ElementR: report invalid keys rather than failing to restore from backup (#4006)

* rust-crypto: allow reporting failures when restoring keys

* add test and catch more invalid keys

* remove checks for room_id and session_id as they are guaranteed to be set

* remove obsolete comment
This commit is contained in:
Hubert Chathi
2024-01-26 11:46:35 -05:00
committed by GitHub
parent 2d1308c733
commit 2fe35fed13
2 changed files with 41 additions and 10 deletions
+12 -9
View File
@@ -212,15 +212,18 @@ export class RustBackupManager extends TypedEventEmitter<RustBackupCryptoEvents,
}
keysByRoom.get(roomId)!.set(key.session_id, key);
}
await this.olmMachine.importBackedUpRoomKeys(keysByRoom, (progress: BigInt, total: BigInt): void => {
const importOpt: ImportRoomKeyProgressData = {
total: Number(total),
successes: Number(progress),
stage: "load_keys",
failures: 0,
};
opts?.progressCallback?.(importOpt);
});
await this.olmMachine.importBackedUpRoomKeys(
keysByRoom,
(progress: BigInt, total: BigInt, failures: BigInt): void => {
const importOpt: ImportRoomKeyProgressData = {
total: Number(total),
successes: Number(progress),
stage: "load_keys",
failures: Number(failures),
};
opts?.progressCallback?.(importOpt);
},
);
}
private keyBackupCheckInProgress: Promise<KeyBackupCheck | null> | null = null;