Skip to content

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

@andybalaam

Description

@andybalaam

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).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions