Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sender Data: Support sender data in InboundGroupSession and InboundGroupSessionPickle #3542

Closed
andybalaam opened this issue Jun 13, 2024 · 0 comments · Fixed by #3556
Closed
Assignees

Comments

@andybalaam
Copy link
Member

andybalaam commented Jun 13, 2024

As part of supporting Invisible Crypto, we want to store information about the sender with an InboundGroupSession (and persist it, so it needs to be in InboundGroupSessionPickle too).

Part of #3544 which is part of Invisible Crypto.

Add something like this to InboundGroupSession and PickledInboundGroupSession

    sender_data: InboundGroupSessionSenderData,

Where

/// Information on the device and user that sent the megolm session data to us
#[derive(Clone)]
pub enum InboundGroupSessionSenderData {
   /// We have not yet found the (signed) device info for the sending device
   UnknownDevice {
      // we may need to handle unsigned and unknown devices separately, which
      // probably necessitates a flag here
      retry_details: RetryDetails,
      legacy_session: bool,
   },

   /// We have the signed device info for the sending device, but not yet the
   /// cross-signing key that it was signed with.
   DeviceInfo { 
       device_keys: DeviceKeys, 
       retry_details: RetryDetails,
       legacy_session: bool
   },

   /// We have figured out the MSK and user
   SenderKnown {
       mxid: OwnedUserId,
       msk: Ed25519PublicKey,
       /// Whether, at the time we checked the signature on the device,
       /// we had actively verified that `msk` belongs to the user.
       msk_verified: bool,  // or maybe VerificationState
   },
}

#[derive(Clone)]
struct RetryDetails {
   retry_count: u8,
   next_retry_time_ms: MillisecondsSinceUnixEpoch,
}

PickledInboundGroupSession must be deserializable from an existing stored inbound group session (ie, one which lacks a sender_data field). In this case, it is a “legacy” session; we set it to UnknownDevice with legacy_session=true and a next_retry_time_ms in the near future).

@andybalaam andybalaam changed the title Support sender data in InboundGroupSession and InboundGroupSessionPickle Sender Data: Support sender data in InboundGroupSession and InboundGroupSessionPickle Jun 13, 2024
@andybalaam andybalaam self-assigned this Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant