Remove trivial wrapper method

// FREEBIE
This commit is contained in:
lilia 2016-04-27 15:54:31 -07:00
parent 78cdc0cb52
commit 56238136ca
4 changed files with 5 additions and 13 deletions

View file

@ -35675,10 +35675,6 @@ libsignal.SessionBuilder = SessionBuilder;
window.textsecure.storage = window.textsecure.storage || {}; window.textsecure.storage = window.textsecure.storage || {};
window.textsecure.storage.devices = { window.textsecure.storage.devices = {
saveKeysToDeviceObject: function(deviceObject) {
return textsecure.protocol_wrapper.processPreKey(deviceObject);
},
getStaleDeviceIdsForNumber: function(number) { getStaleDeviceIdsForNumber: function(number) {
return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) { return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) {
if (deviceIds.length === 0) { if (deviceIds.length === 0) {
@ -37425,7 +37421,7 @@ OutgoingMessage.prototype = {
device.identityKey = response.identityKey; device.identityKey = response.identityKey;
device.encodedNumber = number + "." + device.deviceId; device.encodedNumber = number + "." + device.deviceId;
if (updateDevices === undefined || updateDevices.indexOf(device.deviceId) > -1) { 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") { if (error.message === "Identity key changed") {
error = new textsecure.OutgoingIdentityKeyError( error = new textsecure.OutgoingIdentityKeyError(
number, this.message.toArrayBuffer(), number, this.message.toArrayBuffer(),

View file

@ -55,7 +55,7 @@ OutgoingMessage.prototype = {
device.identityKey = response.identityKey; device.identityKey = response.identityKey;
device.encodedNumber = number + "." + device.deviceId; device.encodedNumber = number + "." + device.deviceId;
if (updateDevices === undefined || updateDevices.indexOf(device.deviceId) > -1) { 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") { if (error.message === "Identity key changed") {
error = new textsecure.OutgoingIdentityKeyError( error = new textsecure.OutgoingIdentityKeyError(
number, this.message.toArrayBuffer(), number, this.message.toArrayBuffer(),

View file

@ -12,10 +12,6 @@
window.textsecure.storage = window.textsecure.storage || {}; window.textsecure.storage = window.textsecure.storage || {};
window.textsecure.storage.devices = { window.textsecure.storage.devices = {
saveKeysToDeviceObject: function(deviceObject) {
return textsecure.protocol_wrapper.processPreKey(deviceObject);
},
getStaleDeviceIdsForNumber: function(number) { getStaleDeviceIdsForNumber: function(number) {
return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) { return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) {
if (deviceIds.length === 0) { if (deviceIds.length === 0) {

View file

@ -4,7 +4,7 @@
'use strict'; 'use strict';
describe('Device storage', function() { describe('Protocol Wrapper', function() {
var store = textsecure.storage.protocol; var store = textsecure.storage.protocol;
var identifier = '+5558675309'; var identifier = '+5558675309';
var another_identifier = '+5555590210'; var another_identifier = '+5555590210';
@ -16,9 +16,9 @@ describe('Device storage', function() {
return textsecure.storage.protocol.putIdentityKey(identifier, identityKey); return textsecure.storage.protocol.putIdentityKey(identifier, identityKey);
}).then(done); }).then(done);
}); });
describe('saveKeysToDeviceObject', function() { describe('processPreKey', function() {
it('rejects if the identity key changes', function(done) { it('rejects if the identity key changes', function(done) {
return textsecure.storage.devices.saveKeysToDeviceObject({ return textsecure.protocol_wrapper.processPreKey({
identityKey: textsecure.crypto.getRandomBytes(33), identityKey: textsecure.crypto.getRandomBytes(33),
encodedNumber: identifier + '.1' encodedNumber: identifier + '.1'
}).then(function() { }).then(function() {