diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2023-07-13 08:45:05 +0200 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2023-07-13 08:45:05 +0200 |
commit | fde760aef037d14c84c49f500c0db91d7e95ae98 (patch) | |
tree | cd964147f986e4d39d38f5bfe3b223059f3ffc03 /src/lib/exchange_api_age_withdraw.c | |
parent | e0f78bc3c9536fb649cc7a69f3ee404b49087d64 (diff) | |
download | exchange-fde760aef037d14c84c49f500c0db91d7e95ae98.tar.xz |
towards age-withdraw and -reveal API
Diffstat (limited to 'src/lib/exchange_api_age_withdraw.c')
-rw-r--r-- | src/lib/exchange_api_age_withdraw.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/lib/exchange_api_age_withdraw.c b/src/lib/exchange_api_age_withdraw.c index 7bad025b2..f1d26c3cc 100644 --- a/src/lib/exchange_api_age_withdraw.c +++ b/src/lib/exchange_api_age_withdraw.c @@ -235,7 +235,8 @@ reserve_age_withdraw_ok ( { struct TALER_EXCHANGE_AgeWithdrawResponse response = { .hr.reply = j_response, - .hr.http_status = MHD_HTTP_OK + .hr.http_status = MHD_HTTP_OK, + .details.ok.h_commitment = awh->h_commitment }; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_uint8 ("noreaveal_index", @@ -568,12 +569,13 @@ perform_protocol ( /* Build the candidate array */ { - const struct CoinCandidate *can = awh->coin_data[i].coin_candidates; json_t *j_can = json_array (); FAIL_IF (NULL == j_can); for (size_t k = 0; k < TALER_CNC_KAPPA; k++) { + const struct CoinCandidate *can = + &awh->coin_data[i].coin_candidates[k]; json_t *jc = GNUNET_JSON_PACK ( TALER_JSON_pack_blinded_planchet ( NULL, @@ -591,20 +593,17 @@ perform_protocol ( } } - /* Sign the request */ - { - struct TALER_AgeWithdrawCommitmentHashP coins_commitment_h; - - GNUNET_CRYPTO_hash_context_finish (coins_hctx, - &coins_commitment_h.hash); + /* Build the hash of the commitment */ + GNUNET_CRYPTO_hash_context_finish (coins_hctx, + &awh->h_commitment.hash); - TALER_wallet_age_withdraw_sign (&coins_commitment_h, - &awh->amount_with_fee, - &awh->age_mask, - awh->max_age, - awh->reserve_priv, - &awh->reserve_sig); - } + /* Sign the request */ + TALER_wallet_age_withdraw_sign (&awh->h_commitment, + &awh->amount_with_fee, + &awh->age_mask, + awh->max_age, + awh->reserve_priv, + &awh->reserve_sig); /* Initiate the POST-request */ j_request_body = GNUNET_JSON_PACK ( @@ -833,7 +832,7 @@ prepare_coins ( { struct CoinCandidate *can = &cd->coin_candidates[k]; - can->secret = input->secret[k]; + can->secret = input->secrets[k]; /* Derive the age restriction from the given secret and * the maximum age */ |