summaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_management_post_extensions.c
diff options
context:
space:
mode:
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
commit0b56de6c994d3e525aa2d0195ff4607db3f14715 (patch)
tree9f34c40155dd5538841497c9f6a151deb2305a8d /src/lib/exchange_api_management_post_extensions.c
parent0b6ebc6160f1fd1f6db7c433f0912b5d2845a59c (diff)
downloadexchange-0b56de6c994d3e525aa2d0195ff4607db3f14715.tar.gz
exchange-0b56de6c994d3e525aa2d0195ff4607db3f14715.tar.bz2
exchange-0b56de6c994d3e525aa2d0195ff4607db3f14715.zip
[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/lib/exchange_api_management_post_extensions.c')
-rw-r--r--src/lib/exchange_api_management_post_extensions.c74
1 files changed, 20 insertions, 54 deletions
diff --git a/src/lib/exchange_api_management_post_extensions.c b/src/lib/exchange_api_management_post_extensions.c
index 862ff7117..c0ab143f6 100644
--- a/src/lib/exchange_api_management_post_extensions.c
+++ b/src/lib/exchange_api_management_post_extensions.c
@@ -1,19 +1,19 @@
/*
- This file is part of TALER
- Copyright (C) 2015-2021 Taler Systems SA
+ This file is part of TALER
+ Copyright (C) 2015-2021 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 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.
+ 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/>
-*/
+ 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 lib/exchange_api_management_post_extensions.c
* @brief functions to handle the settings for extensions (p2p and age restriction)
@@ -125,15 +125,13 @@ struct TALER_EXCHANGE_ManagementPostExtensionsHandle *
TALER_EXCHANGE_management_post_extensions (
struct GNUNET_CURL_Context *ctx,
const char *url,
- const struct TALER_EXCHANGE_ManagementPostExtensionsData *pkd,
- TALER_EXCHANGE_ManagementPostKeysCallback cb,
+ struct TALER_EXCHANGE_ManagementPostExtensionsData *ped,
+ TALER_EXCHANGE_ManagementPostExtensionsCallback cb,
void *cb_cls)
{
struct TALER_EXCHANGE_ManagementPostExtensionsHandle *ph;
CURL *eh = NULL;
json_t *body = NULL;
- json_t *extensions = NULL;
- json_t *extensions_sigs = NULL;
ph = GNUNET_new (struct TALER_EXCHANGE_ManagementPostExtensionsHandle);
ph->cb = cb;
@@ -149,45 +147,13 @@ TALER_EXCHANGE_management_post_extensions (
GNUNET_free (ph);
return NULL;
}
- extensions = json_array ();
- GNUNET_assert (NULL != extensions);
- for (unsigned int i = 0; i<pkd->num_extensions; i++)
- {
- const json_t *config;
- const struct TALER_Extension *ext = &pkd->extensions[i];
-
- config = ext->config_to_json (ext);
-
- GNUNET_assert (NULL != config);
- GNUNET_assert (0 ==
- json_array_append_new (
- extensions,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_data_auto ("extension",
- &ext->name),
- GNUNET_JSON_pack_data_auto ("config",
- config)
- )));
- }
- extensions_sigs = json_array ();
- GNUNET_assert (NULL != extensions_sigs);
- for (unsigned int i = 0; i<pkd->num_extensions; i++)
- {
- const struct TALER_MasterSignatureP *sks
- = &pkd->extensions_sigs[i];
-
- GNUNET_assert (0 ==
- json_array_append_new (
- extensions_sigs,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_data_auto ("extension_sig",
- &sks->eddsa_signature))));
- }
+
body = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_array_steal ("extensions",
- extensions),
- GNUNET_JSON_pack_array_steal ("extensions_sigs",
- extensions_sigs));
+ GNUNET_JSON_pack_object_steal ("extensions",
+ ped->extensions),
+ GNUNET_JSON_pack_data_auto ("extensions_sigs",
+ &ped->extensions_sig));
+
eh = curl_easy_init ();
GNUNET_assert (NULL != eh);
if (GNUNET_OK !=