more traits
This commit is contained in:
parent
82b0eda3ef
commit
6ba7747ac3
@ -39,11 +39,14 @@ libtalertesting_la_LDFLAGS = \
|
||||
-version-info 0:0:0 \
|
||||
-no-undefined
|
||||
libtalertesting_la_SOURCES = \
|
||||
testing_api_cmd_fakebank_transfer.c \
|
||||
testing_api_loop.c \
|
||||
testing_api_traits.c \
|
||||
testing_api_cmd_fakebank_transfer.c \
|
||||
testing_api_trait_reserve_priv.c \
|
||||
testing_api_trait_coin_priv.c
|
||||
testing_api_trait_blinding_key.c \
|
||||
testing_api_trait_coin_priv.c \
|
||||
testing_api_trait_denom_pub.c \
|
||||
testing_api_trait_denom_sig.c \
|
||||
testing_api_trait_reserve_priv.c
|
||||
|
||||
libtalertesting_la_LIBADD = \
|
||||
$(top_builddir)/src/json/libtalerjson.la \
|
||||
|
@ -157,27 +157,37 @@ fakebank_transfer_run (void *cls,
|
||||
else
|
||||
{
|
||||
/* Use reserve public key as subject */
|
||||
#if FIXME_NEEDS_TRAIT
|
||||
if (NULL != fts->reserve_reference)
|
||||
{
|
||||
ref = find_command (is,
|
||||
fts->reserve_reference);
|
||||
GNUNET_assert (NULL != ref);
|
||||
GNUNET_assert (OC_ADMIN_ADD_INCOMING == ref->oc);
|
||||
// FIXME: needs trait...
|
||||
fts->reserve_priv = ref->details.admin_add_incoming.reserve_priv;
|
||||
const struct TALER_TESTING_Command *ref;
|
||||
struct TALER_ReservePrivateKeyP *reserve_priv;
|
||||
|
||||
ref = TALER_TESTING_interpreter_lookup_command (is,
|
||||
fts->reserve_reference);
|
||||
if (NULL == ref)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
TALER_TESTING_interpreter_fail (is);
|
||||
return;
|
||||
}
|
||||
if (GNUNET_OK !=
|
||||
TALER_TESTING_get_trait_reserve_priv (ref,
|
||||
NULL,
|
||||
&reserve_priv))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
TALER_TESTING_interpreter_fail (is);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
|
||||
|
||||
priv = GNUNET_CRYPTO_eddsa_key_create ();
|
||||
fts->reserve_priv.eddsa_priv = *priv;
|
||||
GNUNET_free (priv);
|
||||
#if FIXME_NEEDS_TRAIT
|
||||
}
|
||||
#endif
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (&fts->reserve_priv.eddsa_priv,
|
||||
&reserve_pub.eddsa_pub);
|
||||
subject = GNUNET_STRINGS_data_to_string_alloc (&reserve_pub,
|
||||
|
67
src/exchange-lib/testing_api_trait_blinding_key.c
Normal file
67
src/exchange-lib/testing_api_trait_blinding_key.c
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
This file is part of TALER
|
||||
Copyright (C) 2018 Taler Systems SA
|
||||
|
||||
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
|
||||
Foundation; either version 3, or (at your option) any later version.
|
||||
|
||||
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
TALER; see the file COPYING. If not, see
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file exchange-lib/testing_api_trait_blinding_key.c
|
||||
* @brief main interpreter loop for testcases
|
||||
* @author Christian Grothoff
|
||||
* @author Marcello Stanisci
|
||||
*/
|
||||
#include "platform.h"
|
||||
#include "taler_json_lib.h"
|
||||
#include <gnunet/gnunet_curl_lib.h>
|
||||
#include "exchange_api_handle.h"
|
||||
#include "taler_signatures.h"
|
||||
#include "taler_testing_lib.h"
|
||||
|
||||
#define TALER_TESTING_TRAIT_BLINDING_KEY "blinding-key"
|
||||
|
||||
|
||||
/**
|
||||
* Obtain a blinding key from a @a cmd.
|
||||
*
|
||||
* @param cmd command to extract trait from
|
||||
* @param selector which coin to pick if @a cmd has multiple on offer
|
||||
* @param blinding_key[out] set to the blinding key of the coin
|
||||
* @return #GNUNET_OK on success
|
||||
*/
|
||||
int
|
||||
TALER_TESTING_get_trait_blinding_key (const struct TALER_TESTING_Command *cmd,
|
||||
const char *selector,
|
||||
struct TALER_DenominationBlindingKeyP **blinding_key)
|
||||
{
|
||||
return cmd->traits (cmd->cls,
|
||||
(void **) blinding_key,
|
||||
TALER_TESTING_TRAIT_BLINDING_KEY,
|
||||
selector);
|
||||
}
|
||||
|
||||
|
||||
struct TALER_TESTING_Trait
|
||||
TALER_TESTING_make_trait_blinding_key (const char *selector,
|
||||
const struct TALER_DenominationBlindingKeyP *blinding_key)
|
||||
{
|
||||
struct TALER_TESTING_Trait ret = {
|
||||
.selector = selector,
|
||||
.trait_name = TALER_TESTING_TRAIT_BLINDING_KEY,
|
||||
.ptr = (const void *) blinding_key
|
||||
};
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* end of testing_api_trait_blinding_key.c */
|
@ -15,7 +15,7 @@
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file exchange-lib/testing_api_traits.c
|
||||
* @file exchange-lib/testing_api_trait_coin_priv.c
|
||||
* @brief main interpreter loop for testcases
|
||||
* @author Christian Grothoff
|
||||
* @author Marcello Stanisci
|
||||
|
67
src/exchange-lib/testing_api_trait_denom_pub.c
Normal file
67
src/exchange-lib/testing_api_trait_denom_pub.c
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
This file is part of TALER
|
||||
Copyright (C) 2018 Taler Systems SA
|
||||
|
||||
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
|
||||
Foundation; either version 3, or (at your option) any later version.
|
||||
|
||||
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
TALER; see the file COPYING. If not, see
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file exchange-lib/testing_api_trait_denom_pub.c
|
||||
* @brief main interpreter loop for testcases
|
||||
* @author Christian Grothoff
|
||||
* @author Marcello Stanisci
|
||||
*/
|
||||
#include "platform.h"
|
||||
#include "taler_json_lib.h"
|
||||
#include <gnunet/gnunet_curl_lib.h>
|
||||
#include "exchange_api_handle.h"
|
||||
#include "taler_signatures.h"
|
||||
#include "taler_testing_lib.h"
|
||||
|
||||
#define TALER_TESTING_TRAIT_DENOM_PUB "denomination-public-key"
|
||||
|
||||
|
||||
/**
|
||||
* Obtain a denomination public key from a @a cmd.
|
||||
*
|
||||
* @param cmd command to extract trait from
|
||||
* @param selector which coin to pick if @a cmd has multiple on offer
|
||||
* @param denom_pub[out] set to the blinding key of the coin
|
||||
* @return #GNUNET_OK on success
|
||||
*/
|
||||
int
|
||||
TALER_TESTING_get_trait_denom_pub (const struct TALER_TESTING_Command *cmd,
|
||||
const char *selector,
|
||||
struct TALER_EXCHANGE_DenomPublicKey **denom_pub)
|
||||
{
|
||||
return cmd->traits (cmd->cls,
|
||||
(void **) denom_pub,
|
||||
TALER_TESTING_TRAIT_DENOM_PUB,
|
||||
selector);
|
||||
}
|
||||
|
||||
|
||||
struct TALER_TESTING_Trait
|
||||
TALER_TESTING_make_trait_denom_pub (const char *selector,
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *denom_pub)
|
||||
{
|
||||
struct TALER_TESTING_Trait ret = {
|
||||
.selector = selector,
|
||||
.trait_name = TALER_TESTING_TRAIT_DENOM_PUB,
|
||||
.ptr = (const void *) denom_pub
|
||||
};
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* end of testing_api_trait_denom_pub.c */
|
67
src/exchange-lib/testing_api_trait_denom_sig.c
Normal file
67
src/exchange-lib/testing_api_trait_denom_sig.c
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
This file is part of TALER
|
||||
Copyright (C) 2018 Taler Systems SA
|
||||
|
||||
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
|
||||
Foundation; either version 3, or (at your option) any later version.
|
||||
|
||||
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
TALER; see the file COPYING. If not, see
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file exchange-lib/testing_api_trait_denom_sig.c
|
||||
* @brief main interpreter loop for testcases
|
||||
* @author Christian Grothoff
|
||||
* @author Marcello Stanisci
|
||||
*/
|
||||
#include "platform.h"
|
||||
#include "taler_json_lib.h"
|
||||
#include <gnunet/gnunet_curl_lib.h>
|
||||
#include "exchange_api_handle.h"
|
||||
#include "taler_signatures.h"
|
||||
#include "taler_testing_lib.h"
|
||||
|
||||
#define TALER_TESTING_TRAIT_DENOM_SIG "denomination-signature"
|
||||
|
||||
|
||||
/**
|
||||
* Obtain a denomination signature from a @a cmd.
|
||||
*
|
||||
* @param cmd command to extract trait from
|
||||
* @param selector which signature to pick if @a cmd has multiple on offer
|
||||
* @param denom_sig[out] set to the signature
|
||||
* @return #GNUNET_OK on success
|
||||
*/
|
||||
int
|
||||
TALER_TESTING_get_trait_denom_sig (const struct TALER_TESTING_Command *cmd,
|
||||
const char *selector,
|
||||
struct TALER_DenominationSignature **denom_sig)
|
||||
{
|
||||
return cmd->traits (cmd->cls,
|
||||
(void **) denom_sig,
|
||||
TALER_TESTING_TRAIT_DENOM_SIG,
|
||||
selector);
|
||||
}
|
||||
|
||||
|
||||
struct TALER_TESTING_Trait
|
||||
TALER_TESTING_make_trait_denom_sig (const char *selector,
|
||||
const struct TALER_DenominationSignature *denom_sig)
|
||||
{
|
||||
struct TALER_TESTING_Trait ret = {
|
||||
.selector = selector,
|
||||
.trait_name = TALER_TESTING_TRAIT_DENOM_SIG,
|
||||
.ptr = (const void *) denom_sig
|
||||
};
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* end of testing_api_trait_denom_sig.c */
|
@ -257,6 +257,81 @@ TALER_TESTING_get_trait_coin_priv (const struct TALER_TESTING_Command *cmd,
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param selector
|
||||
*/
|
||||
struct TALER_TESTING_Trait
|
||||
TALER_TESTING_make_trait_blinding_key (const char *selector,
|
||||
const struct TALER_DenominationBlindingKeyP *blinding_key);
|
||||
|
||||
|
||||
/**
|
||||
* Obtain a coin's blinding key from a @a cmd.
|
||||
*
|
||||
* @param cmd command to extract trait from
|
||||
* @param selector which coin to pick if @a cmd has multiple on offer
|
||||
* @param blinding_key[out] set to the blinding key of the coin
|
||||
* @return #GNUNET_OK on success
|
||||
*/
|
||||
int
|
||||
TALER_TESTING_get_trait_blinding_key (const struct TALER_TESTING_Command *cmd,
|
||||
const char *selector,
|
||||
struct TALER_DenominationBlindingKeyP **blinding_key);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param selector
|
||||
*/
|
||||
struct TALER_TESTING_Trait
|
||||
TALER_TESTING_make_trait_denom_pub (const char *selector,
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *dpk);
|
||||
|
||||
|
||||
/**
|
||||
* Obtain a coin private key from a @a cmd.
|
||||
*
|
||||
* @param cmd command to extract trait from
|
||||
* @param selector which coin to pick if @a cmd has multiple on offer
|
||||
* @param dpk[out] set to a denomination key of the coin
|
||||
* @return #GNUNET_OK on success
|
||||
*/
|
||||
int
|
||||
TALER_TESTING_get_trait_denom_pub (const struct TALER_TESTING_Command *cmd,
|
||||
const char *selector,
|
||||
struct TALER_EXCHANGE_DenomPublicKey **dpk);
|
||||
|
||||
|
||||
/**
|
||||
* Obtain a coin denomination signature from a @a cmd.
|
||||
*
|
||||
* @param cmd command to extract trait from
|
||||
* @param selector which coin to pick if @a cmd has multiple on offer
|
||||
* @param sig[out] set to a denomination signature over the coin
|
||||
* @return #GNUNET_OK on success
|
||||
*/
|
||||
int
|
||||
TALER_TESTING_get_trait_denom_sig (const struct TALER_TESTING_Command *cmd,
|
||||
const char *selector,
|
||||
struct TALER_DenominationSignature **dpk);
|
||||
|
||||
|
||||
/**
|
||||
* @param selector
|
||||
*/
|
||||
struct TALER_TESTING_Trait
|
||||
TALER_TESTING_make_trait_denom_sig (const char *selector,
|
||||
const struct TALER_DenominationSignature *sig);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user