Skip to content

Commit

Permalink
rust-crypto: allow reporting failures when restoring keys
Browse files Browse the repository at this point in the history
  • Loading branch information
uhoreg committed Jan 12, 2024
1 parent 2ef3ebb commit eecf09d
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/rust-crypto/backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,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: failures == undefined ? 0 : Number(failures),
};
opts?.progressCallback?.(importOpt);
},
);
}

private keyBackupCheckInProgress: Promise<KeyBackupCheck | null> | null = null;
Expand Down

0 comments on commit eecf09d

Please sign in to comment.