package secp256k1

  1. Overview
  2. Docs

Message

type msg
val msg_of_bytes : ?pos:int -> buffer -> msg option
val msg_of_bytes_exn : ?pos:int -> buffer -> msg
val write_msg_exn : ?pos:int -> buffer -> msg -> int
val write_msg : ?pos:int -> buffer -> msg -> (int, string) result
val msg_to_bytes : msg -> buffer

Signature

type plain
type recoverable
type _ t = private
  1. | P : buffer -> plain t
  2. | R : buffer -> recoverable t
val equal : 'a t -> 'a t -> bool
val to_plain : Context.t -> recoverable t -> plain t

Input/Output

val read : Context.t -> ?pos:int -> buffer -> (plain t, string) result
val read_exn : Context.t -> ?pos:int -> buffer -> plain t
val read_der : Context.t -> ?pos:int -> buffer -> (plain t, string) result
val read_der_exn : Context.t -> ?pos:int -> buffer -> plain t
val read_recoverable : Context.t -> recid:int -> ?pos:int -> buffer -> (recoverable t, string) result
val read_recoverable_exn : Context.t -> recid:int -> ?pos:int -> buffer -> recoverable t
val write_exn : ?der:bool -> Context.t -> ?pos:int -> buffer -> _ t -> int
val write : ?der:bool -> Context.t -> ?pos:int -> buffer -> _ t -> (int, string) result
val to_bytes : ?der:bool -> Context.t -> _ t -> buffer
val to_bytes_recid : Context.t -> recoverable t -> buffer * int

Sign

Creation
val sign : Context.t -> sk:Key.secret Key.t -> msg:msg -> (plain t, string) result
val sign_exn : Context.t -> sk:Key.secret Key.t -> msg:msg -> plain t
val sign_recoverable : Context.t -> sk:Key.secret Key.t -> msg -> (recoverable t, string) result
val sign_recoverable_exn : Context.t -> sk:Key.secret Key.t -> msg -> recoverable t
Direct write in buffers
val write_sign : Context.t -> sk:Key.secret Key.t -> msg:msg -> ?pos:int -> buffer -> (int, string) result
val write_sign_exn : Context.t -> sk:Key.secret Key.t -> msg:msg -> ?pos:int -> buffer -> int
val write_sign_recoverable : Context.t -> sk:Key.secret Key.t -> msg:msg -> ?pos:int -> buffer -> (int, string) result
val write_sign_recoverable_exn : Context.t -> sk:Key.secret Key.t -> msg:msg -> ?pos:int -> buffer -> int
Verification
val verify_exn : Context.t -> pk:Key.public Key.t -> msg:msg -> signature:_ t -> bool
val verify : Context.t -> pk:Key.public Key.t -> msg:msg -> signature:_ t -> (bool, string) result
Recovery
val recover_exn : Context.t -> signature:recoverable t -> msg:msg -> Key.public Key.t
val recover : Context.t -> signature:recoverable t -> msg:msg -> (Key.public Key.t, string) result
OCaml

Innovation. Community. Security.