2025-12-03 16:19:11 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
2026-02-10 14:48:02 +01:00
|
|
|
a="/tmp/a.json"
|
|
|
|
|
b="/tmp/b.json"
|
2025-12-03 16:19:11 +01:00
|
|
|
|
2026-03-21 03:30:15 +01:00
|
|
|
url="http://10.0.0.2:3434"
|
2026-02-21 23:40:58 +01:00
|
|
|
auditor_pub="A17JXR3E6J4CXDPYT7S1H25PGJ3ABS26TQ38654QCX0TB59RPMF0"
|
2026-02-10 11:59:51 +01:00
|
|
|
master_key="./default/master_offline_private_key"
|
2026-02-26 17:24:47 +01:00
|
|
|
zero_kudos="KUDOS:0.0"
|
2025-12-03 16:19:11 +01:00
|
|
|
|
2026-03-03 10:09:03 +01:00
|
|
|
# TODO launch mte.exe and kill it a then end with its PID
|
|
|
|
|
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool() {
|
|
|
|
|
dune exec mte-offline-tool -- "$@" > /dev/null
|
2026-02-10 14:48:02 +01:00
|
|
|
}
|
2025-12-03 16:19:11 +01:00
|
|
|
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool download --output $a --url $url"/management/keys"
|
|
|
|
|
mte-offline-tool sign \
|
2026-02-10 14:48:02 +01:00
|
|
|
--master_key $master_key \
|
|
|
|
|
--input $a \
|
|
|
|
|
--output $b
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool upload --input $b --url $url"/management/keys"
|
2026-02-10 14:48:02 +01:00
|
|
|
echo "[OK] /management/keys"
|
|
|
|
|
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool download --output $a --url $url"/keys"
|
2026-02-25 00:12:05 +01:00
|
|
|
rsa_pub=$(jq -r '.denominations[0].denoms[0].rsa_pub' $a)
|
2026-03-21 16:31:11 +01:00
|
|
|
h_denom=$(dune exec mte-offline-tool -- compute-denomination-hash $rsa_pub)
|
|
|
|
|
mte-offline-tool revoke-denom \
|
2026-02-25 00:12:05 +01:00
|
|
|
--master_key $master_key \
|
|
|
|
|
--output $b \
|
2026-03-21 07:04:52 +01:00
|
|
|
$h_denom
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool upload --input $b --url $url"/management/denominations/"$h_denom"/revoke"
|
2026-02-25 00:12:05 +01:00
|
|
|
echo "[OK] /management/denominations/\$H_DENOM/revoke"
|
|
|
|
|
|
|
|
|
|
pub=$(jq -r '.signkeys[0].key' $a)
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool revoke-signkey \
|
2026-02-25 00:12:05 +01:00
|
|
|
--master_key $master_key \
|
|
|
|
|
--output $b \
|
|
|
|
|
$pub
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool upload --input $b --url $url"/management/signkeys/"$pub"/revoke"
|
2026-02-25 00:12:05 +01:00
|
|
|
echo "[OK] /management/signkeys/\$EXCHANGE_PUB/revoke"
|
|
|
|
|
|
2026-04-03 17:22:10 +02:00
|
|
|
# re-do a 'POST /management/keys' to be sure the exchange has a valid signkey after revoke-signkey
|
|
|
|
|
mte-offline-tool download --output $a --url $url"/management/keys"
|
|
|
|
|
mte-offline-tool sign \
|
|
|
|
|
--master_key $master_key \
|
|
|
|
|
--input $a \
|
|
|
|
|
--output $b
|
|
|
|
|
mte-offline-tool upload --input $b --url $url"/management/keys"
|
|
|
|
|
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool enable-auditor \
|
2026-02-10 11:59:51 +01:00
|
|
|
--master_key $master_key \
|
2025-12-03 16:19:11 +01:00
|
|
|
--output $b \
|
|
|
|
|
--auditor_url "auditor.example.com" \
|
|
|
|
|
--auditor_name "auditor example" \
|
2026-02-25 20:12:13 +01:00
|
|
|
--auditor_pub $auditor_pub
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool upload --input $b --url $url"/management/auditors"
|
2026-02-10 14:48:02 +01:00
|
|
|
echo "[OK] /management/auditors"
|
2025-12-03 16:19:11 +01:00
|
|
|
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool disable-auditor \
|
2026-02-25 20:12:13 +01:00
|
|
|
--master_key $master_key \
|
|
|
|
|
--output $b \
|
|
|
|
|
--auditor_pub $auditor_pub
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool upload --input $b --url $url"/management/auditors/"$auditor_pub"/disable"
|
2026-02-25 20:12:13 +01:00
|
|
|
echo "[OK] /management/auditors/\$AUDITOR_PUB/disable"
|
2026-02-25 00:12:05 +01:00
|
|
|
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool wire-fee \
|
2026-02-10 11:59:51 +01:00
|
|
|
--master_key $master_key \
|
2025-12-03 16:19:11 +01:00
|
|
|
--output $b \
|
2026-02-27 17:49:54 +01:00
|
|
|
--wire_method "x-taler-bank" \
|
2026-02-05 15:31:49 +01:00
|
|
|
--fee_start 0 \
|
|
|
|
|
--fee_end 99999999 \
|
2026-02-26 17:24:47 +01:00
|
|
|
--closing_fee $zero_kudos \
|
|
|
|
|
--wire_fee $zero_kudos
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool upload --input $b --url $url"/management/wire-fee"
|
2026-02-10 14:48:02 +01:00
|
|
|
echo "[OK] /management/wire-fee"
|
2025-12-03 16:19:11 +01:00
|
|
|
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool global-fees \
|
2026-02-10 11:59:51 +01:00
|
|
|
--master_key $master_key \
|
2025-12-03 16:19:11 +01:00
|
|
|
--output $b \
|
2026-02-05 15:31:49 +01:00
|
|
|
--start_date 0 \
|
|
|
|
|
--end_date 99999999 \
|
2026-02-26 17:24:47 +01:00
|
|
|
--history_fee $zero_kudos \
|
|
|
|
|
--account_fee $zero_kudos \
|
|
|
|
|
--purse_fee $zero_kudos \
|
2026-02-05 15:31:49 +01:00
|
|
|
--history_expiration 9999999 \
|
2025-12-03 16:19:11 +01:00
|
|
|
--purse_account_limit 1 \
|
2026-02-05 15:31:49 +01:00
|
|
|
--purse_timeout 9999999
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool upload --input $b --url $url"/management/global-fees"
|
2026-02-10 14:48:02 +01:00
|
|
|
echo "[OK] /management/global-fees"
|
2026-02-25 00:12:05 +01:00
|
|
|
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool enable-wire \
|
2026-02-25 20:12:13 +01:00
|
|
|
--master_key $master_key \
|
|
|
|
|
--output $b \
|
|
|
|
|
--payto_uri "" \
|
|
|
|
|
--bank_label "" \
|
|
|
|
|
--priority 4
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool upload --input $b --url $url"/management/wire"
|
2026-02-25 20:12:13 +01:00
|
|
|
echo "[OK] /management/wire"
|
|
|
|
|
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool disable-wire \
|
2026-02-25 20:12:13 +01:00
|
|
|
--master_key $master_key \
|
|
|
|
|
--output $b \
|
|
|
|
|
--payto_uri ""
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool upload --input $b --url $url"/management/wire/disable"
|
2026-02-25 20:12:13 +01:00
|
|
|
echo "[OK] /management/wire/disable"
|
|
|
|
|
|
|
|
|
|
# wtid (after base32 decode) must be 32bytes
|
|
|
|
|
wtid="000G40R40M30E209185GR38E1W8124GK2GAHC5RR34D1P70X3RFG"
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool drain \
|
2026-02-25 20:12:13 +01:00
|
|
|
--master_key $master_key \
|
|
|
|
|
--output $b \
|
|
|
|
|
--debit_account_section "" \
|
|
|
|
|
--credit_payto_uri "" \
|
|
|
|
|
--wtid $wtid \
|
|
|
|
|
--date 0 \
|
2026-02-26 17:24:47 +01:00
|
|
|
--amount $zero_kudos
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool upload --input $b --url $url"/management/drain"
|
2026-02-25 20:12:13 +01:00
|
|
|
echo "[OK] /management/drain"
|
2026-03-03 01:55:28 +01:00
|
|
|
|
2026-03-21 16:31:11 +01:00
|
|
|
mte-offline-tool download --output $a --url $url"/keys"
|
2026-04-14 20:16:45 +02:00
|
|
|
dune exec test/validate.exe -- keys $a
|
2026-03-03 01:55:28 +01:00
|
|
|
echo "[OK] /keys validation"
|