forked from mystiq/hydrogen-web
move some validation of into session backup
This commit is contained in:
parent
8f4e3c62ce
commit
ffece4f357
1 changed files with 23 additions and 28 deletions
|
@ -182,9 +182,7 @@ export class RoomEncryption {
|
|||
log.set("id", sessionId);
|
||||
log.set("senderKey", senderKey);
|
||||
try {
|
||||
const session = await this._sessionBackup.getSession(this._room.id, sessionId, log);
|
||||
if (session?.algorithm === MEGOLM_ALGORITHM) {
|
||||
let roomKey = this._megolmDecryption.roomKeyFromBackup(this._room.id, sessionId, session);
|
||||
const roomKey = await this._sessionBackup.getRoomKey(this._room.id, sessionId, log);
|
||||
if (roomKey) {
|
||||
if (roomKey.senderKey !== senderKey) {
|
||||
log.set("wrong_sender_key", roomKey.senderKey);
|
||||
|
@ -209,9 +207,6 @@ export class RoomEncryption {
|
|||
await log.wrap("retryDecryption", log => this._room.notifyRoomKey(roomKey, retryEventIds || [], log));
|
||||
}
|
||||
}
|
||||
} else if (session?.algorithm) {
|
||||
log.set("unknown algorithm", session.algorithm);
|
||||
}
|
||||
} catch (err) {
|
||||
if (!(err.name === "HomeServerError" && err.errcode === "M_NOT_FOUND")) {
|
||||
log.set("not_found", true);
|
||||
|
|
Loading…
Reference in a new issue