adapt code to match (updated) spec

This commit is contained in:
Christian Grothoff 2015-08-14 22:42:19 +02:00
parent 3d1627daa7
commit a8f65175f4
3 changed files with 30 additions and 11 deletions

View File

@ -1718,19 +1718,31 @@ struct TALER_MINT_RefreshRevealHandle
* to the application via the callback. * to the application via the callback.
* *
* @param rrh operation handle * @param rrh operation handle
* @param jsona reply from the mint * @param json reply from the mint
* @param[out] coin_privs array of length `num_fresh_coins`, initialized to contain private keys * @param[out] coin_privs array of length `num_fresh_coins`, initialized to contain private keys
* @param[out] sigs array of length `num_fresh_coins`, initialized to cointain RSA signatures * @param[out] sigs array of length `num_fresh_coins`, initialized to cointain RSA signatures
* @return #GNUNET_OK on success, #GNUNET_SYSERR on errors * @return #GNUNET_OK on success, #GNUNET_SYSERR on errors
*/ */
static int static int
refresh_reveal_ok (struct TALER_MINT_RefreshRevealHandle *rrh, refresh_reveal_ok (struct TALER_MINT_RefreshRevealHandle *rrh,
json_t *jsona, json_t *json,
struct TALER_CoinSpendPrivateKeyP *coin_privs, struct TALER_CoinSpendPrivateKeyP *coin_privs,
struct TALER_DenominationSignature *sigs) struct TALER_DenominationSignature *sigs)
{ {
unsigned int i; unsigned int i;
json_t *jsona;
struct MAJ_Specification spec[] = {
MAJ_spec_json ("ev_sigs", &jsona),
MAJ_spec_end
};
if (GNUNET_OK !=
MAJ_parse_json (json,
spec))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
if (! json_is_array (jsona)) if (! json_is_array (jsona))
{ {
/* We expected an array of coins */ /* We expected an array of coins */
@ -1747,7 +1759,7 @@ refresh_reveal_ok (struct TALER_MINT_RefreshRevealHandle *rrh,
{ {
const struct FreshCoin *fc; const struct FreshCoin *fc;
struct TALER_DenominationPublicKey *pk; struct TALER_DenominationPublicKey *pk;
json_t *json; json_t *jsonai;
struct GNUNET_CRYPTO_rsa_Signature *blind_sig; struct GNUNET_CRYPTO_rsa_Signature *blind_sig;
struct GNUNET_CRYPTO_rsa_Signature *sig; struct GNUNET_CRYPTO_rsa_Signature *sig;
struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendPublicKeyP coin_pub;
@ -1760,11 +1772,11 @@ refresh_reveal_ok (struct TALER_MINT_RefreshRevealHandle *rrh,
fc = &rrh->md->fresh_coins[rrh->noreveal_index][i]; fc = &rrh->md->fresh_coins[rrh->noreveal_index][i];
pk = &rrh->md->fresh_pks[i]; pk = &rrh->md->fresh_pks[i];
json = json_array_get (jsona, i); jsonai = json_array_get (jsona, i);
GNUNET_assert (NULL != json); GNUNET_assert (NULL != jsonai);
if (GNUNET_OK != if (GNUNET_OK !=
MAJ_parse_json (json, MAJ_parse_json (jsonai,
spec)) spec))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);

View File

@ -2019,7 +2019,7 @@ run (void *cls,
GNUNET_assert (NULL != mint); GNUNET_assert (NULL != mint);
shutdown_task shutdown_task
= GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 5), (GNUNET_TIME_UNIT_SECONDS, 30),
&do_shutdown, is); &do_shutdown, is);
} }

View File

@ -783,17 +783,24 @@ TMH_RESPONSE_reply_refresh_reveal_success (struct MHD_Connection *connection,
{ {
int newcoin_index; int newcoin_index;
json_t *root; json_t *root;
json_t *obj;
json_t *list; json_t *list;
int ret; int ret;
root = json_object ();
list = json_array (); list = json_array ();
for (newcoin_index = 0; newcoin_index < num_newcoins; newcoin_index++)
{
obj = json_object ();
json_object_set_new (obj,
"ev_sig",
TALER_json_from_rsa_signature (sigs[newcoin_index].rsa_signature));
json_array_append_new (list,
obj);
}
root = json_object ();
json_object_set_new (root, json_object_set_new (root,
"ev_sigs", "ev_sigs",
list); list);
for (newcoin_index = 0; newcoin_index < num_newcoins; newcoin_index++)
json_array_append_new (list,
TALER_json_from_rsa_signature (sigs[newcoin_index].rsa_signature));
ret = TMH_RESPONSE_reply_json (connection, ret = TMH_RESPONSE_reply_json (connection,
root, root,
MHD_HTTP_OK); MHD_HTTP_OK);