diff --git a/rust-sdk/Cargo.toml b/rust-sdk/Cargo.toml index bb4fadf147..9ee7b4bbf7 100644 --- a/rust-sdk/Cargo.toml +++ b/rust-sdk/Cargo.toml @@ -29,11 +29,11 @@ features = ["lax_deserialize"] [dependencies.matrix-sdk-common] git = "https://github.com/matrix-org/matrix-rust-sdk/" -rev = "2e4d5f25cba03bd26415b91defd6e762e8c31b63" +rev = "fc74526699b82ba5be3349e810ded51138dae7fc" [dependencies.matrix-sdk-crypto] git = "https://github.com/matrix-org/matrix-rust-sdk/" -rev = "2e4d5f25cba03bd26415b91defd6e762e8c31b63" +rev = "fc74526699b82ba5be3349e810ded51138dae7fc" features = ["sled_cryptostore", "qrcode", "backups_v1"] [dependencies.tokio] diff --git a/rust-sdk/src/machine.rs b/rust-sdk/src/machine.rs index c842334897..c7fa9741ab 100644 --- a/rust-sdk/src/machine.rs +++ b/rust-sdk/src/machine.rs @@ -616,6 +616,7 @@ impl OlmMachine { fn import_keys_helper( &self, keys: Vec, + from_backup: bool, progress_listener: Box, ) -> Result { let listener = |progress: usize, total: usize| { @@ -624,7 +625,7 @@ impl OlmMachine { let result = self .runtime - .block_on(self.inner.import_keys(keys, listener))?; + .block_on(self.inner.import_keys(keys, from_backup, listener))?; Ok(KeysImportResult { total: result.total_count as i64, @@ -650,14 +651,15 @@ impl OlmMachine { ) -> Result { let keys = Cursor::new(keys); let keys = decrypt_key_export(keys, passphrase)?; - self.import_keys_helper(keys, progress_listener) + self.import_keys_helper(keys, false, progress_listener) } /// Import room keys from the given serialized unencrypted key export. /// /// This method is the same as [`OlmMachine::import_keys`] but the /// decryption step is skipped and should be performed by the caller. This - /// may be useful for custom handling or for server-side key backups. + /// should be used if the room keys are comming from the server-side backup, + /// the method will mark all imported room keys as backed up. /// /// # Arguments /// @@ -678,7 +680,7 @@ impl OlmMachine { .filter_map(|k| k.ok()) .collect(); - self.import_keys_helper(keys, progress_listener) + self.import_keys_helper(keys, true, progress_listener) } /// Discard the currently active room key for the given room if there is