diff options
Diffstat (limited to 'src/lib/exchange_api_refresh_common.h')
-rw-r--r-- | src/lib/exchange_api_refresh_common.h | 106 |
1 files changed, 85 insertions, 21 deletions
diff --git a/src/lib/exchange_api_refresh_common.h b/src/lib/exchange_api_refresh_common.h index 1c037d966..f596e1e90 100644 --- a/src/lib/exchange_api_refresh_common.h +++ b/src/lib/exchange_api_refresh_common.h @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2015-2020 Taler Systems SA + Copyright (C) 2015-2022 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -53,9 +53,11 @@ struct MeltedCoin struct TALER_Amount original_value; /** - * Transfer private keys for each cut-and-choose dimension. + * The original age commitment, its proof and its hash. MUST be NULL if no + * age commitment was set. */ - struct TALER_TransferPrivateKeyP transfer_priv[TALER_CNC_KAPPA]; + const struct TALER_AgeCommitmentProof *age_commitment_proof; + const struct TALER_AgeCommitmentHash *h_age_commitment; /** * Timestamp indicating when coins of this denomination become invalid. @@ -76,6 +78,43 @@ struct MeltedCoin /** + * Data we keep for each fresh coin created in the + * melt process. + */ +struct FreshCoinData +{ + /** + * Denomination public key of the coin. + */ + struct TALER_DenominationPublicKey fresh_pk; + + /** + * Array of planchet secrets for the coins, depending + * on the cut-and-choose. + */ + struct TALER_PlanchetMasterSecretP ps[TALER_CNC_KAPPA]; + + /** + * Private key of the coin. + */ + struct TALER_CoinSpendPrivateKeyP coin_priv; + + /** + * Arrays of age commitments and proofs to be created, one for each + * cut-and-choose dimension. NULL if age restriction is not applicable. + */ + struct TALER_AgeCommitmentProof *age_commitment_proofs[TALER_CNC_KAPPA]; + + /** + * Blinding key secrets for the coins, depending on the + * cut-and-choose. + */ + union GNUNET_CRYPTO_BlindingSecretP bks[TALER_CNC_KAPPA]; + +}; + + +/** * Melt data in non-serialized format for convenient processing. */ struct MeltData @@ -87,46 +126,71 @@ struct MeltData struct TALER_RefreshCommitmentP rc; /** - * Number of coins we are creating + * Information about the melted coin. */ - uint16_t num_fresh_coins; + struct MeltedCoin melted_coin; /** - * Information about the melted coin. + * Array of length @e num_fresh_coins with information + * about each fresh coin. */ - struct MeltedCoin melted_coin; + struct FreshCoinData *fcds; + + /** + * Transfer secrets, one per cut and choose. + */ + struct TALER_TransferSecretP trans_sec[TALER_CNC_KAPPA]; + + /** + * Transfer private keys for each cut-and-choose dimension. + */ + struct TALER_TransferPrivateKeyP transfer_priv[TALER_CNC_KAPPA]; + + /** + * Transfer public key of this commitment. + */ + struct TALER_TransferPublicKeyP transfer_pub[TALER_CNC_KAPPA]; /** - * Array of @e num_fresh_coins denomination keys for the coins to be - * freshly exchangeed. + * Transfer secrets, one per cut and choose. */ - struct TALER_DenominationPublicKey *fresh_pks; + struct TALER_RefreshCommitmentEntry rce[TALER_CNC_KAPPA]; /** - * Arrays of @e num_fresh_coins with information about the fresh - * coins to be created, for each cut-and-choose dimension. + * Blinded planchets and denominations of the fresh coins, depending on the cut-and-choose. Array of length + * @e num_fresh_coins. */ - struct TALER_PlanchetSecretsP *fresh_coins[TALER_CNC_KAPPA]; + struct TALER_RefreshCoinData *rcd[TALER_CNC_KAPPA]; + + /** + * Number of coins we are creating + */ + uint16_t num_fresh_coins; + }; /** - * Deserialize melt data. + * Compute the melt data from the refresh data and secret. * - * @param data json data to deserialize - * @param currency expected currency for the coins - * @return deserialized melt data, NULL on error + * @param rms secret internals of the refresh-reveal operation + * @param rd refresh data with the characteristics of the operation + * @param alg_values contributions from the exchange into the melt + * @param[out] md where to write the derived melt data */ -struct MeltData * -TALER_EXCHANGE_deserialize_melt_data_ (const json_t *data, - const char *currency); +enum GNUNET_GenericReturnValue +TALER_EXCHANGE_get_melt_data_ ( + const struct TALER_RefreshMasterSecretP *rms, + const struct TALER_EXCHANGE_RefreshData *rd, + const struct TALER_ExchangeWithdrawValues *alg_values, + struct MeltData *md); /** * Free all information associated with a melting session. Note * that we allow the melting session to be only partially initialized, * as we use this function also when freeing melt data that was not - * fully initialized (i.e. due to failures in #TALER_EXCHANGE_deserialize_melt_data_()). + * fully initialized. * * @param[in] md melting data to release, the pointer itself is NOT * freed (as it is typically not allocated by itself) |