Signer: explicit registration of signers
instead of toplevel side-effects and `-link-all`
This commit is contained in:
parent
502017c863
commit
0dbe24290f
@ -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
|
||||
|
@ -8,6 +8,7 @@
|
||||
tezos-client-commands
|
||||
tezos-stdlib-unix
|
||||
tezos-rpc-http
|
||||
tezos-signer-backends
|
||||
pbkdf
|
||||
bip39
|
||||
tezos-shell-services))
|
||||
|
@ -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)
|
||||
|
10
src/lib_signer_backends/encrypted.mli
Normal file
10
src/lib_signer_backends/encrypted.mli
Normal 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
|
@ -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)
|
||||
|
@ -166,5 +166,4 @@ module Remote_signer : SIGNER = struct
|
||||
|
||||
end
|
||||
|
||||
let () =
|
||||
register_signer (module Remote_signer)
|
||||
include Remote_signer
|
||||
|
10
src/lib_signer_backends/remote.mli
Normal file
10
src/lib_signer_backends/remote.mli
Normal 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
|
@ -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)
|
||||
|
10
src/lib_signer_backends/unencrypted.mli
Normal file
10
src/lib_signer_backends/unencrypted.mli
Normal 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
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user