|
|
@ -35297,7 +35297,7 @@ Internal.RecipientRecord = function() {
|
|
|
|
window.textsecure.storage = window.textsecure.storage || {};
|
|
|
|
window.textsecure.storage = window.textsecure.storage || {};
|
|
|
|
|
|
|
|
|
|
|
|
textsecure.storage.axolotl = new SignalProtocolStore();
|
|
|
|
textsecure.storage.axolotl = new SignalProtocolStore();
|
|
|
|
var axolotlInstance = axolotl.protocol(textsecure.storage.axolotl);
|
|
|
|
var protocolInstance = axolotl.protocol(textsecure.storage.axolotl);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* jobQueue manages multiple queues indexed by device to serialize
|
|
|
|
* jobQueue manages multiple queues indexed by device to serialize
|
|
|
@ -35320,36 +35320,36 @@ Internal.RecipientRecord = function() {
|
|
|
|
window.textsecure.protocol_wrapper = {
|
|
|
|
window.textsecure.protocol_wrapper = {
|
|
|
|
decryptWhisperMessage: function(fromAddress, blob) {
|
|
|
|
decryptWhisperMessage: function(fromAddress, blob) {
|
|
|
|
return queueJobForNumber(fromAddress, function() {
|
|
|
|
return queueJobForNumber(fromAddress, function() {
|
|
|
|
return axolotlInstance.decryptWhisperMessage(fromAddress, blob.toArrayBuffer());
|
|
|
|
return protocolInstance.decryptWhisperMessage(fromAddress, blob.toArrayBuffer());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
closeOpenSessionForDevice: function(encodedNumber) {
|
|
|
|
closeOpenSessionForDevice: function(encodedNumber) {
|
|
|
|
return queueJobForNumber(encodedNumber, function() {
|
|
|
|
return queueJobForNumber(encodedNumber, function() {
|
|
|
|
return axolotlInstance.closeOpenSessionForDevice(encodedNumber);
|
|
|
|
return protocolInstance.closeOpenSessionForDevice(encodedNumber);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
encryptMessageFor: function(deviceObject, pushMessageContent) {
|
|
|
|
encryptMessageFor: function(deviceObject, pushMessageContent) {
|
|
|
|
return queueJobForNumber(deviceObject.encodedNumber, function() {
|
|
|
|
return queueJobForNumber(deviceObject.encodedNumber, function() {
|
|
|
|
return axolotlInstance.encryptMessageFor(deviceObject, pushMessageContent);
|
|
|
|
return protocolInstance.encryptMessageFor(deviceObject, pushMessageContent);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
startWorker: function() {
|
|
|
|
startWorker: function() {
|
|
|
|
axolotlInstance.startWorker('/js/libsignal-protocol-worker.js');
|
|
|
|
protocolInstance.startWorker('/js/libsignal-protocol-worker.js');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
stopWorker: function() {
|
|
|
|
stopWorker: function() {
|
|
|
|
axolotlInstance.stopWorker();
|
|
|
|
protocolInstance.stopWorker();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
createIdentityKeyRecvSocket: function() {
|
|
|
|
createIdentityKeyRecvSocket: function() {
|
|
|
|
return axolotlInstance.createIdentityKeyRecvSocket();
|
|
|
|
return protocolInstance.createIdentityKeyRecvSocket();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
hasOpenSession: function(encodedNumber) {
|
|
|
|
hasOpenSession: function(encodedNumber) {
|
|
|
|
return queueJobForNumber(encodedNumber, function() {
|
|
|
|
return queueJobForNumber(encodedNumber, function() {
|
|
|
|
return axolotlInstance.hasOpenSession(encodedNumber);
|
|
|
|
return protocolInstance.hasOpenSession(encodedNumber);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
getRegistrationId: function(encodedNumber) {
|
|
|
|
getRegistrationId: function(encodedNumber) {
|
|
|
|
return queueJobForNumber(encodedNumber, function() {
|
|
|
|
return queueJobForNumber(encodedNumber, function() {
|
|
|
|
return axolotlInstance.getRegistrationId(encodedNumber);
|
|
|
|
return protocolInstance.getRegistrationId(encodedNumber);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
handlePreKeyWhisperMessage: function(from, blob) {
|
|
|
|
handlePreKeyWhisperMessage: function(from, blob) {
|
|
|
@ -35361,7 +35361,7 @@ Internal.RecipientRecord = function() {
|
|
|
|
throw new Error("Incompatible version byte");
|
|
|
|
throw new Error("Incompatible version byte");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return queueJobForNumber(from, function() {
|
|
|
|
return queueJobForNumber(from, function() {
|
|
|
|
return axolotlInstance.handlePreKeyWhisperMessage(from, blob).catch(function(e) {
|
|
|
|
return protocolInstance.handlePreKeyWhisperMessage(from, blob).catch(function(e) {
|
|
|
|
if (e.message === 'Unknown identity key') {
|
|
|
|
if (e.message === 'Unknown identity key') {
|
|
|
|
blob.reset(); // restore the version byte.
|
|
|
|
blob.reset(); // restore the version byte.
|
|
|
|
|
|
|
|
|
|
|
|