use properly typed merchant pub/priv key in trait

This commit is contained in:
Christian Grothoff 2020-01-17 17:46:13 +01:00
parent 9d2ff364dc
commit 27457d94e4
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
7 changed files with 168 additions and 173 deletions

View File

@ -2139,7 +2139,7 @@ struct TALER_TESTING_FreshCoinData
* Offer a _array_ of fresh coins. * Offer a _array_ of fresh coins.
* *
* @param index which array of fresh coins to offer, * @param index which array of fresh coins to offer,
* if there are multiple on offer. Tipically passed as * if there are multiple on offer. Typically passed as
* zero. * zero.
* @param fresh_coins the array of fresh coins to offer * @param fresh_coins the array of fresh coins to offer
* *
@ -2255,74 +2255,69 @@ TALER_TESTING_make_trait_exchange_keys (unsigned int index,
/** /**
* Obtain a private key from a "peer". Used e.g. to obtain * Obtain a private key from a "merchant". Used e.g. to obtain
* a merchant's priv to sign a /track request. * a merchant's priv to sign a /track request.
* *
* @param cmd command that is offering the key. * @param cmd command that is offering the key.
* @param index (tipically zero) which key to return if there * @param index (typically zero) which key to return if there
* are multiple on offer. * are multiple on offer.
* @param priv[out] set to the key coming from @a cmd. * @param priv[out] set to the key coming from @a cmd.
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
*/ */
int int
TALER_TESTING_get_trait_peer_key (const struct TALER_TESTING_Command *cmd, TALER_TESTING_get_trait_merchant_priv (const struct TALER_TESTING_Command *cmd,
unsigned int index, unsigned int index,
const struct const struct
GNUNET_CRYPTO_EddsaPrivateKey **priv); TALER_MerchantPrivateKeyP **priv);
// FIXME: private get_trait_merchant_priv instead, rather have // FIXME: private get_trait_merchant_priv instead, rather have
// more traits with precise types than this! // more traits with precise types than this!
/** /**
* Offer private key, typically done when CMD_1 needs it to * Offer private key of a merchant, typically done when CMD_1 needs it to
* sign a request. * sign a request.
* *
* @param index (tipically zero) which key to return if there are * @param index (typically zero) which key to return if there are
* multiple on offer. * multiple on offer.
* @param priv which object should be offered. * @param priv which object should be offered.
* @return the trait. * @return the trait.
*/ */
struct TALER_TESTING_Trait struct TALER_TESTING_Trait
TALER_TESTING_make_trait_peer_key (unsigned int index, TALER_TESTING_make_trait_merchant_priv (unsigned int index,
const struct const struct
GNUNET_CRYPTO_EddsaPrivateKey *priv); TALER_MerchantPrivateKeyP *priv);
// FIXME: private get_trait_merchant_priv instead, rather have
// more traits with precise types than this!
/** /**
* Obtain a public key from a "peer". Used e.g. to obtain * Obtain a public key from a "merchant". Used e.g. to obtain
* a merchant's public key to use backend's API. * a merchant's public key to use backend's API.
* *
* @param cmd command offering the key. * @param cmd command offering the key.
* @param index (tipically zero) which key to return if there * @param index (typically zero) which key to return if there
* are multiple on offer. * are multiple on offer.
* @param pub[out] set to the key coming from @a cmd. * @param pub[out] set to the key coming from @a cmd.
*
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
*/ */
int int
TALER_TESTING_get_trait_peer_key_pub (const struct TALER_TESTING_Command *cmd, TALER_TESTING_get_trait_merchant_pub (const struct TALER_TESTING_Command *cmd,
unsigned int index, unsigned int index,
const struct const struct
GNUNET_CRYPTO_EddsaPublicKey **pub); TALER_MerchantPublicKeyP **pub);
/** /**
* Offer public key. * Offer public key.
* *
* @param index (tipically zero) which key to return if there * @param index (typically zero) which key to return if there
* are multiple on offer. NOTE: if one key is offered, it * are multiple on offer. NOTE: if one key is offered, it
* is mandatory to set this as zero. * is mandatory to set this as zero.
* @param pub which object should be returned. * @param pub which object should be returned.
*
* @return the trait. * @return the trait.
*/ */
struct TALER_TESTING_Trait struct TALER_TESTING_Trait
TALER_TESTING_make_trait_peer_key_pub (unsigned int index, TALER_TESTING_make_trait_merchant_pub (unsigned int index,
struct GNUNET_CRYPTO_EddsaPublicKey *pub); struct TALER_MerchantPublicKeyP *pub);
/** /**

View File

@ -114,7 +114,7 @@ libtalertesting_la_SOURCES = \
testing_api_trait_exchange_sig.c \ testing_api_trait_exchange_sig.c \
testing_api_trait_fresh_coin.c \ testing_api_trait_fresh_coin.c \
testing_api_trait_json.c \ testing_api_trait_json.c \
testing_api_trait_key_peer.c \ testing_api_trait_merchant_key.c \
testing_api_trait_number.c \ testing_api_trait_number.c \
testing_api_trait_process.c \ testing_api_trait_process.c \
testing_api_trait_reserve_pub.c \ testing_api_trait_reserve_pub.c \

View File

@ -197,7 +197,7 @@ deposit_confirmation_run (void *cls,
struct GNUNET_TIME_Absolute refund_deadline; struct GNUNET_TIME_Absolute refund_deadline;
struct TALER_Amount amount_without_fee; struct TALER_Amount amount_without_fee;
struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendPublicKeyP coin_pub;
const struct GNUNET_CRYPTO_EddsaPrivateKey *merchant_priv; const struct TALER_MerchantPrivateKeyP *merchant_priv;
struct TALER_MerchantPublicKeyP merchant_pub; struct TALER_MerchantPublicKeyP merchant_pub;
const struct TALER_ExchangePublicKeyP *exchange_pub; const struct TALER_ExchangePublicKeyP *exchange_pub;
const struct TALER_ExchangeSignatureP *exchange_sig; const struct TALER_ExchangeSignatureP *exchange_sig;
@ -255,10 +255,10 @@ deposit_confirmation_run (void *cls,
GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv, GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv,
&coin_pub.eddsa_pub); &coin_pub.eddsa_pub);
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_TESTING_get_trait_peer_key (deposit_cmd, TALER_TESTING_get_trait_merchant_priv (deposit_cmd,
dcs->coin_index, dcs->coin_index,
&merchant_priv)); &merchant_priv));
GNUNET_CRYPTO_eddsa_key_get_public (merchant_priv, GNUNET_CRYPTO_eddsa_key_get_public (&merchant_priv->eddsa_priv,
&merchant_pub.eddsa_pub); &merchant_pub.eddsa_pub);
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (dcs->amount_without_fee, TALER_string_to_amount (dcs->amount_without_fee,

View File

@ -446,8 +446,8 @@ deposit_traits (void *cls,
ds->wire_details), ds->wire_details),
TALER_TESTING_make_trait_contract_terms (0, TALER_TESTING_make_trait_contract_terms (0,
ds->contract_terms), ds->contract_terms),
TALER_TESTING_make_trait_peer_key (0, TALER_TESTING_make_trait_merchant_priv (0,
&ds->merchant_priv.eddsa_priv), &ds->merchant_priv),
TALER_TESTING_make_trait_amount_obj (0, TALER_TESTING_make_trait_amount_obj (0,
&ds->amount), &ds->amount),
TALER_TESTING_trait_end () TALER_TESTING_trait_end ()

View File

@ -16,14 +16,12 @@
License along with TALER; see the file COPYING. If not, see License along with TALER; see the file COPYING. If not, see
<http://www.gnu.org/licenses/> <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file exchange/testing_api_cmd_refund.c * @file exchange/testing_api_cmd_refund.c
* @brief Implement the /refund test command, plus other * @brief Implement the /refund test command, plus other
* corollary commands (?). * corollary commands (?).
* @author Marcello Stanisci * @author Marcello Stanisci
*/ */
#include "platform.h" #include "platform.h"
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h> #include <gnunet/gnunet_curl_lib.h>
@ -137,7 +135,7 @@ refund_run (void *cls,
struct GNUNET_HashCode h_contract_terms; struct GNUNET_HashCode h_contract_terms;
struct TALER_Amount refund_fee; struct TALER_Amount refund_fee;
struct TALER_Amount refund_amount; struct TALER_Amount refund_amount;
const struct GNUNET_CRYPTO_EddsaPrivateKey *merchant_priv; const struct TALER_MerchantPrivateKeyP *merchant_priv;
const struct TALER_TESTING_Command *coin_cmd; const struct TALER_TESTING_Command *coin_cmd;
rs->exchange = is->exchange; rs->exchange = is->exchange;
@ -168,31 +166,32 @@ refund_run (void *cls,
return; return;
} }
coin_cmd = TALER_TESTING_interpreter_lookup_command coin_cmd = TALER_TESTING_interpreter_lookup_command (is,
(is, rs->coin_reference); rs->coin_reference);
if (NULL == coin_cmd) if (NULL == coin_cmd)
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (is); TALER_TESTING_interpreter_fail (is);
return; return;
} }
if (GNUNET_OK !=
if (GNUNET_OK != TALER_TESTING_get_trait_contract_terms TALER_TESTING_get_trait_contract_terms (coin_cmd,
(coin_cmd, 0, &contract_terms)) 0,
&contract_terms))
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (is); TALER_TESTING_interpreter_fail (is);
return; return;
} }
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_JSON_hash (contract_terms, TALER_JSON_hash (contract_terms,
&h_contract_terms)); &h_contract_terms));
/* Hunting for a coin .. */ /* Hunting for a coin .. */
if (GNUNET_OK != TALER_TESTING_get_trait_coin_priv if (GNUNET_OK !=
(coin_cmd, 0, &coin_priv)) TALER_TESTING_get_trait_coin_priv (coin_cmd,
0,
&coin_priv))
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (is); TALER_TESTING_interpreter_fail (is);
@ -201,24 +200,24 @@ refund_run (void *cls,
GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv, GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv,
&coin.eddsa_pub); &coin.eddsa_pub);
if (GNUNET_OK != TALER_TESTING_get_trait_peer_key if (GNUNET_OK !=
(coin_cmd, 0, &merchant_priv)) TALER_TESTING_get_trait_merchant_priv (coin_cmd,
0,
&merchant_priv))
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (is); TALER_TESTING_interpreter_fail (is);
return; return;
} }
rs->rh = TALER_EXCHANGE_refund (rs->exchange,
rs->rh = TALER_EXCHANGE_refund
(rs->exchange,
&refund_amount, &refund_amount,
&refund_fee, &refund_fee,
&h_contract_terms, &h_contract_terms,
&coin, &coin,
rs->refund_transaction_id, rs->refund_transaction_id,
(const struct TALER_MerchantPrivateKeyP *) merchant_priv, merchant_priv,
&refund_cb, rs); &refund_cb,
rs);
GNUNET_assert (NULL != rs->rh); GNUNET_assert (NULL != rs->rh);
} }

