pub struct Session {
    pub user_id: Arc<UserId>,
    pub device_id: Arc<DeviceId>,
    pub our_identity_keys: Arc<IdentityKeys>,
    pub inner: Arc<Mutex<InnerSession>>,
    pub session_id: Arc<str>,
    pub sender_key: Curve25519PublicKey,
    pub created_using_fallback_key: bool,
    pub creation_time: SecondsSinceUnixEpoch,
    pub last_use_time: SecondsSinceUnixEpoch,
}
Expand description

Cryptographic session that enables secure communication between two Accounts

Fields

user_id: Arc<UserId>

The UserId associated with this session

device_id: Arc<DeviceId>

The specific DeviceId associated with this session

our_identity_keys: Arc<IdentityKeys>

The IdentityKeys associated with this session

inner: Arc<Mutex<InnerSession>>

The OlmSession

session_id: Arc<str>

Our sessionId

sender_key: Curve25519PublicKey

The Key of the sender

created_using_fallback_key: bool

Has this been created using the fallback key

creation_time: SecondsSinceUnixEpoch

When the session was created

last_use_time: SecondsSinceUnixEpoch

When the session was last used

Implementations

Decrypt the given Olm message.

Returns the decrypted plaintext or an DecrypitonError if decryption failed.

Arguments
  • message - The Olm message that should be decrypted.

Get the sender key that was used to establish this Session.

Encrypt the given event content content as an m.room.encrypted event content.

Arguments
  • recipient_device - The device for which this message is going to be encrypted, this needs to be the device that was used to create this session with.

  • content - The content of the event.

Returns the unique identifier for this session.

Store the session as a base64 encoded string.

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

Restore a Session from a previously pickled string.

Returns the restored Olm Session or a SessionUnpicklingError if there was an error.

Arguments
  • user_id - Our own user id that the session belongs to.

  • device_id - Our own device ID that the session belongs to.

  • our_idenity_keys - An clone of the Arc to our own identity keys.

  • pickle - The pickled version of the Session.

  • pickle_mode - The mode that was used to pickle the 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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

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