Crate olm_rs

Source
Expand description

This is a wrapper for libolm. It exposes all original functionality, split into task oriented modules.

This wrapper takes care of memory allocation for you, so all functions in the original library exposing the buffer length of certain read/write buffers (and similar functionality) are not exposed by this wrapper.

Random number generation is also handled internally and hence there are no function arguments for supplying random data.

String arguments will vary in ownership requirements when being provided as a function argument. This is because libolm will sometimes mutate this data and sometimes won’t. To avoid breaking the ownership model, full ownership is required for the former case.

All errors of the type NOT_ENOUGH_RANDOM and OUTPUT_BUFFER_TOO_SMALL from libolm that are encountered result in a panic, as they are unrecoverably fatal. Similarly the output from libolm is assumed to be trusted, except for encryption functions. If the string output from any other function is not properly encoded as UTF-8, a panic will occur as well. In case a function can panic, it is annotated as such in the documentation.

All panics can be considered unreachable, they are documented however for the purpose of transparency.

Modules§

account
This module wraps around all functions following the pattern olm_account_*.
errors
A collection of all errors that can be returned by libolm.
inbound_group_session
This module wraps around all functions in inbound_group_session.h.
outbound_group_session
This module wraps around all functions in outbound_group_session.h.
pk
This module wraps around all functions following the pattern olm_pk_*.
sas
This module wraps around all functions following the pattern olm_sas_*.
session
This module wraps around all functions following the pattern olm_session_*, as well as functions for encryption and decryption using the Double Ratchet algorithm.
utility
This module wraps around all functions following the pattern olm_utility_*.

Structs§

OlmVersion
Used for storing the version number of libolm. Solely returned by get_library_version().

Enums§

PicklingMode
Used for setting the encryption parameter for pickling (serialisation) functions. Unencrypted is functionally equivalent to Encrypted{key: [].to_vec() }, but is much more clear. Pickling modes have to be equivalent for pickling and unpickling operations to succeed. Encrypted takes ownership of key, in order to properly destroy it after use.

Functions§

get_library_version
Returns the version number of the currently utilised libolm.