From 68fd193a782f04b05079b3aeaae064331f1d3b17 Mon Sep 17 00:00:00 2001 From: Michael Hollister Date: Fri, 20 Oct 2023 22:57:50 -0500 Subject: [PATCH] Fixed key forwarding when user identity does not exist in store Signed-off-by: Michael Hollister --- crates/matrix-sdk-crypto/src/olm/account.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/matrix-sdk-crypto/src/olm/account.rs b/crates/matrix-sdk-crypto/src/olm/account.rs index 1c1c9e007ac..b48bec699b1 100644 --- a/crates/matrix-sdk-crypto/src/olm/account.rs +++ b/crates/matrix-sdk-crypto/src/olm/account.rs @@ -1325,11 +1325,14 @@ impl Account { ) .into()) } else { - // If this event is an `m.room_key` event, defer the check for the - // Ed25519 key of the sender until we decrypt room events. This - // ensures that we receive the room key even if we don't have access - // to the device. - if !matches!(*event, AnyDecryptedOlmEvent::RoomKey(_)) { + // If this event is an `m.room_key` or `m.forwarded_room_key` event, + // defer the check for the Ed25519 key of the sender until we decrypt + // room events. This ensures that we receive the room key even if we + // don't have access to the device. + if !matches!( + *event, + AnyDecryptedOlmEvent::RoomKey(_) | AnyDecryptedOlmEvent::ForwardedRoomKey(_) + ) { let Some(device) = store.get_device_from_curve_key(event.sender(), sender_key).await? else {