67 lines
1.2 KiB
OCaml
67 lines
1.2 KiB
OCaml
(** Tezos - Ed25519 cryptography *)
|
|
|
|
|
|
(** {2 Hashed public keys for user ID} ***************************************)
|
|
|
|
module Public_key_hash : Hash.HASH
|
|
|
|
|
|
(** {2 Signature} ************************************************************)
|
|
|
|
module Public_key : sig
|
|
|
|
include Compare.S
|
|
val encoding: t Data_encoding.t
|
|
|
|
val hash: t -> Public_key_hash.t
|
|
|
|
type Base58.data +=
|
|
| Public_key of t
|
|
|
|
val of_b58check: string -> t
|
|
val to_b58check: t -> string
|
|
|
|
val of_bytes: Bytes.t -> t
|
|
|
|
end
|
|
|
|
module Secret_key : sig
|
|
|
|
type t
|
|
val encoding: t Data_encoding.t
|
|
|
|
type Base58.data +=
|
|
| Secret_key of t
|
|
|
|
val of_b58check: string -> t
|
|
val to_b58check: t -> string
|
|
|
|
val of_bytes: Bytes.t -> t
|
|
|
|
end
|
|
|
|
module Signature : sig
|
|
|
|
type t
|
|
val encoding: t Data_encoding.t
|
|
|
|
type Base58.data +=
|
|
| Signature of t
|
|
|
|
val of_b58check: string -> t
|
|
val to_b58check: t -> string
|
|
|
|
val of_bytes: Bytes.t -> t
|
|
|
|
(** Checks a signature *)
|
|
val check: Public_key.t -> t -> MBytes.t -> bool
|
|
|
|
(** Append a signature *)
|
|
val append: Secret_key.t -> MBytes.t -> MBytes.t
|
|
|
|
end
|
|
|
|
val sign: Secret_key.t -> MBytes.t -> Signature.t
|
|
|
|
val generate_key: unit -> (Public_key_hash.t * Public_key.t * Secret_key.t)
|