diff options
Diffstat (limited to 'src/exchange/taler-exchange-httpd_link.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_link.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/src/exchange/taler-exchange-httpd_link.c b/src/exchange/taler-exchange-httpd_link.c index 75d32e562..3d92a11a3 100644 --- a/src/exchange/taler-exchange-httpd_link.c +++ b/src/exchange/taler-exchange-httpd_link.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014-2019 Taler Systems SA + Copyright (C) 2014-2019, 2022 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software @@ -39,7 +39,7 @@ struct HTD_Context /** * Public key of the coin for which we are running link. */ - struct TALER_CoinSpendPublicKeyP coin_pub; + const struct TALER_CoinSpendPublicKeyP *coin_pub; /** * Json array with transfer data we collect. @@ -82,12 +82,22 @@ handle_link_data (void *cls, json_t *obj; obj = GNUNET_JSON_PACK ( - GNUNET_JSON_pack_rsa_public_key ("denom_pub", - pos->denom_pub.rsa_public_key), - GNUNET_JSON_pack_rsa_signature ("ev_sig", - pos->ev_sig.rsa_signature), + TALER_JSON_pack_denom_pub ("denom_pub", + &pos->denom_pub), + TALER_JSON_pack_blinded_denom_sig ("ev_sig", + &pos->ev_sig), + GNUNET_JSON_pack_uint64 ("coin_idx", + pos->coin_refresh_offset), + TALER_JSON_pack_exchange_withdraw_values ("ewv", + &pos->alg_values), GNUNET_JSON_pack_data_auto ("link_sig", - &pos->orig_coin_link_sig)); + &pos->orig_coin_link_sig), + GNUNET_JSON_pack_allow_null ( + pos->have_nonce + ? GNUNET_JSON_pack_data_auto ("cs_nonce", + &pos->nonce) + : GNUNET_JSON_pack_string ("cs_nonce", + NULL))); if ( (NULL == obj) || (0 != json_array_append_new (list, @@ -143,7 +153,7 @@ link_transaction (void *cls, enum GNUNET_DB_QueryStatus qs; qs = TEH_plugin->get_link_data (TEH_plugin->cls, - &ctx->coin_pub, + ctx->coin_pub, &handle_link_data, ctx); if (NULL == ctx->mlist) @@ -168,31 +178,19 @@ link_transaction (void *cls, MHD_RESULT TEH_handler_link (struct TEH_RequestContext *rc, - const char *const args[2]) + const struct TALER_CoinSpendPublicKeyP *coin_pub) { - struct HTD_Context ctx; + struct HTD_Context ctx = { + .coin_pub = coin_pub + }; MHD_RESULT mhd_ret; - memset (&ctx, - 0, - sizeof (ctx)); - if (GNUNET_OK != - GNUNET_STRINGS_string_to_data (args[0], - strlen (args[0]), - &ctx.coin_pub, - sizeof (ctx.coin_pub))) - { - GNUNET_break_op (0); - return TALER_MHD_reply_with_error (rc->connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_EXCHANGE_GENERIC_COINS_INVALID_COIN_PUB, - args[0]); - } ctx.mlist = json_array (); GNUNET_assert (NULL != ctx.mlist); if (GNUNET_OK != TEH_DB_run_transaction (rc->connection, "run link", + TEH_MT_REQUEST_OTHER, &mhd_ret, &link_transaction, &ctx)) |