Add identity key conflict tests

This commit is contained in:
lilia 2015-07-22 12:48:08 -07:00
parent c05be725b3
commit 17e515f886
4 changed files with 64 additions and 2 deletions

View file

@ -259,7 +259,7 @@
publicKey = convertToArrayBuffer(publicKey);
}
var number = textsecure.utils.unencodeNumber(identifier)[0];
return new Promise(function(resolve) {
return new Promise(function(resolve, reject) {
var identityKey = new IdentityKey({id: number});
identityKey.fetch().always(function() {
var oldpublicKey = identityKey.get('publicKey');
@ -271,7 +271,7 @@
if (equalArrayBuffers(oldpublicKey, publicKey)) {
resolve();
} else {
throw new Error("Attempted to overwrite a different identity key");
reject(new Error("Attempted to overwrite a different identity key"));
}
}
});