This commit is contained in:
parent
f0847855bd
commit
74b1bd8dc4
3 changed files with 55 additions and 2 deletions
1
management_keys.json
Normal file
1
management_keys.json
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"future_denoms":[{"section_name":"kudo_1","value":"EUR:0.01","stamp_start":{"t_s":1764324416.944737},"stamp_expire_withdraw":{"t_s":1795860416.944737},"stamp_expire_deposit":{"t_s":1795860416.944737},"stamp_expire_legal":{"t_s":1795860416.944737},"denom_pub":{"cipher":"RSA","age_mask":0,"rsa_pub":"00G000CPX1RHQPPGTJXYN36F8YDSHA2P88QJ68358T7AJ3MSHGTZA3588W0G===="},"fee_withdraw":"EUR:0.00","fee_deposit":"EUR:0.00","fee_refresh":"EUR:0.00","fee_refund":"EUR:0.00","denom_secmod_sig":"2R697VTDXEJV5HTVT6F1PHY9JVJCZ8YMZ20ZNMAQ1P28Z2A6JT4MSWPH4NB6BQMS41VWXAH69WEFGNB2DJTSJ6YCJEGW8JESA44YM10="},{"section_name":"kudo_2","value":"EUR:0.02","stamp_start":{"t_s":1764324416.9645402},"stamp_expire_withdraw":{"t_s":1795860416.9645402},"stamp_expire_deposit":{"t_s":1795860416.9645402},"stamp_expire_legal":{"t_s":1795860416.9645402},"denom_pub":{"cipher":"RSA","age_mask":0,"rsa_pub":"00G000AJHNP3V33R63QB3M3CS7GNVK7ANSKY858KPW3RXH25VSDT6WF8XM0G===="},"fee_withdraw":"EUR:0.00","fee_deposit":"EUR:0.00","fee_refresh":"EUR:0.00","fee_refund":"EUR:0.00","denom_secmod_sig":"FNTE90YDXMS22W0DFVHEC87B344B1W2KBKYF6CSDF5XN4SQ66M46S96TVWJAT6P3JSKK1NA4Z55DQR4BT7CRWC19RSNVAWZ4RZT5M2G="}],"future_signkeys":[{"key":"ABSJDCYBDBVBPNA5XWRJ5GFWX6TSGW1ZHM77HVFS4WG4T0E2D6E0====","stamp_start":{"t_s":1764324416.9446576},"stamp_expire":{"t_s":1795860416.9446576},"stamp_end":{"t_s":1795860416.9446576},"signkey_secmod_sig":"ZP50GN8NQNTARNDVMQE8KME5RQ0ZCPC7GK52752ZPPRNSP6FV2DY8ZW16T17YQEYAVHDTXKNXQK2Y8J4J9DX0N1DEJ0JZ45PH1A4W30="}],"master_pub":"8MQF2XPWCKCW4199JFPE08X7Y9XAX21SF2HD8NZKXM3PY3CMCJ90====","denom_secmod_public_key":"2R170WPAQBY81SFAG1ETTG2EKX6GJRBGW6W8R6EJY924KRJZM3F0====","signkey_secmod_public_key":"FP19WSBYYNB8C2GBHEBW2KDKQPMV88RKG7WD8W8EN710E59T0ZH0===="}
|
||||
|
|
@ -2,4 +2,4 @@
|
|||
(public_name offline)
|
||||
(name offline)
|
||||
(modules offline)
|
||||
(libraries cmdliner bos fmt mirage-crypto ptime mte))
|
||||
(libraries cmdliner bos fmt mirage-crypto ptime mte vif))
|
||||
|
|
|
|||
|
|
@ -1 +1,53 @@
|
|||
let () = Fmt.pr "hello~@."; ()
|
||||
let download ~output_file =
|
||||
Miou_unix.run @@ fun () ->
|
||||
let fn _meta _req _resp () data_opt =
|
||||
(*
|
||||
let () =
|
||||
match response.Httpcats.status with
|
||||
| #Httpcats.Status.successful -> ()
|
||||
| _ ->
|
||||
Fmt.failwith "Download failure: `%a`." Httpcats.Status.pp_hum
|
||||
response.status
|
||||
in
|
||||
let data =
|
||||
match data_opt with
|
||||
| Some data -> data
|
||||
| None -> Fmt.failwith "Download failure: no data received."
|
||||
in
|
||||
*)
|
||||
match data_opt with
|
||||
| None -> Fmt.failwith "Download failure: no data received."
|
||||
| Some data -> (
|
||||
let output_file = Fpath.v output_file in
|
||||
match Bos.OS.File.write output_file data with
|
||||
| Error (`Msg err) -> Fmt.failwith "Write failure: `%s`." err
|
||||
| Ok () -> ())
|
||||
in
|
||||
let uri = "http://localhost:3434/management/keys/" in
|
||||
let rng = Mirage_crypto_rng_miou_unix.(initialize (module Pfortuna)) in
|
||||
let _ = Httpcats.request ~fn ~uri () in
|
||||
Mirage_crypto_rng_miou_unix.kill rng;
|
||||
()
|
||||
|
||||
(* CLI *)
|
||||
|
||||
open Cmdliner
|
||||
open Cmdliner.Term.Syntax
|
||||
|
||||
let output =
|
||||
let doc = "File to save data to be signed." in
|
||||
Arg.(
|
||||
value & opt filepath "management_keys.json" & info [ "o"; "output" ] ~doc)
|
||||
|
||||
let download_cmd =
|
||||
let doc = "Downloads /management/keys/" in
|
||||
let man =
|
||||
[ `S Manpage.s_description; `P "$(cmd) download /management/keys." ]
|
||||
in
|
||||
Cmd.make (Cmd.info "offline" ~version:"%%VERSION%%" ~doc ~man)
|
||||
@@
|
||||
let+ output_file = output in
|
||||
download ~output_file
|
||||
|
||||
let main () = Cmd.eval download_cmd
|
||||
let () = if !Sys.interactive then () else exit (main ())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue