Now we've got everything prettified!
This commit is contained in:
parent
754d65ae2e
commit
a0ed993b42
30 changed files with 3562 additions and 2873 deletions
|
@ -1,32 +1,40 @@
|
|||
'use strict';
|
||||
|
||||
describe('Protocol Wrapper', function() {
|
||||
var store = textsecure.storage.protocol;
|
||||
var identifier = '+5558675309';
|
||||
var another_identifier = '+5555590210';
|
||||
var prekeys, identityKey, testKey;
|
||||
this.timeout(5000);
|
||||
before(function(done) {
|
||||
localStorage.clear();
|
||||
libsignal.KeyHelper.generateIdentityKeyPair().then(function(identityKey) {
|
||||
return textsecure.storage.protocol.saveIdentity(identifier, identityKey);
|
||||
}).then(function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
describe('processPreKey', function() {
|
||||
it('rejects if the identity key changes', function(done) {
|
||||
var address = new libsignal.SignalProtocolAddress(identifier, 1);
|
||||
var builder = new libsignal.SessionBuilder(store, address);
|
||||
return builder.processPreKey({
|
||||
identityKey: textsecure.crypto.getRandomBytes(33),
|
||||
encodedNumber: address.toString()
|
||||
}).then(function() {
|
||||
done(new Error('Allowed to overwrite identity key'));
|
||||
}).catch(function(e) {
|
||||
assert.strictEqual(e.message, 'Identity key changed');
|
||||
done();
|
||||
});
|
||||
var store = textsecure.storage.protocol;
|
||||
var identifier = '+5558675309';
|
||||
var another_identifier = '+5555590210';
|
||||
var prekeys, identityKey, testKey;
|
||||
this.timeout(5000);
|
||||
before(function(done) {
|
||||
localStorage.clear();
|
||||
libsignal.KeyHelper.generateIdentityKeyPair()
|
||||
.then(function(identityKey) {
|
||||
return textsecure.storage.protocol.saveIdentity(
|
||||
identifier,
|
||||
identityKey
|
||||
);
|
||||
})
|
||||
.then(function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
describe('processPreKey', function() {
|
||||
it('rejects if the identity key changes', function(done) {
|
||||
var address = new libsignal.SignalProtocolAddress(identifier, 1);
|
||||
var builder = new libsignal.SessionBuilder(store, address);
|
||||
return builder
|
||||
.processPreKey({
|
||||
identityKey: textsecure.crypto.getRandomBytes(33),
|
||||
encodedNumber: address.toString(),
|
||||
})
|
||||
.then(function() {
|
||||
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