matrix-js-sdk
c93b7ce1 - Add `restoreKeybackup` to `CryptoApi`. (#4476)

Commit
1 year ago
Add `restoreKeybackup` to `CryptoApi`. (#4476) * First draft of moving out restoreKeyBackup out of MatrixClient * Deprecate `restoreKeyBackup*` in `MatrixClient` * Move types * Handle only the room keys response * Renaming and refactor `keysCountInBatch` & `getTotalKeyCount` * Fix `importRoomKeysAsJson` tsdoc * Fix typo * Move `backupDecryptor.free()`` * Comment and simplify a bit `handleDecryptionOfAFullBackup` * Fix decryption crash by moving`backupDecryptor.free` * Use new api in `megolm-backup.spec.ts` * Add tests to get recovery key from secret storage * Add doc to `KeyBackupRestoreOpts` & `KeyBackupRestoreResult` * Add doc to `restoreKeyBackupWithKey` * Add doc to `backup.ts` * Apply comment suggestions Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * - Decryption key is recovered from the cache in `RustCrypto.restoreKeyBackup` - Add `CryptoApi.getSecretStorageBackupPrivateKey` to get the decryption key from the secret storage. * Add `CryptoApi.restoreKeyBackup` to `ImportRoomKeyProgressData` doc. * Add deprecated symbol to all the `restoreKeyBackup*` overrides. * Update tests * Move `RustBackupManager.getTotalKeyCount` to `backup#calculateKeyCountInKeyBackup` * Fix `RustBackupManager.restoreKeyBackup` tsdoc * Move `backupDecryptor.free` in rust crypto. * Move `handleDecryptionOfAFullBackup` in `importKeyBackup` * Rename `calculateKeyCountInKeyBackup` to `countKeystInBackup` * Fix `passphrase` typo * Rename `backupInfoVersion` to `backupVersion` * Complete restoreKeyBackup* methods documentation * Add `loadSessionBackupPrivateKeyFromSecretStorage` * Remove useless intermediary result variable. * Check that decryption key matchs key backup info in `loadSessionBackupPrivateKeyFromSecretStorage` * Get backup info from a specific version * Fix typo in `countKeysInBackup` * Improve documentation and naming * Use `RustSdkCryptoJs.BackupDecryptionKey` as `decryptionKeyMatchesKeyBackupInfo` parameter. * Call directly `olmMachine.getBackupKeys` in `restoreKeyBackup` * Last review changes --------- Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Author
Parents
Loading