From 9b71c69fef5a3075cbb5e256519b43db0749228b Mon Sep 17 00:00:00 2001 From: swrup Date: Wed, 8 Oct 2025 21:17:03 +0200 Subject: [PATCH] wip: all PS types --- src/binary_formats.ml | 696 +++++++++++++++++++++++++++++++++++++++++- src/types.ml | 2 + 2 files changed, 687 insertions(+), 11 deletions(-) diff --git a/src/binary_formats.ml b/src/binary_formats.ml index 29ec5a56..a71bd535 100644 --- a/src/binary_formats.ml +++ b/src/binary_formats.ml @@ -1,6 +1,9 @@ (* https://docs.taler.net/core/api-common.html#binary-formats - numeric values are in network byte order (big endian) *) +(* TODO: ? + some struct have a 'P' suffix, but are not defined in doc + we assume they are = to the un-suffixed ones *) open Include @@ -12,7 +15,6 @@ let int64_size = 8 module Time = struct module Absolute = struct type t = { timestamp_us: int64 } - type t_nbo = { abs_value_us__: int64 } (* not BE here? never used? *) let bin = @@ -20,8 +22,12 @@ module Time = struct record (fun timestamp_us -> { timestamp_us }) |+ field neint64 (fun t -> t.timestamp_us) |> sealr + end - let nboBin = + module AbsoluteNBO = struct + type t = { abs_value_us__: int64 } + + let bin = let open Bin in record (fun abs_value_us__ -> { abs_value_us__ }) |+ field beint64 (fun t -> t.abs_value_us__) @@ -30,20 +36,45 @@ module Time = struct module Relative = struct type t = { timestamp_us: int64 } - type t_nbo = { rel_value_us__: int64 } let bin = let open Bin in record (fun timestamp_us -> { timestamp_us }) |+ field neint64 (fun t -> t.timestamp_us) |> sealr + end - let nboBin = + module RelativeNBO = struct + type t = { rel_value_us__: int64 } + + let bin = let open Bin in record (fun rel_value_us__ -> { rel_value_us__ }) |+ field beint64 (fun t -> t.rel_value_us__) |> sealr end + + (* TODO Taler doc: missing Timestamp(NBO) *) + module Timestamp = struct + type t = { timestamp_us: int64 } + + (* not BE here? never used? *) + let bin = + let open Bin in + record (fun timestamp_us -> { timestamp_us }) + |+ field neint64 (fun t -> t.timestamp_us) + |> sealr + end + + module TimestampNBO = struct + type t = { abs_value_us__: int64 } + + let bin = + let open Bin in + record (fun abs_value_us__ -> { abs_value_us__ }) + |+ field beint64 (fun t -> t.abs_value_us__) + |> sealr + end end (* -- Cryptographic primitives -- *) @@ -106,6 +137,26 @@ module FullPaytoHash = MK_32 () fields and also with account-part canonicalized (so no BIC). *) module NormalizedPaytoHash = MK_32 () +(* TODO Taler doc: missing *) +module AgeCommitmentHash = MK_64 () + +(* TODO Taler doc: missing *) +module PublicRefreshCoinNonceP = MK_64 () + +(* TODO Taler doc: missing *) +module PursePublicKey = MK_32 () + +(* TODO Taler doc: missing *) +module AuditorPublicKeyP = MK_32 () + +(* TODO + // Secret for blinding/unblinding. + // An RSA blinding secret, which is basically + // a 256-bit nonce, converted to Crockford `Base32`. + type DenominationBlindingKeyP = string; +*) +module DenominationBlindingKeyP = MK_64 () + (* Hash over: a) the hash of the denomination's public key, b) an enum value identifying the cipher, and @@ -122,8 +173,8 @@ module MerchantPublicKeyP = MK_32 () module MerchantPrivateKeyP = MK_32 () (*module MerchantSignatureP = MK_64 () *) -module TransfertPublicKeyP = MK_32 () -module TransfertPrivateKeyP = MK_32 () +module TransferPublicKeyP = MK_32 () +module TransferPrivateKeyP = MK_32 () (* enum TALER_AmlDecisionState { @@ -139,7 +190,7 @@ module ExchangeSignatureP = MK_64 () module MasterPublicKeyP = MK_32 () module MasterPrivateKeyP = MK_32 () module MasterSignatureP = MK_64 () -module WireTransfertIdentifierRawP = MK_BASIC_32 () +module WireTransferIdentifierRawP = MK_BASIC_32 () module UUID = struct (* uint32t value[4]; *) @@ -183,15 +234,15 @@ module CoinSpendSignatureP = MK_64 () (* TODO padding: sizeof used here (assume no padding for now) *) (* struct TALER_TransferSecretP { - uint8t key[sizeof (struct GNUNET_HashCode)]; + uint8t key[sizeof (struct HashCode)]; }; - uint8t key[sizeof (struct GNUNET_HashCode)]; + uint8t key[sizeof (struct HashCode)]; }; struct TALER_EncryptedLinkSecretP { uint8t enc[sizeof (struct TALER_LinkSecretP)]; }; *) -module TransfertSecretP = MK_64 () +module TransferSecretP = MK_64 () module LinkSecretP = MK_64 () module EncryptedLinkSecretP = MK_64 () @@ -271,7 +322,7 @@ end (* TODO TALER doc should be in doc - found in src/include/taler/talerAmountLib.h + found in src/include/taler/taler_amount_lib.h why is the non-NBO version only used in TALER_WithdrawRequestPS? GNUNET_PACKED? @@ -451,3 +502,626 @@ module WithdrawConfirmationPS = struct |+ field beint32 (fun t -> t.noreveal_index) |> sealr end + +module SingleWithdrawRequestPS = struct + (* purpose.purpose = TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW *) + type t = { + amount_with_fee: AmountNBO.t; + h_denomination_pub: DenominationHash.t; + h_coin_envelope: BlindedCoinHash.t; + } +end + +module DepositRequestPS = struct + (* purpose.purpose = TALER_SIGNATURE_WALLET_COIN_DEPOSIT *) + type t = { + h_contract_terms: PrivateContractHash.t; + h_age_commitment: AgeCommitmentHash.t; + h_policy: ExtensionsPolicyHash.t; + h_wire: MerchantWireHash.t; + h_denom_pub: DenominationHash.t; + timestamp: Time.AbsoluteNBO.t; + refund_deadline: Time.AbsoluteNBO.t; + amount_with_fee: AmountNBO.t; + deposit_fee: AmountNBO.t; + merchant: MerchantPublicKeyP.t; + wallet_data_hash: HashCode.t; + } +end + +module DepositConfirmationPS = struct + (* purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT *) + type t = { + h_contract_terms: PrivateContractHash.t; + h_wire: MerchantWireHash.t; + h_policy: ExtensionsPolicyHash.t; + timestamp: Time.AbsoluteNBO.t; + refund_deadline: Time.AbsoluteNBO.t; + amount_without_fee: AmountNBO.t; + coin_pub: CoinSpendPublicKeyP.t; + merchant: MerchantPublicKeyP.t; + } +end + +module RefreshCommitmentP = MK_64 () + +module RefreshMeltCoinAffirmationPS = struct + (* purpose.purpose = TALER_SIGNATURE_WALLET_COIN_MELT *) + (* Hash over: + 1. refresh_seed (v27) + 2. the hash over all pairs of R-values if present, skipped otherwise + 3. list denomination hashes, in order + 4. amount with fee + 5. kappa list of n planchets, depths first: [0..n),[0..n),[0..n) + *) + type t = { + session_hash: RefreshCommitmentP.t; + h_denom_pub: DenominationHash.t; + h_age_commitment: AgeCommitmentHash.t; + amount_with_fee: AmountNBO.t; + melt_fee: AmountNBO.t; + } +end + +module RefreshMeltConfirmationPS = struct + (* purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT *) + type t = { + session_hash: RefreshCommitmentP.t; + noreveal_index: int; (* uint16_t mapped to OCaml int *) + } +end + +module ExchangeSigningKeyValidityPS = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY *) + type t = { + start: Time.AbsoluteNBO.t; + expire: Time.AbsoluteNBO.t; + end_: Time.AbsoluteNBO.t; (* "end" renamed to end_ *) + signkey_pub: ExchangePublicKeyP.t; + } +end + +module ExchangeKeySetPS = struct + (* purpose.purpose = TALER_SIGNATURE_EXCHANGE_KEY_SET *) + type t = { + list_issue_date: Time.AbsoluteNBO.t; + hc: HashCode.t; + } +end + +module DenominationKeyValidityPS = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY *) + type t = { + master: MasterPublicKeyP.t; + start: Time.AbsoluteNBO.t; + expire_withdraw: Time.AbsoluteNBO.t; + expire_spend: Time.AbsoluteNBO.t; + expire_legal: Time.AbsoluteNBO.t; + value: AmountNBO.t; + fee_withdraw: AmountNBO.t; + fee_deposit: AmountNBO.t; + fee_refresh: AmountNBO.t; + denom_hash: DenominationHash.t; + } +end + +module MasterWireDetailsPS = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_WIRE_DETAILS *) + type t = { + h_wire_details: FullPaytoHash.t; + h_conversion_url: HashCode.t; + h_credit_restrictions: HashCode.t; + h_debit_restrictions: HashCode.t; + } +end + +module MasterWireFeePS = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_WIRE_FEES *) + type t = { + h_wire_method: HashCode.t; + start_date: Time.AbsoluteNBO.t; + end_date: Time.AbsoluteNBO.t; + wire_fee: AmountNBO.t; + closing_fee: AmountNBO.t; + } +end + +module GlobalFeesPS = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_GLOBAL_FEES *) + type t = { + start_date: Time.AbsoluteNBO.t; + end_date: Time.AbsoluteNBO.t; + purse_timeout: Time.RelativeNBO.t; + kyc_timeout: Time.RelativeNBO.t; + history_expiration: Time.RelativeNBO.t; + history_fee: AmountNBO.t; + kyc_fee: AmountNBO.t; + account_fee: AmountNBO.t; + purse_fee: AmountNBO.t; + purse_account_limit: int; (* uint32_t → int *) + } +end + +module MasterDrainProfitPS = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_DRAIN_PROFITS *) + type t = { + wtid: WireTransferIdentifierRawP.t; + date: Time.AbsoluteNBO.t; + amount: AmountNBO.t; + h_section: HashCode.t; + h_payto: FullPaytoHash.t; + } +end + +module DepositTrackPS = struct + (* purpose.purpose = TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION *) + type t = { + h_contract_terms: PrivateContractHash.t; + h_wire: MerchantWireHash.t; + coin_pub: CoinSpendPublicKeyP.t; + } +end + +module WireDepositDetailP = struct + type t = { + h_contract_terms: PrivateContractHash.t; + execution_time: Time.AbsoluteNBO.t; + coin_pub: CoinSpendPublicKeyP.t; + deposit_value: AmountNBO.t; + deposit_fee: AmountNBO.t; + } +end + +module WireDepositDataPS = struct + (* purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT *) + type t = { + total: AmountNBO.t; + wire_fee: AmountNBO.t; + merchant_pub: MerchantPublicKeyP.t; + h_wire: MerchantWireHash.t; + h_details: HashCode.t; + } +end + +module ExchangeKeyValidityPS = struct + (* purpose.purpose = TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS *) + type t = { + auditor_url_hash: HashCode.t; + master: MasterPublicKeyP.t; + start: Time.AbsoluteNBO.t; + expire_withdraw: Time.AbsoluteNBO.t; + expire_spend: Time.AbsoluteNBO.t; + expire_legal: Time.AbsoluteNBO.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 } +end + +module ContractPS = struct + (* purpose.purpose = TALER_SIGNATURE_MERCHANT_CONTRACT *) + type t = { h_contract_terms: PrivateContractHash.t } +end + +module ConfirmWirePS = struct + (* purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE *) + type t = { + h_wire: MerchantWireHash.t; + h_contract_terms: PrivateContractHash.t; + wtid: WireTransferIdentifierRawP.t; + coin_pub: CoinSpendPublicKeyP.t; + execution_time: Time.AbsoluteNBO.t; + coin_contribution: AmountNBO.t; + } +end + +module RefundConfirmationPS = struct + (* purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND *) + type t = { + h_contract_terms: PrivateContractHash.t; + coin_pub: CoinSpendPublicKeyP.t; + merchant: MerchantPublicKeyP.t; + rtransaction_id: int64; + refund_amount: AmountNBO.t; + } +end + +module DepositTrackPS2 = struct + (* purpose.purpose = TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION *) + type t = { + h_contract_terms: PrivateContractHash.t; + h_wire: MerchantWireHash.t; + merchant: MerchantPublicKeyP.t; + coin_pub: CoinSpendPublicKeyP.t; + } +end + +module RefundRequestPS = struct + (* purpose.purpose = TALER_SIGNATURE_MERCHANT_REFUND *) + type t = { + h_contract_terms: PrivateContractHash.t; + coin_pub: CoinSpendPublicKeyP.t; + rtransaction_id: int64; + refund_amount: AmountNBO.t; + refund_fee: AmountNBO.t; + } +end + +module MerchantRefundConfirmationPS = struct + (* purpose.purpose = TALER_SIGNATURE_MERCHANT_REFUND_OK *) + (* Hash of the order ID (a string), hashed without the 0-termination. *) + type t = { h_order_id: HashCode.t } +end + +module RecoupRequestPS = struct + (* purpose.purpose = TALER_SIGNATURE_WALLET_COIN_RECOUP or TALER_SIGNATURE_WALLET_COIN_RECOUP_REFRESH *) + type t = { + h_denom_pub: DenominationHash.t; + coin_blind: DenominationBlindingKeyP.t; + } +end + +module RecoupRefreshConfirmationPS = struct + (* purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH *) + type t = { + timestamp: Time.AbsoluteNBO.t; + recoup_amount: AmountNBO.t; + coin_pub: CoinSpendPublicKeyP.t; + old_coin_pub: CoinSpendPublicKeyP.t; + } +end + +module RecoupConfirmationPS = struct + (* purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP *) + type t = { + timestamp: Time.AbsoluteNBO.t; + recoup_amount: AmountNBO.t; + coin_pub: CoinSpendPublicKeyP.t; + reserve_pub: ReservePublicKeyP.t; + } +end + +module DenominationUnknownAffirmationPS = struct + (* purpose.purpose = TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_UNKNOWN *) + type t = { + timestamp: Time.AbsoluteNBO.t; + h_denom_pub: DenominationHash.t; + } +end + +module DenominationExpiredAffirmationPS = struct + (* purpose.purpose = TALER_SIGNATURE_EXCHANGE_GENERIC_DENOMINATIN_EXPIRED *) + type t = { + timestamp: Time.AbsoluteNBO.t; + operation: string; (* char[8] → string *) + h_denom_pub: DenominationHash.t; + } +end + +module ReserveCloseConfirmationPS = struct + (* purpose.purpose = TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED *) + type t = { + timestamp: Time.AbsoluteNBO.t; + closing_amount: AmountNBO.t; + reserve_pub: ReservePublicKeyP.t; + h_wire: FullPaytoHash.t; + } +end + +module CoinLinkSignaturePS = struct + (* purpose.purpose = TALER_SIGNATURE_WALLET_COIN_LINK *) + type t = { + h_denom_pub: DenominationHash.t; + old_coin_pub: CoinSpendPublicKeyP.t; + transfer_pub: TransferPublicKeyP.t; + coin_envelope_hash: BlindedCoinHash.t; + } +end + +module RefreshNonceSignaturePS = struct + (* purpose.purpose = TALER_SIGNATURE_WALLET_COIN_LINK *) + type t = { nonce: PublicRefreshCoinNonceP.t } +end + +module ReserveStatusRequestSignaturePS = struct + (* purpose.purpose = TALER_SIGNATURE_RESERVE_STATUS_REQUEST *) + type t = { request_timestamp: Time.AbsoluteNBO.t } +end + +module ReserveHistoryRequestSignaturePS = struct + (* purpose.purpose = TALER_SIGNATURE_RESERVE_HISTORY_REQUEST *) + type t = { + history_fee: AmountNBO.t; + request_timestamp: Time.AbsoluteNBO.t; + } +end + +module PurseStatusRequestSignaturePS = struct + (* purpose.purpose = TALER_SIGNATURE_PURSE_STATUS_REQUEST *) + type t = unit +end + +module PurseStatusResponseSignaturePS = struct + (* purpose.purpose = TALER_SIGNATURE_PURSE_STATUS_RESPONSE *) + type t = { + total_purse_amount: AmountNBO.t; + total_deposit_amount: AmountNBO.t; + max_deposit_fees: AmountNBO.t; + purse_expiration: Time.AbsoluteNBO.t; + status_timestamp: Time.AbsoluteNBO.t; + h_contract_terms: PrivateContractHash.t; + } +end + +module ReserveCloseRequestSignaturePS = struct + (* purpose.purpose = TALER_SIGNATURE_WALLET_RESERVE_CLOSE *) + type t = unit +end + +module PurseRequestSignaturePS = struct + (* purpose.purpose = TALER_SIGNATURE_WALLET_PURSE_CREATE *) + type t = { + purse_expiration: Time.AbsoluteNBO.t; + merge_value_after_fees: AmountNBO.t; + h_contract_terms: PrivateContractHash.t; + min_age: int; + } +end + +module PurseDepositSignaturePS = struct + (* purpose.purpose = TALER_SIGNATURE_PURSE_DEPOSIT *) + type t = { + coin_contribution: AmountNBO.t; + h_denom_pub: DenominationHash.t; + h_age_commitment: AgeCommitmentHash.t; + purse_pub: PursePublicKey.t; + h_exchange_base_url: HashCode.t; + } +end + +module PurseDepositSignaturePS2 = struct + (* purpose.purpose = TALER_SIGNATURE_WALLET_RESERVE_OPEN_DEPOSIT *) + type t = { + reserve_sig: ReserveSignatureP.t; + coin_contribution: AmountNBO.t; + } +end + +module PurseDepositConfirmedSignaturePS = struct + (* purpose.purpose = TALER_SIGNATURE_PURSE_DEPOSIT_CONFIRMED *) + type t = { + total_purse_amount: AmountNBO.t; + total_deposit_fees: AmountNBO.t; + purse_pub: PursePublicKey.t; + purse_expiration: Time.AbsoluteNBO.t; + h_contract_terms: PrivateContractHash.t; + } +end + +module PurseMergeSignaturePS = struct + (* purpose.purpose = TALER_SIGNATURE_WALLET_PURSE_MERGE *) + type t = { + merge_timestamp: Time.AbsoluteNBO.t; + h_wire: NormalizedPaytoHash.t; + } +end + +module AccountMergeSignaturePS = struct + (* purpose.purpose = TALER_SIGNATURE_WALLET_ACCOUNT_MERGE *) + type t = { + reserve_pub: ReservePublicKeyP.t; + purse_pub: PursePublicKey.t; + merge_amount_after_fees: AmountNBO.t; + merge_timestamp: Time.AbsoluteNBO.t; + purse_expiration: Time.AbsoluteNBO.t; + h_contract_terms: PrivateContractHash.t; + min_age: int; + } +end + +module AccountSetupRequestSignaturePS = struct + (* purpose.purpose = TALER_SIGNATURE_WALLET_ACCOUNT_SETUP *) + type t = { threshold: AmountNBO.t } +end + +module PurseMergeSuccessSignaturePS = struct + (* purpose.purpose = TALER_SIGNATURE_PURSE_MERGE_SUCCESS *) + type t = { + reserve_pub: ReservePublicKeyP.t; + purse_pub: PursePublicKey.t; + merge_amount_after_fees: AmountNBO.t; + contract_time: Time.AbsoluteNBO.t; + h_contract_terms: PrivateContractHash.t; + h_wire: NormalizedPaytoHash.t; + min_age: int; + } +end + +module WadDataSignaturePS = struct + (* purpose.purpose = TALER_SIGNATURE_WAD_DATA *) + type t = { + wad_execution_time: Time.AbsoluteNBO.t; + total_amount: AmountNBO.t; + h_items: HashCode.t; + wad_id: WadId.t; + } +end + +module WadPartnerSignaturePS = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_PARTNER_DETAILS *) + type t = { + h_partner_base_url: HashCode.t; + master_public_key: MasterPublicKeyP.t; + start_date: Time.AbsoluteNBO.t; + end_date: Time.AbsoluteNBO.t; + wad_fee: AmountNBO.t; + wad_frequency: Time.RelativeNBO.t; + } +end + +module P2PFeesPS = struct + (* purpose.purpose = TALER_SIGNATURE_P2P_FEES *) + type t = { + start_date: Time.AbsoluteNBO.t; + end_date: Time.AbsoluteNBO.t; + kyc_fee: AmountNBO.t; + purse_fee: AmountNBO.t; + account_history_fee: AmountNBO.t; + account_annual_fee: AmountNBO.t; + account_kyc_timeout: Time.RelativeNBO.t; + purse_timeout: Time.RelativeNBO.t; + purse_account_limit: int; + } +end + +module CoinPurseRefundConfirmationPS = struct + (* purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_PURSE_REFUND *) + type t = { + purse_pub: PursePublicKey.t; + coin_pub: CoinSpendPublicKeyP.t; + refunded_amount: AmountNBO.t; + refund_fee: AmountNBO.t; + } +end + +module DenominationKeyAnnouncementPS = struct + (* purpose.purpose = TALER_SIGNATURE_SM_DENOMINATION_KEY *) + type t = { + h_denom_pub: DenominationHash.t; + h_section_name: HashCode.t; + anchor_time: Time.AbsoluteNBO.t; + duration_withdraw: Time.RelativeNBO.t; + } +end + +module SigningKeyAnnouncementPS = struct + (* purpose.purpose = TALER_SIGNATURE_SM_SIGNING_KEY *) + type t = { + exchange_pub: ExchangePublicKeyP.t; + anchor_time: Time.AbsoluteNBO.t; + duration: Time.RelativeNBO.t; + } +end + +module MasterDenominationKeyRevocationPS = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED *) + type t = { h_denom_pub: DenominationHash.t } +end + +module MasterSigningKeyRevocationPS = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_SIGNING_KEY_REVOKED *) + type t = { exchange_pub: ExchangePublicKeyP.t } +end + +module MasterAddAuditorPS = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_ADD_AUDITOR *) + type t = { + start_date: Time.AbsoluteNBO.t; + auditor_pub: AuditorPublicKeyP.t; + h_auditor_url: HashCode.t; + } +end + +module MasterDelAuditorPS = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_DEL_AUDITOR *) + type t = { + end_date: Time.AbsoluteNBO.t; + auditor_pub: AuditorPublicKeyP.t; + } +end + +module MasterAddWirePS = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_ADD_WIRE *) + type t = { + start_date: Time.AbsoluteNBO.t; + h_wire: FullPaytoHash.t; + h_conversion_url: HashCode.t; + h_credit_restrictions: HashCode.t; + h_debit_restrictions: HashCode.t; + } +end + +module MasterDelWirePS = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_DEL_WIRE *) + type t = { + end_date: Time.AbsoluteNBO.t; + h_wire: FullPaytoHash.t; + } +end + +module MasterAmlOfficerStatusPS = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_AML_KEY *) + type t = { + change_date: Time.TimestampNBO.t; + officer_pub: AmlOfficerPublicKeyP.t; + h_officer_name: HashCode.t; + is_active: int; + } +end + +module AmlDecisionPS = struct + (* purpose.purpose = TALER_SIGNATURE_AML_DECISION *) + type t = { + h_justification: HashCode.t; + decision_time: Time.TimestampNBO.t; + new_threshold: AmountNBO.t; + h_payto: NormalizedPaytoHash.t; + h_kyc_requirements: HashCode.t; + new_state: int; + } +end + +module PartnerConfigurationPS = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_PARNTER_DETAILS *) + type t = { + partner_pub: MasterPublicKeyP.t; + start_date: Time.TimestampNBO.t; + end_date: Time.TimestampNBO.t; + wad_frequency: Time.RelativeNBO.t; + wad_fee: AmountNBO.t; + h_url: HashCode.t; + } +end + +module ReserveOpenPS = struct + (* purpose.purpose = TALER_SIGNATURE_WALLET_RESERVE_OPEN *) + type t = { + reserve_payment: AmountNBO.t; + request_timestamp: Time.TimestampNBO.t; + reserve_expiration: Time.TimestampNBO.t; + purse_limit: int; + } +end + +module ReserveClosePS = struct + (* purpose.purpose = TALER_SIGNATURE_WALLET_RESERVE_CLOSE *) + type t = { + request_timestamp: Time.TimestampNBO.t; + target_account_h_payto: FullPaytoHash.t; + } +end + +module ReserveAttestRequestPS = struct + (* purpose.purpose = TALER_SIGNATURE_WALLET_ATTEST_REQUEST *) + type t = { + request_timestamp: Time.TimestampNBO.t; + h_details: HashCode.t; + } +end + +module ExchangeAttestPS = struct + (* purpose.purpose = TALER_SIGNATURE_EXCHANGE_RESERVE_ATTEST_DETAILS *) + type t = { + attest_timestamp: Time.TimestampNBO.t; + expiration_time: Time.TimestampNBO.t; + reserve_pub: ReservePublicKeyP.t; + h_attributes: HashCode.t; + } +end diff --git a/src/types.ml b/src/types.ml index d1f43f96..415b6dcb 100644 --- a/src/types.ml +++ b/src/types.ml @@ -116,6 +116,8 @@ module Eddsa = struct (* EdDSA and ECDHE public keys always point on Curve25519 and represented using the standard 256 bits Ed25519 compact format, converted to Crockford Base32. *) + (* EdDSA signatures are transmitted as 64-bytes `base32` + binary-encoded objects with just the R and S values (base32_ binary-only). *) type pub = Mirage_crypto_ec.Ed25519.pub let pub_of_string s =