Delete entry with a wrong signature

This commit is contained in:
Gustavo Cortez 2014-07-07 01:57:25 -03:00
parent 313fcd4808
commit c83e0c73da
2 changed files with 10 additions and 1 deletions

View File

@ -194,6 +194,9 @@ angular.module('copayApp.controllers').controller('SendController',
var w = $rootScope.wallet;
var sign = w.verifySignAddressBook(key);
$scope.signAddressBook[key] = sign;
if (!sign) {
notification.error('Wrong signature', 'Entry of Addressbooks was deleted');
}
}, 10);
}
};

View File

@ -861,7 +861,13 @@ Wallet.prototype.verifySignAddressBook = function(key) {
copayerId: this.addressBook[key].copayerId,
createdTs: this.addressBook[key].createdTs
};
return this.verifySignedObject(payload, signature);
var sign = this.verifySignedObject(payload, signature);
if (!sign) {
// remove wrong signed entry
delete this.addressBook[key];
this.store();
}
return sign;
}
}