Add identity key conflict tests
This commit is contained in:
parent
c05be725b3
commit
17e515f886
4 changed files with 64 additions and 2 deletions
|
@ -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"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue