-more eliminations of json_pack

This commit is contained in:
Christian Grothoff 2021-07-31 20:27:16 +02:00
parent 723a3b742e
commit 1d54400a02
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
19 changed files with 305 additions and 623 deletions

View File

@ -155,10 +155,10 @@ struct TALER_EXCHANGE_DenomPublicKey
struct TALER_Amount fee_refund; struct TALER_Amount fee_refund;
/** /**
* Set to #GNUNET_YES if this denomination key has been * Set to true if this denomination key has been
* revoked by the exchange. * revoked by the exchange.
*/ */
int revoked; bool revoked;
}; };
@ -1869,7 +1869,7 @@ typedef void
* @param pk kind of coin to pay back * @param pk kind of coin to pay back
* @param denom_sig signature over the coin by the exchange using @a pk * @param denom_sig signature over the coin by the exchange using @a pk
* @param ps secret internals of the original planchet * @param ps secret internals of the original planchet
* @param was_refreshed #GNUNET_YES if the coin in @a ps was refreshed * @param was_refreshed true if the coin in @a ps was refreshed
* @param recoup_cb the callback to call when the final result for this request is available * @param recoup_cb the callback to call when the final result for this request is available
* @param recoup_cb_cls closure for @a recoup_cb * @param recoup_cb_cls closure for @a recoup_cb
* @return NULL * @return NULL
@ -1881,7 +1881,7 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_EXCHANGE_DenomPublicKey *pk, const struct TALER_EXCHANGE_DenomPublicKey *pk,
const struct TALER_DenominationSignature *denom_sig, const struct TALER_DenominationSignature *denom_sig,
const struct TALER_PlanchetSecretsP *ps, const struct TALER_PlanchetSecretsP *ps,
int was_refreshed, bool was_refreshed,
TALER_EXCHANGE_RecoupResultCallback recoup_cb, TALER_EXCHANGE_RecoupResultCallback recoup_cb,
void *recoup_cb_cls); void *recoup_cb_cls);

View File

@ -103,9 +103,9 @@ TALER_JSON_pack_time_rel_nbo (const char *name,
* @return json pack specification * @return json pack specification
*/ */
struct GNUNET_JSON_PackSpec struct GNUNET_JSON_PackSpec
TALER_JSON_pack_denomination_public_key (const char *name, TALER_JSON_pack_denomination_public_key (
const struct const char *name,
TALER_DenominationPublicKey *pk); const struct TALER_DenominationPublicKey *pk);
/** /**
@ -117,9 +117,9 @@ TALER_JSON_pack_denomination_public_key (const char *name,
* @return json pack specification * @return json pack specification
*/ */
struct GNUNET_JSON_PackSpec struct GNUNET_JSON_PackSpec
TALER_JSON_pack_denomination_signature (const char *name, TALER_JSON_pack_denomination_signature (
const struct const char *name,
TALER_DenominationSignature *sig); const struct TALER_DenominationSignature *sig);
/** /**

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2014-2020 Taler Systems SA Copyright (C) 2014-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -323,37 +323,35 @@ TALER_AUDITOR_deposit_confirmation (
} }
deposit_confirmation_obj deposit_confirmation_obj
= json_pack ("{s:o, s:o," /* h_wire, h_contract_terms */ = GNUNET_JSON_PACK (
" s:o, s:o," /* timestamp, refund_deadline */ GNUNET_JSON_pack_data_auto ("h_wire",
" s:o, s:o," /* amount_without_fees, coin_pub */ h_wire),
" s:o, s:o," /* merchant_pub, exchange_sig */ GNUNET_JSON_pack_data_auto ("h_contract_terms",
" s:o, s:o," /* master_pub, ep_start */
" s:o, s:o," /* ep_expire, ep_end */
" s:o, s:o}", /* master_sig, exchange_pub */
"h_wire", GNUNET_JSON_from_data_auto (h_wire),
"h_contract_terms", GNUNET_JSON_from_data_auto (
h_contract_terms), h_contract_terms),
"exchange_timestamp", GNUNET_JSON_from_time_abs ( GNUNET_JSON_pack_time_abs ("exchange_timestamp",
exchange_timestamp), exchange_timestamp),
"refund_deadline", GNUNET_JSON_from_time_abs (refund_deadline), GNUNET_JSON_pack_time_abs ("refund_deadline",
"amount_without_fee", TALER_JSON_from_amount ( refund_deadline),
TALER_JSON_pack_amount ("amount_without_fee",
amount_without_fee), amount_without_fee),
"coin_pub", GNUNET_JSON_from_data_auto (coin_pub), GNUNET_JSON_pack_data_auto ("coin_pub",
"merchant_pub", GNUNET_JSON_from_data_auto (merchant_pub), coin_pub),
"exchange_sig", GNUNET_JSON_from_data_auto (exchange_sig), GNUNET_JSON_pack_data_auto ("merchant_pub",
"master_pub", GNUNET_JSON_from_data_auto (master_pub), merchant_pub),
"ep_start", GNUNET_JSON_from_time_abs (ep_start), GNUNET_JSON_pack_data_auto ("exchange_sig",
"ep_expire", GNUNET_JSON_from_time_abs (ep_expire), exchange_sig),
"ep_end", GNUNET_JSON_from_time_abs (ep_end), GNUNET_JSON_pack_data_auto ("master_pub",
"master_sig", GNUNET_JSON_from_data_auto (master_sig), master_pub),
"exchange_pub", GNUNET_JSON_from_data_auto (exchange_pub)); GNUNET_JSON_pack_time_abs ("ep_start",
ep_start),
if (NULL == deposit_confirmation_obj) GNUNET_JSON_pack_time_abs ("ep_expire",
{ ep_expire),
GNUNET_break (0); GNUNET_JSON_pack_time_abs ("ep_end",
return NULL; ep_end),
} GNUNET_JSON_pack_data_auto ("master_sig",
master_sig),
GNUNET_JSON_pack_data_auto ("exchange_pub",
exchange_pub));
dh = GNUNET_new (struct TALER_AUDITOR_DepositConfirmationHandle); dh = GNUNET_new (struct TALER_AUDITOR_DepositConfirmationHandle);
dh->auditor = auditor; dh->auditor = auditor;
dh->cb = cb; dh->cb = cb;

