JJ: Description from the destination commit:

~

JJ: Description from source commit:
clean up
This commit is contained in:
swrup 2026-03-03 10:09:03 +01:00
parent d0ddee257e
commit 0c16870cbd
20 changed files with 104 additions and 120 deletions

View file

@ -145,10 +145,10 @@ end
(* -- *)
let read_file fname = Bos.OS.File.read (Fpath.v fname) |> unwrap_err_msg
let read_file fname = Bos.OS.File.read (Fpath.v fname) |> unwrap_msg
let write_file fname content =
Bos.OS.File.write (Fpath.v fname) content |> unwrap_err_msg
Bos.OS.File.write (Fpath.v fname) content |> unwrap_msg
let read_master_key_file filename =
let* master_key = read_file filename in
@ -167,7 +167,7 @@ let download ~output ~url =
% "-X"
% "GET"
% url)
|> unwrap_err_msg
|> unwrap_msg
let upload ~input ~url =
let open Bos in
@ -185,7 +185,7 @@ let upload ~input ~url =
% "--data"
% ("@" ^ input)
% url)
|> unwrap_err_msg
|> unwrap_msg
let setup ~output ~output_pubkey =
Mirage_crypto_rng_unix.use_default ();
@ -348,15 +348,8 @@ let wire_fee ~output ~master_key ~wire_method ~fee_start ~fee_end ~closing_fee
let* () = write_file output s in
Ok ()
(* TODO wire
hash over json, hash over string option?
~conversion_url ~credit_restrictions ~debit_restrictions *)
let enable_wire ~output ~master_key ~payto_uri ~bank_label ~priority =
let* key = read_master_key_file master_key in
let ns = Mtime_clock.now_ns () in
let validity_start = Timestamp.of_s @@ Int64.unsigned_div ns 1_000_000_000L in
let h_wire_details = Hash.FullPaytoHash.hash payto_uri in
(* TODO wire *)
let conversion_url = None in
let credit_restrictions = [] in
let debit_restrictions = [] in
@ -365,6 +358,11 @@ let enable_wire ~output ~master_key ~payto_uri ~bank_label ~priority =
in
let h_credit_restrictions = Hash.Cstring.H64.hash "" in
let h_debit_restrictions = Hash.Cstring.H64.hash "" in
(* - *)
let* key = read_master_key_file master_key in
let ns = Mtime_clock.now_ns () in
let validity_start = Timestamp.of_s @@ Int64.unsigned_div ns 1_000_000_000L in
let h_wire_details = Hash.FullPaytoHash.hash payto_uri in
let master_sig_wire =
let open Signatures.MasterWireDetails in
signf (EddsaSignature.sign ~key)