Skip to content

Commit f1ad14a

Browse files
committed
crypto: Calculate sender data for incoming sessions
1 parent f4ad80b commit f1ad14a

File tree

5 files changed

+882
-3
lines changed

5 files changed

+882
-3
lines changed

crates/matrix-sdk-crypto/src/machine.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ use crate::{
6363
identities::{user::UserIdentities, Device, IdentityManager, UserDevices},
6464
olm::{
6565
Account, CrossSigningStatus, EncryptionSettings, IdentityKeys, InboundGroupSession,
66-
OlmDecryptionInfo, PrivateCrossSigningIdentity, SenderData, SessionType, StaticAccountData,
66+
OlmDecryptionInfo, PrivateCrossSigningIdentity, SenderDataFinder, SessionType,
67+
StaticAccountData,
6768
},
6869
requests::{IncomingResponse, OutgoingRequest, UploadSigningKeysRequest},
6970
session_manager::{GroupSessionManager, SessionManager},
@@ -806,7 +807,7 @@ impl OlmMachine {
806807
event: &DecryptedRoomKeyEvent,
807808
content: &MegolmV1AesSha2Content,
808809
) -> OlmResult<Option<InboundGroupSession>> {
809-
let sender_data = SenderData::unknown();
810+
let sender_data = SenderDataFinder::find(self, sender_key, event, content).await?;
810811

811812
let session = InboundGroupSession::new(
812813
sender_key,

crates/matrix-sdk-crypto/src/olm/group_sessions/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ use serde::{Deserialize, Serialize};
1818
mod inbound;
1919
mod outbound;
2020
mod sender_data;
21+
mod sender_data_finder;
2122

2223
pub use inbound::{InboundGroupSession, PickledInboundGroupSession};
2324
pub(crate) use outbound::ShareState;
2425
pub use outbound::{
2526
EncryptionSettings, OutboundGroupSession, PickledOutboundGroupSession, ShareInfo,
2627
};
2728
pub use sender_data::{SenderData, SenderDataRetryDetails};
29+
pub(crate) use sender_data_finder::SenderDataFinder;
2830
use thiserror::Error;
2931
pub use vodozemac::megolm::{ExportedSessionKey, SessionKey};
3032
use vodozemac::{megolm::SessionKeyDecodeError, Curve25519PublicKey};

0 commit comments

Comments
 (0)