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

An Olm session represents one end of an encrypted communication channel between two participants.

A session enables enables the session owner to encrypt messages intended for, and decrypt messages sent by, the other participant of the channel.

Olm sessions have two important properties:

  1. They are based on a double ratchet algorithm which continuously introduces new entropy into the channel as messages are sent and received. This imbues the channel with self-healing properties, allowing it to recover from a momentary loss of confidentiality in the event of a key compromise.
  2. They are asynchronous, allowing the participant to start sending messages to the other side even if the other participant is not online at the moment.

An Olm Session is acquired from an Account, by calling either

Implementations

Returns the globally unique session ID, in base64-encoded form.

A session ID is the SHA256 of the concatenation of the account’s identity key, an ephemeral base key and the one-time key which was used to establish the session. Due to the construction, every session ID is (probabilistically) globally unique.

Have we ever received and decrypted a message from the other side?

Used to decide if outgoing messages should be sent as normal or pre-key messages.

Encrypt the plaintext and construct an OlmMessage.

The message will either be a pre-key message or a normal message, depending on whether the session is fully established. A session is fully established once you receive (and decrypt) at least one message from the other side.

Get the keys associated with this session.

Try to decrypt an Olm message, which will either return the plaintext or result in a DecryptionError.

Convert the session into a struct which implements serde::Serialize and serde::Deserialize.

Restore a Session from a previously saved SessionPickle.

Create a Session object by unpickling a session pickle in libolm legacy pickle format.

Such pickles are encrypted and need to first be decrypted using pickle_key.

Trait Implementations

Formats the value using the given formatter. Read more

Converts to this type from the input type.

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.

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