diff options
92 files changed, 902 insertions, 1604 deletions
diff --git a/src/bank-lib/bank_api_admin_add_incoming.c b/src/bank-lib/bank_api_admin_add_incoming.c index ffc89ccc5..403160163 100644 --- a/src/bank-lib/bank_api_admin_add_incoming.c +++ b/src/bank-lib/bank_api_admin_add_incoming.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2015--2023 Taler Systems SA + Copyright (C) 2015--2024 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 @@ -159,7 +159,7 @@ TALER_BANK_admin_add_incoming ( const struct TALER_BANK_AuthenticationData *auth, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_Amount *amount, - const char *debit_account, + const struct TALER_FullPayto debit_account, TALER_BANK_AdminAddIncomingCallback res_cb, void *res_cb_cls) { @@ -167,7 +167,7 @@ TALER_BANK_admin_add_incoming ( json_t *admin_obj; CURL *eh; - if (NULL == debit_account) + if (NULL == debit_account.full_payto) { GNUNET_break (0); return NULL; @@ -187,8 +187,8 @@ TALER_BANK_admin_add_incoming ( reserve_pub), TALER_JSON_pack_amount ("amount", amount), - GNUNET_JSON_pack_string ("debit_account", - debit_account)); + TALER_JSON_pack_full_payto ("debit_account", + debit_account)); if (NULL == admin_obj) { GNUNET_break (0); diff --git a/src/bank-lib/bank_api_admin_add_kycauth.c b/src/bank-lib/bank_api_admin_add_kycauth.c index 1660305b1..8f347cc30 100644 --- a/src/bank-lib/bank_api_admin_add_kycauth.c +++ b/src/bank-lib/bank_api_admin_add_kycauth.c @@ -154,7 +154,7 @@ TALER_BANK_admin_add_kycauth ( const struct TALER_BANK_AuthenticationData *auth, const union TALER_AccountPublicKeyP *account_pub, const struct TALER_Amount *amount, - const char *debit_account, + const struct TALER_FullPayto debit_account, TALER_BANK_AdminAddKycauthCallback res_cb, void *res_cb_cls) { @@ -162,7 +162,7 @@ TALER_BANK_admin_add_kycauth ( json_t *admin_obj; CURL *eh; - if (NULL == debit_account) + if (NULL == debit_account.full_payto) { GNUNET_break (0); return NULL; @@ -182,8 +182,8 @@ TALER_BANK_admin_add_kycauth ( account_pub), TALER_JSON_pack_amount ("amount", amount), - GNUNET_JSON_pack_string ("debit_account", - debit_account)); + TALER_JSON_pack_full_payto ("debit_account", + debit_account)); if (NULL == admin_obj) { GNUNET_break (0); diff --git a/src/bank-lib/bank_api_credit.c b/src/bank-lib/bank_api_credit.c index dc92b064a..c461fe614 100644 --- a/src/bank-lib/bank_api_credit.c +++ b/src/bank-lib/bank_api_credit.c @@ -86,8 +86,8 @@ parse_account_history (struct TALER_BANK_CreditHistoryHandle *hh, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_array_const ("incoming_transactions", &history_array), - TALER_JSON_spec_payto_uri ("credit_account", - &chr.details.ok.credit_account_uri), + TALER_JSON_spec_full_payto_uri ("credit_account", + &chr.details.ok.credit_account_uri), GNUNET_JSON_spec_end () }; @@ -118,8 +118,8 @@ parse_account_history (struct TALER_BANK_CreditHistoryHandle *hh, &td->execution_date), GNUNET_JSON_spec_uint64 ("row_id", &td->serial_id), - TALER_JSON_spec_payto_uri ("debit_account", - &td->debit_account_uri), + TALER_JSON_spec_full_payto_uri ("debit_account", + &td->debit_account_uri), GNUNET_JSON_spec_end () }; json_t *transaction = json_array_get (history_array, diff --git a/src/bank-lib/bank_api_debit.c b/src/bank-lib/bank_api_debit.c index 62bf66c0f..df9140687 100644 --- a/src/bank-lib/bank_api_debit.c +++ b/src/bank-lib/bank_api_debit.c @@ -86,8 +86,8 @@ parse_account_history (struct TALER_BANK_DebitHistoryHandle *hh, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_array_const ("outgoing_transactions", &history_array), - TALER_JSON_spec_payto_uri ("debit_account", - &dhr.details.ok.debit_account_uri), + TALER_JSON_spec_full_payto_uri ("debit_account", + &dhr.details.ok.debit_account_uri), GNUNET_JSON_spec_end () }; @@ -117,8 +117,8 @@ parse_account_history (struct TALER_BANK_DebitHistoryHandle *hh, &td->serial_id), GNUNET_JSON_spec_fixed_auto ("wtid", &td->wtid), - TALER_JSON_spec_payto_uri ("credit_account", - &td->credit_account_uri), + TALER_JSON_spec_full_payto_uri ("credit_account", + &td->credit_account_uri), TALER_JSON_spec_web_url ("exchange_base_url", &td->exchange_base_url), GNUNET_JSON_spec_end () diff --git a/src/bank-lib/bank_api_transfer.c b/src/bank-lib/bank_api_transfer.c index 0748a0d7e..affb8b6ce 100644 --- a/src/bank-lib/bank_api_transfer.c +++ b/src/bank-lib/bank_api_transfer.c @@ -68,15 +68,16 @@ GNUNET_NETWORK_STRUCT_END void TALER_BANK_prepare_transfer ( - const char *destination_account_payto_uri, + const struct TALER_FullPayto destination_account_payto_uri, const struct TALER_Amount *amount, const char *exchange_base_url, const struct TALER_WireTransferIdentifierRawP *wtid, void **buf, size_t *buf_size) { + const char *payto = destination_account_payto_uri.full_payto; struct WirePackP *wp; - size_t d_len = strlen (destination_account_payto_uri) + 1; + size_t d_len = strlen (payto) + 1; size_t u_len = strlen (exchange_base_url) + 1; char *end; @@ -100,7 +101,7 @@ TALER_BANK_prepare_transfer ( wp->exchange_url_len = htonl ((uint32_t) u_len); end = (char *) &wp[1]; GNUNET_memcpy (end, - destination_account_payto_uri, + payto, d_len); GNUNET_memcpy (end + d_len, exchange_base_url, diff --git a/src/bank-lib/taler-exchange-wire-gateway-client.c b/src/bank-lib/taler-exchange-wire-gateway-client.c index 2f8499a38..477bb750e 100644 --- a/src/bank-lib/taler-exchange-wire-gateway-client.c +++ b/src/bank-lib/taler-exchange-wire-gateway-client.c @@ -44,12 +44,12 @@ static struct TALER_Amount amount; /** * Credit account payto://-URI. */ -static char *credit_account; +static struct TALER_FullPayto credit_account; /** * Debit account payto://-URI. */ -static char *debit_account; +static struct TALER_FullPayto debit_account; /** * Wire transfer subject. @@ -185,13 +185,13 @@ credit_history_cb (void *cls, &reply->details.ok.details[i]; /* If credit/debit accounts were specified, use as a filter */ - if ( (NULL != credit_account) && - (0 != strcasecmp (credit_account, - reply->details.ok.credit_account_uri) ) ) + if ( (NULL != credit_account.full_payto) && + (0 != TALER_full_payto_cmp (credit_account, + reply->details.ok.credit_account_uri) ) ) continue; - if ( (NULL != debit_account) && - (0 != strcasecmp (debit_account, - cd->debit_account_uri) ) ) + if ( (NULL != debit_account.full_payto) && + (0 != TALER_full_payto_cmp (debit_account, + cd->debit_account_uri) ) ) continue; switch (cd->type) { @@ -199,8 +199,8 @@ credit_history_cb (void *cls, fprintf (stdout, "%llu: %s->%s (%s) over %s at %s\n", (unsigned long long) cd->serial_id, - cd->debit_account_uri, - reply->details.ok.credit_account_uri, + cd->debit_account_uri.full_payto, + reply->details.ok.credit_account_uri.full_payto, TALER_B2S (&cd->details.reserve.reserve_pub), TALER_amount2s (&cd->amount), GNUNET_TIME_timestamp2s (cd->execution_date)); @@ -209,8 +209,8 @@ credit_history_cb (void *cls, fprintf (stdout, "%llu: %s->%s (KYC:%s) over %s at %s\n", (unsigned long long) cd->serial_id, - cd->debit_account_uri, - reply->details.ok.credit_account_uri, + cd->debit_account_uri.full_payto, + reply->details.ok.credit_account_uri.full_payto, TALER_B2S (&cd->details.kycauth.account_pub), TALER_amount2s (&cd->amount), GNUNET_TIME_timestamp2s (cd->execution_date)); @@ -303,19 +303,19 @@ debit_history_cb (void *cls, &reply->details.ok.details[i]; /* If credit/debit accounts were specified, use as a filter */ - if ( (NULL != credit_account) && - (0 != strcasecmp (credit_account, - dd->credit_account_uri) ) ) + if ( (NULL != credit_account.full_payto) && + (0 != TALER_full_payto_cmp (credit_account, + dd->credit_account_uri) ) ) continue; - if ( (NULL != debit_account) && - (0 != strcasecmp (debit_account, - reply->details.ok.debit_account_uri) ) ) + if ( (NULL != debit_account.full_payto) && + (0 != TALER_full_payto_cmp (debit_account, + reply->details.ok.debit_account_uri) ) ) continue; fprintf (stdout, "%llu: %s->%s (%s) over %s at %s\n", (unsigned long long) dd->serial_id, - reply->details.ok.debit_account_uri, - dd->credit_account_uri, + reply->details.ok.debit_account_uri.full_payto, + dd->credit_account_uri.full_payto, TALER_B2S (&dd->wtid), TALER_amount2s (&dd->amount), GNUNET_TIME_timestamp2s (dd->execution_date)); @@ -413,7 +413,7 @@ execute_wire_transfer (void) size_t buf_size; char *params; - if (NULL != debit_account) + if (NULL != debit_account.full_payto) { fprintf (stderr, "Invalid option -C specified, conflicts with -D\n"); @@ -445,7 +445,7 @@ execute_wire_transfer (void) &wtid, sizeof (wtid)); } - params = strchr (credit_account, + params = strchr (credit_account.full_payto, (unsigned char) '&'); if (NULL != params) *params = '\0'; @@ -662,12 +662,12 @@ run (void *cls, execute_debit_history (); return; } - if (NULL != credit_account) + if (NULL != credit_account.full_payto) { execute_wire_transfer (); return; } - if (NULL != debit_account) + if (NULL != debit_account.full_payto) { execute_admin_transfer (); return; @@ -706,12 +706,12 @@ main (int argc, "credit", "ACCOUNT", "payto URI of the bank account to credit (when making outgoing transfers)", - &credit_account), + &credit_account.full_payto), GNUNET_GETOPT_option_string ('D', "debit", "PAYTO-URL", "payto URI of the bank account to debit (when making incoming transfers)", - &debit_account), + &debit_account.full_payto), GNUNET_GETOPT_option_flag ('i', "credit-history", "Ask to get a list of 10 incoming transactions.", diff --git a/src/exchangedb/0002-wire_targets.sql b/src/exchangedb/0002-wire_targets.sql index 88d67d9a5..eaf693c54 100644 --- a/src/exchangedb/0002-wire_targets.sql +++ b/src/exchangedb/0002-wire_targets.sql @@ -37,13 +37,13 @@ BEGIN ,partition_suffix ); PERFORM comment_partitioned_column( - 'Can be a regular bank account, or also be a URI identifying a reserve-account (for P2P payments)' + 'Full payto URI. Can identify a regular bank account, or also be a URI identifying a reserve-account (for P2P payments)' ,'payto_uri' ,'wire_targets' ,partition_suffix ); PERFORM comment_partitioned_column( - 'Unsalted hash of payto_uri' + 'Unsalted hash of (full) payto_uri' ,'wire_target_h_payto' ,'wire_targets' ,partition_suffix diff --git a/src/exchangedb/Makefile.am b/src/exchangedb/Makefile.am index 5472f41f5..909cd171e 100644 --- a/src/exchangedb/Makefile.am +++ b/src/exchangedb/Makefile.am @@ -108,7 +108,6 @@ endif libtaler_plugin_exchangedb_postgres_la_SOURCES = \ plugin_exchangedb_common.c plugin_exchangedb_common.h \ - pg_setup_wire_target.h pg_setup_wire_target.c \ pg_compute_shard.h pg_compute_shard.c \ plugin_exchangedb_postgres.c plugin_exchangedb_postgres.h \ pg_helper.h \ @@ -308,11 +307,6 @@ libtaler_plugin_exchangedb_postgres_la_SOURCES = \ pg_lookup_kyc_requirement_by_row.h pg_lookup_kyc_requirement_by_row.c \ pg_select_reserve_open_above_serial_id.c pg_select_reserve_open_above_serial_id.h -# pg_select_justification_for_missing_wire.h pg_select_justification_for_missing_wire.c -# pg_select_aml_process.h pg_select_aml_process.c -# pg_select_aml_history.h pg_select_aml_history.c -# pg_select_aml_threshold.h pg_select_aml_threshold.c - libtaler_plugin_exchangedb_postgres_la_LDFLAGS = \ $(TALER_PLUGIN_LDFLAGS) diff --git a/src/exchangedb/perf_deposits_get_ready.c b/src/exchangedb/perf_deposits_get_ready.c index 1cb8c595a..0018bbbd2 100644 --- a/src/exchangedb/perf_deposits_get_ready.c +++ b/src/exchangedb/perf_deposits_get_ready.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014-2023 Taler Systems SA + Copyright (C) 2014-2024 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 @@ -354,8 +354,8 @@ run (void *cls) depos[i].amount_with_fee = value; bd.refund_deadline = deadline; bd.wire_deadline = deadline; - bd.receiver_wire_account = - "payto://iban/DE67830654080004822650?receiver-name=Test"; + bd.receiver_wire_account.full_payto = + (char *) "payto://iban/DE67830654080004822650?receiver-name=Test"; TALER_merchant_wire_signature_hash ( bd.receiver_wire_account, &bd.wire_salt, @@ -448,7 +448,7 @@ run (void *cls) struct GNUNET_TIME_Absolute time; struct GNUNET_TIME_Relative duration; struct TALER_MerchantPublicKeyP merchant_pub; - char *payto_uri; + struct TALER_FullPayto payto_uri; enum GNUNET_DB_QueryStatus qs; time = GNUNET_TIME_absolute_get (); @@ -466,6 +466,7 @@ run (void *cls) duration.rel_value_us); GNUNET_assert (sqrs + duration_sq >= sqrs); sqrs += duration_sq; + GNUNET_free (payto_uri.full_payto); } /* evaluation of performance */ diff --git a/src/exchangedb/perf_select_refunds_by_coin.c b/src/exchangedb/perf_select_refunds_by_coin.c index 6b9592919..cb216109d 100644 --- a/src/exchangedb/perf_select_refunds_by_coin.c +++ b/src/exchangedb/perf_select_refunds_by_coin.c @@ -358,8 +358,8 @@ run (void *cls) .wallet_timestamp = ts, .refund_deadline = deadline, .wire_deadline = deadline, - .receiver_wire_account - = "payto://iban/DE67830654080004822650?receiver-name=Test" + .receiver_wire_account.full_payto + = (char *) "payto://iban/DE67830654080004822650?receiver-name=Test" }; if (i >= ROUNDS) diff --git a/src/exchangedb/pg_aggregate.h b/src/exchangedb/pg_aggregate.h index 1f986ef9e..66e77c2ba 100644 --- a/src/exchangedb/pg_aggregate.h +++ b/src/exchangedb/pg_aggregate.h @@ -38,7 +38,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_aggregate ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_WireTransferIdentifierRawP *wtid, struct TALER_Amount *total); diff --git a/src/exchangedb/pg_create_aggregation_transient.h b/src/exchangedb/pg_create_aggregation_transient.h index 2f0a348b2..22e52f882 100644 --- a/src/exchangedb/pg_create_aggregation_transient.h +++ b/src/exchangedb/pg_create_aggregation_transient.h @@ -39,7 +39,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_create_aggregation_transient ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const char *exchange_account_section, const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_WireTransferIdentifierRawP *wtid, diff --git a/src/exchangedb/pg_delete_aggregation_transient.h b/src/exchangedb/pg_delete_aggregation_transient.h index f74b0179e..dfd666507 100644 --- a/src/exchangedb/pg_delete_aggregation_transient.h +++ b/src/exchangedb/pg_delete_aggregation_transient.h @@ -37,7 +37,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_delete_aggregation_transient ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const struct TALER_WireTransferIdentifierRawP *wtid); #endif diff --git a/src/exchangedb/pg_drain_kyc_alert.h b/src/exchangedb/pg_drain_kyc_alert.h index 7425f472d..4a1b1e0b3 100644 --- a/src/exchangedb/pg_drain_kyc_alert.h +++ b/src/exchangedb/pg_drain_kyc_alert.h @@ -35,6 +35,6 @@ enum GNUNET_DB_QueryStatus TEH_PG_drain_kyc_alert (void *cls, uint32_t trigger_type, - struct TALER_PaytoHashP *h_payto); + struct TALER_NormalizedPaytoHashP *h_payto); #endif diff --git a/src/exchangedb/pg_find_aggregation_transient.h b/src/exchangedb/pg_find_aggregation_transient.h index c7ba4ea38..cb904b3ee 100644 --- a/src/exchangedb/pg_find_aggregation_transient.h +++ b/src/exchangedb/pg_find_aggregation_transient.h @@ -36,7 +36,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_find_aggregation_transient ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, TALER_EXCHANGEDB_TransientAggregationCallback cb, void *cb_cls); diff --git a/src/exchangedb/pg_get_drain_profit.h b/src/exchangedb/pg_get_drain_profit.h index dd05d8afd..37595815d 100644 --- a/src/exchangedb/pg_get_drain_profit.h +++ b/src/exchangedb/pg_get_drain_profit.h @@ -44,7 +44,7 @@ TEH_PG_get_drain_profit ( const struct TALER_WireTransferIdentifierRawP *wtid, uint64_t *serial, char **account_section, - char **payto_uri, + struct TALER_FullPayto *payto_uri, struct GNUNET_TIME_Timestamp *request_timestamp, struct TALER_Amount *amount, struct TALER_MasterSignatureP *master_sig); diff --git a/src/exchangedb/pg_get_kyc_rules.h b/src/exchangedb/pg_get_kyc_rules.h index 9473fdc2c..b56fad24e 100644 --- a/src/exchangedb/pg_get_kyc_rules.h +++ b/src/exchangedb/pg_get_kyc_rules.h @@ -45,7 +45,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_get_kyc_rules ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, bool *no_account_pub, union TALER_AccountPublicKeyP *account_pub, bool *no_reserve_pub, diff --git a/src/exchangedb/pg_get_pending_kyc_requirement_process.h b/src/exchangedb/pg_get_pending_kyc_requirement_process.h index d2561a6da..aad49b0f0 100644 --- a/src/exchangedb/pg_get_pending_kyc_requirement_process.h +++ b/src/exchangedb/pg_get_pending_kyc_requirement_process.h @@ -38,7 +38,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_get_pending_kyc_requirement_process ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, const char *provider_name, char **redirect_url); diff --git a/src/exchangedb/pg_get_ready_deposit.h b/src/exchangedb/pg_get_ready_deposit.h index b1dd7a968..7e9714ce8 100644 --- a/src/exchangedb/pg_get_ready_deposit.h +++ b/src/exchangedb/pg_get_ready_deposit.h @@ -24,6 +24,8 @@ #include "taler_util.h" #include "taler_json_lib.h" #include "taler_exchangedb_plugin.h" + + /** * Obtain information about deposits that are ready to be executed. Such * deposits must not be marked as "done", the execution time must be @@ -41,6 +43,6 @@ TEH_PG_get_ready_deposit (void *cls, uint64_t start_shard_row, uint64_t end_shard_row, struct TALER_MerchantPublicKeyP *merchant_pub, - char **payto_uri); + struct TALER_FullPayto *payto_uri); #endif diff --git a/src/exchangedb/pg_insert_aml_decision.h b/src/exchangedb/pg_insert_aml_decision.h index afdd7f3a7..b23958f18 100644 --- a/src/exchangedb/pg_insert_aml_decision.h +++ b/src/exchangedb/pg_insert_aml_decision.h @@ -56,8 +56,8 @@ enum GNUNET_DB_QueryStatus TEH_PG_insert_aml_decision ( void *cls, - const char *payto_uri, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPayto payto_uri, + const struct TALER_NormalizedPaytoHashP *h_payto, struct GNUNET_TIME_Timestamp decision_time, struct GNUNET_TIME_Timestamp expiration_time, const json_t *properties, diff --git a/src/exchangedb/pg_insert_close_request.h b/src/exchangedb/pg_insert_close_request.h index c014a10b9..c18d938ed 100644 --- a/src/exchangedb/pg_insert_close_request.h +++ b/src/exchangedb/pg_insert_close_request.h @@ -42,7 +42,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_insert_close_request ( void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const struct TALER_ReserveSignatureP *reserve_sig, struct GNUNET_TIME_Timestamp request_timestamp, const struct TALER_Amount *balance, diff --git a/src/exchangedb/pg_insert_drain_profit.h b/src/exchangedb/pg_insert_drain_profit.h index 90183d850..71ea5b46c 100644 --- a/src/exchangedb/pg_insert_drain_profit.h +++ b/src/exchangedb/pg_insert_drain_profit.h @@ -42,7 +42,7 @@ TEH_PG_insert_drain_profit ( void *cls, const struct TALER_WireTransferIdentifierRawP *wtid, const char *account_section, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, struct GNUNET_TIME_Timestamp request_timestamp, const struct TALER_Amount *amount, const struct TALER_MasterSignatureP *master_sig); diff --git a/src/exchangedb/pg_insert_kyc_attributes.h b/src/exchangedb/pg_insert_kyc_attributes.h index e33f3a152..cc8c9a754 100644 --- a/src/exchangedb/pg_insert_kyc_attributes.h +++ b/src/exchangedb/pg_insert_kyc_attributes.h @@ -52,7 +52,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_insert_kyc_attributes ( void *cls, uint64_t process_row, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, uint32_t birthday, struct GNUNET_TIME_Timestamp collection_time, const char *provider_name, diff --git a/src/exchangedb/pg_insert_kyc_failure.h b/src/exchangedb/pg_insert_kyc_failure.h index 120718feb..e81d3dcc5 100644 --- a/src/exchangedb/pg_insert_kyc_failure.h +++ b/src/exchangedb/pg_insert_kyc_failure.h @@ -43,7 +43,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_insert_kyc_failure ( void *cls, uint64_t process_row, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, const char *provider_name, const char *provider_account_id, const char *provider_legitimization_id, diff --git a/src/exchangedb/pg_insert_kyc_requirement_process.h b/src/exchangedb/pg_insert_kyc_requirement_process.h index 2181813fc..2996d2cef 100644 --- a/src/exchangedb/pg_insert_kyc_requirement_process.h +++ b/src/exchangedb/pg_insert_kyc_requirement_process.h @@ -45,7 +45,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_insert_kyc_requirement_process ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, uint32_t measure_index, uint64_t legitimization_measure_serial_id, const char *provider_name, diff --git a/src/exchangedb/pg_insert_programmatic_legitimization_outcome.h b/src/exchangedb/pg_insert_programmatic_legitimization_outcome.h index 17ced6503..4d6cd480c 100644 --- a/src/exchangedb/pg_insert_programmatic_legitimization_outcome.h +++ b/src/exchangedb/pg_insert_programmatic_legitimization_outcome.h @@ -43,7 +43,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_insert_programmatic_legitimization_outcome ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, struct GNUNET_TIME_Timestamp decision_time, struct GNUNET_TIME_Absolute expiration_time, const json_t *account_properties, diff --git a/src/exchangedb/pg_insert_reserve_closed.h b/src/exchangedb/pg_insert_reserve_closed.h index 2ac1a6e30..57ebe5631 100644 --- a/src/exchangedb/pg_insert_reserve_closed.h +++ b/src/exchangedb/pg_insert_reserve_closed.h @@ -24,6 +24,8 @@ #include "taler_util.h" #include "taler_json_lib.h" #include "taler_exchangedb_plugin.h" + + /** * Insert reserve close operation into database. * @@ -42,7 +44,7 @@ TEH_PG_insert_reserve_closed ( void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, struct GNUNET_TIME_Timestamp execution_date, - const char *receiver_account, + const struct TALER_FullPayto receiver_account, const struct TALER_WireTransferIdentifierRawP *wtid, const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *closing_fee, diff --git a/src/exchangedb/pg_insert_wire.h b/src/exchangedb/pg_insert_wire.h index 7a5e4caca..ce61efd39 100644 --- a/src/exchangedb/pg_insert_wire.h +++ b/src/exchangedb/pg_insert_wire.h @@ -24,6 +24,8 @@ #include "taler_util.h" #include "taler_json_lib.h" #include "taler_exchangedb_plugin.h" + + /** * Insert information about an wire account used by this exchange. * @@ -42,7 +44,7 @@ */ enum GNUNET_DB_QueryStatus TEH_PG_insert_wire (void *cls, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const char *conversion_url, const json_t *debit_restrictions, const json_t *credit_restrictions, diff --git a/src/exchangedb/pg_iterate_kyc_reference.h b/src/exchangedb/pg_iterate_kyc_reference.h index 0242fdcf1..8e1c93b81 100644 --- a/src/exchangedb/pg_iterate_kyc_reference.h +++ b/src/exchangedb/pg_iterate_kyc_reference.h @@ -39,7 +39,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_iterate_kyc_reference ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, TALER_EXCHANGEDB_LegitimizationProcessCallback lpc, void *lpc_cls); diff --git a/src/exchangedb/pg_iterate_reserve_close_info.h b/src/exchangedb/pg_iterate_reserve_close_info.h index 34692e656..55cd5f487 100644 --- a/src/exchangedb/pg_iterate_reserve_close_info.h +++ b/src/exchangedb/pg_iterate_reserve_close_info.h @@ -40,7 +40,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_iterate_reserve_close_info ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, struct GNUNET_TIME_Absolute time_limit, TALER_EXCHANGEDB_KycAmountCallback kac, void *kac_cls); diff --git a/src/exchangedb/pg_kyc_provider_account_lookup.h b/src/exchangedb/pg_kyc_provider_account_lookup.h index bafc42b6f..61939ba84 100644 --- a/src/exchangedb/pg_kyc_provider_account_lookup.h +++ b/src/exchangedb/pg_kyc_provider_account_lookup.h @@ -42,7 +42,7 @@ TEH_PG_kyc_provider_account_lookup ( void *cls, const char *provider_name, const char *provider_legitimization_id, - struct TALER_PaytoHashP *h_payto, + struct TALER_NormalizedPaytoHashP *h_payto, uint64_t *process_row); #endif diff --git a/src/exchangedb/pg_lookup_aml_history.h b/src/exchangedb/pg_lookup_aml_history.h index db146e937..e66e9f19b 100644 --- a/src/exchangedb/pg_lookup_aml_history.h +++ b/src/exchangedb/pg_lookup_aml_history.h @@ -39,7 +39,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_lookup_aml_history ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, TALER_EXCHANGEDB_AmlHistoryCallback cb, void *cb_cls); diff --git a/src/exchangedb/pg_lookup_completed_legitimization.h b/src/exchangedb/pg_lookup_completed_legitimization.h index 1bc16c2ac..3754df11d 100644 --- a/src/exchangedb/pg_lookup_completed_legitimization.h +++ b/src/exchangedb/pg_lookup_completed_legitimization.h @@ -55,7 +55,7 @@ TEH_PG_lookup_completed_legitimization ( uint64_t legitimization_measure_serial_id, uint32_t measure_index, struct TALER_AccountAccessTokenP *access_token, - struct TALER_PaytoHashP *h_payto, + struct TALER_NormalizedPaytoHashP *h_payto, json_t **jmeasures, bool *is_finished, size_t *encrypted_attributes_len, diff --git a/src/exchangedb/pg_lookup_h_payto_by_access_token.h b/src/exchangedb/pg_lookup_h_payto_by_access_token.h index afcac09cf..10e4e076b 100644 --- a/src/exchangedb/pg_lookup_h_payto_by_access_token.h +++ b/src/exchangedb/pg_lookup_h_payto_by_access_token.h @@ -40,6 +40,6 @@ enum GNUNET_DB_QueryStatus TEH_PG_lookup_h_payto_by_access_token ( void *cls, const struct TALER_AccountAccessTokenP *access_token, - struct TALER_PaytoHashP *h_payto); + struct TALER_NormalizedPaytoHashP *h_payto); #endif diff --git a/src/exchangedb/pg_lookup_kyc_history.h b/src/exchangedb/pg_lookup_kyc_history.h index 1c47366a5..c5ba486c9 100644 --- a/src/exchangedb/pg_lookup_kyc_history.h +++ b/src/exchangedb/pg_lookup_kyc_history.h @@ -39,7 +39,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_lookup_kyc_history ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, TALER_EXCHANGEDB_KycHistoryCallback cb, void *cb_cls); diff --git a/src/exchangedb/pg_lookup_kyc_process_by_account.h b/src/exchangedb/pg_lookup_kyc_process_by_account.h index 1068380e9..4f3cedc13 100644 --- a/src/exchangedb/pg_lookup_kyc_process_by_account.h +++ b/src/exchangedb/pg_lookup_kyc_process_by_account.h @@ -42,7 +42,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_lookup_kyc_process_by_account ( void *cls, const char *provider_name, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, uint64_t *process_row, struct GNUNET_TIME_Absolute *expiration, char **provider_account_id, diff --git a/src/exchangedb/pg_lookup_kyc_requirement_by_row.h b/src/exchangedb/pg_lookup_kyc_requirement_by_row.h index 8bf6c38d9..38c58ba67 100644 --- a/src/exchangedb/pg_lookup_kyc_requirement_by_row.h +++ b/src/exchangedb/pg_lookup_kyc_requirement_by_row.h @@ -50,7 +50,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_lookup_kyc_requirement_by_row ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, union TALER_AccountPublicKeyP *account_pub, struct TALER_ReservePublicKeyP *reserve_pub, struct TALER_AccountAccessTokenP *access_token, diff --git a/src/exchangedb/pg_lookup_pending_legitimization.h b/src/exchangedb/pg_lookup_pending_legitimization.h index eaf6a60d7..1c39370a6 100644 --- a/src/exchangedb/pg_lookup_pending_legitimization.h +++ b/src/exchangedb/pg_lookup_pending_legitimization.h @@ -47,7 +47,7 @@ TEH_PG_lookup_pending_legitimization ( void *cls, uint64_t legitimization_measure_serial_id, struct TALER_AccountAccessTokenP *access_token, - struct TALER_PaytoHashP *h_payto, + struct TALER_NormalizedPaytoHashP *h_payto, json_t **jmeasures, bool *is_finished); diff --git a/src/exchangedb/pg_lookup_rules_by_access_token.h b/src/exchangedb/pg_lookup_rules_by_access_token.h index e1824382c..e8fdf8af6 100644 --- a/src/exchangedb/pg_lookup_rules_by_access_token.h +++ b/src/exchangedb/pg_lookup_rules_by_access_token.h @@ -37,7 +37,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_lookup_rules_by_access_token ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, json_t **jnew_rules, uint64_t *rowid); diff --git a/src/exchangedb/pg_lookup_wire_timestamp.h b/src/exchangedb/pg_lookup_wire_timestamp.h index f2ee117de..e043be93a 100644 --- a/src/exchangedb/pg_lookup_wire_timestamp.h +++ b/src/exchangedb/pg_lookup_wire_timestamp.h @@ -24,6 +24,8 @@ #include "taler_util.h" #include "taler_json_lib.h" #include "taler_exchangedb_plugin.h" + + /** * Check the last date an exchange wire account was modified. * @@ -34,7 +36,7 @@ */ enum GNUNET_DB_QueryStatus TEH_PG_lookup_wire_timestamp (void *cls, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, struct GNUNET_TIME_Timestamp *last_date); #endif diff --git a/src/exchangedb/pg_profit_drains_get_pending.h b/src/exchangedb/pg_profit_drains_get_pending.h index cd793a129..327719ef8 100644 --- a/src/exchangedb/pg_profit_drains_get_pending.h +++ b/src/exchangedb/pg_profit_drains_get_pending.h @@ -44,7 +44,7 @@ TEH_PG_profit_drains_get_pending ( uint64_t *serial, struct TALER_WireTransferIdentifierRawP *wtid, char **account_section, - char **payto_uri, + struct TALER_FullPayto *payto_uri, struct GNUNET_TIME_Timestamp *request_timestamp, struct TALER_Amount *amount, struct TALER_MasterSignatureP *master_sig); diff --git a/src/exchangedb/pg_reserves_get_origin.h b/src/exchangedb/pg_reserves_get_origin.h index 927c8c139..6c248f8d1 100644 --- a/src/exchangedb/pg_reserves_get_origin.h +++ b/src/exchangedb/pg_reserves_get_origin.h @@ -37,7 +37,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_reserves_get_origin ( void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, - struct TALER_PaytoHashP *h_payto, - char **payto_uri); + struct TALER_FullPaytoHashP *h_payto, + struct TALER_FullPayto *payto_uri); #endif diff --git a/src/exchangedb/pg_reserves_in_insert.c b/src/exchangedb/pg_reserves_in_insert.c index 95e488771..d9a591861 100644 --- a/src/exchangedb/pg_reserves_in_insert.c +++ b/src/exchangedb/pg_reserves_in_insert.c @@ -32,7 +32,6 @@ #include "pg_rollback.h" #include "pg_reserves_get.h" #include "pg_reserves_update.h" -#include "pg_setup_wire_target.h" #include "pg_event_notify.h" diff --git a/src/exchangedb/pg_select_aggregation_amounts_for_kyc_check.h b/src/exchangedb/pg_select_aggregation_amounts_for_kyc_check.h index b91740581..3bd34c058 100644 --- a/src/exchangedb/pg_select_aggregation_amounts_for_kyc_check.h +++ b/src/exchangedb/pg_select_aggregation_amounts_for_kyc_check.h @@ -40,7 +40,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_select_aggregation_amounts_for_kyc_check ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, struct GNUNET_TIME_Absolute time_limit, TALER_EXCHANGEDB_KycAmountCallback kac, void *kac_cls); diff --git a/src/exchangedb/pg_select_aggregation_transient.h b/src/exchangedb/pg_select_aggregation_transient.h index fd82a97aa..e137652e2 100644 --- a/src/exchangedb/pg_select_aggregation_transient.h +++ b/src/exchangedb/pg_select_aggregation_transient.h @@ -39,9 +39,11 @@ enum GNUNET_DB_QueryStatus TEH_PG_select_aggregation_transient ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const struct TALER_MerchantPublicKeyP *merchant_pub, const char *exchange_account_section, struct TALER_WireTransferIdentifierRawP *wtid, struct TALER_Amount *total); + + #endif diff --git a/src/exchangedb/pg_select_aml_attributes.h b/src/exchangedb/pg_select_aml_attributes.h index d207c41e1..785f995dd 100644 --- a/src/exchangedb/pg_select_aml_attributes.h +++ b/src/exchangedb/pg_select_aml_attributes.h @@ -41,7 +41,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_select_aml_attributes ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, uint64_t offset, int64_t limit, TALER_EXCHANGEDB_AmlAttributeCallback cb, diff --git a/src/exchangedb/pg_select_aml_decisions.h b/src/exchangedb/pg_select_aml_decisions.h index 6780f2816..771f86bb7 100644 --- a/src/exchangedb/pg_select_aml_decisions.h +++ b/src/exchangedb/pg_select_aml_decisions.h @@ -43,7 +43,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_select_aml_decisions ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, enum TALER_EXCHANGE_YesNoAll investigation_only, enum TALER_EXCHANGE_YesNoAll active_only, uint64_t offset, diff --git a/src/exchangedb/pg_select_aml_history.c b/src/exchangedb/pg_select_aml_history.c deleted file mode 100644 index 0461e0d9b..000000000 --- a/src/exchangedb/pg_select_aml_history.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2022 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 exchangedb/pg_select_aml_history.c - * @brief Implementation of the select_aml_history function for Postgres - * @author Christian Grothoff - */ -#include "platform.h" -#include "taler_error_codes.h" -#include "taler_dbevents.h" -#include "taler_pq_lib.h" -#include "pg_select_aml_history.h" -#include "pg_helper.h" - - -/** - * Closure for #handle_aml_result. - */ -struct AmlHistoryResultContext -{ - /** - * Function to call on each result. - */ - TALER_EXCHANGEDB_AmlHistoryCallback cb; - - /** - * Closure for @e cb. - */ - void *cb_cls; - - /** - * Plugin context. - */ - struct PostgresClosure *pg; - - /** - * Set to #GNUNET_SYSERR on serious errors. - */ - enum GNUNET_GenericReturnValue status; -}; - - -/** - * Function to be called with the results of a SELECT statement - * that has returned @a num_results results. Helper function - * for #TEH_PG_select_aml_history(). - * - * @param cls closure of type `struct AmlHistoryResultContext *` - * @param result the postgres result - * @param num_results the number of results in @a result - */ -static void -handle_aml_result (void *cls, - PGresult *result, - unsigned int num_results) -{ - struct AmlHistoryResultContext *ctx = cls; - struct PostgresClosure *pg = ctx->pg; - - for (unsigned int i = 0; i<num_results; i++) - { - struct TALER_Amount new_threshold; - uint32_t ns; - struct GNUNET_TIME_Timestamp decision_time; - char *justification; - struct TALER_AmlOfficerPublicKeyP decider_pub; - struct TALER_AmlOfficerSignatureP decider_sig; - struct GNUNET_PQ_ResultSpec rs[] = { - TALER_PQ_RESULT_SPEC_AMOUNT ("new_threshold", - &new_threshold), - GNUNET_PQ_result_spec_uint32 ("new_status", - &ns), - GNUNET_PQ_result_spec_timestamp ("decision_time", - &decision_time), - GNUNET_PQ_result_spec_string ("justification", - &justification), - GNUNET_PQ_result_spec_auto_from_type ("decider_pub", - &decider_pub), - GNUNET_PQ_result_spec_auto_from_type ("decider_sig", - &decider_sig), - GNUNET_PQ_result_spec_end - }; - - if (GNUNET_OK != - GNUNET_PQ_extract_result (result, - rs, - i)) - { - GNUNET_break (0); - ctx->status = GNUNET_SYSERR; - return; - } - ctx->cb (ctx->cb_cls, - &new_threshold, - (enum TALER_AmlDecisionState) ns, - decision_time, - justification, - &decider_pub, - &decider_sig); - GNUNET_PQ_cleanup_result (rs); - } -} - - -enum GNUNET_DB_QueryStatus -TEH_PG_select_aml_history ( - void *cls, - const struct TALER_PaytoHashP *h_payto, - TALER_EXCHANGEDB_AmlHistoryCallback cb, - void *cb_cls) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_auto_from_type (h_payto), - GNUNET_PQ_query_param_end - }; - struct AmlHistoryResultContext ctx = { - .cb = cb, - .cb_cls = cb_cls, - .pg = pg, - .status = GNUNET_OK - }; - enum GNUNET_DB_QueryStatus qs; - - PREPARE (pg, - "lookup_aml_history", - "SELECT" - " new_threshold" - ",new_status" - ",decision_time" - ",justification" - ",decider_pub" - ",decider_sig" - " FROM aml_history" - " WHERE h_payto=$1;"); - qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, - "lookup_aml_history", - params, - &handle_aml_result, - &ctx); - if (GNUNET_OK != ctx.status) - return GNUNET_DB_STATUS_HARD_ERROR; - return qs; -} diff --git a/src/exchangedb/pg_select_aml_history.h b/src/exchangedb/pg_select_aml_history.h deleted file mode 100644 index 78569947f..000000000 --- a/src/exchangedb/pg_select_aml_history.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2022 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 exchangedb/pg_select_aml_history.h - * @brief implementation of the select_aml_history function for Postgres - * @author Christian Grothoff - */ -#ifndef PG_SELECT_AML_HISTORY_H -#define PG_SELECT_AML_HISTORY_H - -#include "taler_util.h" -#include "taler_json_lib.h" -#include "taler_exchangedb_plugin.h" - - -/** - * Lookup AML decision history for a particular account. - * - * @param cls closure - * @param h_payto which account should we return the AML decision history for - * @param cb callback to invoke on each match - * @param cb_cls closure for @a cb - * @return database transaction status - */ -enum GNUNET_DB_QueryStatus -TEH_PG_select_aml_history ( - void *cls, - const struct TALER_PaytoHashP *h_payto, - TALER_EXCHANGEDB_AmlHistoryCallback cb, - void *cb_cls); - - -#endif diff --git a/src/exchangedb/pg_select_aml_process.c b/src/exchangedb/pg_select_aml_process.c deleted file mode 100644 index c34cae4bb..000000000 --- a/src/exchangedb/pg_select_aml_process.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2022 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 exchangedb/pg_select_aml_process.c - * @brief Implementation of the select_aml_process function for Postgres - * @author Christian Grothoff - */ -#include "platform.h" -#include "taler_error_codes.h" -#include "taler_dbevents.h" -#include "taler_pq_lib.h" -#include "pg_select_aml_process.h" -#include "pg_helper.h" - - -/** - * Closure for #handle_aml_result. - */ -struct AmlProcessResultContext -{ - /** - * Function to call on each result. - */ - TALER_EXCHANGEDB_AmlStatusCallback cb; - - /** - * Closure for @e cb. - */ - void *cb_cls; - - /** - * Plugin context. - */ - struct PostgresClosure *pg; - - /** - * Set to #GNUNET_SYSERR on serious errors. - */ - enum GNUNET_GenericReturnValue status; -}; - - -/** - * Function to be called with the results of a SELECT statement - * that has returned @a num_results results. Helper function - * for #TEH_PG_select_aml_process(). - * - * @param cls closure of type `struct AmlProcessResultContext *` - * @param result the postgres result - * @param num_results the number of results in @a result - */ -static void -handle_aml_result (void *cls, - PGresult *result, - unsigned int num_results) -{ - struct AmlProcessResultContext *ctx = cls; - struct PostgresClosure *pg = ctx->pg; - - for (unsigned int i = 0; i<num_results; i++) - { - struct TALER_PaytoHashP h_payto; - struct TALER_Amount threshold; - uint64_t rowid; - uint32_t sv; - struct GNUNET_PQ_ResultSpec rs[] = { - GNUNET_PQ_result_spec_uint64 ("aml_status_serial_id", - &rowid), - GNUNET_PQ_result_spec_auto_from_type ("h_payto", - &h_payto), - TALER_PQ_RESULT_SPEC_AMOUNT ("threshold", - &threshold), - GNUNET_PQ_result_spec_uint32 ("status", - &sv), - GNUNET_PQ_result_spec_end - }; - - if (GNUNET_OK != - GNUNET_PQ_extract_result (result, - rs, - i)) - { - GNUNET_break (0); - ctx->status = GNUNET_SYSERR; - return; - } - ctx->cb (ctx->cb_cls, - rowid, - &h_payto, - &threshold, - (enum TALER_AmlDecisionState) sv); - GNUNET_PQ_cleanup_result (rs); - } -} - - -enum GNUNET_DB_QueryStatus -TEH_PG_select_aml_process ( - void *cls, - enum TALER_AmlDecisionState decision, - uint64_t row_off, - uint64_t limit, - bool forward, - TALER_EXCHANGEDB_AmlStatusCallback cb, - void *cb_cls) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_uint32 (&decision), - GNUNET_PQ_query_param_uint64 (&row_off), - GNUNET_PQ_query_param_uint64 (&limit), - GNUNET_PQ_query_param_end - }; - struct AmlProcessResultContext ctx = { - .cb = cb, - .cb_cls = cb_cls, - .pg = pg, - .status = GNUNET_OK - }; - enum GNUNET_DB_QueryStatus qs; - const char *stmt = forward - ? "select_aml_process_inc" - : "select_aml_process_dec"; - - PREPARE (pg, - "select_aml_process_inc", - "SELECT" - " aml_status_serial_id" - ",h_payto" - ",threshold" - ",status" - " FROM aml_status" - " WHERE aml_status_serial_id > $2" - " AND status = $1" - " ORDER BY aml_status_serial_id ASC" - " LIMIT $3"); - PREPARE (pg, - "select_aml_process_dec", - "SELECT" - " aml_status_serial_id" - ",h_payto" - ",threshold" - ",status" - " FROM aml_status" - " WHERE aml_status_serial_id < $2" - " AND status = $1" - " ORDER BY aml_status_serial_id DESC" - " LIMIT $3"); - qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, - stmt, - params, - &handle_aml_result, - &ctx); - if (GNUNET_OK != ctx.status) - return GNUNET_DB_STATUS_HARD_ERROR; - return qs; -} diff --git a/src/exchangedb/pg_select_aml_process.h b/src/exchangedb/pg_select_aml_process.h deleted file mode 100644 index 648cace2e..000000000 --- a/src/exchangedb/pg_select_aml_process.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2022 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 exchangedb/pg_select_aml_process.h - * @brief implementation of the select_aml_process function for Postgres - * @author Christian Grothoff - */ -#ifndef PG_SELECT_AML_PROCESS_H -#define PG_SELECT_AML_PROCESS_H - -#include "taler_util.h" -#include "taler_json_lib.h" -#include "taler_exchangedb_plugin.h" - - -/** - * Lookup AML decisions that have a particular state. - * - * @param cls closure - * @param decision which decision states to filter by - * @param row_off offset to start from - * @param limit how many rows to return at most - * @param forward true to go forward in time, false to go backwards - * @param cb callback to invoke on each match - * @param cb_cls closure for @a cb - * @return database transaction status - */ -enum GNUNET_DB_QueryStatus -TEH_PG_select_aml_process ( - void *cls, - enum TALER_AmlDecisionState decision, - uint64_t row_off, - uint64_t limit, - bool forward, - TALER_EXCHANGEDB_AmlStatusCallback cb, - void *cb_cls); - - -#endif diff --git a/src/exchangedb/pg_select_aml_threshold.c b/src/exchangedb/pg_select_aml_threshold.c deleted file mode 100644 index 23286f029..000000000 --- a/src/exchangedb/pg_select_aml_threshold.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2023 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 exchangedb/pg_select_aml_threshold.c - * @brief Implementation of the select_aml_threshold function for Postgres - * @author Christian Grothoff - */ -#include "platform.h" -#include "taler_error_codes.h" -#include "taler_dbevents.h" -#include "taler_pq_lib.h" -#include "pg_select_aml_threshold.h" -#include "pg_helper.h" - - -enum GNUNET_DB_QueryStatus -TEH_PG_select_aml_threshold ( - void *cls, - const struct TALER_PaytoHashP *h_payto, - enum TALER_AmlDecisionState *decision, - struct TALER_EXCHANGEDB_KycStatus *kyc, - struct TALER_Amount *threshold) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_auto_from_type (h_payto), - GNUNET_PQ_query_param_end - }; - uint32_t status32 = TALER_AML_NORMAL; - struct GNUNET_PQ_ResultSpec rs[] = { - TALER_PQ_RESULT_SPEC_AMOUNT ("threshold", - threshold), - GNUNET_PQ_result_spec_uint32 ("status", - &status32), - GNUNET_PQ_result_spec_uint64 ("kyc_requirement", - &kyc->requirement_row), - GNUNET_PQ_result_spec_end - }; - enum GNUNET_DB_QueryStatus qs; - - PREPARE (pg, - "select_aml_threshold", - "SELECT" - " threshold" - ",status" - ",kyc_requirement" - " FROM aml_status" - " WHERE h_payto=$1;"); - qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn, - "select_aml_threshold", - params, - rs); - *decision = (enum TALER_AmlDecisionState) status32; - kyc->ok = (TALER_AML_FROZEN != *decision) - || (0 != kyc->requirement_row); - return qs; -} diff --git a/src/exchangedb/pg_select_aml_threshold.h b/src/exchangedb/pg_select_aml_threshold.h deleted file mode 100644 index 8f0e3bcfc..000000000 --- a/src/exchangedb/pg_select_aml_threshold.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2023 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 exchangedb/pg_select_aml_threshold.h - * @brief implementation of the select_aml_threshold function for Postgres - * @author Christian Grothoff - */ -#ifndef PG_SELECT_AML_THRESHOLD_H -#define PG_SELECT_AML_THRESHOLD_H - -#include "taler_util.h" -#include "taler_json_lib.h" -#include "taler_exchangedb_plugin.h" - - -/** - * Obtain the current AML threshold set for an account. - * - * @param cls closure - * @param h_payto account for which the AML threshold is stored - * @param[out] decision set to current AML decision - * @param[out] kyc set to KYC requirements imposed by AML, if any - * @param[out] threshold set to the existing threshold - * @return database transaction status, 0 if no threshold was set - */ -enum GNUNET_DB_QueryStatus -TEH_PG_select_aml_threshold ( - void *cls, - const struct TALER_PaytoHashP *h_payto, - enum TALER_AmlDecisionState *decision, - struct TALER_EXCHANGEDB_KycStatus *kyc, - struct TALER_Amount *threshold); - - -#endif diff --git a/src/exchangedb/pg_select_deposit_amounts_for_kyc_check.h b/src/exchangedb/pg_select_deposit_amounts_for_kyc_check.h index 7e4ab31b2..5cc2c2c60 100644 --- a/src/exchangedb/pg_select_deposit_amounts_for_kyc_check.h +++ b/src/exchangedb/pg_select_deposit_amounts_for_kyc_check.h @@ -42,7 +42,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_select_deposit_amounts_for_kyc_check ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, struct GNUNET_TIME_Absolute time_limit, TALER_EXCHANGEDB_KycAmountCallback kac, void *kac_cls); diff --git a/src/exchangedb/pg_select_justification_for_missing_wire.c b/src/exchangedb/pg_select_justification_for_missing_wire.c deleted file mode 100644 index 77d5b4de7..000000000 --- a/src/exchangedb/pg_select_justification_for_missing_wire.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2022-2023 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 exchangedb/pg_select_batch_deposits_missing_wire.c - * @brief Implementation of the select_batch_deposits_missing_wire function for Postgres - * @author Christian Grothoff - */ -#include "platform.h" -#include "taler_error_codes.h" -#include "taler_dbevents.h" -#include "taler_pq_lib.h" -#include "pg_select_batch_deposits_missing_wire.h" -#include "pg_helper.h" - - -enum GNUNET_DB_QueryStatus -TEH_PG_select_justification_for_missing_wire ( - void *cls, - const struct TALER_PaytoHashP *wire_target_h_payto, - char **payto_uri, - char **kyc_pending, - enum TALER_AmlDecisionState *status, - struct TALER_Amount *aml_limit) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_TIME_Absolute now - = GNUNET_TIME_absolute_get (); - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_auto_from_type (wire_target_h_payto), - GNUNET_PQ_query_param_absolute_time (&now), - GNUNET_PQ_query_param_end - }; - uint32_t aml_status32; - struct GNUNET_PQ_ResultSpec rs[] = { - GNUNET_PQ_result_spec_allow_null ( - GNUNET_PQ_result_spec_string ("payto_uri", - payto_uri), - NULL), - GNUNET_PQ_result_spec_allow_null ( - GNUNET_PQ_result_spec_string ("kyc_pending", - kyc_pending), - NULL), - GNUNET_PQ_result_spec_allow_null ( - GNUNET_PQ_result_spec_uint32 ("aml_status", - &aml_status32), - NULL), - GNUNET_PQ_result_spec_allow_null ( - TALER_PQ_RESULT_SPEC_AMOUNT ("aml_limit", - aml_limit), - NULL), - GNUNET_PQ_result_spec_end - }; - enum GNUNET_DB_QueryStatus qs; - - PREPARE (pg, - "deposits_get_overdue", - "SELECT" - " out_payto_uri AS payto_uri" - ",out_kyc_pending AS kyc_pending" - ",out_deadline AS deadline" - ",out_aml_status AS aml_status" - ",out_aml_limit AS aml_limit" - " FROM exchange_do_select_justification_missing_wire" - " ($1, $2);"); - memset (aml_limit, - 0, - sizeof (*aml_limit)); - qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn, - "", - params, - rs); - if (qs <= 0) - return qs; - *status = (enum TALER_AmlDecisionState) aml_status32; - return qs; -} diff --git a/src/exchangedb/pg_select_justification_for_missing_wire.h b/src/exchangedb/pg_select_justification_for_missing_wire.h deleted file mode 100644 index 7f73eb511..000000000 --- a/src/exchangedb/pg_select_justification_for_missing_wire.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2022 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 exchangedb/pg_select_justification_for_missing_wire.h - * @brief implementation of the select_justification_for_missing_wire function for Postgres - * @author Christian Grothoff - */ -#ifndef PG_SELECT_JUSTIFICATION_FOR_MISSING_WIRE_H -#define PG_SELECT_JUSTIFICATION_FOR_MISSING_WIRE_H - -#include "taler_util.h" -#include "taler_json_lib.h" -#include "taler_exchangedb_plugin.h" - -/** - * Select all of those justifications for why we might not have - * done a wire transfer from in the database for a particular target account. - * - * @param cls closure - * @param wire_target_h_payto effected target account - * @param[out] payto_uri target account URI, set to NULL if unknown - * @param[out] kyc_pending set to string describing missing KYC data - * @param[out] status set to AML status - * @param[out] aml_limit set to AML limit, or invalid amount for none - * @return transaction status code - */ -enum GNUNET_DB_QueryStatus -TEH_PG_select_justification_for_missing_wire ( - void *cls, - const struct TALER_PaytoHashP *wire_target_h_payto, - char **payto_uri, - char **kyc_pending, - enum TALER_AmlDecisionState *status, - struct TALER_Amount *aml_limit); - -#endif diff --git a/src/exchangedb/pg_select_kyc_attributes.h b/src/exchangedb/pg_select_kyc_attributes.h index 7458aefe8..33163dca6 100644 --- a/src/exchangedb/pg_select_kyc_attributes.h +++ b/src/exchangedb/pg_select_kyc_attributes.h @@ -38,7 +38,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_select_kyc_attributes ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, TALER_EXCHANGEDB_AttributeCallback cb, void *cb_cls); diff --git a/src/exchangedb/pg_select_merge_amounts_for_kyc_check.h b/src/exchangedb/pg_select_merge_amounts_for_kyc_check.h index 5d0a96359..ead8e3f55 100644 --- a/src/exchangedb/pg_select_merge_amounts_for_kyc_check.h +++ b/src/exchangedb/pg_select_merge_amounts_for_kyc_check.h @@ -39,7 +39,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_select_merge_amounts_for_kyc_check ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, struct GNUNET_TIME_Absolute time_limit, TALER_EXCHANGEDB_KycAmountCallback kac, void *kac_cls); diff --git a/src/exchangedb/pg_select_reserve_close_info.h b/src/exchangedb/pg_select_reserve_close_info.h index 2b90ffd05..d42a7eb38 100644 --- a/src/exchangedb/pg_select_reserve_close_info.h +++ b/src/exchangedb/pg_select_reserve_close_info.h @@ -43,7 +43,7 @@ TEH_PG_select_reserve_close_info ( void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, struct TALER_Amount *balance, - char **payto_uri); + struct TALER_FullPayto *payto_uri); #endif diff --git a/src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.h b/src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.h index 9a780adbe..cd843d973 100644 --- a/src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.h +++ b/src/exchangedb/pg_select_withdraw_amounts_for_kyc_check.h @@ -40,7 +40,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_select_withdraw_amounts_for_kyc_check ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, struct GNUNET_TIME_Absolute time_limit, TALER_EXCHANGEDB_KycAmountCallback kac, void *kac_cls); diff --git a/src/exchangedb/pg_setup_wire_target.c b/src/exchangedb/pg_setup_wire_target.c deleted file mode 100644 index ed6fbe338..000000000 --- a/src/exchangedb/pg_setup_wire_target.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2022 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 exchangedb/pg_setup_wire_target.c - * @brief Implementation of the setup_wire_target function for Postgres - * @author Christian Grothoff - */ -#include "platform.h" -#include "taler_error_codes.h" -#include "taler_dbevents.h" -#include "taler_pq_lib.h" -#include "pg_setup_wire_target.h" - - -enum GNUNET_DB_QueryStatus -TEH_PG_setup_wire_target ( - struct PostgresClosure *pg, - const char *payto_uri, - struct TALER_PaytoHashP *h_payto) -{ - struct GNUNET_PQ_QueryParam iparams[] = { - GNUNET_PQ_query_param_auto_from_type (h_payto), - GNUNET_PQ_query_param_string (payto_uri), - GNUNET_PQ_query_param_end - }; - - TALER_payto_hash (payto_uri, - h_payto); - - PREPARE (pg, - "insert_kyc_status", - "INSERT INTO wire_targets" - " (wire_target_h_payto" - " ,payto_uri" - " ) VALUES " - " ($1, $2)" - " ON CONFLICT DO NOTHING"); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "insert_kyc_status", - iparams); -} diff --git a/src/exchangedb/pg_setup_wire_target.h b/src/exchangedb/pg_setup_wire_target.h deleted file mode 100644 index 77512a600..000000000 --- a/src/exchangedb/pg_setup_wire_target.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2022 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 exchangedb/pg_setup_wire_target.h - * @brief implementation of the setup_wire_target function for Postgres - * @author Christian Grothoff - */ -#ifndef PG_SETUP_WIRE_TARGET_H -#define PG_SETUP_WIRE_TARGET_H - -#include "taler_util.h" -#include "taler_json_lib.h" -#include "pg_helper.h" -#include "taler_exchangedb_plugin.h" - -/** - * Setup new wire target for @a payto_uri. - * - * @param pg the plugin-specific state - * @param payto_uri the payto URI to check - * @param[out] h_payto set to the hash of @a payto_uri - * @return transaction status - */ -enum GNUNET_DB_QueryStatus -TEH_PG_setup_wire_target ( - struct PostgresClosure *pg, - const char *payto_uri, - struct TALER_PaytoHashP *h_payto); - -#endif diff --git a/src/exchangedb/pg_store_wire_transfer_out.h b/src/exchangedb/pg_store_wire_transfer_out.h index 79950e65a..8c79ea4ef 100644 --- a/src/exchangedb/pg_store_wire_transfer_out.h +++ b/src/exchangedb/pg_store_wire_transfer_out.h @@ -41,7 +41,7 @@ TEH_PG_store_wire_transfer_out ( void *cls, struct GNUNET_TIME_Timestamp date, const struct TALER_WireTransferIdentifierRawP *wtid, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const char *exchange_account_section, const struct TALER_Amount *amount); diff --git a/src/exchangedb/pg_trigger_aml_process.h b/src/exchangedb/pg_trigger_aml_process.h index 2283571af..c4ae3001b 100644 --- a/src/exchangedb/pg_trigger_aml_process.h +++ b/src/exchangedb/pg_trigger_aml_process.h @@ -38,7 +38,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_trigger_aml_process ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, const struct TALER_Amount *threshold_crossed); diff --git a/src/exchangedb/pg_trigger_kyc_rule_for_account.h b/src/exchangedb/pg_trigger_kyc_rule_for_account.h index 56ee0ca8b..a0f11a4b8 100644 --- a/src/exchangedb/pg_trigger_kyc_rule_for_account.h +++ b/src/exchangedb/pg_trigger_kyc_rule_for_account.h @@ -49,8 +49,8 @@ enum GNUNET_DB_QueryStatus TEH_PG_trigger_kyc_rule_for_account ( void *cls, - const char *payto_uri, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPayto payto_uri, + const struct TALER_NormalizedPaytoHashP *h_payto, const union TALER_AccountPublicKeyP *set_account_pub, const struct TALER_MerchantPublicKeyP *check_merchant_pub, const json_t *jmeasures, diff --git a/src/exchangedb/pg_update_aggregation_transient.h b/src/exchangedb/pg_update_aggregation_transient.h index c444e85bb..7ef07d8f2 100644 --- a/src/exchangedb/pg_update_aggregation_transient.h +++ b/src/exchangedb/pg_update_aggregation_transient.h @@ -24,6 +24,8 @@ #include "taler_util.h" #include "taler_json_lib.h" #include "taler_exchangedb_plugin.h" + + /** * Update existing entry in the transient aggregation table. * @a h_payto is only needed for query performance. @@ -38,7 +40,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_update_aggregation_transient ( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const struct TALER_WireTransferIdentifierRawP *wtid, uint64_t kyc_requirement_row, const struct TALER_Amount *total); diff --git a/src/exchangedb/pg_update_kyc_process_by_row.h b/src/exchangedb/pg_update_kyc_process_by_row.h index 86e82ed30..4f1f9c2b6 100644 --- a/src/exchangedb/pg_update_kyc_process_by_row.h +++ b/src/exchangedb/pg_update_kyc_process_by_row.h @@ -47,7 +47,7 @@ TEH_PG_update_kyc_process_by_row ( void *cls, uint64_t process_row, const char *provider_name, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, const char *provider_account_id, const char *provider_legitimization_id, const char *redirect_url, diff --git a/src/exchangedb/pg_update_wire.h b/src/exchangedb/pg_update_wire.h index a596a0802..4d3f22f79 100644 --- a/src/exchangedb/pg_update_wire.h +++ b/src/exchangedb/pg_update_wire.h @@ -44,7 +44,7 @@ */ enum GNUNET_DB_QueryStatus TEH_PG_update_wire (void *cls, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const char *conversion_url, const json_t *debit_restrictions, const json_t *credit_restrictions, diff --git a/src/exchangedb/plugin_exchangedb_common.c b/src/exchangedb/plugin_exchangedb_common.c index 562710eaa..3141c9ab2 100644 --- a/src/exchangedb/plugin_exchangedb_common.c +++ b/src/exchangedb/plugin_exchangedb_common.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2015, 2016, 2020 Taler Systems SA + Copyright (C) 2015, 2016, 2020, 2024 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 @@ -38,7 +38,7 @@ TEH_COMMON_free_reserve_history ( struct TALER_EXCHANGEDB_BankTransfer *bt; bt = rh->details.bank; - GNUNET_free (bt->sender_account_details); + GNUNET_free (bt->sender_account_details.full_payto); GNUNET_free (bt); break; } @@ -65,7 +65,7 @@ TEH_COMMON_free_reserve_history ( struct TALER_EXCHANGEDB_ClosingTransfer *closing; closing = rh->details.closing; - GNUNET_free (closing->receiver_account_details); + GNUNET_free (closing->receiver_account_details.full_payto); GNUNET_free (closing); break; } @@ -128,7 +128,7 @@ TEH_COMMON_free_coin_transaction_list ( struct TALER_EXCHANGEDB_DepositListEntry *deposit; deposit = tl->details.deposit; - GNUNET_free (deposit->receiver_wire_account); + GNUNET_free (deposit->receiver_wire_account.full_payto); GNUNET_free (deposit); break; } diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index b5d410fc1..09efe8d88 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -221,7 +221,6 @@ #include "pg_select_purse_by_merge_pub.h" #include "pg_set_purse_balance.h" #include "pg_reserves_update.h" -#include "pg_setup_wire_target.h" #include "pg_compute_shard.h" #include "pg_insert_kyc_attributes.h" #include "pg_select_kyc_attributes.h" diff --git a/src/include/taler_auditordb_plugin.h b/src/include/taler_auditordb_plugin.h index 88241e25a..dab35acbf 100644 --- a/src/include/taler_auditordb_plugin.h +++ b/src/include/taler_auditordb_plugin.h @@ -837,7 +837,7 @@ typedef void void *cls, uint64_t batch_deposit_serial_id, const struct TALER_Amount *total_amount, - const struct TALER_PaytoHashP *wire_target_h_payto, + const struct TALER_FullPaytoHashP *wire_target_h_payto, struct GNUNET_TIME_Timestamp deadline); @@ -968,7 +968,7 @@ struct TALER_AUDITORDB_Plugin * #GNUNET_SYSERR if we have no DB connection */ enum GNUNET_GenericReturnValue - (*preflight)(void *cls); + (*preflight)(void *cls); /** @@ -1025,8 +1025,8 @@ struct TALER_AUDITORDB_Plugin * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure */ enum GNUNET_GenericReturnValue - (*drop_tables)(void *cls, - bool drop_exchangelist); + (*drop_tables)(void *cls, + bool drop_exchangelist); /** @@ -1038,9 +1038,9 @@ struct TALER_AUDITORDB_Plugin * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure */ enum GNUNET_GenericReturnValue - (*create_tables)(void *cls, - bool support_partitions, - uint32_t num_partitions); + (*create_tables)(void *cls, + bool support_partitions, + uint32_t num_partitions); /** @@ -1050,7 +1050,7 @@ struct TALER_AUDITORDB_Plugin * @return #GNUNET_OK on success */ enum GNUNET_GenericReturnValue - (*start)(void *cls); + (*start)(void *cls); /** @@ -1060,7 +1060,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*commit)(void *cls); + (*commit)(void *cls); /** @@ -1081,7 +1081,7 @@ struct TALER_AUDITORDB_Plugin * #GNUNET_SYSERR on DB errors */ enum GNUNET_GenericReturnValue - (*gc)(void *cls); + (*gc)(void *cls); /** @@ -1095,7 +1095,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*insert_auditor_progress)( + (*insert_auditor_progress)( void *cls, const char *progress_key, uint64_t progress_offset, @@ -1112,7 +1112,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*update_auditor_progress)( + (*update_auditor_progress)( void *cls, const char *progress_key, uint64_t progress_offset, @@ -1128,10 +1128,10 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*get_auditor_progress)(void *cls, - const char *progress_key, - uint64_t *progress_offset, - ...); + (*get_auditor_progress)(void *cls, + const char *progress_key, + uint64_t *progress_offset, + ...); /** @@ -1145,10 +1145,10 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*insert_balance)(void *cls, - const char *balance_key, - const struct TALER_Amount *balance_value, - ...); + (*insert_balance)(void *cls, + const char *balance_key, + const struct TALER_Amount *balance_value, + ...); /** @@ -1162,10 +1162,10 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*update_balance)(void *cls, - const char *balance_key, - const struct TALER_Amount *balance_amount, - ...); + (*update_balance)(void *cls, + const char *balance_key, + const struct TALER_Amount *balance_amount, + ...); /** @@ -1178,10 +1178,10 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*get_balance)(void *cls, - const char *balance_key, - struct TALER_Amount *balance_value, - ...); + (*get_balance)(void *cls, + const char *balance_key, + struct TALER_Amount *balance_value, + ...); /** @@ -1194,7 +1194,7 @@ struct TALER_AUDITORDB_Plugin * @return query result status */ enum GNUNET_DB_QueryStatus - (*get_balances)( + (*get_balances)( void *cls, const char *balance_key, TALER_AUDITORDB_BalancesCallback cb, @@ -1210,7 +1210,7 @@ struct TALER_AUDITORDB_Plugin * @return query result status */ enum GNUNET_DB_QueryStatus - (*get_progress_points)( + (*get_progress_points)( void *cls, const char *progress_key, TALER_AUDITORDB_ProgressPointsCallback cb, @@ -1224,7 +1224,7 @@ struct TALER_AUDITORDB_Plugin * @return query result status */ enum GNUNET_DB_QueryStatus - (*insert_exchange_signkey)( + (*insert_exchange_signkey)( void *cls, const struct TALER_AUDITORDB_ExchangeSigningKey *sk); @@ -1237,7 +1237,7 @@ struct TALER_AUDITORDB_Plugin * @return query result status */ enum GNUNET_DB_QueryStatus - (*insert_deposit_confirmation)( + (*insert_deposit_confirmation)( void *cls, const struct TALER_AUDITORDB_DepositConfirmation *dc); @@ -1254,7 +1254,7 @@ struct TALER_AUDITORDB_Plugin * @return query result status */ enum GNUNET_DB_QueryStatus - (*get_deposit_confirmations)( + (*get_deposit_confirmations)( void *cls, int64_t limit, uint64_t offset, @@ -1277,7 +1277,7 @@ struct TALER_AUDITORDB_Plugin * @return query result status */ enum GNUNET_DB_QueryStatus - (*get_amount_arithmetic_inconsistency)( + (*get_amount_arithmetic_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1286,7 +1286,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_coin_inconsistency)( + (*get_coin_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1295,7 +1295,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_row_inconsistency)( + (*get_row_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1304,7 +1304,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_emergency)( + (*get_emergency)( void *cls, int64_t limit, uint64_t offset, @@ -1313,7 +1313,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_emergency_by_count)( + (*get_emergency_by_count)( void *cls, int64_t limit, uint64_t offset, @@ -1322,7 +1322,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_denomination_key_validity_withdraw_inconsistency)( + (*get_denomination_key_validity_withdraw_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1331,7 +1331,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_purse_not_closed_inconsistencies)( + (*get_purse_not_closed_inconsistencies)( void *cls, int64_t limit, uint64_t offset, @@ -1340,7 +1340,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_reserve_balance_insufficient_inconsistency)( + (*get_reserve_balance_insufficient_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1349,7 +1349,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_bad_sig_losses)( + (*get_bad_sig_losses)( void *cls, int64_t limit, uint64_t offset, @@ -1360,7 +1360,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_auditor_closure_lags)( + (*get_auditor_closure_lags)( void *cls, int64_t limit, uint64_t offset, @@ -1369,7 +1369,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_refreshes_hanging)( + (*get_refreshes_hanging)( void *cls, int64_t limit, uint64_t offset, @@ -1385,62 +1385,62 @@ struct TALER_AUDITORDB_Plugin * @return query result status */ enum GNUNET_DB_QueryStatus - (*delete_amount_arithmetic_inconsistency)( + (*delete_amount_arithmetic_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_coin_inconsistency)( + (*delete_coin_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_row_inconsistency)( + (*delete_row_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_emergency)( + (*delete_emergency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_emergency_by_count)( + (*delete_emergency_by_count)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_denomination_key_validity_withdraw_inconsistency)( + (*delete_denomination_key_validity_withdraw_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_purse_not_closed_inconsistencies)( + (*delete_purse_not_closed_inconsistencies)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_reserve_balance_insufficient_inconsistency)( + (*delete_reserve_balance_insufficient_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_bad_sig_losses)( + (*delete_bad_sig_losses)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_auditor_closure_lags)( + (*delete_auditor_closure_lags)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_progress)( + (*delete_progress)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_refreshes_hanging)( + (*delete_refreshes_hanging)( void *cls, uint64_t row_id); @@ -1453,76 +1453,76 @@ struct TALER_AUDITORDB_Plugin * @return query result status */ enum GNUNET_DB_QueryStatus - (*insert_amount_arithmetic_inconsistency)( + (*insert_amount_arithmetic_inconsistency)( void *cls, const struct TALER_AUDITORDB_AmountArithmeticInconsistency *dc); enum GNUNET_DB_QueryStatus - (*insert_coin_inconsistency)( + (*insert_coin_inconsistency)( void *cls, const struct TALER_AUDITORDB_CoinInconsistency *dc); enum GNUNET_DB_QueryStatus - (*insert_row_inconsistency)( + (*insert_row_inconsistency)( void *cls, const struct TALER_AUDITORDB_RowInconsistency *dc); enum GNUNET_DB_QueryStatus - (*insert_emergency)( + (*insert_emergency)( void *cls, const struct TALER_AUDITORDB_Emergency *dc); enum GNUNET_DB_QueryStatus - (*insert_emergency_by_count)( + (*insert_emergency_by_count)( void *cls, const struct TALER_AUDITORDB_EmergenciesByCount *dc); enum GNUNET_DB_QueryStatus - (*insert_denomination_key_validity_withdraw_inconsistency)( + (*insert_denomination_key_validity_withdraw_inconsistency)( void *cls, const struct TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistency *dc); enum GNUNET_DB_QueryStatus - (*insert_purse_not_closed_inconsistencies)( + (*insert_purse_not_closed_inconsistencies)( void *cls, const struct TALER_AUDITORDB_PurseNotClosedInconsistencies *dc); enum GNUNET_DB_QueryStatus - (*insert_reserve_balance_insufficient_inconsistency)( + (*insert_reserve_balance_insufficient_inconsistency)( void *cls, const struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency *dc); enum GNUNET_DB_QueryStatus - (*insert_bad_sig_losses)( + (*insert_bad_sig_losses)( void *cls, const struct TALER_AUDITORDB_BadSigLosses *dc); enum GNUNET_DB_QueryStatus - (*insert_auditor_closure_lags)( + (*insert_auditor_closure_lags)( void *cls, const struct TALER_AUDITORDB_ClosureLags *dc); enum GNUNET_DB_QueryStatus - (*insert_refreshes_hanging)( + (*insert_refreshes_hanging)( void *cls, const struct TALER_AUDITORDB_RefreshesHanging *dc); enum GNUNET_DB_QueryStatus - (*update_generic_suppressed)( + (*update_generic_suppressed)( void *cls, enum TALER_AUDITORDB_DeletableSuppressableTables table, uint64_t row_id, bool suppressed); enum GNUNET_DB_QueryStatus - (*delete_generic)( + (*delete_generic)( void *cls, enum TALER_AUDITORDB_DeletableSuppressableTables table, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*get_reserve_in_inconsistency)( + (*get_reserve_in_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1532,18 +1532,18 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_reserve_in_inconsistency)( + (*delete_reserve_in_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_reserve_in_inconsistency)( + (*insert_reserve_in_inconsistency)( void *cls, const struct TALER_AUDITORDB_ReserveInInconsistency *dc); enum GNUNET_DB_QueryStatus - (*get_reserve_not_closed_inconsistency)( + (*get_reserve_not_closed_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1553,18 +1553,18 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_reserve_not_closed_inconsistency)( + (*delete_reserve_not_closed_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_reserve_not_closed_inconsistency)( + (*insert_reserve_not_closed_inconsistency)( void *cls, const struct TALER_AUDITORDB_ReserveNotClosedInconsistency *dc); enum GNUNET_DB_QueryStatus - (*get_denominations_without_sigs)( + (*get_denominations_without_sigs)( void *cls, int64_t limit, uint64_t offset, @@ -1574,18 +1574,18 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_denominations_without_sigs)( + (*delete_denominations_without_sigs)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_denominations_without_sigs)( + (*insert_denominations_without_sigs)( void *cls, const struct TALER_AUDITORDB_DenominationsWithoutSigs *dc); enum GNUNET_DB_QueryStatus - (*get_misattribution_in_inconsistency)( + (*get_misattribution_in_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1595,18 +1595,18 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_misattribution_in_inconsistency)( + (*delete_misattribution_in_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_misattribution_in_inconsistency)( + (*insert_misattribution_in_inconsistency)( void *cls, const struct TALER_AUDITORDB_MisattributionInInconsistency *dc); enum GNUNET_DB_QueryStatus - (*get_reserves)( + (*get_reserves)( void *cls, int64_t limit, uint64_t offset, @@ -1614,7 +1614,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_purses)( + (*get_purses)( void *cls, int64_t limit, uint64_t offset, @@ -1623,12 +1623,12 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_purses)( + (*delete_purses)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*get_denomination_pending)( + (*get_denomination_pending)( void *cls, int64_t limit, uint64_t offset, @@ -1636,17 +1636,17 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*delete_denomination_pending)( + (*delete_denomination_pending)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_denomination_pending)( + (*insert_denomination_pending)( void *cls, const struct TALER_AUDITORDB_DenominationPending *dc); enum GNUNET_DB_QueryStatus - (*get_exchange_signkeys)( + (*get_exchange_signkeys)( void *cls, int64_t limit, uint64_t offset, @@ -1655,7 +1655,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_wire_format_inconsistency)( + (*get_wire_format_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1665,18 +1665,18 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_wire_format_inconsistency)( + (*delete_wire_format_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_wire_format_inconsistency)( + (*insert_wire_format_inconsistency)( void *cls, const struct TALER_AUDITORDB_WireFormatInconsistency *dc); enum GNUNET_DB_QueryStatus - (*get_wire_out_inconsistency)( + (*get_wire_out_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1686,23 +1686,23 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_wire_out_inconsistency)( + (*delete_wire_out_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_wire_out_inconsistency)( + (*insert_wire_out_inconsistency)( void *cls, const struct TALER_AUDITORDB_WireOutInconsistency *dc); enum GNUNET_DB_QueryStatus - (*delete_wire_out_inconsistency_if_matching)( + (*delete_wire_out_inconsistency_if_matching)( void *cls, const struct TALER_AUDITORDB_WireOutInconsistency *dc); enum GNUNET_DB_QueryStatus - (*get_reserve_balance_summary_wrong_inconsistency)( + (*get_reserve_balance_summary_wrong_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1712,18 +1712,18 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_reserve_balance_summary_wrong_inconsistency)( + (*delete_reserve_balance_summary_wrong_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_reserve_balance_summary_wrong_inconsistency)( + (*insert_reserve_balance_summary_wrong_inconsistency)( void *cls, const struct TALER_AUDITORDB_ReserveBalanceSummaryWrongInconsistency *dc); enum GNUNET_DB_QueryStatus - (*get_row_minor_inconsistencies)( + (*get_row_minor_inconsistencies)( void *cls, int64_t limit, uint64_t offset, @@ -1733,18 +1733,18 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_row_minor_inconsistencies)( + (*delete_row_minor_inconsistencies)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_row_minor_inconsistencies)( + (*insert_row_minor_inconsistencies)( void *cls, const struct TALER_AUDITORDB_RowMinorInconsistencies *dc); enum GNUNET_DB_QueryStatus - (*get_fee_time_inconsistency)( + (*get_fee_time_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1754,13 +1754,13 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_fee_time_inconsistency)( + (*delete_fee_time_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_fee_time_inconsistency)( + (*insert_fee_time_inconsistency)( void *cls, const struct TALER_AUDITORDB_FeeTimeInconsistency *dc); @@ -1776,7 +1776,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*insert_reserve_info)( + (*insert_reserve_info)( void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_AUDITORDB_ReserveFeeBalance *rfb, @@ -1795,7 +1795,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*update_reserve_info)( + (*update_reserve_info)( void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_AUDITORDB_ReserveFeeBalance *rfb, @@ -1814,7 +1814,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*get_reserve_info)( + (*get_reserve_info)( void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, uint64_t *rowid, @@ -1831,8 +1831,8 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*del_reserve_info)(void *cls, - const struct TALER_ReservePublicKeyP *reserve_pub); + (*del_reserve_info)(void *cls, + const struct TALER_ReservePublicKeyP *reserve_pub); /** @@ -1846,10 +1846,10 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*insert_pending_deposit)( + (*insert_pending_deposit)( void *cls, uint64_t batch_deposit_serial_id, - const struct TALER_PaytoHashP *wire_target_h_payto, + const struct TALER_FullPaytoHashP *wire_target_h_payto, const struct TALER_Amount *total_amount, struct GNUNET_TIME_Timestamp deadline); @@ -1864,7 +1864,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*delete_pending_deposit)( + (*delete_pending_deposit)( void *cls, uint64_t batch_deposit_serial_id); @@ -1879,7 +1879,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*select_pending_deposits)( + (*select_pending_deposits)( void *cls, struct GNUNET_TIME_Absolute deadline, TALER_AUDITORDB_WireMissingCallback cb, @@ -1897,7 +1897,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*insert_purse_info)( + (*insert_purse_info)( void *cls, const struct TALER_PurseContractPublicKeyP *purse_pub, const struct TALER_Amount *balance, @@ -1914,7 +1914,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*update_purse_info)( + (*update_purse_info)( void *cls, const struct TALER_PurseContractPublicKeyP *purse_pub, const struct TALER_Amount *balance); @@ -1931,7 +1931,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*get_purse_info)( + (*get_purse_info)( void *cls, const struct TALER_PurseContractPublicKeyP *purse_pub, uint64_t *rowid, @@ -1947,7 +1947,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*delete_purse_info)( + (*delete_purse_info)( void *cls, const struct TALER_PurseContractPublicKeyP *purse_pub); @@ -1961,7 +1961,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*select_purse_expired)( + (*select_purse_expired)( void *cls, TALER_AUDITORDB_ExpiredPurseCallback cb, void *cb_cls); @@ -1977,7 +1977,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*insert_denomination_balance)( + (*insert_denomination_balance)( void *cls, const struct TALER_DenominationHashP *denom_pub_hash, const struct TALER_AUDITORDB_DenominationCirculationData *dcd); @@ -1993,7 +1993,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*update_denomination_balance)( + (*update_denomination_balance)( void *cls, const struct TALER_DenominationHashP *denom_pub_hash, const struct TALER_AUDITORDB_DenominationCirculationData *dcd); @@ -2006,7 +2006,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*del_denomination_balance)( + (*del_denomination_balance)( void *cls, const struct TALER_DenominationHashP *denom_pub_hash); @@ -2020,7 +2020,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*get_denomination_balance)( + (*get_denomination_balance)( void *cls, const struct TALER_DenominationHashP *denom_pub_hash, struct TALER_AUDITORDB_DenominationCirculationData *dcd); @@ -2040,7 +2040,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*insert_historic_denom_revenue)( + (*insert_historic_denom_revenue)( void *cls, const struct TALER_DenominationHashP *denom_pub_hash, struct GNUNET_TIME_Timestamp revenue_timestamp, @@ -2057,7 +2057,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*select_historic_denom_revenue)( + (*select_historic_denom_revenue)( void *cls, int64_t limit, uint64_t offset, @@ -2075,7 +2075,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*insert_historic_reserve_revenue)( + (*insert_historic_reserve_revenue)( void *cls, struct GNUNET_TIME_Timestamp start_time, struct GNUNET_TIME_Timestamp end_time, @@ -2091,7 +2091,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*select_historic_reserve_revenue)( + (*select_historic_reserve_revenue)( void *cls, int64_t limit, uint64_t offset, diff --git a/src/include/taler_bank_service.h b/src/include/taler_bank_service.h index c1d031546..a891c5b7c 100644 --- a/src/include/taler_bank_service.h +++ b/src/include/taler_bank_service.h @@ -204,7 +204,7 @@ TALER_BANK_admin_add_incoming ( const struct TALER_BANK_AuthenticationData *auth, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_Amount *amount, - const char *debit_account, + const struct TALER_FullPayto debit_account, TALER_BANK_AdminAddIncomingCallback res_cb, void *res_cb_cls); @@ -310,7 +310,7 @@ TALER_BANK_admin_add_kycauth ( const struct TALER_BANK_AuthenticationData *auth, const union TALER_AccountPublicKeyP *account_pub, const struct TALER_Amount *amount, - const char *debit_account, + const struct TALER_FullPayto debit_account, TALER_BANK_AdminAddKycauthCallback res_cb, void *res_cb_cls); @@ -342,7 +342,7 @@ TALER_BANK_admin_add_kycauth_cancel ( */ void TALER_BANK_prepare_transfer ( - const char *destination_account_payto_uri, + const struct TALER_FullPayto destination_account_payto_uri, const struct TALER_Amount *amount, const char *exchange_base_url, const struct TALER_WireTransferIdentifierRawP *wtid, @@ -519,7 +519,7 @@ struct TALER_BANK_CreditDetails /** * payto://-URL of the source account that send the funds. */ - const char *debit_account_uri; + struct TALER_FullPayto debit_account_uri; /** * Details that depend on the @e type. @@ -614,7 +614,7 @@ struct TALER_BANK_CreditHistoryResponse /** * payto://-URL of the target account that received the funds. */ - const char *credit_account_uri; + struct TALER_FullPayto credit_account_uri; /** * Array of transactions received. @@ -728,7 +728,7 @@ struct TALER_BANK_DebitDetails /** * payto://-URI of the target account that received the funds. */ - const char *credit_account_uri; + struct TALER_FullPayto credit_account_uri; }; @@ -771,7 +771,7 @@ struct TALER_BANK_DebitHistoryResponse /** * payto://-URI of the source account that send the funds. */ - const char *debit_account_uri; + struct TALER_FullPayto debit_account_uri; /** * Array of transactions initiated. diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index 29796cadc..a068d4f9c 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -824,10 +824,49 @@ struct TALER_MerchantWireHashP /** - * Hash used to represent the unsalted hash of a + * payto:// URI representing a bank account, excluding receiver name + * (and also otherwise normalized, so without BIC, etc.). + */ +struct TALER_NormalizedPayto +{ + /** + * Actual string value. + */ + char *normalized_payto; +}; + + +/** + * payto:// URI representing a bank account, including receiver name, + * not normalized. + */ +struct TALER_FullPayto +{ + /** + * Actual string value. + */ + char *full_payto; +}; + + +/** + * Hash used to represent the unsalted hash of a full * payto:// URI representing a bank account. */ -struct TALER_PaytoHashP +struct TALER_FullPaytoHashP +{ + /** + * Actual hash value. + */ + struct GNUNET_ShortHashCode hash; +}; + + +/** + * Hash used to represent the unsalted hash of a normalized + * payto:// URI representing a bank account. + */ +struct TALER_NormalizedPaytoHashP { /** * Actual hash value. @@ -1828,14 +1867,25 @@ TALER_kyc_measure_authorization_hash ( /** - * Compute the hash of a payto URI. + * Compute the hash of a full payto URI. + * + * @param fpayto URI to hash + * @param[out] h_fpayto where to write the hash + */ +void +TALER_full_payto_hash (const struct TALER_FullPayto fpayto, + struct TALER_FullPaytoHashP *h_fpayto); + + +/** + * Compute the hash of a normalized payto URI. * * @param payto URI to hash - * @param[out] h_payto where to write the hash + * @param[out] h_npayto where to write the hash */ void -TALER_payto_hash (const char *payto, - struct TALER_PaytoHashP *h_payto); +TALER_normalized_payto_hash (const struct TALER_NormalizedPayto npayto, + struct TALER_NormalizedPaytoHashP *h_npayto); /** @@ -2677,7 +2727,7 @@ void TALER_officer_aml_decision_sign ( const char *justification, struct GNUNET_TIME_Timestamp decision_time, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, const json_t *new_rules, const json_t *properties, const char *new_check, @@ -2705,7 +2755,7 @@ enum GNUNET_GenericReturnValue TALER_officer_aml_decision_verify ( const char *justification, struct GNUNET_TIME_Timestamp decision_time, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, const json_t *new_rules, const json_t *properties, const char *new_check, @@ -3464,7 +3514,7 @@ TALER_wallet_purse_deposit_verify ( */ void TALER_wallet_purse_merge_sign ( - const char *reserve_uri, + const struct TALER_NormalizedPayto reserve_uri, struct GNUNET_TIME_Timestamp merge_timestamp, const struct TALER_PurseContractPublicKeyP *purse_pub, const struct TALER_PurseMergePrivateKeyP *merge_priv, @@ -3483,7 +3533,7 @@ TALER_wallet_purse_merge_sign ( */ enum GNUNET_GenericReturnValue TALER_wallet_purse_merge_verify ( - const char *reserve_uri, + const struct TALER_NormalizedPayto reserve_uri, struct GNUNET_TIME_Timestamp merge_timestamp, const struct TALER_PurseContractPublicKeyP *purse_pub, const struct TALER_PurseMergePublicKeyP *merge_pub, @@ -3675,7 +3725,7 @@ TALER_wallet_reserve_open_deposit_verify ( void TALER_wallet_reserve_close_sign ( struct GNUNET_TIME_Timestamp request_timestamp, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const struct TALER_ReservePrivateKeyP *reserve_priv, struct TALER_ReserveSignatureP *reserve_sig); @@ -3693,7 +3743,7 @@ TALER_wallet_reserve_close_sign ( enum GNUNET_GenericReturnValue TALER_wallet_reserve_close_verify ( struct GNUNET_TIME_Timestamp request_timestamp, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReserveSignatureP *reserve_sig); @@ -4524,48 +4574,6 @@ TALER_exchange_online_key_set_verify ( /** - * Create account KYC setup success signature. - * - * @param scb function to call to create the signature - * @param h_payto target of the KYC account - * @param kyc JSON data describing which KYC checks - * were satisfied - * @param timestamp time when the KYC was confirmed - * @param[out] pub where to write the public key - * @param[out] sig where to write the signature - * @return #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_exchange_online_account_setup_success_sign ( - TALER_ExchangeSignCallback scb, - const struct TALER_PaytoHashP *h_payto, - const json_t *kyc, - struct GNUNET_TIME_Timestamp timestamp, - struct TALER_ExchangePublicKeyP *pub, - struct TALER_ExchangeSignatureP *sig); - - -/** - * Verify account KYC setup success signature. - * - * @param h_payto target of the KYC account - * @param kyc JSON data describing which KYC checks - * were satisfied - * @param timestamp time when the KYC was confirmed - * @param pub where to write the public key - * @param sig where to write the signature - * @return #GNUNET_OK if the signature is valid - */ -enum GNUNET_GenericReturnValue -TALER_exchange_online_account_setup_success_verify ( - const struct TALER_PaytoHashP *h_payto, - const json_t *kyc, - struct GNUNET_TIME_Timestamp timestamp, - const struct TALER_ExchangePublicKeyP *pub, - const struct TALER_ExchangeSignatureP *sig); - - -/** * Hash normalized @a j JSON object or array and * store the result in @a hc. * @@ -4617,7 +4625,7 @@ TALER_exchange_online_wire_deposit_sign ( const struct TALER_Amount *total, const struct TALER_Amount *wire_fee, const struct TALER_MerchantPublicKeyP *merchant_pub, - const char *payto, + const struct TALER_FullPayto payto, const struct GNUNET_HashCode *h_details, struct TALER_ExchangePublicKeyP *pub, struct TALER_ExchangeSignatureP *sig); @@ -4640,7 +4648,7 @@ TALER_exchange_online_wire_deposit_verify ( const struct TALER_Amount *total, const struct TALER_Amount *wire_fee, const struct TALER_MerchantPublicKeyP *merchant_pub, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const struct GNUNET_HashCode *h_details, const struct TALER_ExchangePublicKeyP *pub, const struct TALER_ExchangeSignatureP *sig); @@ -4884,7 +4892,7 @@ TALER_exchange_online_reserve_closed_sign ( struct GNUNET_TIME_Timestamp timestamp, const struct TALER_Amount *closing_amount, const struct TALER_Amount *closing_fee, - const char *payto, + const struct TALER_FullPayto payto, const struct TALER_WireTransferIdentifierRawP *wtid, const struct TALER_ReservePublicKeyP *reserve_pub, struct TALER_ExchangePublicKeyP *pub, @@ -4909,7 +4917,7 @@ TALER_exchange_online_reserve_closed_verify ( struct GNUNET_TIME_Timestamp timestamp, const struct TALER_Amount *closing_amount, const struct TALER_Amount *closing_fee, - const char *payto, + const struct TALER_FullPayto payto, const struct TALER_WireTransferIdentifierRawP *wtid, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ExchangePublicKeyP *pub, @@ -5483,7 +5491,7 @@ TALER_exchange_offline_profit_drain_sign ( struct GNUNET_TIME_Timestamp date, const struct TALER_Amount *amount, const char *account_section, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const struct TALER_MasterPrivateKeyP *master_priv, struct TALER_MasterSignatureP *master_sig); @@ -5508,7 +5516,7 @@ TALER_exchange_offline_profit_drain_verify ( struct GNUNET_TIME_Timestamp date, const struct TALER_Amount *amount, const char *account_section, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterSignatureP *master_sig); @@ -5799,7 +5807,7 @@ TALER_exchange_offline_global_fee_verify ( */ void TALER_exchange_offline_wire_add_sign ( - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const char *conversion_url, const json_t *debit_restrictions, const json_t *credit_restrictions, @@ -5822,7 +5830,7 @@ TALER_exchange_offline_wire_add_sign ( */ enum GNUNET_GenericReturnValue TALER_exchange_offline_wire_add_verify ( - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const char *conversion_url, const json_t *debit_restrictions, const json_t *credit_restrictions, @@ -5841,7 +5849,7 @@ TALER_exchange_offline_wire_add_verify ( */ void TALER_exchange_offline_wire_del_sign ( - const char *payto_uri, + const struct TALER_FullPayto payto_uri, struct GNUNET_TIME_Timestamp now, const struct TALER_MasterPrivateKeyP *master_priv, struct TALER_MasterSignatureP *master_sig); @@ -5858,7 +5866,7 @@ TALER_exchange_offline_wire_del_sign ( */ enum GNUNET_GenericReturnValue TALER_exchange_offline_wire_del_verify ( - const char *payto_uri, + const struct TALER_FullPayto payto_uri, struct GNUNET_TIME_Timestamp sign_time, const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterSignatureP *master_sig); @@ -5877,7 +5885,7 @@ TALER_exchange_offline_wire_del_verify ( */ enum GNUNET_GenericReturnValue TALER_exchange_wire_signature_check ( - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const char *conversion_url, const json_t *debit_restrictions, const json_t *credit_restrictions, @@ -5897,7 +5905,7 @@ TALER_exchange_wire_signature_check ( */ void TALER_exchange_wire_signature_make ( - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const char *conversion_url, const json_t *debit_restrictions, const json_t *credit_restrictions, @@ -5915,9 +5923,10 @@ TALER_exchange_wire_signature_make ( * @param[out] hc set to the hash */ void -TALER_merchant_wire_signature_hash (const char *payto_uri, - const struct TALER_WireSaltP *salt, - struct TALER_MerchantWireHashP *hc); +TALER_merchant_wire_signature_hash ( + const struct TALER_FullPayto payto_uri, + const struct TALER_WireSaltP *salt, + struct TALER_MerchantWireHashP *hc); /** @@ -5931,7 +5940,7 @@ TALER_merchant_wire_signature_hash (const char *payto_uri, */ enum GNUNET_GenericReturnValue TALER_merchant_wire_signature_check ( - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const struct TALER_WireSaltP *salt, const struct TALER_MerchantPublicKeyP *merch_pub, const struct TALER_MerchantSignatureP *merch_sig); @@ -5947,7 +5956,7 @@ TALER_merchant_wire_signature_check ( */ void TALER_merchant_wire_signature_make ( - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const struct TALER_WireSaltP *salt, const struct TALER_MerchantPrivateKeyP *merch_priv, struct TALER_MerchantSignatureP *merch_sig); diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index 2aaa02d0a..7a5d55d83 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -36,7 +36,7 @@ * Version of the Taler Exchange API, in hex. * Thus 0.8.4-1 = 0x00080401. */ -#define TALER_EXCHANGE_API_VERSION 0x00100005 +#define TALER_EXCHANGE_API_VERSION 0x00100006 /** * Information returned when a client needs to pass @@ -48,7 +48,7 @@ struct TALER_EXCHANGE_KycNeededRedirect /** * Hash of the payto-URI of the account to KYC; */ - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; /** * Public key needed to access the KYC state of @@ -371,10 +371,10 @@ struct TALER_EXCHANGE_AccountRestriction struct { /** - * Regular expression that the payto://-URI of the partner account must - * follow. The regular expression should follow posix-egrep, but - * without support for character classes, GNU extensions, - * back-references or intervals. See + * Regular expression that the normalized payto://-URI of the partner + * account must follow. The regular expression should follow + * posix-egrep, but without support for character classes, GNU + * extensions, back-references or intervals. See * https://www.gnu.org/software/findutils/manual/html_node/find_html/posix_002degrep-regular-expression-syntax.html * for a description of the posix-egrep syntax. Applications may support * regexes with additional features, but exchanges must not use such @@ -406,7 +406,7 @@ struct TALER_EXCHANGE_WireAccount /** * payto://-URI of the exchange. */ - char *payto_uri; + struct TALER_FullPayto fpayto_uri; /** * URL of a conversion service in case using this account is subject to @@ -1037,7 +1037,7 @@ enum GNUNET_GenericReturnValue TALER_EXCHANGE_test_account_allowed ( const struct TALER_EXCHANGE_WireAccount *account, bool check_credit, - const char *payto_uri); + const struct TALER_NormalizedPayto payto_uri); /** @@ -1281,7 +1281,7 @@ struct TALER_EXCHANGE_DepositContractDetail * The merchant’s account details, in the payto://-format supported by the * exchange. */ - const char *merchant_payto_uri; + const struct TALER_FullPayto merchant_payto_uri; /** * Policy extension specific details about the deposit relevant to the exchange. @@ -2193,7 +2193,7 @@ struct TALER_EXCHANGE_ReserveHistoryEntry /** * Sender account payto://-URL of the incoming transfer. */ - char *sender_url; + struct TALER_FullPayto sender_url; /** * Information that uniquely identifies the wire transfer. @@ -2285,7 +2285,7 @@ struct TALER_EXCHANGE_ReserveHistoryEntry /** * Receiver account information for the outgoing wire transfer as a payto://-URI. */ - const char *receiver_account_details; + struct TALER_FullPayto receiver_account_details; /** * Wire transfer details for the outgoing wire transfer. @@ -2435,7 +2435,7 @@ struct TALER_EXCHANGE_ReserveHistoryEntry * for the closure, or all zeros for the reserve * origin account. */ - struct TALER_PaytoHashP target_account_h_payto; + struct TALER_FullPaytoHashP target_account_h_payto; } close_request; @@ -3956,7 +3956,7 @@ struct TALER_EXCHANGE_TransferData /** * hash of the payto:// URI the transfer went to */ - struct TALER_PaytoHashP h_payto; + struct TALER_FullPaytoHashP h_payto; /** * time when the exchange claims to have performed the wire transfer @@ -4522,7 +4522,7 @@ struct TALER_EXCHANGE_KycCheckHandle * TALER_EXCHANGE_kyc_check ( struct GNUNET_CURL_Context *ctx, const char *url, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, const union TALER_AccountPrivateKeyP *pk, enum TALER_EXCHANGE_KycLongPollTarget lpt, struct GNUNET_TIME_Relative timeout, @@ -4856,7 +4856,7 @@ struct TALER_EXCHANGE_KycProofHandle * TALER_EXCHANGE_kyc_proof ( struct GNUNET_CURL_Context *ctx, const char *url, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, const char *logic, const char *args, TALER_EXCHANGE_KycProofCallback cb, @@ -5449,7 +5449,7 @@ TALER_EXCHANGE_management_drain_profits ( const struct TALER_Amount *amount, struct GNUNET_TIME_Timestamp date, const char *account_section, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const struct TALER_MasterSignatureP *master_sig, TALER_EXCHANGE_ManagementDrainProfitsCallback cb, void *cb_cls); @@ -6114,7 +6114,7 @@ struct TALER_EXCHANGE_AmlDecision /** * Account the decision was made for. */ - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; /** * RowID of this decision. @@ -6229,7 +6229,7 @@ struct TALER_EXCHANGE_LookupAmlDecisions * TALER_EXCHANGE_lookup_aml_decisions ( struct GNUNET_CURL_Context *ctx, const char *exchange_url, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, enum TALER_EXCHANGE_YesNoAll investigation_only, enum TALER_EXCHANGE_YesNoAll active_only, uint64_t offset, @@ -6350,7 +6350,7 @@ struct TALER_EXCHANGE_LookupKycAttributes * TALER_EXCHANGE_lookup_kyc_attributes ( struct GNUNET_CURL_Context *ctx, const char *exchange_url, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, uint64_t offset, int64_t limit, const struct TALER_AmlOfficerPrivateKeyP *officer_priv, @@ -6504,8 +6504,8 @@ struct TALER_EXCHANGE_AddAmlDecision * TALER_EXCHANGE_post_aml_decision ( struct GNUNET_CURL_Context *ctx, const char *url, - const struct TALER_PaytoHashP *h_payto, - const char *payto_uri, + const struct TALER_NormalizedPaytoHashP *h_payto, + const struct TALER_NormalizedPayto payto_uri, struct GNUNET_TIME_Timestamp decision_time, const char *successor_measure, const char *new_measures, @@ -6785,7 +6785,7 @@ struct TALER_EXCHANGE_ManagementWireEnableHandle * TALER_EXCHANGE_management_enable_wire ( struct GNUNET_CURL_Context *ctx, const char *url, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const char *conversion_url, const json_t *debit_restrictions, const json_t *credit_restrictions, @@ -6841,7 +6841,7 @@ struct TALER_EXCHANGE_ManagementWireDisableHandle; * Inform the exchange that a wire account should be disabled. * * @param ctx the context - * @param url HTTP base URL for the exchange + * @param exchange_url HTTP base URL for the exchange * @param payto_uri RFC 8905 URI of the exchange's bank account * @param validity_end when was this decided? * @param master_sig signature affirming the wire addition @@ -6853,8 +6853,8 @@ struct TALER_EXCHANGE_ManagementWireDisableHandle; struct TALER_EXCHANGE_ManagementWireDisableHandle * TALER_EXCHANGE_management_disable_wire ( struct GNUNET_CURL_Context *ctx, - const char *url, - const char *payto_uri, + const char *exchange_url, + const struct TALER_FullPayto payto_uri, struct GNUNET_TIME_Timestamp validity_end, const struct TALER_MasterSignatureP *master_sig, TALER_EXCHANGE_ManagementWireDisableCallback cb, @@ -8224,7 +8224,7 @@ TALER_EXCHANGE_reserves_close ( struct GNUNET_CURL_Context *ctx, const char *url, const struct TALER_ReservePrivateKeyP *reserve_priv, - const char *target_payto_uri, + const struct TALER_FullPayto target_payto_uri, TALER_EXCHANGE_ReservesCloseCallback cb, void *cb_cls); diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index bb1072485..3bb3d03cf 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -240,7 +240,7 @@ struct TALER_KycCompletedEventP /** * Hash of payto://-URI for which the KYC state changed. */ - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; }; @@ -382,7 +382,7 @@ struct TALER_EXCHANGEDB_TableData struct { - char *payto_uri; + struct TALER_FullPayto full_payto_uri; struct TALER_AccountAccessTokenP access_token; union TALER_AccountPublicKeyP target_pub; bool no_account; @@ -398,7 +398,7 @@ struct TALER_EXCHANGEDB_TableData struct { - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; struct GNUNET_TIME_Timestamp decision_time; struct GNUNET_TIME_Timestamp expiration_time; json_t *properties; @@ -408,7 +408,7 @@ struct TALER_EXCHANGEDB_TableData struct { - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; struct GNUNET_TIME_Timestamp start_time; struct GNUNET_TIME_Timestamp expiration_time; uint64_t legitimization_measure_serial_id; @@ -421,7 +421,7 @@ struct TALER_EXCHANGEDB_TableData struct { - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; uint64_t legitimization_serial; struct GNUNET_TIME_Timestamp collection_time; struct GNUNET_TIME_Timestamp expiration_time; @@ -432,7 +432,7 @@ struct TALER_EXCHANGEDB_TableData struct { - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; uint64_t outcome_serial_id; char *justification; struct TALER_AmlOfficerPublicKeyP decider_pub; @@ -466,7 +466,7 @@ struct TALER_EXCHANGEDB_TableData { uint64_t wire_reference; struct TALER_Amount credit; - struct TALER_PaytoHashP sender_account_h_payto; + struct TALER_FullPaytoHashP sender_account_h_payto; char *exchange_account_section; struct GNUNET_TIME_Timestamp execution_date; struct TALER_ReservePublicKeyP reserve_pub; @@ -476,7 +476,7 @@ struct TALER_EXCHANGEDB_TableData { uint64_t wire_reference; struct TALER_Amount credit; - struct TALER_PaytoHashP sender_account_h_payto; + struct TALER_FullPaytoHashP sender_account_h_payto; char *exchange_account_section; struct GNUNET_TIME_Timestamp execution_date; union TALER_AccountPublicKeyP account_pub; @@ -506,7 +506,7 @@ struct TALER_EXCHANGEDB_TableData struct TALER_ReservePublicKeyP reserve_pub; struct GNUNET_TIME_Timestamp execution_date; struct TALER_WireTransferIdentifierRawP wtid; - struct TALER_PaytoHashP sender_account_h_payto; + struct TALER_FullPaytoHashP sender_account_h_payto; struct TALER_Amount amount; struct TALER_Amount closing_fee; } reserves_close; @@ -600,7 +600,7 @@ struct TALER_EXCHANGEDB_TableData struct GNUNET_HashCode wallet_data_hash; bool no_wallet_data_hash; struct TALER_WireSaltP wire_salt; - struct TALER_PaytoHashP wire_target_h_payto; + struct TALER_FullPaytoHashP wire_target_h_payto; bool policy_blocked; uint64_t policy_details_serial_id; bool no_policy_details; @@ -627,7 +627,7 @@ struct TALER_EXCHANGEDB_TableData { struct GNUNET_TIME_Timestamp execution_date; struct TALER_WireTransferIdentifierRawP wtid_raw; - struct TALER_PaytoHashP wire_target_h_payto; + struct TALER_FullPaytoHashP wire_target_h_payto; char *exchange_account_section; struct TALER_Amount amount; } wire_out; @@ -753,7 +753,7 @@ struct TALER_EXCHANGEDB_TableData struct TALER_ReservePublicKeyP reserve_pub; struct TALER_ReserveSignatureP reserve_sig; struct TALER_PurseContractPublicKeyP purse_pub; - struct TALER_PaytoHashP wallet_h_payto; + struct TALER_NormalizedPaytoHashP wallet_h_payto; } account_merges; struct @@ -771,7 +771,7 @@ struct TALER_EXCHANGEDB_TableData struct TALER_ReserveSignatureP reserve_sig; struct TALER_Amount close; struct TALER_Amount close_fee; - char *payto_uri; + struct TALER_FullPayto payto_uri; } close_requests; struct @@ -824,7 +824,7 @@ struct TALER_EXCHANGEDB_TableData { struct TALER_WireTransferIdentifierRawP wtid; char *account_section; - char *payto_uri; + struct TALER_FullPayto payto_uri; struct GNUNET_TIME_Timestamp trigger_date; struct TALER_Amount amount; struct TALER_MasterSignatureP master_sig; @@ -922,7 +922,7 @@ struct TALER_EXCHANGEDB_BankTransfer * Detailed wire information about the sending account * in "payto://" format. */ - char *sender_account_details; + struct TALER_FullPayto sender_account_details; /** * Data uniquely identifying the wire transfer (wire transfer-type specific) @@ -963,7 +963,7 @@ struct TALER_EXCHANGEDB_ClosingTransfer * Detailed wire information about the receiving account * in payto://-format. */ - char *receiver_account_details; + struct TALER_FullPayto receiver_account_details; /** * Detailed wire transfer information that uniquely identifies the @@ -1608,7 +1608,7 @@ struct TALER_EXCHANGEDB_CloseRequest * for the closure, or all zeros for the reserve * origin account. */ - struct TALER_PaytoHashP target_account_h_payto; + struct TALER_FullPaytoHashP target_account_h_payto; /** * Signature by the reserve approving the history request. @@ -1793,7 +1793,7 @@ struct TALER_EXCHANGEDB_BatchDeposit /** * Unsalted hash over @e receiver_wire_account. */ - struct TALER_PaytoHashP wire_target_h_payto; + struct TALER_FullPaytoHashP wire_target_h_payto; /** * Salt used by the merchant to compute "h_wire". @@ -1839,7 +1839,7 @@ struct TALER_EXCHANGEDB_BatchDeposit * Information about the receiver for executing the transaction. URI in * payto://-format. */ - const char *receiver_wire_account; + struct TALER_FullPayto receiver_wire_account; /** * Array about the coins that are being deposited. @@ -1962,7 +1962,7 @@ struct TALER_EXCHANGEDB_Deposit * Information about the receiver for executing the transaction. URI in * payto://-format. */ - char *receiver_wire_account; + struct TALER_FullPayto receiver_wire_account; /** * True if @e policy_json was provided @@ -2076,7 +2076,7 @@ struct TALER_EXCHANGEDB_DepositListEntry * Detailed information about the receiver for executing the transaction. * URL in payto://-format. */ - char *receiver_wire_account; + struct TALER_FullPayto receiver_wire_account; /** * true, if age commitment is not applicable @@ -2659,7 +2659,7 @@ typedef void typedef void (*TALER_EXCHANGEDB_AttributeCallback)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, const char *provider_name, struct GNUNET_TIME_Timestamp collection_time, struct GNUNET_TIME_Timestamp expiration_time, @@ -3076,7 +3076,7 @@ typedef enum GNUNET_GenericReturnValue uint64_t rowid, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_Amount *credit, - const char *sender_account_details, + const struct TALER_FullPayto sender_account_details, uint64_t wire_reference, struct GNUNET_TIME_Timestamp execution_date); @@ -3097,7 +3097,7 @@ typedef enum GNUNET_GenericReturnValue typedef void (*TALER_EXCHANGEDB_WireAccountCallback)( void *cls, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const char *conversion_url, const json_t *debit_restrictions, const json_t *credit_restrictions, @@ -3271,8 +3271,8 @@ typedef void void *cls, uint64_t rowid, const struct TALER_MerchantPublicKeyP *merchant_pub, - const char *account_payto_uri, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPayto account_payto_uri, + const struct TALER_FullPaytoHashP *h_payto, struct GNUNET_TIME_Timestamp exec_time, const struct TALER_PrivateContractHashP *h_contract_terms, const struct TALER_DenominationPublicKey *denom_pub, @@ -3299,7 +3299,7 @@ typedef enum GNUNET_GenericReturnValue uint64_t rowid, struct GNUNET_TIME_Timestamp date, const struct TALER_WireTransferIdentifierRawP *wtid, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const struct TALER_Amount *amount); @@ -3317,7 +3317,7 @@ typedef enum GNUNET_GenericReturnValue typedef bool (*TALER_EXCHANGEDB_TransientAggregationCallback)( void *cls, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const struct TALER_WireTransferIdentifierRawP *wtid, const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_Amount *total); @@ -3451,7 +3451,7 @@ typedef enum GNUNET_GenericReturnValue const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *closing_fee, const struct TALER_ReservePublicKeyP *reserve_pub, - const char *receiver_account, + const struct TALER_FullPayto receiver_account, const struct TALER_WireTransferIdentifierRawP *wtid, uint64_t close_request_row); @@ -3487,7 +3487,7 @@ typedef enum GNUNET_GenericReturnValue void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_Amount *left, - const char *account_details, + const struct TALER_FullPayto account_details, struct GNUNET_TIME_Timestamp expiration_date, uint64_t close_request_row); @@ -3530,7 +3530,7 @@ typedef void void *cls, uint64_t batch_deposit_serial_id, const struct TALER_Amount *total_amount, - const struct TALER_PaytoHashP *wire_target_h_payto, + const struct TALER_FullPaytoHashP *wire_target_h_payto, struct GNUNET_TIME_Timestamp deadline); @@ -3616,7 +3616,7 @@ typedef void void *cls, uint64_t row_id, const char *justification, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, struct GNUNET_TIME_Timestamp decision_time, struct GNUNET_TIME_Absolute expiration_time, const json_t *jproperties, @@ -3941,8 +3941,8 @@ struct TALER_EXCHANGEDB_Plugin (*reserves_get_origin)( void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, - struct TALER_PaytoHashP *h_payto, - char **payto_uri); + struct TALER_FullPaytoHashP *h_payto, + struct TALER_FullPayto *payto_uri); /** @@ -3956,7 +3956,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*drain_kyc_alert)(void *cls, uint32_t trigger_type, - struct TALER_PaytoHashP *h_payto); + struct TALER_NormalizedPaytoHashP *h_payto); /** @@ -4678,7 +4678,7 @@ struct TALER_EXCHANGEDB_Plugin uint64_t start_shard_row, uint64_t end_shard_row, struct TALER_MerchantPublicKeyP *merchant_pub, - char **payto_uri); + struct TALER_FullPayto *payto_uri); /** @@ -4695,7 +4695,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*aggregate)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_WireTransferIdentifierRawP *wtid, struct TALER_Amount *total); @@ -4716,7 +4716,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*create_aggregation_transient)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const char *exchange_account_section, const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_WireTransferIdentifierRawP *wtid, @@ -4738,7 +4738,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*select_aggregation_transient)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const struct TALER_MerchantPublicKeyP *merchant_pub, const char *exchange_account_section, struct TALER_WireTransferIdentifierRawP *wtid, @@ -4757,7 +4757,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*find_aggregation_transient)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, TALER_EXCHANGEDB_TransientAggregationCallback cb, void *cb_cls); @@ -4776,7 +4776,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*update_aggregation_transient)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const struct TALER_WireTransferIdentifierRawP *wtid, uint64_t kyc_requirement_row, const struct TALER_Amount *total); @@ -4794,7 +4794,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*delete_aggregation_transient)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const struct TALER_WireTransferIdentifierRawP *wtid); @@ -5188,7 +5188,7 @@ struct TALER_EXCHANGEDB_Plugin void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, struct TALER_Amount *balance, - char **payto_uri); + struct TALER_FullPayto *payto_uri); /** @@ -5215,7 +5215,7 @@ struct TALER_EXCHANGEDB_Plugin struct GNUNET_TIME_Timestamp *request_timestamp, struct TALER_Amount *close_balance, struct TALER_Amount *close_fee, - char **payto_uri); + struct TALER_FullPayto *payto_uri); /** @@ -5224,7 +5224,6 @@ struct TALER_EXCHANGEDB_Plugin * * @param cls closure * @param h_payto which target account is this about? - * @param h_payto account identifier * @param time_limit oldest transaction that could be relevant * @param kac function to call for each applicable amount, in reverse chronological order (or until @a kac aborts by returning anything except #GNUNET_OK). * @param kac_cls closure for @a kac @@ -5233,7 +5232,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*iterate_reserve_close_info)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, struct GNUNET_TIME_Absolute time_limit, TALER_EXCHANGEDB_KycAmountCallback kac, void *kac_cls); @@ -5257,9 +5256,8 @@ struct TALER_EXCHANGEDB_Plugin void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, struct GNUNET_TIME_Timestamp execution_date, - const char *receiver_account, - const struct - TALER_WireTransferIdentifierRawP *wtid, + const struct TALER_FullPayto receiver_account, + const struct TALER_WireTransferIdentifierRawP *wtid, const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *closing_fee, uint64_t close_request_row); @@ -5355,7 +5353,7 @@ struct TALER_EXCHANGEDB_Plugin void *cls, struct GNUNET_TIME_Timestamp date, const struct TALER_WireTransferIdentifierRawP *wtid, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const char *exchange_account_section, const struct TALER_Amount *amount); @@ -5840,8 +5838,8 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*select_justification_for_missing_wire)( void *cls, - const struct TALER_PaytoHashP *wire_target_h_payto, - char **payto_uri, + const struct TALER_FullPaytoHashP *wire_target_h_payto, + struct TALER_FullPayto *payto_uri, json_t **jproperties, json_t **jrules); @@ -5931,7 +5929,7 @@ struct TALER_EXCHANGEDB_Plugin */ enum GNUNET_DB_QueryStatus (*lookup_wire_timestamp)(void *cls, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, struct GNUNET_TIME_Timestamp *last_date); @@ -5953,7 +5951,7 @@ struct TALER_EXCHANGEDB_Plugin */ enum GNUNET_DB_QueryStatus (*insert_wire)(void *cls, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const char *conversion_url, const json_t *debit_restrictions, const json_t *credit_restrictions, @@ -5981,7 +5979,7 @@ struct TALER_EXCHANGEDB_Plugin */ enum GNUNET_DB_QueryStatus (*update_wire)(void *cls, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const char *conversion_url, const json_t *debit_restrictions, const json_t *credit_restrictions, @@ -6812,7 +6810,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*insert_close_request)(void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const struct TALER_ReserveSignatureP *reserve_sig, struct GNUNET_TIME_Timestamp request_timestamp, const struct TALER_Amount *balance, @@ -6835,7 +6833,7 @@ struct TALER_EXCHANGEDB_Plugin (*insert_drain_profit)(void *cls, const struct TALER_WireTransferIdentifierRawP *wtid, const char *account_section, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, struct GNUNET_TIME_Timestamp request_timestamp, const struct TALER_Amount *amount, const struct TALER_MasterSignatureP *master_sig); @@ -6859,7 +6857,7 @@ struct TALER_EXCHANGEDB_Plugin const struct TALER_WireTransferIdentifierRawP *wtid, uint64_t *serial, char **account_section, - char **payto_uri, + struct TALER_FullPayto *payto_uri, struct GNUNET_TIME_Timestamp *request_timestamp, struct TALER_Amount *amount, struct TALER_MasterSignatureP *master_sig); @@ -6884,7 +6882,7 @@ struct TALER_EXCHANGEDB_Plugin uint64_t *serial, struct TALER_WireTransferIdentifierRawP *wtid, char **account_section, - char **payto_uri, + struct TALER_FullPayto *payto_uri, struct GNUNET_TIME_Timestamp *request_timestamp, struct TALER_Amount *amount, struct TALER_MasterSignatureP *master_sig); @@ -6926,8 +6924,8 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*trigger_kyc_rule_for_account)( void *cls, - const char *payto_uri, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPayto payto_uri, + const struct TALER_NormalizedPaytoHashP *h_payto, const union TALER_AccountPublicKeyP *set_account_pub, const struct TALER_MerchantPublicKeyP *check_merchant_pub, const json_t *jmeasures, @@ -6955,7 +6953,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*insert_kyc_requirement_process)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, uint32_t measure_index, uint64_t legitimization_measure_serial_id, const char *provider_name, @@ -6976,7 +6974,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*get_pending_kyc_requirement_process)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, const char *provider_name, char **redirect_url); @@ -7003,7 +7001,7 @@ struct TALER_EXCHANGEDB_Plugin void *cls, uint64_t process_row, const char *provider_name, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, const char *provider_account_id, const char *provider_legitimization_id, const char *redirect_url, @@ -7037,7 +7035,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*lookup_kyc_requirement_by_row)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, union TALER_AccountPublicKeyP *account_pub, struct TALER_ReservePublicKeyP *reserve_pub, struct TALER_AccountAccessTokenP *access_token, @@ -7075,7 +7073,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*lookup_rules_by_access_token)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, json_t **jnew_rules, uint64_t *rowid); @@ -7096,7 +7094,7 @@ struct TALER_EXCHANGEDB_Plugin (*lookup_kyc_process_by_account)( void *cls, const char *provider_name, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, uint64_t *process_row, struct GNUNET_TIME_Absolute *expiration, char **provider_account_id, @@ -7104,8 +7102,7 @@ struct TALER_EXCHANGEDB_Plugin /** - * Lookup an - * @a h_payto by @a provider_legitimization_id. + * Lookup an @a h_payto by @a provider_legitimization_id. * * @param cls closure * @param provider_name @@ -7119,7 +7116,7 @@ struct TALER_EXCHANGEDB_Plugin void *cls, const char *provider_name, const char *provider_legitimization_id, - struct TALER_PaytoHashP *h_payto, + struct TALER_NormalizedPaytoHashP *h_payto, uint64_t *process_row); @@ -7142,7 +7139,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*get_kyc_rules)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, bool *no_account_pub, union TALER_AccountPublicKeyP *account_pub, bool *no_reserve_pub, @@ -7163,7 +7160,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*iterate_kyc_reference)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, TALER_EXCHANGEDB_LegitimizationProcessCallback lpc, void *lpc_cls); @@ -7182,7 +7179,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*select_withdraw_amounts_for_kyc_check)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, struct GNUNET_TIME_Absolute time_limit, TALER_EXCHANGEDB_KycAmountCallback kac, void *kac_cls); @@ -7202,7 +7199,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*select_aggregation_amounts_for_kyc_check)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, struct GNUNET_TIME_Absolute time_limit, TALER_EXCHANGEDB_KycAmountCallback kac, void *kac_cls); @@ -7222,7 +7219,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*select_merge_amounts_for_kyc_check)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, struct GNUNET_TIME_Absolute time_limit, TALER_EXCHANGEDB_KycAmountCallback kac, void *kac_cls); @@ -7244,7 +7241,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*select_deposit_amounts_for_kyc_check)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, struct GNUNET_TIME_Absolute time_limit, TALER_EXCHANGEDB_KycAmountCallback kac, void *kac_cls); @@ -7267,7 +7264,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*insert_programmatic_legitimization_outcome)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, struct GNUNET_TIME_Timestamp decision_time, struct GNUNET_TIME_Absolute expiration_time, const json_t *account_properties, @@ -7303,7 +7300,7 @@ struct TALER_EXCHANGEDB_Plugin (*insert_kyc_attributes)( void *cls, uint64_t process_row, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, uint32_t birthday, struct GNUNET_TIME_Timestamp collection_time, const char *provider_name, @@ -7331,7 +7328,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*select_kyc_attributes)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, TALER_EXCHANGEDB_AttributeCallback cb, void *cb_cls); @@ -7397,25 +7394,6 @@ struct TALER_EXCHANGEDB_Plugin bool *read_only, struct GNUNET_TIME_Absolute *last_change); -#if 0 - /** - * Obtain the current AML threshold set for an account. - * - * @param cls closure - * @param h_payto account for which the AML threshold is stored - * @param[out] decision set to current AML decision - * @param[out] threshold set to the existing threshold - * @return database transaction status, 0 if no threshold was set - */ - enum GNUNET_DB_QueryStatus - (*select_aml_threshold)( - void *cls, - const struct TALER_PaytoHashP *h_payto, - enum TALER_AmlDecisionState *decision, - struct TALER_EXCHANGEDB_KycStatus *kyc, - struct TALER_Amount *threshold); -#endif - /** * Obtain the AML statistics for a given key and @@ -7449,7 +7427,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*trigger_aml_process)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, const struct TALER_Amount *threshold_crossed); @@ -7470,7 +7448,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*select_aml_decisions)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, enum TALER_EXCHANGE_YesNoAll investigation_only, enum TALER_EXCHANGE_YesNoAll active_only, uint64_t offset, @@ -7494,7 +7472,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*select_aml_attributes)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, uint64_t offset, int64_t limit, TALER_EXCHANGEDB_AmlAttributeCallback cb, @@ -7515,7 +7493,7 @@ struct TALER_EXCHANGEDB_Plugin (*lookup_h_payto_by_access_token)( void *cls, const struct TALER_AccountAccessTokenP *access_token, - struct TALER_PaytoHashP *h_payto); + struct TALER_NormalizedPaytoHashP *h_payto); /** @@ -7539,7 +7517,7 @@ struct TALER_EXCHANGEDB_Plugin void *cls, uint64_t legitimization_measure_serial_id, struct TALER_AccountAccessTokenP *access_token, - struct TALER_PaytoHashP *h_payto, + struct TALER_NormalizedPaytoHashP *h_payto, json_t **jmeasures, bool *is_finished); @@ -7573,7 +7551,7 @@ struct TALER_EXCHANGEDB_Plugin uint64_t legitimization_measure_serial_id, uint32_t measure_index, struct TALER_AccountAccessTokenP *access_token, - struct TALER_PaytoHashP *h_payto, + struct TALER_NormalizedPaytoHashP *h_payto, json_t **jmeasures, bool *is_finished, size_t *encrypted_attributes_len, @@ -7593,7 +7571,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*lookup_aml_history)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, TALER_EXCHANGEDB_AmlHistoryCallback cb, void *cb_cls); @@ -7611,7 +7589,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*lookup_kyc_history)( void *cls, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, TALER_EXCHANGEDB_KycHistoryCallback cb, void *cb_cls); @@ -7686,8 +7664,8 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*insert_aml_decision)( void *cls, - const char *payto_uri, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPayto payto_uri, + const struct TALER_NormalizedPaytoHashP *h_payto, struct GNUNET_TIME_Timestamp decision_time, struct GNUNET_TIME_Timestamp expiration_time, const json_t *properties, @@ -7721,7 +7699,7 @@ struct TALER_EXCHANGEDB_Plugin (*insert_kyc_failure)( void *cls, uint64_t process_row, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, const char *provider_name, const char *provider_account_id, const char *provider_legitimization_id, diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h index 0e8c8fc2b..fa3a25b31 100644 --- a/src/include/taler_json_lib.h +++ b/src/include/taler_json_lib.h @@ -184,6 +184,34 @@ TALER_JSON_pack_amount ( /** * Generate packer instruction for a JSON field of type + * full payto. + * + * @param name name of the field to add to the object + * @param payto payto URI to pack + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +TALER_JSON_pack_full_payto ( + const char *name, + const struct TALER_FullPayto payto); + + +/** + * Generate packer instruction for a JSON field of type + * normalized payto. + * + * @param name name of the field to add to the object + * @param payto payto URI to pack + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +TALER_JSON_pack_normalized_payto ( + const char *name, + const struct TALER_NormalizedPayto payto); + + +/** + * Generate packer instruction for a JSON field of type * encrypted contract. * * @param name name of the field to add to the object @@ -451,8 +479,9 @@ TALER_JSON_spec_web_url (const char *field, * @return corresponding field spec */ struct GNUNET_JSON_Specification -TALER_JSON_spec_payto_uri (const char *field, - const char **payto_uri); +TALER_JSON_spec_full_payto_uri ( + const char *field, + struct TALER_FullPayto *payto_uri); /** @@ -861,7 +890,7 @@ TALER_JSON_wire_to_method ( * * @return NULL on error */ -char * +struct TALER_FullPayto TALER_JSON_wire_to_payto ( const json_t *wire_s); diff --git a/src/include/taler_kyclogic_plugin.h b/src/include/taler_kyclogic_plugin.h index 0018086b6..00f35fd60 100644 --- a/src/include/taler_kyclogic_plugin.h +++ b/src/include/taler_kyclogic_plugin.h @@ -201,7 +201,7 @@ typedef void (*TALER_KYCLOGIC_WebhookCallback)( void *cls, uint64_t process_row, - const struct TALER_PaytoHashP *account_id, + const struct TALER_NormalizedPaytoHashP *account_id, const char *provider_name, const char *provider_user_id, const char *provider_legitimization_id, @@ -229,7 +229,7 @@ typedef enum GNUNET_DB_QueryStatus void *cls, const char *provider_name, const char *provider_legitimization_id, - struct TALER_PaytoHashP *h_payto, + struct TALER_NormalizedPaytoHashP *h_payto, uint64_t *process_row); @@ -291,7 +291,7 @@ struct TALER_KYCLOGIC_Plugin struct TALER_KYCLOGIC_InitiateHandle * (*initiate)(void *cls, const struct TALER_KYCLOGIC_ProviderDetails *pd, - const struct TALER_PaytoHashP *account_id, + const struct TALER_NormalizedPaytoHashP *account_id, uint64_t process_row, TALER_KYCLOGIC_InitiateCallback cb, void *cb_cls); @@ -324,7 +324,7 @@ struct TALER_KYCLOGIC_Plugin (*proof)(void *cls, const struct TALER_KYCLOGIC_ProviderDetails *pd, struct MHD_Connection *connection, - const struct TALER_PaytoHashP *account_id, + const struct TALER_NormalizedPaytoHashP *account_id, uint64_t process_row, const char *provider_user_id, const char *provider_legitimization_id, diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index 6b7ae667d..5c00901f6 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -153,17 +153,17 @@ struct TALER_TESTING_Credentials /** * RFC 8905 URI of the exchange. */ - char *exchange_payto; + struct TALER_FullPayto exchange_payto; /** * RFC 8905 URI of a user. */ - char *user42_payto; + struct TALER_FullPayto user42_payto; /** * RFC 8905 URI of a user. */ - char *user43_payto; + struct TALER_FullPayto user43_payto; }; @@ -200,12 +200,12 @@ TALER_TESTING_get_credentials ( * Allocate and return a piece of wire-details. Combines * a @a payto -URL and adds some salt to create the JSON. * - * @param payto payto://-URL to encapsulate + * @param fpayto payto://-URL to encapsulate * @return JSON describing the account, including the * payto://-URL of the account, must be manually decref'd */ json_t * -TALER_TESTING_make_wire_details (const char *payto); +TALER_TESTING_make_wire_details (const struct TALER_FullPayto fpayto); /** @@ -315,10 +315,10 @@ struct TALER_TESTING_Command * @return #GNUNET_OK on success */ enum GNUNET_GenericReturnValue - (*traits)(void *cls, - const void **ret, - const char *trait, - unsigned int index); + (*traits)(void *cls, + const void **ret, + const char *trait, + unsigned int index); /** * When did the execution of this command start? @@ -776,8 +776,8 @@ struct TALER_TESTING_Command TALER_TESTING_cmd_transfer (const char *label, const char *amount, const struct TALER_BANK_AuthenticationData *auth, - const char *payto_debit_account, - const char *payto_credit_account, + const struct TALER_FullPayto payto_debit_account, + const struct TALER_FullPayto payto_credit_account, const struct TALER_WireTransferIdentifierRawP *wtid, const char *exchange_base_url); @@ -864,7 +864,7 @@ TALER_TESTING_cmd_admin_add_incoming ( const char *label, const char *amount, const struct TALER_BANK_AuthenticationData *auth, - const char *payto_debit_account); + const struct TALER_FullPayto payto_debit_account); /** @@ -884,7 +884,7 @@ TALER_TESTING_cmd_admin_add_kycauth ( const char *label, const char *amount, const struct TALER_BANK_AuthenticationData *auth, - const char *payto_debit_account, + const struct TALER_FullPayto payto_debit_account, const char *account_ref); @@ -908,7 +908,7 @@ TALER_TESTING_cmd_admin_add_incoming_with_ref ( const char *label, const char *amount, const struct TALER_BANK_AuthenticationData *auth, - const char *payto_debit_account, + const struct TALER_FullPayto payto_debit_account, const char *ref, unsigned int http_status); @@ -1298,10 +1298,11 @@ TALER_TESTING_cmd_reserve_poll_finish (const char *label, * @return the command. */ struct TALER_TESTING_Command -TALER_TESTING_cmd_reserve_history (const char *label, - const char *reserve_reference, - const char *expected_balance, - unsigned int expected_response_code); +TALER_TESTING_cmd_reserve_history ( + const char *label, + const char *reserve_reference, + const char *expected_balance, + unsigned int expected_response_code); /** @@ -1314,10 +1315,11 @@ TALER_TESTING_cmd_reserve_history (const char *label, * @return the command. */ struct TALER_TESTING_Command -TALER_TESTING_cmd_coin_history (const char *label, - const char *coin_reference, - const char *expected_balance, - unsigned int expected_response_code); +TALER_TESTING_cmd_coin_history ( + const char *label, + const char *coin_reference, + const char *expected_balance, + unsigned int expected_response_code); /** @@ -1333,13 +1335,14 @@ TALER_TESTING_cmd_coin_history (const char *label, * @return the command. */ struct TALER_TESTING_Command -TALER_TESTING_cmd_reserve_open (const char *label, - const char *reserve_reference, - const char *reserve_pay, - struct GNUNET_TIME_Relative expiration_time, - uint32_t min_purses, - unsigned int expected_response_code, - ...); +TALER_TESTING_cmd_reserve_open ( + const char *label, + const char *reserve_reference, + const char *reserve_pay, + struct GNUNET_TIME_Relative expiration_time, + uint32_t min_purses, + unsigned int expected_response_code, + ...); /** @@ -1352,10 +1355,11 @@ TALER_TESTING_cmd_reserve_open (const char *label, * @return the command. */ struct TALER_TESTING_Command -TALER_TESTING_cmd_reserve_get_attestable (const char *label, - const char *reserve_reference, - unsigned int expected_response_code, - ...); +TALER_TESTING_cmd_reserve_get_attestable ( + const char *label, + const char *reserve_reference, + unsigned int expected_response_code, + ...); /** @@ -1368,10 +1372,11 @@ TALER_TESTING_cmd_reserve_get_attestable (const char *label, * @return the command. */ struct TALER_TESTING_Command -TALER_TESTING_cmd_reserve_attest (const char *label, - const char *reserve_reference, - unsigned int expected_response_code, - ...); +TALER_TESTING_cmd_reserve_attest ( + const char *label, + const char *reserve_reference, + unsigned int expected_response_code, + ...); /** @@ -1384,10 +1389,11 @@ TALER_TESTING_cmd_reserve_attest (const char *label, * @return the command. */ struct TALER_TESTING_Command -TALER_TESTING_cmd_reserve_close (const char *label, - const char *reserve_reference, - const char *target_account, - unsigned int expected_response_code); +TALER_TESTING_cmd_reserve_close ( + const char *label, + const char *reserve_reference, + const char *target_account, + unsigned int expected_response_code); /** @@ -1410,14 +1416,15 @@ TALER_TESTING_cmd_reserve_close (const char *label, * @return the command. */ struct TALER_TESTING_Command -TALER_TESTING_cmd_deposit (const char *label, - const char *coin_reference, - unsigned int coin_index, - const char *target_account_payto, - const char *contract_terms, - struct GNUNET_TIME_Relative refund_deadline, - const char *amount, - unsigned int expected_response_code); +TALER_TESTING_cmd_deposit ( + const char *label, + const char *coin_reference, + unsigned int coin_index, + const struct TALER_FullPayto target_account_payto, + const char *contract_terms, + struct GNUNET_TIME_Relative refund_deadline, + const char *amount, + unsigned int expected_response_code); /** * Create a "deposit" command that references an existing merchant key. @@ -1444,15 +1451,16 @@ TALER_TESTING_cmd_deposit (const char *label, * @return the command. */ struct TALER_TESTING_Command -TALER_TESTING_cmd_deposit_with_ref (const char *label, - const char *coin_reference, - unsigned int coin_index, - const char *target_account_payto, - const char *contract_terms, - struct GNUNET_TIME_Relative refund_deadline, - const char *amount, - unsigned int expected_response_code, - const char *merchant_priv_reference); +TALER_TESTING_cmd_deposit_with_ref ( + const char *label, + const char *coin_reference, + unsigned int coin_index, + const struct TALER_FullPayto target_account_payto, + const char *contract_terms, + struct GNUNET_TIME_Relative refund_deadline, + const char *amount, + unsigned int expected_response_code, + const char *merchant_priv_reference); /** * Modify a deposit command to enable retries when we get transient @@ -1497,12 +1505,13 @@ TALER_TESTING_cmd_deposit_replay (const char *label, * @return the command. */ struct TALER_TESTING_Command -TALER_TESTING_cmd_batch_deposit (const char *label, - const char *target_account_payto, - const char *contract_terms, - struct GNUNET_TIME_Relative refund_deadline, - unsigned int expected_response_code, - ...); +TALER_TESTING_cmd_batch_deposit ( + const char *label, + const struct TALER_FullPayto target_account_payto, + const char *contract_terms, + struct GNUNET_TIME_Relative refund_deadline, + unsigned int expected_response_code, + ...); /** @@ -1677,8 +1686,8 @@ TALER_TESTING_cmd_check_bank_transfer ( const char *label, const char *exchange_base_url, const char *amount, - const char *debit_payto, - const char *credit_payto); + const struct TALER_FullPayto debit_payto, + const struct TALER_FullPayto credit_payto); /** @@ -1696,8 +1705,8 @@ struct TALER_TESTING_Command TALER_TESTING_cmd_check_bank_admin_transfer ( const char *label, const char *amount, - const char *debit_payto, - const char *credit_payto, + const struct TALER_FullPayto debit_payto, + const struct TALER_FullPayto credit_payto, const char *reserve_pub_ref); @@ -2075,7 +2084,7 @@ TALER_TESTING_cmd_set_wire_fee (const char *label, */ struct TALER_TESTING_Command TALER_TESTING_cmd_wire_add (const char *label, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, unsigned int expected_http_status, bool bad_sig); @@ -2092,7 +2101,7 @@ TALER_TESTING_cmd_wire_add (const char *label, */ struct TALER_TESTING_Command TALER_TESTING_cmd_wire_del (const char *label, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, unsigned int expected_http_status, bool bad_sig); @@ -2656,7 +2665,7 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits, enum GNUNET_GenericReturnValue \ TALER_TESTING_get_trait_ ## name ( \ const struct TALER_TESTING_Command *cmd, \ - type * *ret); \ + type **ret); \ struct TALER_TESTING_Trait \ TALER_TESTING_make_trait_ ## name ( \ type * value); @@ -2699,11 +2708,11 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits, TALER_TESTING_get_trait_ ## name ( \ const struct TALER_TESTING_Command *cmd, \ unsigned int index, \ - type * *ret); \ + type **ret); \ struct TALER_TESTING_Trait \ TALER_TESTING_make_trait_ ## name ( \ unsigned int index, \ - type * value); + type *value); /** @@ -2757,7 +2766,8 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits, op (contract_priv, const struct TALER_ContractDiffiePrivateP) \ op (reserve_priv, const struct TALER_ReservePrivateKeyP) \ op (reserve_sig, const struct TALER_ReserveSignatureP) \ - op (h_payto, const struct TALER_PaytoHashP) \ + op (h_full_payto, const struct TALER_FullPaytoHashP) \ + op (h_normalized_payto, const struct TALER_NormalizedPaytoHashP) \ op (account_access_token, const struct TALER_AccountAccessTokenP) \ op (account_priv, const union TALER_AccountPrivateKeyP) \ op (account_pub, const union TALER_AccountPublicKeyP) \ @@ -2775,14 +2785,15 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits, op (auditor_url, const char) \ op (exchange_bank_account_url, const char) \ op (taler_uri, const char) \ - op (payto_uri, const char) \ + op (full_payto_uri, const struct TALER_FullPayto) \ + op (normalized_payto_uri, const struct TALER_NormalizedPayto) \ op (kyc_url, const char) \ op (web_url, const char) \ op (row, const uint64_t) \ op (legi_requirement_row, const uint64_t) \ op (array_length, const unsigned int) \ - op (credit_payto_uri, const char) \ - op (debit_payto_uri, const char) \ + op (credit_payto_uri, const struct TALER_FullPayto) \ + op (debit_payto_uri, const struct TALER_FullPayto) \ op (order_id, const char) \ op (amount, const struct TALER_Amount) \ op (amount_with_fee, const struct TALER_Amount) \ diff --git a/src/include/taler_util.h b/src/include/taler_util.h index e8e8610b5..d687f3bb4 100644 --- a/src/include/taler_util.h +++ b/src/include/taler_util.h @@ -34,9 +34,9 @@ #if MHD_VERSION < 0x00097701 #define MHD_create_response_from_buffer_static(s, b) \ - MHD_create_response_from_buffer (s, \ - (const char *) b, \ - MHD_RESPMEM_PERSISTENT) + MHD_create_response_from_buffer (s, \ + (const char *) b, \ + MHD_RESPMEM_PERSISTENT) #endif /** @@ -64,16 +64,16 @@ /* Define logging functions */ #define TALER_LOG_DEBUG(...) \ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) #define TALER_LOG_INFO(...) \ - GNUNET_log (GNUNET_ERROR_TYPE_INFO, __VA_ARGS__) + GNUNET_log (GNUNET_ERROR_TYPE_INFO, __VA_ARGS__) #define TALER_LOG_WARNING(...) \ - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, __VA_ARGS__) + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, __VA_ARGS__) #define TALER_LOG_ERROR(...) \ - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, __VA_ARGS__) + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, __VA_ARGS__) /** @@ -84,11 +84,11 @@ * @param reason string to print as warning */ #define TALER_assert_as(EXP, reason) \ - do { \ - if (EXP) break; \ - TALER_LOG_ERROR ("%s at %s:%d\n", reason, __FILE__, __LINE__); \ - abort (); \ - } while (0) + do { \ + if (EXP) break; \ + TALER_LOG_ERROR ("%s at %s:%d\n", reason, __FILE__, __LINE__); \ + abort (); \ + } while (0) /** @@ -119,11 +119,11 @@ #define TALER_gcry_ok(cmd) \ - do {int rc; rc = cmd; if (! rc) break; \ - TALER_LOG_ERROR ("A Gcrypt call failed at %s:%d with error: %s\n", \ - __FILE__, \ - __LINE__, gcry_strerror (rc)); abort (); } while (0 \ - ) + do {int rc; rc = cmd; if (! rc) break; \ + TALER_LOG_ERROR ("A Gcrypt call failed at %s:%d with error: %s\n", \ + __FILE__, \ + __LINE__, gcry_strerror (rc)); abort (); } while (0 \ + ) /** @@ -382,6 +382,18 @@ TALER_url_valid_charset (const char *url); /** + * Compare two payto URIs for equality. + * + * @param a a full payto URI, NULL is permitted + * @param b a full payto URI, NULL is permitted + * @return 0 if both are equal, otherwise -1 or 1 + */ +int +TALER_full_payto_cmp (const struct TALER_FullPayto a, + const struct TALER_FullPayto b); + + +/** * Test if the URL is a valid "http" (or "https") * URL (includes test for #TALER_url_valid_charset()). * @@ -522,8 +534,8 @@ TALER_payto_get_method (const char *payto_uri); * @param input a payto://-URI * @return normalized URI, or NULL if @a input was not well-formed */ -char * -TALER_payto_normalize (const char *input); +struct TALER_NormalizedPayto +TALER_payto_normalize (const struct TALER_FullPayto input); /** @@ -540,33 +552,33 @@ TALER_xtalerbank_account_from_payto (const char *payto); /** * Obtain the receiver name from a payto URL. * - * @param payto an x-taler-bank payto URL - * @return only the receiver name from the @a payto URL, NULL if not an x-taler-bank payto URL + * @param fpayto a full payto URL + * @return only the receiver name from the @a payto URL, NULL if not a full payto URL */ char * -TALER_payto_get_receiver_name (const char *payto); +TALER_payto_get_receiver_name (const struct TALER_FullPayto fpayto); /** * Extract the subject value from the URI parameters. * - * @param payto_uri the URL to parse + * @param payto_uri the full URL to parse * @return NULL if the subject parameter is not found. * The caller should free the returned value. */ char * -TALER_payto_get_subject (const char *payto_uri); +TALER_payto_get_subject (const struct TALER_FullPayto payto_uri); /** - * Check that a payto:// URI is well-formed. + * Check that a full payto:// URI is well-formed. * - * @param payto_uri the URL to check + * @param fpayto_uri the full URL to check * @return NULL on success, otherwise an error * message to be freed by the caller! */ char * -TALER_payto_validate (const char *payto_uri); +TALER_payto_validate (const struct TALER_FullPayto fpayto_uri); /** @@ -577,7 +589,7 @@ TALER_payto_validate (const char *payto_uri); * @param reserve_pub the public key of the reserve * @return payto://-URI for the reserve (without receiver-name!) */ -char * +struct TALER_NormalizedPayto TALER_reserve_make_payto (const char *exchange_url, const struct TALER_ReservePublicKeyP *reserve_pub); @@ -843,7 +855,7 @@ TALER_get_lowest_age ( * @return lowest age for the largest age group */ #define TALER_adult_age(mask) \ - sizeof((mask)->bits) * 8 - __builtin_clz ((mask)->bits) - 1 + sizeof((mask)->bits) * 8 - __builtin_clz ((mask)->bits) - 1 #undef __TALER_UTIL_LIB_H_INSIDE__ diff --git a/src/json/json_helper.c b/src/json/json_helper.c index 2d1037ef6..12dadbff1 100644 --- a/src/json/json_helper.c +++ b/src/json/json_helper.c @@ -1200,10 +1200,11 @@ TALER_JSON_spec_web_url (const char *field, * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error */ static enum GNUNET_GenericReturnValue -parse_payto_uri (void *cls, - json_t *root, - struct GNUNET_JSON_Specification *spec) +parse_full_payto_uri (void *cls, + json_t *root, + struct GNUNET_JSON_Specification *spec) { + struct TALER_FullPayto *payto_uri = spec->ptr; const char *str; char *err; @@ -1214,29 +1215,31 @@ parse_payto_uri (void *cls, GNUNET_break_op (0); return GNUNET_SYSERR; } - err = TALER_payto_validate (str); + payto_uri->full_payto = (char *) str; + err = TALER_payto_validate (*payto_uri); if (NULL != err) { GNUNET_break_op (0); GNUNET_free (err); + payto_uri->full_payto = NULL; return GNUNET_SYSERR; } - *(const char **) spec->ptr = str; return GNUNET_OK; } struct GNUNET_JSON_Specification -TALER_JSON_spec_payto_uri (const char *field, - const char **payto_uri) +TALER_JSON_spec_full_payto_uri ( + const char *field, + struct TALER_FullPayto *payto_uri) { struct GNUNET_JSON_Specification ret = { - .parser = &parse_payto_uri, + .parser = &parse_full_payto_uri, .field = field, .ptr = payto_uri }; - *payto_uri = NULL; + payto_uri->full_payto = NULL; return ret; } diff --git a/src/json/json_pack.c b/src/json/json_pack.c index 859976acb..409d7f43f 100644 --- a/src/json/json_pack.c +++ b/src/json/json_pack.c @@ -339,4 +339,24 @@ TALER_JSON_pack_amount (const char *name, } +struct GNUNET_JSON_PackSpec +TALER_JSON_pack_full_payto ( + const char *name, + const struct TALER_FullPayto payto) +{ + return GNUNET_JSON_pack_string (name, + payto.full_payto); +} + + +struct GNUNET_JSON_PackSpec +TALER_JSON_pack_normalized_payto ( + const char *name, + const struct TALER_NormalizedPayto payto) +{ + return GNUNET_JSON_pack_string (name, + payto.normalized_payto); +} + + /* End of json/json_pack.c */ diff --git a/src/json/json_wire.c b/src/json/json_wire.c index 9d22d28ea..f0ca00203 100644 --- a/src/json/json_wire.c +++ b/src/json/json_wire.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2018, 2021 Taler Systems SA + Copyright (C) 2018, 2021, 2024 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 @@ -28,11 +28,11 @@ enum GNUNET_GenericReturnValue TALER_JSON_merchant_wire_signature_hash (const json_t *wire_s, struct TALER_MerchantWireHashP *hc) { - const char *payto_uri; + struct TALER_FullPayto payto_uri; struct TALER_WireSaltP salt; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_string ("payto_uri", - &payto_uri), + TALER_JSON_spec_full_payto_uri ("payto_uri", + &payto_uri), GNUNET_JSON_spec_fixed_auto ("salt", &salt), GNUNET_JSON_spec_end () @@ -48,7 +48,7 @@ TALER_JSON_merchant_wire_signature_hash (const json_t *wire_s, } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Validating `%s'\n", - payto_uri); + payto_uri.full_payto); { char *err; @@ -57,7 +57,7 @@ TALER_JSON_merchant_wire_signature_hash (const json_t *wire_s, { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "URI `%s' ill-formed: %s\n", - payto_uri, + payto_uri.full_payto, err); GNUNET_free (err); return GNUNET_SYSERR; @@ -70,11 +70,14 @@ TALER_JSON_merchant_wire_signature_hash (const json_t *wire_s, } -char * +struct TALER_FullPayto TALER_JSON_wire_to_payto (const json_t *wire_s) { json_t *payto_o; const char *payto_str; + struct TALER_FullPayto payto = { + NULL + }; char *err; payto_o = json_object_get (wire_s, @@ -84,19 +87,21 @@ TALER_JSON_wire_to_payto (const json_t *wire_s) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Malformed wire record encountered: lacks payto://-url\n"); - return NULL; + return payto; } + payto.full_payto = GNUNET_strdup (payto_str); if (NULL != - (err = TALER_payto_validate (payto_str))) + (err = TALER_payto_validate (payto))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Malformed wire record encountered: payto URI `%s' invalid: %s\n", payto_str, err); + GNUNET_free (payto.full_payto); GNUNET_free (err); - return NULL; + return payto; } - return GNUNET_strdup (payto_str); + return payto; } diff --git a/src/lib/exchange_api_purse_merge.c b/src/lib/exchange_api_purse_merge.c index c013b29d2..d602078d2 100644 --- a/src/lib/exchange_api_purse_merge.c +++ b/src/lib/exchange_api_purse_merge.c @@ -319,7 +319,7 @@ TALER_EXCHANGE_account_merge ( json_t *merge_obj; CURL *eh; char arg_str[sizeof (pch->purse_pub) * 2 + 32]; - char *reserve_url; + struct TALER_NormalizedPayto reserve_url; pch = GNUNET_new (struct TALER_EXCHANGE_AccountMergeHandle); pch->merge_priv = *merge_priv; @@ -353,7 +353,7 @@ TALER_EXCHANGE_account_merge ( } reserve_url = TALER_reserve_make_payto (pch->provider_url, &pch->reserve_pub); - if (NULL == reserve_url) + if (NULL == reserve_url.normalized_payto) { GNUNET_break (0); GNUNET_free (pch->provider_url); @@ -366,7 +366,7 @@ TALER_EXCHANGE_account_merge ( if (NULL == pch->url) { GNUNET_break (0); - GNUNET_free (reserve_url); + GNUNET_free (reserve_url.normalized_payto); GNUNET_free (pch->provider_url); GNUNET_free (pch); return NULL; diff --git a/src/util/aml_signatures.c b/src/util/aml_signatures.c index a41a0126c..cbde36637 100644 --- a/src/util/aml_signatures.c +++ b/src/util/aml_signatures.c @@ -44,7 +44,7 @@ struct TALER_AmlDecisionPS /** * Hash of the account identifier to which the decision applies. */ - struct TALER_PaytoHashP h_payto GNUNET_PACKED; + struct TALER_NormalizedPaytoHashP h_payto GNUNET_PACKED; /** * Hash over the justification text. @@ -78,7 +78,7 @@ void TALER_officer_aml_decision_sign ( const char *justification, struct GNUNET_TIME_Timestamp decision_time, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, const json_t *new_rules, const json_t *properties, const char *new_measure, @@ -116,7 +116,7 @@ enum GNUNET_GenericReturnValue TALER_officer_aml_decision_verify ( const char *justification, struct GNUNET_TIME_Timestamp decision_time, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_NormalizedPaytoHashP *h_payto, const json_t *new_rules, const json_t *properties, const char *new_measure, diff --git a/src/util/crypto_wire.c b/src/util/crypto_wire.c index aa504b81e..28cf946c0 100644 --- a/src/util/crypto_wire.c +++ b/src/util/crypto_wire.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2018 Taler Systems SA + Copyright (C) 2018, 2024 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 @@ -24,7 +24,7 @@ void -TALER_merchant_wire_signature_hash (const char *payto_uri, +TALER_merchant_wire_signature_hash (const struct TALER_FullPayto payto_uri, const struct TALER_WireSaltP *salt, struct TALER_MerchantWireHashP *hc) { @@ -33,8 +33,8 @@ TALER_merchant_wire_signature_hash (const char *payto_uri, sizeof (*hc), salt, sizeof (*salt), - payto_uri, - strlen (payto_uri) + 1, + payto_uri.full_payto, + strlen (payto_uri.full_payto) + 1, "merchant-wire-signature", strlen ("merchant-wire-signature"), NULL, 0)); diff --git a/src/util/exchange_signatures.c b/src/util/exchange_signatures.c index aaefb5cec..04f7e1e5b 100644 --- a/src/util/exchange_signatures.c +++ b/src/util/exchange_signatures.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2021-2023 Taler Systems SA + Copyright (C) 2021-2024 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 @@ -539,91 +539,6 @@ TALER_exchange_online_key_set_verify ( GNUNET_NETWORK_STRUCT_BEGIN /** - * @brief Signature by which an exchange affirms that an account - * successfully passed the KYC checks. - */ -struct TALER_ExchangeAccountSetupSuccessPS -{ - /** - * Purpose is #TALER_SIGNATURE_EXCHANGE_ACCOUNT_SETUP_SUCCESS. Signed by a - * `struct TALER_ExchangePublicKeyP` using EdDSA. - */ - struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - - /** - * Hash over the payto for which the signature was made. - */ - struct TALER_PaytoHashP h_payto; - - /** - * Hash over details on *which* KYC obligations were discharged! - */ - struct GNUNET_HashCode h_kyc; - - /** - * When was the signature made. - */ - struct GNUNET_TIME_TimestampNBO timestamp; - -}; - -GNUNET_NETWORK_STRUCT_END - - -enum TALER_ErrorCode -TALER_exchange_online_account_setup_success_sign ( - TALER_ExchangeSignCallback scb, - const struct TALER_PaytoHashP *h_payto, - const json_t *kyc, - struct GNUNET_TIME_Timestamp timestamp, - struct TALER_ExchangePublicKeyP *pub, - struct TALER_ExchangeSignatureP *sig) -{ - struct TALER_ExchangeAccountSetupSuccessPS kyc_purpose = { - .purpose.size = htonl (sizeof (kyc_purpose)), - .purpose.purpose = htonl ( - TALER_SIGNATURE_EXCHANGE_ACCOUNT_SETUP_SUCCESS), - .h_payto = *h_payto, - .timestamp = GNUNET_TIME_timestamp_hton (timestamp) - }; - - TALER_json_hash (kyc, - &kyc_purpose.h_kyc); - return scb (&kyc_purpose.purpose, - pub, - sig); -} - - -enum GNUNET_GenericReturnValue -TALER_exchange_online_account_setup_success_verify ( - const struct TALER_PaytoHashP *h_payto, - const json_t *kyc, - struct GNUNET_TIME_Timestamp timestamp, - const struct TALER_ExchangePublicKeyP *pub, - const struct TALER_ExchangeSignatureP *sig) -{ - struct TALER_ExchangeAccountSetupSuccessPS kyc_purpose = { - .purpose.size = htonl (sizeof (kyc_purpose)), - .purpose.purpose = htonl ( - TALER_SIGNATURE_EXCHANGE_ACCOUNT_SETUP_SUCCESS), - .h_payto = *h_payto, - .timestamp = GNUNET_TIME_timestamp_hton (timestamp) - }; - - TALER_json_hash (kyc, - &kyc_purpose.h_kyc); - return - GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_ACCOUNT_SETUP_SUCCESS, - &kyc_purpose, - &sig->eddsa_signature, - &pub->eddsa_pub); -} - - -GNUNET_NETWORK_STRUCT_BEGIN - -/** * @brief Format internally used for packing the detailed information * to generate the signature for /track/transfer signatures. */ @@ -716,7 +631,7 @@ struct TALER_WireDepositDataPS /** * Hash of bank account of the merchant. */ - struct TALER_PaytoHashP h_payto; + struct TALER_FullPaytoHashP h_payto; /** * Hash of the individual deposits that were aggregated, @@ -735,7 +650,7 @@ TALER_exchange_online_wire_deposit_sign ( const struct TALER_Amount *total, const struct TALER_Amount *wire_fee, const struct TALER_MerchantPublicKeyP *merchant_pub, - const char *payto, + const struct TALER_FullPayto payto, const struct GNUNET_HashCode *h_details, struct TALER_ExchangePublicKeyP *pub, struct TALER_ExchangeSignatureP *sig) @@ -751,8 +666,8 @@ TALER_exchange_online_wire_deposit_sign ( total); TALER_amount_hton (&wdp.wire_fee, wire_fee); - TALER_payto_hash (payto, - &wdp.h_payto); + TALER_full_payto_hash (payto, + &wdp.h_payto); return scb (&wdp.purpose, pub, sig); @@ -764,7 +679,7 @@ TALER_exchange_online_wire_deposit_verify ( const struct TALER_Amount *total, const struct TALER_Amount *wire_fee, const struct TALER_MerchantPublicKeyP *merchant_pub, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const struct GNUNET_HashCode *h_details, const struct TALER_ExchangePublicKeyP *pub, const struct TALER_ExchangeSignatureP *sig) @@ -781,11 +696,11 @@ TALER_exchange_online_wire_deposit_verify ( total); TALER_amount_hton (&wdp.wire_fee, wire_fee); - return - GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT, - &wdp, - &sig->eddsa_signature, - &pub->eddsa_pub); + return GNUNET_CRYPTO_eddsa_verify ( + TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT, + &wdp, + &sig->eddsa_signature, + &pub->eddsa_pub); } @@ -1298,7 +1213,7 @@ struct TALER_ReserveCloseConfirmationPS /** * Hash of the receiver's bank account. */ - struct TALER_PaytoHashP h_payto; + struct TALER_FullPaytoHashP h_payto; /** * Wire transfer subject. @@ -1315,7 +1230,7 @@ TALER_exchange_online_reserve_closed_sign ( struct GNUNET_TIME_Timestamp timestamp, const struct TALER_Amount *closing_amount, const struct TALER_Amount *closing_fee, - const char *payto, + const struct TALER_FullPayto payto, const struct TALER_WireTransferIdentifierRawP *wtid, const struct TALER_ReservePublicKeyP *reserve_pub, struct TALER_ExchangePublicKeyP *pub, @@ -1333,8 +1248,8 @@ TALER_exchange_online_reserve_closed_sign ( closing_amount); TALER_amount_hton (&rcc.closing_fee, closing_fee); - TALER_payto_hash (payto, - &rcc.h_payto); + TALER_full_payto_hash (payto, + &rcc.h_payto); return scb (&rcc.purpose, pub, sig); @@ -1346,7 +1261,7 @@ TALER_exchange_online_reserve_closed_verify ( struct GNUNET_TIME_Timestamp timestamp, const struct TALER_Amount *closing_amount, const struct TALER_Amount *closing_fee, - const char *payto, + const struct TALER_FullPayto payto, const struct TALER_WireTransferIdentifierRawP *wtid, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ExchangePublicKeyP *pub, @@ -1364,13 +1279,13 @@ TALER_exchange_online_reserve_closed_verify ( closing_amount); TALER_amount_hton (&rcc.closing_fee, closing_fee); - TALER_payto_hash (payto, - &rcc.h_payto); - return - GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED, - &rcc, - &sig->eddsa_signature, - &pub->eddsa_pub); + TALER_full_payto_hash (payto, + &rcc.h_payto); + return GNUNET_CRYPTO_eddsa_verify ( + TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED, + &rcc, + &sig->eddsa_signature, + &pub->eddsa_pub); } @@ -1478,11 +1393,11 @@ TALER_exchange_online_purse_created_verify ( amount_without_fee); TALER_amount_hton (&dc.total_deposited, total_deposited); - return - GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_PURSE_CREATION, - &dc, - &sig->eddsa_signature, - &pub->eddsa_pub); + return GNUNET_CRYPTO_eddsa_verify ( + TALER_SIGNATURE_EXCHANGE_CONFIRM_PURSE_CREATION, + &dc, + &sig->eddsa_signature, + &pub->eddsa_pub); } @@ -1572,11 +1487,11 @@ TALER_exchange_online_purse_refund_verify ( amount_without_fee); TALER_amount_hton (&dc.refund_fee, refund_fee); - return - GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_PURSE_REFUND, - &dc, - &sig->eddsa_signature, - &pub->eddsa_pub); + return GNUNET_CRYPTO_eddsa_verify ( + TALER_SIGNATURE_EXCHANGE_CONFIRM_PURSE_REFUND, + &dc, + &sig->eddsa_signature, + &pub->eddsa_pub); } diff --git a/src/util/merchant_signatures.c b/src/util/merchant_signatures.c index 4dca3c652..56d93ab87 100644 --- a/src/util/merchant_signatures.c +++ b/src/util/merchant_signatures.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2020 Taler Systems SA + Copyright (C) 2020, 2024 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 @@ -214,7 +214,7 @@ struct TALER_MerchantWireDetailsPS enum GNUNET_GenericReturnValue TALER_merchant_wire_signature_check ( - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const struct TALER_WireSaltP *salt, const struct TALER_MerchantPublicKeyP *merch_pub, const struct TALER_MerchantSignatureP *merch_sig) @@ -236,7 +236,7 @@ TALER_merchant_wire_signature_check ( void TALER_merchant_wire_signature_make ( - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const struct TALER_WireSaltP *salt, const struct TALER_MerchantPrivateKeyP *merch_priv, struct TALER_MerchantSignatureP *merch_sig) @@ -346,4 +346,5 @@ TALER_merchant_contract_sign ( merch_sig); } + /* end of merchant_signatures.c */ diff --git a/src/util/offline_signatures.c b/src/util/offline_signatures.c index fbff850df..e68fe6ee1 100644 --- a/src/util/offline_signatures.c +++ b/src/util/offline_signatures.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2020-2023 Taler Systems SA + Copyright (C) 2020-2024 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 @@ -676,7 +676,7 @@ struct TALER_MasterAddWirePS /** * Hash over the exchange's payto URI. */ - struct TALER_PaytoHashP h_payto GNUNET_PACKED; + struct TALER_FullPaytoHashP h_payto GNUNET_PACKED; /** * Hash over the conversion URL, all zeros if there @@ -700,7 +700,7 @@ GNUNET_NETWORK_STRUCT_END void TALER_exchange_offline_wire_add_sign ( - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const char *conversion_url, const json_t *debit_restrictions, const json_t *credit_restrictions, @@ -714,8 +714,8 @@ TALER_exchange_offline_wire_add_sign ( .start_date = GNUNET_TIME_timestamp_hton (now), }; - TALER_payto_hash (payto_uri, - &kv.h_payto); + TALER_full_payto_hash (payto_uri, + &kv.h_payto); if (NULL != conversion_url) GNUNET_CRYPTO_hash (conversion_url, strlen (conversion_url) + 1, @@ -732,7 +732,7 @@ TALER_exchange_offline_wire_add_sign ( enum GNUNET_GenericReturnValue TALER_exchange_offline_wire_add_verify ( - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const char *conversion_url, const json_t *debit_restrictions, const json_t *credit_restrictions, @@ -746,8 +746,8 @@ TALER_exchange_offline_wire_add_verify ( .start_date = GNUNET_TIME_timestamp_hton (sign_time), }; - TALER_payto_hash (payto_uri, - &aw.h_payto); + TALER_full_payto_hash (payto_uri, + &aw.h_payto); if (NULL != conversion_url) GNUNET_CRYPTO_hash (conversion_url, strlen (conversion_url) + 1, @@ -788,7 +788,7 @@ struct TALER_MasterDelWirePS /** * Hash over the exchange's payto URI. */ - struct TALER_PaytoHashP h_payto GNUNET_PACKED; + struct TALER_FullPaytoHashP h_payto GNUNET_PACKED; }; @@ -797,7 +797,7 @@ GNUNET_NETWORK_STRUCT_END void TALER_exchange_offline_wire_del_sign ( - const char *payto_uri, + const struct TALER_FullPayto payto_uri, struct GNUNET_TIME_Timestamp now, const struct TALER_MasterPrivateKeyP *master_priv, struct TALER_MasterSignatureP *master_sig) @@ -808,8 +808,8 @@ TALER_exchange_offline_wire_del_sign ( .end_date = GNUNET_TIME_timestamp_hton (now), }; - TALER_payto_hash (payto_uri, - &kv.h_payto); + TALER_full_payto_hash (payto_uri, + &kv.h_payto); GNUNET_CRYPTO_eddsa_sign (&master_priv->eddsa_priv, &kv, &master_sig->eddsa_signature); @@ -818,7 +818,7 @@ TALER_exchange_offline_wire_del_sign ( enum GNUNET_GenericReturnValue TALER_exchange_offline_wire_del_verify ( - const char *payto_uri, + const struct TALER_FullPayto payto_uri, struct GNUNET_TIME_Timestamp sign_time, const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterSignatureP *master_sig) @@ -830,8 +830,8 @@ TALER_exchange_offline_wire_del_verify ( .end_date = GNUNET_TIME_timestamp_hton (sign_time), }; - TALER_payto_hash (payto_uri, - &aw.h_payto); + TALER_full_payto_hash (payto_uri, + &aw.h_payto); return GNUNET_CRYPTO_eddsa_verify ( TALER_SIGNATURE_MASTER_DEL_WIRE, &aw, @@ -1131,7 +1131,7 @@ struct TALER_MasterWireDetailsPS /** * Hash over the account holder's payto:// URL. */ - struct TALER_PaytoHashP h_wire_details GNUNET_PACKED; + struct TALER_FullPaytoHashP h_wire_details GNUNET_PACKED; /** * Hash over the conversion URL, all zeros if there @@ -1156,7 +1156,7 @@ GNUNET_NETWORK_STRUCT_END enum GNUNET_GenericReturnValue TALER_exchange_wire_signature_check ( - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const char *conversion_url, const json_t *debit_restrictions, const json_t *credit_restrictions, @@ -1168,8 +1168,8 @@ TALER_exchange_wire_signature_check ( .purpose.size = htonl (sizeof (wd)) }; - TALER_payto_hash (payto_uri, - &wd.h_wire_details); + TALER_full_payto_hash (payto_uri, + &wd.h_wire_details); if (NULL != conversion_url) GNUNET_CRYPTO_hash (conversion_url, strlen (conversion_url) + 1, @@ -1187,7 +1187,7 @@ TALER_exchange_wire_signature_check ( void TALER_exchange_wire_signature_make ( - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const char *conversion_url, const json_t *debit_restrictions, const json_t *credit_restrictions, @@ -1199,8 +1199,8 @@ TALER_exchange_wire_signature_make ( .purpose.size = htonl (sizeof (wd)) }; - TALER_payto_hash (payto_uri, - &wd.h_wire_details); + TALER_full_payto_hash (payto_uri, + &wd.h_wire_details); if (NULL != conversion_url) GNUNET_CRYPTO_hash (conversion_url, strlen (conversion_url) + 1, @@ -1318,7 +1318,7 @@ struct TALER_DrainProfitPS struct GNUNET_TIME_TimestampNBO date; struct TALER_AmountNBO amount; struct GNUNET_HashCode h_section; - struct TALER_PaytoHashP h_payto; + struct TALER_FullPaytoHashP h_payto; }; GNUNET_NETWORK_STRUCT_END @@ -1330,7 +1330,7 @@ TALER_exchange_offline_profit_drain_sign ( struct GNUNET_TIME_Timestamp date, const struct TALER_Amount *amount, const char *account_section, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const struct TALER_MasterPrivateKeyP *master_priv, struct TALER_MasterSignatureP *master_sig) { @@ -1344,8 +1344,8 @@ TALER_exchange_offline_profit_drain_sign ( GNUNET_CRYPTO_hash (account_section, strlen (account_section) + 1, &wd.h_section); - TALER_payto_hash (payto_uri, - &wd.h_payto); + TALER_full_payto_hash (payto_uri, + &wd.h_payto); TALER_amount_hton (&wd.amount, amount); GNUNET_CRYPTO_eddsa_sign (&master_priv->eddsa_priv, @@ -1360,7 +1360,7 @@ TALER_exchange_offline_profit_drain_verify ( struct GNUNET_TIME_Timestamp date, const struct TALER_Amount *amount, const char *account_section, - const char *payto_uri, + const struct TALER_FullPayto payto_uri, const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterSignatureP *master_sig) { @@ -1374,8 +1374,8 @@ TALER_exchange_offline_profit_drain_verify ( GNUNET_CRYPTO_hash (account_section, strlen (account_section) + 1, &wd.h_section); - TALER_payto_hash (payto_uri, - &wd.h_payto); + TALER_full_payto_hash (payto_uri, + &wd.h_payto); TALER_amount_hton (&wd.amount, amount); return GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_DRAIN_PROFIT, diff --git a/src/util/payto.c b/src/util/payto.c index 528108efa..038d13155 100644 --- a/src/util/payto.c +++ b/src/util/payto.c @@ -28,18 +28,35 @@ #define PAYTO "payto://" +int +TALER_full_payto_cmp (const struct TALER_FullPayto a, + const struct TALER_FullPayto b) +{ + if ( (NULL == a.full_payto) && + (NULL == b.full_payto) ) + return 0; + if (NULL == a.full_payto) + return -1; + if (NULL == b.full_payto) + return 1; + return strcmp (a.full_payto, + b.full_payto); +} + + /** * Extract the value under @a key from the URI parameters. * - * @param payto_uri the URL to parse + * @param fpayto_uri the full payto URL to parse * @param search_key key to look for, including "=" * @return NULL if the @a key parameter is not found. * The caller should free the returned value. */ static char * -payto_get_key (const char *payto_uri, +payto_get_key (const struct TALER_FullPayto fpayto_uri, const char *search_key) { + const char *payto_uri = fpayto_uri.full_payto; const char *key; const char *value_start; const char *value_end; @@ -71,7 +88,7 @@ payto_get_key (const char *payto_uri, char * -TALER_payto_get_subject (const char *payto_uri) +TALER_payto_get_subject (const struct TALER_FullPayto payto_uri) { return payto_get_key (payto_uri, "subject="); @@ -149,7 +166,7 @@ TALER_xtalerbank_account_from_payto (const char *payto) * to be freed by the caller */ static char * -validate_payto_iban (const char *account_url) +validate_payto_iban (struct TALER_FullPayto account_url) { const char *iban; const char *q; @@ -157,11 +174,12 @@ validate_payto_iban (const char *account_url) char *err; #define IBAN_PREFIX "payto://iban/" - if (0 != strncasecmp (account_url, + if (0 != strncasecmp (account_url.full_payto, IBAN_PREFIX, strlen (IBAN_PREFIX))) return NULL; /* not an IBAN */ - iban = strrchr (account_url, '/') + 1; + iban = strrchr (account_url.full_payto, + '/') + 1; #undef IBAN_PREFIX q = strchr (iban, '?'); @@ -203,7 +221,7 @@ validate_payto_iban (const char *account_url) * to be freed by the caller */ static char * -validate_payto_xtalerbank (const char *account_url) +validate_payto_xtalerbank (const struct TALER_FullPayto account_url) { const char *user; const char *nxt; @@ -215,11 +233,11 @@ validate_payto_xtalerbank (const char *account_url) bool port_ok; #define XTALERBANK_PREFIX PAYTO "x-taler-bank/" - if (0 != strncasecmp (account_url, + if (0 != strncasecmp (account_url.full_payto, XTALERBANK_PREFIX, strlen (XTALERBANK_PREFIX))) return NULL; /* not an IBAN */ - host = &account_url[strlen (XTALERBANK_PREFIX)]; + host = &account_url.full_payto[strlen (XTALERBANK_PREFIX)]; #undef XTALERBANK_PREFIX beg = strchr (host, '/'); @@ -328,8 +346,9 @@ validate_payto_xtalerbank (const char *account_url) char * -TALER_payto_validate (const char *payto_uri) +TALER_payto_validate (const struct TALER_FullPayto fpayto_uri) { + const char *payto_uri = fpayto_uri.full_payto; char *ret; const char *start; const char *end; @@ -363,9 +382,9 @@ TALER_payto_validate (const char *payto_uri) if (NULL == end) return GNUNET_strdup ("missing '/' in payload"); - if (NULL != (ret = validate_payto_iban (payto_uri))) + if (NULL != (ret = validate_payto_iban (fpayto_uri))) return ret; /* got a definitive answer */ - if (NULL != (ret = validate_payto_xtalerbank (payto_uri))) + if (NULL != (ret = validate_payto_xtalerbank (fpayto_uri))) return ret; /* got a definitive answer */ /* Insert other bank account validation methods here later! */ @@ -375,21 +394,21 @@ TALER_payto_validate (const char *payto_uri) char * -TALER_payto_get_receiver_name (const char *payto) +TALER_payto_get_receiver_name (const struct TALER_FullPayto fpayto) { char *err; - err = TALER_payto_validate (payto); + err = TALER_payto_validate (fpayto); if (NULL != err) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid payto://-URI `%s': %s\n", - payto, + fpayto.full_payto, err); GNUNET_free (err); return NULL; } - return payto_get_key (payto, + return payto_get_key (fpayto, "receiver-name="); } @@ -572,9 +591,12 @@ normalize_payto_ilp (size_t len, } -char * -TALER_payto_normalize (const char *input) +struct TALER_NormalizedPayto +TALER_payto_normalize (const struct TALER_FullPayto input) { + struct TALER_NormalizedPayto npto = { + .normalized_payto = NULL + }; char *method; const char *end; char *ret; @@ -587,70 +609,92 @@ TALER_payto_normalize (const char *input) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Malformed payto://-URI `%s': %s\n", - input, + input.full_payto, err); GNUNET_free (err); - return NULL; + return npto; } } - method = TALER_payto_get_method (input); + method = TALER_payto_get_method (input.full_payto); if (NULL == method) { GNUNET_break (0); - return NULL; + return npto; } - end = strchr (input, '?'); + end = strchr (input.full_payto, + '?'); if (NULL == end) - end = &input[strlen (input)]; + end = &input.full_payto[strlen (input.full_payto)]; if (0 == strcasecmp (method, "x-taler-bank")) - ret = normalize_payto_x_taler_bank (end - input, - input); + ret = normalize_payto_x_taler_bank (end - input.full_payto, + input.full_payto); else if (0 == strcasecmp (method, "iban")) - ret = normalize_payto_iban (end - input, - input); + ret = normalize_payto_iban (end - input.full_payto, + input.full_payto); else if (0 == strcasecmp (method, "upi")) - ret = normalize_payto_upi (end - input, - input); + ret = normalize_payto_upi (end - input.full_payto, + input.full_payto); else if (0 == strcasecmp (method, "bitcoin")) - ret = normalize_payto_bitcoin (end - input, - input); + ret = normalize_payto_bitcoin (end - input.full_payto, + input.full_payto); else if (0 == strcasecmp (method, "ilp")) - ret = normalize_payto_ilp (end - input, - input); + ret = normalize_payto_ilp (end - input.full_payto, + input.full_payto); else - ret = GNUNET_strndup (input, - end - input); + ret = GNUNET_strndup (input.full_payto, + end - input.full_payto); GNUNET_free (method); - return ret; + npto.normalized_payto = ret; + return npto; } void -TALER_payto_hash (const char *payto, - struct TALER_PaytoHashP *h_payto) +TALER_normalized_payto_hash (const struct TALER_NormalizedPayto npayto, + struct TALER_NormalizedPaytoHashP *h_npayto) { struct GNUNET_HashCode sha512; - GNUNET_CRYPTO_hash (payto, - strlen (payto) + 1, + GNUNET_CRYPTO_hash (npayto.normalized_payto, + strlen (npayto.normalized_payto) + 1, &sha512); - GNUNET_static_assert (sizeof (sha512) > sizeof (*h_payto)); + GNUNET_static_assert (sizeof (sha512) > sizeof (*h_npayto)); /* truncate */ - GNUNET_memcpy (h_payto, + GNUNET_memcpy (h_npayto, &sha512, - sizeof (*h_payto)); + sizeof (*h_npayto)); } -char * +void +TALER_full_payto_hash (const struct TALER_FullPayto fpayto, + struct TALER_FullPaytoHashP *h_fpayto) +{ + struct GNUNET_HashCode sha512; + + GNUNET_CRYPTO_hash (fpayto.full_payto, + strlen (fpayto.full_payto) + 1, + &sha512); + GNUNET_static_assert (sizeof (sha512) > sizeof (*h_fpayto)); + /* truncate */ + GNUNET_memcpy (h_fpayto, + &sha512, + sizeof (*h_fpayto)); +} + + +struct TALER_NormalizedPayto TALER_reserve_make_payto (const char *exchange_url, const struct TALER_ReservePublicKeyP *reserve_pub) { + struct TALER_NormalizedPayto npto = { + .normalized_payto = NULL + }; char pub_str[sizeof (*reserve_pub) * 2]; char *end; bool is_http; @@ -679,7 +723,7 @@ TALER_reserve_make_payto (const char *exchange_url, else { GNUNET_break (0); - return NULL; + return npto; } /* exchange_url includes trailing '/' */ GNUNET_asprintf (&reserve_url, @@ -687,7 +731,8 @@ TALER_reserve_make_payto (const char *exchange_url, is_http ? "taler-reserve-http" : "taler-reserve", exchange_url, pub_str); - return reserve_url; + npto.normalized_payto = reserve_url; + return npto; } diff --git a/src/util/test_crypto.c b/src/util/test_crypto.c index 2a2090952..ab51650fd 100644 --- a/src/util/test_crypto.c +++ b/src/util/test_crypto.c @@ -1,6 +1,6 @@ /* This file is part of TALER - (C) 2015, 2020-2023 Taler Systems SA + (C) 2015, 2020-2024 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 @@ -322,7 +322,14 @@ test_planchets (uint8_t age) static int test_exchange_sigs (void) { - const char *pt = "payto://x-taler-bank/localhost/Account"; + const struct TALER_FullPayto pt = { + .full_payto + = (char *) "payto://x-taler-bank/localhost/Account?receiver-name=ACC" + }; + const struct TALER_FullPayto pto = { + .full_payto + = (char *) "payto://x-taler-bank/localhost/Other?receiver-name=OTH" + }; struct TALER_MasterPrivateKeyP priv; struct TALER_MasterPublicKeyP pub; struct TALER_MasterSignatureP sig; @@ -352,7 +359,7 @@ test_exchange_sigs (void) } if (GNUNET_OK == TALER_exchange_wire_signature_check ( - "payto://x-taler-bank/localhost/Other", + pto, NULL, rest, rest, @@ -382,7 +389,14 @@ test_exchange_sigs (void) static int test_merchant_sigs (void) { - const char *pt = "payto://x-taler-bank/localhost/Account"; + const struct TALER_FullPayto pt = { + .full_payto + = (char *) "payto://x-taler-bank/localhost/Account?receiver-name=ACC" + }; + const struct TALER_FullPayto pto = { + .full_payto + = (char *) "payto://x-taler-bank/localhost/Other?receiver-name=OTH" + }; struct TALER_WireSaltP salt; struct TALER_MerchantPrivateKeyP priv; struct TALER_MerchantPublicKeyP pub; @@ -409,7 +423,7 @@ test_merchant_sigs (void) } if (GNUNET_OK == TALER_merchant_wire_signature_check ( - "payto://x-taler-bank/localhost/Other", + pto, &salt, &pub, &sig)) diff --git a/src/util/test_payto.c b/src/util/test_payto.c index c01969161..f2b182e48 100644 --- a/src/util/test_payto.c +++ b/src/util/test_payto.c @@ -1,6 +1,6 @@ /* This file is part of TALER - (C) 2020 Taler Systems SA + (C) 2020, 2024 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 @@ -53,42 +53,64 @@ main (int argc, GNUNET_assert (NULL == TALER_iban_validate ("DE89370400440532013000")); r = TALER_payto_validate ( - "payto://x-taler-bank/hostname/username?receiver-name=foo"); + (struct TALER_FullPayto) { + (char *) "payto://x-taler-bank/hostname/username?receiver-name=foo" + }); GNUNET_assert (NULL == r); r = TALER_payto_validate ( - "payto://x-taler-bank/hostname/~path/username?receiver-name=foo"); + (struct TALER_FullPayto) { + (char *) "payto://x-taler-bank/hostname/~path/username?receiver-name=foo" + }); GNUNET_assert (NULL == r); r = TALER_payto_validate ( - "payto://x-taler-bank/hostname/~path/username?receiver-name=fo/o"); + (struct TALER_FullPayto) { + (char *) "payto://x-taler-bank/hostname/~path/username?receiver-name=fo/o" + }); GNUNET_assert (NULL == r); r = TALER_payto_validate ( - "payto://x-taler-bank/host_name/~path/username?receiver-name=fo_o"); + (struct TALER_FullPayto) { + (char *) "payto://x-taler-bank/host_name/~path/username?receiver-name=fo_o" + }); GNUNET_assert (NULL == r); r = TALER_payto_validate ( - "payto://x-taler-bank/hostname/path/username?receiver-name=foo"); + (struct TALER_FullPayto) { + (char *) "payto://x-taler-bank/hostname/path/username?receiver-name=foo" + }); GNUNET_assert (NULL == r); r = TALER_payto_validate ( - "payto://x-taler-bank/https://hostname/username?receiver-name=foo"); + (struct TALER_FullPayto) { + (char *) "payto://x-taler-bank/https://hostname/username?receiver-name=foo" + }); GNUNET_assert (NULL != r); GNUNET_free (r); r = TALER_payto_validate ( - "payto://x-taler-bank/hostname:4a2/path/username?receiver-name=foo"); + (struct TALER_FullPayto) { + (char *) "payto://x-taler-bank/hostname:4a2/path/username?receiver-name=foo" + }); GNUNET_assert (NULL != r); GNUNET_free (r); r = TALER_payto_validate ( - "payto://x-taler-bank/-hostname/username?receiver-name=foo"); + (struct TALER_FullPayto) { + (char *) "payto://x-taler-bank/-hostname/username?receiver-name=foo" + }); GNUNET_assert (NULL != r); GNUNET_free (r); r = TALER_payto_validate ( - "payto://x-taler-bank/domain..name/username?receiver-name=foo"); + (struct TALER_FullPayto) { + (char *) "payto://x-taler-bank/domain..name/username?receiver-name=foo" + }); GNUNET_assert (NULL != r); GNUNET_free (r); r = TALER_payto_validate ( - "payto://x-taler-bank/domain..name/?receiver-name=foo"); + (struct TALER_FullPayto) { + (char *) "payto://x-taler-bank/domain..name/?receiver-name=foo" + }); GNUNET_assert (NULL != r); GNUNET_free (r); r = TALER_payto_validate ( - "payto://x-taler-bank/domain.name/username"); + (struct TALER_FullPayto) { + (char *) "payto://x-taler-bank/domain.name/username" + }); GNUNET_assert (NULL != r); GNUNET_free (r); r = TALER_xtalerbank_account_from_payto ( @@ -109,12 +131,17 @@ main (int argc, r); r = TALER_payto_get_subject ( - "payto://x-taler-bank/localhost:1080/alice?subject=hello&amount=EUR:1"); + (struct TALER_FullPayto) { + (char *) + "payto://x-taler-bank/localhost:1080/alice?subject=hello&amount=EUR:1" + }); CHECK ("hello", r); r = TALER_payto_get_subject ( - "payto://x-taler-bank/localhost:1080/alice"); + (struct TALER_FullPayto) { + (char *) "payto://x-taler-bank/localhost:1080/alice" + }); GNUNET_assert (r == NULL); return 0; } diff --git a/src/util/wallet_signatures.c b/src/util/wallet_signatures.c index 7b1a539ef..1668fa53b 100644 --- a/src/util/wallet_signatures.c +++ b/src/util/wallet_signatures.c @@ -1226,7 +1226,7 @@ struct TALER_PurseMergePS * Which reserve should the purse be merged with. * Hash of the reserve's payto:// URI. */ - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; }; @@ -1234,7 +1234,7 @@ GNUNET_NETWORK_STRUCT_END void TALER_wallet_purse_merge_sign ( - const char *reserve_uri, + const struct TALER_NormalizedPayto reserve_uri, struct GNUNET_TIME_Timestamp merge_timestamp, const struct TALER_PurseContractPublicKeyP *purse_pub, const struct TALER_PurseMergePrivateKeyP *merge_priv, @@ -1248,11 +1248,11 @@ TALER_wallet_purse_merge_sign ( }; GNUNET_assert (0 == - strncasecmp (reserve_uri, + strncasecmp (reserve_uri.normalized_payto, "payto://taler-reserve", strlen ("payto://taler-reserve"))); - TALER_payto_hash (reserve_uri, - &pm.h_payto); + TALER_normalized_payto_hash (reserve_uri, + &pm.h_payto); GNUNET_CRYPTO_eddsa_sign (&merge_priv->eddsa_priv, &pm, &merge_sig->eddsa_signature); @@ -1261,7 +1261,7 @@ TALER_wallet_purse_merge_sign ( enum GNUNET_GenericReturnValue TALER_wallet_purse_merge_verify ( - const char *reserve_uri, + const struct TALER_NormalizedPayto reserve_uri, struct GNUNET_TIME_Timestamp merge_timestamp, const struct TALER_PurseContractPublicKeyP *purse_pub, const struct TALER_PurseMergePublicKeyP *merge_pub, @@ -1275,15 +1275,15 @@ TALER_wallet_purse_merge_verify ( }; if (0 != - strncasecmp (reserve_uri, + strncasecmp (reserve_uri.normalized_payto, "payto://taler-reserve", strlen ("payto://taler-reserve"))) { GNUNET_break (0); return GNUNET_NO; } - TALER_payto_hash (reserve_uri, - &pm.h_payto); + TALER_normalized_payto_hash (reserve_uri, + &pm.h_payto); return GNUNET_CRYPTO_eddsa_verify ( TALER_SIGNATURE_WALLET_PURSE_MERGE, &pm, @@ -1613,7 +1613,7 @@ struct TALER_ReserveClosePS * for the closure, or all zeros for the reserve * origin account. */ - struct TALER_PaytoHashP target_account_h_payto; + struct TALER_FullPaytoHashP target_account_h_payto; }; @@ -1623,7 +1623,7 @@ GNUNET_NETWORK_STRUCT_END void TALER_wallet_reserve_close_sign ( struct GNUNET_TIME_Timestamp request_timestamp, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const struct TALER_ReservePrivateKeyP *reserve_priv, struct TALER_ReserveSignatureP *reserve_sig) { @@ -1645,7 +1645,7 @@ TALER_wallet_reserve_close_sign ( enum GNUNET_GenericReturnValue TALER_wallet_reserve_close_verify ( struct GNUNET_TIME_Timestamp request_timestamp, - const struct TALER_PaytoHashP *h_payto, + const struct TALER_FullPaytoHashP *h_payto, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReserveSignatureP *reserve_sig) { @@ -1897,4 +1897,5 @@ TALER_wallet_token_use_verify ( &token_use_pub->public_key); } + /* end of wallet_signatures.c */ |