Add isTrustedIdentity to SignalProtocolStore
Adds a new required storage method for the protocol library. // FREEBIE
This commit is contained in:
parent
0dc5a0488c
commit
e659104cbf
2 changed files with 26 additions and 0 deletions
|
@ -250,6 +250,19 @@
|
|||
});
|
||||
|
||||
},
|
||||
isTrustedIdentity: function(identifier, publicKey) {
|
||||
if (identifier === null || identifier === undefined) {
|
||||
throw new Error("Tried to get identity key for undefined/null key");
|
||||
}
|
||||
var number = textsecure.utils.unencodeNumber(identifier)[0];
|
||||
return new Promise(function(resolve) {
|
||||
var identityKey = new IdentityKey({id: number});
|
||||
identityKey.fetch().always(function() {
|
||||
var oldpublicKey = identityKey.get('publicKey');
|
||||
resolve(!oldpublicKey || equalArrayBuffers(oldpublicKey, publicKey));
|
||||
});
|
||||
});
|
||||
},
|
||||
loadIdentityKey: function(identifier) {
|
||||
if (identifier === null || identifier === undefined) {
|
||||
throw new Error("Tried to get identity key for undefined/null key");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue