indentation and minor updates to reflect latest API docs
This commit is contained in:
parent
42147c2501
commit
80b29ed2ae
@ -24,11 +24,13 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Number of characters (plus 1 for 0-termination) we use to
|
* @brief Number of characters (plus 1 for 0-termination) we use to
|
||||||
* represent currency names (i.e. EUR, USD, etc.). We use
|
* represent currency names (i.e. EUR, USD, etc.). We use 8+4 for
|
||||||
* 4 for alignment as 3 characters are typical and we need a
|
* alignment in the `struct TALER_Amount`. The amount is typically an
|
||||||
* 0-terminator. So do not change this.
|
* ISO 4217 currency code when an alpha-numeric 3-digit code is used.
|
||||||
|
* For regional currencies, the first character should be a "*" followed
|
||||||
|
* by a region-specific name (i.e. "*BRETAGNEFR").
|
||||||
*/
|
*/
|
||||||
#define TALER_CURRENCY_LEN 4
|
#define TALER_CURRENCY_LEN 12
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The "fraction" value in a `struct TALER_Amount` represents which
|
* @brief The "fraction" value in a `struct TALER_Amount` represents which
|
||||||
|
@ -236,8 +236,9 @@ TMH_DB_execute_withdraw_status (struct MHD_Connection *connection,
|
|||||||
if (NULL == rh)
|
if (NULL == rh)
|
||||||
return TMH_RESPONSE_reply_json_pack (connection,
|
return TMH_RESPONSE_reply_json_pack (connection,
|
||||||
MHD_HTTP_NOT_FOUND,
|
MHD_HTTP_NOT_FOUND,
|
||||||
"{s:s}",
|
"{s:s, s:s}",
|
||||||
"error", "Reserve not found");
|
"error", "Reserve not found",
|
||||||
|
"parameter", "withdraw_pub");
|
||||||
res = TMH_RESPONSE_reply_withdraw_status_success (connection,
|
res = TMH_RESPONSE_reply_withdraw_status_success (connection,
|
||||||
rh);
|
rh);
|
||||||
TMH_plugin->free_reserve_history (TMH_plugin->cls,
|
TMH_plugin->free_reserve_history (TMH_plugin->cls,
|
||||||
@ -346,11 +347,8 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection,
|
|||||||
TMH_plugin->rollback (TMH_plugin->cls,
|
TMH_plugin->rollback (TMH_plugin->cls,
|
||||||
session);
|
session);
|
||||||
TMH_KS_release (key_state);
|
TMH_KS_release (key_state);
|
||||||
return TMH_RESPONSE_reply_json_pack (connection,
|
return TMH_RESPONSE_reply_arg_unknown (connection,
|
||||||
MHD_HTTP_NOT_FOUND,
|
"reserve_pub");
|
||||||
"{s:s}",
|
|
||||||
"error",
|
|
||||||
"Reserve not found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* calculate amount required including fees */
|
/* calculate amount required including fees */
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of TALER
|
This file is part of TALER
|
||||||
Copyright (C) 2014 GNUnet e.V.
|
Copyright (C) 2014, 2015 GNUnet e.V.
|
||||||
|
|
||||||
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 Affero General Public License as published by the Free Software
|
terms of the GNU Affero General Public License as published by the Free Software
|
||||||
@ -23,8 +23,8 @@
|
|||||||
* @author Christian Grothoff
|
* @author Christian Grothoff
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
* - missing 'wire' format check (well-formed SEPA-details)
|
* - missing 'wire' format check (well-formed SEPA-details) (#3624)
|
||||||
* - ugliy if-construction for deposit type
|
* - ugly if-construction for deposit type
|
||||||
*/
|
*/
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include <gnunet/gnunet_util_lib.h>
|
#include <gnunet/gnunet_util_lib.h>
|
||||||
@ -80,8 +80,8 @@ verify_and_execute_deposit (struct MHD_Connection *connection,
|
|||||||
&deposit->coin.coin_pub.ecdsa_pub))
|
&deposit->coin.coin_pub.ecdsa_pub))
|
||||||
{
|
{
|
||||||
TALER_LOG_WARNING ("Invalid signature on /deposit request\n");
|
TALER_LOG_WARNING ("Invalid signature on /deposit request\n");
|
||||||
return TMH_RESPONSE_reply_arg_invalid (connection,
|
return TMH_RESPONSE_reply_signature_invalid (connection,
|
||||||
"csig");
|
"coin_sig");
|
||||||
}
|
}
|
||||||
/* check denomination exists and is valid */
|
/* check denomination exists and is valid */
|
||||||
key_state = TMH_KS_acquire ();
|
key_state = TMH_KS_acquire ();
|
||||||
@ -91,7 +91,7 @@ verify_and_execute_deposit (struct MHD_Connection *connection,
|
|||||||
{
|
{
|
||||||
TMH_KS_release (key_state);
|
TMH_KS_release (key_state);
|
||||||
TALER_LOG_WARNING ("Unknown denomination key in /deposit request\n");
|
TALER_LOG_WARNING ("Unknown denomination key in /deposit request\n");
|
||||||
return TMH_RESPONSE_reply_arg_invalid (connection,
|
return TMH_RESPONSE_reply_arg_unknown (connection,
|
||||||
"denom_pub");
|
"denom_pub");
|
||||||
}
|
}
|
||||||
/* check coin signature */
|
/* check coin signature */
|
||||||
@ -100,7 +100,8 @@ verify_and_execute_deposit (struct MHD_Connection *connection,
|
|||||||
{
|
{
|
||||||
TALER_LOG_WARNING ("Invalid coin passed for /deposit\n");
|
TALER_LOG_WARNING ("Invalid coin passed for /deposit\n");
|
||||||
TMH_KS_release (key_state);
|
TMH_KS_release (key_state);
|
||||||
return TMH_RESPONSE_reply_coin_invalid (connection);
|
return TMH_RESPONSE_reply_signature_invalid (connection,
|
||||||
|
"ub_sig");
|
||||||
}
|
}
|
||||||
TALER_amount_ntoh (&fee_deposit,
|
TALER_amount_ntoh (&fee_deposit,
|
||||||
&dki->issue.fee_deposit);
|
&dki->issue.fee_deposit);
|
||||||
@ -145,12 +146,12 @@ parse_and_handle_deposit_request (struct MHD_Connection *connection,
|
|||||||
struct TMH_KS_StateHandle *ks;
|
struct TMH_KS_StateHandle *ks;
|
||||||
struct TMH_PARSE_FieldSpecification spec[] = {
|
struct TMH_PARSE_FieldSpecification spec[] = {
|
||||||
TMH_PARSE_MEMBER_DENOMINATION_PUBLIC_KEY ("denom_pub", &deposit.coin.denom_pub),
|
TMH_PARSE_MEMBER_DENOMINATION_PUBLIC_KEY ("denom_pub", &deposit.coin.denom_pub),
|
||||||
TMH_PARSE_MEMBER_DENOMINATION_SIGNATURE ("ubsig", &deposit.coin.denom_sig),
|
TMH_PARSE_MEMBER_DENOMINATION_SIGNATURE ("ub_sig", &deposit.coin.denom_sig),
|
||||||
TMH_PARSE_MEMBER_FIXED ("coin_pub", &deposit.coin.coin_pub),
|
TMH_PARSE_MEMBER_FIXED ("coin_pub", &deposit.coin.coin_pub),
|
||||||
TMH_PARSE_MEMBER_FIXED ("merchant_pub", &deposit.merchant_pub),
|
TMH_PARSE_MEMBER_FIXED ("merchant_pub", &deposit.merchant_pub),
|
||||||
TMH_PARSE_MEMBER_FIXED ("H_a", &deposit.h_contract),
|
TMH_PARSE_MEMBER_FIXED ("H_contract", &deposit.h_contract),
|
||||||
TMH_PARSE_MEMBER_FIXED ("H_wire", &deposit.h_wire),
|
TMH_PARSE_MEMBER_FIXED ("H_wire", &deposit.h_wire),
|
||||||
TMH_PARSE_MEMBER_FIXED ("csig", &deposit.csig),
|
TMH_PARSE_MEMBER_FIXED ("coin_sig", &deposit.csig),
|
||||||
TMH_PARSE_MEMBER_FIXED ("transaction_id", &deposit.transaction_id),
|
TMH_PARSE_MEMBER_FIXED ("transaction_id", &deposit.transaction_id),
|
||||||
TMH_PARSE_MEMBER_TIME_ABS ("timestamp", &deposit.timestamp),
|
TMH_PARSE_MEMBER_TIME_ABS ("timestamp", &deposit.timestamp),
|
||||||
TMH_PARSE_MEMBER_TIME_ABS ("refund_deadline", &deposit.refund_deadline),
|
TMH_PARSE_MEMBER_TIME_ABS ("refund_deadline", &deposit.refund_deadline),
|
||||||
@ -170,7 +171,7 @@ parse_and_handle_deposit_request (struct MHD_Connection *connection,
|
|||||||
wire))
|
wire))
|
||||||
{
|
{
|
||||||
TMH_PARSE_release_data (spec);
|
TMH_PARSE_release_data (spec);
|
||||||
return TMH_RESPONSE_reply_arg_invalid (connection,
|
return TMH_RESPONSE_reply_arg_unknown (connection,
|
||||||
"wire");
|
"wire");
|
||||||
}
|
}
|
||||||
if (NULL == (wire_enc = json_dumps (wire, JSON_COMPACT | JSON_SORT_KEYS)))
|
if (NULL == (wire_enc = json_dumps (wire, JSON_COMPACT | JSON_SORT_KEYS)))
|
||||||
@ -192,7 +193,7 @@ parse_and_handle_deposit_request (struct MHD_Connection *connection,
|
|||||||
{
|
{
|
||||||
TMH_KS_release (ks);
|
TMH_KS_release (ks);
|
||||||
TMH_PARSE_release_data (spec);
|
TMH_PARSE_release_data (spec);
|
||||||
return TMH_RESPONSE_reply_arg_invalid (connection,
|
return TMH_RESPONSE_reply_arg_unknown (connection,
|
||||||
"denom_pub");
|
"denom_pub");
|
||||||
}
|
}
|
||||||
TALER_amount_ntoh (&deposit.deposit_fee,
|
TALER_amount_ntoh (&deposit.deposit_fee,
|
||||||
|
@ -417,7 +417,7 @@ TMH_KS_acquire (void)
|
|||||||
"No valid signing key found!\n");
|
"No valid signing key found!\n");
|
||||||
|
|
||||||
keys = json_pack ("{s:o, s:o, s:o, s:o}",
|
keys = json_pack ("{s:o, s:o, s:o, s:o}",
|
||||||
"TMH_master_public_key",
|
"master_public_key",
|
||||||
TALER_json_from_data (&TMH_master_public_key,
|
TALER_json_from_data (&TMH_master_public_key,
|
||||||
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)),
|
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)),
|
||||||
"signkeys", key_state->sign_keys_array,
|
"signkeys", key_state->sign_keys_array,
|
||||||
@ -436,7 +436,7 @@ TMH_KS_acquire (void)
|
|||||||
&sig);
|
&sig);
|
||||||
keys = json_pack ("{s:o, s:o}",
|
keys = json_pack ("{s:o, s:o}",
|
||||||
"keys", keys,
|
"keys", keys,
|
||||||
"eddsa-signature", TALER_json_from_eddsa_sig (&ks.purpose,
|
"eddsa_sig", TALER_json_from_eddsa_sig (&ks.purpose,
|
||||||
&sig.eddsa_signature));
|
&sig.eddsa_signature));
|
||||||
key_state->keys_json = json_dumps (keys,
|
key_state->keys_json = json_dumps (keys,
|
||||||
JSON_INDENT (2));
|
JSON_INDENT (2));
|
||||||
|
@ -408,12 +408,9 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection,
|
|||||||
TMH_RESPONSE_reply_json_pack (connection,
|
TMH_RESPONSE_reply_json_pack (connection,
|
||||||
MHD_HTTP_BAD_REQUEST,
|
MHD_HTTP_BAD_REQUEST,
|
||||||
"{s:s, s:s, s:o}",
|
"{s:s, s:s, s:o}",
|
||||||
"error",
|
"error", "missing field in JSON",
|
||||||
"missing field in JSON",
|
"field", fname,
|
||||||
"field",
|
"path", path))
|
||||||
fname,
|
|
||||||
"path",
|
|
||||||
path))
|
|
||||||
? GNUNET_NO : GNUNET_SYSERR;
|
? GNUNET_NO : GNUNET_SYSERR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -434,8 +431,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection,
|
|||||||
TMH_RESPONSE_reply_json_pack (connection,
|
TMH_RESPONSE_reply_json_pack (connection,
|
||||||
MHD_HTTP_BAD_REQUEST,
|
MHD_HTTP_BAD_REQUEST,
|
||||||
"{s:s, s:o}",
|
"{s:s, s:o}",
|
||||||
"error",
|
"error", "missing index in JSON",
|
||||||
"missing index in JSON",
|
|
||||||
"path", path))
|
"path", path))
|
||||||
? GNUNET_NO : GNUNET_SYSERR;
|
? GNUNET_NO : GNUNET_SYSERR;
|
||||||
break;
|
break;
|
||||||
@ -458,10 +454,8 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection,
|
|||||||
TMH_RESPONSE_reply_json_pack (connection,
|
TMH_RESPONSE_reply_json_pack (connection,
|
||||||
MHD_HTTP_BAD_REQUEST,
|
MHD_HTTP_BAD_REQUEST,
|
||||||
"{s:s, s:o}",
|
"{s:s, s:o}",
|
||||||
"error",
|
"error", "string expected",
|
||||||
"string expected",
|
"path", path))
|
||||||
"path",
|
|
||||||
path))
|
|
||||||
? GNUNET_NO : GNUNET_SYSERR;
|
? GNUNET_NO : GNUNET_SYSERR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -473,10 +467,8 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection,
|
|||||||
TMH_RESPONSE_reply_json_pack (connection,
|
TMH_RESPONSE_reply_json_pack (connection,
|
||||||
MHD_HTTP_BAD_REQUEST,
|
MHD_HTTP_BAD_REQUEST,
|
||||||
"{s:s, s:o}",
|
"{s:s, s:o}",
|
||||||
"error",
|
"error", "malformed binary data in JSON",
|
||||||
"malformed binary data in JSON",
|
"path", path))
|
||||||
"path",
|
|
||||||
path))
|
|
||||||
? GNUNET_NO : GNUNET_SYSERR;
|
? GNUNET_NO : GNUNET_SYSERR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -519,8 +511,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection,
|
|||||||
TMH_RESPONSE_reply_json_pack (connection,
|
TMH_RESPONSE_reply_json_pack (connection,
|
||||||
MHD_HTTP_BAD_REQUEST,
|
MHD_HTTP_BAD_REQUEST,
|
||||||
"{s:s, s:o}",
|
"{s:s, s:o}",
|
||||||
"error",
|
"error", "malformed binary data in JSON",
|
||||||
"malformed binary data in JSON",
|
|
||||||
"path", path))
|
"path", path))
|
||||||
? GNUNET_NO : GNUNET_SYSERR;
|
? GNUNET_NO : GNUNET_SYSERR;
|
||||||
break;
|
break;
|
||||||
@ -570,10 +561,8 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection,
|
|||||||
TMH_RESPONSE_reply_json_pack (connection,
|
TMH_RESPONSE_reply_json_pack (connection,
|
||||||
MHD_HTTP_BAD_REQUEST,
|
MHD_HTTP_BAD_REQUEST,
|
||||||
"{s:s, s:o}",
|
"{s:s, s:o}",
|
||||||
"error",
|
"error", "string expected",
|
||||||
"string expected",
|
"path", path))
|
||||||
"path",
|
|
||||||
path))
|
|
||||||
? GNUNET_NO : GNUNET_SYSERR;
|
? GNUNET_NO : GNUNET_SYSERR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -590,10 +579,8 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection,
|
|||||||
TMH_RESPONSE_reply_json_pack (connection,
|
TMH_RESPONSE_reply_json_pack (connection,
|
||||||
MHD_HTTP_BAD_REQUEST,
|
MHD_HTTP_BAD_REQUEST,
|
||||||
"{s:s, s:o}",
|
"{s:s, s:o}",
|
||||||
"error",
|
"error", "malformed binary data in JSON",
|
||||||
"malformed binary data in JSON",
|
"path", path))
|
||||||
"path",
|
|
||||||
path))
|
|
||||||
? GNUNET_NO : GNUNET_SYSERR;
|
? GNUNET_NO : GNUNET_SYSERR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -606,10 +593,8 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection,
|
|||||||
TMH_RESPONSE_reply_json_pack (connection,
|
TMH_RESPONSE_reply_json_pack (connection,
|
||||||
MHD_HTTP_BAD_REQUEST,
|
MHD_HTTP_BAD_REQUEST,
|
||||||
"{s:s, s:o}",
|
"{s:s, s:o}",
|
||||||
"error",
|
"error", "malformed RSA public key in JSON",
|
||||||
"malformed RSA public key in JSON",
|
"path", path))
|
||||||
"path",
|
|
||||||
path))
|
|
||||||
? GNUNET_NO : GNUNET_SYSERR;
|
? GNUNET_NO : GNUNET_SYSERR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -634,10 +619,8 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection,
|
|||||||
TMH_RESPONSE_reply_json_pack (connection,
|
TMH_RESPONSE_reply_json_pack (connection,
|
||||||
MHD_HTTP_BAD_REQUEST,
|
MHD_HTTP_BAD_REQUEST,
|
||||||
"{s:s, s:o}",
|
"{s:s, s:o}",
|
||||||
"error",
|
"error", "string expected",
|
||||||
"string expected",
|
"path", path))
|
||||||
"path",
|
|
||||||
path))
|
|
||||||
? GNUNET_NO : GNUNET_SYSERR;
|
? GNUNET_NO : GNUNET_SYSERR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -654,10 +637,8 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection,
|
|||||||
TMH_RESPONSE_reply_json_pack (connection,
|
TMH_RESPONSE_reply_json_pack (connection,
|
||||||
MHD_HTTP_BAD_REQUEST,
|
MHD_HTTP_BAD_REQUEST,
|
||||||
"{s:s, s:o}",
|
"{s:s, s:o}",
|
||||||
"error",
|
"error", "malformed binary data in JSON",
|
||||||
"malformed binary data in JSON",
|
"path", path))
|
||||||
"path",
|
|
||||||
path))
|
|
||||||
? GNUNET_NO : GNUNET_SYSERR;
|
? GNUNET_NO : GNUNET_SYSERR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -670,10 +651,8 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection,
|
|||||||
TMH_RESPONSE_reply_json_pack (connection,
|
TMH_RESPONSE_reply_json_pack (connection,
|
||||||
MHD_HTTP_BAD_REQUEST,
|
MHD_HTTP_BAD_REQUEST,
|
||||||
"{s:s, s:o}",
|
"{s:s, s:o}",
|
||||||
"error",
|
"error", "malformed RSA signature in JSON",
|
||||||
"malformed RSA signature in JSON",
|
"path", path))
|
||||||
"path",
|
|
||||||
path))
|
|
||||||
? GNUNET_NO : GNUNET_SYSERR;
|
? GNUNET_NO : GNUNET_SYSERR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -113,22 +113,42 @@ TMH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a response indicating an invalid coin. (I.e. the signature
|
* Send a response indicating an argument refering to a
|
||||||
* over the public key of the coin does not match a valid signing key
|
* resource unknown to the mint (i.e. unknown reserve or
|
||||||
* of this mint).
|
* denomination key).
|
||||||
*
|
*
|
||||||
* @param connection the MHD connection to use
|
* @param connection the MHD connection to use
|
||||||
* @return MHD result code
|
* @param param_name the parameter that is invalid
|
||||||
|
* @return a MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
TMH_RESPONSE_reply_coin_invalid (struct MHD_Connection *connection)
|
TMH_RESPONSE_reply_arg_unknown (struct MHD_Connection *connection,
|
||||||
|
const char *param_name)
|
||||||
{
|
{
|
||||||
/* TODO: may want to be more precise in the future and
|
|
||||||
distinguish bogus signatures from bogus public keys. */
|
|
||||||
return TMH_RESPONSE_reply_json_pack (connection,
|
return TMH_RESPONSE_reply_json_pack (connection,
|
||||||
MHD_HTTP_NOT_FOUND,
|
MHD_HTTP_NOT_FOUND,
|
||||||
"{s:s}",
|
"{s:s, s:s}",
|
||||||
"error", "Coin is not valid");
|
"error", "unknown entity referenced",
|
||||||
|
"parameter", param_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a response indicating an invalid signature.
|
||||||
|
*
|
||||||
|
* @param connection the MHD connection to use
|
||||||
|
* @param param_name the parameter that is invalid
|
||||||
|
* @return a MHD result code
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
TMH_RESPONSE_reply_signature_invalid (struct MHD_Connection *connection,
|
||||||
|
const char *param_name)
|
||||||
|
{
|
||||||
|
return TMH_RESPONSE_reply_json_pack (connection,
|
||||||
|
MHD_HTTP_UNAUTHORIZED,
|
||||||
|
"{s:s, s:s}",
|
||||||
|
"error", "invalid signature",
|
||||||
|
"parameter", param_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -163,7 +183,7 @@ TMH_RESPONSE_reply_internal_error (struct MHD_Connection *connection,
|
|||||||
const char *hint)
|
const char *hint)
|
||||||
{
|
{
|
||||||
return TMH_RESPONSE_reply_json_pack (connection,
|
return TMH_RESPONSE_reply_json_pack (connection,
|
||||||
MHD_HTTP_BAD_REQUEST,
|
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||||
"{s:s, s:s}",
|
"{s:s, s:s}",
|
||||||
"error", "internal error",
|
"error", "internal error",
|
||||||
"hint", hint);
|
"hint", hint);
|
||||||
@ -369,7 +389,7 @@ compile_transaction_history (const struct TALER_MINTDB_TransactionList *tl)
|
|||||||
{
|
{
|
||||||
struct TALER_RefreshMeltCoinAffirmationPS ms;
|
struct TALER_RefreshMeltCoinAffirmationPS ms;
|
||||||
const struct TALER_MINTDB_RefreshMelt *melt = pos->details.melt;
|
const struct TALER_MINTDB_RefreshMelt *melt = pos->details.melt;
|
||||||
|
t
|
||||||
type = "melt";
|
type = "melt";
|
||||||
value = melt->amount_with_fee;
|
value = melt->amount_with_fee;
|
||||||
ms.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT);
|
ms.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT);
|
||||||
|
@ -64,6 +64,18 @@ TMH_RESPONSE_reply_json_pack (struct MHD_Connection *connection,
|
|||||||
...);
|
...);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a response indicating an invalid signature.
|
||||||
|
*
|
||||||
|
* @param connection the MHD connection to use
|
||||||
|
* @param param_name the parameter that is invalid
|
||||||
|
* @return a MHD result code
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
TMH_RESPONSE_reply_signature_invalid (struct MHD_Connection *connection,
|
||||||
|
const char *param_name);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a response indicating an invalid argument.
|
* Send a response indicating an invalid argument.
|
||||||
*
|
*
|
||||||
@ -77,15 +89,17 @@ TMH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a response indicating an invalid coin. (I.e. the signature
|
* Send a response indicating an argument refering to a
|
||||||
* over the public key of the coin does not match a valid signing key
|
* resource unknown to the mint (i.e. unknown reserve or
|
||||||
* of this mint).
|
* denomination key).
|
||||||
*
|
*
|
||||||
* @param connection the MHD connection to use
|
* @param connection the MHD connection to use
|
||||||
* @return MHD result code
|
* @param param_name the parameter that is invalid
|
||||||
|
* @return a MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
TMH_RESPONSE_reply_coin_invalid (struct MHD_Connection *connection);
|
TMH_RESPONSE_reply_arg_unknown (struct MHD_Connection *connection,
|
||||||
|
const char *param_name);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -132,7 +132,7 @@ TMH_WITHDRAW_handler_withdraw_sign (struct TMH_RequestHandler *rh,
|
|||||||
if (NULL == dki)
|
if (NULL == dki)
|
||||||
{
|
{
|
||||||
TMH_PARSE_release_data (spec);
|
TMH_PARSE_release_data (spec);
|
||||||
return TMH_RESPONSE_reply_arg_invalid (connection,
|
return TMH_RESPONSE_reply_arg_unknown (connection,
|
||||||
"denom_pub");
|
"denom_pub");
|
||||||
}
|
}
|
||||||
TALER_amount_ntoh (&amount,
|
TALER_amount_ntoh (&amount,
|
||||||
@ -165,7 +165,7 @@ TMH_WITHDRAW_handler_withdraw_sign (struct TMH_RequestHandler *rh,
|
|||||||
{
|
{
|
||||||
TALER_LOG_WARNING ("Client supplied invalid signature for /withdraw/sign request\n");
|
TALER_LOG_WARNING ("Client supplied invalid signature for /withdraw/sign request\n");
|
||||||
TMH_PARSE_release_data (spec);
|
TMH_PARSE_release_data (spec);
|
||||||
return TMH_RESPONSE_reply_arg_invalid (connection,
|
return TMH_RESPONSE_reply_signature_invalid (connection,
|
||||||
"reserve_sig");
|
"reserve_sig");
|
||||||
}
|
}
|
||||||
res = TMH_DB_execute_withdraw_sign (connection,
|
res = TMH_DB_execute_withdraw_sign (connection,
|
||||||
|
@ -84,7 +84,8 @@ TALER_json_from_abs (struct GNUNET_TIME_Absolute stamp)
|
|||||||
json_t *j;
|
json_t *j;
|
||||||
char *mystr;
|
char *mystr;
|
||||||
int ret;
|
int ret;
|
||||||
ret = GNUNET_asprintf (&mystr, "%llu",
|
ret = GNUNET_asprintf (&mystr,
|
||||||
|
"%llu",
|
||||||
(long long) (stamp.abs_value_us / (1000 * 1000)));
|
(long long) (stamp.abs_value_us / (1000 * 1000)));
|
||||||
GNUNET_assert (ret > 0);
|
GNUNET_assert (ret > 0);
|
||||||
j = json_string (mystr);
|
j = json_string (mystr);
|
||||||
@ -117,11 +118,11 @@ TALER_json_from_eddsa_sig (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpo
|
|||||||
|
|
||||||
el = TALER_json_from_data (purpose,
|
el = TALER_json_from_data (purpose,
|
||||||
ntohl (purpose->size));
|
ntohl (purpose->size));
|
||||||
json_object_set_new (root, "eddsa-val", el);
|
json_object_set_new (root, "eddsa_val", el);
|
||||||
|
|
||||||
el = TALER_json_from_data (signature,
|
el = TALER_json_from_data (signature,
|
||||||
sizeof (struct GNUNET_CRYPTO_EddsaSignature));
|
sizeof (struct GNUNET_CRYPTO_EddsaSignature));
|
||||||
json_object_set_new (root, "eddsa-sig", el);
|
json_object_set_new (root, "eddsa_sig", el);
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
@ -151,11 +152,11 @@ TALER_json_from_ecdsa_sig (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpo
|
|||||||
|
|
||||||
el = TALER_json_from_data (purpose,
|
el = TALER_json_from_data (purpose,
|
||||||
ntohl (purpose->size));
|
ntohl (purpose->size));
|
||||||
json_object_set_new (root, "ecdsa-val", el);
|
json_object_set_new (root, "ecdsa_val", el);
|
||||||
|
|
||||||
el = TALER_json_from_data (signature,
|
el = TALER_json_from_data (signature,
|
||||||
sizeof (struct GNUNET_CRYPTO_EddsaSignature));
|
sizeof (struct GNUNET_CRYPTO_EddsaSignature));
|
||||||
json_object_set_new (root, "ecdsa-sig", el);
|
json_object_set_new (root, "ecdsa_sig", el);
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user