Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason not to call this discard_room_key too, as it's much less confusing for developers following the rust-sdk.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same function name in the matrix-sdk-crypto-wasm repo
Refs: https://github.com/matrix-org/matrix-sdk-crypto-wasm/blob/main/src/machine.rs#L835

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
Expand Down