diff --git a/bindings/matrix-sdk-ffi/src/encryption.rs b/bindings/matrix-sdk-ffi/src/encryption.rs index 85468b2cf93..34a0e794941 100644 --- a/bindings/matrix-sdk-ffi/src/encryption.rs +++ b/bindings/matrix-sdk-ffi/src/encryption.rs @@ -315,6 +315,7 @@ impl Encryption { pub async fn enable_recovery( &self, wait_for_backups_to_upload: bool, + mut passphrase: Option, progress_listener: Box, ) -> Result { let recovery = self.inner.recovery(); @@ -325,6 +326,12 @@ impl Encryption { recovery.enable() }; + let enable = if let Some(passphrase) = &passphrase { + enable.with_passphrase(passphrase) + } else { + enable + }; + let mut progress_stream = enable.subscribe_to_progress(); let task = RUNTIME.spawn(async move { @@ -337,6 +344,7 @@ impl Encryption { let ret = enable.await?; task.abort(); + passphrase.zeroize(); Ok(ret) }