From c47bdd5715f39305c9305b49cced9a9f561a1f5c Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 28 Jan 2022 13:14:11 +0100 Subject: [PATCH] flush key backup when creating a new room key --- src/matrix/e2ee/RoomEncryption.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/matrix/e2ee/RoomEncryption.js b/src/matrix/e2ee/RoomEncryption.js index 2e6ee254..80f57507 100644 --- a/src/matrix/e2ee/RoomEncryption.js +++ b/src/matrix/e2ee/RoomEncryption.js @@ -236,6 +236,7 @@ export class RoomEncryption { this._keySharePromise = (async () => { const roomKeyMessage = await this._megolmEncryption.ensureOutboundSession(this._room.id, this._encryptionParams); if (roomKeyMessage) { + this._keyBackup?.flush(log); await log.wrap("share key", log => this._shareNewRoomKey(roomKeyMessage, hsApi, log)); } })(); @@ -254,6 +255,7 @@ export class RoomEncryption { } const megolmResult = await log.wrap("megolm encrypt", () => this._megolmEncryption.encrypt(this._room.id, type, content, this._encryptionParams)); if (megolmResult.roomKeyMessage) { + this._keyBackup?.flush(log); await log.wrap("share key", log => this._shareNewRoomKey(megolmResult.roomKeyMessage, hsApi, log)); } return {