From 370114eb8b9feaf7064f8527f8d18ccb66ce96f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Sat, 26 May 2018 13:41:56 +0200 Subject: [PATCH] Client: preload encrypted keys when running a daemon --- src/bin_signer/main_signer.ml | 3 +++ src/proto_alpha/lib_baking/client_baking_daemon.ml | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/bin_signer/main_signer.ml b/src/bin_signer/main_signer.ml index c3027a1b7..0201ce6a4 100644 --- a/src/bin_signer/main_signer.ml +++ b/src/bin_signer/main_signer.ml @@ -62,6 +62,7 @@ let commands = with Failure _ -> failwith "Invalid port %s" x)))) (prefixes [ "launch" ; "socket" ; "signer" ] @@ stop) (fun (host, port) cctxt -> + Tezos_signer_backends.Encrypted.decrypt_all cctxt >>=? fun () -> Socket_daemon.run cctxt (Tcp (host, port))) ; command ~group ~desc: "Launch a signer daemon over a local Unix socket." @@ -75,6 +76,7 @@ let commands = (parameter (fun _ s -> return s)))) (prefixes [ "launch" ; "local" ; "signer" ] @@ stop) (fun path cctxt -> + Tezos_signer_backends.Encrypted.decrypt_all cctxt >>=? fun () -> Socket_daemon.run cctxt (Unix path)) ; command ~group ~desc: "Launch a signer daemon over HTTPS." @@ -106,6 +108,7 @@ let commands = ~desc: "path to th TLS key" (parameter (fun _ s -> return s)) @@ stop) (fun (host, port) cert key cctxt -> + Tezos_signer_backends.Encrypted.decrypt_all cctxt >>=? fun () -> Https_daemon.run cctxt ~host ~port ~cert ~key) ; ] diff --git a/src/proto_alpha/lib_baking/client_baking_daemon.ml b/src/proto_alpha/lib_baking/client_baking_daemon.ml index 7d80efb24..ec93f516a 100644 --- a/src/proto_alpha/lib_baking/client_baking_daemon.ml +++ b/src/proto_alpha/lib_baking/client_baking_daemon.ml @@ -8,6 +8,18 @@ (**************************************************************************) let run (cctxt : #Proto_alpha.full) ?max_priority ~delay ?min_date delegates ~endorsement ~denunciation ~baking = + begin + match delegates with + | [] -> + Tezos_signer_backends.Encrypted.decrypt_all cctxt + | _ :: _ -> + iter_s + (fun k -> + Client_keys.get_key cctxt k >>=? fun (_, _, sk_uri) -> + Client_keys.neuterize sk_uri >>=? fun _ -> + return ()) + delegates + end >>=? fun () -> (* TODO really detach... *) let endorsement = if endorsement then