add exchange_pub to callbacks

This commit is contained in:
Christian Grothoff 2016-06-07 15:14:44 +02:00
parent e5894fac26
commit 166352e87e
9 changed files with 85 additions and 23 deletions

View File

@ -1,2 +1,7 @@
Tue Jun 7 15:13:46 CEST 2016
Adding public key of the exchange that was used to sign replies
to applicable callbacks of libtalerexchange. (This will eventually
be needed by the merchant's backend.) -CG
Wed Jun 1 17:27:36 CEST 2016 Wed Jun 1 17:27:36 CEST 2016
Releasing taler-exchange 0.0.0. -CG Releasing taler-exchange 0.0.0. -CG

View File

@ -222,12 +222,14 @@ fail (const char *msg)
* @param cls closure with the interpreter state * @param cls closure with the interpreter state
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful deposit; * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful deposit;
* 0 if the exchange's reply is bogus (fails to follow the protocol) * 0 if the exchange's reply is bogus (fails to follow the protocol)
* @param exchange_pub public key used by the exchange for signing
* @param obj the received JSON reply, should be kept as proof (and, in case of errors, * @param obj the received JSON reply, should be kept as proof (and, in case of errors,
* be forwarded to the customer) * be forwarded to the customer)
*/ */
static void static void
deposit_cb (void *cls, deposit_cb (void *cls,
unsigned int http_status, unsigned int http_status,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const json_t *obj) const json_t *obj)
{ {
unsigned int coin_index = (unsigned int) (long) cls; unsigned int coin_index = (unsigned int) (long) cls;

View File

@ -94,18 +94,20 @@ struct TALER_EXCHANGE_DepositHandle
* *
* @param dh deposit handle * @param dh deposit handle
* @param json json reply with the signature * @param json json reply with the signature
* @param exchange_pub set to the exchange's public key
* @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not * @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not
*/ */
static int static int
verify_deposit_signature_ok (const struct TALER_EXCHANGE_DepositHandle *dh, verify_deposit_signature_ok (const struct TALER_EXCHANGE_DepositHandle *dh,
const json_t *json) const json_t *json,
struct TALER_ExchangePublicKeyP *exchange_pub)
{ {
struct TALER_ExchangeSignatureP exchange_sig; struct TALER_ExchangeSignatureP exchange_sig;
struct TALER_ExchangePublicKeyP exchange_pub;
const struct TALER_EXCHANGE_Keys *key_state; const struct TALER_EXCHANGE_Keys *key_state;
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("sig", &exchange_sig), GNUNET_JSON_spec_fixed_auto ("sig", &exchange_sig),
GNUNET_JSON_spec_fixed_auto ("pub", &exchange_pub), GNUNET_JSON_spec_fixed_auto ("pub", exchange_pub),
GNUNET_JSON_spec_end() GNUNET_JSON_spec_end()
}; };
@ -120,7 +122,7 @@ verify_deposit_signature_ok (const struct TALER_EXCHANGE_DepositHandle *dh,
key_state = TALER_EXCHANGE_get_keys (dh->exchange); key_state = TALER_EXCHANGE_get_keys (dh->exchange);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_EXCHANGE_test_signing_key (key_state, TALER_EXCHANGE_test_signing_key (key_state,
&exchange_pub)) exchange_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
@ -129,7 +131,7 @@ verify_deposit_signature_ok (const struct TALER_EXCHANGE_DepositHandle *dh,
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT,
&dh->depconf.purpose, &dh->depconf.purpose,
&exchange_sig.eddsa_signature, &exchange_sig.eddsa_signature,
&exchange_pub.eddsa_pub)) &exchange_pub->eddsa_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
@ -200,6 +202,8 @@ handle_deposit_finished (void *cls,
const json_t *json) const json_t *json)
{ {
struct TALER_EXCHANGE_DepositHandle *dh = cls; struct TALER_EXCHANGE_DepositHandle *dh = cls;
struct TALER_ExchangePublicKeyP exchange_pub;
struct TALER_ExchangePublicKeyP *ep = NULL;
dh->job = NULL; dh->job = NULL;
switch (response_code) switch (response_code)
@ -209,11 +213,16 @@ handle_deposit_finished (void *cls,
case MHD_HTTP_OK: case MHD_HTTP_OK:
if (GNUNET_OK != if (GNUNET_OK !=
verify_deposit_signature_ok (dh, verify_deposit_signature_ok (dh,
json)) json,
&exchange_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
response_code = 0; response_code = 0;
} }
else
{
ep = &exchange_pub;
}
break; break;
case MHD_HTTP_BAD_REQUEST: case MHD_HTTP_BAD_REQUEST:
/* This should never happen, either us or the exchange is buggy /* This should never happen, either us or the exchange is buggy
@ -253,6 +262,7 @@ handle_deposit_finished (void *cls,
} }
dh->cb (dh->cb_cls, dh->cb (dh->cb_cls,
response_code, response_code,
ep,
json); json);
TALER_EXCHANGE_deposit_cancel (dh); TALER_EXCHANGE_deposit_cancel (dh);
} }

View File

@ -84,18 +84,19 @@ struct TALER_EXCHANGE_DepositWtidHandle
* *
* @param dwh deposit wtid handle * @param dwh deposit wtid handle
* @param json json reply with the signature * @param json json reply with the signature
* @param[out] exchange_pub set to the exchange's public key
* @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not * @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not
*/ */
static int static int
verify_deposit_wtid_signature_ok (const struct TALER_EXCHANGE_DepositWtidHandle *dwh, verify_deposit_wtid_signature_ok (const struct TALER_EXCHANGE_DepositWtidHandle *dwh,
const json_t *json) const json_t *json,
struct TALER_ExchangePublicKeyP *exchange_pub)
{ {
struct TALER_ExchangeSignatureP exchange_sig; struct TALER_ExchangeSignatureP exchange_sig;
struct TALER_ExchangePublicKeyP exchange_pub;
const struct TALER_EXCHANGE_Keys *key_state; const struct TALER_EXCHANGE_Keys *key_state;
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("exchange_sig", &exchange_sig), GNUNET_JSON_spec_fixed_auto ("exchange_sig", &exchange_sig),
GNUNET_JSON_spec_fixed_auto ("exchange_pub", &exchange_pub), GNUNET_JSON_spec_fixed_auto ("exchange_pub", exchange_pub),
GNUNET_JSON_spec_end() GNUNET_JSON_spec_end()
}; };
@ -110,7 +111,7 @@ verify_deposit_wtid_signature_ok (const struct TALER_EXCHANGE_DepositWtidHandle
key_state = TALER_EXCHANGE_get_keys (dwh->exchange); key_state = TALER_EXCHANGE_get_keys (dwh->exchange);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_EXCHANGE_test_signing_key (key_state, TALER_EXCHANGE_test_signing_key (key_state,
&exchange_pub)) exchange_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
@ -119,7 +120,7 @@ verify_deposit_wtid_signature_ok (const struct TALER_EXCHANGE_DepositWtidHandle
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE,
&dwh->depconf.purpose, &dwh->depconf.purpose,
&exchange_sig.eddsa_signature, &exchange_sig.eddsa_signature,
&exchange_pub.eddsa_pub)) &exchange_pub->eddsa_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
@ -146,6 +147,8 @@ handle_deposit_wtid_finished (void *cls,
struct GNUNET_TIME_Absolute execution_time = GNUNET_TIME_UNIT_FOREVER_ABS; struct GNUNET_TIME_Absolute execution_time = GNUNET_TIME_UNIT_FOREVER_ABS;
const struct TALER_Amount *coin_contribution = NULL; const struct TALER_Amount *coin_contribution = NULL;
struct TALER_Amount coin_contribution_s; struct TALER_Amount coin_contribution_s;
struct TALER_ExchangePublicKeyP exchange_pub;
struct TALER_ExchangePublicKeyP *ep = NULL;
dwh->job = NULL; dwh->job = NULL;
switch (response_code) switch (response_code)
@ -177,11 +180,16 @@ handle_deposit_wtid_finished (void *cls,
coin_contribution = &coin_contribution_s; coin_contribution = &coin_contribution_s;
if (GNUNET_OK != if (GNUNET_OK !=
verify_deposit_wtid_signature_ok (dwh, verify_deposit_wtid_signature_ok (dwh,
json)) json,
&exchange_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
response_code = 0; response_code = 0;
} }
else
{
ep = &exchange_pub;
}
} }
break; break;
case MHD_HTTP_ACCEPTED: case MHD_HTTP_ACCEPTED:
@ -231,6 +239,7 @@ handle_deposit_wtid_finished (void *cls,
} }
dwh->cb (dwh->cb_cls, dwh->cb (dwh->cb_cls,
response_code, response_code,
ep,
json, json,
wtid, wtid,
execution_time, execution_time,

View File

@ -951,20 +951,21 @@ struct TALER_EXCHANGE_RefreshMeltHandle
* *
* @param rmh melt handle * @param rmh melt handle
* @param json json reply with the signature * @param json json reply with the signature
* @param[out] exchange_pub public key of the exchange used for the signature
* @param[out] noreveal_index set to the noreveal index selected by the exchange * @param[out] noreveal_index set to the noreveal index selected by the exchange
* @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not * @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not
*/ */
static int static int
verify_refresh_melt_signature_ok (struct TALER_EXCHANGE_RefreshMeltHandle *rmh, verify_refresh_melt_signature_ok (struct TALER_EXCHANGE_RefreshMeltHandle *rmh,
const json_t *json, const json_t *json,
struct TALER_ExchangePublicKeyP *exchange_pub,
uint16_t *noreveal_index) uint16_t *noreveal_index)
{ {
struct TALER_ExchangeSignatureP exchange_sig; struct TALER_ExchangeSignatureP exchange_sig;
struct TALER_ExchangePublicKeyP exchange_pub;
const struct TALER_EXCHANGE_Keys *key_state; const struct TALER_EXCHANGE_Keys *key_state;
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("exchange_sig", &exchange_sig), GNUNET_JSON_spec_fixed_auto ("exchange_sig", &exchange_sig),
GNUNET_JSON_spec_fixed_auto ("exchange_pub", &exchange_pub), GNUNET_JSON_spec_fixed_auto ("exchange_pub", exchange_pub),
GNUNET_JSON_spec_uint16 ("noreveal_index", noreveal_index), GNUNET_JSON_spec_uint16 ("noreveal_index", noreveal_index),
GNUNET_JSON_spec_end() GNUNET_JSON_spec_end()
}; };
@ -983,7 +984,7 @@ verify_refresh_melt_signature_ok (struct TALER_EXCHANGE_RefreshMeltHandle *rmh,
key_state = TALER_EXCHANGE_get_keys (rmh->exchange); key_state = TALER_EXCHANGE_get_keys (rmh->exchange);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_EXCHANGE_test_signing_key (key_state, TALER_EXCHANGE_test_signing_key (key_state,
&exchange_pub)) exchange_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
@ -1006,7 +1007,7 @@ verify_refresh_melt_signature_ok (struct TALER_EXCHANGE_RefreshMeltHandle *rmh,
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT,
&confirm.purpose, &confirm.purpose,
&exchange_sig.eddsa_signature, &exchange_sig.eddsa_signature,
&exchange_pub.eddsa_pub)) &exchange_pub->eddsa_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
@ -1126,6 +1127,7 @@ handle_refresh_melt_finished (void *cls,
{ {
struct TALER_EXCHANGE_RefreshMeltHandle *rmh = cls; struct TALER_EXCHANGE_RefreshMeltHandle *rmh = cls;
uint16_t noreveal_index = TALER_CNC_KAPPA; /* invalid value */ uint16_t noreveal_index = TALER_CNC_KAPPA; /* invalid value */
struct TALER_ExchangePublicKeyP exchange_pub;
rmh->job = NULL; rmh->job = NULL;
switch (response_code) switch (response_code)
@ -1136,6 +1138,7 @@ handle_refresh_melt_finished (void *cls,
if (GNUNET_OK != if (GNUNET_OK !=
verify_refresh_melt_signature_ok (rmh, verify_refresh_melt_signature_ok (rmh,
json, json,
&exchange_pub,
&noreveal_index)) &noreveal_index))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
@ -1146,6 +1149,7 @@ handle_refresh_melt_finished (void *cls,
rmh->melt_cb (rmh->melt_cb_cls, rmh->melt_cb (rmh->melt_cb_cls,
response_code, response_code,
noreveal_index, noreveal_index,
(0 == response_code) ? NULL : &exchange_pub,
json); json);
rmh->melt_cb = NULL; rmh->melt_cb = NULL;
} }
@ -1190,6 +1194,7 @@ handle_refresh_melt_finished (void *cls,
rmh->melt_cb (rmh->melt_cb_cls, rmh->melt_cb (rmh->melt_cb_cls,
response_code, response_code,
UINT16_MAX, UINT16_MAX,
NULL,
json); json);
TALER_EXCHANGE_refresh_melt_cancel (rmh); TALER_EXCHANGE_refresh_melt_cancel (rmh);
} }
@ -1731,7 +1736,7 @@ TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange,
struct GNUNET_CURL_Context *ctx; struct GNUNET_CURL_Context *ctx;
struct MeltData *md; struct MeltData *md;
unsigned int j; unsigned int j;
GNUNET_assert (GNUNET_YES == GNUNET_assert (GNUNET_YES ==
MAH_handle_is_ready (exchange)); MAH_handle_is_ready (exchange));
md = deserialize_melt_data (refresh_data, md = deserialize_melt_data (refresh_data,

View File

@ -83,18 +83,19 @@ struct TALER_EXCHANGE_RefundHandle
* *
* @param rh refund handle * @param rh refund handle
* @param json json reply with the signature * @param json json reply with the signature
* @param[out] exchange_pub set to the exchange's public key
* @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not * @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not
*/ */
static int static int
verify_refund_signature_ok (const struct TALER_EXCHANGE_RefundHandle *rh, verify_refund_signature_ok (const struct TALER_EXCHANGE_RefundHandle *rh,
const json_t *json) const json_t *json,
struct TALER_ExchangePublicKeyP *exchange_pub)
{ {
struct TALER_ExchangeSignatureP exchange_sig; struct TALER_ExchangeSignatureP exchange_sig;
struct TALER_ExchangePublicKeyP exchange_pub;
const struct TALER_EXCHANGE_Keys *key_state; const struct TALER_EXCHANGE_Keys *key_state;
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("sig", &exchange_sig), GNUNET_JSON_spec_fixed_auto ("sig", &exchange_sig),
GNUNET_JSON_spec_fixed_auto ("pub", &exchange_pub), GNUNET_JSON_spec_fixed_auto ("pub", exchange_pub),
GNUNET_JSON_spec_end() GNUNET_JSON_spec_end()
}; };
@ -109,7 +110,7 @@ verify_refund_signature_ok (const struct TALER_EXCHANGE_RefundHandle *rh,
key_state = TALER_EXCHANGE_get_keys (rh->exchange); key_state = TALER_EXCHANGE_get_keys (rh->exchange);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_EXCHANGE_test_signing_key (key_state, TALER_EXCHANGE_test_signing_key (key_state,
&exchange_pub)) exchange_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
@ -118,7 +119,7 @@ verify_refund_signature_ok (const struct TALER_EXCHANGE_RefundHandle *rh,
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND,
&rh->depconf.purpose, &rh->depconf.purpose,
&exchange_sig.eddsa_signature, &exchange_sig.eddsa_signature,
&exchange_pub.eddsa_pub)) &exchange_pub->eddsa_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
@ -141,6 +142,8 @@ handle_refund_finished (void *cls,
const json_t *json) const json_t *json)
{ {
struct TALER_EXCHANGE_RefundHandle *rh = cls; struct TALER_EXCHANGE_RefundHandle *rh = cls;
struct TALER_ExchangePublicKeyP exchange_pub;
struct TALER_ExchangePublicKeyP *ep = NULL;
rh->job = NULL; rh->job = NULL;
switch (response_code) switch (response_code)
@ -150,11 +153,16 @@ handle_refund_finished (void *cls,
case MHD_HTTP_OK: case MHD_HTTP_OK:
if (GNUNET_OK != if (GNUNET_OK !=
verify_refund_signature_ok (rh, verify_refund_signature_ok (rh,
json)) json,
&exchange_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
response_code = 0; response_code = 0;
} }
else
{
ep = &exchange_pub;
}
break; break;
case MHD_HTTP_BAD_REQUEST: case MHD_HTTP_BAD_REQUEST:
/* This should never happen, either us or the exchange is buggy /* This should never happen, either us or the exchange is buggy
@ -188,6 +196,7 @@ handle_refund_finished (void *cls,
} }
rh->cb (rh->cb_cls, rh->cb (rh->cb_cls,
response_code, response_code,
ep,
json); json);
TALER_EXCHANGE_refund_cancel (rh); TALER_EXCHANGE_refund_cancel (rh);
} }

View File

@ -186,6 +186,7 @@ handle_wire_deposits_finished (void *cls,
break; break;
wdh->cb (wdh->cb_cls, wdh->cb (wdh->cb_cls,
response_code, response_code,
&exchange_pub,
json, json,
&h_wire, &h_wire,
&total_amount, &total_amount,
@ -224,6 +225,7 @@ handle_wire_deposits_finished (void *cls,
} }
wdh->cb (wdh->cb_cls, wdh->cb (wdh->cb_cls,
response_code, response_code,
NULL,
json, json,
NULL, NULL, 0, NULL); NULL, NULL, 0, NULL);
TALER_EXCHANGE_wire_deposits_cancel (wdh); TALER_EXCHANGE_wire_deposits_cancel (wdh);

View File

@ -1028,12 +1028,14 @@ reserve_withdraw_cb (void *cls,
* @param cls closure with the interpreter state * @param cls closure with the interpreter state
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful deposit; * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful deposit;
* 0 if the exchange's reply is bogus (fails to follow the protocol) * 0 if the exchange's reply is bogus (fails to follow the protocol)
* @param exchange_pub public key the exchange used for signing
* @param obj the received JSON reply, should be kept as proof (and, in case of errors, * @param obj the received JSON reply, should be kept as proof (and, in case of errors,
* be forwarded to the customer) * be forwarded to the customer)
*/ */
static void static void
deposit_cb (void *cls, deposit_cb (void *cls,
unsigned int http_status, unsigned int http_status,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const json_t *obj) const json_t *obj)
{ {
struct InterpreterState *is = cls; struct InterpreterState *is = cls;
@ -1062,12 +1064,14 @@ deposit_cb (void *cls,
* 0 if the exchange's reply is bogus (fails to follow the protocol) * 0 if the exchange's reply is bogus (fails to follow the protocol)
* @param noreveal_index choice by the exchange in the cut-and-choose protocol, * @param noreveal_index choice by the exchange in the cut-and-choose protocol,
* UINT16_MAX on error * UINT16_MAX on error
* @param exchange_pub public key the exchange used for signing
* @param full_response full response from the exchange (for logging, in case of errors) * @param full_response full response from the exchange (for logging, in case of errors)
*/ */
static void static void
melt_cb (void *cls, melt_cb (void *cls,
unsigned int http_status, unsigned int http_status,
uint16_t noreveal_index, uint16_t noreveal_index,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const json_t *full_response) const json_t *full_response)
{ {
struct InterpreterState *is = cls; struct InterpreterState *is = cls;
@ -1388,6 +1392,7 @@ wire_cb (void *cls,
* *
* @param cls closure * @param cls closure
* @param http_status HTTP status code we got, 0 on exchange protocol violation * @param http_status HTTP status code we got, 0 on exchange protocol violation
* @param exchange_pub public key the exchange used for signing
* @param json original json reply (may include signatures, those have then been * @param json original json reply (may include signatures, those have then been
* validated already) * validated already)
* @param wtid extracted wire transfer identifier, or NULL if the exchange could * @param wtid extracted wire transfer identifier, or NULL if the exchange could
@ -1400,6 +1405,7 @@ wire_cb (void *cls,
static void static void
wire_deposits_cb (void *cls, wire_deposits_cb (void *cls,
unsigned int http_status, unsigned int http_status,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const json_t *json, const json_t *json,
const struct GNUNET_HashCode *h_wire, const struct GNUNET_HashCode *h_wire,
const struct TALER_Amount *total_amount, const struct TALER_Amount *total_amount,
@ -1515,6 +1521,7 @@ wire_deposits_cb (void *cls,
* *
* @param cls closure * @param cls closure
* @param http_status HTTP status code we got, 0 on exchange protocol violation * @param http_status HTTP status code we got, 0 on exchange protocol violation
* @param exchange_pub public key the exchange used for signing
* @param json original json reply (may include signatures, those have then been * @param json original json reply (may include signatures, those have then been
* validated already) * validated already)
* @param wtid wire transfer identifier used by the exchange, NULL if exchange did not * @param wtid wire transfer identifier used by the exchange, NULL if exchange did not
@ -1527,6 +1534,7 @@ wire_deposits_cb (void *cls,
static void static void
deposit_wtid_cb (void *cls, deposit_wtid_cb (void *cls,
unsigned int http_status, unsigned int http_status,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const json_t *json, const json_t *json,
const struct TALER_WireTransferIdentifierRawP *wtid, const struct TALER_WireTransferIdentifierRawP *wtid,
struct GNUNET_TIME_Absolute execution_time, struct GNUNET_TIME_Absolute execution_time,
@ -1580,12 +1588,14 @@ deposit_wtid_cb (void *cls,
* @param cls closure * @param cls closure
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful deposit; * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful deposit;
* 0 if the exchange's reply is bogus (fails to follow the protocol) * 0 if the exchange's reply is bogus (fails to follow the protocol)
* @param exchange_pub public key the exchange used for signing @a obj
* @param obj the received JSON reply, should be kept as proof (and, in particular, * @param obj the received JSON reply, should be kept as proof (and, in particular,
* be forwarded to the customer) * be forwarded to the customer)
*/ */
static void static void
refund_cb (void *cls, refund_cb (void *cls,
unsigned int http_status, unsigned int http_status,
const struct TALER_ExchangePublicKeyP *exchange_pub,
const json_t *obj) const json_t *obj)
{ {
struct InterpreterState *is = cls; struct InterpreterState *is = cls;

View File

@ -416,12 +416,14 @@ struct TALER_EXCHANGE_DepositHandle;
* @param cls closure * @param cls closure
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful deposit; * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful deposit;
* 0 if the exchange's reply is bogus (fails to follow the protocol) * 0 if the exchange's reply is bogus (fails to follow the protocol)
* @param sign_key exchange key used to sign @a obj, or NULL
* @param obj the received JSON reply, should be kept as proof (and, in case of errors, * @param obj the received JSON reply, should be kept as proof (and, in case of errors,
* be forwarded to the customer) * be forwarded to the customer)
*/ */
typedef void typedef void
(*TALER_EXCHANGE_DepositResultCallback) (void *cls, (*TALER_EXCHANGE_DepositResultCallback) (void *cls,
unsigned int http_status, unsigned int http_status,
const struct TALER_ExchangePublicKeyP *sign_key,
const json_t *obj); const json_t *obj);
@ -502,12 +504,14 @@ struct TALER_EXCHANGE_RefundHandle;
* @param cls closure * @param cls closure
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful deposit; * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful deposit;
* 0 if the exchange's reply is bogus (fails to follow the protocol) * 0 if the exchange's reply is bogus (fails to follow the protocol)
* @param sign_key exchange key used to sign @a obj, or NULL
* @param obj the received JSON reply, should be kept as proof (and, in particular, * @param obj the received JSON reply, should be kept as proof (and, in particular,
* be forwarded to the customer) * be forwarded to the customer)
*/ */
typedef void typedef void
(*TALER_EXCHANGE_RefundResultCallback) (void *cls, (*TALER_EXCHANGE_RefundResultCallback) (void *cls,
unsigned int http_status, unsigned int http_status,
const struct TALER_ExchangePublicKeyP *sign_key,
const json_t *obj); const json_t *obj);
@ -833,12 +837,14 @@ struct TALER_EXCHANGE_RefreshMeltHandle;
* 0 if the exchange's reply is bogus (fails to follow the protocol) * 0 if the exchange's reply is bogus (fails to follow the protocol)
* @param noreveal_index choice by the exchange in the cut-and-choose protocol, * @param noreveal_index choice by the exchange in the cut-and-choose protocol,
* UINT16_MAX on error * UINT16_MAX on error
* @param sign_key exchange key used to sign @a full_response, or NULL
* @param full_response full response from the exchange (for logging, in case of errors) * @param full_response full response from the exchange (for logging, in case of errors)
*/ */
typedef void typedef void
(*TALER_EXCHANGE_RefreshMeltCallback) (void *cls, (*TALER_EXCHANGE_RefreshMeltCallback) (void *cls,
unsigned int http_status, unsigned int http_status,
uint16_t noreveal_index, uint16_t noreveal_index,
const struct TALER_ExchangePublicKeyP *sign_key,
const json_t *full_response); const json_t *full_response);
@ -1135,6 +1141,7 @@ struct TALER_WireDepositDetails
* *
* @param cls closure * @param cls closure
* @param http_status HTTP status code we got, 0 on exchange protocol violation * @param http_status HTTP status code we got, 0 on exchange protocol violation
* @param sign_key exchange key used to sign @a json, or NULL
* @param json original json reply (may include signatures, those have then been * @param json original json reply (may include signatures, those have then been
* validated already) * validated already)
* @param wtid extracted wire transfer identifier, or NULL if the exchange could * @param wtid extracted wire transfer identifier, or NULL if the exchange could
@ -1147,6 +1154,7 @@ struct TALER_WireDepositDetails
typedef void typedef void
(*TALER_EXCHANGE_WireDepositsCallback)(void *cls, (*TALER_EXCHANGE_WireDepositsCallback)(void *cls,
unsigned int http_status, unsigned int http_status,
const struct TALER_ExchangePublicKeyP *sign_key,
const json_t *json, const json_t *json,
const struct GNUNET_HashCode *h_wire, const struct GNUNET_HashCode *h_wire,
const struct TALER_Amount *total_amount, const struct TALER_Amount *total_amount,
@ -1195,6 +1203,7 @@ struct TALER_EXCHANGE_DepositWtidHandle;
* *
* @param cls closure * @param cls closure
* @param http_status HTTP status code we got, 0 on exchange protocol violation * @param http_status HTTP status code we got, 0 on exchange protocol violation
* @param sign_key exchange key used to sign @a json, or NULL
* @param json original json reply (may include signatures, those have then been * @param json original json reply (may include signatures, those have then been
* validated already) * validated already)
* @param wtid wire transfer identifier used by the exchange, NULL if exchange did not * @param wtid wire transfer identifier used by the exchange, NULL if exchange did not
@ -1205,6 +1214,7 @@ struct TALER_EXCHANGE_DepositWtidHandle;
typedef void typedef void
(*TALER_EXCHANGE_DepositWtidCallback)(void *cls, (*TALER_EXCHANGE_DepositWtidCallback)(void *cls,
unsigned int http_status, unsigned int http_status,
const struct TALER_ExchangePublicKeyP *sign_key,
const json_t *json, const json_t *json,
const struct TALER_WireTransferIdentifierRawP *wtid, const struct TALER_WireTransferIdentifierRawP *wtid,
struct GNUNET_TIME_Absolute execution_time, struct GNUNET_TIME_Absolute execution_time,