Module Olm.InboundGroupSession
type t
=
{
buf : char Ctypes.ptr;
igs : C.Types.InboundGroupSession.t Ctypes_static.ptr;
}
val clear : C.Types.InboundGroupSession.t Ctypes_static.ptr -> (int, [> `OlmError ]) Core.result
clear igs
Clear memory backing the given
igs
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 inbound group sessiont
if so.
val alloc : unit -> t
alloc ()
Allocate an
C.Types.InboundGroupSession.t
and return the pointers in at
.
val create : string -> (t, [> OlmError.t ]) Core.result
create outbound_session_key
Start a new inbound group session, using an exported
outbound_session_key
, (obtained withOutboundGroupSession.session_key
).
val pickle : ?pass:string -> t -> (string, [> OlmError.t ]) Core.result
pickle ?pass t
Stores an inbound group session object
t
as a base64 string. Encrypting it using the optionally supplied passphrasepass
. Returns a base64 encoded string of the pickled inbound group session on success.
val from_pickle : ?pass:string -> string -> (t, [> OlmError.t | `ValueError of string ]) Core.result
from_pickle ?pass pickle
Loads an inbound 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 account then the error will be`BadAccountKey
. If the base64 couldn't be decoded then the error will be`InvalidBase64
.
val decrypt : ?ignore_unicode_errors:bool -> t -> string -> (string * int, [> OlmError.t | `ValueError of string | `UnicodeError ]) Core.result
decrypt t ciphertext
Returns a tuple of the plain-text decrypted from
ciphertext
byt
and the message index of the decrypted message or an error on failure. Invalid unicode characters are replaced withUutf.u_rep
unlessignore_unicode_errors
is set to true. Possible olm errors include:*
`InvalidBase64
if the message is not valid base64 *`BadMessageVersion
if the message was encrypted with an unsupported version of the protocol *`BadMessageFormat
if the message headers could not be decoded *`BadMessageMac
if the message could not be verified *`UnknownMessageIndex
if we do not have a session key corresponding to the message's index (i.e., it was sent before the session key was shared with us)
val id : t -> (string, [> OlmError.t ]) Core.result
id t
A base64 encoded identifier for the session
t
.
val first_known_index : t -> int
first_known_index t
The first message index we know how to decrypt for
t
.
val export_session : t -> int -> (string, [> OlmError.t ]) Core.result
export_session t message_index
Export the base64-encoded ratchet key for the session
t
, at the givenmessage_index
, in a format which can be used byimport_session
. Error will be`UnknownMessageIndex
if we do not have a session key formessage_index
(i.e., it was sent before the session key was shared with us)
val import_session : string -> (t, [> OlmError.t ]) Core.result
import_session exported_key
Creates an inbound group session with an
exported_key
from an (previously) existing inbound group session. If theexported_key
is not valid, the error will be`BadSessionKey
.
val is_verified : t -> bool
is_verified t
Check if the session has been verified as a valid session. (A session is verified either because the original session share was signed, or because we have subsequently successfully decrypted a message.)