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

This commit is contained in:
Ulyssa 2024-03-02 15:55:27 -08:00 committed by GitHub
parent 9732971fc2
commit dd001af365
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,6 +21,7 @@ use url::Url;
use matrix_sdk::{ use matrix_sdk::{
config::{RequestConfig, SyncSettings}, config::{RequestConfig, SyncSettings},
encryption::verification::{SasVerification, Verification}, encryption::verification::{SasVerification, Verification},
encryption::{BackupDownloadStrategy, EncryptionSettings},
event_handler::Ctx, event_handler::Ctx,
matrix_auth::MatrixSession, matrix_auth::MatrixSession,
reqwest, reqwest,
@ -101,6 +102,12 @@ use crate::{
ApplicationSettings, 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_DEVICE_NAME: &str = "iamb";
const IAMB_USER_AGENT: &str = "iamb"; const IAMB_USER_AGENT: &str = "iamb";
const MIN_MSG_LOAD: u32 = 50; const MIN_MSG_LOAD: u32 = 50;
@ -664,7 +671,8 @@ async fn create_client_inner(
let builder = Client::builder() let builder = Client::builder()
.http_client(http) .http_client(http)
.sqlite_store(settings.sqlite_dir.as_path(), None) .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 { let builder = if let Some(url) = homeserver {
// Use the explicitly specified homeserver. // Use the explicitly specified homeserver.