hookup megolm decryption in session

This commit is contained in:
Bruno Windels 2020-09-04 15:31:27 +02:00
parent 32a399afec
commit baad4bd37f

View file

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