From a227ee6d1bd979ae87ab9afda27f180c840313bf Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 28 Mar 2022 13:57:43 +0200 Subject: -first cut at contract encryption and decryption --- src/lib/exchange_api_purse_create_with_deposit.c | 25 +++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/lib/exchange_api_purse_create_with_deposit.c') diff --git a/src/lib/exchange_api_purse_create_with_deposit.c b/src/lib/exchange_api_purse_create_with_deposit.c index 6765b7771..e39cb076f 100644 --- a/src/lib/exchange_api_purse_create_with_deposit.c +++ b/src/lib/exchange_api_purse_create_with_deposit.c @@ -202,6 +202,7 @@ TALER_EXCHANGE_purse_create_with_deposit ( struct GNUNET_TIME_Timestamp purse_expiration, unsigned int num_deposits, const struct TALER_EXCHANGE_PurseDeposit *deposits, + bool upload_contract, TALER_EXCHANGE_PurseCreateDepositCallback cb, void *cb_cls) { @@ -335,23 +336,25 @@ TALER_EXCHANGE_purse_create_with_deposit ( } GNUNET_free (url); { - void *econtract; - size_t econtract_size; + void *econtract = NULL; + size_t econtract_size = 0; - TALER_CRYPTO_contract_encrypt_for_merge (&purse_pub, - contract_priv, - merge_priv, - contract_terms, - &econtract, - &econtract_size); + if (upload_contract) + TALER_CRYPTO_contract_encrypt_for_merge (&purse_pub, + contract_priv, + merge_priv, + contract_terms, + &econtract, + &econtract_size); create_obj = GNUNET_JSON_PACK ( TALER_JSON_pack_amount ("amount", &purse_value_after_fees), GNUNET_JSON_pack_uint64 ("min_age", min_age), - GNUNET_JSON_pack_data_varsize ("econtract", - econtract, - econtract_size), + GNUNET_JSON_pack_allow_null ( + GNUNET_JSON_pack_data_varsize ("econtract", + econtract, + econtract_size)), GNUNET_JSON_pack_data_auto ("contract_pub", &contract_pub), GNUNET_JSON_pack_data_auto ("merge_pub", -- cgit v1.2.3