ligo/src/lib_signer_services/signer_services.ml

44 lines
2.0 KiB
OCaml
Raw Normal View History

2018-05-24 02:26:10 +02:00
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
let sign =
2018-06-06 10:49:53 +02:00
let query =
let open RPC_query in
query (fun signature -> signature)
|+ opt_field
~descr: "Must be provided if the signer requires \
authentication. In this case, it must be the signature \
of the public key hash and message concatenated, by one \
of the keys authorized by the signer."
"authentication" Signature.rpc_arg (fun signature -> signature)
|> seal in
RPC_service.post_service
2018-05-24 02:26:10 +02:00
~description: "Sign a piece of data with a given remote key"
2018-06-06 10:49:53 +02:00
~query
~input: Data_encoding.bytes
2018-06-06 10:49:53 +02:00
~output: Data_encoding.(obj1 (req "signature" Signature.encoding))
RPC_path.(root / "keys" /: Signature.Public_key_hash.rpc_arg)
2018-05-24 02:26:10 +02:00
let public_key =
RPC_service.get_service
2018-05-24 02:26:10 +02:00
~description: "Retrieve the public key of a given remote key"
~query: RPC_query.empty
~output: Data_encoding.(obj1 (req "public_key" Signature.Public_key.encoding))
RPC_path.(root / "keys" /: Signature.Public_key_hash.rpc_arg)
2018-06-06 10:49:53 +02:00
let authorized_keys =
RPC_service.get_service
~description: "Retrieve the public keys that can be used to \
authenticate signing commands.\n\
If the empty object is returned, the signer has \
been set to accept unsigned commands."
~query: RPC_query.empty
~output: Data_encoding.(obj1 (opt "authorized_keys" (list Signature.Public_key_hash.encoding)))
RPC_path.(root / "authorized_keys")