View File

@ -156,8 +156,7 @@ struct TrackTransferState
* if @a http_status is #MHD_HTTP_OK). * if @a http_status is #MHD_HTTP_OK).
*/ */
static void static void
deposit_wtid_cb deposit_wtid_cb (void *cls,
(void *cls,
unsigned int http_status, unsigned int http_status,
enum TALER_ErrorCode ec, enum TALER_ErrorCode ec,
const struct TALER_ExchangePublicKeyP *exchange_pub, const struct TALER_ExchangePublicKeyP *exchange_pub,
@ -255,12 +254,12 @@ track_transaction_run (void *cls,
const json_t *wire_details; const json_t *wire_details;
struct GNUNET_HashCode h_wire_details; struct GNUNET_HashCode h_wire_details;
struct GNUNET_HashCode h_contract_terms; struct GNUNET_HashCode h_contract_terms;
const struct GNUNET_CRYPTO_EddsaPrivateKey *merchant_priv; const struct TALER_MerchantPrivateKeyP *merchant_priv;
tts->is = is; tts->is = is;
transaction_cmd = TALER_TESTING_interpreter_lookup_command transaction_cmd
(tts->is, tts->transaction_reference); = TALER_TESTING_interpreter_lookup_command (tts->is,
tts->transaction_reference);
if (NULL == transaction_cmd) if (NULL == transaction_cmd)
{ {
GNUNET_break (0); GNUNET_break (0);
@ -268,8 +267,10 @@ track_transaction_run (void *cls,
return; return;
} }
if (GNUNET_OK != TALER_TESTING_get_trait_coin_priv if (GNUNET_OK !=
(transaction_cmd, tts->coin_index, &coin_priv)) TALER_TESTING_get_trait_coin_priv (transaction_cmd,
tts->coin_index,
&coin_priv))
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (tts->is); TALER_TESTING_interpreter_fail (tts->is);
@ -280,23 +281,28 @@ track_transaction_run (void *cls,
&coin_pub.eddsa_pub); &coin_pub.eddsa_pub);
/* Get the strings.. */ /* Get the strings.. */
if (GNUNET_OK != TALER_TESTING_get_trait_wire_details if (GNUNET_OK !=
(transaction_cmd, 0, &wire_details)) TALER_TESTING_get_trait_wire_details (transaction_cmd,
0,
&wire_details))
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (tts->is); TALER_TESTING_interpreter_fail (tts->is);
return; return;
} }
if (GNUNET_OK != TALER_TESTING_get_trait_contract_terms if (GNUNET_OK !=
(transaction_cmd, 0, &contract_terms)) TALER_TESTING_get_trait_contract_terms (transaction_cmd,
0,
&contract_terms))
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (tts->is); TALER_TESTING_interpreter_fail (tts->is);
return; return;
} }
if ((NULL == wire_details) || (NULL == contract_terms)) if ( (NULL == wire_details) ||
(NULL == contract_terms) )
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (tts->is); TALER_TESTING_interpreter_fail (tts->is);
@ -312,23 +318,23 @@ track_transaction_run (void *cls,
TALER_JSON_hash (contract_terms, TALER_JSON_hash (contract_terms,
&h_contract_terms)) ); &h_contract_terms)) );
if (GNUNET_OK != TALER_TESTING_get_trait_peer_key if (GNUNET_OK !=
(transaction_cmd, 0, &merchant_priv)) TALER_TESTING_get_trait_merchant_priv (transaction_cmd,
0,
&merchant_priv))
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (tts->is); TALER_TESTING_interpreter_fail (tts->is);
return; return;
} }
tts->tth = TALER_EXCHANGE_track_transaction tts->tth = TALER_EXCHANGE_track_transaction (is->exchange,
(is->exchange, merchant_priv,
(struct TALER_MerchantPrivateKeyP *) merchant_priv,
&h_wire_details, &h_wire_details,
&h_contract_terms, &h_contract_terms,
&coin_pub, &coin_pub,
&deposit_wtid_cb, &deposit_wtid_cb,
tts); tts);
GNUNET_assert (NULL != tts->tth); GNUNET_assert (NULL != tts->tth);
} }
@ -341,8 +347,7 @@ track_transaction_run (void *cls,
* @param cmd the command which is being cleaned up. * @param cmd the command which is being cleaned up.
*/ */
static void static void
track_transaction_cleanup track_transaction_cleanup (void *cls,
(void *cls,
const struct TALER_TESTING_Command *cmd) const struct TALER_TESTING_Command *cmd)
{ {
struct TrackTransactionState *tts = cls; struct TrackTransactionState *tts = cls;
@ -404,8 +409,7 @@ track_transaction_traits (void *cls,
* @return the command. * @return the command.
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_track_transaction TALER_TESTING_cmd_track_transaction (const char *label,
(const char *label,
const char *transaction_reference, const char *transaction_reference,
unsigned int coin_index, unsigned int coin_index,
unsigned int expected_response_code, unsigned int expected_response_code,
@ -418,7 +422,7 @@ TALER_TESTING_cmd_track_transaction
tts->expected_response_code = expected_response_code; tts->expected_response_code = expected_response_code;
tts->bank_transfer_reference = bank_transfer_reference; tts->bank_transfer_reference = bank_transfer_reference;
tts->coin_index = coin_index; tts->coin_index = coin_index;
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.cls = tts, .cls = tts,
.label = label, .label = label,
@ -429,6 +433,7 @@ TALER_TESTING_cmd_track_transaction
return cmd; return cmd;
} }
}
/** /**
@ -483,8 +488,7 @@ track_transfer_cleanup (void *cls,
* transactions. * transactions.
*/ */
static void static void
track_transfer_cb track_transfer_cb (void *cls,
(void *cls,
unsigned int http_status, unsigned int http_status,
enum TALER_ErrorCode ec, enum TALER_ErrorCode ec,
const struct TALER_ExchangePublicKeyP *exchange_pub, const struct TALER_ExchangePublicKeyP *exchange_pub,
@ -668,7 +672,7 @@ track_transfer_cb
* @param cmd the command under execution. * @param cmd the command under execution.
* @param is the interpreter state. * @param is the interpreter state.
*/ */
void static void
track_transfer_run (void *cls, track_transfer_run (void *cls,
const struct TALER_TESTING_Command *cmd, const struct TALER_TESTING_Command *cmd,
struct TALER_TESTING_Interpreter *is) struct TALER_TESTING_Interpreter *is)
@ -733,8 +737,7 @@ track_transfer_run (void *cls,
* @return the command. * @return the command.
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_track_transfer_empty TALER_TESTING_cmd_track_transfer_empty (const char *label,
(const char *label,
const char *wtid_reference, const char *wtid_reference,
unsigned int index, unsigned int index,
unsigned int expected_response_code) unsigned int expected_response_code)
@ -742,11 +745,10 @@ TALER_TESTING_cmd_track_transfer_empty
struct TrackTransferState *tts; struct TrackTransferState *tts;
tts = GNUNET_new (struct TrackTransferState); tts = GNUNET_new (struct TrackTransferState);
tts->wtid_reference = wtid_reference; tts->wtid_reference = wtid_reference;
tts->index = index; tts->index = index;
tts->expected_response_code = expected_response_code; tts->expected_response_code = expected_response_code;
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.cls = tts, .cls = tts,
.label = label, .label = label,
@ -756,6 +758,7 @@ TALER_TESTING_cmd_track_transfer_empty
return cmd; return cmd;
} }
}
/** /**
@ -775,8 +778,7 @@ TALER_TESTING_cmd_track_transfer_empty
* @return the command * @return the command
*/ */
struct TALER_TESTING_Command struct TALER_TESTING_Command
TALER_TESTING_cmd_track_transfer TALER_TESTING_cmd_track_transfer (const char *label,
(const char *label,
const char *wtid_reference, const char *wtid_reference,
unsigned int index, unsigned int index,
unsigned int expected_response_code, unsigned int expected_response_code,
@ -786,13 +788,12 @@ TALER_TESTING_cmd_track_transfer
struct TrackTransferState *tts; struct TrackTransferState *tts;
tts = GNUNET_new (struct TrackTransferState); tts = GNUNET_new (struct TrackTransferState);
tts->wtid_reference = wtid_reference; tts->wtid_reference = wtid_reference;
tts->index = index; tts->index = index;
tts->expected_response_code = expected_response_code; tts->expected_response_code = expected_response_code;
tts->expected_total_amount = expected_total_amount; tts->expected_total_amount = expected_total_amount;
tts->expected_wire_fee = expected_wire_fee; tts->expected_wire_fee = expected_wire_fee;
{
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.cls = tts, .cls = tts,
.label = label, .label = label,
@ -802,6 +803,7 @@ TALER_TESTING_cmd_track_transfer
return cmd; return cmd;
} }
}
/* end of testing_api_cmd_track.c */ /* end of testing_api_cmd_track.c */

View File

@ -16,9 +16,8 @@
License along with TALER; see the file COPYING. If not, see License along with TALER; see the file COPYING. If not, see
<http://www.gnu.org/licenses/> <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file exchange-lib/testing_api_trait_key_peer.c * @file lib/testing_api_trait_merchant_key.c
* @brief traits to offer peer's (private) keys * @brief traits to offer peer's (private) keys
* @author Marcello Stanisci * @author Marcello Stanisci
*/ */
@ -29,28 +28,28 @@
#include "taler_signatures.h" #include "taler_signatures.h"
#include "taler_testing_lib.h" #include "taler_testing_lib.h"
#define TALER_TESTING_TRAIT_KEY_PEER "key-peer" #define TALER_TESTING_TRAIT_MERCHANT_PRIV "merchant-priv"
#define TALER_TESTING_TRAIT_KEY_PEER_PUB "key-peer-pub" #define TALER_TESTING_TRAIT_MERCHANT_PUB "merchant-pub-pub"
/** /**
* Obtain a private key from a "peer". Used e.g. to obtain * Obtain a private key from a "peer". Used e.g. to obtain
* a merchant's priv to sign a /track request. * a merchant's priv to sign a /track request.
* *
* @param cmd command that is offering the key. * @param cmd command that is offering the key.
* @param index (tipically zero) which key to return if there * @param index (typically zero) which key to return if there
* are multiple on offer. * are multiple on offer.
* @param priv[out] set to the key coming from @a cmd. * @param priv[out] set to the key coming from @a cmd.
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
*/ */
int int
TALER_TESTING_get_trait_peer_key TALER_TESTING_get_trait_merchant_priv
(const struct TALER_TESTING_Command *cmd, (const struct TALER_TESTING_Command *cmd,
unsigned int index, unsigned int index,
const struct GNUNET_CRYPTO_EddsaPrivateKey **priv) const struct TALER_MerchantPrivateKeyP **priv)
{ {
return cmd->traits (cmd->cls, return cmd->traits (cmd->cls,
(const void **) priv, (const void **) priv,
TALER_TESTING_TRAIT_KEY_PEER, TALER_TESTING_TRAIT_MERCHANT_PRIV,
index); index);
} }
@ -59,21 +58,22 @@ TALER_TESTING_get_trait_peer_key
* Offer private key, typically done when CMD_1 needs it to * Offer private key, typically done when CMD_1 needs it to
* sign a request. * sign a request.
* *
* @param index (tipically zero) which key to return if there are * @param index (typically zero) which key to return if there are
* multiple on offer. * multiple on offer.
* @param priv which object should be offered. * @param priv which object should be offered.
* @return the trait. * @return the trait.
*/ */
struct TALER_TESTING_Trait struct TALER_TESTING_Trait
TALER_TESTING_make_trait_peer_key TALER_TESTING_make_trait_merchant_priv (unsigned int index,
(unsigned int index, const struct
const struct GNUNET_CRYPTO_EddsaPrivateKey *priv) TALER_MerchantPrivateKeyP *priv)
{ {
struct TALER_TESTING_Trait ret = { struct TALER_TESTING_Trait ret = {
.index = index, .index = index,
.trait_name = TALER_TESTING_TRAIT_KEY_PEER, .trait_name = TALER_TESTING_TRAIT_MERCHANT_PRIV,
.ptr = (const void *) priv .ptr = (const void *) priv
}; };
return ret; return ret;
} }
@ -83,21 +83,21 @@ TALER_TESTING_make_trait_peer_key
* a merchant's public key to use backend's API. * a merchant's public key to use backend's API.
* *
* @param cmd command offering the key. * @param cmd command offering the key.
* @param index (tipically zero) which key to return if there * @param index (typically zero) which key to return if there
* are multiple on offer. * are multiple on offer.
* @param pub[out] set to the key coming from @a cmd. * @param pub[out] set to the key coming from @a cmd.
* *
* @return #GNUNET_OK on success. * @return #GNUNET_OK on success.
*/ */
int int
TALER_TESTING_get_trait_peer_key_pub TALER_TESTING_get_trait_merchant_pub
(const struct TALER_TESTING_Command *cmd, (const struct TALER_TESTING_Command *cmd,
unsigned int index, unsigned int index,
const struct GNUNET_CRYPTO_EddsaPublicKey **pub) const struct TALER_MerchantPublicKeyP **pub)
{ {
return cmd->traits (cmd->cls, return cmd->traits (cmd->cls,
(const void **) pub, (const void **) pub,
TALER_TESTING_TRAIT_KEY_PEER_PUB, TALER_TESTING_TRAIT_MERCHANT_PUB,
index); index);
} }
@ -105,25 +105,24 @@ TALER_TESTING_get_trait_peer_key_pub
/** /**
* Offer public key. * Offer public key.
* *
* @param index (tipically zero) which key to return if there * @param index (typically zero) which key to return if there
* are multiple on offer. NOTE: if one key is offered, it * are multiple on offer. NOTE: if one key is offered, it
* is mandatory to set this as zero. * is mandatory to set this as zero.
* @param pub which object should be returned. * @param pub which object should be returned.
*
* @return the trait. * @return the trait.
*/ */
struct TALER_TESTING_Trait struct TALER_TESTING_Trait
TALER_TESTING_make_trait_peer_key_pub TALER_TESTING_make_trait_merchant_pub (unsigned int index,
(unsigned int index, struct TALER_MerchantPublicKeyP *pub)
struct GNUNET_CRYPTO_EddsaPublicKey *pub)
{ {
struct TALER_TESTING_Trait ret = { struct TALER_TESTING_Trait ret = {
.index = index, .index = index,
.trait_name = TALER_TESTING_TRAIT_KEY_PEER_PUB, .trait_name = TALER_TESTING_TRAIT_MERCHANT_PUB,
.ptr = (const void *) pub .ptr = (const void *) pub
}; };
return ret; return ret;
} }
/* end of testing_api_trait_key_peer.c */ /* end of testing_api_trait_merchant_key.c */