From dd001af36502740bb817f0c1508c8aaab7a4c6de Mon Sep 17 00:00:00 2001 From: Ulyssa Date: Sat, 2 Mar 2024 15:55:27 -0800 Subject: [PATCH] Download rooms keys from backups if they exist (#211) --- src/worker.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/worker.rs b/src/worker.rs index 66a9c29..2d0833c 100644 --- a/src/worker.rs +++ b/src/worker.rs @@ -21,6 +21,7 @@ use url::Url; use matrix_sdk::{ config::{RequestConfig, SyncSettings}, encryption::verification::{SasVerification, Verification}, + encryption::{BackupDownloadStrategy, EncryptionSettings}, event_handler::Ctx, matrix_auth::MatrixSession, reqwest, @@ -101,6 +102,12 @@ use crate::{ ApplicationSettings, }; +const DEFAULT_ENCRYPTION_SETTINGS: EncryptionSettings = EncryptionSettings { + auto_enable_cross_signing: true, + auto_enable_backups: true, + backup_download_strategy: BackupDownloadStrategy::AfterDecryptionFailure, +}; + const IAMB_DEVICE_NAME: &str = "iamb"; const IAMB_USER_AGENT: &str = "iamb"; const MIN_MSG_LOAD: u32 = 50; @@ -664,7 +671,8 @@ async fn create_client_inner( let builder = Client::builder() .http_client(http) .sqlite_store(settings.sqlite_dir.as_path(), None) - .request_config(req_config); + .request_config(req_config) + .with_encryption_settings(DEFAULT_ENCRYPTION_SETTINGS.clone()); let builder = if let Some(url) = homeserver { // Use the explicitly specified homeserver.