|
|
|
@ -35493,13 +35493,6 @@ Internal.SessionLock.queueJobForNumber = function queueJobForNumber(number, runJ
|
|
|
|
|
|
|
|
|
|
window.textsecure = window.textsecure || {};
|
|
|
|
|
window.textsecure.protocol_wrapper = {
|
|
|
|
|
decryptWhisperMessage: function(fromAddress, message) {
|
|
|
|
|
return queueJobForNumber(fromAddress, function() {
|
|
|
|
|
var address = libsignal.SignalProtocolAddress.fromString(fromAddress);
|
|
|
|
|
var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address);
|
|
|
|
|
return sessionCipher.decryptWhisperMessage(message.toArrayBuffer());
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
closeOpenSessionForDevice: function(encodedNumber) {
|
|
|
|
|
return queueJobForNumber(encodedNumber, function() {
|
|
|
|
|
return protocolInstance.closeOpenSessionForDevice(encodedNumber);
|
|
|
|
@ -37134,9 +37127,11 @@ MessageReceiver.prototype.extend({
|
|
|
|
|
decrypt: function(envelope, ciphertext) {
|
|
|
|
|
var fromAddress = [envelope.source , (envelope.sourceDevice || 0)].join('.');
|
|
|
|
|
var promise;
|
|
|
|
|
var address = new libsignal.SignalProtocolAddress(envelope.source, envelope.sourceDevice);
|
|
|
|
|
var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address);
|
|
|
|
|
switch(envelope.type) {
|
|
|
|
|
case textsecure.protobuf.Envelope.Type.CIPHERTEXT:
|
|
|
|
|
promise = textsecure.protocol_wrapper.decryptWhisperMessage(fromAddress, ciphertext);
|
|
|
|
|
promise = sessionCipher.decryptWhisperMessage(ciphertext.toArrayBuffer());
|
|
|
|
|
break;
|
|
|
|
|
case textsecure.protobuf.Envelope.Type.PREKEY_BUNDLE:
|
|
|
|
|
promise = textsecure.protocol_wrapper.handlePreKeyWhisperMessage(fromAddress, ciphertext);
|
|
|
|
|