This commit is contained in:
swrup 2025-11-30 14:23:55 +01:00
parent cf4da6b382
commit b79fa883bd
5 changed files with 32 additions and 19 deletions

View file

@ -1,6 +1,5 @@
(* TODO
- clean up cmdliner
- don't depends on wget
- setup: need public key in config file
- check sigs *)
(* doc: https://docs.taler.net/manpages/taler-exchange-offline.1.html *)
@ -11,26 +10,15 @@ let download ~base_url ~output =
let uri =
Uri.with_path (Uri.of_string base_url) "/management/keys/" |> Uri.to_string
in
let wget = Cmd.(v "wget" % "-O" % output % uri) in
OS.Cmd.run wget
OS.Cmd.run Cmd.(v "hurl" % "--output" % output % uri)
let upload ~base_url ~input =
let open Bos in
let uri =
Uri.with_path (Uri.of_string base_url) "/management/keys/" |> Uri.to_string
in
let wget =
Cmd.(
v "wget"
% "--method=POST"
% "--header='Content-Type: application/json'"
% "--body-file"
% input
% "-O"
% "/dev/null"
% uri)
in
OS.Cmd.run wget
OS.Cmd.run
Cmd.(v "hurl" % "--method" % "POST" % "--json-input" % ("@=" ^ input) % uri)
let setup ~output =
let output = Fpath.v output in