Module Pk.Encryption

type t = {
buf : char Ctypes.ptr;
pk_enc : C.Types.PkEncryption.t Ctypes_static.ptr;
}
val clear : C.Types.PkEncryption.t Ctypes_static.ptr -> (int, [> `OlmError ]) Core.result

clear pk_enc

Clear memory backing the given pk_enc 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 pk encryption object t if so.

val alloc : unit -> t

alloc ()

Allocate an C.Types.Pk.Encryption.t and return the pointers in a t.

val create : string -> (t[> OlmError.t | `ValueError of string ]) Core.result

create recipient_key

Create a new PK encryption object with targeted at the supplied recipient_key.

val encrypt : t -> string -> (Message.t[> OlmError.t ]) Core.result

encrypt t plaintext

Encrypts plaintext with t, returning a Message.t.