Rename axolotl storage

// FREEBIE
pull/749/head
lilia 9 years ago
parent ee3bc11e3c
commit 1d60dc38fb

@ -35296,8 +35296,8 @@ Internal.RecipientRecord = function() {
window.textsecure = window.textsecure || {}; window.textsecure = window.textsecure || {};
window.textsecure.storage = window.textsecure.storage || {}; window.textsecure.storage = window.textsecure.storage || {};
textsecure.storage.axolotl = new SignalProtocolStore(); textsecure.storage.protocol = new SignalProtocolStore();
var protocolInstance = axolotl.protocol(textsecure.storage.axolotl); var protocolInstance = axolotl.protocol(textsecure.storage.protocol);
/* /*
* jobQueue manages multiple queues indexed by device to serialize * jobQueue manages multiple queues indexed by device to serialize
@ -35614,14 +35614,14 @@ Internal.RecipientRecord = function() {
window.textsecure.storage.devices = { window.textsecure.storage.devices = {
saveKeysToDeviceObject: function(deviceObject) { saveKeysToDeviceObject: function(deviceObject) {
var number = textsecure.utils.unencodeNumber(deviceObject.encodedNumber)[0]; var number = textsecure.utils.unencodeNumber(deviceObject.encodedNumber)[0];
return textsecure.storage.axolotl.loadIdentityKey(number).then(function(identityKey) { return textsecure.storage.protocol.loadIdentityKey(number).then(function(identityKey) {
if (identityKey !== undefined && deviceObject.identityKey !== undefined && getString(identityKey) != getString(deviceObject.identityKey)) { if (identityKey !== undefined && deviceObject.identityKey !== undefined && getString(identityKey) != getString(deviceObject.identityKey)) {
var error = new Error("Identity key changed"); var error = new Error("Identity key changed");
error.identityKey = deviceObject.identityKey; error.identityKey = deviceObject.identityKey;
throw error; throw error;
} }
return textsecure.storage.axolotl.putIdentityKey(number, deviceObject.identityKey).then(function() { return textsecure.storage.protocol.putIdentityKey(number, deviceObject.identityKey).then(function() {
tempKeys[deviceObject.encodedNumber] = { tempKeys[deviceObject.encodedNumber] = {
preKey: deviceObject.preKey, preKey: deviceObject.preKey,
preKeyId: deviceObject.preKeyId, preKeyId: deviceObject.preKeyId,
@ -35640,7 +35640,7 @@ Internal.RecipientRecord = function() {
}, },
getStaleDeviceIdsForNumber: function(number) { getStaleDeviceIdsForNumber: function(number) {
return textsecure.storage.axolotl.getDeviceIds(number).then(function(deviceIds) { return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) {
if (deviceIds.length === 0) { if (deviceIds.length === 0) {
return [1]; return [1];
} }
@ -35658,11 +35658,11 @@ Internal.RecipientRecord = function() {
}); });
}, },
getDeviceObjectsForNumber: function(number) { getDeviceObjectsForNumber: function(number) {
return textsecure.storage.axolotl.loadIdentityKey(number).then(function(identityKey) { return textsecure.storage.protocol.loadIdentityKey(number).then(function(identityKey) {
if (identityKey === undefined) { if (identityKey === undefined) {
return []; return [];
} }
return textsecure.storage.axolotl.getDeviceIds(number).then(function(deviceIds) { return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) {
// Add pending devices from tempKeys // Add pending devices from tempKeys
for (var encodedNumber in tempKeys) { for (var encodedNumber in tempKeys) {
var deviceNumber = textsecure.utils.unencodeNumber(encodedNumber)[0]; var deviceNumber = textsecure.utils.unencodeNumber(encodedNumber)[0];
@ -35693,7 +35693,7 @@ Internal.RecipientRecord = function() {
promise = promise.then(function() { promise = promise.then(function() {
var encodedNumber = number + "." + deviceIdsToRemove[j]; var encodedNumber = number + "." + deviceIdsToRemove[j];
delete tempKeys[encodedNumber]; delete tempKeys[encodedNumber];
return textsecure.storage.axolotl.removeSession(encodedNumber); return textsecure.storage.protocol.removeSession(encodedNumber);
}); });
} }
return promise; return promise;
@ -35717,7 +35717,7 @@ Internal.RecipientRecord = function() {
// create a random group id that we haven't seen before. // create a random group id that we haven't seen before.
function generateNewGroupId() { function generateNewGroupId() {
var groupId = getString(textsecure.crypto.getRandomBytes(16)); var groupId = getString(textsecure.crypto.getRandomBytes(16));
return textsecure.storage.axolotl.getGroup(groupId).then(function(group) { return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
if (group === undefined) { if (group === undefined) {
return groupId; return groupId;
} else { } else {
@ -35732,7 +35732,7 @@ Internal.RecipientRecord = function() {
var groupId = groupId; var groupId = groupId;
return new Promise(function(resolve) { return new Promise(function(resolve) {
if (groupId !== undefined) { if (groupId !== undefined) {
resolve(textsecure.storage.axolotl.getGroup(groupId).then(function(group) { resolve(textsecure.storage.protocol.getGroup(groupId).then(function(group) {
if (group !== undefined) { if (group !== undefined) {
throw new Error("Tried to recreate group"); throw new Error("Tried to recreate group");
} }
@ -35763,14 +35763,14 @@ Internal.RecipientRecord = function() {
for (var i in finalNumbers) for (var i in finalNumbers)
groupObject.numberRegistrationIds[finalNumbers[i]] = {}; groupObject.numberRegistrationIds[finalNumbers[i]] = {};
return textsecure.storage.axolotl.putGroup(groupId, groupObject).then(function() { return textsecure.storage.protocol.putGroup(groupId, groupObject).then(function() {
return {id: groupId, numbers: finalNumbers}; return {id: groupId, numbers: finalNumbers};
}); });
}); });
}, },
getNumbers: function(groupId) { getNumbers: function(groupId) {
return textsecure.storage.axolotl.getGroup(groupId).then(function(group) { return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
if (group === undefined) if (group === undefined)
return undefined; return undefined;
@ -35779,7 +35779,7 @@ Internal.RecipientRecord = function() {
}, },
removeNumber: function(groupId, number) { removeNumber: function(groupId, number) {
return textsecure.storage.axolotl.getGroup(groupId).then(function(group) { return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
if (group === undefined) if (group === undefined)
return undefined; return undefined;
@ -35791,7 +35791,7 @@ Internal.RecipientRecord = function() {
if (i > -1) { if (i > -1) {
group.numbers.splice(i, 1); group.numbers.splice(i, 1);
delete group.numberRegistrationIds[number]; delete group.numberRegistrationIds[number];
return textsecure.storage.axolotl.putGroup(groupId, group).then(function() { return textsecure.storage.protocol.putGroup(groupId, group).then(function() {
return group.numbers; return group.numbers;
}); });
} }
@ -35801,7 +35801,7 @@ Internal.RecipientRecord = function() {
}, },
addNumbers: function(groupId, numbers) { addNumbers: function(groupId, numbers) {
return textsecure.storage.axolotl.getGroup(groupId).then(function(group) { return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
if (group === undefined) if (group === undefined)
return undefined; return undefined;
@ -35815,18 +35815,18 @@ Internal.RecipientRecord = function() {
} }
} }
return textsecure.storage.axolotl.putGroup(groupId, group).then(function() { return textsecure.storage.protocol.putGroup(groupId, group).then(function() {
return group.numbers; return group.numbers;
}); });
}); });
}, },
deleteGroup: function(groupId) { deleteGroup: function(groupId) {
return textsecure.storage.axolotl.removeGroup(groupId); return textsecure.storage.protocol.removeGroup(groupId);
}, },
getGroup: function(groupId) { getGroup: function(groupId) {
return textsecure.storage.axolotl.getGroup(groupId).then(function(group) { return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
if (group === undefined) if (group === undefined)
return undefined; return undefined;
@ -35835,7 +35835,7 @@ Internal.RecipientRecord = function() {
}, },
updateNumbers: function(groupId, numbers) { updateNumbers: function(groupId, numbers) {
return textsecure.storage.axolotl.getGroup(groupId).then(function(group) { return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
if (group === undefined) if (group === undefined)
throw new Error("Tried to update numbers for unknown group"); throw new Error("Tried to update numbers for unknown group");
@ -35859,7 +35859,7 @@ Internal.RecipientRecord = function() {
}, },
needUpdateByDeviceRegistrationId: function(groupId, number, encodedNumber, registrationId) { needUpdateByDeviceRegistrationId: function(groupId, number, encodedNumber, registrationId) {
return textsecure.storage.axolotl.getGroup(groupId).then(function(group) { return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
if (group === undefined) if (group === undefined)
throw new Error("Unknown group for device registration id"); throw new Error("Unknown group for device registration id");
@ -35871,7 +35871,7 @@ Internal.RecipientRecord = function() {
var needUpdate = group.numberRegistrationIds[number][encodedNumber] !== undefined; var needUpdate = group.numberRegistrationIds[number][encodedNumber] !== undefined;
group.numberRegistrationIds[number][encodedNumber] = registrationId; group.numberRegistrationIds[number][encodedNumber] = registrationId;
return textsecure.storage.axolotl.putGroup(groupId, group).then(function() { return textsecure.storage.protocol.putGroup(groupId, group).then(function() {
return needUpdate; return needUpdate;
}); });
}); });
@ -36813,7 +36813,7 @@ var TextSecureServer = (function() {
return this.server.confirmCode( return this.server.confirmCode(
number, verificationCode, password, signalingKey, registrationId, deviceName number, verificationCode, password, signalingKey, registrationId, deviceName
).then(function(response) { ).then(function(response) {
return textsecure.storage.axolotl.clearSessionStore().then(function() { return textsecure.storage.protocol.clearSessionStore().then(function() {
textsecure.storage.remove('identityKey'); textsecure.storage.remove('identityKey');
textsecure.storage.remove('signaling_key'); textsecure.storage.remove('signaling_key');
textsecure.storage.remove('password'); textsecure.storage.remove('password');
@ -36824,10 +36824,10 @@ var TextSecureServer = (function() {
// update our own identity key, which may have changed // update our own identity key, which may have changed
// if we're relinking after a reinstall on the master device // if we're relinking after a reinstall on the master device
var putIdentity = textsecure.storage.axolotl.putIdentityKey.bind( var putIdentity = textsecure.storage.protocol.putIdentityKey.bind(
null, number, identityKeyPair.pubKey null, number, identityKeyPair.pubKey
); );
textsecure.storage.axolotl.removeIdentityKey(number).then(putIdentity, putIdentity); textsecure.storage.protocol.removeIdentityKey(number).then(putIdentity, putIdentity);
textsecure.storage.put('identityKey', identityKeyPair); textsecure.storage.put('identityKey', identityKeyPair);
textsecure.storage.put('signaling_key', signalingKey); textsecure.storage.put('signaling_key', signalingKey);
@ -36855,7 +36855,7 @@ var TextSecureServer = (function() {
} }
var store = textsecure.storage.axolotl; var store = textsecure.storage.protocol;
return store.getIdentityKeyPair().then(function(identityKey) { return store.getIdentityKeyPair().then(function(identityKey) {
var result = { preKeys: [], identityKey: identityKey.pubKey }; var result = { preKeys: [], identityKey: identityKey.pubKey };
var promises = []; var promises = [];

@ -402,8 +402,8 @@
throw 'No conflicts to resolve'; throw 'No conflicts to resolve';
} }
return textsecure.storage.axolotl.removeIdentityKey(number).then(function() { return textsecure.storage.protocol.removeIdentityKey(number).then(function() {
return textsecure.storage.axolotl.putIdentityKey(number, identityKey).then(function() { return textsecure.storage.protocol.putIdentityKey(number, identityKey).then(function() {
var promise = Promise.resolve(); var promise = Promise.resolve();
this.messageCollection.each(function(message) { this.messageCollection.each(function(message) {
if (message.hasKeyConflict(number)) { if (message.hasKeyConflict(number)) {

@ -292,7 +292,7 @@
}).fail(function() { }).fail(function() {
reject(new Error("Tried to remove identity for unknown number")); reject(new Error("Tried to remove identity for unknown number"));
}); });
resolve(textsecure.storage.axolotl.removeAllSessions(number)); resolve(textsecure.storage.protocol.removeAllSessions(number));
}); });
}, },
getGroup: function(groupId) { getGroup: function(groupId) {

@ -170,8 +170,8 @@
if (this.model.isPrivate()) { if (this.model.isPrivate()) {
var their_number = this.model.id; var their_number = this.model.id;
var our_number = textsecure.storage.user.getNumber(); var our_number = textsecure.storage.user.getNumber();
textsecure.storage.axolotl.loadIdentityKey(their_number).then(function(their_key) { textsecure.storage.protocol.loadIdentityKey(their_number).then(function(their_key) {
textsecure.storage.axolotl.loadIdentityKey(our_number).then(function(our_key) { textsecure.storage.protocol.loadIdentityKey(our_number).then(function(our_key) {
var view = new Whisper.KeyVerificationPanelView({ var view = new Whisper.KeyVerificationPanelView({
model: { their_key: their_key, your_key: our_key } model: { their_key: their_key, your_key: our_key }
}).render(); }).render();

@ -12,11 +12,11 @@
initialize: function(options) { initialize: function(options) {
this.contact = options.contact; this.contact = options.contact;
this.conversation = options.conversation; this.conversation = options.conversation;
textsecure.storage.axolotl.loadIdentityKey(textsecure.storage.user.getNumber()).then(function(our_key) { textsecure.storage.protocol.loadIdentityKey(textsecure.storage.user.getNumber()).then(function(our_key) {
this.your_key = our_key; this.your_key = our_key;
this.render(); this.render();
}.bind(this)); }.bind(this));
textsecure.storage.axolotl.loadIdentityKey(textsecure.storage.user.getNumber()).then(function(our_key) { textsecure.storage.protocol.loadIdentityKey(textsecure.storage.user.getNumber()).then(function(our_key) {
var view = new Whisper.KeyVerificationView({ var view = new Whisper.KeyVerificationView({
model: { model: {
their_key : this.model.identityKey, their_key : this.model.identityKey,

@ -98,7 +98,7 @@
return this.server.confirmCode( return this.server.confirmCode(
number, verificationCode, password, signalingKey, registrationId, deviceName number, verificationCode, password, signalingKey, registrationId, deviceName
).then(function(response) { ).then(function(response) {
return textsecure.storage.axolotl.clearSessionStore().then(function() { return textsecure.storage.protocol.clearSessionStore().then(function() {
textsecure.storage.remove('identityKey'); textsecure.storage.remove('identityKey');
textsecure.storage.remove('signaling_key'); textsecure.storage.remove('signaling_key');
textsecure.storage.remove('password'); textsecure.storage.remove('password');
@ -109,10 +109,10 @@
// update our own identity key, which may have changed // update our own identity key, which may have changed
// if we're relinking after a reinstall on the master device // if we're relinking after a reinstall on the master device
var putIdentity = textsecure.storage.axolotl.putIdentityKey.bind( var putIdentity = textsecure.storage.protocol.putIdentityKey.bind(
null, number, identityKeyPair.pubKey null, number, identityKeyPair.pubKey
); );
textsecure.storage.axolotl.removeIdentityKey(number).then(putIdentity, putIdentity); textsecure.storage.protocol.removeIdentityKey(number).then(putIdentity, putIdentity);
textsecure.storage.put('identityKey', identityKeyPair); textsecure.storage.put('identityKey', identityKeyPair);
textsecure.storage.put('signaling_key', signalingKey); textsecure.storage.put('signaling_key', signalingKey);
@ -140,7 +140,7 @@
} }
var store = textsecure.storage.axolotl; var store = textsecure.storage.protocol;
return store.getIdentityKeyPair().then(function(identityKey) { return store.getIdentityKeyPair().then(function(identityKey) {
var result = { preKeys: [], identityKey: identityKey.pubKey }; var result = { preKeys: [], identityKey: identityKey.pubKey };
var promises = []; var promises = [];

@ -6,8 +6,8 @@
window.textsecure = window.textsecure || {}; window.textsecure = window.textsecure || {};
window.textsecure.storage = window.textsecure.storage || {}; window.textsecure.storage = window.textsecure.storage || {};
textsecure.storage.axolotl = new SignalProtocolStore(); textsecure.storage.protocol = new SignalProtocolStore();
var protocolInstance = axolotl.protocol(textsecure.storage.axolotl); var protocolInstance = axolotl.protocol(textsecure.storage.protocol);
/* /*
* jobQueue manages multiple queues indexed by device to serialize * jobQueue manages multiple queues indexed by device to serialize

@ -16,14 +16,14 @@
window.textsecure.storage.devices = { window.textsecure.storage.devices = {
saveKeysToDeviceObject: function(deviceObject) { saveKeysToDeviceObject: function(deviceObject) {
var number = textsecure.utils.unencodeNumber(deviceObject.encodedNumber)[0]; var number = textsecure.utils.unencodeNumber(deviceObject.encodedNumber)[0];
return textsecure.storage.axolotl.loadIdentityKey(number).then(function(identityKey) { return textsecure.storage.protocol.loadIdentityKey(number).then(function(identityKey) {
if (identityKey !== undefined && deviceObject.identityKey !== undefined && getString(identityKey) != getString(deviceObject.identityKey)) { if (identityKey !== undefined && deviceObject.identityKey !== undefined && getString(identityKey) != getString(deviceObject.identityKey)) {
var error = new Error("Identity key changed"); var error = new Error("Identity key changed");
error.identityKey = deviceObject.identityKey; error.identityKey = deviceObject.identityKey;
throw error; throw error;
} }
return textsecure.storage.axolotl.putIdentityKey(number, deviceObject.identityKey).then(function() { return textsecure.storage.protocol.putIdentityKey(number, deviceObject.identityKey).then(function() {
tempKeys[deviceObject.encodedNumber] = { tempKeys[deviceObject.encodedNumber] = {
preKey: deviceObject.preKey, preKey: deviceObject.preKey,
preKeyId: deviceObject.preKeyId, preKeyId: deviceObject.preKeyId,
@ -42,7 +42,7 @@
}, },
getStaleDeviceIdsForNumber: function(number) { getStaleDeviceIdsForNumber: function(number) {
return textsecure.storage.axolotl.getDeviceIds(number).then(function(deviceIds) { return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) {
if (deviceIds.length === 0) { if (deviceIds.length === 0) {
return [1]; return [1];
} }
@ -60,11 +60,11 @@
}); });
}, },
getDeviceObjectsForNumber: function(number) { getDeviceObjectsForNumber: function(number) {
return textsecure.storage.axolotl.loadIdentityKey(number).then(function(identityKey) { return textsecure.storage.protocol.loadIdentityKey(number).then(function(identityKey) {
if (identityKey === undefined) { if (identityKey === undefined) {
return []; return [];
} }
return textsecure.storage.axolotl.getDeviceIds(number).then(function(deviceIds) { return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) {
// Add pending devices from tempKeys // Add pending devices from tempKeys
for (var encodedNumber in tempKeys) { for (var encodedNumber in tempKeys) {
var deviceNumber = textsecure.utils.unencodeNumber(encodedNumber)[0]; var deviceNumber = textsecure.utils.unencodeNumber(encodedNumber)[0];
@ -95,7 +95,7 @@
promise = promise.then(function() { promise = promise.then(function() {
var encodedNumber = number + "." + deviceIdsToRemove[j]; var encodedNumber = number + "." + deviceIdsToRemove[j];
delete tempKeys[encodedNumber]; delete tempKeys[encodedNumber];
return textsecure.storage.axolotl.removeSession(encodedNumber); return textsecure.storage.protocol.removeSession(encodedNumber);
}); });
} }
return promise; return promise;

@ -14,7 +14,7 @@
// create a random group id that we haven't seen before. // create a random group id that we haven't seen before.
function generateNewGroupId() { function generateNewGroupId() {
var groupId = getString(textsecure.crypto.getRandomBytes(16)); var groupId = getString(textsecure.crypto.getRandomBytes(16));
return textsecure.storage.axolotl.getGroup(groupId).then(function(group) { return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
if (group === undefined) { if (group === undefined) {
return groupId; return groupId;
} else { } else {
@ -29,7 +29,7 @@
var groupId = groupId; var groupId = groupId;
return new Promise(function(resolve) { return new Promise(function(resolve) {
if (groupId !== undefined) { if (groupId !== undefined) {
resolve(textsecure.storage.axolotl.getGroup(groupId).then(function(group) { resolve(textsecure.storage.protocol.getGroup(groupId).then(function(group) {
if (group !== undefined) { if (group !== undefined) {
throw new Error("Tried to recreate group"); throw new Error("Tried to recreate group");
} }
@ -60,14 +60,14 @@
for (var i in finalNumbers) for (var i in finalNumbers)
groupObject.numberRegistrationIds[finalNumbers[i]] = {}; groupObject.numberRegistrationIds[finalNumbers[i]] = {};
return textsecure.storage.axolotl.putGroup(groupId, groupObject).then(function() { return textsecure.storage.protocol.putGroup(groupId, groupObject).then(function() {
return {id: groupId, numbers: finalNumbers}; return {id: groupId, numbers: finalNumbers};
}); });
}); });
}, },
getNumbers: function(groupId) { getNumbers: function(groupId) {
return textsecure.storage.axolotl.getGroup(groupId).then(function(group) { return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
if (group === undefined) if (group === undefined)
return undefined; return undefined;
@ -76,7 +76,7 @@
}, },
removeNumber: function(groupId, number) { removeNumber: function(groupId, number) {
return textsecure.storage.axolotl.getGroup(groupId).then(function(group) { return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
if (group === undefined) if (group === undefined)
return undefined; return undefined;
@ -88,7 +88,7 @@
if (i > -1) { if (i > -1) {
group.numbers.splice(i, 1); group.numbers.splice(i, 1);
delete group.numberRegistrationIds[number]; delete group.numberRegistrationIds[number];
return textsecure.storage.axolotl.putGroup(groupId, group).then(function() { return textsecure.storage.protocol.putGroup(groupId, group).then(function() {
return group.numbers; return group.numbers;
}); });
} }
@ -98,7 +98,7 @@
}, },
addNumbers: function(groupId, numbers) { addNumbers: function(groupId, numbers) {
return textsecure.storage.axolotl.getGroup(groupId).then(function(group) { return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
if (group === undefined) if (group === undefined)
return undefined; return undefined;
@ -112,18 +112,18 @@
} }
} }
return textsecure.storage.axolotl.putGroup(groupId, group).then(function() { return textsecure.storage.protocol.putGroup(groupId, group).then(function() {
return group.numbers; return group.numbers;
}); });
}); });
}, },
deleteGroup: function(groupId) { deleteGroup: function(groupId) {
return textsecure.storage.axolotl.removeGroup(groupId); return textsecure.storage.protocol.removeGroup(groupId);
}, },
getGroup: function(groupId) { getGroup: function(groupId) {
return textsecure.storage.axolotl.getGroup(groupId).then(function(group) { return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
if (group === undefined) if (group === undefined)
return undefined; return undefined;
@ -132,7 +132,7 @@
}, },
updateNumbers: function(groupId, numbers) { updateNumbers: function(groupId, numbers) {
return textsecure.storage.axolotl.getGroup(groupId).then(function(group) { return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
if (group === undefined) if (group === undefined)
throw new Error("Tried to update numbers for unknown group"); throw new Error("Tried to update numbers for unknown group");
@ -156,7 +156,7 @@
}, },
needUpdateByDeviceRegistrationId: function(groupId, number, encodedNumber, registrationId) { needUpdateByDeviceRegistrationId: function(groupId, number, encodedNumber, registrationId) {
return textsecure.storage.axolotl.getGroup(groupId).then(function(group) { return textsecure.storage.protocol.getGroup(groupId).then(function(group) {
if (group === undefined) if (group === undefined)
throw new Error("Unknown group for device registration id"); throw new Error("Unknown group for device registration id");
@ -168,7 +168,7 @@
var needUpdate = group.numberRegistrationIds[number][encodedNumber] !== undefined; var needUpdate = group.numberRegistrationIds[number][encodedNumber] !== undefined;
group.numberRegistrationIds[number][encodedNumber] = registrationId; group.numberRegistrationIds[number][encodedNumber] = registrationId;
return textsecure.storage.axolotl.putGroup(groupId, group).then(function() { return textsecure.storage.protocol.putGroup(groupId, group).then(function() {
return needUpdate; return needUpdate;
}); });
}); });

@ -6,7 +6,7 @@
describe('Device storage', function() { describe('Device storage', function() {
before(function() { localStorage.clear(); }); before(function() { localStorage.clear(); });
var store = textsecure.storage.axolotl; var store = textsecure.storage.protocol;
var identifier = '+5558675309'; var identifier = '+5558675309';
var another_identifier = '+5555590210'; var another_identifier = '+5555590210';
var identityKey = { var identityKey = {

@ -19,25 +19,25 @@ describe("Key generation", function() {
} }
function itStoresPreKey(keyId) { function itStoresPreKey(keyId) {
it('prekey ' + keyId + ' is valid', function(done) { it('prekey ' + keyId + ' is valid', function(done) {
return textsecure.storage.axolotl.loadPreKey(keyId).then(function(keyPair) { return textsecure.storage.protocol.loadPreKey(keyId).then(function(keyPair) {
validateStoredKeyPair(keyPair); validateStoredKeyPair(keyPair);
}).then(done,done); }).then(done,done);
}); });
} }
function itStoresSignedPreKey(keyId) { function itStoresSignedPreKey(keyId) {
it('signed prekey ' + keyId + ' is valid', function(done) { it('signed prekey ' + keyId + ' is valid', function(done) {
return textsecure.storage.axolotl.loadSignedPreKey(keyId).then(function(keyPair) { return textsecure.storage.protocol.loadSignedPreKey(keyId).then(function(keyPair) {
validateStoredKeyPair(keyPair); validateStoredKeyPair(keyPair);
}).then(done,done); }).then(done,done);
}); });
} }
function validateResultKey(resultKey) { function validateResultKey(resultKey) {
return textsecure.storage.axolotl.loadPreKey(resultKey.keyId).then(function(keyPair) { return textsecure.storage.protocol.loadPreKey(resultKey.keyId).then(function(keyPair) {
assertEqualArrayBuffers(resultKey.publicKey, keyPair.pubKey); assertEqualArrayBuffers(resultKey.publicKey, keyPair.pubKey);
}); });
} }
function validateResultSignedKey(resultSignedKey) { function validateResultSignedKey(resultSignedKey) {
return textsecure.storage.axolotl.loadSignedPreKey(resultSignedKey.keyId).then(function(keyPair) { return textsecure.storage.protocol.loadSignedPreKey(resultSignedKey.keyId).then(function(keyPair) {
assertEqualArrayBuffers(resultSignedKey.publicKey, keyPair.pubKey); assertEqualArrayBuffers(resultSignedKey.publicKey, keyPair.pubKey);
}); });
} }
@ -45,7 +45,7 @@ describe("Key generation", function() {
before(function(done) { before(function(done) {
localStorage.clear(); localStorage.clear();
axolotl.util.generateIdentityKeyPair().then(function(keyPair) { axolotl.util.generateIdentityKeyPair().then(function(keyPair) {
return textsecure.storage.axolotl.put('identityKey', keyPair); return textsecure.storage.protocol.put('identityKey', keyPair);
}).then(done, done); }).then(done, done);
}); });
@ -164,7 +164,7 @@ describe("Key generation", function() {
validateResultSignedKey(result.signedPreKey).then(done,done); validateResultSignedKey(result.signedPreKey).then(done,done);
}); });
it('deletes signed key 1', function() { it('deletes signed key 1', function() {
textsecure.storage.axolotl.loadSignedPreKey(1).then(function(keyPair) { textsecure.storage.protocol.loadSignedPreKey(1).then(function(keyPair) {
assert.isUndefined(keyPair); assert.isUndefined(keyPair);
}); });
}); });

@ -6,7 +6,7 @@
describe("SignalProtocolStore", function() { describe("SignalProtocolStore", function() {
before(function() { localStorage.clear(); }); before(function() { localStorage.clear(); });
var store = textsecure.storage.axolotl; var store = textsecure.storage.protocol;
var identifier = '+5558675309'; var identifier = '+5558675309';
var another_identifier = '+5555590210'; var another_identifier = '+5555590210';
var identityKey = { var identityKey = {

@ -10,7 +10,7 @@ describe("SignalProtocolStore", function() {
storage.put('identityKey', identityKey); storage.put('identityKey', identityKey);
storage.fetch().then(done, done); storage.fetch().then(done, done);
}); });
var store = textsecure.storage.axolotl; var store = textsecure.storage.protocol;
var identifier = '+5558675309'; var identifier = '+5558675309';
var identityKey = { var identityKey = {
pubKey: textsecure.crypto.getRandomBytes(33), pubKey: textsecure.crypto.getRandomBytes(33),

Loading…
Cancel
Save