.
This commit is contained in:
parent
a0340bd100
commit
b04f0dc949
3 changed files with 25 additions and 25 deletions
|
|
@ -2,27 +2,35 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
a="tmp_a.json"
|
a="/tmp/a.json"
|
||||||
b="tmp_b.json"
|
b="/tmp/b.json"
|
||||||
|
|
||||||
|
url="http://localhost:3434"
|
||||||
auditor_pub=$(<"./test/auditor_public_key")
|
auditor_pub=$(<"./test/auditor_public_key")
|
||||||
master_key="./default/master_offline_private_key"
|
master_key="./default/master_offline_private_key"
|
||||||
zero_euro="EUR:0.0"
|
zero_euro="EUR:0.0"
|
||||||
|
|
||||||
dune exec offline -- download --output $a
|
offline_tool() {
|
||||||
dune exec offline -- sign --master_key $master_key --input $a --output $b
|
dune exec offline -- "$@"
|
||||||
dune exec offline -- upload --input $b --url "/management/keys"
|
}
|
||||||
|
|
||||||
dune exec offline -- enable-auditor \
|
offline_tool download --output $a --url $url"/management/keys"
|
||||||
|
offline_tool sign \
|
||||||
|
--master_key $master_key \
|
||||||
|
--input $a \
|
||||||
|
--output $b
|
||||||
|
offline_tool upload --input $b --url $url"/management/keys"
|
||||||
|
|
||||||
|
offline_tool enable-auditor \
|
||||||
--master_key $master_key \
|
--master_key $master_key \
|
||||||
--output $b \
|
--output $b \
|
||||||
--auditor_url "auditor.example.com" \
|
--auditor_url "auditor.example.com" \
|
||||||
--auditor_name "auditor example" \
|
--auditor_name "auditor example" \
|
||||||
--auditor_pub $auditor_pub \
|
--auditor_pub $auditor_pub \
|
||||||
--validity_start 0
|
--validity_start 0
|
||||||
dune exec offline -- upload --input $b --url "/management/auditors"
|
offline_tool upload --input $b --url $url"/management/auditors"
|
||||||
|
|
||||||
dune exec offline -- wire-fee \
|
offline_tool wire-fee \
|
||||||
--master_key $master_key \
|
--master_key $master_key \
|
||||||
--output $b \
|
--output $b \
|
||||||
--wire_method "xxx" \
|
--wire_method "xxx" \
|
||||||
|
|
@ -30,9 +38,9 @@ dune exec offline -- wire-fee \
|
||||||
--fee_end 99999999 \
|
--fee_end 99999999 \
|
||||||
--closing_fee $zero_euro \
|
--closing_fee $zero_euro \
|
||||||
--wire_fee $zero_euro
|
--wire_fee $zero_euro
|
||||||
dune exec offline -- upload --input $b --url "/management/wire-fee"
|
offline_tool upload --input $b --url $url"/management/wire-fee"
|
||||||
|
|
||||||
dune exec offline -- global-fees \
|
offline_tool global-fees \
|
||||||
--master_key $master_key \
|
--master_key $master_key \
|
||||||
--output $b \
|
--output $b \
|
||||||
--start_date 0 \
|
--start_date 0 \
|
||||||
|
|
@ -43,7 +51,4 @@ dune exec offline -- global-fees \
|
||||||
--history_expiration 9999999 \
|
--history_expiration 9999999 \
|
||||||
--purse_account_limit 1 \
|
--purse_account_limit 1 \
|
||||||
--purse_timeout 9999999
|
--purse_timeout 9999999
|
||||||
dune exec offline -- upload --input $b --url "/management/global-fees"
|
offline_tool upload --input $b --url $url"/management/global-fees"
|
||||||
|
|
||||||
rm $a
|
|
||||||
rm $b
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
(* TODO
|
(* TODO
|
||||||
change download_cmd/upload_cmd
|
better cmd doc
|
||||||
change arguments: '_' -> '-'
|
change arguments: '_' -> '-'
|
||||||
|
|
||||||
all management operations:
|
all management operations:
|
||||||
|
|
@ -99,8 +99,8 @@ let download_cmd =
|
||||||
let doc = "GET" in
|
let doc = "GET" in
|
||||||
Cmd.make (Cmd.info "download" ~doc)
|
Cmd.make (Cmd.info "download" ~doc)
|
||||||
@@
|
@@
|
||||||
let+ output = output in
|
let+ output = output and+ url = url in
|
||||||
download ~output
|
download ~output ~url
|
||||||
|
|
||||||
let upload_cmd =
|
let upload_cmd =
|
||||||
let doc = "POST" in
|
let doc = "POST" in
|
||||||
|
|
|
||||||
|
|
@ -161,18 +161,13 @@ let read_master_key_file filename =
|
||||||
let* master_key = read_file filename in
|
let* master_key = read_file filename in
|
||||||
Crypto.EddsaPrivateKey.of_octets master_key
|
Crypto.EddsaPrivateKey.of_octets master_key
|
||||||
|
|
||||||
let base_url = Uri.of_string "http://localhost:3434/"
|
let download ~output ~url =
|
||||||
let full_url path = Uri.with_path base_url path |> Uri.to_string
|
|
||||||
|
|
||||||
let download ~output =
|
|
||||||
let open Bos in
|
let open Bos in
|
||||||
let uri = full_url "/management/keys/" in
|
OS.Cmd.run Cmd.(v "curl" % "-s" % "-o" % output % "-X" % "GET" % url)
|
||||||
OS.Cmd.run Cmd.(v "curl" % "-s" % "-o" % output % "-X" % "GET" % uri)
|
|
||||||
|> unwrap_err_msg
|
|> unwrap_err_msg
|
||||||
|
|
||||||
let upload ~input ~url =
|
let upload ~input ~url =
|
||||||
let open Bos in
|
let open Bos in
|
||||||
let uri = full_url url in
|
|
||||||
OS.Cmd.run
|
OS.Cmd.run
|
||||||
Cmd.(
|
Cmd.(
|
||||||
v "curl"
|
v "curl"
|
||||||
|
|
@ -183,7 +178,7 @@ let upload ~input ~url =
|
||||||
% "Content-Type: application/json"
|
% "Content-Type: application/json"
|
||||||
% "--data"
|
% "--data"
|
||||||
% ("@" ^ input)
|
% ("@" ^ input)
|
||||||
% uri)
|
% url)
|
||||||
|> unwrap_err_msg
|
|> unwrap_err_msg
|
||||||
|
|
||||||
let setup ~output =
|
let setup ~output =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue