Module Tezt_tezos.Account

type secret_key =
  1. | Unencrypted of string
    (*

    The string does NOT contain the 'encrypted:' prefix

    *)
  2. | Encrypted of string
  3. | Remote of string

This type is used to construct values for secret keys.

Note: The tests only use unencrypted keys for the moment, please add new constructors for other keys here, as needed.

type key = {
  1. alias : string;
  2. public_key_hash : string;
  3. public_key : string;
  4. secret_key : secret_key;
}

Keys associated to an account. For example:

    {
      alias = "bootstrap1";
      public_key_hash = "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx";
      public_key = "edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav";
      secret_key =
        Unencrypted "edsk3gUfUPyBSfrS9CCgmCiQsTCHGkviBDusMxDJstFtojtc1zcpsh";
    }
val key_typ : key Tezt_wrapper.Check.typ

A Check.typ for key

val sign_bytes : ?watermark:Tezos_crypto.Signature.watermark -> signer:key -> bytes -> Tezos_crypto.Signature.t

sign_bytes ~watermark ~signer message signs the bytes message with signer's secret key. Returns the corresponding Tezos signature. This function can be used to sign transactions, blocks, etc. depending on the given watermark.

Used for regular accounts.

val require_unencrypted_secret_key : __LOC__:string -> secret_key -> string

require_unencrypted_secret_key ~__LOC__ key returns sk if key is Unencrypted sk, or fails.

val require_unencrypted_or_remote_secret_key : __LOC__:string -> secret_key -> unit
val uri_of_secret_key : secret_key -> string

uri_of_secret_key secret_key returns secret_key as an URI.

The URI of a secret key is its contents prefixed unencrypted: respectively encrypted: if it is unencrypted respetively encrypted.

val secret_key_typ : secret_key Tezt_wrapper.Check.typ

A Check.typ for secret_key

val write : key list -> base_dir:string -> unit

write keys ~base_dir writes the keys into the octez-client's data directory base_dir. This function has the same effect as importing all the keys manually via octez-client but is faster.

val generate_new_key : algo:Tezos_crypto.Signature.algo -> alias:string -> key

generate_new_key ~algo ~alias generates a new key using the given algo, and the Tezos crypto library. Even though an alias is given, this key is not registered in a client, and must be registered manually. Typically, this can be used to generate keys for bootstrap accounts, and include them in overwrite_bootstrap_accounts when calling Protocol.write_parameter_file. At this point it is possible to specify the delegate and consensus keys of an arbitrary number of bootstrap accounts. To use these keys in a client and start baking, it is necessary to include them using Client.import_secret_key (which is usually not needed for the default bootstrap accounts).

module Bootstrap : sig ... end
val parse_client_output : alias:string -> client_output:string -> key

parse_client_output ~alias ~client_output extracts keys from clients output that yields result of the form

      Hash: tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx
      Public Key: edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav
      Secret Key: unencrypted:edsk3gUfUPyBSfrS9CCgmCiQsTCHGkviBDusMxDJstFtojtc1zcpsh

and returns the corresponding key.