You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Make OlmDevice.addInboundGroupSession async
This commit is contained in:
@@ -686,7 +686,7 @@ OlmDevice.prototype._getInboundGroupSession = function(
|
|||||||
* @param {boolean} exportFormat true if the megolm keys are in export format
|
* @param {boolean} exportFormat true if the megolm keys are in export format
|
||||||
* (ie, they lack an ed25519 signature)
|
* (ie, they lack an ed25519 signature)
|
||||||
*/
|
*/
|
||||||
OlmDevice.prototype.addInboundGroupSession = function(
|
OlmDevice.prototype.addInboundGroupSession = async function(
|
||||||
roomId, senderKey, forwardingCurve25519KeyChain,
|
roomId, senderKey, forwardingCurve25519KeyChain,
|
||||||
sessionId, sessionKey, keysClaimed,
|
sessionId, sessionKey, keysClaimed,
|
||||||
exportFormat,
|
exportFormat,
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ MegolmEncryption.prototype._prepareNewSession = async function() {
|
|||||||
const sessionId = this._olmDevice.createOutboundGroupSession();
|
const sessionId = this._olmDevice.createOutboundGroupSession();
|
||||||
const key = this._olmDevice.getOutboundGroupSessionKey(sessionId);
|
const key = this._olmDevice.getOutboundGroupSessionKey(sessionId);
|
||||||
|
|
||||||
this._olmDevice.addInboundGroupSession(
|
await this._olmDevice.addInboundGroupSession(
|
||||||
this._roomId, this._olmDevice.deviceCurve25519Key, [], sessionId,
|
this._roomId, this._olmDevice.deviceCurve25519Key, [], sessionId,
|
||||||
key.key, {ed25519: this._olmDevice.deviceEd25519Key},
|
key.key, {ed25519: this._olmDevice.deviceEd25519Key},
|
||||||
);
|
);
|
||||||
@@ -706,18 +706,20 @@ MegolmDecryption.prototype.onRoomKeyEvent = function(event) {
|
|||||||
content.room_id, senderKey, forwardingKeyChain, sessionId,
|
content.room_id, senderKey, forwardingKeyChain, sessionId,
|
||||||
content.session_key, keysClaimed,
|
content.session_key, keysClaimed,
|
||||||
exportFormat,
|
exportFormat,
|
||||||
);
|
).then(() => {
|
||||||
|
// cancel any outstanding room key requests for this session
|
||||||
|
this._crypto.cancelRoomKeyRequest({
|
||||||
|
algorithm: content.algorithm,
|
||||||
|
room_id: content.room_id,
|
||||||
|
session_id: content.session_id,
|
||||||
|
sender_key: senderKey,
|
||||||
|
});
|
||||||
|
|
||||||
// cancel any outstanding room key requests for this session
|
// have another go at decrypting events sent with this session.
|
||||||
this._crypto.cancelRoomKeyRequest({
|
this._retryDecryption(senderKey, sessionId);
|
||||||
algorithm: content.algorithm,
|
}).catch((e) => {
|
||||||
room_id: content.room_id,
|
console.error(`Error handling m.room_key_event: ${e}`);
|
||||||
session_id: content.session_id,
|
|
||||||
sender_key: senderKey,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// have another go at decrypting events sent with this session.
|
|
||||||
this._retryDecryption(senderKey, sessionId);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user