Update saveIdentity

Add support new blockingApproval and nonblockingApproval arguments
Populate the firstUse property on identity key records
Return whether an existing record was overwritten.

References
https://github.com/WhisperSystems/Signal-Android/commit/39d4a7#diff-69ede72c549da6bcbcd959935995b7e9R45

// FREEBIE
This commit is contained in:
lilia 2017-05-24 13:54:14 -07:00 committed by Scott Nonnenberg
parent 4d4dd3341f
commit 82469713d2
2 changed files with 38 additions and 16 deletions

View file

@ -43,16 +43,14 @@ describe("SignalProtocolStore", function() {
});
}).then(done,done);
});
it('rejects on key change', function(done) {
it('returns true on key change', function(done) {
var newIdentity = libsignal.crypto.getRandomBytes(33);
store.saveIdentity(identifier, testKey.pubKey).then(function() {
store.saveIdentity(identifier, newIdentity).then(function() {
done(new Error('Allowed to overwrite identity key'));
}).catch(function(e) {
assert(e instanceof Error);
store.saveIdentity(identifier, newIdentity).then(function(changed) {
assert.isTrue(changed);
done();
});
});
}).catch(done);
});
});
describe('isTrustedIdentity', function() {