aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-03-09 13:04:51 +0100
committerChristian Grothoff <christian@grothoff.org>2015-03-09 13:04:51 +0100
commite4e8fe6c7c57305e3d2118b81c186ded6c6b1f3c (patch)
treea9c44757d10a4194d2ce1d62277002184147af96
parentf2700dc6eed292f18f2bb0c0222e3ee946e820e7 (diff)
add withdraw proof to reserve history json
-rw-r--r--src/mint/mint_db.h8
-rw-r--r--src/mint/taler-mint-httpd_db.c5
-rw-r--r--src/mint/taler-mint-httpd_responses.c15
3 files changed, 25 insertions, 3 deletions
diff --git a/src/mint/mint_db.h b/src/mint/mint_db.h
index c3a300a57..48fb5ea39 100644
--- a/src/mint/mint_db.h
+++ b/src/mint/mint_db.h
@@ -183,8 +183,14 @@ struct CollectableBlindcoin
struct GNUNET_CRYPTO_EddsaPublicKey reserve_pub;
/**
+ * Hash over the blinded message, needed to verify
+ * the @e reserve_sig.
+ */
+ struct GNUNET_HashCode h_coin_envelope;
+
+ /**
* Signature confirming the withdrawl, matching @e reserve_pub,
- * @e denom_pub and @e h_blind.
+ * @e denom_pub and @e h_coin_envelope.
*/
struct GNUNET_CRYPTO_EddsaSignature reserve_sig;
};
diff --git a/src/mint/taler-mint-httpd_db.c b/src/mint/taler-mint-httpd_db.c
index ed9119313..b20e88494 100644
--- a/src/mint/taler-mint-httpd_db.c
+++ b/src/mint/taler-mint-httpd_db.c
@@ -378,9 +378,12 @@ TALER_MINT_db_execute_withdraw_sign (struct MHD_Connection *connection,
return TALER_MINT_reply_internal_error (connection,
"Internal error");
}
- collectable.denom_pub = (struct GNUNET_CRYPTO_rsa_PublicKey *) denomination_pub;
collectable.sig = sig;
+ collectable.denom_pub = (struct GNUNET_CRYPTO_rsa_PublicKey *) denomination_pub;
collectable.reserve_pub = *reserve;
+ GNUNET_CRYPTO_hash (blinded_msg,
+ blinded_msg_len,
+ &collectable.h_coin_envelope);
collectable.reserve_sig = *signature;
if (GNUNET_OK !=
TALER_MINT_DB_insert_collectable_blindcoin (db_conn,
diff --git a/src/mint/taler-mint-httpd_responses.c b/src/mint/taler-mint-httpd_responses.c
index ec8fdc03b..9af372995 100644
--- a/src/mint/taler-mint-httpd_responses.c
+++ b/src/mint/taler-mint-httpd_responses.c
@@ -418,10 +418,12 @@ compile_reserve_history (const struct ReserveHistory *rh,
struct TALER_Amount withdraw_total;
struct TALER_Amount value;
json_t *json_history;
+ json_t *transaction;
int ret;
const struct ReserveHistory *pos;
struct TALER_MINT_DenomKeyIssuePriv *dki;
struct MintKeyState *key_state;
+ struct TALER_WithdrawRequest wr;
json_history = json_array ();
ret = 0;
@@ -456,6 +458,7 @@ compile_reserve_history (const struct ReserveHistory *rh,
case TALER_MINT_DB_RO_BANK_TO_MINT:
break;
case TALER_MINT_DB_RO_WITHDRAW_COIN:
+
dki = TALER_MINT_get_denom_key (key_state,
pos->details.withdraw->denom_pub);
value = TALER_amount_ntoh (dki->issue.value);
@@ -465,10 +468,20 @@ compile_reserve_history (const struct ReserveHistory *rh,
withdraw_total = TALER_amount_add (withdraw_total,
value);
ret = 1;
- /* FIXME: add `struct CollectableBlindcoin` as JSON here as well! (#3527) */
+ wr.purpose.purpose = htonl (TALER_SIGNATURE_WITHDRAW);
+ wr.purpose.size = htonl (sizeof (struct TALER_WithdrawRequest));
+ wr.reserve_pub = pos->details.withdraw->reserve_pub;
+ GNUNET_CRYPTO_rsa_public_key_hash (pos->details.withdraw->denom_pub,
+ &wr.h_denomination_pub);
+ wr.h_coin_envelope = pos->details.withdraw->h_coin_envelope;
+
+ transaction = TALER_JSON_from_eddsa_sig (&wr.purpose,
+ &pos->details.withdraw->reserve_sig);
+
json_array_append_new (json_history,
json_pack ("{s:s, s:o, s:o}",
"type", "WITHDRAW",
+ "signature", transaction,
"amount", TALER_JSON_from_amount (value)));
break;