diff --git a/crates/matrix-sdk/src/room/mod.rs b/crates/matrix-sdk/src/room/mod.rs index 3404db2e2..49def01dd 100644 --- a/crates/matrix-sdk/src/room/mod.rs +++ b/crates/matrix-sdk/src/room/mod.rs @@ -2000,13 +2000,13 @@ impl Room { /// let room_id = room_id!("!SVkFJHzfwvuaIEawgC:localhost"); /// /// if let Some(room) = client.get_room(&room_id) { - /// room.enable_encryption_with_state().await? + /// room.enable_encryption_with_state_event_encryption().await? /// } /// # anyhow::Ok(()) }; /// ``` #[instrument(skip_all)] #[cfg(feature = "experimental-encrypted-state-events")] - pub async fn enable_encryption_with_state(&self) -> Result<()> { + pub async fn enable_encryption_with_state_event_encryption(&self) -> Result<()> { self.enable_encryption_inner(true).await } diff --git a/crates/matrix-sdk/src/test_utils/mocks/mod.rs b/crates/matrix-sdk/src/test_utils/mocks/mod.rs index 1440dea4b..5776e539a 100644 --- a/crates/matrix-sdk/src/test_utils/mocks/mod.rs +++ b/crates/matrix-sdk/src/test_utils/mocks/mod.rs @@ -2457,10 +2457,9 @@ impl<'a> MockEndpoint<'a, EncryptionStateEndpoint> { /// # anyhow::Ok(()) }); #[cfg(feature = "experimental-encrypted-state-events")] pub fn state_encrypted(self) -> MatrixMock<'a> { - self.respond_with( - ResponseTemplate::new(200) - .set_body_json(&*test_json::sync_events::ENCRYPTION_WITH_STATE_CONTENT), - ) + self.respond_with(ResponseTemplate::new(200).set_body_json( + &*test_json::sync_events::ENCRYPTION_WITH_ENCRYPTED_STATE_EVENTS_CONTENT, + )) } /// Marks the room as not encrypted. diff --git a/crates/matrix-sdk/tests/integration/room/joined.rs b/crates/matrix-sdk/tests/integration/room/joined.rs index 9605881f4..3a617081c 100644 --- a/crates/matrix-sdk/tests/integration/room/joined.rs +++ b/crates/matrix-sdk/tests/integration/room/joined.rs @@ -1133,7 +1133,9 @@ async fn test_enable_state_encryption_doesnt_stay_unknown() { assert_matches!(room.latest_encryption_state().await.unwrap(), EncryptionState::NotEncrypted); - room.enable_encryption_with_state().await.expect("enabling encryption should work"); + room.enable_encryption_with_state_event_encryption() + .await + .expect("enabling encryption should work"); mock.verify_and_reset().await; mock.mock_room_state_encryption().state_encrypted().mount().await; diff --git a/testing/matrix-sdk-test/src/sync_builder/test_event.rs b/testing/matrix-sdk-test/src/sync_builder/test_event.rs index ec83a35d9..28e105572 100644 --- a/testing/matrix-sdk-test/src/sync_builder/test_event.rs +++ b/testing/matrix-sdk-test/src/sync_builder/test_event.rs @@ -15,7 +15,7 @@ pub enum StateTestEvent { Aliases, Create, Encryption, - EncryptionWithState, + EncryptionWithEncryptedStateEvents, HistoryVisibility, JoinRules, Member, @@ -41,8 +41,8 @@ impl From for JsonValue { StateTestEvent::Aliases => test_json::sync_events::ALIASES.to_owned(), StateTestEvent::Create => test_json::sync_events::CREATE.to_owned(), StateTestEvent::Encryption => test_json::sync_events::ENCRYPTION.to_owned(), - StateTestEvent::EncryptionWithState => { - test_json::sync_events::ENCRYPTION_WITH_STATE.to_owned() + StateTestEvent::EncryptionWithEncryptedStateEvents => { + test_json::sync_events::ENCRYPTION_WITH_ENCRYPTED_STATE_EVENTS.to_owned() } StateTestEvent::HistoryVisibility => { test_json::sync_events::HISTORY_VISIBILITY.to_owned() diff --git a/testing/matrix-sdk-test/src/test_json/sync_events.rs b/testing/matrix-sdk-test/src/test_json/sync_events.rs index 848d24c82..ca0898b51 100644 --- a/testing/matrix-sdk-test/src/test_json/sync_events.rs +++ b/testing/matrix-sdk-test/src/test_json/sync_events.rs @@ -138,7 +138,7 @@ pub static ENCRYPTION: Lazy = Lazy::new(|| { }) }); -pub static ENCRYPTION_WITH_STATE_CONTENT: Lazy = Lazy::new(|| { +pub static ENCRYPTION_WITH_ENCRYPTED_STATE_EVENTS_CONTENT: Lazy = Lazy::new(|| { json!({ "algorithm": "m.megolm.v1.aes-sha2", "rotation_period_ms": 604800000, @@ -147,9 +147,9 @@ pub static ENCRYPTION_WITH_STATE_CONTENT: Lazy = Lazy::new(|| { }) }); -pub static ENCRYPTION_WITH_STATE: Lazy = Lazy::new(|| { +pub static ENCRYPTION_WITH_ENCRYPTED_STATE_EVENTS: Lazy = Lazy::new(|| { json!({ - "content": *ENCRYPTION_WITH_STATE_CONTENT, + "content": *ENCRYPTION_WITH_ENCRYPTED_STATE_EVENTS_CONTENT, "event_id": "$143273582443PhrSn:example.org", "origin_server_ts": 1432735824653u64, "room_id": "!jEsUZKDJdhlrceRyVU:example.org",