Update libsignal-protocol / Update prekey format
Integrates change in prekey object formatting, which now matches more conveniently with the representation rendered by the server. // FREEBIE
This commit is contained in:
parent
6589ec544a
commit
9f871db48a
6 changed files with 49 additions and 105 deletions
|
@ -5,33 +5,27 @@
|
|||
'use strict';
|
||||
|
||||
describe('Device storage', function() {
|
||||
before(function() { localStorage.clear(); });
|
||||
var store = textsecure.storage.protocol;
|
||||
var identifier = '+5558675309';
|
||||
var another_identifier = '+5555590210';
|
||||
var identityKey = {
|
||||
pubKey: textsecure.crypto.getRandomBytes(33),
|
||||
privKey: textsecure.crypto.getRandomBytes(32),
|
||||
};
|
||||
var testKey = {
|
||||
pubKey: textsecure.crypto.getRandomBytes(33),
|
||||
privKey: textsecure.crypto.getRandomBytes(32),
|
||||
};
|
||||
var prekeys, identityKey, testKey;
|
||||
this.timeout(5000);
|
||||
before(function(done) {
|
||||
localStorage.clear();
|
||||
libsignal.util.generateIdentityKeyPair().then(function(identityKey) {
|
||||
return textsecure.storage.protocol.putIdentityKey(identifier, identityKey);
|
||||
}).then(done);
|
||||
});
|
||||
describe('saveKeysToDeviceObject', function() {
|
||||
it('rejects if the identity key changes', function(done) {
|
||||
return textsecure.storage.devices.saveKeysToDeviceObject({
|
||||
identityKey: identityKey.pubKey,
|
||||
identityKey: textsecure.crypto.getRandomBytes(33),
|
||||
encodedNumber: identifier + '.1'
|
||||
}).then(function() {
|
||||
textsecure.storage.devices.saveKeysToDeviceObject({
|
||||
identityKey: testKey.pubKey,
|
||||
encodedNumber: identifier + '.1'
|
||||
}).then(function() {
|
||||
done(new Error('Allowed to overwrite identity key'));
|
||||
}).catch(function(e) {
|
||||
assert.strictEqual(e.message, 'Identity key changed');
|
||||
done();
|
||||
});
|
||||
done(new Error('Allowed to overwrite identity key'));
|
||||
}).catch(function(e) {
|
||||
assert.strictEqual(e.message, 'Identity key changed');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue