Dedupe methods

Define textsecure.crypto in terms of libsignal.crypto.

// FREEBIE
This commit is contained in:
lilia 2016-05-07 17:49:45 -07:00
parent 58452066aa
commit f8e176fd40
9 changed files with 35 additions and 107 deletions

View file

@ -13,12 +13,12 @@ describe("SignalProtocolStore", function() {
var store = textsecure.storage.protocol;
var identifier = '+5558675309';
var identityKey = {
pubKey: textsecure.crypto.getRandomBytes(33),
privKey: textsecure.crypto.getRandomBytes(32),
pubKey: libsignal.crypto.getRandomBytes(33),
privKey: libsignal.crypto.getRandomBytes(32),
};
var testKey = {
pubKey: textsecure.crypto.getRandomBytes(33),
privKey: textsecure.crypto.getRandomBytes(32),
pubKey: libsignal.crypto.getRandomBytes(33),
privKey: libsignal.crypto.getRandomBytes(32),
};
describe('getLocalRegistrationId', function() {
it('retrieves my registration id', function(done) {
@ -44,7 +44,7 @@ describe("SignalProtocolStore", function() {
}).then(done,done);
});
it('rejects on key change', function(done) {
var newIdentity = textsecure.crypto.getRandomBytes(33);
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'));
@ -68,7 +68,7 @@ describe("SignalProtocolStore", function() {
});
});
it('returns false if a key is untrusted', function(done) {
var newIdentity = textsecure.crypto.getRandomBytes(33);
var newIdentity = libsignal.crypto.getRandomBytes(33);
store.saveIdentity(identifier, testKey.pubKey).then(function() {
store.isTrustedIdentity(identifier, newIdentity).then(function(trusted) {
if (trusted) {