Module Olm.OutboundGroupSession
type t
=
{
buf : char Ctypes.ptr;
ogs : C.Types.OutboundGroupSession.t Ctypes_static.ptr;
}
val clear : C.Types.OutboundGroupSession.t Ctypes_static.ptr -> (int, [> `OlmError ]) Core.result
clear ogs
Clear memory backing the given
ogs
pointer.
val check_error : t -> Unsigned.size_t -> (int, [> OlmError.t ]) Core.result
check_error t ret
Check whether return code
ret
is equal to `olm_error()` ( -1 ), returning the return value as an int if not, and the `last_error` from the outbound group sessiont
if so.
val alloc : unit -> t
alloc ()
Allocate an
C.Types.OutboundGroupSession.t
and return the pointers in at
.
val create : unit -> (t, [> OlmError.t ]) Core.result
create ()
Start a new outbound group session.
val pickle : ?pass:string -> t -> (string, [> OlmError.t ]) Core.result
pickle ?pass t
Stores an outbound group session object
t
as a base64 string. Encrypting it using the optionally supplied passphrasepass
. Returns a base64 encoded string of the pickled outbound group session on success.
val from_pickle : ?pass:string -> string -> (t, [> OlmError.t | `ValueError of string ]) Core.result
from_pickle ?pass pickle
Loads an outbound group session from a pickled base64-encoded string
pickle
and returns at
, decrypted with the optionally supplied passphrasepass
. If the passphrase doesn't match the one used to encrypt the outbound group session then the error will be`BadAccountKey
. If the base64 couldn't be decoded then the error will be`InvalidBase64
.
val encrypt : t -> string -> (string, [> OlmError.t ]) Core.result
encrypt t plaintext
Ecrypts
plaintext
with the outbound group sessiont
.
val id : t -> (string, [> OlmError.t ]) Core.result
id t
A base64 encoded identifier for the session
t
.
val message_index : t -> int
message_index t
The current message index of the session
t
. Each message is encrypted with an increasing index. This is the index for the next message.
val session_key : t -> (string, [> OlmError.t ]) Core.result
session_key t
The base64-encoded current ratchet key for the session
t
. Each message is encrypted with a different ratchet key. This function returns the ratchet key that will be used for the next message.