diff options
Diffstat (limited to 'src/testing')
18 files changed, 285 insertions, 542 deletions
diff --git a/src/testing/.gitignore b/src/testing/.gitignore index a6eb294..9ac5ba4 100644 --- a/src/testing/.gitignore +++ b/src/testing/.gitignore @@ -1,3 +1,6 @@ test_anastasis test_anastasisrest_api -test_anastasis_api_home/.local/share/taler/crypto-* +test_anastasis_api_home/taler/exchange-secmod-* +test_anastasis_api_home/taler/auditor/ +test_anastasis_api_home/taler/exchange/offline-keys/secm_tofus.pub +test_anastasis_api.conf.edited diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index fec971a..22162d3 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am @@ -38,7 +38,6 @@ libanastasistesting_la_LIBADD = \ -lgnunetjson \ -lgnunetutil \ -ljansson \ - -luuid \ -ltalertesting \ $(XLIB) @@ -72,9 +71,8 @@ test_anastasis_LDADD = \ EXTRA_DIST = \ test_anastasis_api.conf \ - test_anastasis_api_home/.config/taler/exchange/account-2.json \ - test_anastasis_api_home/.local/share/taler/exchange/offline-keys/master.priv \ + test_anastasis_api_home/taler/exchange/offline-keys/master.priv \ sms_authentication.sh MOSTLYCLEANFILES = \ - test_anastasis_api_home/.local/share/taler/exchange/offline-keys/secm_tofus.pub + test_anastasis_api_home/taler/exchange/offline-keys/secm_tofus.pub diff --git a/src/testing/test_anastasis.c b/src/testing/test_anastasis.c index 4fa3fb9..f28d9a9 100644 --- a/src/testing/test_anastasis.c +++ b/src/testing/test_anastasis.c @@ -1,6 +1,6 @@ /* This file is part of Anastasis - Copyright (C) 2020, 2021 Anastasis SARL + Copyright (C) 2020-2023 Anastasis SARL Anastasis 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 @@ -52,34 +52,29 @@ #define MERCHANT_ACCOUNT_NAME "3" /** - * Configuration of the bank. + * Credentials for the test. */ -static struct TALER_TESTING_BankConfiguration bc; - -/** - * Configuration of the exchange. - */ -static struct TALER_TESTING_ExchangeConfiguration ec; +static struct TALER_TESTING_Credentials cred; /** * Payto URI of the customer (payer). */ -static char *payer_payto; +static const char *payer_payto; /** * Payto URI of the exchange (escrow account). */ -static char *exchange_payto; +static const char *exchange_payto; /** * Payto URI of the merchant (receiver). */ -static char *merchant_payto; +static const char *merchant_payto; /** * Merchant base URL. */ -static char *merchant_url; +static const char *merchant_url; /** * Anastasis base URL. @@ -92,11 +87,6 @@ static char *anastasis_url; static char *file_secret; /** - * Merchant process. - */ -static struct GNUNET_OS_Process *merchantd; - -/** * Anastasis process. */ static struct GNUNET_OS_Process *anastasisd; @@ -135,7 +125,7 @@ cmd_transfer_to_exchange (const char *label, { return TALER_TESTING_cmd_admin_add_incoming (label, amount, - &bc.exchange_auth, + &cred.ba, payer_payto); } @@ -328,28 +318,29 @@ run (void *cls, struct TALER_TESTING_Command commands[] = { /* general setup */ - TALER_TESTING_cmd_auditor_add ("add-auditor-OK", - MHD_HTTP_NO_CONTENT, - false), - TALER_TESTING_cmd_wire_add ("add-wire-account", - "payto://x-taler-bank/localhost/2", - MHD_HTTP_NO_CONTENT, - false), - TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", - CONFIG_FILE), - TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", - CONFIG_FILE, - "EUR:0.01", - "EUR:0.01", - "EUR:0.01"), - TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys", - 1), + TALER_TESTING_cmd_run_fakebank ("run-fakebank", + cred.cfg, + "exchange-account-exchange"), + TALER_TESTING_cmd_system_start ("start-taler", + CONFIG_FILE, + "-em", + "-u", "exchange-account-exchange", + NULL), + TALER_TESTING_cmd_get_exchange ("get-exchange", + cred.cfg, + NULL, + true, + true), TALER_TESTING_cmd_merchant_post_instances ("instance-create-default", merchant_url, "default", - merchant_payto, - "EUR", MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_post_account ( + "instance-create-default-account", + merchant_url, + merchant_payto, + NULL, NULL, + MHD_HTTP_OK), TALER_TESTING_cmd_batch ("pay", pay), TALER_TESTING_cmd_batch ("anastasis", @@ -357,9 +348,8 @@ run (void *cls, TALER_TESTING_cmd_end () }; - TALER_TESTING_run_with_fakebank (is, - commands, - bc.exchange_auth.wire_gateway_url); + TALER_TESTING_run (is, + commands); } @@ -367,19 +357,7 @@ int main (int argc, char *const *argv) { - unsigned int ret; - /* These environment variables get in the way... */ - unsetenv ("XDG_DATA_HOME"); - unsetenv ("XDG_CONFIG_HOME"); - - GNUNET_log_setup ("test-anastasis", - "DEBUG", - NULL); - if (GNUNET_OK != - TALER_TESTING_prepare_fakebank (CONFIG_FILE, - "exchange-account-exchange", - &bc)) - return 77; + int ret; { char dir[] = "/tmp/test-anastasis-file-XXXXXX"; @@ -394,73 +372,42 @@ main (int argc, "%s/.secret", dir); } - id_data = ANASTASIS_TESTING_make_id_data_example ( - "MaxMuster123456789"); - payer_payto = ("payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME); - exchange_payto = ("payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME); - merchant_payto = ("payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME); - if (NULL == - (merchant_url = TALER_TESTING_prepare_merchant (CONFIG_FILE))) - return 77; - TALER_TESTING_cleanup_files (CONFIG_FILE); + id_data = ANASTASIS_TESTING_make_id_data_example ("MaxMuster123456789"); + payer_payto = + "payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME + "?receiver-name=62"; + exchange_payto = + "payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME + "?receiver-name=exchange"; + merchant_payto = + "payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME + "?receiver-name=merchant"; + merchant_url = "http://localhost:8080/"; if (NULL == (anastasis_url = ANASTASIS_TESTING_prepare_anastasis (CONFIG_FILE))) return 77; - TALER_TESTING_cleanup_files (CONFIG_FILE); - - switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, - GNUNET_YES, - &ec)) + if (NULL == (anastasisd = + ANASTASIS_TESTING_run_anastasis (CONFIG_FILE, + anastasis_url))) { - case GNUNET_SYSERR: - GNUNET_break (0); - return 1; - case GNUNET_NO: - return 77; - case GNUNET_OK: - if (NULL == (merchantd = - TALER_TESTING_run_merchant (CONFIG_FILE, - merchant_url))) - { - GNUNET_break (0); - return 1; - } - if (NULL == (anastasisd = - ANASTASIS_TESTING_run_anastasis (CONFIG_FILE, - anastasis_url))) - { - GNUNET_break (0); - GNUNET_OS_process_kill (merchantd, - SIGTERM); - GNUNET_OS_process_wait (merchantd); - GNUNET_OS_process_destroy (merchantd); - - return 1; - } - ret = TALER_TESTING_setup_with_exchange (&run, - NULL, - CONFIG_FILE); - - GNUNET_OS_process_kill (merchantd, - SIGTERM); - GNUNET_OS_process_kill (anastasisd, - SIGTERM); - GNUNET_OS_process_wait (merchantd); - GNUNET_OS_process_wait (anastasisd); - GNUNET_OS_process_destroy (merchantd); - GNUNET_OS_process_destroy (anastasisd); - GNUNET_free (merchant_url); - GNUNET_free (anastasis_url); - - if (GNUNET_OK != ret) - return 1; - break; - default: GNUNET_break (0); return 1; } - return 0; + ret = TALER_TESTING_main (argv, + "INFO", + CONFIG_FILE, + "exchange-account-exchange", + TALER_TESTING_BS_FAKEBANK, + &cred, + &run, + NULL); + GNUNET_OS_process_kill (anastasisd, + SIGTERM); + GNUNET_OS_process_wait (anastasisd); + GNUNET_OS_process_destroy (anastasisd); + GNUNET_free (anastasis_url); + return ret; } diff --git a/src/testing/test_anastasis_api.c b/src/testing/test_anastasis_api.c index 4d85fed..7d7e2ac 100644 --- a/src/testing/test_anastasis_api.c +++ b/src/testing/test_anastasis_api.c @@ -52,34 +52,29 @@ #define MERCHANT_ACCOUNT_NAME "3" /** - * Configuration of the bank. + * Test credentials. */ -static struct TALER_TESTING_BankConfiguration bc; - -/** - * Configuration of the exchange. - */ -static struct TALER_TESTING_ExchangeConfiguration ec; +static struct TALER_TESTING_Credentials cred; /** * Payto URI of the customer (payer). */ -static char *payer_payto; +static const char *payer_payto; /** * Payto URI of the exchange (escrow account). */ -static char *exchange_payto; +static const char *exchange_payto; /** * Payto URI of the merchant (receiver). */ -static char *merchant_payto; +static const char *merchant_payto; /** * Merchant base URL. */ -static char *merchant_url; +static const char *merchant_url; /** * Anastasis base URL. @@ -87,11 +82,6 @@ static char *merchant_url; static char *anastasis_url; /** - * Merchant process. - */ -static struct GNUNET_OS_Process *merchantd; - -/** * Anastasis process. */ static struct GNUNET_OS_Process *anastasisd; @@ -129,7 +119,7 @@ cmd_transfer_to_exchange (const char *label, { return TALER_TESTING_cmd_admin_add_incoming (label, amount, - &bc.exchange_auth, + &cred.ba, payer_payto); } @@ -276,28 +266,29 @@ run (void *cls, struct TALER_TESTING_Command commands[] = { /* general setup */ - TALER_TESTING_cmd_auditor_add ("add-auditor-OK", - MHD_HTTP_NO_CONTENT, - false), - TALER_TESTING_cmd_wire_add ("add-wire-account", - "payto://x-taler-bank/localhost/2", - MHD_HTTP_NO_CONTENT, - false), - TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", - CONFIG_FILE), - TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", - CONFIG_FILE, - "EUR:0.01", - "EUR:0.01", - "EUR:0.01"), - TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys", - 1), + TALER_TESTING_cmd_run_fakebank ("run-fakebank", + cred.cfg, + "exchange-account-exchange"), + TALER_TESTING_cmd_system_start ("start-taler", + CONFIG_FILE, + "-em", + "-u", "exchange-account-exchange", + NULL), + TALER_TESTING_cmd_get_exchange ("get-exchange", + cred.cfg, + NULL, + true, + true), TALER_TESTING_cmd_merchant_post_instances ("instance-create-default", merchant_url, "default", - merchant_payto, - "EUR", MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_post_account ( + "instance-create-default-account", + merchant_url, + merchant_payto, + NULL, NULL, + MHD_HTTP_OK), ANASTASIS_TESTING_cmd_config ("salt-request-1", anastasis_url, MHD_HTTP_OK), @@ -310,9 +301,8 @@ run (void *cls, TALER_TESTING_cmd_end () }; - TALER_TESTING_run_with_fakebank (is, - commands, - bc.exchange_auth.wire_gateway_url); + TALER_TESTING_run (is, + commands); } @@ -322,17 +312,6 @@ main (int argc, { int ret; - /* These environment variables get in the way... */ - unsetenv ("XDG_DATA_HOME"); - unsetenv ("XDG_CONFIG_HOME"); - GNUNET_log_setup ("test-anastasis-api", - "DEBUG", - NULL); - if (GNUNET_OK != - TALER_TESTING_prepare_fakebank (CONFIG_FILE, - "exchange-account-exchange", - &bc)) - return 77; { char dir[] = "/tmp/test-anastasis-file-XXXXXX"; @@ -347,73 +326,41 @@ main (int argc, "%s/.secret", dir); } - payer_payto = ("payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME); - exchange_payto = ("payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME); - merchant_payto = ("payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME); - if (NULL == - (merchant_url = TALER_TESTING_prepare_merchant (CONFIG_FILE))) - return 77; - TALER_TESTING_cleanup_files (CONFIG_FILE); + payer_payto = + "payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME + "?receiver-name=62"; + exchange_payto = + "payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME + "?receiver-name=exchange"; + merchant_payto = + "payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME + "?receiver-name=merchant"; + merchant_url = "http://localhost:8080/"; if (NULL == (anastasis_url = ANASTASIS_TESTING_prepare_anastasis (CONFIG_FILE))) return 77; - TALER_TESTING_cleanup_files (CONFIG_FILE); - - switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, - GNUNET_YES, - &ec)) + if (NULL == (anastasisd = + ANASTASIS_TESTING_run_anastasis (CONFIG_FILE, + anastasis_url))) { - case GNUNET_SYSERR: - GNUNET_break (0); - return 1; - case GNUNET_NO: - return 77; - case GNUNET_OK: - if (NULL == (merchantd = - TALER_TESTING_run_merchant (CONFIG_FILE, - merchant_url))) - { - GNUNET_break (0); - return 1; - } - if (NULL == (anastasisd = - ANASTASIS_TESTING_run_anastasis (CONFIG_FILE, - anastasis_url))) - { - GNUNET_break (0); - GNUNET_OS_process_kill (merchantd, - SIGTERM); - GNUNET_OS_process_wait (merchantd); - GNUNET_OS_process_destroy (merchantd); - return 1; - } - ret = TALER_TESTING_setup_with_exchange (&run, - NULL, - CONFIG_FILE); - GNUNET_OS_process_kill (merchantd, - SIGTERM); - GNUNET_OS_process_kill (anastasisd, - SIGTERM); - GNUNET_OS_process_wait (merchantd); - GNUNET_OS_process_wait (anastasisd); - GNUNET_OS_process_destroy (merchantd); - GNUNET_OS_process_destroy (anastasisd); - GNUNET_free (merchant_url); - GNUNET_free (anastasis_url); - - if (GNUNET_OK != ret) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Test failed in interpreter\n"); - return 1; - } - break; - default: GNUNET_break (0); return 1; } - return 0; + ret = TALER_TESTING_main (argv, + "INFO", + CONFIG_FILE, + "exchange-account-exchange", + TALER_TESTING_BS_FAKEBANK, + &cred, + &run, + NULL); + GNUNET_OS_process_kill (anastasisd, + SIGTERM); + GNUNET_OS_process_wait (anastasisd); + GNUNET_OS_process_destroy (anastasisd); + GNUNET_free (anastasis_url); + return ret; } diff --git a/src/testing/test_anastasis_api.conf b/src/testing/test_anastasis_api.conf index 3dfc6ba..53801d4 100644 --- a/src/testing/test_anastasis_api.conf +++ b/src/testing/test_anastasis_api.conf @@ -1,231 +1,125 @@ # This file is in the public domain. # [PATHS] -# Persistent data storage for the testcase TALER_TEST_HOME = test_anastasis_api_home/ -TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/${USER:-}/taler-system-runtime/ - -# Persistent data storage -TALER_DATA_HOME = $TALER_TEST_HOME/.local/share/taler/ - -# Configuration files -TALER_CONFIG_HOME = $TALER_TEST_HOME/.config/taler/ - -# Cached data, no big deal if lost -TALER_CACHE_HOME = $TALER_TEST_HOME/.cache/taler/ +TALER_HOME = ${TALER_TEST_HOME:-${HOME:-${USERPROFILE}}} +TALER_DATA_HOME = ${TALER_TEST_HOME:-${XDG_DATA_HOME:-${TALER_HOME}/.local/share/}/.local/share/}taler/ +TALER_CONFIG_HOME = ${TALER_TEST_HOME:-${XDG_CONFIG_HOME:-${TALER_HOME}/.config/}/.config/}taler/ +TALER_CACHE_HOME = ${TALER_TEST_HOME:-${XDG_CACHE_HOME:-${TALER_HOME}/.cache/}/.cache/}taler/ +TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/taler-system-runtime/ [taler] -# What currency do we use? -#currency = EUR -currency = EUR -#CURRENCY_ROUND_UNIT = EUR:0.01 -#CURRENCY_ROUND_UNIT = EUR:0.01 +CURRENCY = EUR +CURRENCY_ROUND_UNIT = EUR:0.01 [taler-helper-crypto-rsa] -# Reduce from 1 year to speed up test LOOKAHEAD_SIGN = 12 days [taler-helper-crypto-eddsa] -# Reduce from 1 year to speed up test LOOKAHEAD_SIGN = 12 days -# Reduce from 12 weeks to ensure we have multiple DURATION = 7 days - [bank] HTTP_PORT = 8082 -#BASE_URL = https://bank.test.taler.net/ +BASE_URL = http://localhost:8082/ -########################################## -# Configuration for Anastasis # -########################################## +[libeufin-bank] +CURRENCY = EUR +WIRE_TYPE = iban +IBAN_PAYTO_BIC = SANDBOXX +DEFAULT_CUSTOMER_DEBT_LIMIT = EUR:200 +DEFAULT_ADMIN_DEBT_LIMIT = EUR:2000 +REGISTRATION_BONUS_ENABLED = yes +REGISTRATION_BONUS = EUR:100 +SUGGESTED_WITHDRAWAL_EXCHANGE = http://localhost:8081/ +SERVE = tcp +PORT = 8082 [anastasis] PORT = 8086 - DB = postgres - BUSINESS_NAME = "Checker's Test Inc." - -# Upload limit UPLOAD_LIMIT_MB = 1 - ANNUAL_POLICY_UPLOAD_LIMIT = 64 - INSURANCE = EUR:0 - PROVIDER_SALT = salty - - -# Annual fee we charge. -#ANNUAL_FEE = EUR:4.99 ANNUAL_FEE = EUR:4.99 - TRUTH_UPLOAD_FEE = EUR:0.0 - -# Base URL of anastasis. -# BASE_URL = http://localhost:8086/ +BASE_URL = http://localhost:8086/ [anastasis-merchant-backend] -# Where does our payment backend run? Must match PORT under [merchant] PAYMENT_BACKEND_URL = http://localhost:8080/ -# Authentication costs [authorization-question] -# Cost of authentication by question COST = EUR:0 [authorization-file] -# Cost of authentication by file (only for testing purposes) COST = EUR:1 [authorization-email] -# Cost of authentication by E-Mail COST = EUR:0 [authorization-sms] -# Cost of authentication by SMS COST = EUR:0 - -# Command which is executed for the sms authentication COMMAND = ./sms_authentication.sh - - - -# This specifies which database the postgres backend uses. [stasis-postgres] CONFIG = postgres:///anastasischeck -########################################## -# Configuration for the merchant backend # -########################################## - [merchant] - -# Which port do we run the backend on? (HTTP server) PORT = 8080 - -# How quickly do we want the exchange to send us our money? -# Used only if the frontend does not specify a value. WIRE_TRANSFER_DELAY = 0 s - -# Which plugin (backend) do we use for the DB. DB = postgres -# Default choice for maximum wire fee. -DEFAULT_MAX_WIRE_FEE = EUR:0.10 - -# Default choice for maximum deposit fee. -DEFAULT_MAX_DEPOSIT_FEE = EUR:0.10 - - -# This specifies which database the postgres backend uses. [merchantdb-postgres] CONFIG = postgres:///talercheck -# Sections starting with "exchange-" specify trusted exchanges -# (by the merchant) [merchant-exchange-default] MASTER_KEY = T1VVFQZZARQ1CMF4BN58EE7SKTW5AV2BS18S87ZEGYS4S29J6DNG EXCHANGE_BASE_URL = http://localhost:8081/ -#MASTER_KEY = DY95EXAHQ2BKM2WK9YHZHYG1R7PPMMJPY14FNGP662DAKE35AKQG -#EXCHANGE_BASE_URL = https://exchange.test.taler.net/ -#CURRENCY = EUR CURRENCY = EUR -# only fixes skips. [auditor] -BASE_URL = http://the.auditor/ -#BASE_URL = https://auditor.test.taler.net/ -#AUDITOR_KEY = DSDASDXAMDAARMNAD53ZA4AFAHA2QADAMAHHASWDAWXN84SDAA11 -# If currency does not match [TALER] section, the auditor -# will be ignored! -CURRENCY = EUR - -# Where do we store the auditor's private key? -AUDITOR_PRIV_FILE = ${TALER_DATA_HOME}/auditor/offline-keys/auditor.priv - -# Auditors must be in sections "auditor-", the rest of the section -# name could be anything. -[auditor-ezb] -# Informal name of the auditor. Just for the user. -NAME = European Central Bank - -# URL of the auditor (especially for in the future, when the -# auditor offers an automated issue reporting system). -# Not really used today. -URL = http://taler.ezb.eu/ - -# This is the important bit: the signing key of the auditor. -PUBLIC_KEY = 9QXF7XY7E9VPV47B5Z806NDFSX2VJ79SVHHD29QEQ3BG31ANHZ60 - -# Which currency is this auditor trusted for? -CURRENCY = EUR - - -################################################### -# Configuration for the exchange for the testcase # -################################################### +PORT = 8083 +BASE_URL = "http://localhost:8083/" [exchange] -# How to access our database +AML_THRESHOLD = EUR:1000000 DB = postgres - -# HTTP port the exchange listens to PORT = 8081 - -# how long are the signatures with the signkey valid? SIGNKEY_LEGAL_DURATION = 2 years - -# Our public key MASTER_PUBLIC_KEY = T1VVFQZZARQ1CMF4BN58EE7SKTW5AV2BS18S87ZEGYS4S29J6DNG - -# Base URL of the exchange. BASE_URL = "http://localhost:8081/" -#BASE_URL = https://exchange.test.taler.net/ - -# Network configuration for the normal API/service HTTP server -# serve via tcp socket (on PORT) SERVE = tcp +STEFAN_ABS = "EUR:5" [exchange-offline] - -# Where do we store the offline master private key of the exchange? MASTER_PRIV_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/master.priv -# Where do we store the TOFU key material? SECM_TOFU_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/secm_tofus.pub - [taler-exchange-secmod-eddsa] -# Where do we store the generated private keys. KEY_DIR = ${TALER_DATA_HOME}/exchange-secmod-eddsa/keys [taler-exchange-secmod-rsa] -# Where do we store the generated private keys. KEY_DIR = ${TALER_DATA_HOME}/exchange-secmod-rsa/keys +[taler-exchange-secmod-cs] +KEY_DIR = ${TALER_DATA_HOME}/exchange-secmod-cs/keys -[exchangedb-postgres] -CONFIG = "postgres:///talercheck" -[auditordb-postgres] +[exchangedb-postgres] CONFIG = "postgres:///talercheck" -# Account of the EXCHANGE [exchange-account-exchange] -# What is the exchange's bank account (with the "Taler Bank" demo system)? -PAYTO_URI = "payto://x-taler-bank/localhost:8082/2" +PAYTO_URI = "payto://x-taler-bank/localhost:8082/2?receiver-name=exchange" ENABLE_DEBIT = YES ENABLE_CREDIT = YES [exchange-accountcredentials-exchange] -WIRE_GATEWAY_URL = "http://localhost:8082/2/" +WIRE_GATEWAY_URL = "http://localhost:8082/accounts/2/taler-wire-gateway/" WIRE_GATEWAY_AUTH_METHOD = NONE - - [coin_eur_ct_1] value = EUR:0.01 duration_withdraw = 7 days diff --git a/src/testing/test_anastasis_api_home/.config/taler/exchange/account-2.json b/src/testing/test_anastasis_api_home/.config/taler/exchange/account-2.json deleted file mode 100644 index f798275..0000000 --- a/src/testing/test_anastasis_api_home/.config/taler/exchange/account-2.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "payto_uri": "payto://x-taler-bank/localhost:8082/2", - "master_sig": "AM32QB4RYMWK548PE63PJXJMWSA001TFFWTZZPSSD8HQ8JE4D5V5X8WTSYSX59ANF4YRTRMF5Q4Q12CE2KTA8KQ03CM11YDTK75SJ20"} diff --git a/src/testing/test_anastasis_api_home/.local/share/taler/exchange/offline-keys/master.priv b/src/testing/test_anastasis_api_home/taler/exchange-offline/master.priv index c20942d..c20942d 100644 --- a/src/testing/test_anastasis_api_home/.local/share/taler/exchange/offline-keys/master.priv +++ b/src/testing/test_anastasis_api_home/taler/exchange-offline/master.priv diff --git a/src/testing/test_anastasis_api_home/taler/exchange/offline-keys/master.priv b/src/testing/test_anastasis_api_home/taler/exchange/offline-keys/master.priv new file mode 100644 index 0000000..c20942d --- /dev/null +++ b/src/testing/test_anastasis_api_home/taler/exchange/offline-keys/master.priv @@ -0,0 +1 @@ +k;d_U}A.w"!Gv_m"_
\ No newline at end of file diff --git a/src/testing/testing_api_cmd_config.c b/src/testing/testing_api_cmd_config.c index 92a8ae1..542e140 100644 --- a/src/testing/testing_api_cmd_config.c +++ b/src/testing/testing_api_cmd_config.c @@ -61,39 +61,26 @@ struct ConfigState * Function called with the results of a #ANASTASIS_get_config(). * * @param cls closure - * @param http_status HTTP status of the request * @param config config from the server */ static void config_cb (void *cls, - unsigned int http_status, const struct ANASTASIS_Config *config) { struct ConfigState *ss = cls; ss->so = NULL; - if (http_status != ss->http_status) + if (config->http_status != ss->http_status) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected response code %u to command %s in %s:%u\n", - http_status, - ss->is->commands[ss->is->ip].label, - __FILE__, - __LINE__); - TALER_TESTING_interpreter_fail (ss->is); + TALER_TESTING_unexpected_status (ss->is, + config->http_status, + ss->http_status); return; } - if (NULL == config) + if (GNUNET_OK == config->http_status) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Config is NULL, command %s in %s:%u\n", - ss->is->commands[ss->is->ip].label, - __FILE__, - __LINE__); - TALER_TESTING_interpreter_fail (ss->is); - return; + ss->provider_salt = config->details.ok.provider_salt; } - ss->provider_salt = config->provider_salt; TALER_TESTING_interpreter_next (ss->is); } @@ -113,10 +100,11 @@ config_run (void *cls, struct ConfigState *ss = cls; ss->is = is; - ss->so = ANASTASIS_get_config (is->ctx, - ss->anastasis_url, - &config_cb, - ss); + ss->so = ANASTASIS_get_config ( + TALER_TESTING_interpreter_get_context (is), + ss->anastasis_url, + &config_cb, + ss); if (NULL == ss->so) { GNUNET_break (0); diff --git a/src/testing/testing_api_cmd_policy_lookup.c b/src/testing/testing_api_cmd_policy_lookup.c index 1f59b12..2d854c5 100644 --- a/src/testing/testing_api_cmd_policy_lookup.c +++ b/src/testing/testing_api_cmd_policy_lookup.c @@ -72,32 +72,26 @@ struct PolicyLookupState * Function called with the results of a #ANASTASIS_policy_lookup(). * * @param cls closure - * @param http_status HTTP status of the request * @param dd details about the lookup operation */ static void policy_lookup_cb (void *cls, - unsigned int http_status, const struct ANASTASIS_DownloadDetails *dd) { struct PolicyLookupState *pls = cls; pls->plo = NULL; - if (http_status != pls->http_status) + if (dd->http_status != pls->http_status) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected response code %u to command %s in %s:%u\n", - http_status, - pls->is->commands[pls->is->ip].label, - __FILE__, - __LINE__); - TALER_TESTING_interpreter_fail (pls->is); + TALER_TESTING_unexpected_status (pls->is, + dd->http_status, + pls->http_status); return; } if (NULL != pls->upload_reference) { - if ( (MHD_HTTP_OK == http_status) && - (0 != GNUNET_memcmp (&dd->curr_policy_hash, + if ( (MHD_HTTP_OK == dd->http_status) && + (0 != GNUNET_memcmp (&dd->details.ok.curr_policy_hash, pls->upload_hash)) ) { GNUNET_break (0); @@ -156,11 +150,12 @@ policy_lookup_run (void *cls, } pls->anastasis_pub = *anastasis_pub; } - pls->plo = ANASTASIS_policy_lookup (is->ctx, - pls->anastasis_url, - &pls->anastasis_pub, - &policy_lookup_cb, - pls); + pls->plo = ANASTASIS_policy_lookup ( + TALER_TESTING_interpreter_get_context (is), + pls->anastasis_url, + &pls->anastasis_pub, + &policy_lookup_cb, + pls); if (NULL == pls->plo) { GNUNET_break (0); diff --git a/src/testing/testing_api_cmd_policy_store.c b/src/testing/testing_api_cmd_policy_store.c index f23489d..edc753d 100644 --- a/src/testing/testing_api_cmd_policy_store.c +++ b/src/testing/testing_api_cmd_policy_store.c @@ -139,13 +139,9 @@ policy_store_cb (void *cls, pss->pso = NULL; if (ud->http_status != pss->http_status) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected response code %u to command %s in %s:%u\n", - ud->http_status, - pss->is->commands[pss->is->ip].label, - __FILE__, - __LINE__); - TALER_TESTING_interpreter_fail (pss->is); + TALER_TESTING_unexpected_status (pss->is, + ud->http_status, + pss->http_status); return; } switch (ud->us) @@ -276,7 +272,7 @@ policy_store_run (void *cls, pss->recovery_data_size, &pss->curr_hash); pss->pso = ANASTASIS_policy_store ( - is->ctx, + TALER_TESTING_interpreter_get_context (is), pss->anastasis_url, &pss->anastasis_priv, pss->recovery_data, @@ -340,8 +336,7 @@ policy_store_traits (void *cls, struct PolicyStoreState *pss = cls; struct TALER_TESTING_Trait traits[] = { TALER_TESTING_make_trait_claim_token (&pss->claim_token), - TALER_TESTING_make_trait_order_id ( - (const char **) &pss->order_id), + TALER_TESTING_make_trait_order_id (pss->order_id), ANASTASIS_TESTING_make_trait_hash (&pss->curr_hash), ANASTASIS_TESTING_make_trait_account_pub (&pss->anastasis_pub), ANASTASIS_TESTING_make_trait_account_priv (&pss->anastasis_priv), diff --git a/src/testing/testing_api_cmd_truth_challenge.c b/src/testing/testing_api_cmd_truth_challenge.c index f1384c4..c399345 100644 --- a/src/testing/testing_api_cmd_truth_challenge.c +++ b/src/testing/testing_api_cmd_truth_challenge.c @@ -100,13 +100,9 @@ truth_challenge_cb (void *cls, ksls->tco = NULL; if (tcd->http_status != ksls->expected_http_status) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected response code %u to command %s in %s:%u\n", - tcd->http_status, - ksls->is->commands[ksls->is->ip].label, - __FILE__, - __LINE__); - TALER_TESTING_interpreter_fail (ksls->is); + TALER_TESTING_unexpected_status (ksls->is, + tcd->http_status, + ksls->expected_http_status); return; } switch (tcd->http_status) @@ -268,13 +264,14 @@ truth_challenge_run (void *cls, payment_secret = NULL; } - ksls->tco = ANASTASIS_truth_challenge (is->ctx, - ksls->anastasis_url, - truth_uuid, - truth_key, - payment_secret, - &truth_challenge_cb, - ksls); + ksls->tco = ANASTASIS_truth_challenge ( + TALER_TESTING_interpreter_get_context (is), + ksls->anastasis_url, + truth_uuid, + truth_key, + payment_secret, + &truth_challenge_cb, + ksls); if (NULL == ksls->tco) { GNUNET_break (0); @@ -325,12 +322,9 @@ truth_challenge_traits (void *cls, struct TALER_TESTING_Trait traits[] = { ANASTASIS_TESTING_make_trait_payment_secret ( &ksls->payment_secret_response), - TALER_TESTING_make_trait_payto_uri ( - (const char **) ksls->pay_uri), - TALER_TESTING_make_trait_order_id ( - (const char **) &ksls->order_id), - ANASTASIS_TESTING_make_trait_code ( - (const char **) &ksls->code), + TALER_TESTING_make_trait_payto_uri (ksls->pay_uri), + TALER_TESTING_make_trait_order_id (ksls->order_id), + ANASTASIS_TESTING_make_trait_code (ksls->code), TALER_TESTING_trait_end () }; diff --git a/src/testing/testing_api_cmd_truth_solve.c b/src/testing/testing_api_cmd_truth_solve.c index 5c12b3f..29157ed 100644 --- a/src/testing/testing_api_cmd_truth_solve.c +++ b/src/testing/testing_api_cmd_truth_solve.c @@ -127,13 +127,9 @@ truth_solve_cb (void *cls, ksls->tso = NULL; if (tsr->http_status != ksls->expected_http_status) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected response code %u to command %s in %s:%u\n", - tsr->http_status, - ksls->is->commands[ksls->is->ip].label, - __FILE__, - __LINE__); - TALER_TESTING_interpreter_fail (ksls->is); + TALER_TESTING_unexpected_status (ksls->is, + tsr->http_status, + ksls->expected_http_status); return; } switch (tsr->http_status) @@ -163,7 +159,7 @@ truth_solve_run (void *cls, const struct ANASTASIS_CRYPTO_TruthKeyP *truth_key; const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid; const struct ANASTASIS_PaymentSecretP *payment_secret; - const char **answerp; + const char *answer; ksls->is = is; if (NULL == ksls->upload_reference) @@ -185,7 +181,7 @@ truth_solve_run (void *cls, return; } { - const char **fn; + const char *fn; if (GNUNET_OK != ANASTASIS_TESTING_get_trait_filename (upload_cmd, @@ -195,8 +191,8 @@ truth_solve_run (void *cls, TALER_TESTING_interpreter_fail (ksls->is); return; } - if (NULL != *fn) - ksls->filename = GNUNET_strdup (*fn); + if (NULL != fn) + ksls->filename = GNUNET_strdup (fn); } if (GNUNET_OK != ANASTASIS_TESTING_get_trait_truth_uuid (upload_cmd, @@ -242,13 +238,13 @@ truth_solve_run (void *cls, } if (GNUNET_OK != ANASTASIS_TESTING_get_trait_code (download_cmd, - &answerp)) + &answer)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (ksls->is); return; } - if (NULL == *answerp) + if (NULL == answer) { GNUNET_break (0); TALER_TESTING_interpreter_fail (ksls->is); @@ -258,9 +254,9 @@ truth_solve_run (void *cls, else { /* answer is the answer */ - answerp = &ksls->answer; + answer = ksls->answer; } - if (NULL == answerp) + if (NULL == answer) { GNUNET_break (0); TALER_TESTING_interpreter_fail (ksls->is); @@ -291,18 +287,19 @@ truth_solve_run (void *cls, { struct GNUNET_HashCode h_answer; - GNUNET_CRYPTO_hash (*answerp, - strlen (*answerp), + GNUNET_CRYPTO_hash (answer, + strlen (answer), &h_answer); - ksls->tso = ANASTASIS_truth_solve (is->ctx, - ksls->anastasis_url, - truth_uuid, - truth_key, - payment_secret, - GNUNET_TIME_UNIT_ZERO, - &h_answer, - &truth_solve_cb, - ksls); + ksls->tso = ANASTASIS_truth_solve ( + TALER_TESTING_interpreter_get_context (is), + ksls->anastasis_url, + truth_uuid, + truth_key, + payment_secret, + GNUNET_TIME_UNIT_ZERO, + &h_answer, + &truth_solve_cb, + ksls); } if (NULL == ksls->tso) { @@ -356,12 +353,9 @@ truth_solve_traits (void *cls, struct TALER_TESTING_Trait traits[] = { ANASTASIS_TESTING_make_trait_payment_secret ( &ksls->payment_secret_response), - TALER_TESTING_make_trait_payto_uri ( - (const char **) ksls->pay_uri), - TALER_TESTING_make_trait_order_id ( - (const char **) &ksls->order_id), - ANASTASIS_TESTING_make_trait_code ( - (const char **) &ksls->code), + TALER_TESTING_make_trait_payto_uri (ksls->pay_uri), + TALER_TESTING_make_trait_order_id (ksls->order_id), + ANASTASIS_TESTING_make_trait_code (ksls->code), TALER_TESTING_trait_end () }; diff --git a/src/testing/testing_api_cmd_truth_store.c b/src/testing/testing_api_cmd_truth_store.c index 0972210..f7a6ece 100644 --- a/src/testing/testing_api_cmd_truth_store.c +++ b/src/testing/testing_api_cmd_truth_store.c @@ -125,16 +125,11 @@ truth_store_cb (void *cls, struct TruthStoreState *tss = cls; tss->tso = NULL; - if ( (NULL == ud) || - (ud->http_status != tss->http_status) ) + if (ud->http_status != tss->http_status) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected response code %u to command %s in %s:%u\n", - (NULL != ud) ? ud->http_status : 0, - tss->is->commands[tss->is->ip].label, - __FILE__, - __LINE__); - TALER_TESTING_interpreter_fail (tss->is); + TALER_TESTING_unexpected_status (tss->is, + ud->http_status, + tss->http_status); return; } switch (ud->us) @@ -273,7 +268,7 @@ truth_store_run (void *cls, GNUNET_free (t); } tss->tso = ANASTASIS_truth_store ( - is->ctx, + TALER_TESTING_interpreter_get_context (is), tss->anastasis_url, &tss->uuid, tss->method, @@ -345,10 +340,8 @@ truth_store_traits (void *cls, ANASTASIS_TESTING_make_trait_truth_key (&tss->key), ANASTASIS_TESTING_make_trait_eks (&tss->encrypted_keyshare), ANASTASIS_TESTING_make_trait_payment_secret (&tss->payment_secret_response), - TALER_TESTING_make_trait_payto_uri ( - (const char **) &tss->pay_uri), - ANASTASIS_TESTING_make_trait_filename ( - (const char **) &tss->filename), + TALER_TESTING_make_trait_payto_uri (tss->pay_uri), + ANASTASIS_TESTING_make_trait_filename (tss->filename), TALER_TESTING_trait_end () }; diff --git a/src/testing/testing_cmd_challenge_answer.c b/src/testing/testing_cmd_challenge_answer.c index 8e5e2d8..ad24861 100644 --- a/src/testing/testing_cmd_challenge_answer.c +++ b/src/testing/testing_cmd_challenge_answer.c @@ -249,7 +249,7 @@ challenge_answer_run (void *cls, if (1 == cs->mode) { const struct TALER_TESTING_Command *ref; - const char **answer; + const char *answer; unsigned long long code; char dummy; @@ -270,7 +270,7 @@ challenge_answer_run (void *cls, return; } if (1 != - sscanf (*answer, + sscanf (answer, "%llu%c", &code, &dummy)) @@ -544,14 +544,11 @@ challenge_create_traits (void *cls, { struct ChallengeState *cs = cls; struct TALER_TESTING_Trait traits[] = { - ANASTASIS_TESTING_make_trait_code ( - (const char **) &cs->code), + ANASTASIS_TESTING_make_trait_code (cs->code), ANASTASIS_TESTING_make_trait_payment_secret ( &cs->payment_order_req), - TALER_TESTING_make_trait_payto_uri ( - (const char **) cs->payment_uri), - TALER_TESTING_make_trait_order_id ( - (const char **) &cs->order_id), + TALER_TESTING_make_trait_payto_uri (cs->payment_uri), + TALER_TESTING_make_trait_order_id (cs->order_id), TALER_TESTING_trait_end () }; diff --git a/src/testing/testing_cmd_recover_secret.c b/src/testing/testing_cmd_recover_secret.c index 3b12012..1f3e832 100644 --- a/src/testing/testing_cmd_recover_secret.c +++ b/src/testing/testing_cmd_recover_secret.c @@ -74,7 +74,7 @@ struct RecoverSecretState /** * Coresecret to check if decryption worked */ - const void **core_secret; + const void *core_secret; /** * Task scheduled to wait for recovery to complete. @@ -108,13 +108,19 @@ policy_lookup_cb (void *cls, { struct RecoverSecretState *rss = cls; - rss->ri = (struct ANASTASIS_RecoveryInformation *) ri; if (NULL == ri) { GNUNET_break (0); TALER_TESTING_interpreter_fail (rss->is); return; } + if (0 == ri->cs_len) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (rss->is); + return; + } + rss->ri = (struct ANASTASIS_RecoveryInformation *) ri; TALER_TESTING_interpreter_next (rss->is); } @@ -146,7 +152,7 @@ core_secret_cb (void *cls, return; } if (0 != memcmp (secret, - *rss->core_secret, + rss->core_secret, secret_size)) { GNUNET_break (0); @@ -188,9 +194,9 @@ recover_secret_run (void *cls, if (NULL != rss->download_reference) { - ref = TALER_TESTING_interpreter_lookup_command - (is, - rss->download_reference); + ref = TALER_TESTING_interpreter_lookup_command ( + is, + rss->download_reference); if (NULL == ref) { GNUNET_break (0); @@ -220,22 +226,23 @@ recover_secret_run (void *cls, if (GNUNET_OK != ANASTASIS_TESTING_get_trait_core_secret ( ref, - (const void ***) &rss->core_secret)) + &rss->core_secret)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (rss->is); return; } } - rss->recovery = ANASTASIS_recovery_begin (is->ctx, - rss->id_data, - rss->version, - rss->anastasis_url, - provider_salt, - &policy_lookup_cb, - rss, - &core_secret_cb, - rss); + rss->recovery = ANASTASIS_recovery_begin ( + TALER_TESTING_interpreter_get_context (is), + rss->id_data, + rss->version, + rss->anastasis_url, + provider_salt, + &policy_lookup_cb, + rss, + &core_secret_cb, + rss); if (NULL == rss->recovery) { GNUNET_break (0); @@ -301,7 +308,7 @@ recover_secret_cleanup (void *cls, * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue recover_secret_traits (void *cls, const void **ret, const char *trait, diff --git a/src/testing/testing_cmd_secret_share.c b/src/testing/testing_cmd_secret_share.c index 26a237d..3c401d2 100644 --- a/src/testing/testing_cmd_secret_share.c +++ b/src/testing/testing_cmd_secret_share.c @@ -135,14 +135,7 @@ secret_share_result_cb (void *cls, sss->sso = NULL; if (sr->ss != sss->want_status) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected response code %u to command %s in %s:%u\n", - sr->ss, - sss->is->commands[sss->is->ip].label, - __FILE__, - __LINE__); TALER_TESTING_interpreter_fail (sss->is); - return; } switch (sr->ss) { @@ -225,7 +218,7 @@ secret_share_run (void *cls, if (NULL != sss->prev_secret_share) { const struct TALER_TESTING_Command *ref; - const char **order_id; + const char *order_id; ref = TALER_TESTING_interpreter_lookup_command (is, sss->prev_secret_share); @@ -243,8 +236,7 @@ secret_share_run (void *cls, TALER_TESTING_interpreter_fail (sss->is); return; } - sss->payment_order_id = (char *) *order_id; - + sss->payment_order_id = GNUNET_strdup (order_id); if (NULL == sss->payment_order_id) { GNUNET_break (0); @@ -296,19 +288,20 @@ secret_share_run (void *cls, pds.provider_salt = *provider_salt; } - sss->sso = ANASTASIS_secret_share (is->ctx, - sss->id_data, - &pds, - 1, - policies, - sss->cmd_label_array_length, - false, - GNUNET_TIME_UNIT_ZERO, - &secret_share_result_cb, - sss, - "test-case", - sss->core_secret, - sss->core_secret_size); + sss->sso = ANASTASIS_secret_share ( + TALER_TESTING_interpreter_get_context (is), + sss->id_data, + &pds, + 1, + policies, + sss->cmd_label_array_length, + false, + GNUNET_TIME_UNIT_ZERO, + &secret_share_result_cb, + sss, + "test-case", + sss->core_secret, + sss->core_secret_size); if (NULL == sss->sso) { GNUNET_break (0); @@ -366,9 +359,8 @@ secret_share_traits (void *cls, struct SecretShareState *sss = cls; struct TALER_TESTING_Trait traits[] = { TALER_TESTING_make_trait_claim_token (&sss->token), - ANASTASIS_TESTING_make_trait_core_secret (&sss->core_secret), - TALER_TESTING_make_trait_order_id ( - (const char **) &sss->payment_order_id), + ANASTASIS_TESTING_make_trait_core_secret (sss->core_secret), + TALER_TESTING_make_trait_order_id (sss->payment_order_id), TALER_TESTING_trait_end () }; diff --git a/src/testing/testing_cmd_truth_upload.c b/src/testing/testing_cmd_truth_upload.c index 89ba790..2e3523b 100644 --- a/src/testing/testing_cmd_truth_upload.c +++ b/src/testing/testing_cmd_truth_upload.c @@ -208,19 +208,20 @@ truth_upload_run (void *cls, ANASTASIS_CRYPTO_user_identifier_derive (tus->id_data, provider_salt, &user_id); - tus->tuo = ANASTASIS_truth_upload (is->ctx, - &user_id, - tus->anastasis_url, - tus->method, - tus->instructions, - tus->mime_type, - provider_salt, - tus->truth_data, - tus->truth_data_size, - false, /* force payment */ - GNUNET_TIME_UNIT_ZERO, - &truth_upload_cb, - tus); + tus->tuo = ANASTASIS_truth_upload ( + TALER_TESTING_interpreter_get_context (is), + &user_id, + tus->anastasis_url, + tus->method, + tus->instructions, + tus->mime_type, + provider_salt, + tus->truth_data, + tus->truth_data_size, + false, /* force payment */ + GNUNET_TIME_UNIT_ZERO, + &truth_upload_cb, + tus); if (NULL == tus->tuo) { GNUNET_break (0); |