aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-07-28 16:24:41 +0200
committerChristian Grothoff <christian@grothoff.org>2024-07-29 12:18:49 +0200
commit5f042c913f5a43ffb587bf3c0c9f3c4c3597d197 (patch)
tree7339379b1cd6b953028da7d2b75d14c46351521e
parentd608d40dc5604eecbd631b12ecfc9324c38b588c (diff)
downloadexchange-5f042c913f5a43ffb587bf3c0c9f3c4c3597d197.tar.xz
fix push/pull of test_kyc_api
-rw-r--r--src/testing/test_kyc_api.c2
-rw-r--r--src/testing/testing_api_cmd_bank_admin_add_incoming.c47
-rw-r--r--src/testing/testing_api_cmd_reserve_purse.c98
3 files changed, 94 insertions, 53 deletions
diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c
index 6a7f29a3c..eb4d71690 100644
--- a/src/testing/test_kyc_api.c
+++ b/src/testing/test_kyc_api.c
@@ -715,14 +715,12 @@ run (void *cls,
TALER_TESTING_cmd_batch (
"p2p_withdraw",
p2p_withdraw),
-#if FIXME
TALER_TESTING_cmd_batch (
"push",
push),
TALER_TESTING_cmd_batch (
"pull",
pull),
-#endif
TALER_TESTING_cmd_batch ("aml",
aml),
TALER_TESTING_cmd_end ()
diff --git a/src/testing/testing_api_cmd_bank_admin_add_incoming.c b/src/testing/testing_api_cmd_bank_admin_add_incoming.c
index d4d9878bd..61ffd7f31 100644
--- a/src/testing/testing_api_cmd_bank_admin_add_incoming.c
+++ b/src/testing/testing_api_cmd_bank_admin_add_incoming.c
@@ -78,7 +78,7 @@ struct AdminAddIncomingState
* Set (by the interpreter) to the reserve's private key
* we used to make a wire transfer subject line with.
*/
- struct TALER_ReservePrivateKeyP reserve_priv;
+ union TALER_AccountPrivateKeyP account_priv;
/**
* Whether we know the private key or not.
@@ -86,9 +86,9 @@ struct AdminAddIncomingState
bool reserve_priv_known;
/**
- * Reserve public key matching @e reserve_priv.
+ * Account public key matching @e account_priv.
*/
- struct TALER_ReservePublicKeyP reserve_pub;
+ union TALER_AccountPublicKeyP account_pub;
/**
* Handle to the pending request at the bank.
@@ -321,20 +321,23 @@ admin_add_incoming_run (void *cls,
TALER_TESTING_get_trait_reserve_priv (ref,
&reserve_priv))
{
- if (GNUNET_OK != TALER_TESTING_get_trait_reserve_pub (ref,
- &reserve_pub))
+ if (GNUNET_OK !=
+ TALER_TESTING_get_trait_reserve_pub (ref,
+ &reserve_pub))
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
return;
}
have_public = true;
- fts->reserve_pub.eddsa_pub = reserve_pub->eddsa_pub;
+ fts->account_pub.reserve_pub.eddsa_pub
+ = reserve_pub->eddsa_pub;
fts->reserve_priv_known = false;
}
else
{
- fts->reserve_priv.eddsa_priv = reserve_priv->eddsa_priv;
+ fts->account_priv.reserve_priv.eddsa_priv
+ = reserve_priv->eddsa_priv;
fts->reserve_priv_known = true;
}
}
@@ -342,12 +345,14 @@ admin_add_incoming_run (void *cls,
{
/* No referenced reserve to take priv
* from, no explicit subject given: create new key! */
- GNUNET_CRYPTO_eddsa_key_create (&fts->reserve_priv.eddsa_priv);
+ GNUNET_CRYPTO_eddsa_key_create (
+ &fts->account_priv.reserve_priv.eddsa_priv);
fts->reserve_priv_known = true;
}
if (! have_public)
- GNUNET_CRYPTO_eddsa_key_get_public (&fts->reserve_priv.eddsa_priv,
- &fts->reserve_pub.eddsa_pub);
+ GNUNET_CRYPTO_eddsa_key_get_public (
+ &fts->account_priv.reserve_priv.eddsa_priv,
+ &fts->account_pub.reserve_pub.eddsa_pub);
fts->reserve_history.type = TALER_EXCHANGE_RTT_CREDIT;
fts->reserve_history.amount = fts->amount;
fts->reserve_history.details.in_details.sender_url
@@ -356,7 +361,7 @@ admin_add_incoming_run (void *cls,
= TALER_BANK_admin_add_incoming (
TALER_TESTING_interpreter_get_context (is),
&fts->auth,
- &fts->reserve_pub,
+ &fts->account_pub.reserve_pub,
&fts->amount,
fts->payto_debit_account,
&confirmation_cb,
@@ -434,8 +439,14 @@ admin_add_incoming_traits (void *cls,
TALER_TESTING_make_trait_amount (&fts->amount),
TALER_TESTING_make_trait_timestamp (0,
&fts->timestamp),
- TALER_TESTING_make_trait_reserve_priv (&fts->reserve_priv),
- TALER_TESTING_make_trait_reserve_pub (&fts->reserve_pub),
+ TALER_TESTING_make_trait_reserve_priv (
+ &fts->account_priv.reserve_priv),
+ TALER_TESTING_make_trait_reserve_pub (
+ &fts->account_pub.reserve_pub),
+ TALER_TESTING_make_trait_account_priv (
+ &fts->account_priv),
+ TALER_TESTING_make_trait_account_pub (
+ &fts->account_pub),
TALER_TESTING_make_trait_reserve_history (0,
&fts->reserve_history),
TALER_TESTING_trait_end ()
@@ -458,9 +469,13 @@ admin_add_incoming_traits (void *cls,
TALER_TESTING_make_trait_amount (&fts->amount),
TALER_TESTING_make_trait_timestamp (0,
&fts->timestamp),
- TALER_TESTING_make_trait_reserve_pub (&fts->reserve_pub),
- TALER_TESTING_make_trait_reserve_history (0,
- &fts->reserve_history),
+ TALER_TESTING_make_trait_reserve_pub (
+ &fts->account_pub.reserve_pub),
+ TALER_TESTING_make_trait_account_pub (
+ &fts->account_pub),
+ TALER_TESTING_make_trait_reserve_history (
+ 0,
+ &fts->reserve_history),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_api_cmd_reserve_purse.c b/src/testing/testing_api_cmd_reserve_purse.c
index ef6964f26..923542082 100644
--- a/src/testing/testing_api_cmd_reserve_purse.c
+++ b/src/testing/testing_api_cmd_reserve_purse.c
@@ -42,14 +42,14 @@ struct ReservePurseState
struct GNUNET_TIME_Timestamp merge_timestamp;
/**
- * Reserve private key.
+ * Account (reserve) private key.
*/
- struct TALER_ReservePrivateKeyP reserve_priv;
+ union TALER_AccountPrivateKeyP account_priv;
/**
- * Reserve public key.
+ * Account (reserve) public key.
*/
- struct TALER_ReservePublicKeyP reserve_pub;
+ union TALER_AccountPublicKeyP account_pub;
/**
* Reserve signature generated for the request
@@ -199,18 +199,26 @@ purse_run (void *cls,
TALER_TESTING_interpreter_fail (ds->is);
return;
}
- ds->reserve_priv = *reserve_priv;
- GNUNET_CRYPTO_eddsa_key_create (&ds->purse_priv.eddsa_priv);
- GNUNET_CRYPTO_eddsa_key_get_public (&ds->purse_priv.eddsa_priv,
- &ds->purse_pub.eddsa_pub);
- GNUNET_CRYPTO_eddsa_key_get_public (&ds->reserve_priv.eddsa_priv,
- &ds->reserve_pub.eddsa_pub);
- GNUNET_CRYPTO_eddsa_key_create (&ds->merge_priv.eddsa_priv);
- GNUNET_CRYPTO_eddsa_key_get_public (&ds->merge_priv.eddsa_priv,
- &ds->merge_pub.eddsa_pub);
- GNUNET_CRYPTO_ecdhe_key_create (&ds->contract_priv.ecdhe_priv);
- ds->purse_expiration = GNUNET_TIME_absolute_to_timestamp (
- GNUNET_TIME_relative_to_absolute (ds->expiration_rel));
+ ds->account_priv.reserve_priv = *reserve_priv;
+ GNUNET_CRYPTO_eddsa_key_create (
+ &ds->purse_priv.eddsa_priv);
+ GNUNET_CRYPTO_eddsa_key_get_public (
+ &ds->purse_priv.eddsa_priv,
+ &ds->purse_pub.eddsa_pub);
+ GNUNET_CRYPTO_eddsa_key_get_public (
+ &ds->account_priv.reserve_priv.eddsa_priv,
+ &ds->account_pub.reserve_pub.eddsa_pub);
+ GNUNET_CRYPTO_eddsa_key_create (
+ &ds->merge_priv.eddsa_priv);
+ GNUNET_CRYPTO_eddsa_key_get_public (
+ &ds->merge_priv.eddsa_priv,
+ &ds->merge_pub.eddsa_pub);
+ GNUNET_CRYPTO_ecdhe_key_create (
+ &ds->contract_priv.ecdhe_priv);
+ ds->purse_expiration
+ = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_relative_to_absolute (
+ ds->expiration_rel));
{
char *payto_uri;
@@ -225,11 +233,15 @@ purse_run (void *cls,
TALER_TESTING_interpreter_fail (is);
return;
}
- GNUNET_assert (GNUNET_OK ==
- TALER_TESTING_get_trait_exchange_url (exchange_cmd,
- &exchange_url));
- payto_uri = TALER_reserve_make_payto (exchange_url,
- &ds->reserve_pub);
+ GNUNET_assert (
+ GNUNET_OK ==
+ TALER_TESTING_get_trait_exchange_url (
+ exchange_cmd,
+ &exchange_url));
+ payto_uri
+ = TALER_reserve_make_payto (
+ exchange_url,
+ &ds->account_pub.reserve_pub);
TALER_payto_hash (payto_uri,
&ds->h_payto);
GNUNET_free (payto_uri);
@@ -245,7 +257,7 @@ purse_run (void *cls,
TALER_TESTING_interpreter_get_context (is),
TALER_TESTING_get_exchange_url (is),
TALER_TESTING_get_keys (is),
- &ds->reserve_priv,
+ &ds->account_priv.reserve_priv,
&ds->purse_priv,
&ds->merge_priv,
&ds->contract_priv,
@@ -308,19 +320,35 @@ purse_traits (void *cls,
{
struct ReservePurseState *ds = cls;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_timestamp (0,
- &ds->merge_timestamp),
- TALER_TESTING_make_trait_contract_terms (ds->contract_terms),
- TALER_TESTING_make_trait_purse_priv (&ds->purse_priv),
- TALER_TESTING_make_trait_purse_pub (&ds->purse_pub),
- TALER_TESTING_make_trait_merge_priv (&ds->merge_priv),
- TALER_TESTING_make_trait_merge_pub (&ds->merge_pub),
- TALER_TESTING_make_trait_contract_priv (&ds->contract_priv),
- TALER_TESTING_make_trait_reserve_priv (&ds->reserve_priv),
- TALER_TESTING_make_trait_reserve_pub (&ds->reserve_pub),
- TALER_TESTING_make_trait_reserve_sig (&ds->reserve_sig),
- TALER_TESTING_make_trait_legi_requirement_row (&ds->requirement_row),
- TALER_TESTING_make_trait_h_payto (&ds->h_payto),
+ TALER_TESTING_make_trait_timestamp (
+ 0,
+ &ds->merge_timestamp),
+ TALER_TESTING_make_trait_contract_terms (
+ ds->contract_terms),
+ TALER_TESTING_make_trait_purse_priv (
+ &ds->purse_priv),
+ TALER_TESTING_make_trait_purse_pub (
+ &ds->purse_pub),
+ TALER_TESTING_make_trait_merge_priv (
+ &ds->merge_priv),
+ TALER_TESTING_make_trait_merge_pub (
+ &ds->merge_pub),
+ TALER_TESTING_make_trait_contract_priv (
+ &ds->contract_priv),
+ TALER_TESTING_make_trait_account_priv (
+ &ds->account_priv),
+ TALER_TESTING_make_trait_account_pub (
+ &ds->account_pub),
+ TALER_TESTING_make_trait_reserve_priv (
+ &ds->account_priv.reserve_priv),
+ TALER_TESTING_make_trait_reserve_pub (
+ &ds->account_pub.reserve_pub),
+ TALER_TESTING_make_trait_reserve_sig (
+ &ds->reserve_sig),
+ TALER_TESTING_make_trait_legi_requirement_row (
+ &ds->requirement_row),
+ TALER_TESTING_make_trait_h_payto (
+ &ds->h_payto),
TALER_TESTING_trait_end ()
};