summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchange/taler-exchange-httpd.h')
-rw-r--r--src/exchange/taler-exchange-httpd.h199
1 files changed, 78 insertions, 121 deletions
diff --git a/src/exchange/taler-exchange-httpd.h b/src/exchange/taler-exchange-httpd.h
index 278a05be9..25e9e1105 100644
--- a/src/exchange/taler-exchange-httpd.h
+++ b/src/exchange/taler-exchange-httpd.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014, 2015, 2020 Taler Systems SA
+ Copyright (C) 2014-2022 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
@@ -25,113 +25,13 @@
#include <microhttpd.h>
#include "taler_json_lib.h"
-#include "taler_crypto_lib.h"
+#include "taler_util.h"
+#include "taler_kyclogic_plugin.h"
#include "taler_extensions.h"
#include <gnunet/gnunet_mhd_compat.h>
/**
- * Enumeration for our KYC modes.
- */
-enum TEH_KycMode
-{
- /**
- * KYC is disabled.
- */
- TEH_KYC_NONE = 0,
-
- /**
- * We use Oauth2.0.
- */
- TEH_KYC_OAUTH2 = 1
-};
-
-
-/**
- * Structure describing our KYC configuration.
- */
-struct TEH_KycOptions
-{
- /**
- * What KYC mode are we in?
- */
- enum TEH_KycMode mode;
-
- /**
- * Maximum amount that can be withdrawn in @e withdraw_period without
- * needing KYC.
- * Only valid if @e mode is not #TEH_KYC_NONE and
- * if @e withdraw_period is non-zero.
- */
- struct TALER_Amount withdraw_limit;
-
- /**
- * Maximum balance a wallet can hold without
- * needing KYC.
- * Only valid if @e mode is not #TEH_KYC_NONE and
- * if the amount specified is valid.
- */
- struct TALER_Amount wallet_balance_limit;
-
- /**
- * Time period over which @e withdraw_limit applies.
- * Only valid if @e mode is not #TEH_KYC_NONE.
- */
- struct GNUNET_TIME_Relative withdraw_period;
-
- /**
- * Details depending on @e mode.
- */
- union
- {
-
- /**
- * Configuration details if @e mode is #TEH_KYC_OAUTH2.
- */
- struct
- {
-
- /**
- * URL of the OAuth2.0 endpoint for KYC checks.
- * (token/auth)
- */
- char *auth_url;
-
- /**
- * URL of the OAuth2.0 endpoint for KYC checks.
- */
- char *login_url;
-
- /**
- * URL of the user info access endpoint.
- */
- char *info_url;
-
- /**
- * Our client ID for OAuth2.0.
- */
- char *client_id;
-
- /**
- * Our client secret for OAuth2.0.
- */
- char *client_secret;
-
- /**
- * Where to redirect clients after the
- * Web-based KYC process is done?
- */
- char *post_kyc_redirect_url;
-
- } oauth2;
-
- } details;
-};
-
-
-extern struct TEH_KycOptions TEH_kyc_config;
-
-/**
* How long is caching /keys allowed at most?
*/
extern struct GNUNET_TIME_Relative TEH_max_keys_caching;
@@ -165,6 +65,11 @@ extern int TEH_check_invariants_flag;
extern int TEH_allow_keys_timetravel;
/**
+ * Option set to #GNUNET_YES if rewards are allowed.
+ */
+extern int TEH_enable_rewards;
+
+/**
* Main directory with revocation data.
*/
extern char *TEH_revocation_directory;
@@ -183,19 +88,51 @@ extern bool TEH_suicide;
extern struct TALER_MasterPublicKeyP TEH_master_public_key;
/**
+ * Key used to encrypt KYC attribute data in our database.
+ */
+extern struct TALER_AttributeEncryptionKeyP TEH_attribute_key;
+
+/**
* Our DB plugin.
*/
extern struct TALER_EXCHANGEDB_Plugin *TEH_plugin;
/**
+ * Absolute STEFAN parameter.
+ */
+extern struct TALER_Amount TEH_stefan_abs;
+
+/**
+ * Logarithmic STEFAN parameter.
+ */
+extern struct TALER_Amount TEH_stefan_log;
+
+/**
+ * Linear STEFAN parameter.
+ */
+extern float TEH_stefan_lin;
+
+/**
+ * Default ways how to render #TEH_currency amounts.
+ */
+extern const struct TALER_CurrencySpecification *TEH_cspec;
+
+/**
* Our currency.
*/
extern char *TEH_currency;
-/*
- * Age restriction extension state
+/**
+ * Name of the KYC-AML-trigger evaluation binary.
*/
-extern bool TEH_age_restriction_enabled;
+extern char *TEH_kyc_aml_trigger;
+
+/**
+ * What is the largest amount we allow a peer to
+ * merge into a reserve before always triggering
+ * an AML check?
+ */
+extern struct TALER_Amount TEH_aml_threshold;
/**
* Our (externally visible) base URL.
@@ -216,6 +153,7 @@ extern struct GNUNET_CURL_Context *TEH_curl_ctx;
* Signature of the offline master key of all enabled extensions' configuration
*/
extern struct TALER_MasterSignatureP TEH_extensions_sig;
+extern bool TEH_extensions_signed;
/**
* @brief Struct describing an URL and the handler for it.
@@ -261,6 +199,11 @@ struct TEH_RequestContext
struct MHD_Connection *connection;
/**
+ * JSON root of uploaded data (or NULL, if none).
+ */
+ json_t *root;
+
+ /**
* @e rh-specific cleanup routine. Function called
* upon completion of the request that should
* clean up @a rh_ctx. Can be NULL.
@@ -300,11 +243,10 @@ struct TEH_RequestHandler
union
{
/**
- * Function to call to handle a GET requests (and those
+ * Function to call to handle GET requests (and those
* with @e method NULL).
*
* @param rc context for the request
- * @param mime_type the @e mime_type for the reply (hint, can be NULL)
* @param args array of arguments, needs to be of length @e args_expected
* @return MHD result code
*/
@@ -314,11 +256,11 @@ struct TEH_RequestHandler
/**
- * Function to call to handle a POST request.
+ * Function to call to handle POST requests.
*
* @param rc context for the request
* @param json uploaded JSON data
- * @param args array of arguments, needs to be of length @e args_expected
+ * @param args array of arguments, needs to be of length @e nargs
* @return MHD result code
*/
MHD_RESULT
@@ -326,18 +268,18 @@ struct TEH_RequestHandler
const json_t *root,
const char *const args[]);
- } handler;
-
- /**
- * Number of arguments this handler expects in the @a args array.
- */
- unsigned int nargs;
+ /**
+ * Function to call to handle DELETE requests.
+ *
+ * @param rc context for the request
+ * @param args array of arguments, needs to be of length @e nargs
+ * @return MHD result code
+ */
+ MHD_RESULT
+ (*delete)(struct TEH_RequestContext *rc,
+ const char *const args[]);
- /**
- * Is the number of arguments given in @e nargs only an upper bound,
- * and calling with fewer arguments could be OK?
- */
- bool nargs_is_upper_bound;
+ } handler;
/**
* Mime type to use in reply (hint, can be NULL).
@@ -358,7 +300,22 @@ struct TEH_RequestHandler
* Default response code. 0 for none provided.
*/
unsigned int response_code;
+
+ /**
+ * Number of arguments this handler expects in the @a args array.
+ */
+ unsigned int nargs;
+
+ /**
+ * Is the number of arguments given in @e nargs only an upper bound,
+ * and calling with fewer arguments could be OK?
+ */
+ bool nargs_is_upper_bound;
};
+/* Age restriction configuration */
+extern bool TEH_age_restriction_enabled;
+extern struct TALER_AgeRestrictionConfig TEH_age_restriction_config;
+
#endif