|
|
|
@ -37122,8 +37122,7 @@ window.axolotl.protocol = function(storage_interface) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var initSession = function(isInitiator, ourEphemeralKey, ourSignedKey, encodedNumber, theirIdentityPubKey, theirEphemeralPubKey, theirSignedPubKey) {
|
|
|
|
|
var ourIdentityKey = storage_interface.getMyIdentityKey();
|
|
|
|
|
|
|
|
|
|
return storage_interface.getMyIdentityKey().then(function(ourIdentityKey) {
|
|
|
|
|
if (isInitiator) {
|
|
|
|
|
if (ourSignedKey !== undefined)
|
|
|
|
|
throw new Error("Invalid call to initSession");
|
|
|
|
@ -37195,6 +37194,7 @@ window.axolotl.protocol = function(storage_interface) {
|
|
|
|
|
}).then(finishInit);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var removeOldChains = function(session) {
|
|
|
|
@ -37386,12 +37386,13 @@ window.axolotl.protocol = function(storage_interface) {
|
|
|
|
|
|
|
|
|
|
return fillMessageKeys(chain, message.counter).then(function() {
|
|
|
|
|
return HKDF(axolotlInternal.utils.convertToArrayBuffer(chain.messageKeys[message.counter]), '', "WhisperMessageKeys").then(function(keys) {
|
|
|
|
|
return storage_interface.getMyIdentityKey().then(function(ourIdentityKey) {
|
|
|
|
|
delete chain.messageKeys[message.counter];
|
|
|
|
|
|
|
|
|
|
var messageProtoArray = axolotlInternal.utils.convertToArrayBuffer(messageProto);
|
|
|
|
|
var macInput = new Uint8Array(messageProtoArray.byteLength + 33*2 + 1);
|
|
|
|
|
macInput.set(new Uint8Array(axolotlInternal.utils.convertToArrayBuffer(session.indexInfo.remoteIdentityKey)));
|
|
|
|
|
macInput.set(new Uint8Array(axolotlInternal.utils.convertToArrayBuffer(storage_interface.getMyIdentityKey().pubKey)), 33);
|
|
|
|
|
macInput.set(new Uint8Array(axolotlInternal.utils.convertToArrayBuffer(ourIdentityKey.pubKey)), 33);
|
|
|
|
|
macInput[33*2] = (3 << 4) | 3;
|
|
|
|
|
macInput.set(new Uint8Array(messageProtoArray), 33*2 + 1);
|
|
|
|
|
|
|
|
|
@ -37426,6 +37427,7 @@ window.axolotl.protocol = function(storage_interface) {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*************************
|
|
|
|
@ -37452,6 +37454,8 @@ window.axolotl.protocol = function(storage_interface) {
|
|
|
|
|
|
|
|
|
|
// return Promise(encoded [PreKey]WhisperMessage)
|
|
|
|
|
self.encryptMessageFor = function(deviceObject, pushMessageContent) {
|
|
|
|
|
return storage_interface.getMyIdentityKey().then(function(ourIdentityKey) {
|
|
|
|
|
return storage_interface.getMyRegistrationId().then(function(myRegistrationId) {
|
|
|
|
|
return crypto_storage.getOpenSession(deviceObject.encodedNumber).then(function(session) {
|
|
|
|
|
var hadSession = session !== undefined;
|
|
|
|
|
|
|
|
|
@ -37477,7 +37481,7 @@ window.axolotl.protocol = function(storage_interface) {
|
|
|
|
|
var encodedMsg = axolotlInternal.utils.convertToArrayBuffer(msg.encode());
|
|
|
|
|
|
|
|
|
|
var macInput = new Uint8Array(encodedMsg.byteLength + 33*2 + 1);
|
|
|
|
|
macInput.set(new Uint8Array(axolotlInternal.utils.convertToArrayBuffer(storage_interface.getMyIdentityKey().pubKey)));
|
|
|
|
|
macInput.set(new Uint8Array(axolotlInternal.utils.convertToArrayBuffer(ourIdentityKey.pubKey)));
|
|
|
|
|
macInput.set(new Uint8Array(axolotlInternal.utils.convertToArrayBuffer(session.indexInfo.remoteIdentityKey)), 33);
|
|
|
|
|
macInput[33*2] = (3 << 4) | 3;
|
|
|
|
|
macInput.set(new Uint8Array(encodedMsg), 33*2 + 1);
|
|
|
|
@ -37500,8 +37504,8 @@ window.axolotl.protocol = function(storage_interface) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var preKeyMsg = new axolotlInternal.protobuf.PreKeyWhisperMessage();
|
|
|
|
|
preKeyMsg.identityKey = axolotlInternal.utils.convertToArrayBuffer(storage_interface.getMyIdentityKey().pubKey);
|
|
|
|
|
preKeyMsg.registrationId = storage_interface.getMyRegistrationId();
|
|
|
|
|
preKeyMsg.identityKey = axolotlInternal.utils.convertToArrayBuffer(ourIdentityKey.pubKey);
|
|
|
|
|
preKeyMsg.registrationId = myRegistrationId;
|
|
|
|
|
|
|
|
|
|
if (session === undefined) {
|
|
|
|
|
var deviceIdentityKey = axolotlInternal.utils.convertToArrayBuffer(deviceObject.identityKey);
|
|
|
|
@ -37539,6 +37543,8 @@ window.axolotl.protocol = function(storage_interface) {
|
|
|
|
|
return {type: 1, body: axolotlInternal.utils.convertToString(message)};
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.createIdentityKeyRecvSocket = function() {
|
|
|
|
@ -37987,7 +37993,7 @@ axolotlInternal.RecipientRecord = function() {
|
|
|
|
|
window.textsecure.storage = window.textsecure.storage || {};
|
|
|
|
|
|
|
|
|
|
// Overrideable storage implementation
|
|
|
|
|
window.textsecure.storage.impl = {
|
|
|
|
|
window.textsecure.storage.impl = window.textsecure.storage.impl || {
|
|
|
|
|
/*****************************
|
|
|
|
|
*** Base Storage Routines ***
|
|
|
|
|
*****************************/
|
|
|
|
@ -39408,7 +39414,7 @@ function generateKeys(count, progressCallback) {
|
|
|
|
|
textsecure.protocol_wrapper.startWorker();
|
|
|
|
|
|
|
|
|
|
var store = textsecure.storage.axolotl;
|
|
|
|
|
var identityKey = store.getMyIdentityKey();
|
|
|
|
|
return store.getMyIdentityKey().then(function(identityKey) {
|
|
|
|
|
var result = { preKeys: [], identityKey: identityKey.pubKey };
|
|
|
|
|
var promises = [];
|
|
|
|
|
|
|
|
|
@ -39443,6 +39449,7 @@ function generateKeys(count, progressCallback) {
|
|
|
|
|
textsecure.protocol_wrapper.stopWorker();
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* vim: ts=4:sw=4:expandtab
|
|
|
|
|