Update protocol libs

Rename storage functions

// FREEBIE
This commit is contained in:
lilia 2016-04-21 15:40:43 -07:00
parent b5ddd41a5e
commit 1fe5d63015
11 changed files with 91 additions and 91 deletions

View file

@ -34330,7 +34330,7 @@ window.axolotl.protocol = function(storage_interface) {
var crypto_storage = {};
function getRecord(encodedNumber) {
return storage_interface.getSession(encodedNumber).then(function(serialized) {
return storage_interface.loadSession(encodedNumber).then(function(serialized) {
if (serialized === undefined) {
return undefined;
}
@ -34390,12 +34390,12 @@ window.axolotl.protocol = function(storage_interface) {
else if (record.registrationId === null)
throw new Error("Had open sessions on a record that had no registrationId set");
return storage_interface.getIdentityKey(encodedNumber).then(function(identityKey) {
return storage_interface.loadIdentityKey(encodedNumber).then(function(identityKey) {
if (identityKey !== undefined && toString(identityKey) !== toString(record.identityKey))
throw new Error("Tried to change identity key at save time");
return storage_interface.putIdentityKey(encodedNumber, record.identityKey).then(function() {
return storage_interface.putSession(encodedNumber, record.serialize());
return storage_interface.storeSession(encodedNumber, record.serialize());
});
});
});
@ -34462,7 +34462,7 @@ window.axolotl.protocol = function(storage_interface) {
crypto_storage.getSessionOrIdentityKeyByBaseKey = function(encodedNumber, baseKey) {
return getRecord(encodedNumber).then(function(record) {
if (record === undefined) {
return storage_interface.getIdentityKey(encodedNumber).then(function(identityKey) {
return storage_interface.loadIdentityKey(encodedNumber).then(function(identityKey) {
if (identityKey === undefined)
return undefined;
return { indexInfo: { remoteIdentityKey: identityKey } };
@ -34538,7 +34538,7 @@ window.axolotl.protocol = function(storage_interface) {
}
var initSession = function(isInitiator, ourEphemeralKey, ourSignedKey, encodedNumber, theirIdentityPubKey, theirEphemeralPubKey, theirSignedPubKey) {
return storage_interface.getMyIdentityKey().then(function(ourIdentityKey) {
return storage_interface.getIdentityKeyPair().then(function(ourIdentityKey) {
if (isInitiator) {
if (ourSignedKey !== undefined) {
throw new Error("Invalid call to initSession");
@ -34674,8 +34674,8 @@ window.axolotl.protocol = function(storage_interface) {
var initSessionFromPreKeyWhisperMessage = function(encodedNumber, message) {
var preKeyPair, signedPreKeyPair, session;
return Promise.all([
storage_interface.getPreKey(message.preKeyId),
storage_interface.getSignedPreKey(message.signedPreKeyId),
storage_interface.loadPreKey(message.preKeyId),
storage_interface.loadSignedPreKey(message.signedPreKeyId),
crypto_storage.getSessionOrIdentityKeyByBaseKey(encodedNumber, toArrayBuffer(message.baseKey))
]).then(function(results) {
preKeyPair = results[0];
@ -34839,7 +34839,7 @@ window.axolotl.protocol = function(storage_interface) {
return HKDF(toArrayBuffer(messageKey), '', "WhisperMessageKeys");
});
}).then(function(keys) {
return storage_interface.getMyIdentityKey().then(function(ourIdentityKey) {
return storage_interface.getIdentityKeyPair().then(function(ourIdentityKey) {
var macInput = new Uint8Array(messageProto.byteLength + 33*2 + 1);
macInput.set(new Uint8Array(toArrayBuffer(session.indexInfo.remoteIdentityKey)));
@ -34920,8 +34920,8 @@ window.axolotl.protocol = function(storage_interface) {
var ourIdentityKey, myRegistrationId, session, hadSession;
return Promise.all([
storage_interface.getMyIdentityKey(),
storage_interface.getMyRegistrationId(),
storage_interface.getIdentityKeyPair(),
storage_interface.getLocalRegistrationId(),
crypto_storage.getOpenSession(deviceObject.encodedNumber)
]).then(function(results) {
ourIdentityKey = results[0];
@ -35614,7 +35614,7 @@ axolotlInternal.RecipientRecord = function() {
window.textsecure.storage.devices = {
saveKeysToDeviceObject: function(deviceObject) {
var number = textsecure.utils.unencodeNumber(deviceObject.encodedNumber)[0];
return textsecure.storage.axolotl.getIdentityKey(number).then(function(identityKey) {
return textsecure.storage.axolotl.loadIdentityKey(number).then(function(identityKey) {
if (identityKey !== undefined && deviceObject.identityKey !== undefined && getString(identityKey) != getString(deviceObject.identityKey)) {
var error = new Error("Identity key changed");
error.identityKey = deviceObject.identityKey;
@ -35658,7 +35658,7 @@ axolotlInternal.RecipientRecord = function() {
});
},
getDeviceObjectsForNumber: function(number) {
return textsecure.storage.axolotl.getIdentityKey(number).then(function(identityKey) {
return textsecure.storage.axolotl.loadIdentityKey(number).then(function(identityKey) {
if (identityKey === undefined) {
return [];
}
@ -36856,14 +36856,14 @@ var TextSecureServer = (function() {
var store = textsecure.storage.axolotl;
return store.getMyIdentityKey().then(function(identityKey) {
return store.getIdentityKeyPair().then(function(identityKey) {
var result = { preKeys: [], identityKey: identityKey.pubKey };
var promises = [];
for (var keyId = startId; keyId < startId+count; ++keyId) {
promises.push(
axolotl.util.generatePreKey(keyId).then(function(res) {
store.putPreKey(res.keyId, res.keyPair);
store.storePreKey(res.keyId, res.keyPair);
result.preKeys.push({
keyId : res.keyId,
publicKey : res.keyPair.pubKey
@ -36875,7 +36875,7 @@ var TextSecureServer = (function() {
promises.push(
axolotl.util.generateSignedPreKey(identityKey, signedKeyId).then(function(res) {
store.putSignedPreKey(res.keyId, res.keyPair);
store.storeSignedPreKey(res.keyId, res.keyPair);
result.signedPreKey = {
keyId : res.keyId,
publicKey : res.keyPair.pubKey,