pub struct OutboundGroupSession { /* private fields */ }
Expand description

Outbound group session.

Outbound group sessions are used to exchange room messages between a group of participants. Outbound group sessions are used to encrypt the room messages.

Implementations

Create a new outbound group session for the given room.

Outbound group sessions are used to encrypt room messages.

Arguments
  • device_id - The id of the device that created this session.

  • identity_keys - The identity keys of the account that created this session.

  • room_id - The id of the room that the session is used in.

  • settings - Settings determining the algorithm and rotation period of the outbound group session.

This should be called if an the user wishes to rotate this session.

Get the encryption settings of this outbound session.

Mark the request with the given request id as sent.

This removes the request from the queue and marks the set of users/devices that received the session.

Encrypt a room message for the given room.

Beware that a group session needs to be shared before this method can be called using the share_group_session() method.

Since group sessions can expire or become invalid if the room membership changes client authors should check with the should_share_group_session() method if a new group session needs to be shared.

Arguments
  • content - The plaintext content of the message that should be encrypted in raw json Value form.

  • event_type - The plaintext type of the event, the outer type of the event will become m.room.encrypted.

Panics

Panics if the content can’t be serialized.

Check if the session has expired and if it should be rotated.

A session will expire after some time or if enough messages have been encrypted using it.

Has the session been invalidated.

Mark the session as shared.

Messages shouldn’t be encrypted with the session before it has been shared.

Check if the session has been marked as shared.

Get the session key of this session.

A session key can be used to to create an InboundGroupSession.

Get the room id of the room this session belongs to.

Returns the unique identifier for this session.

Get the current message index for this session.

Each message is sent with an increasing index. This returns the message index that will be used for the next encrypted message.

Restore a Session from a previously pickled string.

Returns the restored group session or a OlmGroupSessionError if there was an error.

Arguments
  • device_id - The device id of the device that created this session. Put differently, our own device id.

  • identity_keys - The identity keys of the device that created this session, our own identity keys.

  • pickle - The pickled version of the OutboundGroupSession.

  • pickle_mode - The mode that was used to pickle the session, either an unencrypted mode or an encrypted using passphrase.

Store the group session as a base64 encoded string and associated data belonging to the session.

Arguments
  • pickle_mode - The mode that should be used to pickle the group session, either an unencrypted mode or an encrypted using passphrase.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more