From 56238136ca36c19897dfce0a8beeefe30593eb38 Mon Sep 17 00:00:00 2001 From: lilia Date: Wed, 27 Apr 2016 15:54:31 -0700 Subject: [PATCH] Remove trivial wrapper method // FREEBIE --- js/libtextsecure.js | 6 +----- libtextsecure/outgoing_message.js | 2 +- libtextsecure/storage/devices.js | 4 ---- libtextsecure/test/device_storage_test.js | 6 +++--- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 58c68cef..b69a5a12 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -35675,10 +35675,6 @@ libsignal.SessionBuilder = SessionBuilder; window.textsecure.storage = window.textsecure.storage || {}; window.textsecure.storage.devices = { - saveKeysToDeviceObject: function(deviceObject) { - return textsecure.protocol_wrapper.processPreKey(deviceObject); - }, - getStaleDeviceIdsForNumber: function(number) { return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) { if (deviceIds.length === 0) { @@ -37425,7 +37421,7 @@ OutgoingMessage.prototype = { device.identityKey = response.identityKey; device.encodedNumber = number + "." + device.deviceId; if (updateDevices === undefined || updateDevices.indexOf(device.deviceId) > -1) { - return textsecure.storage.devices.saveKeysToDeviceObject(device).catch(function(error) { + return textsecure.protocol_wrapper.processPreKey(device).catch(function(error) { if (error.message === "Identity key changed") { error = new textsecure.OutgoingIdentityKeyError( number, this.message.toArrayBuffer(), diff --git a/libtextsecure/outgoing_message.js b/libtextsecure/outgoing_message.js index c4bc6137..2458a6b1 100644 --- a/libtextsecure/outgoing_message.js +++ b/libtextsecure/outgoing_message.js @@ -55,7 +55,7 @@ OutgoingMessage.prototype = { device.identityKey = response.identityKey; device.encodedNumber = number + "." + device.deviceId; if (updateDevices === undefined || updateDevices.indexOf(device.deviceId) > -1) { - return textsecure.storage.devices.saveKeysToDeviceObject(device).catch(function(error) { + return textsecure.protocol_wrapper.processPreKey(device).catch(function(error) { if (error.message === "Identity key changed") { error = new textsecure.OutgoingIdentityKeyError( number, this.message.toArrayBuffer(), diff --git a/libtextsecure/storage/devices.js b/libtextsecure/storage/devices.js index ba437351..f54afbe0 100644 --- a/libtextsecure/storage/devices.js +++ b/libtextsecure/storage/devices.js @@ -12,10 +12,6 @@ window.textsecure.storage = window.textsecure.storage || {}; window.textsecure.storage.devices = { - saveKeysToDeviceObject: function(deviceObject) { - return textsecure.protocol_wrapper.processPreKey(deviceObject); - }, - getStaleDeviceIdsForNumber: function(number) { return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) { if (deviceIds.length === 0) { diff --git a/libtextsecure/test/device_storage_test.js b/libtextsecure/test/device_storage_test.js index 1727f146..92cd4abe 100644 --- a/libtextsecure/test/device_storage_test.js +++ b/libtextsecure/test/device_storage_test.js @@ -4,7 +4,7 @@ 'use strict'; -describe('Device storage', function() { +describe('Protocol Wrapper', function() { var store = textsecure.storage.protocol; var identifier = '+5558675309'; var another_identifier = '+5555590210'; @@ -16,9 +16,9 @@ describe('Device storage', function() { return textsecure.storage.protocol.putIdentityKey(identifier, identityKey); }).then(done); }); - describe('saveKeysToDeviceObject', function() { + describe('processPreKey', function() { it('rejects if the identity key changes', function(done) { - return textsecure.storage.devices.saveKeysToDeviceObject({ + return textsecure.protocol_wrapper.processPreKey({ identityKey: textsecure.crypto.getRandomBytes(33), encodedNumber: identifier + '.1' }).then(function() {