Commit dd001af365

dd001af36502740bb817f0c1508c8aaab7a4c6de

parent: 9732971fc2

Unregistered key

Ulyssa <git@ulyssa.dev> · 2024-03-02 23:55 UTC
committer: <noreply@github.com>

Download rooms keys from backups if they exist (#211)

Layout: unified · split

src/worker.rs +9 −1
@@ -21,6 +21,7 @@ use url::Url;
21use matrix_sdk::{ 21use matrix_sdk::{
22 config::{RequestConfig, SyncSettings}, 22 config::{RequestConfig, SyncSettings},
23 encryption::verification::{SasVerification, Verification}, 23 encryption::verification::{SasVerification, Verification},
24 encryption::{BackupDownloadStrategy, EncryptionSettings},
24 event_handler::Ctx, 25 event_handler::Ctx,
25 matrix_auth::MatrixSession, 26 matrix_auth::MatrixSession,
26 reqwest, 27 reqwest,
@@ -101,6 +102,12 @@ use crate::{
101 ApplicationSettings, 102 ApplicationSettings,
102}; 103};
103 104
105const DEFAULT_ENCRYPTION_SETTINGS: EncryptionSettings = EncryptionSettings {
106 auto_enable_cross_signing: true,
107 auto_enable_backups: true,
108 backup_download_strategy: BackupDownloadStrategy::AfterDecryptionFailure,
109};
110
104const IAMB_DEVICE_NAME: &str = "iamb"; 111const IAMB_DEVICE_NAME: &str = "iamb";
105const IAMB_USER_AGENT: &str = "iamb"; 112const IAMB_USER_AGENT: &str = "iamb";
106const MIN_MSG_LOAD: u32 = 50; 113const MIN_MSG_LOAD: u32 = 50;
@@ -664,7 +671,8 @@ async fn create_client_inner(
664 let builder = Client::builder() 671 let builder = Client::builder()
665 .http_client(http) 672 .http_client(http)
666 .sqlite_store(settings.sqlite_dir.as_path(), None) 673 .sqlite_store(settings.sqlite_dir.as_path(), None)
667 .request_config(req_config); 674 .request_config(req_config)
675 .with_encryption_settings(DEFAULT_ENCRYPTION_SETTINGS.clone());
668 676
669 let builder = if let Some(url) = homeserver { 677 let builder = if let Some(url) = homeserver {
670 // Use the explicitly specified homeserver. 678 // Use the explicitly specified homeserver.