Commit ea4e33b0 authored by Grégoire Henry's avatar Grégoire Henry

Client: preload encrypted keys when running a daemon (again)

This is 370114eb again, sigh.
parent d3589324
Pipeline #25481643 passed with stages
in 21 minutes and 29 seconds
......@@ -192,6 +192,17 @@ let decrypt_all (cctxt : #Client_context.io_wallet) =
return_unit
end sks
let decrypt_list (cctxt : #Client_context.io_wallet) keys =
Secret_key.load cctxt >>=? fun sks ->
iter_s begin fun (name, sk_uri) ->
if Uri.scheme (sk_uri : sk_uri :> Uri.t) = Some scheme &&
(keys = [] || List.mem name keys) then
decrypt cctxt ~name sk_uri >>=? fun _ ->
return_unit
else
return_unit
end sks
let rec read_passphrase (cctxt : #Client_context.io) =
cctxt#prompt_password
"Enter passphrase to encrypt your key: " >>=? fun password ->
......
......@@ -33,6 +33,9 @@ val decrypt:
val decrypt_all:
#Client_context.io_wallet -> unit tzresult Lwt.t
val decrypt_list:
#Client_context.io_wallet -> string list -> unit tzresult Lwt.t
val encrypt:
#Client_context.io ->
Signature.secret_key -> Client_keys.sk_uri tzresult Lwt.t
......@@ -86,6 +86,8 @@ let baker_commands () =
directory_parameter
@@ seq_of_param Client_keys.Public_key_hash.alias_param)
(fun (max_priority, threshold) node_path delegates cctxt ->
Tezos_signer_backends.Encrypted.decrypt_list
cctxt (List.map fst delegates) >>=? fun () ->
Client_daemon.Baker.run cctxt
?threshold
?max_priority
......@@ -107,6 +109,8 @@ let endorser_commands () =
(prefixes [ "run" ]
@@ seq_of_param Client_keys.Public_key_hash.alias_param)
(fun endorsement_delay delegates cctxt ->
Tezos_signer_backends.Encrypted.decrypt_list
cctxt (List.map fst delegates) >>=? fun () ->
Client_daemon.Endorser.run cctxt
~delay:endorsement_delay
~min_date:((Time.add (Time.now ()) (Int64.neg 1800L)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment