Add identity key conflict tests

This commit is contained in:
lilia 2015-07-22 12:48:08 -07:00
parent c05be725b3
commit 17e515f886
4 changed files with 64 additions and 2 deletions

View file

@ -50,6 +50,17 @@ describe("AxolotlStore", function() {
});
}).then(done,done);
});
it('rejects on key change', function(done) {
var newIdentity = textsecure.crypto.getRandomBytes(33);
store.putIdentityKey(identifier, testKey.pubKey).then(function() {
store.putIdentityKey(identifier, newIdentity).then(function() {
done(new Error('Allowed to overwrite identity key'));
}).catch(function(e) {
assert(e instanceof Error);
done();
});
});
});
it('stores prekeys', function(done) {
store.putPreKey(1, testKey).then(function() {
return store.getPreKey(1).then(function(key) {