diff --git a/src/matrix/Session.js b/src/matrix/Session.js index c3429075..d48e0d00 100644 --- a/src/matrix/Session.js +++ b/src/matrix/Session.js @@ -49,6 +49,9 @@ export class Session { this._e2eeAccount = null; this._deviceTracker = null; this._olmEncryption = null; + this._megolmEncryption = null; + this._megolmDecryption = null; + if (olm) { this._olmUtil = new olm.Utility(); this._deviceTracker = new DeviceTracker({ @@ -92,9 +95,12 @@ export class Session { storage: this._storage, now: this._clock.now, ownDeviceId: this._sessionInfo.deviceId, - }) - const megolmDecryption = new MegOlmDecryption({pickleKey: PICKLE_KEY, olm: this._olm}); - this._deviceMessageHandler.enableEncryption({olmDecryption, megolmDecryption}); + }); + this._megolmDecryption = new MegOlmDecryption({ + pickleKey: PICKLE_KEY, + olm: this._olm, + }); + this._deviceMessageHandler.enableEncryption({olmDecryption, megolmDecryption: this._megolmDecryption}); } _createRoomEncryption(room, encryptionParams) { @@ -118,6 +124,7 @@ export class Session { deviceTracker: this._deviceTracker, olmEncryption: this._olmEncryption, megolmEncryption: this._megolmEncryption, + megolmDecryption: this._megolmDecryption, encryptionParams }); }