-
-
Notifications
You must be signed in to change notification settings - Fork 655
Add restoreKeybackup to CryptoApi.
#4476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add restoreKeybackup to CryptoApi.
#4476
Conversation
bc49f0b to
65bf2b0
Compare
65bf2b0 to
5e9ed6b
Compare
5e9ed6b to
61c1940
Compare
Sounds sensible.
No. There is no real reason for applications to be restoring keys at the room level (and certainly not at the session level). The crypto stack will fetch keys on demand. Let's drop support for those parameters.
Yeah, I think that it makes sense to mark |
richvdh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a very sensible start. Obviously, please make sure that any new public types and methods are clearly documented, but I think you know that.
eaa2357 to
d385c72
Compare
…ekeybackup # Conflicts: # src/rust-crypto/backup.ts
bad71c7 to
e55aee9
Compare
…pPrivateKeyFromSecretStorage`
db068a4 to
250b7e9
Compare
…BackupInfo` parameter.
richvdh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM otherwise
* 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 <[email protected]> * - 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 <[email protected]>
Checklist
public/exportedsymbols have accurate TSDoc documentation.Task element-hq/element-web#26922
The goal is to simplify the
restoreKeyBackupapi and move it out of theMatrixClientto theCryptoApi.CryptoApirestoreKeyBackupRestoreKeyBackupDialogwe never target a specific session or room when calling therestoreKeyBackup*consequently I get rid of thetargetRoomIdandtargetSessionId.IKeyBackupRestoreOpts.cacheCompleteCallbackis not used inRestoreKeyBackupDialog, I removed also this parameter.keyBackupInfoas a parameter, we directly retrieve it internally.restoreKeyBackupWithPassphrasewhich is deprecated because deriving a key backup from the passphrase is not in the spec.RustBackupManager.restoreKeyBackup*inMatrixClient