diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2022-02-17 12:23:06 +0100 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2022-02-18 00:30:19 +0100 |
commit | a78b3345fbf017b1cddfd09afb4b2c29287b0bba (patch) | |
tree | 45752022adc8b1661fb1662df40af4d58ab7d5f4 /src/testing | |
parent | 8bdf6ab19df70c16d335ecf82f2c3b2117eeb70e (diff) | |
download | exchange-a78b3345fbf017b1cddfd09afb4b2c29287b0bba.tar.xz |
[age restriction] progress 15/n - melt/refresh/reveal and recoup
Added age restriction support for
- melt/refresh/reveal
- recoup
However, tests are not yet implemented for those flows.
Also: minor fixes and refactoring.
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/test_exchange_api_twisted.c | 3 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_insert_deposit.c | 2 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_refresh.c | 36 |
3 files changed, 23 insertions, 18 deletions
diff --git a/src/testing/test_exchange_api_twisted.c b/src/testing/test_exchange_api_twisted.c index 33631764c..f8cfa64b7 100644 --- a/src/testing/test_exchange_api_twisted.c +++ b/src/testing/test_exchange_api_twisted.c @@ -124,6 +124,7 @@ run (void *cls, TALER_TESTING_cmd_withdraw_amount ("refresh-withdraw-coin", "refresh-create-reserve", "EUR:5", + 0, /* age restriction off */ MHD_HTTP_OK), TALER_TESTING_cmd_deposit ("refresh-deposit-partial", "refresh-withdraw-coin", @@ -164,6 +165,7 @@ run (void *cls, TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-r1", "create-reserve-r1", "EUR:5", + 0, /* age restriction off */ MHD_HTTP_OK), TALER_TESTING_cmd_deposit ("deposit-refund-1", "withdraw-coin-r1", @@ -233,6 +235,7 @@ run (void *cls, TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-r2", "create-reserve-r2", "EUR:5", + 0, /* age restriction off */ MHD_HTTP_OK), TALER_TESTING_cmd_end () }; diff --git a/src/testing/testing_api_cmd_insert_deposit.c b/src/testing/testing_api_cmd_insert_deposit.c index dcda7cf33..f02040677 100644 --- a/src/testing/testing_api_cmd_insert_deposit.c +++ b/src/testing/testing_api_cmd_insert_deposit.c @@ -212,7 +212,7 @@ insert_deposit_run (void *cls, GNUNET_assert (GNUNET_OK == TALER_denom_blind (&dpk, &bks, - NULL, /* FIXME-Oec */ + NULL, /* no age restriction active */ &deposit.coin.coin_pub, &alg_values, &c_hash, diff --git a/src/testing/testing_api_cmd_refresh.c b/src/testing/testing_api_cmd_refresh.c index 11c88c19c..8ae4ab93f 100644 --- a/src/testing/testing_api_cmd_refresh.c +++ b/src/testing/testing_api_cmd_refresh.c @@ -836,6 +836,7 @@ refresh_link_run (void *cls, /* finally, use private key from withdraw sign command */ rls->rlh = TALER_EXCHANGE_link (is->exchange, coin_priv, + rms->age_commitment, &link_cb, rls); @@ -1149,28 +1150,29 @@ melt_run (void *cls, rms->refresh_data.melt_pk = *melt_denom_pub; rms->refresh_data.fresh_pks = rms->fresh_pks; rms->refresh_data.fresh_pks_len = num_fresh_coins; -/* FIXME-oec: is this needed _here_? + rms->refresh_data.age_commitment = NULL; + + GNUNET_assert (age_restricted == + (NULL != rms->age_commitment)); + + if (NULL != rms->age_commitment) { - struct TALER_AgeCommitment *ac = NULL; + struct TALER_AgeCommitment *ac; + uint32_t seed; - GNUNET_assert (age_restricted == (NULL != rms->age_commitment)); + ac = GNUNET_new (struct TALER_AgeCommitment); + seed = GNUNET_CRYPTO_random_u32 ( + GNUNET_CRYPTO_QUALITY_WEAK, + UINT32_MAX); - if (NULL != rms->age_commitment) - { - uint32_t seed = GNUNET_CRYPTO_random_u32 ( - GNUNET_CRYPTO_QUALITY_WEAK, - UINT32_MAX); - - GNUNET_assert (GNUNET_OK == - TALER_age_commitment_derive ( - rms->age_commitment, - seed, - ac)); - } + GNUNET_assert (GNUNET_OK == + TALER_age_commitment_derive ( + rms->age_commitment, + seed, + ac)); - rms->refresh_data.age_commitment = ac + rms->refresh_data.age_commitment = ac; } -*/ rms->rmh = TALER_EXCHANGE_melt (is->exchange, &rms->rms, |