Signer: create packages tezos-signer-services and tezos-signed-backends

This commit is contained in:
Grégoire Henry 2018-05-26 12:11:08 +02:00
parent 4b094b9c02
commit 502017c863
18 changed files with 116 additions and 19 deletions

View File

@ -480,32 +480,42 @@ opam:45:tezos-client:
variables:
package: tezos-client
opam:46:ocplib-ezresto-directory:
opam:46:tezos-signer-services:
<<: *opam_definition
variables:
package: tezos-signer-services
opam:47:ocplib-ezresto-directory:
<<: *opam_definition
variables:
package: ocplib-ezresto-directory
opam:47:tezos-baker-alpha:
opam:48:tezos-baker-alpha:
<<: *opam_definition
variables:
package: tezos-baker-alpha
opam:48:tezos-protocol-demo:
opam:49:tezos-protocol-demo:
<<: *opam_definition
variables:
package: tezos-protocol-demo
opam:49:tezos-signer:
opam:50:tezos-signer:
<<: *opam_definition
variables:
package: tezos-signer
opam:50:tezos-node:
opam:51:tezos-signer-backends:
<<: *opam_definition
variables:
package: tezos-signer-backends
opam:52:tezos-node:
<<: *opam_definition
variables:
package: tezos-node
opam:51:ocplib-json-typed-browser:
opam:53:ocplib-json-typed-browser:
<<: *opam_definition
variables:
package: ocplib-json-typed-browser

View File

@ -13,7 +13,8 @@
tezos-stdlib-unix
tezos-client-base-unix
tezos-client-alpha-commands.registration
tezos-baking-alpha-commands.registration))
tezos-baking-alpha-commands.registration
tezos-signer-backends))
(flags (:standard -w -9+27-30-32-40@8
-safe-string
-open Tezos_base__TzPervasives

View File

@ -7,7 +7,7 @@
(* *)
(**************************************************************************)
open Client_signer_remote_messages
open Signer_messages
let log = Logging.Client.Sign.lwt_log_notice

View File

@ -15,11 +15,11 @@ let run (cctxt : #Client_context.io_wallet) ~host ~port ~cert ~key =
`TLS (`Crt_file_path cert, `Key_file_path key, `No_password, `Port port) in
let dir = RPC_directory.empty in
let dir =
RPC_directory.register0 dir Client_signer_remote_services.sign begin fun () req ->
RPC_directory.register0 dir Signer_services.sign begin fun () req ->
Handler.sign cctxt req.key req.data
end in
let dir =
RPC_directory.register0 dir Client_signer_remote_services.public_key begin fun () req ->
RPC_directory.register0 dir Signer_services.public_key begin fun () req ->
Handler.public_key cctxt req.key
end in
Lwt.catch

View File

@ -7,14 +7,17 @@
tezos-client-base
tezos-client-base-unix
tezos-client-commands
tezos-signer-services
tezos-rpc-http
tezos-stdlib-unix))
tezos-stdlib-unix
tezos-signer-backends))
(flags (:standard -w -9+27-30-32-40@8
-safe-string
-open Tezos_base__TzPervasives
-open Tezos_client_base
-open Tezos_client_base_unix
-open Tezos_client_commands
-open Tezos_signer_services
-open Tezos_rpc_http
-open Tezos_stdlib_unix))))

View File

@ -7,7 +7,7 @@
(* *)
(**************************************************************************)
open Client_signer_remote_messages
open Signer_messages
let log = Logging.Client.Sign.lwt_log_notice

View File

@ -0,0 +1,23 @@
(jbuild_version 1)
(library
((name tezos_signer_backends)
(public_name tezos-signer-backends)
(libraries (tezos-base
tezos-stdlib-unix
tezos-client-base
tezos-rpc-http
tezos-signer-services
pbkdf
bip39))
(flags (:standard -open Tezos_base__TzPervasives
-open Tezos_stdlib_unix
-open Tezos_client_base
-open Tezos_signer_services
-open Tezos_rpc_http
-linkall -w -9))))
(alias
((name runtest_indent)
(deps ((glob_files *.ml*)))
(action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^}))))

View File

@ -8,7 +8,7 @@
(**************************************************************************)
open Client_keys
open Client_signer_remote_messages
open Signer_messages
let call host port service arg =
RPC_client.call_service
@ -41,15 +41,13 @@ let socket_request_public_key path key =
let sign path key data = match path with
| Socket path -> socket_sign path key data
| Https (host, port) ->
call host port
Client_signer_remote_services.sign { key ; data } >>=? fun res ->
call host port Signer_services.sign { key ; data } >>=? fun res ->
return res.signature
let request_public_key path key = match path with
| Socket path -> socket_request_public_key path key
| Https (host, port) ->
call host port
Client_signer_remote_services.public_key { key } >>=? fun res ->
call host port Signer_services.public_key { key } >>=? fun res ->
return res.public_key
module Remote_signer : SIGNER = struct

View File

@ -0,0 +1,21 @@
opam-version: "1.2"
version: "dev"
maintainer: "contact@tezos.com"
authors: [ "Tezos devteam" ]
homepage: "https://www.tezos.com/"
bug-reports: "https://gitlab.com/tezos/tezos/issues"
dev-repo: "https://gitlab.com/tezos/tezos.git"
license: "unreleased"
depends: [
"ocamlfind" { build }
"jbuilder" { build & = "1.0+beta19.1" }
"tezos-base"
"tezos-client-base"
"tezos-client-commands"
]
build: [
[ "jbuilder" "build" "-p" name "-j" jobs ]
]
build-test: [
[ "jbuilder" "runtest" "-p" name "-j" jobs ]
]

View File

@ -0,0 +1,19 @@
(jbuild_version 1)
(library
((name tezos_signer_services)
(public_name tezos-signer-services)
(libraries (tezos-base
tezos-client-base
tezos-rpc))
(flags (:standard -w -9+27-30-32-40@8
-safe-string
-open Tezos_base__TzPervasives
-open Tezos_rpc
-open Tezos_client_base
-linkall))))
(alias
((name runtest_indent)
(deps ((glob_files *.ml*)))
(action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^}))))

View File

@ -7,7 +7,7 @@
(* *)
(**************************************************************************)
open Client_signer_remote_messages
open Signer_messages
let sign = RPC_service.post_service
~description: "Sign a piece of data with a given remote key"

View File

@ -7,7 +7,7 @@
(* *)
(**************************************************************************)
open Client_signer_remote_messages
open Signer_messages
val sign :
([ `POST ], unit, unit, unit, Sign.Request.t, Sign.Response.t) RPC_service.t

View File

@ -0,0 +1,21 @@
opam-version: "1.2"
version: "dev"
maintainer: "contact@tezos.com"
authors: [ "Tezos devteam" ]
homepage: "https://www.tezos.com/"
bug-reports: "https://gitlab.com/tezos/tezos/issues"
dev-repo: "https://gitlab.com/tezos/tezos.git"
license: "unreleased"
depends: [
"ocamlfind" { build }
"jbuilder" { build & = "1.0+beta19.1" }
"tezos-base"
"tezos-client-base"
"tezos-client-commands"
]
build: [
[ "jbuilder" "build" "-p" name "-j" jobs ]
]
build-test: [
[ "jbuilder" "runtest" "-p" name "-j" jobs ]
]

View File

@ -15,6 +15,7 @@
tezos-client-alpha
tezos-baking-alpha
tezos-client-base-unix
tezos-signer-backends
alcotest-lwt))
(flags (:standard -w -9-32 -safe-string
-open Tezos_base__TzPervasives