aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-05-07 21:09:47 +0200
committerChristian Grothoff <christian@grothoff.org>2024-07-29 12:18:40 +0200
commit9d21c0598e11bac144bbb3333b95b0881127d76c (patch)
tree6fbe93ad90513fd863a5d22e9fa18a1a2539280b /src
parent042f91464f787fb1a51198acc6f560226c3cc977 (diff)
-fix more build issues
Diffstat (limited to 'src')
-rw-r--r--src/exchange/taler-exchange-httpd_common_kyc.c15
-rw-r--r--src/exchange/taler-exchange-httpd_config.c31
-rw-r--r--src/exchange/taler-exchange-httpd_keys.c52
-rw-r--r--src/exchangedb/exchange_do_insert_kyc_attributes.sql13
-rw-r--r--src/exchangedb/pg_insert_kyc_attributes.c11
-rw-r--r--src/exchangedb/pg_insert_kyc_attributes.h4
-rw-r--r--src/include/taler_crypto_lib.h14
-rw-r--r--src/include/taler_exchangedb_plugin.h8
-rw-r--r--src/include/taler_kyclogic_lib.h10
-rw-r--r--src/kyclogic/kyclogic_api.c21
-rw-r--r--src/util/util.c47
11 files changed, 64 insertions, 162 deletions
diff --git a/src/exchange/taler-exchange-httpd_common_kyc.c b/src/exchange/taler-exchange-httpd_common_kyc.c
index bcee5a0d2..6d6bd260e 100644
--- a/src/exchange/taler-exchange-httpd_common_kyc.c
+++ b/src/exchange/taler-exchange-httpd_common_kyc.c
@@ -120,16 +120,11 @@ kyc_aml_finished (void *cls,
void *ea;
const char *birthdate;
unsigned int birthday = 0;
- struct GNUNET_ShortHashCode kyc_prox;
struct GNUNET_AsyncScopeSave old_scope;
- unsigned int num_checks;
- char **provided_checks;
kat->kyc_aml = NULL;
GNUNET_async_scope_enter (&kat->scope,
&old_scope);
- TALER_CRYPTO_attributes_to_kyc_prox (kat->attributes,
- &kyc_prox);
birthdate = json_string_value (json_object_get (kat->attributes,
TALER_ATTRIBUTE_BIRTHDATE));
if ( (TEH_age_restriction_enabled) &&
@@ -160,17 +155,10 @@ kyc_aml_finished (void *cls,
kat->attributes,
&ea,
&eas);
- TALER_KYCLOGIC_lookup_checks (kat->provider_section,
- &num_checks,
- &provided_checks);
qs = TEH_plugin->insert_kyc_attributes (
TEH_plugin->cls,
kat->process_row,
&kat->account_id,
- &kyc_prox,
- kat->provider_section,
- num_checks,
- (const char **) provided_checks,
birthday,
GNUNET_TIME_timestamp_get (),
kat->provider_user_id,
@@ -179,9 +167,6 @@ kyc_aml_finished (void *cls,
eas,
ea,
0 != code);
- for (unsigned int i = 0; i<num_checks; i++)
- GNUNET_free (provided_checks[i]);
- GNUNET_free (provided_checks);
GNUNET_free (ea);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Stored encrypted KYC process #%llu attributes: %d\n",
diff --git a/src/exchange/taler-exchange-httpd_config.c b/src/exchange/taler-exchange-httpd_config.c
index 257dfa6ba..35d0705e9 100644
--- a/src/exchange/taler-exchange-httpd_config.c
+++ b/src/exchange/taler-exchange-httpd_config.c
@@ -59,20 +59,29 @@ TEH_handler_config (struct TEH_RequestContext *rc,
TALER_MHD_get_date_string (km.abs_time,
dat);
resp = TALER_MHD_MAKE_JSON_PACK (
- GNUNET_JSON_pack_array_steal ("supported_kyc_requirements",
- TALER_KYCLOGIC_get_satisfiable ()),
+ GNUNET_JSON_pack_allow_null (
+ GNUNET_JSON_pack_array_steal (
+ "wallet_balance_limit_without_kyc",
+ TALER_KYCLOGIC_get_wallet_thresholds ())),
+ /* Deprecate? */
+ GNUNET_JSON_pack_array_steal (
+ "supported_kyc_requirements",
+ json_array ()),
GNUNET_JSON_pack_object_steal (
"currency_specification",
TALER_CONFIG_currency_specs_to_json (TEH_cspec)),
- GNUNET_JSON_pack_string ("currency",
- TEH_currency),
- GNUNET_JSON_pack_string ("name",
- "taler-exchange"),
- GNUNET_JSON_pack_string ("implementation",
- "urn:net:taler:specs:taler-exchange:c-reference")
- ,
- GNUNET_JSON_pack_string ("version",
- EXCHANGE_PROTOCOL_VERSION));
+ GNUNET_JSON_pack_string (
+ "currency",
+ TEH_currency),
+ GNUNET_JSON_pack_string (
+ "name",
+ "taler-exchange"),
+ GNUNET_JSON_pack_string (
+ "implementation",
+ "urn:net:taler:specs:taler-exchange:c-reference"),
+ GNUNET_JSON_pack_string (
+ "version",
+ EXCHANGE_PROTOCOL_VERSION));
GNUNET_break (MHD_YES ==
MHD_add_response_header (resp,
diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c
index 0ec28e950..650cce4df 100644
--- a/src/exchange/taler-exchange-httpd_keys.c
+++ b/src/exchange/taler-exchange-httpd_keys.c
@@ -2276,7 +2276,8 @@ setup_general_response_headers (void *cls,
GNUNET_break (MHD_YES ==
MHD_add_response_header (response,
MHD_HTTP_HEADER_CACHE_CONTROL,
- "public,must-revalidate,max-age=86400"));
+ "public,must-revalidate,max-age=86400")
+ );
if (! GNUNET_TIME_relative_is_zero (ksh->rekey_frequency))
{
struct GNUNET_TIME_Relative r;
@@ -2322,27 +2323,6 @@ setup_general_response_headers (void *cls,
/**
- * Function called with wallet balance thresholds.
- *
- * @param[in,out] cls a `json **` where to put the array of json amounts discovered
- * @param threshold another threshold amount to add
- */
-static void
-wallet_threshold_cb (void *cls,
- const struct TALER_Amount *threshold)
-{
- json_t **ret = cls;
-
- if (NULL == *ret)
- *ret = json_array ();
- GNUNET_assert (0 ==
- json_array_append_new (*ret,
- TALER_JSON_from_amount (
- threshold)));
-}
-
-
-/**
* Initialize @a krd using the given values for @a signkeys,
* @a recoup and @a denoms.
*
@@ -2469,29 +2449,15 @@ create_krd (struct TEH_KeyStateHandle *ksh,
ksh->global_fees),
GNUNET_JSON_pack_timestamp ("list_issue_date",
last_cherry_pick_date),
+ GNUNET_JSON_pack_allow_null (
+ GNUNET_JSON_pack_array_steal (
+ "wallet_balance_limit_without_kyc",
+ TALER_KYCLOGIC_get_wallet_thresholds ())),
GNUNET_JSON_pack_data_auto ("exchange_pub",
&exchange_pub),
GNUNET_JSON_pack_data_auto ("exchange_sig",
&exchange_sig));
GNUNET_assert (NULL != keys);
-
- /* Set wallet limit if KYC is configured */
- {
- json_t *wblwk = NULL;
-
- TALER_KYCLOGIC_kyc_iterate_thresholds (
- TALER_KYCLOGIC_KYC_TRIGGER_WALLET_BALANCE,
- &wallet_threshold_cb,
- &wblwk);
- if (NULL != wblwk)
- GNUNET_assert (
- 0 ==
- json_object_set_new (
- keys,
- "wallet_balance_limit_without_kyc",
- wblwk));
- }
-
/* Signal support for the configured, enabled extensions. */
{
json_t *extensions = json_object ();
@@ -2900,7 +2866,8 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
denominations_by_group =
GNUNET_CONTAINER_multihashmap_create (1024,
- GNUNET_NO /* NO, because keys are only on the stack */);
+ GNUNET_NO /* NO, because keys are only on the stack */
+ );
/* heap = max heap, sorted by start time */
while (NULL != (dk = GNUNET_CONTAINER_heap_remove_root (heap)))
{
@@ -3267,7 +3234,8 @@ build_key_state (struct HelperState *hs,
ksh->denomkey_map = GNUNET_CONTAINER_multihashmap_create (1024,
true);
ksh->signkey_map = GNUNET_CONTAINER_multipeermap_create (32,
- false /* MUST be false! */);
+ false /* MUST be false! */
+ );
ksh->auditors = json_array ();
GNUNET_assert (NULL != ksh->auditors);
/* NOTE: fetches master-signed signkeys, but ALSO those that were revoked! */
diff --git a/src/exchangedb/exchange_do_insert_kyc_attributes.sql b/src/exchangedb/exchange_do_insert_kyc_attributes.sql
index 7db4d80c0..2e25e7dba 100644
--- a/src/exchangedb/exchange_do_insert_kyc_attributes.sql
+++ b/src/exchangedb/exchange_do_insert_kyc_attributes.sql
@@ -1,6 +1,6 @@
--
-- This file is part of TALER
--- Copyright (C) 2023 Taler Systems SA
+-- Copyright (C) 2023, 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
@@ -17,9 +17,6 @@
CREATE OR REPLACE FUNCTION exchange_do_insert_kyc_attributes(
IN in_process_row INT8,
IN in_h_payto BYTEA,
- IN in_kyc_prox BYTEA,
- IN in_provider_section TEXT,
- IN in_satisfied_checks TEXT[],
IN in_birthday INT4,
IN in_provider_account_id TEXT,
IN in_provider_legitimization_id TEXT,
@@ -39,18 +36,12 @@ BEGIN
INSERT INTO exchange.kyc_attributes
(h_payto
- ,kyc_prox
- ,provider
- ,satisfied_checks
,collection_time
,expiration_time
,encrypted_attributes
,legitimization_serial
) VALUES
(in_h_payto
- ,in_kyc_prox
- ,in_provider_section
- ,in_satisfied_checks
,in_collection_time_ts
,in_expiration_time_ts
,in_enc_attributes
@@ -110,5 +101,5 @@ INSERT INTO kyc_alerts
END $$;
-COMMENT ON FUNCTION exchange_do_insert_kyc_attributes(INT8, BYTEA, BYTEA, TEXT, TEXT[], INT4, TEXT, TEXT, INT8, INT8, INT8, BYTEA, BOOL, TEXT)
+COMMENT ON FUNCTION exchange_do_insert_kyc_attributes(INT8, BYTEA, INT4, TEXT, TEXT, INT8, INT8, INT8, BYTEA, BOOL, TEXT)
IS 'Inserts new KYC attributes and updates the status of the legitimization process and the AML status for the account';
diff --git a/src/exchangedb/pg_insert_kyc_attributes.c b/src/exchangedb/pg_insert_kyc_attributes.c
index 3c94abb85..76dbe1aa7 100644
--- a/src/exchangedb/pg_insert_kyc_attributes.c
+++ b/src/exchangedb/pg_insert_kyc_attributes.c
@@ -31,10 +31,6 @@ TEH_PG_insert_kyc_attributes (
void *cls,
uint64_t process_row,
const struct TALER_PaytoHashP *h_payto,
- const struct GNUNET_ShortHashCode *kyc_prox,
- const char *provider_section,
- unsigned int num_checks,
- const char *satisfied_checks[static num_checks],
uint32_t birthday,
struct GNUNET_TIME_Timestamp collection_time,
const char *provider_account_id,
@@ -57,11 +53,6 @@ TEH_PG_insert_kyc_attributes (
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&process_row),
GNUNET_PQ_query_param_auto_from_type (h_payto),
- GNUNET_PQ_query_param_auto_from_type (kyc_prox),
- GNUNET_PQ_query_param_string (provider_section),
- GNUNET_PQ_query_param_array_ptrs_string (num_checks,
- satisfied_checks,
- pg->conn),
GNUNET_PQ_query_param_uint32 (&birthday),
(NULL == provider_account_id)
? GNUNET_PQ_query_param_null ()
@@ -94,7 +85,7 @@ TEH_PG_insert_kyc_attributes (
"SELECT "
" out_ok"
" FROM exchange_do_insert_kyc_attributes "
- "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14);");
+ "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);");
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"insert_kyc_attributes",
params,
diff --git a/src/exchangedb/pg_insert_kyc_attributes.h b/src/exchangedb/pg_insert_kyc_attributes.h
index 35b25bdc8..e8650f969 100644
--- a/src/exchangedb/pg_insert_kyc_attributes.h
+++ b/src/exchangedb/pg_insert_kyc_attributes.h
@@ -52,10 +52,6 @@ TEH_PG_insert_kyc_attributes (
void *cls,
uint64_t process_row,
const struct TALER_PaytoHashP *h_payto,
- const struct GNUNET_ShortHashCode *kyc_prox,
- const char *provider_section,
- unsigned int num_checks,
- const char *satisfied_checks[static num_checks],
uint32_t birthday,
struct GNUNET_TIME_Timestamp collection_time,
const char *provider_account_id,
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index e0e1d1240..3d0c25ff4 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -1712,20 +1712,6 @@ TALER_CRYPTO_kyc_attributes_decrypt (
/**
- * Takes a set of KYC attributes and extracts key
- * data that we use to detect similar / duplicate
- * entries in the database.
- *
- * @param attr set of KYC attributes
- * @param[out] kyc_prox set to the proximity hash
- */
-void
-TALER_CRYPTO_attributes_to_kyc_prox (
- const json_t *attr,
- struct GNUNET_ShortHashCode *kyc_prox);
-
-
-/**
* Check if a coin is valid; that is, whether the denomination key exists,
* is not expired, and the signature is correct.
*
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index cc1c39d5f..a647f488a 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -6962,10 +6962,6 @@ struct TALER_EXCHANGEDB_Plugin
* @param cls closure
* @param process_row KYC process row to update
* @param h_payto account for which the attribute data is stored
- * @param kyc_prox key for similarity search
- * @param provider_section provider that must be checked
- * @param num_checks how many checks do these attributes satisfy
- * @param satisfied_checks array of checks satisfied by these attributes
* @param provider_account_id provider account ID
* @param provider_legitimization_id provider legitimization ID
* @param birthday birthdate of user, in days after 1990, or 0 if unknown or definitively adult
@@ -6981,10 +6977,6 @@ struct TALER_EXCHANGEDB_Plugin
void *cls,
uint64_t process_row,
const struct TALER_PaytoHashP *h_payto,
- const struct GNUNET_ShortHashCode *kyc_prox,
- const char *provider_section,
- unsigned int num_checks,
- const char *satisfied_checks[static num_checks],
uint32_t birthday,
struct GNUNET_TIME_Timestamp collection_time,
const char *provider_account_id,
diff --git a/src/include/taler_kyclogic_lib.h b/src/include/taler_kyclogic_lib.h
index 168415b64..7bc5b0672 100644
--- a/src/include/taler_kyclogic_lib.h
+++ b/src/include/taler_kyclogic_lib.h
@@ -114,6 +114,16 @@ TALER_KYCLOGIC_kyc_done (void);
/**
+ * Return JSON array with amounts with thresholds that
+ * may change KYC requirements for the wallet.
+ *
+ * @return JSON array, NULL if no limits apply
+ */
+json_t *
+TALER_KYCLOGIC_get_wallet_thresholds (void);
+
+
+/**
* Function called to iterate over KYC-relevant
* transaction amounts for a particular time range.
* Called within a database transaction, so must
diff --git a/src/kyclogic/kyclogic_api.c b/src/kyclogic/kyclogic_api.c
index 7c1984f28..a413e592f 100644
--- a/src/kyclogic/kyclogic_api.c
+++ b/src/kyclogic/kyclogic_api.c
@@ -621,6 +621,27 @@ TALER_KYCLOGIC_kyc_trigger2s (
}
+json_t *
+TALER_KYCLOGIC_get_wallet_thresholds (void)
+{
+#if 0
+ json_t *ret;
+
+ ret = json_array ();
+ GNUNET_assert (NULL != ret);
+ GNUNET_assert (
+ 0 ==
+ json_array_append_new (
+ ret,
+ TALER_JSON_from_amount (
+ threshold)));
+ return ret;
+#endif
+ GNUNET_break (0); // FIXME: implement!
+ return NULL;
+}
+
+
/**
* Load KYC logic plugin.
*
diff --git a/src/util/util.c b/src/util/util.c
index da5727487..35f76bcfe 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -405,51 +405,4 @@ strchrnul (const char *s,
#endif
-void
-TALER_CRYPTO_attributes_to_kyc_prox (
- const json_t *attr,
- struct GNUNET_ShortHashCode *kyc_prox)
-{
- const char *name = NULL;
- const char *birthdate = NULL;
- struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_string (TALER_ATTRIBUTE_FULL_NAME,
- &name),
- NULL),
- GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_string (TALER_ATTRIBUTE_BIRTHDATE,
- &birthdate),
- NULL),
- GNUNET_JSON_spec_end ()
- };
-
- if (GNUNET_OK !=
- GNUNET_JSON_parse (attr,
- spec,
- NULL, NULL))
- {
- GNUNET_break (0);
- memset (kyc_prox,
- 0,
- sizeof (*kyc_prox));
- return;
- }
- GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (
- kyc_prox,
- sizeof (*kyc_prox),
- name,
- (NULL == name)
- ? 0
- : strlen (name),
- birthdate,
- (NULL == birthdate)
- ? 0
- : strlen (birthdate),
- NULL,
- 0));
-}
-
-
/* end of util.c */