From d313dc2cffda6e2665b701b741f9318bf34cf7b3 Mon Sep 17 00:00:00 2001 From: liemlylac Date: Fri, 18 Apr 2025 09:57:46 +0700 Subject: [PATCH] Add invalidate_group_session --- src/machine.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/machine.rs b/src/machine.rs index bb1127c..8edaa61 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -378,6 +378,22 @@ impl OlmMachine { Ok(()) } + /// Invalidate the currently active outbound group session for the + /// given room. + /// + /// # Arguments + /// + /// * `room_id`, the ID of the room for which the message should be discarded + /// + /// Returns true if a session was invalidated, false if there was + /// no session to invalidate. + #[napi(strict)] + pub async fn invalidate_group_session(&self, room_id: &identifiers::RoomId) -> bool { + let room_id = room_id.inner.clone(); + + self.inner.discard_room_key(&room_id).await.is_ok() + } + /// Get to-device requests to share a room key with users in a room. /// /// # Arguments