Skip to content

Commit

Permalink
Fixed key forwarding when user identity does not exist in store
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Hollister <[email protected]>
  • Loading branch information
Michael-Hollister committed Oct 21, 2023
1 parent 7758e61 commit 68fd193
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions crates/matrix-sdk-crypto/src/olm/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 68fd193

Please sign in to comment.