mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-13 18:45:44 -04:00
ffi: Allow recovery to be enabled using a passphrase
This commit is contained in:
@@ -315,6 +315,7 @@ impl Encryption {
|
||||
pub async fn enable_recovery(
|
||||
&self,
|
||||
wait_for_backups_to_upload: bool,
|
||||
mut passphrase: Option<String>,
|
||||
progress_listener: Box<dyn EnableRecoveryProgressListener>,
|
||||
) -> Result<String> {
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user