2017-11-14 03:32:46 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2017-11-14 03:36:14 +04:00
|
|
|
(* Copyright (c) 2014 - 2017. *)
|
2017-11-14 03:32:46 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-11-14 03:32:46 +04:00
|
|
|
(** Tezos - Ed25519 cryptography *)
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-28 05:56:40 +04:00
|
|
|
(** {2 Hashed public keys for user ID} ***************************************)
|
|
|
|
|
|
|
|
module Public_key_hash : Hash.HASH
|
|
|
|
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
(** {2 Signature} ************************************************************)
|
|
|
|
|
2017-02-28 05:56:40 +04:00
|
|
|
module Public_key : sig
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-28 05:56:40 +04:00
|
|
|
include Compare.S
|
|
|
|
val encoding: t Data_encoding.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-28 05:56:40 +04:00
|
|
|
val hash: t -> Public_key_hash.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-28 05:56:40 +04:00
|
|
|
type Base58.data +=
|
|
|
|
| Public_key of t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-04-05 11:54:21 +04:00
|
|
|
val of_b58check_exn: string -> t
|
|
|
|
val of_b58check_opt: string -> t option
|
2017-02-28 05:56:40 +04:00
|
|
|
val to_b58check: t -> string
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-28 05:56:40 +04:00
|
|
|
val of_bytes: Bytes.t -> t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2018-01-15 18:03:13 +04:00
|
|
|
val to_hex: t -> [ `Hex of string ]
|
|
|
|
val of_hex: [ `Hex of string ] -> t option
|
|
|
|
val of_hex_exn: [ `Hex of string ] -> t
|
|
|
|
|
2017-02-28 05:56:40 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
module Secret_key : sig
|
|
|
|
|
|
|
|
type t
|
|
|
|
val encoding: t Data_encoding.t
|
|
|
|
|
|
|
|
type Base58.data +=
|
|
|
|
| Secret_key of t
|
|
|
|
|
2017-04-05 11:54:21 +04:00
|
|
|
val of_b58check_exn: string -> t
|
|
|
|
val of_b58check_opt: string -> t option
|
2017-02-28 05:56:40 +04:00
|
|
|
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
|
|
|
|
|
2017-04-05 11:54:21 +04:00
|
|
|
val of_b58check_exn: string -> t
|
|
|
|
val of_b58check_opt: string -> t option
|
2017-02-28 05:56:40 +04:00
|
|
|
val to_b58check: t -> string
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-28 05:56:40 +04:00
|
|
|
val of_bytes: Bytes.t -> t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-28 05:56:40 +04:00
|
|
|
(** Checks a signature *)
|
|
|
|
val check: Public_key.t -> t -> MBytes.t -> bool
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-28 05:56:40 +04:00
|
|
|
(** Append a signature *)
|
|
|
|
val append: Secret_key.t -> MBytes.t -> MBytes.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-28 05:56:40 +04:00
|
|
|
end
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-28 05:56:40 +04:00
|
|
|
val sign: Secret_key.t -> MBytes.t -> Signature.t
|
2017-02-24 18:38:42 +04:00
|
|
|
|
2017-02-28 05:56:40 +04:00
|
|
|
val generate_key: unit -> (Public_key_hash.t * Public_key.t * Secret_key.t)
|