Fix tests

// FREEBIE
This commit is contained in:
lilia
2017-05-26 17:39:20 -07:00
committed by Scott Nonnenberg
parent f095a1583e
commit 2584f4fae4
4 changed files with 15 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ function SignalProtocolStore() {
}
SignalProtocolStore.prototype = {
Direction: { SENDING: 1, RECEIVING: 2},
getIdentityKeyPair: function() {
return Promise.resolve(this.get('identityKey'));
},
@@ -53,7 +54,13 @@ SignalProtocolStore.prototype = {
if (identifier === null || identifier === undefined)
throw new Error("Tried to put identity key for undefined/null key");
return new Promise(function(resolve) {
resolve(this.put('identityKey' + identifier, identityKey));
var existing = this.get('identityKey' + identifier);
this.put('identityKey' + identifier, identityKey);
if (existing && existing !== identityKey) {
resolve(true);
} else {
resolve(false);
}
}.bind(this));
},