package tezos-base
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=7062cd57addd452852598a2214ade393130efa087b99068d53713bdf912b3680
sha512=08e4091144a03ce3c107fb91a66501bd8b65ca3278917c455a2eaac6df3e108ade63f6ab8340a4bb152d60f404326e464d0ec95d26cafe8e82f870465d24a5fc
doc/tezos-base.p2p-identity-file/Tezos_base_p2p_identity_file/Identity_file/index.html
Module Tezos_base_p2p_identity_file.Identity_fileSource
val read :
?expected_pow:float ->
string ->
Tezos_base.TzPervasives.P2p_identity.t Tezos_base.TzPervasives.tzresult Lwt.tread ?expected_pow filename reads an P2p_identity.t from disk at location filename. If expected_pow is set, the function also checks that the read identity has the expected PoW.
The function fails with:
No_identity_fileif the given file is not found;Identity_mismatchif the given identity is ill-formed (the id is not the hash of the public key);Identity_keys_mismatchif the the public and secret keys do not match;Insufficient_proof_of_workif the read identity doesn't have the expected PoW.
val write :
check_data_dir:
(data_dir:string -> unit Tezos_base.TzPervasives.tzresult Lwt.t) ->
string ->
Tezos_base.TzPervasives.P2p_identity.t ->
unit Tezos_base.TzPervasives.tzresult Lwt.twrite ~check_data_dir filename identity writes identity into file filename. The function fails with Existent_identity_file if the file already exists.
See init for check_data_dir.
val generate :
check_data_dir:
(data_dir:string -> unit Tezos_base.TzPervasives.tzresult Lwt.t) ->
string ->
float ->
Tezos_base.TzPervasives.P2p_identity.t Tezos_base.TzPervasives.tzresult Lwt.tgenerate ~check_data_dir filename expected_pow generates a fresh identity with the given expected_pow and saves it into filename. The function fails with Existent_identity_file if filename already exists.
val init :
check_data_dir:
(data_dir:string -> unit Tezos_base.TzPervasives.tzresult Lwt.t) ->
identity_file:string ->
expected_pow:float ->
Tezos_base.TzPervasives.P2p_identity.t Tezos_base.TzPervasives.tzresult Lwt.tinit ~check_data_dir ~identity_file ~expected_pow returns the P2p_identity.t read from identity_file, if any. Otherwise, it generates a fresh one with the given expected_pow, saves it into identity_file and returns it. In this latter case, the function check_data_dir can be used to enforce invariants on the "data dir" (the directory containing the identity file).