Struct matrix_sdk_crypto::olm::OutboundGroupSession [−][src]
pub struct OutboundGroupSession { /* fields omitted */ }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
pub fn new(
device_id: Arc<DeviceId>,
identity_keys: Arc<IdentityKeys>,
room_id: &RoomId,
settings: EncryptionSettings
) -> Self
pub fn new(
device_id: Arc<DeviceId>,
identity_keys: Arc<IdentityKeys>,
room_id: &RoomId,
settings: EncryptionSettings
) -> Self
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.
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.
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.
pub fn from_pickle(
device_id: Arc<DeviceId>,
identity_keys: Arc<IdentityKeys>,
pickle: PickledOutboundGroupSession,
pickling_mode: PicklingMode
) -> Result<Self, OlmGroupSessionError>
pub fn from_pickle(
device_id: Arc<DeviceId>,
identity_keys: Arc<IdentityKeys>,
pickle: PickledOutboundGroupSession,
pickling_mode: PicklingMode
) -> Result<Self, OlmGroupSessionError>
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 theOutboundGroupSession. -
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
Auto Trait Implementations
impl !RefUnwindSafe for OutboundGroupSession
impl Send for OutboundGroupSession
impl Sync for OutboundGroupSession
impl Unpin for OutboundGroupSession
impl !UnwindSafe for OutboundGroupSession
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more