Module Pk.Signing

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

clear pk_sgn

Clear memory backing the given pk_sgn 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 signing object t if so.

val alloc : unit -> t

alloc ()

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

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

create seed

Create a new PK signing object with the provided seed which will used as the private key for signing. Provided seed must have the same length as the seeds generated by generate_seed ().

val generate_seed : unit -> string

generate_seed ()

Generate and random seed.

val sign : t -> string -> (string, [> OlmError.t ]) Core.result

sign t msg

Signs the message msg with the pk signing t, returning the signature.