Signer: explicit registration of signers

instead of toplevel side-effects and `-link-all`
This commit is contained in:
Grégoire Henry 2018-05-26 12:37:19 +02:00
parent 502017c863
commit 0dbe24290f
10 changed files with 266 additions and 236 deletions

View File

@ -74,6 +74,12 @@ let main select_commands =
ignore Clic.(setup_formatter Format.err_formatter
(if Unix.isatty Unix.stderr then Ansi else Plain) Short) ;
init_logger () >>= fun () ->
Client_keys.register_signer
(module Tezos_signer_backends.Unencrypted) ;
Client_keys.register_signer
(module Tezos_signer_backends.Encrypted) ;
Client_keys.register_signer
(module Tezos_signer_backends.Remote) ;
Lwt.catch begin fun () -> begin
Client_config.parse_config_args
(new unix_full

View File

@ -8,6 +8,7 @@
tezos-client-commands
tezos-stdlib-unix
tezos-rpc-http
tezos-signer-backends
pbkdf
bip39
tezos-shell-services))

View File

@ -9,7 +9,6 @@
open Client_keys
module Encrypted_signer : SIGNER = struct
let scheme = "encrypted"
let title =
@ -211,7 +210,3 @@ module Encrypted_signer : SIGNER = struct
let public_key x = return x
let public_key_hash x = return (Signature.Public_key.hash x)
let sign ?watermark t buf = return (Signature.sign ?watermark t buf)
end
let () =
register_signer (module Encrypted_signer)

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2017. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Client_keys.SIGNER

View File

@ -15,7 +15,7 @@
-open Tezos_client_base
-open Tezos_signer_services
-open Tezos_rpc_http
-linkall -w -9))))
-w -9))))
(alias
((name runtest_indent)

View File

@ -166,5 +166,4 @@ module Remote_signer : SIGNER = struct
end
let () =
register_signer (module Remote_signer)
include Remote_signer

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2017. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Client_keys.SIGNER

View File

@ -9,7 +9,6 @@
open Client_keys
module Unencrypted_signer : SIGNER = struct
let scheme = "unencrypted"
let title =
@ -67,7 +66,3 @@ module Unencrypted_signer : SIGNER = struct
let public_key x = return x
let public_key_hash x = return (Signature.Public_key.hash x)
let sign ?watermark t buf = return (Signature.sign ?watermark t buf)
end
let () =
register_signer (module Unencrypted_signer)

View File

@ -0,0 +1,10 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2017. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
include Client_keys.SIGNER

View File

@ -616,3 +616,7 @@ let display_level block =
let endorsement_security_deposit block =
Constants_services.endorsement_security_deposit !rpc_ctxt block
let () =
Client_keys.register_signer
(module Tezos_signer_backends.Unencrypted)