From 6a62e21d9aed1119694b9fd538b9b3beae5a8960 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 6 Nov 2021 17:26:28 +0100 Subject: update specification to match protocolv9 --- core/api-common.rst | 185 ++++++++++++++++++++++++++++------------------------ 1 file changed, 100 insertions(+), 85 deletions(-) (limited to 'core/api-common.rst') diff --git a/core/api-common.rst b/core/api-common.rst index b3cffd2e..b6bd02a4 100644 --- a/core/api-common.rst +++ b/core/api-common.rst @@ -222,6 +222,11 @@ hashed data. See `base32`_. // 32-byte hash code. type ShortHashCode = string; +.. ts:def:: WireSalt + + // 16-byte salt. + type WireSalt = string; + .. ts:def:: SHA256HashCode type SHA256HashCode = ShortHashCode; @@ -535,12 +540,49 @@ All elliptic curve operations are on Curve25519. Public and private keys are thus 32 bytes, and signatures 64 bytes. For hashing, including HKDFs, Taler uses 512-bit hash codes (64 bytes). +.. _HashCode: .. sourcecode:: c struct GNUNET_HashCode { uint8_t hash[64]; // usually SHA-512 }; +.. sourcecode:: c + struct TALER_DenominationHash { + struct GNUNET_HashCode hash; + }; + +.. sourcecode:: c + struct TALER_PrivateContractHash { + struct GNUNET_HashCode hash; + }; + +.. sourcecode:: c + struct TALER_ExtensionContractHash { + struct GNUNET_HashCode hash; + }; + +.. sourcecode:: c + struct TALER_MerchantWireHash { + struct GNUNET_HashCode hash; + }; + +.. sourcecode:: c + struct TALER_PaytoHash { + struct GNUNET_HashCode hash; + }; + +.. sourcecode:: c + struct TALER_BlindedCoinHash { + struct GNUNET_HashCode hash; + }; + +.. sourcecode:: c + struct TALER_CoinPubHash { + struct GNUNET_HashCode hash; + }; + + .. _TALER_EcdhEphemeralPublicKeyP: .. sourcecode:: c @@ -721,8 +763,8 @@ within the struct TALER_ReservePublicKeyP reserve_pub; struct TALER_AmountNBO amount_with_fee; struct TALER_AmountNBO withdraw_fee; - struct GNUNET_HashCode h_denomination_pub; - struct GNUNET_HashCode h_coin_envelope; + struct TALER_DenominationHash h_denomination_pub; + struct TALER_BlindedCoinHash h_coin_envelope; }; .. _TALER_DepositRequestPS: @@ -733,15 +775,15 @@ within the * purpose.purpose = TALER_SIGNATURE_WALLET_COIN_DEPOSIT */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct GNUNET_HashCode h_contract_terms; - struct GNUNET_HashCode h_wire; - struct GNUNET_HashCode h_denom_pub; + struct TALER_PrivateContractHash h_contract_terms; + struct TALER_ExtensionContractHash h_extensions; + struct TALER_MerchantWireHash h_wire; + struct TALER_DenominationHash h_denom_pub; struct GNUNET_TIME_AbsoluteNBO timestamp; struct GNUNET_TIME_AbsoluteNBO refund_deadline; struct TALER_AmountNBO amount_with_fee; struct TALER_AmountNBO deposit_fee; struct TALER_MerchantPublicKeyP merchant; - union TALER_CoinSpendPublicKeyP coin_pub; }; .. _TALER_DepositConfirmationPS: @@ -749,11 +791,11 @@ within the struct TALER_DepositConfirmationPS { /** - * purpose.purpose = TALER_SIGNATURE_WALLET_CONFIRM_DEPOSIT + * purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct GNUNET_HashCode h_contract_terms; - struct GNUNET_HashCode h_wire; + struct TALER_PrivateContractHash h_contract_terms; + struct TALER_MerchantWireHash h_wire; struct GNUNET_TIME_AbsoluteNBO timestamp; struct GNUNET_TIME_AbsoluteNBO refund_deadline; struct TALER_AmountNBO amount_without_fee; @@ -769,8 +811,8 @@ within the * purpose.purpose = TALER_SIGNATURE_WALLET_COIN_MELT */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct GNUNET_HashCode session_hash; - struct GNUNET_HashCode h_denom_pub; + struct TALER_RefreshCommitmentP session_hash; + struct TALER_DenominationHash h_denom_pub; struct TALER_AmountNBO amount_with_fee; struct TALER_AmountNBO melt_fee; union TALER_CoinSpendPublicKeyP coin_pub; @@ -784,7 +826,7 @@ within the * purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct GNUNET_HashCode session_hash; + struct TALER_RefreshCommitmentP session_hash; uint16_t noreveal_index; }; @@ -832,7 +874,7 @@ within the struct TALER_AmountNBO fee_withdraw; struct TALER_AmountNBO fee_deposit; struct TALER_AmountNBO fee_refresh; - struct GNUNET_HashCode denom_hash; + struct TALER_DenominationHash denom_hash; }; .. _TALER_MasterWireDetailsPS: @@ -843,7 +885,7 @@ within the * purpose.purpose = TALER_SIGNATURE_MASTER_WIRE_DETAILS */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct GNUNET_HashCode h_wire_details; + struct TALER_PaytoHash h_wire_details; }; .. _TALER_MasterWireFeePS: @@ -869,19 +911,19 @@ within the * purpose.purpose = TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct GNUNET_HashCode h_contract_terms; - struct GNUNET_HashCode h_wire; + struct TALER_PrivateContractHash h_contract_terms; + struct TALER_MerchantWireHash h_wire; struct TALER_MerchantPublicKeyP merchant; - struct TALER_CoinSpendPublicKeyP coin_pub; + union TALER_CoinSpendPublicKeyP coin_pub; }; .. _TALER_WireDepositDetailP: .. sourcecode:: c struct TALER_WireDepositDetailP { - struct GNUNET_HashCode h_contract_terms; + struct TALER_PrivateContractHash h_contract_terms; struct GNUNET_TIME_AbsoluteNBO execution_time; - struct TALER_CoinSpendPublicKeyP coin_pub; + union TALER_CoinSpendPublicKeyP coin_pub; struct TALER_AmountNBO deposit_value; struct TALER_AmountNBO deposit_fee; }; @@ -898,7 +940,7 @@ within the struct TALER_AmountNBO total; struct TALER_AmountNBO wire_fee; struct TALER_MerchantPublicKeyP merchant_pub; - struct GNUNET_HashCode h_wire; + struct TALER_MerchantWireHash h_wire; struct GNUNET_HashCode h_details; }; @@ -920,7 +962,7 @@ within the struct TALER_AmountNBO fee_withdraw; struct TALER_AmountNBO fee_deposit; struct TALER_AmountNBO fee_refresh; - struct GNUNET_HashCode denom_hash; + struct TALER_DenominationHash denom_hash; }; .. _TALER_PaymentResponsePS: @@ -931,7 +973,7 @@ within the * purpose.purpose = TALER_SIGNATURE_MERCHANT_PAYMENT_OK */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct GNUNET_HashCode h_contract_terms; + struct TALER_PrivateContractHash h_contract_terms; }; .. _TALER_ContractPS: @@ -944,7 +986,7 @@ within the struct GNUNET_CRYPTO_EccSignaturePurpose purpose; struct TALER_AmountNBO total_amount; struct TALER_AmountNBO max_fee; - struct GNUNET_HashCode h_contract_terms; + struct TALER_PrivateContractHash h_contract_terms; struct TALER_MerchantPublicKeyP merchant_pub; }; @@ -957,10 +999,10 @@ within the * purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct GNUNET_HashCode h_wire; - struct GNUNET_HashCode h_contract_terms; + struct TALER_MerchantWireHash h_wire; + struct TALER_PrivateContractHash h_contract_terms; struct TALER_WireTransferIdentifierRawP wtid; - struct TALER_CoinSpendPublicKeyP coin_pub; + union TALER_CoinSpendPublicKeyP coin_pub; struct GNUNET_TIME_AbsoluteNBO execution_time; struct TALER_AmountNBO coin_contribution; }; @@ -973,8 +1015,8 @@ within the * purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND. */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct GNUNET_HashCode h_contract_terms; - struct TALER_CoinSpendPublicKeyP coin_pub; + struct TALER_PrivateContractHash h_contract_terms; + union TALER_CoinSpendPublicKeyP coin_pub; struct TALER_MerchantPublicKeyP merchant; uint64_t rtransaction_id; struct TALER_AmountNBO refund_amount; @@ -988,10 +1030,10 @@ within the * purpose.purpose = TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION. */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct GNUNET_HashCode h_contract_terms; - struct GNUNET_HashCode h_wire; + struct TALER_PrivateContractHash h_contract_terms; + struct TALER_MerchantWireHash h_wire; struct TALER_MerchantPublicKeyP merchant; - struct TALER_CoinSpendPublicKeyP coin_pub; + union TALER_CoinSpendPublicKeyP coin_pub; }; .. _TALER_RefundRequestPS: @@ -1002,8 +1044,8 @@ within the * purpose.purpose = TALER_SIGNATURE_MERCHANT_REFUND */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct GNUNET_HashCode h_contract_terms; - struct TALER_CoinSpendPublicKeyP coin_pub; + struct TALER_PrivateContractHash h_contract_terms; + union TALER_CoinSpendPublicKeyP coin_pub; struct TALER_MerchantPublicKeyP merchant; uint64_t rtransaction_id; struct TALER_AmountNBO refund_amount; @@ -1033,8 +1075,8 @@ within the * purpose.purpose = TALER_SIGNATURE_WALLET_COIN_RECOUP */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct TALER_CoinSpendPublicKeyP coin_pub; - struct GNUNET_HashCode h_denom_pub; + union TALER_CoinSpendPublicKeyP coin_pub; + struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationBlindingKeyP coin_blind; }; @@ -1048,7 +1090,7 @@ within the struct GNUNET_CRYPTO_EccSignaturePurpose purpose; struct GNUNET_TIME_AbsoluteNBO timestamp; struct TALER_AmountNBO recoup_amount; - struct TALER_CoinSpendPublicKeyP coin_pub; + union TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendPublicKeyP old_coin_pub; }; @@ -1062,7 +1104,7 @@ within the struct GNUNET_CRYPTO_EccSignaturePurpose purpose; struct GNUNET_TIME_AbsoluteNBO timestamp; struct TALER_AmountNBO recoup_amount; - struct TALER_CoinSpendPublicKeyP coin_pub; + union TALER_CoinSpendPublicKeyP coin_pub; struct TALER_ReservePublicKeyP reserve_pub; }; @@ -1076,7 +1118,7 @@ within the */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; struct GNUNET_TIME_AbsoluteNBO timestamp; - struct GNUNET_HashCode h_denom_pub; + struct TALER_DenominationHash h_denom_pub; }; @@ -1090,7 +1132,7 @@ within the struct GNUNET_CRYPTO_EccSignaturePurpose purpose; struct GNUNET_TIME_AbsoluteNBO timestamp; char operation[8]; - struct GNUNET_HashCode h_denom_pub; + struct TALER_DenominationHash h_denom_pub; }; @@ -1105,7 +1147,7 @@ within the struct GNUNET_TIME_AbsoluteNBO timestamp; struct TALER_AmountNBO closing_amount; struct TALER_ReservePublicKeyP reserve_pub; - struct GNUNET_HashCode h_wire; + struct TALER_PaytoHash h_wire; }; .. _TALER_CoinLinkSignaturePS: @@ -1116,10 +1158,10 @@ within the * purpose.purpose = TALER_SIGNATURE_WALLET_COIN_LINK */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct GNUNET_HashCode h_denom_pub; - struct TALER_CoinSpendPublicKeyP old_coin_pub; + struct TALER_DenominationHash h_denom_pub; + union TALER_CoinSpendPublicKeyP old_coin_pub; struct TALER_TransferPublicKeyP transfer_pub; - struct GNUNET_HashCode coin_envelope_hash; + struct TALER_BlindedCoinHash coin_envelope_hash; }; @@ -1174,7 +1216,7 @@ within the struct TALER_AmountNBO max_deposit_fees; struct GNUNET_TIME_AbsoluteNBO purse_expiration; struct GNUNET_TIME_AbsoluteNBO status_timestamp; - struct GNUNET_HashCode h_contract_terms; + struct TALER_PrivateContractHash h_contract_terms; }; @@ -1206,7 +1248,7 @@ within the struct GNUNET_CRYPTO_EccSignaturePurpose purpose; struct GNUNET_TIME_AbsoluteNBO purse_expiration; struct TALER_AmountNBO merge_value_after_fees; - struct GNUNET_HashCode h_contract_terms; + struct TALER_PrivateContractHash h_contract_terms; }; @@ -1221,7 +1263,7 @@ within the struct TALER_AmountNBO coin_contribution; struct GNUNET_TIME_AbsoluteNBO purse_expiration; struct TALER_PursePublicKey purse_pub; - struct GNUNET_HashCode h_contract_terms; + struct TALER_PrivateContractHash h_contract_terms; }; @@ -1237,7 +1279,7 @@ within the struct TALER_AmountNBO total_deposit_fees; struct TALER_PursePublicKey purse_pub; struct GNUNET_TIME_AbsoluteNBO purse_expiration; - struct GNUNET_HashCode h_contract_terms; + struct TALER_PrivateContractHash h_contract_terms; }; .. _TALER_PurseMergeSignaturePS: @@ -1252,8 +1294,8 @@ within the struct GNUNET_TIME_AbsoluteNBO merge_timestamp; struct GNUNET_TIME_AbsoluteNBO purse_expiration; struct TALER_AmountNBO merge_value_after_fees; - struct GNUNET_HashCode h_contract_terms; - struct GNUNET_HashCode h_wire; + struct TALER_PrivateContractHash h_contract_terms; + struct TALER_PaytoHash h_wire; }; @@ -1269,8 +1311,8 @@ within the struct GNUNET_TIME_AbsoluteNBO merge_timestamp; struct GNUNET_TIME_AbsoluteNBO purse_expiration; struct TALER_AmountNBO merge_value_after_fees; - struct GNUNET_HashCode h_contract_terms; - struct GNUNET_HashCode h_wire; + struct TALER_PrivateContractHash h_contract_terms; + struct TALER_PaytoHash h_wire; }; @@ -1286,35 +1328,8 @@ within the struct TALER_PursePublicKey purse_pub; struct TALER_AmountNBO merge_amount_after_fees; struct GNUNET_TIME_AbsoluteNBO contract_time; - struct GNUNET_HashCode h_contract_terms; - struct GNUNET_HashCode h_wire; - }; - - -.. _TALER_AccountSetupRequestSignaturePS: -.. sourcecode:: c - - struct TALER_AccountSetupRequestSignaturePS { - /** - * purpose.purpose = TALER_SIGNATURE_ACCOUNT_SETUP_REQUEST - */ - struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct GNUNET_TIME_AbsoluteNBO kyc_timestamp; - struct TALER_AmountNBO kyc_fee; - struct GNUNET_HashCode h_wire; - }; - - -.. _TALER_AccountSetupSuccessSignaturePS: -.. sourcecode:: c - - struct TALER_AccountSetupRequestSignaturePS { - /** - * purpose.purpose = TALER_SIGNATURE_ACCOUNT_SETUP_SUCCESS - */ - struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct TALER_ReservePublicKey reserve_pub; - struct GNUNET_TIME_AbsoluteNBO now; + struct TALER_PrivateContractHash h_contract_terms; + struct TALER_PaytoHash h_wire; }; @@ -1378,7 +1393,7 @@ within the */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; struct TALER_PursePublicKey purse_pub; - struct TALER_CoinSpendPublicKeyP coin_pub; + union TALER_CoinSpendPublicKeyP coin_pub; struct TALER_MerchantPublicKeyP merchant; struct TALER_AmountNBO remaining_amount; struct TALER_AmountNBO purse_fee_share; @@ -1394,7 +1409,7 @@ within the * purpose.purpose = TALER_SIGNATURE_SM_DENOMINATION_KEY */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct GNUNET_HashCode h_denom_pub; + struct TALER_DenominationHash h_denom_pub; struct GNUNET_HashCode h_section_name; struct GNUNET_TIME_AbsoluteNBO anchor_time; struct GNUNET_TIME_RelativeNBO duration_withdraw; @@ -1422,7 +1437,7 @@ within the * purpose.purpose = TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED. */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct GNUNET_HashCode h_denom_pub; + struct TALER_DenominationHash h_denom_pub; }; @@ -1472,7 +1487,7 @@ within the */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; struct GNUNET_TIME_AbsoluteNBO start_date; - struct GNUNET_HashCode h_wire GNUNET_PACKED; + struct TALER_PaytoHash h_wire; }; .. _TALER_MasterDelWirePS: @@ -1484,5 +1499,5 @@ within the */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; struct GNUNET_TIME_AbsoluteNBO end_date; - struct GNUNET_HashCode h_wire GNUNET_PACKED; + struct TALER_PaytoHash h_wire; }; -- cgit v1.2.3