This commit is contained in:
swrup 2025-12-06 18:09:48 +01:00
parent eb385df0a3
commit 4874f90b4f
2 changed files with 51 additions and 24 deletions

View file

@ -1,10 +1,21 @@
(* TODO (* TODO
ppx? ppx?
normalized JSON-object
for signature of ExchangeKeysResponse.exetensions field
why is this one not defined by a struct?
how to handle protocol versions: how to handle protocol versions:
- "@deprecated" fields - "@deprecated" fields
- "@since protocol xx" - "@since protocol xx"
better jsont cases handling:
- factorize common fields (DenomCommon/DenomGroupCommon)
- "+age_restricted"/CS variants
- raise error not implemented if not RSA
monotonic time
payto_uri payto_uri
uri uri
option: correct use opt_mem or Jsont.option option: correct use opt_mem or Jsont.option
@ -49,9 +60,10 @@ module Account_operation = struct
|> Jsont.enum ~kind:"account operation type" |> Jsont.enum ~kind:"account operation type"
end end
module ErrorDetail = struct (* TODO error response
(* TODO GANA error codes - use GANA error codes
https://git.gnunet.org/gana.git/tree/gnu-taler-error-codes/registry.rec *) https://git.gnunet.org/gana.git/tree/gnu-taler-error-codes/registry.rec *)
module ErrorDetail = struct
type t = { type t = {
code: int; code: int;
hint: string option; hint: string option;
@ -484,7 +496,7 @@ module AuditorSetupMessage = struct
auditor_name: string; auditor_name: string;
auditor_pub: EddsaPublicKey.t; auditor_pub: EddsaPublicKey.t;
master_sig: MasterAddAuditorPS.t; master_sig: MasterAddAuditorPS.t;
(* TODO time (* TODO monotonic time
something about using monotonic system time here! *) something about using monotonic system time here! *)
validity_start: Timestamp.t; validity_start: Timestamp.t;
} }
@ -511,8 +523,7 @@ end
module AuditorTeardownMessage = struct module AuditorTeardownMessage = struct
type t = { type t = {
master_sig: MasterDelAuditorPS.t; master_sig: MasterDelAuditorPS.t;
(* TODO time (* TODO monotonic time *)
something about using monotonic system time here! *)
validity_end: Timestamp.t; validity_end: Timestamp.t;
} }
@ -533,7 +544,7 @@ module WireFeeSetupMessage = struct
(* TODO over which struct? (* TODO over which struct?
Signature using the exchange's offline key Signature using the exchange's offline key
with purpose TALER_SIGNATURE_MASTER_WIRE_FEES *) with purpose TALER_SIGNATURE_MASTER_WIRE_FEES *)
master_sig_wire: EddsaSignature.t; master_sig_wire: MasterWireFeePS.t;
fee_start: Amount.t; fee_start: Amount.t;
fee_end: Amount.t; fee_end: Amount.t;
closing_fee: Amount.t; closing_fee: Amount.t;
@ -561,7 +572,7 @@ module WireFeeSetupMessage = struct
let open Jsont.Object in let open Jsont.Object in
map ~kind:"WireFeeSetupMessage" make map ~kind:"WireFeeSetupMessage" make
|> mem "wire_method" Jsont.string ~enc:wire_method |> mem "wire_method" Jsont.string ~enc:wire_method
|> mem "master_sig_wire" EddsaSignature.jsont ~enc:master_sig_wire |> mem "master_sig_wire" MasterWireFeePS.jsont ~enc:master_sig_wire
|> mem "fee_start" Amount.jsont ~enc:fee_start |> mem "fee_start" Amount.jsont ~enc:fee_start
|> mem "fee_end" Amount.jsont ~enc:fee_end |> mem "fee_end" Amount.jsont ~enc:fee_end
|> mem "closing_fee" Amount.jsont ~enc:closing_fee |> mem "closing_fee" Amount.jsont ~enc:closing_fee
@ -626,7 +637,7 @@ module WireSetupMessage = struct
payto_uri: string; payto_uri: string;
master_sig_wire: MasterWireDetailsPS.t; master_sig_wire: MasterWireDetailsPS.t;
master_sig_add: MasterAddWirePS.t; master_sig_add: MasterAddWirePS.t;
(* TODO time monotonic *) (* TODO monotonic time *)
validity_start: Timestamp.t; validity_start: Timestamp.t;
bank_label: string option; bank_label: string option;
priority: int option; priority: int option;
@ -665,7 +676,7 @@ module WireTeardownMessage = struct
type t = { type t = {
payto_uri: string; payto_uri: string;
master_sig_del: MasterDelWirePS.t; master_sig_del: MasterDelWirePS.t;
(* TODO time monotonic *) (* TODO monotonic time *)
validity_end: Timestamp.t; validity_end: Timestamp.t;
} }
@ -1037,11 +1048,6 @@ module RsaDenomGroup = struct
|> finish |> finish
end end
(* TODO cases
better jsont cases handling
factorize common fields (DenomCommon/DenomGroupCommon)
"+age_restricted"/CS variants
raise error not implemented if not RSA *)
module DenomGroup = struct module DenomGroup = struct
type t = Rsa of RsaDenomGroup.t type t = Rsa of RsaDenomGroup.t
@ -1234,7 +1240,11 @@ module ExchangeKeysResponse = struct
hard_limits: AccountLimit.t list; hard_limits: AccountLimit.t list;
zero_limits: ZeroLimitedOperation.t list; zero_limits: ZeroLimitedOperation.t list;
denominations: DenomGroup.t list; denominations: DenomGroup.t list;
exchange_sig: EddsaSignature.t; (* Compact EdDSA signature (binary-only) over the
contatentation of all of the master_sigs (in reverse
chronological order by group) in the arrays under
"denominations" *)
exchange_sig: ExchangeKeySetPS.t;
exchange_pub: EddsaPublicKey.t; exchange_pub: EddsaPublicKey.t;
recoup: RecoupDenoms.t list; recoup: RecoupDenoms.t list;
global_fees: GlobalFees.t list; global_fees: GlobalFees.t list;
@ -1242,6 +1252,9 @@ module ExchangeKeysResponse = struct
auditors: AuditorKeys.t list; auditors: AuditorKeys.t list;
signkeys: SignKey.t list; signkeys: SignKey.t list;
extensions: ExtensionManifest.t Stdlib.Map.Make(Stdlib.String).t option; extensions: ExtensionManifest.t Stdlib.Map.Make(Stdlib.String).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. *)
extensions_sig: EddsaSignature.t option; extensions_sig: EddsaSignature.t option;
} }
@ -1359,7 +1372,7 @@ module ExchangeKeysResponse = struct
(Jsont.list ZeroLimitedOperation.jsont) (Jsont.list ZeroLimitedOperation.jsont)
~enc:zero_limits ~enc:zero_limits
|> mem "denominations" (Jsont.list DenomGroup.jsont) ~enc:denominations |> mem "denominations" (Jsont.list DenomGroup.jsont) ~enc:denominations
|> mem "exchange_sig" EddsaSignature.jsont ~enc:exchange_sig |> mem "exchange_sig" ExchangeKeySetPS.jsont ~enc:exchange_sig
|> mem "exchange_pub" EddsaPublicKey.jsont ~enc:exchange_pub |> mem "exchange_pub" EddsaPublicKey.jsont ~enc:exchange_pub
|> mem "recoup" (Jsont.list RecoupDenoms.jsont) ~enc:recoup |> mem "recoup" (Jsont.list RecoupDenoms.jsont) ~enc:recoup
|> mem "global_fees" (Jsont.list GlobalFees.jsont) ~enc:global_fees |> mem "global_fees" (Jsont.list GlobalFees.jsont) ~enc:global_fees

View file

@ -702,6 +702,28 @@ module ExchangeKeyValidityPS = struct
include MK (R) include MK (R)
end end
module ExchangeKeySetPS = struct
module R = struct
(* purpose.purpose = TALER_SIGNATURE_EXCHANGE_KEY_SET *)
type r = {
list_issue_date: TimeAbsoluteNBO.t;
hc: Hash_64.t;
}
let bin =
let open Bin in
Purpose.make_bin Taler_signatures.exchange_key_set @@ fun _purpose ->
record (fun _purpose list_issue_date hc -> { list_issue_date; hc })
|+ Purpose.field _purpose
|+ field TimeAbsoluteNBO.bin (fun t -> t.list_issue_date)
|+ field Hash_64.bin (fun t -> t.hc)
|> sealr
end
include R
include MK (R)
end
(* ### BIN IMPL END ### *) (* ### BIN IMPL END ### *)
module WithdrawRequestPS = struct module WithdrawRequestPS = struct
@ -812,14 +834,6 @@ module RefreshMeltConfirmationPS = struct
} }
end end
module ExchangeKeySetPS = struct
(* purpose.purpose = TALER_SIGNATURE_EXCHANGE_KEY_SET *)
type t = {
list_issue_date: TimeAbsoluteNBO.t;
hc: Hash_64_cstr.t;
}
end
module DepositTrackPS = struct module DepositTrackPS = struct
(* purpose.purpose = TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION *) (* purpose.purpose = TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION *)
type t = { type t = {