Struct olm_rs::session::OlmSession[][src]

pub struct OlmSession { /* fields omitted */ }
Expand description

Either an outbound or inbound session for secure communication.

Implementations

Retuns the identifier for this session. Will be the same for both ends of the conversation.

C-API equivalent

olm_session_id

Panics

  • OutputBufferTooSmall if the supplied output buffer for the ID was too small
  • on malformed UTF-8 coding of the session ID provided by libolm

Serialises an OlmSession to encrypted base64.

C-API equivalent

olm_pickle_session

Panics

  • OUTPUT_BUFFER_TOO_SMALL for OlmSession’s pickled buffer
  • on malformed UTF-8 coding of the pickling provided by libolm

Deserialises from encrypted base64 that was previously obtained by pickling an OlmSession.

C-API equivalent

olm_unpickle_session

Errors

  • BadAccountKey if the key doesn’t match the one the session was encrypted with
  • InvalidBase64 if decoding the supplied pickled string slice fails

Encrypts a plaintext message using the session.

C-API equivalent

  • olm_encrypt

Panics

  • NotEnoughRandom for too little supplied random data
  • OutputBufferTooSmall for encrypted message
  • on malformed UTF-8 coding of the ciphertext provided by libolm

Decrypts a message using this session. Decoding is lossy, meaing if the decrypted plaintext contains invalid UTF-8 symbols, they will be returned as U+FFFD (�).

C-API equivalent

olm_decrypt

Errors

  • InvalidBase64 on invalid base64 coding for supplied arguments
  • BadMessageVersion on unsupported protocol version
  • BadMessageFormat on failing to decode the message
  • BadMessageMac on invalid message MAC

Panics

  • OutputBufferTooSmall on plaintext output buffer

Checker for any received messages for this session.

C-API equivalent

olm_session_has_received_message

Checks if the ‘prekey’ message is for this in-bound session.

C-API equivalent

olm_matches_inbound_session

Errors

  • InvalidBase64 for failing to decode base64 in one_time_key_message
  • BadMessageVersion for message from unsupported protocol version
  • BadMessageFormat for failing to decode one_time_key_message

Checks if the ‘prekey’ message is for this in-bound session.

C-API equivalent

olm_matches_inbound_session

Errors

  • InvalidBase64 for failing to decode base64 in one_time_key_message
  • BadMessageVersion for message from unsupported protocol version
  • BadMessageFormat for failing to decode one_time_key_message

Trait Implementations

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

orders by unicode code points (which is a superset of ASCII)

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

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

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. 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

Performs the conversion.

Performs the conversion.

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.