1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Typo + exit if session was never shared

This commit is contained in:
David Baker
2018-11-13 12:15:33 +00:00
parent 231fde219c
commit 6c413bba48
2 changed files with 9 additions and 1 deletions

View File

@@ -433,7 +433,15 @@ MegolmEncryption.prototype.reshareKeyWithDevice = async function(
}
// The chain index of the key we previously sent this device
if (obSessionInfo.sharedWithDevices[userId] === undefined) {
logger.debug("Session ID " + sessionId + " never shared with user " + userId);
return;
}
const sentChainIndex = obSessionInfo.sharedWithDevices[userId][device.deviceId];
if (sentChainIndex === undefined) {
logger.debug("Session ID " + sessionId + " never shared with device " + userId + ":" + device.deviceId);
return;
}
// get the key from the inbound session: the outbound one will already
// have been ratcheted to the next chain index.

View File

@@ -1196,7 +1196,7 @@ Crypto.prototype._onToDeviceBadEncrypted = async function(event) {
// We send this first such that, as long as the toDevice messages arrive in the
// same order we sent them, the other end will get this first, set up the new session,
// then get the keyshare request and send the key over this new session (because it
// it the session it has most recently received a message on).
// is the session it has most recently received a message on).
const encryptedContent = {
algorithm: olmlib.OLM_ALGORITHM,
sender_key: this._olmDevice.deviceCurve25519Key,