View File

@ -187,17 +187,11 @@ TALER_EXCHANGE_add_auditor_denomination (
GNUNET_free (ah); GNUNET_free (ah);
return NULL; return NULL;
} }
body = json_pack ("{s:o}", body = GNUNET_JSON_PACK (
"auditor_sig", GNUNET_JSON_pack_data_auto ("auditor_sig",
GNUNET_JSON_from_data_auto (auditor_sig)); auditor_sig));
if (NULL == body)
{
GNUNET_break (0);
GNUNET_free (ah->url);
GNUNET_free (ah);
return NULL;
}
eh = curl_easy_init (); eh = curl_easy_init ();
GNUNET_assert (NULL != eh);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_curl_easy_post (&ah->post_ctx, TALER_curl_easy_post (&ah->post_ctx,
eh, eh,

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2014-2020 Taler Systems SA Copyright (C) 2014-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -663,38 +663,29 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
return NULL; return NULL;
} }
deposit_obj = json_pack ("{s:o, s:O," /* f/wire */ deposit_obj = GNUNET_JSON_PACK (
" s:o, s:o," /* h_wire, h_contract_terms */ TALER_JSON_pack_amount ("contribution",
" s:o," /* denom_pub */ amount),
" s:o, s:o," /* ub_sig, timestamp */ GNUNET_JSON_pack_object_incref ("wire",
" s:o," /* merchant_pub */ wire_details),
" s:o, s:o," /* refund_deadline, wire_deadline */ GNUNET_JSON_pack_data_auto ("h_wire",
" s:o}", /* coin_sig */ &h_wire),
"contribution", TALER_JSON_from_amount (amount), GNUNET_JSON_pack_data_auto ("h_contract_terms",
"wire", wire_details,
"h_wire", GNUNET_JSON_from_data_auto (&h_wire),
"h_contract_terms", GNUNET_JSON_from_data_auto (
h_contract_terms), h_contract_terms),
"denom_pub_hash", GNUNET_JSON_from_data_auto ( GNUNET_JSON_pack_data_auto ("denom_pub_hash",
&denom_pub_hash), &denom_pub_hash),
"ub_sig", GNUNET_JSON_from_rsa_signature ( TALER_JSON_pack_denomination_signature ("ub_sig",
denom_sig->rsa_signature), denom_sig),
"timestamp", GNUNET_JSON_from_time_abs (timestamp), GNUNET_JSON_pack_time_abs ("timestamp",
"merchant_pub", GNUNET_JSON_from_data_auto ( timestamp),
GNUNET_JSON_pack_data_auto ("merchant_pub",
merchant_pub), merchant_pub),
"refund_deadline", GNUNET_JSON_from_time_abs ( GNUNET_JSON_pack_time_abs ("refund_deadline",
refund_deadline), refund_deadline),
"wire_transfer_deadline", GNUNET_JSON_from_time_abs ( GNUNET_JSON_pack_time_abs ("wire_transfer_deadline",
wire_deadline), wire_deadline),
"coin_sig", GNUNET_JSON_from_data_auto (coin_sig) GNUNET_JSON_pack_data_auto ("coin_sig",
); coin_sig));
if (NULL == deposit_obj)
{
*ec = TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE;
GNUNET_break (0);
return NULL;
}
dh = GNUNET_new (struct TALER_EXCHANGE_DepositHandle); dh = GNUNET_new (struct TALER_EXCHANGE_DepositHandle);
dh->auditor_chance = AUDITOR_CHANCE; dh->auditor_chance = AUDITOR_CHANCE;
dh->exchange = exchange; dh->exchange = exchange;

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2014-2018 Taler Systems SA Copyright (C) 2014-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it TALER is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published under the terms of the GNU General Public License as published
@ -1612,22 +1612,17 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
if (now.abs_value_us > sk->valid_until.abs_value_us) if (now.abs_value_us > sk->valid_until.abs_value_us)
continue; /* skip keys that have expired */ continue; /* skip keys that have expired */
signkey = json_pack ("{s:o, s:o, s:o, s:o, s:o}", signkey = GNUNET_JSON_PACK (
"key", GNUNET_JSON_pack_data_auto ("key",
GNUNET_JSON_from_data_auto &sk->key),
(&sk->key), GNUNET_JSON_pack_data_auto ("master_sig",
"master_sig", &sk->master_sig),
GNUNET_JSON_from_data_auto GNUNET_JSON_pack_time_abs ("stamp_start",
(&sk->master_sig), sk->valid_from),
"stamp_start", GNUNET_JSON_pack_time_abs ("stamp_expire",
GNUNET_JSON_from_time_abs sk->valid_until),
(sk->valid_from), GNUNET_JSON_pack_time_abs ("stamp_end",
"stamp_expire", sk->valid_legal));
GNUNET_JSON_from_time_abs
(sk->valid_until),
"stamp_end",
GNUNET_JSON_from_time_abs
(sk->valid_legal));
if (NULL == signkey) if (NULL == signkey)
{ {
GNUNET_break (0); GNUNET_break (0);
@ -1656,57 +1651,35 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
if (now.abs_value_us > dk->expire_deposit.abs_value_us) if (now.abs_value_us > dk->expire_deposit.abs_value_us)
continue; /* skip keys that have expired */ continue; /* skip keys that have expired */
denom = json_pack ("{s:o, s:o, s:o, s:o, s:o " denom = GNUNET_JSON_PACK (
",s:o, s:o, s:o, s:o, s:o " GNUNET_JSON_pack_time_abs ("stamp_expire_deposit",
",s:o}", dk->expire_deposit),
"stamp_expire_deposit", GNUNET_JSON_pack_time_abs ("stamp_expire_withdraw",
GNUNET_JSON_from_time_abs (dk->expire_deposit), dk->withdraw_valid_until),
"stamp_expire_withdraw", GNUNET_JSON_pack_time_abs ("stamp_start",
GNUNET_JSON_from_time_abs (dk->withdraw_valid_until), dk->valid_from),
"stamp_start", GNUNET_JSON_pack_time_abs ("stamp_expire_legal",
GNUNET_JSON_from_time_abs (dk->valid_from), dk->expire_legal),
"stamp_expire_legal", TALER_JSON_pack_amount ("value",
GNUNET_JSON_from_time_abs (dk->expire_legal), &dk->value),
"value", TALER_JSON_pack_amount ("fee_withdraw",
TALER_JSON_from_amount (&dk->value), &dk->fee_withdraw),
"fee_withdraw", TALER_JSON_pack_amount ("fee_deposit",
/* #6 */ &dk->fee_deposit),
TALER_JSON_from_amount (&dk->fee_withdraw), TALER_JSON_pack_amount ("fee_refresh",
"fee_deposit", &dk->fee_refresh),
TALER_JSON_from_amount (&dk->fee_deposit), TALER_JSON_pack_amount ("fee_refund",
"fee_refresh", &dk->fee_refund),
TALER_JSON_from_amount (&dk->fee_refresh), GNUNET_JSON_pack_data_auto ("master_sig",
"fee_refund", &dk->master_sig),
TALER_JSON_from_amount (&dk->fee_refund), TALER_JSON_pack_denomination_public_key ("denom_pub",
"master_sig", &dk->key));
GNUNET_JSON_from_data_auto (&dk->master_sig), GNUNET_assert (0 ==
/* #10 */ json_array_append_new (denoms,
"denom_pub", denom));
GNUNET_JSON_from_rsa_public_key (
dk->key.rsa_public_key));
if (NULL == denom)
{
GNUNET_break (0);
continue;
}
if (0 != json_array_append_new (denoms,
denom))
{
GNUNET_break (0);
json_decref (denom);
json_decref (denoms);
json_decref (signkeys);
return NULL;
}
} }
auditors = json_array (); auditors = json_array ();
if (NULL == auditors) GNUNET_assert (NULL != auditors);
{
GNUNET_break (0);
json_decref (denoms);
json_decref (signkeys);
return NULL;
}
for (unsigned int i = 0; i<kd->num_auditors; i++) for (unsigned int i = 0; i<kd->num_auditors; i++)
{ {
const struct TALER_EXCHANGE_AuditorInformation *ai = &kd->auditors[i]; const struct TALER_EXCHANGE_AuditorInformation *ai = &kd->auditors[i];
@ -1733,92 +1706,53 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
if (now.abs_value_us > dk->expire_deposit.abs_value_us) if (now.abs_value_us > dk->expire_deposit.abs_value_us)
continue; /* skip auditor signatures for denomination keys that have expired */ continue; /* skip auditor signatures for denomination keys that have expired */
GNUNET_assert (adi->denom_key_offset < kd->num_denom_keys); GNUNET_assert (adi->denom_key_offset < kd->num_denom_keys);
k = json_pack ("{s:o, s:o}", k = GNUNET_JSON_PACK (
"denom_pub_h", GNUNET_JSON_pack_data_auto ("denom_pub_h",
GNUNET_JSON_from_data_auto (&dk->h_key), &dk->h_key),
"auditor_sig", GNUNET_JSON_pack_data_auto ("auditor_sig",
GNUNET_JSON_from_data_auto (&adi->auditor_sig)); &adi->auditor_sig));
if (NULL == k) GNUNET_assert (0 ==
{ json_array_append_new (adenoms,
GNUNET_break (0); k));
json_decref (adenoms);
json_decref (denoms);
json_decref (signkeys);
json_decref (auditors);
return NULL;
}
if (0 != json_array_append_new (adenoms,
k))
{
GNUNET_break (0);
json_decref (k);
json_decref (adenoms);
json_decref (denoms);
json_decref (signkeys);
json_decref (auditors);
return NULL;
}
} }
a = json_pack ("{s:o, s:s, s:o}", a = GNUNET_JSON_PACK (
"auditor_pub", GNUNET_JSON_pack_data_auto ("auditor_pub",
GNUNET_JSON_from_data_auto (&ai->auditor_pub), &ai->auditor_pub),
"auditor_url", GNUNET_JSON_pack_string ("auditor_url",
ai->auditor_url, ai->auditor_url),
"denomination_keys", GNUNET_JSON_pack_array_steal ("denomination_keys",
adenoms); adenoms));
if (NULL == a) GNUNET_assert (0 ==
{ json_array_append_new (auditors,
json_decref (adenoms); a));
json_decref (denoms);
json_decref (signkeys);
json_decref (auditors);
return NULL;
} }
if (0 != json_array_append_new (auditors, keys = GNUNET_JSON_PACK (
a)) GNUNET_JSON_pack_string ("version",
{ kd->version),
json_decref (a); GNUNET_JSON_pack_string ("currency",
json_decref (denoms); kd->currency),
json_decref (signkeys); GNUNET_JSON_pack_data_auto ("master_public_key",
json_decref (auditors); &kd->master_pub),
return NULL; GNUNET_JSON_pack_time_rel ("reserve_closing_delay",
} kd->reserve_closing_delay),
} GNUNET_JSON_pack_time_abs ("list_issue_date",
keys = json_pack ("{s:s, s:s, s:o, s:o, s:o, s:o" kd->list_issue_date),
",s:o, s:o}", GNUNET_JSON_pack_array_steal ("signkeys",
/* 1 */ signkeys),
"version", GNUNET_JSON_pack_array_steal ("denoms",
kd->version, denoms),
"currency", GNUNET_JSON_pack_array_steal ("auditors",
kd->currency, auditors));
"master_public_key", return GNUNET_JSON_PACK (
GNUNET_JSON_from_data_auto (&kd->master_pub), GNUNET_JSON_pack_uint64 ("version",
"reserve_closing_delay", EXCHANGE_SERIALIZATION_FORMAT_VERSION),
GNUNET_JSON_from_time_rel (kd->reserve_closing_delay), GNUNET_JSON_pack_time_abs ("expire",
"list_issue_date", exchange->key_data_expiration),
GNUNET_JSON_from_time_abs (kd->list_issue_date), GNUNET_JSON_pack_string ("exchange_url",
"signkeys", exchange->url),
signkeys, GNUNET_JSON_pack_object_steal ("keys",
/* #7 */ keys));
"denoms",
denoms,
"auditors",
auditors);
if (NULL == keys)
{
GNUNET_break (0);
return NULL;
}
return json_pack ("{s:I, s:o, s:s, s:o}",
"version",
(json_int_t) EXCHANGE_SERIALIZATION_FORMAT_VERSION,
"expire",
GNUNET_JSON_from_time_abs (exchange->key_data_expiration),
"exchange_url",
exchange->url,
"keys",
keys);
} }

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2015-2020 Taler Systems SA Copyright (C) 2015-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -166,19 +166,13 @@ TALER_EXCHANGE_management_disable_auditor (
GNUNET_free (ah); GNUNET_free (ah);
return NULL; return NULL;
} }
body = json_pack ("{s:o, s:o}", body = GNUNET_JSON_PACK (
"master_sig", GNUNET_JSON_pack_data_auto ("master_sig",
GNUNET_JSON_from_data_auto (master_sig), master_sig),
"validity_end", GNUNET_JSON_pack_time_abs ("validity_end",
GNUNET_JSON_from_time_abs (validity_end)); validity_end));
if (NULL == body)
{
GNUNET_break (0);
GNUNET_free (ah->url);
GNUNET_free (ah);
return NULL;
}
eh = curl_easy_init (); eh = curl_easy_init ();
GNUNET_assert (NULL != eh);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_curl_easy_post (&ah->post_ctx, TALER_curl_easy_post (&ah->post_ctx,
eh, eh,

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2015-2020 Taler Systems SA Copyright (C) 2015-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -150,25 +150,19 @@ TALER_EXCHANGE_management_enable_auditor (
GNUNET_free (ah); GNUNET_free (ah);
return NULL; return NULL;
} }
body = json_pack ("{s:s, s:s, s:o, s:o, s:o}", body = GNUNET_JSON_PACK (
"auditor_url", GNUNET_JSON_pack_string ("auditor_url",
auditor_url, auditor_url),
"auditor_name", GNUNET_JSON_pack_string ("auditor_name",
auditor_name, auditor_name),
"auditor_pub", GNUNET_JSON_pack_data_auto ("auditor_pub",
GNUNET_JSON_from_data_auto (auditor_pub), auditor_pub),
"master_sig", GNUNET_JSON_pack_data_auto ("master_sig",
GNUNET_JSON_from_data_auto (master_sig), master_sig),
"validity_start", GNUNET_JSON_pack_time_abs ("validity_start",
GNUNET_JSON_from_time_abs (validity_start)); validity_start));
if (NULL == body)
{
GNUNET_break (0);
GNUNET_free (ah->url);
GNUNET_free (ah);
return NULL;
}
eh = curl_easy_init (); eh = curl_easy_init ();
GNUNET_assert (NULL != eh);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_curl_easy_post (&ah->post_ctx, TALER_curl_easy_post (&ah->post_ctx,
eh, eh,

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2015-2020 Taler Systems SA Copyright (C) 2015-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -149,72 +149,44 @@ TALER_EXCHANGE_post_management_keys (
return NULL; return NULL;
} }
denom_sigs = json_array (); denom_sigs = json_array ();
if (NULL == denom_sigs) GNUNET_assert (NULL != denom_sigs);
{
GNUNET_free (ph->url);
GNUNET_free (ph);
return NULL;
}
for (unsigned int i = 0; i<pkd->num_denom_sigs; i++) for (unsigned int i = 0; i<pkd->num_denom_sigs; i++)
{ {
if (0 != const struct TALER_EXCHANGE_DenominationKeySignature *dks
= &pkd->denom_sigs[i];
GNUNET_assert (0 ==
json_array_append_new ( json_array_append_new (
denom_sigs, denom_sigs,
json_pack ("{s:o, s:o}", GNUNET_JSON_PACK (
"h_denom_pub", GNUNET_JSON_pack_data_auto ("h_denom_pub",
GNUNET_JSON_from_data_auto ( &dks->h_denom_pub),
&pkd->denom_sigs[i].h_denom_pub), GNUNET_JSON_pack_data_auto ("master_sig",
"master_sig", &dks->master_sig))));
GNUNET_JSON_from_data_auto (
&pkd->denom_sigs[i].master_sig))))
{
json_decref (denom_sigs);
GNUNET_free (ph->url);
GNUNET_free (ph);
return NULL;
}
} }
signkey_sigs = json_array (); signkey_sigs = json_array ();
if (NULL == signkey_sigs) GNUNET_assert (NULL != signkey_sigs);
{
json_decref (denom_sigs);
GNUNET_free (ph->url);
GNUNET_free (ph);
return NULL;
}
for (unsigned int i = 0; i<pkd->num_sign_sigs; i++) for (unsigned int i = 0; i<pkd->num_sign_sigs; i++)
{ {
if (0 != const struct TALER_EXCHANGE_SigningKeySignature *sks
= &pkd->sign_sigs[i];
GNUNET_assert (0 ==
json_array_append_new ( json_array_append_new (
signkey_sigs, signkey_sigs,
json_pack ("{s:o, s:o}", GNUNET_JSON_PACK (
"exchange_pub", GNUNET_JSON_pack_data_auto ("exchange_pub",
GNUNET_JSON_from_data_auto ( &sks->exchange_pub),
&pkd->sign_sigs[i].exchange_pub), GNUNET_JSON_pack_data_auto ("master_sig",
"master_sig", &sks->master_sig))));
GNUNET_JSON_from_data_auto (
&pkd->sign_sigs[i].master_sig))))
{
json_decref (signkey_sigs);
json_decref (denom_sigs);
GNUNET_free (ph->url);
GNUNET_free (ph);
return NULL;
}
}
body = json_pack ("{s:o, s:o}",
"denom_sigs",
denom_sigs,
"signkey_sigs",
signkey_sigs);
if (NULL == body)
{
GNUNET_break (0);
GNUNET_free (ph->url);
GNUNET_free (ph);
return NULL;
} }
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_array_steal ("denom_sigs",
denom_sigs),
GNUNET_JSON_pack_array_steal ("signkey_sigs",
signkey_sigs));
eh = curl_easy_init (); eh = curl_easy_init ();
GNUNET_assert (NULL != eh);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_curl_easy_post (&ph->post_ctx, TALER_curl_easy_post (&ph->post_ctx,
eh, eh,

View File

@ -163,9 +163,9 @@ TALER_EXCHANGE_management_revoke_denomination_key (
GNUNET_free (rh); GNUNET_free (rh);
return NULL; return NULL;
} }
body = json_pack ("{s:o}", body = GNUNET_JSON_PACK (
"master_sig", GNUNET_JSON_pack_data_auto ("master_sig",
GNUNET_JSON_from_data_auto (master_sig)); master_sig));
if (NULL == body) if (NULL == body)
{ {
GNUNET_break (0); GNUNET_break (0);

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2015-2020 Taler Systems SA Copyright (C) 2015-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -160,17 +160,11 @@ TALER_EXCHANGE_management_revoke_signing_key (
GNUNET_free (rh); GNUNET_free (rh);
return NULL; return NULL;
} }
body = json_pack ("{s:o}", body = GNUNET_JSON_PACK (
"master_sig", GNUNET_JSON_pack_data_auto ("master_sig",
GNUNET_JSON_from_data_auto (master_sig)); master_sig));
if (NULL == body)
{
GNUNET_break (0);
GNUNET_free (rh->url);
GNUNET_free (rh);
return NULL;
}
eh = curl_easy_init (); eh = curl_easy_init ();
GNUNET_assert (NULL != eh);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_curl_easy_post (&rh->post_ctx, TALER_curl_easy_post (&rh->post_ctx,
eh, eh,

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2020 Taler Systems SA Copyright (C) 2020-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -152,27 +152,21 @@ TALER_EXCHANGE_management_set_wire_fees (
GNUNET_free (swfh); GNUNET_free (swfh);
return NULL; return NULL;
} }
body = json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}", body = GNUNET_JSON_PACK (
"wire_method", GNUNET_JSON_pack_string ("wire_method",
wire_method, wire_method),
"master_sig", GNUNET_JSON_pack_data_auto ("master_sig",
GNUNET_JSON_from_data_auto (master_sig), master_sig),
"fee_start", GNUNET_JSON_pack_time_abs ("fee_start",
GNUNET_JSON_from_time_abs (validity_start), validity_start),
"fee_end", GNUNET_JSON_pack_time_abs ("fee_end",
GNUNET_JSON_from_time_abs (validity_end), validity_end),
"closing_fee", TALER_JSON_pack_amount ("closing_fee",
TALER_JSON_from_amount (closing_fee), closing_fee),
"wire_fee", TALER_JSON_pack_amount ("wire_fee",
TALER_JSON_from_amount (wire_fee)); wire_fee));
if (NULL == body)
{
GNUNET_break (0);
GNUNET_free (swfh->url);
GNUNET_free (swfh);
return NULL;
}
eh = curl_easy_init (); eh = curl_easy_init ();
GNUNET_assert (NULL != eh);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_curl_easy_post (&swfh->post_ctx, TALER_curl_easy_post (&swfh->post_ctx,
eh, eh,

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2015-2020 Taler Systems SA Copyright (C) 2015-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -154,21 +154,15 @@ TALER_EXCHANGE_management_disable_wire (
GNUNET_free (wh); GNUNET_free (wh);
return NULL; return NULL;
} }
body = json_pack ("{s:s, s:o, s:o}", body = GNUNET_JSON_PACK (
"payto_uri", GNUNET_JSON_pack_string ("payto_uri",
payto_uri, payto_uri),
"master_sig_del", GNUNET_JSON_pack_data_auto ("master_sig_del",
GNUNET_JSON_from_data_auto (master_sig), master_sig),
"validity_end", GNUNET_JSON_pack_time_abs ("validity_end",
GNUNET_JSON_from_time_abs (validity_end)); validity_end));
if (NULL == body)
{
GNUNET_break (0);
GNUNET_free (wh->url);
GNUNET_free (wh);
return NULL;
}
eh = curl_easy_init (); eh = curl_easy_init ();
GNUNET_assert (NULL != eh);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_curl_easy_post (&wh->post_ctx, TALER_curl_easy_post (&wh->post_ctx,
eh, eh,

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2015-2020 Taler Systems SA Copyright (C) 2015-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -151,23 +151,17 @@ TALER_EXCHANGE_management_enable_wire (
GNUNET_free (wh); GNUNET_free (wh);
return NULL; return NULL;
} }
body = json_pack ("{s:s, s:o, s:o, s:o}", body = GNUNET_JSON_PACK (
"payto_uri", GNUNET_JSON_pack_string ("payto_uri",
payto_uri, payto_uri),
"master_sig_add", GNUNET_JSON_pack_data_auto ("master_sig_add",
GNUNET_JSON_from_data_auto (master_sig1), master_sig1),
"master_sig_wire", GNUNET_JSON_pack_data_auto ("master_sig_wire",
GNUNET_JSON_from_data_auto (master_sig2), master_sig2),
"validity_start", GNUNET_JSON_pack_time_abs ("validity_start",
GNUNET_JSON_from_time_abs (validity_start)); validity_start));
if (NULL == body)
{
GNUNET_break (0);
GNUNET_free (wh->url);
GNUNET_free (wh);
return NULL;
}
eh = curl_easy_init (); eh = curl_easy_init ();
GNUNET_assert (NULL != eh);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_curl_easy_post (&wh->post_ctx, TALER_curl_easy_post (&wh->post_ctx,
eh, eh,

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2015-2020 Taler Systems SA Copyright (C) 2015-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -449,26 +449,6 @@ handle_melt_finished (void *cls,
} }
/**
* Submit a melt request to the exchange and get the exchange's
* response.
*
* This API is typically used by a wallet. Note that to ensure that
* no money is lost in case of hardware failures, the provided
* argument should have been constructed using
* #TALER_EXCHANGE_refresh_prepare and committed to persistent storage
* prior to calling this function.
*
* @param exchange the exchange handle; the exchange must be ready to operate
* @param refresh_data_length size of the @a refresh_data (returned
* in the `res_size` argument from #TALER_EXCHANGE_refresh_prepare())
* @param refresh_data the refresh data as returned from
#TALER_EXCHANGE_refresh_prepare())
* @param melt_cb the callback to call with the result
* @param melt_cb_cls closure for @a melt_cb
* @return a handle for this request; NULL if the argument was invalid.
* In this case, neither callback will be called.
*/
struct TALER_EXCHANGE_MeltHandle * struct TALER_EXCHANGE_MeltHandle *
TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange, TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange,
size_t refresh_data_length, size_t refresh_data_length,
@ -511,27 +491,19 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange,
GNUNET_CRYPTO_eddsa_sign (&md->melted_coin.coin_priv.eddsa_priv, GNUNET_CRYPTO_eddsa_sign (&md->melted_coin.coin_priv.eddsa_priv,
&melt, &melt,
&confirm_sig.eddsa_signature); &confirm_sig.eddsa_signature);
melt_obj = json_pack ("{s:o, s:o, s:o, s:o, s:o, s:o}", melt_obj = GNUNET_JSON_PACK (
"coin_pub", GNUNET_JSON_pack_data_auto ("coin_pub",
GNUNET_JSON_from_data_auto (&melt.coin_pub), &melt.coin_pub),
"denom_pub_hash", GNUNET_JSON_pack_data_auto ("denom_pub_hash",
GNUNET_JSON_from_data_auto (&melt.h_denom_pub), &melt.h_denom_pub),
"denom_sig", TALER_JSON_pack_denomination_signature ("denom_sig",
GNUNET_JSON_from_rsa_signature ( &md->melted_coin.sig),
md->melted_coin.sig.rsa_signature), GNUNET_JSON_pack_data_auto ("confirm_sig",
"confirm_sig", &confirm_sig),
GNUNET_JSON_from_data_auto (&confirm_sig), TALER_JSON_pack_amount ("value_with_fee",
"value_with_fee",
TALER_JSON_from_amount (
&md->melted_coin.melt_amount_with_fee), &md->melted_coin.melt_amount_with_fee),
"rc", GNUNET_JSON_pack_data_auto ("rc",
GNUNET_JSON_from_data_auto (&melt.rc)); &melt.rc));
if (NULL == melt_obj)
{
GNUNET_break (0);
TALER_EXCHANGE_free_melt_data_ (md);
return NULL;
}
{ {
char pub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2]; char pub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2];
char *end; char *end;
@ -596,12 +568,6 @@ TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange,
} }
/**
* Cancel a melt request. This function cannot be used
* on a request handle if either callback was already invoked.
*
* @param mh the refresh melt handle
*/
void void
TALER_EXCHANGE_melt_cancel (struct TALER_EXCHANGE_MeltHandle *mh) TALER_EXCHANGE_melt_cancel (struct TALER_EXCHANGE_MeltHandle *mh)
{ {

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2017-2020 Taler Systems SA Copyright (C) 2017-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -300,28 +300,12 @@ handle_recoup_finished (void *cls,
} }
/**
* Ask the exchange to pay back a coin due to the exchange triggering
* the emergency recoup protocol for a given denomination. The value
* of the coin will be refunded to the original customer (without fees).
*
* @param exchange the exchange handle; the exchange must be ready to operate
* @param pk kind of coin to pay back
* @param denom_sig signature over the coin by the exchange using @a pk
* @param ps secret internals of the original planchet
* @param was_refreshed #GNUNET_YES if the coin in @a ps was refreshed
* @param recoup_cb the callback to call when the final result for this request is available
* @param recoup_cb_cls closure for @a recoup_cb
* @return NULL
* if the inputs are invalid (i.e. denomination key not with this exchange).
* In this case, the callback is not called.
*/
struct TALER_EXCHANGE_RecoupHandle * struct TALER_EXCHANGE_RecoupHandle *
TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange, TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_EXCHANGE_DenomPublicKey *pk, const struct TALER_EXCHANGE_DenomPublicKey *pk,
const struct TALER_DenominationSignature *denom_sig, const struct TALER_DenominationSignature *denom_sig,
const struct TALER_PlanchetSecretsP *ps, const struct TALER_PlanchetSecretsP *ps,
int was_refreshed, bool was_refreshed,
TALER_EXCHANGE_RecoupResultCallback recoup_cb, TALER_EXCHANGE_RecoupResultCallback recoup_cb,
void *recoup_cb_cls) void *recoup_cb_cls)
{ {
@ -347,24 +331,17 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
GNUNET_CRYPTO_eddsa_sign (&ps->coin_priv.eddsa_priv, GNUNET_CRYPTO_eddsa_sign (&ps->coin_priv.eddsa_priv,
&pr, &pr,
&coin_sig.eddsa_signature); &coin_sig.eddsa_signature);
recoup_obj = json_pack ("{s:o, s:o," /* denom pub/sig */ recoup_obj = GNUNET_JSON_PACK (
" s:o," /* sig */ GNUNET_JSON_pack_data_auto ("denom_pub_hash",
" s:o, s:o}", /* coin_bks */
"denom_pub_hash", GNUNET_JSON_from_data_auto (
&h_denom_pub), &h_denom_pub),
"denom_sig", GNUNET_JSON_from_rsa_signature ( TALER_JSON_pack_denomination_signature ("denom_sig",
denom_sig->rsa_signature), denom_sig),
"coin_sig", GNUNET_JSON_from_data_auto (&coin_sig), GNUNET_JSON_pack_data_auto ("coin_sig",
"coin_blind_key_secret", GNUNET_JSON_from_data_auto ( &coin_sig),
GNUNET_JSON_pack_data_auto ("coin_blind_key_secret",
&ps->blinding_key), &ps->blinding_key),
"refreshed", json_boolean (was_refreshed) GNUNET_JSON_pack_bool ("refreshed",
); was_refreshed));
if (NULL == recoup_obj)
{
GNUNET_break (0);
return NULL;
}
{ {
char pub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2]; char pub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2];
char *end; char *end;
@ -426,12 +403,6 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
} }
/**
* Cancel a recoup request. This function cannot be used on a
* request handle if the callback was already invoked.
*
* @param ph the recoup handle
*/
void void
TALER_EXCHANGE_recoup_cancel (struct TALER_EXCHANGE_RecoupHandle *ph) TALER_EXCHANGE_recoup_cancel (struct TALER_EXCHANGE_RecoupHandle *ph)
{ {

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2015-2020 Taler Systems SA Copyright (C) 2015-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -287,28 +287,6 @@ handle_refresh_reveal_finished (void *cls,
} }
/**
* Submit a /refresh/reval request to the exchange and get the exchange's
* response.
*
* This API is typically used by a wallet. Note that to ensure that
* no money is lost in case of hardware failures, the provided
* arguments should have been committed to persistent storage
* prior to calling this function.
*
* @param exchange the exchange handle; the exchange must be ready to operate
* @param refresh_data_length size of the @a refresh_data (returned
* in the `res_size` argument from #TALER_EXCHANGE_refresh_prepare())
* @param refresh_data the refresh data as returned from
#TALER_EXCHANGE_refresh_prepare())
* @param noreveal_index response from the exchange to the
* #TALER_EXCHANGE_melt() invocation
* @param reveal_cb the callback to call with the final result of the
* refresh operation
* @param reveal_cb_cls closure for the above callback
* @return a handle for this request; NULL if the argument was invalid.
* In this case, neither callback will be called.
*/
struct TALER_EXCHANGE_RefreshesRevealHandle * struct TALER_EXCHANGE_RefreshesRevealHandle *
TALER_EXCHANGE_refreshes_reveal ( TALER_EXCHANGE_refreshes_reveal (
struct TALER_EXCHANGE_Handle *exchange, struct TALER_EXCHANGE_Handle *exchange,
@ -425,23 +403,17 @@ TALER_EXCHANGE_refreshes_reveal (
} }
/* build main JSON request */ /* build main JSON request */
reveal_obj = json_pack ("{s:o, s:o, s:o, s:o, s:o}", reveal_obj = GNUNET_JSON_PACK (
"transfer_pub", GNUNET_JSON_pack_data_auto ("transfer_pub",
GNUNET_JSON_from_data_auto (&transfer_pub), &transfer_pub),
"transfer_privs", GNUNET_JSON_pack_array_steal ("transfer_privs",
transfer_privs, transfer_privs),
"link_sigs", GNUNET_JSON_pack_array_steal ("link_sigs",
link_sigs, link_sigs),
"new_denoms_h", GNUNET_JSON_pack_array_steal ("new_denoms_h",
new_denoms_h, new_denoms_h),
"coin_evs", GNUNET_JSON_pack_array_steal ("coin_evs",
coin_evs); coin_evs));
if (NULL == reveal_obj)
{
GNUNET_break (0);
return NULL;
}
{ {
char pub_str[sizeof (struct TALER_RefreshCommitmentP) * 2]; char pub_str[sizeof (struct TALER_RefreshCommitmentP) * 2];
char *end; char *end;
@ -498,12 +470,6 @@ TALER_EXCHANGE_refreshes_reveal (
} }
/**
* Cancel a refresh reveal request. This function cannot be used
* on a request handle if the callback was already invoked.
*
* @param rrh the refresh reval handle
*/
void void
TALER_EXCHANGE_refreshes_reveal_cancel ( TALER_EXCHANGE_refreshes_reveal_cancel (
struct TALER_EXCHANGE_RefreshesRevealHandle *rrh) struct TALER_EXCHANGE_RefreshesRevealHandle *rrh)

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2014-2020 Taler Systems SA Copyright (C) 2014-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -635,35 +635,6 @@ handle_refund_finished (void *cls,
} }
/**
* Submit a refund request to the exchange and get the exchange's
* response. This API is used by a merchant. Note that
* while we return the response verbatim to the caller for further
* processing, we do already verify that the response is well-formed
* (i.e. that signatures included in the response are all valid). If
* the exchange's reply is not well-formed, we return an HTTP status code
* of zero to @a cb.
*
* The @a exchange must be ready to operate (i.e. have
* finished processing the /keys reply). If this check fails, we do
* NOT initiate the transaction with the exchange and instead return NULL.
*
* @param exchange the exchange handle; the exchange must be ready to operate
* @param amount the amount to be refunded; must be larger than the refund fee
* (as that fee is still being subtracted), and smaller than the amount
* (with deposit fee) of the original deposit contribution of this coin
* @param h_contract_terms hash of the contact of the merchant with the customer that is being refunded
* @param coin_pub coins public key of the coin from the original deposit operation
* @param rtransaction_id transaction id for the transaction between merchant and customer (of refunding operation);
* this is needed as we may first do a partial refund and later a full refund. If both
* refunds are also over the same amount, we need the @a rtransaction_id to make the disjoint
* refund requests different (as requests are idempotent and otherwise the 2nd refund might not work).
* @param merchant_priv the private key of the merchant, used to generate signature for refund request
* @param cb the callback to call when a reply for this request is available
* @param cb_cls closure for the above callback
* @return a handle for this request; NULL if the inputs are invalid (i.e.
* signatures fail to verify). In this case, the callback is not called.
*/
struct TALER_EXCHANGE_RefundHandle * struct TALER_EXCHANGE_RefundHandle *
TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange, TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
@ -714,25 +685,17 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
"/coins/%s/refund", "/coins/%s/refund",
pub_str); pub_str);
} }
refund_obj = json_pack ("{s:o," /* amount */ refund_obj = GNUNET_JSON_PACK (
" s:o," /* h_contract_terms */ TALER_JSON_pack_amount ("refund_amount",
" s:I," /* rtransaction id */ amount),
" s:o, s:o}", /* merchant_pub, merchant_sig */ GNUNET_JSON_pack_data_auto ("h_contract_terms",
"refund_amount", TALER_JSON_from_amount (amount),
"h_contract_terms", GNUNET_JSON_from_data_auto (
h_contract_terms), h_contract_terms),
"rtransaction_id", (json_int_t) rtransaction_id, GNUNET_JSON_pack_uint64 ("rtransaction_id",
"merchant_pub", GNUNET_JSON_from_data_auto ( rtransaction_id),
GNUNET_JSON_pack_data_auto ("merchant_pub",
&rr.merchant), &rr.merchant),
"merchant_sig", GNUNET_JSON_from_data_auto ( GNUNET_JSON_pack_data_auto ("merchant_sig",
&merchant_sig) &merchant_sig));
);
if (NULL == refund_obj)
{
GNUNET_break (0);
return NULL;
}
rh = GNUNET_new (struct TALER_EXCHANGE_RefundHandle); rh = GNUNET_new (struct TALER_EXCHANGE_RefundHandle);
rh->exchange = exchange; rh->exchange = exchange;
rh->cb = cb; rh->cb = cb;
@ -783,12 +746,6 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
} }
/**
* Cancel a refund permission request. This function cannot be used
* on a request handle if a response is already served for it.
*
* @param refund the refund permission request handle
*/
void void
TALER_EXCHANGE_refund_cancel (struct TALER_EXCHANGE_RefundHandle *refund) TALER_EXCHANGE_refund_cancel (struct TALER_EXCHANGE_RefundHandle *refund)
{ {

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2014-2020 Taler Systems SA Copyright (C) 2014-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -344,25 +344,6 @@ handle_reserve_withdraw_finished (void *cls,
} }
/**
* Withdraw a coin from the exchange using a /reserve/withdraw
* request. This API is typically used by a wallet to withdraw a tip
* where the reserve's signature was created by the merchant already.
*
* Note that to ensure that no money is lost in case of hardware
* failures, the caller must have committed (most of) the arguments to
* disk before calling, and be ready to repeat the request with the
* same arguments in case of failures.
*
* @param exchange the exchange handle; the exchange must be ready to operate
* @param pd planchet details of the planchet to withdraw
* @param reserve_priv private key of the reserve to withdraw from
* @param res_cb the callback to call when the final result for this request is available
* @param res_cb_cls closure for @a res_cb
* @return NULL
* if the inputs are invalid (i.e. denomination key not with this exchange).
* In this case, the callback is not called.
*/
struct TALER_EXCHANGE_Withdraw2Handle * struct TALER_EXCHANGE_Withdraw2Handle *
TALER_EXCHANGE_withdraw2 ( TALER_EXCHANGE_withdraw2 (
struct TALER_EXCHANGE_Handle *exchange, struct TALER_EXCHANGE_Handle *exchange,
@ -445,20 +426,14 @@ TALER_EXCHANGE_withdraw2 (
{ {
json_t *withdraw_obj; json_t *withdraw_obj;
withdraw_obj = json_pack ("{s:o, s:o, s:o}", withdraw_obj = GNUNET_JSON_PACK (
"denom_pub_hash", GNUNET_JSON_pack_data_auto ("denom_pub_hash",
GNUNET_JSON_from_data_auto (&pd->denom_pub_hash), &pd->denom_pub_hash),
"coin_ev", GNUNET_JSON_pack_data_varsize ("coin_ev",
GNUNET_JSON_from_data (pd->coin_ev, pd->coin_ev,
pd->coin_ev_size), pd->coin_ev_size),
"reserve_sig", GNUNET_JSON_pack_data_auto ("reserve_sig",
GNUNET_JSON_from_data_auto (&reserve_sig)); &reserve_sig));
if (NULL == withdraw_obj)
{
GNUNET_break (0);
GNUNET_free (wh);
return NULL;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Attempting to withdraw from reserve %s\n", "Attempting to withdraw from reserve %s\n",
TALER_B2S (&wh->reserve_pub)); TALER_B2S (&wh->reserve_pub));
@ -502,12 +477,6 @@ TALER_EXCHANGE_withdraw2 (
} }
/**
* Cancel a withdraw status request. This function cannot be used
* on a request handle if a response is already served for it.
*
* @param wh the withdraw sign request handle
*/
void void
TALER_EXCHANGE_withdraw2_cancel (struct TALER_EXCHANGE_Withdraw2Handle *wh) TALER_EXCHANGE_withdraw2_cancel (struct TALER_EXCHANGE_Withdraw2Handle *wh)
{ {