aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-04-03 13:55:02 +0200
committerChristian Grothoff <christian@grothoff.org>2017-04-03 13:55:02 +0200
commit94e9ba87101e09138d9cf083d630bf37935b3ea3 (patch)
tree6746d72d47c395f27a1185d49c11ad15ecaf9fbe /src
parentb988eb92fc9ea7fca8db7895e52af67a1a9231d7 (diff)
handle TALER_EXCHANGEDB_TT_PAYBACK in response generation of exchange
Diffstat (limited to 'src')
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c31
1 files changed, 30 insertions, 1 deletions
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);
}