From 94e9ba87101e09138d9cf083d630bf37935b3ea3 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 3 Apr 2017 13:55:02 +0200 Subject: [PATCH] handle TALER_EXCHANGEDB_TT_PAYBACK in response generation of exchange --- src/exchange/taler-exchange-httpd_responses.c | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index 96587c4d1..01dcb6ca0 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014, 2015, 2016 Inria & GNUnet e.V. + Copyright (C) 2014, 2015, 2016, 2017 Inria & GNUnet e.V. 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 @@ -551,6 +551,35 @@ compile_transaction_history (const struct TALER_EXCHANGEDB_TransactionList *tl) details = GNUNET_JSON_from_data_auto (&rr); } break; + case TALER_EXCHANGEDB_TT_PAYBACK: + { + const struct TALER_EXCHANGEDB_Payback *payback = pos->details.payback; + struct TALER_PaybackRequestPS pr; + + type = "PAYBACK"; + value = payback->value; + pr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_PAYBACK); + pr.purpose.size = htonl (sizeof (pr)); + pr.coin_pub = payback->coin_pub; + GNUNET_CRYPTO_rsa_public_key_hash (payback->denom_pub.rsa_public_key, + &pr.h_denom_pub); + pr.coin_blind = payback->coin_blind; + + /* internal sanity check before we hand out a bogus sig... */ + sig = &payback->coin_sig.eddsa_signature; + if (GNUNET_OK != + GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_PAYBACK, + &pr.purpose, + sig, + &payback->coin_pub.eddsa_pub)) + { + GNUNET_break (0); + json_decref (history); + return NULL; + } + details = GNUNET_JSON_from_data_auto (&pr); + } + break; default: GNUNET_assert (0); }