This commit is contained in:
swrup 2026-03-03 10:09:03 +01:00
parent d0ddee257e
commit bcc940100a
20 changed files with 112 additions and 130 deletions

View file

@ -10,6 +10,8 @@ auditor_pub="A17JXR3E6J4CXDPYT7S1H25PGJ3ABS26TQ38654QCX0TB59RPMF0"
master_key="./default/master_offline_private_key"
zero_kudos="KUDOS:0.0"
# TODO launch mte.exe and kill it a then end with its PID
offline_tool() {
dune exec offline -- "$@" > /dev/null
}

View file

@ -34,8 +34,6 @@ let () =
check Timestamp.jsont {|{"t_s": "never"}|};
check_bad Timestamp.jsont {|{"t_s": "123456780"}|};
check_bad Timestamp.jsont {|{"t_s": "agagou"}|};
(* TODO CS not implemented *)
check_bad DenominationKey.jsont
{|{"cipher": "CS", "age_mask": 18, "cs_pub": "ouhagag"}|};
()

View file

@ -12,8 +12,8 @@ let keys content =
else Fmt.error "version incompatible"
in
(* TODO need hash over json..
validate ExchangeWireAccount *)
(* TODO json hash
validate wire *)
let* () =
let open AggregateTransferFee in
v.wire_fees
@ -51,11 +51,13 @@ let keys content =
let opt = List.find_opt (fun sk -> sk.Signkey.pub = v.exchange_pub) sk_l in
match opt with
| None -> Fmt.error "exchange_pub is not in signkeys list"
| Some sk ->
(* TODO will need to fake time to validate expired data *)
| Some _sk ->
(* todo add a --now option if we want to validate timestamps
let now = Timestamp.of_ptime (Ptime_clock.now ()) in
if Signkey.is_valid_at ~timestamp:now sk then Ok ()
else Fmt.error "exchange_pub is not valid at the current time"
*)
Ok ()
in
let* () =
let open Signatures.ExchangeKeySet in
@ -127,7 +129,7 @@ let keys_cmd =
@@
let+ input = input in
let* content =
Result.bind (Fpath.of_string input) Bos.OS.File.read |> unwrap_err_msg
Result.bind (Fpath.of_string input) Bos.OS.File.read |> unwrap_msg
in
keys content