This commit is contained in:
swrup 2025-12-03 16:19:11 +01:00 committed by Swrup
parent 099cd80670
commit b507d540ad
43 changed files with 5647 additions and 1808 deletions

44
test/offline_management.sh Executable file
View file

@ -0,0 +1,44 @@
#!/bin/bash
set -e
a="tmp_a.json"
b="tmp_b.json"
auditor_pub=$(<"./data/auditor_public_key")
dune exec offline -- download --output $a
dune exec offline -- sign --input $a --output $b
dune exec offline -- upload --input $b --url "/management/keys"
dune exec offline -- enable-auditor \
--output $b \
--auditor_url "auditor.example.com" \
--auditor_name "auditor example" \
--auditor_pub $auditor_pub \
--validity_start "0.0"
dune exec offline -- upload --input $b --url "/management/auditors"
dune exec offline -- wire-fee \
--output $b \
--wire_method "magic" \
--fee_start "0.0" \
--fee_end "99999999.9" \
--closing_fee "EUR:0.0" \
--wire_fee "EUR:0.0"
dune exec offline -- upload --input $b --url "/management/wire-fee"
dune exec offline -- global-fees \
--output $b \
--start_date "0.0" \
--end_date "99999999.9" \
--history_fee "EUR:0.0" \
--account_fee "EUR:0.0" \
--purse_fee "EUR:0.0" \
--history_expiration "9999999.0" \
--purse_account_limit 1 \
--purse_timeout "9999999.0"
dune exec offline -- upload --input $b --url "/management/global-fees"
rm $a
rm $b

View file

@ -1,22 +1,21 @@
let () = Mirage_crypto_rng_unix.use_default ()
let get_ok = function Error e -> failwith e | Ok v -> v
let () =
let priv = Mirage_crypto_pk.Rsa.generate ~bits:2048 () in
let pub = Mirage_crypto_pk.Rsa.pub_of_priv priv in
let () =
let open Crypto.RsaPrivateKey in
let priv' = priv |> to_octets |> of_octets in
let priv' = priv |> to_octets |> of_octets |> get_ok in
assert (to_octets priv = to_octets priv')
in
let () =
let open Crypto.RsaPublicKey in
let pub' = pub |> to_octets |> of_octets in
let pub' = pub |> to_octets |> of_octets |> get_ok in
assert (to_octets pub = to_octets pub')
in
()
let get_ok = function Error e -> failwith e | Ok v -> v
let () =
let open Api in
let check jsont s =