mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-24 18:38:15 +01:00
Tests for isTrustedIdentity
// FREEBIE
This commit is contained in:
@@ -37,6 +37,30 @@ describe("SignalProtocolStore", function() {
|
||||
});
|
||||
}).then(done,done);
|
||||
});
|
||||
it('returns whether a key is trusted', function(done) {
|
||||
var newIdentity = textsecure.crypto.getRandomBytes(33);
|
||||
store.putIdentityKey(identifier, testKey.pubKey).then(function() {
|
||||
store.isTrustedIdentity(identifier, newIdentity).then(function(trusted) {
|
||||
if (trusted) {
|
||||
done(new Error('Allowed to overwrite identity key'));
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
}).catch(done);
|
||||
});
|
||||
});
|
||||
it('returns whether a key is untrusted', function(done) {
|
||||
var newIdentity = textsecure.crypto.getRandomBytes(33);
|
||||
store.putIdentityKey(identifier, testKey.pubKey).then(function() {
|
||||
store.isTrustedIdentity(identifier, testKey.pubKey).then(function(trusted) {
|
||||
if (trusted) {
|
||||
done();
|
||||
} else {
|
||||
done(new Error('Allowed to overwrite identity key'));
|
||||
}
|
||||
}).catch(done);
|
||||
});
|
||||
});
|
||||
it('stores prekeys', function(done) {
|
||||
store.storePreKey(1, testKey).then(function() {
|
||||
return store.loadPreKey(1).then(function(key) {
|
||||
|
||||
Reference in New Issue
Block a user