2016-11-03 11:15:31 -07:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2017-11-14 00:36:14 +01:00
|
|
|
(* Copyright (c) 2014 - 2017. *)
|
2016-11-03 11:15:31 -07:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
(** Tezos - X25519/XSalsa20-Poly1305 cryptography *)
|
|
|
|
|
|
|
|
type nonce
|
|
|
|
|
|
|
|
val random_nonce : unit -> nonce
|
|
|
|
val increment_nonce : ?step:int -> nonce -> nonce
|
2016-11-16 01:19:13 +01:00
|
|
|
val nonce_encoding : nonce Data_encoding.t
|
|
|
|
|
2016-11-17 12:02:32 -08:00
|
|
|
type target
|
2016-11-18 14:07:27 -08:00
|
|
|
val default_target : target
|
2017-01-23 11:09:51 +01:00
|
|
|
val make_target : float -> target
|
2016-11-17 12:02:32 -08:00
|
|
|
|
2016-11-16 01:19:13 +01:00
|
|
|
type secret_key
|
|
|
|
type public_key
|
2017-11-27 06:13:12 +01:00
|
|
|
module Public_key_hash : S.INTERNAL_HASH
|
2017-01-14 13:13:49 +01:00
|
|
|
type channel_key
|
2016-11-16 01:19:13 +01:00
|
|
|
|
|
|
|
val public_key_encoding : public_key Data_encoding.t
|
|
|
|
val secret_key_encoding : secret_key Data_encoding.t
|
|
|
|
|
2017-01-14 13:13:49 +01:00
|
|
|
val hash : public_key -> Public_key_hash.t
|
|
|
|
val random_keypair : unit -> secret_key * public_key * Public_key_hash.t
|
2016-11-16 01:19:13 +01:00
|
|
|
|
2016-11-03 11:15:31 -07:00
|
|
|
val box : secret_key -> public_key -> MBytes.t -> nonce -> MBytes.t
|
2016-11-07 14:38:02 -08:00
|
|
|
val box_open : secret_key -> public_key -> MBytes.t -> nonce -> MBytes.t option
|
2016-11-16 01:19:13 +01:00
|
|
|
|
2017-01-14 13:13:49 +01:00
|
|
|
val precompute : secret_key -> public_key -> channel_key
|
|
|
|
val fast_box : channel_key -> MBytes.t -> nonce -> MBytes.t
|
|
|
|
val fast_box_open : channel_key -> MBytes.t -> nonce -> MBytes.t option
|
|
|
|
|
2016-11-17 12:02:32 -08:00
|
|
|
val check_proof_of_work : public_key -> nonce -> target -> bool
|
2017-01-23 11:09:48 +01:00
|
|
|
val generate_proof_of_work : ?max:int -> public_key -> target -> nonce
|
2017-01-14 13:13:49 +01:00
|
|
|
|