diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2022-01-11 15:24:43 +0100 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2022-01-21 15:41:02 +0100 |
commit | 0b56de6c994d3e525aa2d0195ff4607db3f14715 (patch) | |
tree | 9f34c40155dd5538841497c9f6a151deb2305a8d /src/include | |
parent | 0b6ebc6160f1fd1f6db7c433f0912b5d2845a59c (diff) | |
download | exchange-0b56de6c994d3e525aa2d0195ff4607db3f14715.tar.xz |
[age restriction] progress 12/n
- taler-offline-tool now handles extensions
- command "extensions" added with subcommands "show" and "sign"
- parses extensions from taler config
- shows and signs of extensions and their configurations
- creates signed set of configurations for upload
- added test for retrieval of extension config
- simplified signature verification for extensions
- remove per-extension signatures, also from DB schema
- adjust prepared statements accordingly
- adjust DB event handler for extensions
- allow NULL for config for extension in DB schema
- handler for /management/extensions adjusted to new datastructures
- changed test for TALER_denom_blind/TALER_denom_sign_blinded with and
without TALER_AgeHash
- minor updates and various fixes
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_crypto_lib.h | 4 | ||||
-rw-r--r-- | src/include/taler_exchange_service.h | 15 | ||||
-rw-r--r-- | src/include/taler_exchangedb_plugin.h | 9 | ||||
-rw-r--r-- | src/include/taler_extensions.h | 19 |
4 files changed, 20 insertions, 27 deletions
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index f1fa0285d..6a805b645 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -2536,7 +2536,7 @@ TALER_merchant_wire_signature_make ( */ void TALER_exchange_offline_extension_config_hash_sign ( - const struct TALER_ExtensionConfigHash h_config, + const struct TALER_ExtensionConfigHash *h_config, const struct TALER_MasterPrivateKeyP *master_priv, struct TALER_MasterSignatureP *master_sig); @@ -2552,7 +2552,7 @@ TALER_exchange_offline_extension_config_hash_sign ( */ enum GNUNET_GenericReturnValue TALER_exchange_offline_extension_config_hash_verify ( - const struct TALER_ExtensionConfigHash h_config, + const struct TALER_ExtensionConfigHash *h_config, const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterSignatureP *master_sig ); diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index 7fb5b4ec0..5bc87cf47 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -2682,12 +2682,14 @@ TALER_EXCHANGE_post_management_keys_cancel ( /** * Information needed for a POST /management/extensions operation. + * + * It represents the interface ExchangeKeysResponse as defined in + * https://docs.taler.net/design-documents/006-extensions.html#exchange */ struct TALER_EXCHANGE_ManagementPostExtensionsData { - struct TALER_Extension *extensions; - struct TALER_MasterSignatureP *extensions_sigs; - uint32_t num_extensions; + json_t *extensions; + struct TALER_MasterSignatureP extensions_sig; }; /** @@ -2708,11 +2710,12 @@ struct TALER_EXCHANGE_ManagementPostExtensionsHandle; /** - * FIXME-oec: Provide correct explanation of this function. + * Uploads the configurations of enabled extensions to the exchange, signed + * with the master key. * * @param ctx the context * @param url HTTP base URL for the exchange - * @param pkd signature data to POST + * @param ped signature data to POST * @param cb function to call with the exchange's result * @param cb_cls closure for @a cb * @return the request handle; NULL upon error @@ -2721,7 +2724,7 @@ struct TALER_EXCHANGE_ManagementPostExtensionsHandle * TALER_EXCHANGE_management_post_extensions ( struct GNUNET_CURL_Context *ctx, const char *url, - const struct TALER_EXCHANGE_ManagementPostExtensionsData *pkd, + struct TALER_EXCHANGE_ManagementPostExtensionsData *ped, TALER_EXCHANGE_ManagementPostExtensionsCallback cb, void *cb_cls); diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index 5eb168e14..cd68e1edb 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -4026,15 +4026,13 @@ struct TALER_EXCHANGEDB_Plugin * * @param cls the @e cls of this struct with the plugin-specific state * @param extension_name the name of the extension - * @param config JSON object of the configuration as string - * @param config_sig signature of the configuration by the offline master key + * @param config JSON object of the configuration as string, maybe NULL (== disabled extension) * @return transaction status code */ enum GNUNET_DB_QueryStatus (*set_extension_config)(void *cls, const char *extension_name, - const char *config, - const struct TALER_MasterSignatureP *config_sig); + const char *config); /** * Function called to retrieve the configuration of an extension @@ -4042,8 +4040,7 @@ struct TALER_EXCHANGEDB_Plugin * * @param cls the @e cls of this struct with the plugin-specific state * @param extension_name the name of the extension - * @param[out] config JSON object of the configuration as string - * @param[out] config_sig signature of the configuration by the master key + * @param[out] config JSON object of the configuration as string, maybe NULL (== disabled extension) * @return transaction status code */ enum GNUNET_DB_QueryStatus diff --git a/src/include/taler_extensions.h b/src/include/taler_extensions.h index 243811eb5..31e5c6738 100644 --- a/src/include/taler_extensions.h +++ b/src/include/taler_extensions.h @@ -28,29 +28,22 @@ #define TALER_EXTENSION_SECTION_PREFIX "exchange-extension-" -enum TALER_Extension_ReturnValue -{ - TALER_Extension_OK = 0, - TALER_Extension_ERROR_PARSING = 1, - TALER_Extension_ERROR_INVALID = 2, - TALER_Extension_ERROR_SYS = 3 -}; - enum TALER_Extension_Type { TALER_Extension_AgeRestriction = 0, TALER_Extension_Peer2Peer = 1, - TALER_Extension_Max = 2 // Must be last + TALER_Extension_MaxPredefined = 2 // Must be last }; /* - * TODO oec: documentation + * Represents the implementation of an extension. */ struct TALER_Extension { enum TALER_Extension_Type type; char *name; bool critical; + bool enabled; void *config; enum GNUNET_GenericReturnValue (*test_config)(const json_t *config); @@ -68,7 +61,7 @@ struct TALER_Extension * Finds and returns a supported extension by a given name. * * @param name name of the extension to lookup - * @param extensions list of TALER_Extensions as haystack, terminated by an entry of type TALER_Extension_Max + * @param extensions list of TALER_Extensions as haystack, terminated by a NULL-entry * @param[out] ext set to the extension, if found, NULL otherwise * @return GNUNET_OK if extension was found, GNUNET_NO otherwise */ @@ -109,7 +102,7 @@ TALER_extension_get_by_name (const char *name, * @param[out] mask Mask representation for age restriction. * @return Error, if age groups were invalid, OK otherwise. */ -enum TALER_Extension_ReturnValue +enum GNUNET_GenericReturnValue TALER_parse_age_group_string (const char *groups, struct TALER_AgeMask *mask); @@ -133,7 +126,7 @@ TALER_age_mask_to_string (const struct TALER_AgeMask *mask); * @return Error if extension for age restriction was set but age groups were * invalid, OK otherwise. */ -enum TALER_Extension_ReturnValue +enum GNUNET_GenericReturnValue TALER_get_age_mask (const struct GNUNET_CONFIGURATION_Handle *cfg, struct TALER_AgeMask *mask); |