From d450ecd2ad12a203c28c1d6dfb503af0de1a275e Mon Sep 17 00:00:00 2001 From: swrup Date: Fri, 27 Feb 2026 18:15:09 +0100 Subject: [PATCH] --- src/api.ml | 4 ++-- test/offline_management.sh | 2 +- test/validate_response.ml | 34 +++++++++++++++++++++++++--------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/api.ml b/src/api.ml index 592083fa..8ec12854 100644 --- a/src/api.ml +++ b/src/api.ml @@ -1261,7 +1261,7 @@ module ExchangeKeysResponse = struct stefan_lin: Float.t; asset_type: string; accounts: ExchangeWireAccount.t list; - wire_fees: AggregateTransferFee.t list Stdlib.Map.Make(Stdlib.String).t; + wire_fees: AggregateTransferFee.t list String_map.t; wads: ExchangePartnerListEntry.t list; kyc_enabled: bool; disable_direct_deposit: bool; @@ -1278,7 +1278,7 @@ module ExchangeKeysResponse = struct list_issue_date: Timestamp.t; auditors: AuditorKeys.t list; signkeys: SignKey.t list; - extensions: ExtensionManifest.t Stdlib.Map.Make(Stdlib.String).t option; + extensions: ExtensionManifest.t String_map.t option; (* Signature by the exchange master key of the SHA-256 hash of the normalized JSON-object of field extensions, if it was set. The signature has purpose TALER_SIGNATURE_MASTER_EXTENSIONS. *) diff --git a/test/offline_management.sh b/test/offline_management.sh index ccbef73b..606e6028 100755 --- a/test/offline_management.sh +++ b/test/offline_management.sh @@ -60,7 +60,7 @@ echo "[OK] /management/auditors/\$AUDITOR_PUB/disable" offline_tool wire-fee \ --master_key $master_key \ --output $b \ ---wire_method "xxx" \ +--wire_method "x-taler-bank" \ --fee_start 0 \ --fee_end 99999999 \ --closing_fee $zero_kudos \ diff --git a/test/validate_response.ml b/test/validate_response.ml index 709f4464..13059db5 100644 --- a/test/validate_response.ml +++ b/test/validate_response.ml @@ -2,9 +2,9 @@ open Syntax (*open Crypto*) let keys content = - let open Api.ExchangeKeysResponse in + let open Api in + let open ExchangeKeysResponse in let* v = Api.decode jsont content in - (* validate version compatibility *) let* () = if Libtool_version.is_compatible @@ -13,13 +13,29 @@ let keys content = else Fmt.error "version incompatible" in - (* TODO *) - (* validate currency specification *) - (* validate all amounts *) - (* validate all timestamp/duration *) - (* validate master_public_key *) - (* validate accounts *) - (* validate wire-fees *) + (* TODO need hash over json.. + validate ExchangeWireAccount *) + let* () = + let open AggregateTransferFee in + v.wire_fees + |> String_map.bindings + |> List.concat_map (fun (wire_method, l) -> + List.map (fun item -> (wire_method, item)) l) + |> list_iter + (fun + (wire_method, { wire_fee; closing_fee; start_date; end_date; sig_ }) + -> + let open Signatures.MasterWireFee in + verify v.master_public_key sig_ + { + h_wire_method= Hash.Cstring.H64.hash wire_method; + start_date; + end_date; + wire_fee; + closing_fee; + }) + in + (* validate signkeys *) (* validate exchange_pub *) (* validate denominations *)