From 9d6e1040669435dfa2ab93abd4f1669c7bf90871 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 6 Nov 2021 19:43:47 +0100 Subject: include h_extensions in deposit confirmation --- src/include/taler_auditor_service.h | 2 ++ src/include/taler_auditordb_plugin.h | 5 +++++ src/include/taler_crypto_lib.h | 34 ++++++++++++++++++++++++++++++++++ src/include/taler_signatures.h | 18 ++++++++++++++---- src/include/taler_testing_lib.h | 2 ++ 5 files changed, 57 insertions(+), 4 deletions(-) (limited to 'src/include') diff --git a/src/include/taler_auditor_service.h b/src/include/taler_auditor_service.h index 9e2e46d28..4da72c1c4 100644 --- a/src/include/taler_auditor_service.h +++ b/src/include/taler_auditor_service.h @@ -235,6 +235,7 @@ typedef void * @param h_wire hash of merchant wire details * @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the auditor) * @param exchange_timestamp timestamp when the contract was finalized, must not be too far in the future + * @param wire_deadline date until which the exchange should wire the funds * @param refund_deadline date until which the merchant can issue a refund to the customer via the auditor (can be zero if refunds are not allowed); must not be after the @a wire_deadline * @param amount_without_fee the amount confirmed to be wired by the exchange to the merchant * @param coin_pub coin’s public key @@ -257,6 +258,7 @@ TALER_AUDITOR_deposit_confirmation ( const struct TALER_MerchantWireHash *h_wire, const struct TALER_PrivateContractHash *h_contract_terms, struct GNUNET_TIME_Absolute timestamp, + struct GNUNET_TIME_Absolute wire_deadline, struct GNUNET_TIME_Absolute refund_deadline, const struct TALER_Amount *amount_without_fee, const struct TALER_CoinSpendPublicKeyP *coin_pub, diff --git a/src/include/taler_auditordb_plugin.h b/src/include/taler_auditordb_plugin.h index 18db86946..8dd454b97 100644 --- a/src/include/taler_auditordb_plugin.h +++ b/src/include/taler_auditordb_plugin.h @@ -295,6 +295,11 @@ struct TALER_AUDITORDB_DepositConfirmation */ struct GNUNET_TIME_Absolute refund_deadline; + /** + * How much time does the @e exchange have to wire the funds? + */ + struct GNUNET_TIME_Absolute wire_deadline; + /** * Amount to be deposited, excluding fee. Calculated from the * amount with fee and the fee from the deposit request. diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index 881e368ee..7787c23d8 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -1547,6 +1547,40 @@ TALER_CRYPTO_helper_esign_disconnect ( struct TALER_CRYPTO_ExchangeSignHelper *esh); +/* ********************* exchange signing ************************** */ + + +/** + * Verify a deposit confirmation. + * + * @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the exchange) + * @param h_wire hash of the merchant’s account details + * @param h_extensions hash over the extensions, can be NULL + * @param exchange_timestamp timestamp when the contract was finalized, must not be too far off + * @param wire_deadline date until which the exchange should wire the funds + * @param refund_deadline date until which the merchant can issue a refund to the customer via the exchange (can be zero if refunds are not allowed); must not be after the @a wire_deadline + * @param amount_without_fee the amount to be deposited after fees + * @param coin_pub public key of the deposited coin + * @param merchant_pub the public key of the merchant (used to identify the merchant for refund requests) + * @param exchange_pub exchange's online signing public key + * @param exchange_sig the signature made with purpose #TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT + * @return #GNUNET_OK if the signature is valid + */ +enum GNUNET_GenericReturnValue +TALER_exchange_deposit_confirm_verify ( + const struct TALER_PrivateContractHash *h_contract_terms, + const struct TALER_MerchantWireHash *h_wire, + const struct TALER_ExtensionContractHash *h_extensions, + struct GNUNET_TIME_Absolute exchange_timestamp, + struct GNUNET_TIME_Absolute wire_deadline, + struct GNUNET_TIME_Absolute refund_deadline, + const struct TALER_Amount *amount_without_fee, + const struct TALER_CoinSpendPublicKeyP *coin_pub, + const struct TALER_MerchantPublicKeyP *merchant_pub, + const struct TALER_ExchangePublicKeyP *exchange_pub, + const struct TALER_ExchangeSignatureP *exchange_sig); + + /* ********************* wallet signing ************************** */ diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h index 5eef0db6f..40755348d 100644 --- a/src/include/taler_signatures.h +++ b/src/include/taler_signatures.h @@ -555,12 +555,24 @@ struct TALER_DepositConfirmationPS */ struct TALER_MerchantWireHash h_wire GNUNET_PACKED; + /** + * Hash over the extension options of the deposit, 0 if there + * were not extension options. + */ + struct TALER_ExtensionContractHash h_extensions GNUNET_PACKED; + /** * Time when this confirmation was generated / when the exchange received * the deposit request. */ struct GNUNET_TIME_AbsoluteNBO exchange_timestamp; + /** + * By when does the exchange expect to pay the merchant + * (as per the merchant's request). + */ + struct GNUNET_TIME_AbsoluteNBO wire_deadline; + /** * How much time does the @e merchant have to issue a refund * request? Zero if refunds are not allowed. After this time, the @@ -577,9 +589,7 @@ struct TALER_DepositConfirmationPS struct TALER_AmountNBO amount_without_fee; /** - * The coin's public key. This is the value that must have been - * signed (blindly) by the Exchange. The deposit request is to be - * signed by the corresponding private key (using EdDSA). + * The public key of the coin that was deposited. */ struct TALER_CoinSpendPublicKeyP coin_pub; @@ -587,7 +597,7 @@ struct TALER_DepositConfirmationPS * The Merchant's public key. Allows the merchant to later refund * the transaction or to inquire about the wire transfer identifier. */ - struct TALER_MerchantPublicKeyP merchant; + struct TALER_MerchantPublicKeyP merchant_pub; }; diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index 2656300fe..e99912a64 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -2379,6 +2379,8 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits, op (coin_priv, const struct TALER_CoinSpendPrivateKeyP) \ op (coin_pub, const struct TALER_CoinSpendPublicKeyP) \ op (absolute_time, const struct GNUNET_TIME_Absolute) \ + op (wire_deadline, const struct GNUNET_TIME_Absolute) \ + op (refund_deadline, const struct GNUNET_TIME_Absolute) \ op (exchange_pub, const struct TALER_ExchangePublicKeyP) \ op (exchange_sig, const struct TALER_ExchangeSignatureP) \ op (blinding_key, const union TALER_DenominationBlindingKeyP) -- cgit v1.2.3