From 7939b6ae98c7057e998d476a4f6af120ffd83007 Mon Sep 17 00:00:00 2001 From: lilia Date: Sun, 1 May 2016 15:29:37 -0700 Subject: [PATCH] Remove hasOpenSession from protocol_wrapper // FREEBIE --- js/libtextsecure.js | 10 +++------- libtextsecure/protocol_wrapper.js | 5 ----- libtextsecure/storage/devices.js | 5 +++-- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 3810ce9a..2aa76fa7 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -35501,11 +35501,6 @@ Internal.SessionLock.queueJobForNumber = function queueJobForNumber(number, runJ }, createIdentityKeyRecvSocket: function() { return protocolInstance.createIdentityKeyRecvSocket(); - }, - hasOpenSession: function(encodedNumber) { - return queueJobForNumber(encodedNumber, function() { - return protocolInstance.hasOpenSession(encodedNumber); - }); } }; })(); @@ -35751,8 +35746,9 @@ Internal.SessionLock.queueJobForNumber = function queueJobForNumber(number, runJ } var updateDevices = []; return Promise.all(deviceIds.map(function(deviceId) { - var address = new libsignal.SignalProtocolAddress(number, deviceId).toString(); - return textsecure.protocol_wrapper.hasOpenSession(address).then(function(hasSession) { + var address = new libsignal.SignalProtocolAddress(number, deviceId); + var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address); + return sessionCipher.hasOpenSession().then(function(hasSession) { if (!hasSession) { updateDevices.push(deviceId); } diff --git a/libtextsecure/protocol_wrapper.js b/libtextsecure/protocol_wrapper.js index d82a3296..b2b07a58 100644 --- a/libtextsecure/protocol_wrapper.js +++ b/libtextsecure/protocol_wrapper.js @@ -36,11 +36,6 @@ }, createIdentityKeyRecvSocket: function() { return protocolInstance.createIdentityKeyRecvSocket(); - }, - hasOpenSession: function(encodedNumber) { - return queueJobForNumber(encodedNumber, function() { - return protocolInstance.hasOpenSession(encodedNumber); - }); } }; })(); diff --git a/libtextsecure/storage/devices.js b/libtextsecure/storage/devices.js index 8050c487..a9d68fa0 100644 --- a/libtextsecure/storage/devices.js +++ b/libtextsecure/storage/devices.js @@ -19,8 +19,9 @@ } var updateDevices = []; return Promise.all(deviceIds.map(function(deviceId) { - var address = new libsignal.SignalProtocolAddress(number, deviceId).toString(); - return textsecure.protocol_wrapper.hasOpenSession(address).then(function(hasSession) { + var address = new libsignal.SignalProtocolAddress(number, deviceId); + var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address); + return sessionCipher.hasOpenSession().then(function(hasSession) { if (!hasSession) { updateDevices.push(deviceId); }