diff --git a/src/api.ml b/src/api.ml index ade65cc6..89d9f123 100644 --- a/src/api.ml +++ b/src/api.ml @@ -840,3 +840,20 @@ module AggregateTransferFee = struct |> mem "sig" MasterWireFeePS.jsont ~enc:sig_ |> finish end + +module AuditorDenominationKey = struct + type t = { + denom_pub_h: HashCode.t; + auditor_sig: ExchangeKeyValidityPS.t; + } + + let jsont = + let make denom_pub_h auditor_sig = { denom_pub_h; auditor_sig } in + let denom_pub_h v = v.denom_pub_h in + let auditor_sig v = v.auditor_sig in + let open Jsont.Object in + map ~kind:"AuditorDenominationKey" make + |> mem "denom_pub_h" HashCode.jsont ~enc:denom_pub_h + |> mem "auditor_sig" ExchangeKeyValidityPS.jsont ~enc:auditor_sig + |> finish +end diff --git a/src/bin_signature.ml b/src/bin_signature.ml index ed0cfc71..776a1323 100644 --- a/src/bin_signature.ml +++ b/src/bin_signature.ml @@ -635,6 +635,73 @@ module MasterWireFeePS = struct include MK (R) end +module ExchangeKeyValidityPS = struct + module R = struct + (* purpose.purpose = TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS *) + type r = { + auditor_url_hash: Hash_64_cstr.t; + master: MasterPublicKeyP.t; + start: TimeAbsoluteNBO.t; + expire_withdraw: TimeAbsoluteNBO.t; + expire_spend: TimeAbsoluteNBO.t; + expire_legal: TimeAbsoluteNBO.t; + value: AmountNBO.t; + fee_withdraw: AmountNBO.t; + fee_deposit: AmountNBO.t; + fee_refresh: AmountNBO.t; + denom_hash: DenominationHash.t; + } + + let bin = + let open Bin in + Purpose.make_bin Taler_signatures.auditor_exchange_keys @@ fun _purpose -> + record + (fun + _purpose + auditor_url_hash + master + start + expire_withdraw + expire_spend + expire_legal + value + fee_withdraw + fee_deposit + fee_refresh + denom_hash + -> + { + auditor_url_hash; + master; + start; + expire_withdraw; + expire_spend; + expire_legal; + value; + fee_withdraw; + fee_deposit; + fee_refresh; + denom_hash; + }) + |+ Purpose.field _purpose + |+ field Hash_64_cstr.bin (fun t -> t.auditor_url_hash) + |+ field MasterPublicKeyP.bin (fun t -> t.master) + |+ field TimeAbsoluteNBO.bin (fun t -> t.start) + |+ field TimeAbsoluteNBO.bin (fun t -> t.expire_withdraw) + |+ field TimeAbsoluteNBO.bin (fun t -> t.expire_spend) + |+ field TimeAbsoluteNBO.bin (fun t -> t.expire_legal) + |+ field AmountNBO.bin (fun t -> t.value) + |+ field AmountNBO.bin (fun t -> t.fee_withdraw) + |+ field AmountNBO.bin (fun t -> t.fee_deposit) + |+ field AmountNBO.bin (fun t -> t.fee_refresh) + |+ field DenominationHash.bin (fun t -> t.denom_hash) + |> sealr + end + + include R + include MK (R) +end + (* ### BIN IMPL END ### *) module WithdrawRequestPS = struct @@ -783,23 +850,6 @@ module WireDepositDataPS = struct } end -module ExchangeKeyValidityPS = struct - (* purpose.purpose = TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS *) - type t = { - auditor_url_hash: Hash_64_cstr.t; - master: MasterPublicKeyP.t; - start: TimeAbsoluteNBO.t; - expire_withdraw: TimeAbsoluteNBO.t; - expire_spend: TimeAbsoluteNBO.t; - expire_legal: TimeAbsoluteNBO.t; - value: AmountNBO.t; - fee_withdraw: AmountNBO.t; - fee_deposit: AmountNBO.t; - fee_refresh: AmountNBO.t; - denom_hash: DenominationHash.t; - } -end - module PaymentResponsePS = struct (* purpose.purpose = TALER_SIGNATURE_MERCHANT_PAYMENT_OK *) type t = { h_contract_terms: PrivateContractHash.t }