From 99da0ff18d0397bb5f643283f25d2102a3b00377 Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Mon, 22 Jul 2024 16:32:59 +0100 Subject: [PATCH] crypto: Simplify the interface of search_for_device --- .../src/olm/group_sessions/sender_data_finder.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/matrix-sdk-crypto/src/olm/group_sessions/sender_data_finder.rs b/crates/matrix-sdk-crypto/src/olm/group_sessions/sender_data_finder.rs index 3058e5edb84..0a4dbc99372 100644 --- a/crates/matrix-sdk-crypto/src/olm/group_sessions/sender_data_finder.rs +++ b/crates/matrix-sdk-crypto/src/olm/group_sessions/sender_data_finder.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use ruma::UserId; use tracing::error; use vodozemac::Curve25519PublicKey; @@ -150,7 +151,7 @@ impl<'a> SenderDataFinder<'a> { self.have_device_keys(sender_device_keys).await } else { // No: look for the device in the store - self.search_for_device(sender_curve_key, room_key_event).await + self.search_for_device(sender_curve_key, &room_key_event.sender).await } } @@ -158,12 +159,12 @@ impl<'a> SenderDataFinder<'a> { async fn search_for_device( &self, sender_curve_key: Curve25519PublicKey, - room_key_event: &'a DecryptedRoomKeyEvent, + sender_user_id: &UserId, ) -> OlmResult { // Does the locally-cached (in the store) devices list contain a device with the // curve key of the sender of the to-device message? if let Some(sender_device) = - self.store.get_device_from_curve_key(&room_key_event.sender, sender_curve_key).await? + self.store.get_device_from_curve_key(sender_user_id, sender_curve_key).await? { // Yes: use the device to continue self.have_device(sender_device)