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

@ -10,12 +10,12 @@ describe("SignalProtocolStore", function() {
var identifier = '+5558675309';
var another_identifier = '+5555590210';
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),
};
it('retrieves my registration id', function(done) {
store.put('registrationId', 1337);
@ -38,7 +38,7 @@ describe("SignalProtocolStore", function() {
}).then(done,done);
});
it('returns whether a key is trusted', 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) {
@ -50,7 +50,7 @@ describe("SignalProtocolStore", function() {
});
});
it('returns whether 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, testKey.pubKey).then(function(trusted) {
if (trusted) {