diff --git a/bindings/matrix-sdk-crypto-ffi/src/lib.rs b/bindings/matrix-sdk-crypto-ffi/src/lib.rs index 12cb12fe8c5..e4b67c12097 100644 --- a/bindings/matrix-sdk-crypto-ffi/src/lib.rs +++ b/bindings/matrix-sdk-crypto-ffi/src/lib.rs @@ -812,7 +812,7 @@ mod uniffi_types { RequestVerificationResult, StartSasResult, Verification, VerificationRequest, }, BackupKeys, CrossSigningKeyExport, CrossSigningStatus, DecryptedEvent, EncryptionSettings, - RoomKeyCounts, + EventEncryptionAlgorithm, RoomKeyCounts, RoomSettings, }; } diff --git a/bindings/matrix-sdk-crypto-ffi/src/machine.rs b/bindings/matrix-sdk-crypto-ffi/src/machine.rs index fbade20e9d2..bc218f42be3 100644 --- a/bindings/matrix-sdk-crypto-ffi/src/machine.rs +++ b/bindings/matrix-sdk-crypto-ffi/src/machine.rs @@ -572,7 +572,7 @@ impl OlmMachine { /// set_room_only_allow_trusted_devices) methods. pub fn get_room_settings( &self, - room_id: &str, + room_id: String, ) -> Result, CryptoStoreError> { let room_id = RoomId::parse(room_id)?; let settings = self @@ -587,7 +587,7 @@ impl OlmMachine { /// available variants pub fn set_room_algorithm( &self, - room_id: &str, + room_id: String, algorithm: EventEncryptionAlgorithm, ) -> Result<(), CryptoStoreError> { let room_id = RoomId::parse(room_id)?; @@ -614,7 +614,7 @@ impl OlmMachine { /// set_only_allow_trusted_devices) method. pub fn set_room_only_allow_trusted_devices( &self, - room_id: &str, + room_id: String, only_allow_trusted_devices: bool, ) -> Result<(), CryptoStoreError> { let room_id = RoomId::parse(room_id)?; diff --git a/bindings/matrix-sdk-crypto-ffi/src/olm.udl b/bindings/matrix-sdk-crypto-ffi/src/olm.udl index 679e504e3cf..edaa4097c2f 100644 --- a/bindings/matrix-sdk-crypto-ffi/src/olm.udl +++ b/bindings/matrix-sdk-crypto-ffi/src/olm.udl @@ -467,3 +467,8 @@ dictionary PickledInboundGroupSession { boolean imported; boolean backed_up; }; + +dictionary RoomSettings { + EventEncryptionAlgorithm algorithm; + boolean only_allow_trusted_devices; +}; \ No newline at end of file diff --git a/crates/matrix-sdk-crypto/src/store/mod.rs b/crates/matrix-sdk-crypto/src/store/mod.rs index 784f34bd807..bbdfc8846ec 100644 --- a/crates/matrix-sdk-crypto/src/store/mod.rs +++ b/crates/matrix-sdk-crypto/src/store/mod.rs @@ -733,7 +733,10 @@ impl Store { /// /// Any users not already on the list are flagged as awaiting a key query. /// Users that were already in the list are unaffected. - pub(crate) async fn update_tracked_users(&self, users: impl Iterator) -> Result<()> { + pub(crate) async fn update_tracked_users( + &self, + users: impl Iterator, + ) -> Result<()> { self.load_tracked_users().await?; let mut store_updates = Vec::new(); diff --git a/crates/matrix-sdk-indexeddb/src/crypto_store.rs b/crates/matrix-sdk-indexeddb/src/crypto_store.rs index 1d5c6cc6fbd..17a2b60149d 100644 --- a/crates/matrix-sdk-indexeddb/src/crypto_store.rs +++ b/crates/matrix-sdk-indexeddb/src/crypto_store.rs @@ -167,7 +167,6 @@ impl IndexeddbCryptoStore { db.create_object_store(keys::SECRET_REQUESTS_BY_INFO)?; db.create_object_store(keys::BACKUP_KEYS)?; - } else if old_version < 1.1 { // We changed how we store inbound group sessions, the key used to // be a trippled of `(room_id, sender_key, session_id)` now it's a @@ -550,10 +549,10 @@ impl_crypto_store! { } if !room_settings_changes.is_empty() { - let settings_store = tx.object_store(KEYS::ROOM_SETTINGS)?; + let settings_store = tx.object_store(keys::ROOM_SETTINGS)?; for (room_id, settings) in &room_settings_changes { - let key = self.encode_key(KEYS::ROOM_SETTINGS, room_id); + let key = self.encode_key(keys::ROOM_SETTINGS, room_id); let value = self.serialize_value(&settings)?; settings_store.put_key_val(&key, &value)?; } @@ -973,11 +972,11 @@ impl_crypto_store! { } async fn get_room_settings(&self, room_id: &RoomId) -> Result> { - let key = self.encode_key(KEYS::ROOM_SETTINGS, room_id); + let key = self.encode_key(keys::ROOM_SETTINGS, room_id); Ok(self .inner - .transaction_on_one_with_mode(KEYS::ROOM_SETTINGS, IdbTransactionMode::Readonly)? - .object_store(KEYS::ROOM_SETTINGS)? + .transaction_on_one_with_mode(keys::ROOM_SETTINGS, IdbTransactionMode::Readonly)? + .object_store(keys::ROOM_SETTINGS)? .get(&key)? .await? .map(|v| self.deserialize_value(v)) @@ -987,8 +986,8 @@ impl_crypto_store! { async fn get_custom_value(&self, key: &str) -> Result>> { Ok(self .inner - .transaction_on_one_with_mode(KEYS::CORE, IdbTransactionMode::Readonly)? - .object_store(KEYS::CORE)? + .transaction_on_one_with_mode(keys::CORE, IdbTransactionMode::Readonly)? + .object_store(keys::CORE)? .get(&JsValue::from_str(key))? .await? .map(|v| self.deserialize_value(v)) @@ -998,8 +997,8 @@ impl_crypto_store! { async fn set_custom_value(&self, key: &str, value: Vec) -> Result<()> { self .inner - .transaction_on_one_with_mode(KEYS::CORE, IdbTransactionMode::Readwrite)? - .object_store(KEYS::CORE)? + .transaction_on_one_with_mode(keys::CORE, IdbTransactionMode::Readwrite)? + .object_store(keys::CORE)? .put_key_val(&JsValue::from_str(key), &self.serialize_value(&value)?)?; Ok(()) }