donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit bd81cf5436cf37ce9db73bf4ea2c72ac7c390b84
parent c0108813b534993cc72244357c4657499ac50de1
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
Date:   Tue,  2 Jan 2024 16:42:08 +0100

cleanup

Diffstat:
Msrc/lib/donau_api_handle.h | 32--------------------------------
Dsrc/lib/donau_api_submit_receipts_get.c | 230-------------------------------------------------------------------------------
Msrc/testing/testing_api_misc.c | 11-----------
3 files changed, 0 insertions(+), 273 deletions(-)

diff --git a/src/lib/donau_api_handle.h b/src/lib/donau_api_handle.h @@ -25,38 +25,6 @@ #include <gnunet/gnunet_curl_lib.h> #include "donau_service.h" #include <taler/taler_util.h> -// #include "taler_curl_lib.h" - - -/** - * Function called for each auditor to give us a chance to possibly - * launch a deposit confirmation interaction. - * - * @param cls closure - * @param auditor_url base URL of the auditor - * @param auditor_pub public key of the auditor - */ -typedef void -(*TEAH_AuditorCallback)( - void *cls, - const char *auditor_url, - const struct TALER_AuditorPublicKeyP *auditor_pub); - - -/** - * Iterate over all available auditors for @a h, calling - * @a ac and giving it a chance to start a deposit - * confirmation interaction. - * - * @param keys the keys to go over auditors for - * @param ac function to call per auditor - * @param ac_cls closure for @a ac - */ -void -TEAH_get_auditors_for_dc ( - struct DONAU_Keys *keys, - TEAH_AuditorCallback ac, - void *ac_cls); /* end of donau_api_handle.h */ diff --git a/src/lib/donau_api_submit_receipts_get.c b/src/lib/donau_api_submit_receipts_get.c @@ -1,230 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2014-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 CHARITYABILITY 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 lib/donau_api_deposits_get.c - * @brief Implementation of the /deposits/ GET request - * @author Christian Grothoff - */ -#include "taler/platform.h" -#include <jansson.h> -#include <microhttpd.h> /* just for HTTP status codes */ -#include <gnunet/gnunet_util_lib.h> -#include <gnunet/gnunet_json_lib.h> -#include <gnunet/gnunet_curl_lib.h> -#include "taler/taler_json_lib.h" -#include "taler_donau_service.h" -#include "donau_api_handle.h" -#include "taler_signatures.h" -#include "donau_api_curl_defaults.h" - - -/** - * @brief A Deposit Get Handle - */ -struct DONAU_DepositGetHandle -{ - - /** - * The keys of the this request handle will use - */ - struct DONAU_Keys *keys; - - /** - * The url for this request. - */ - char *url; - - /** - * Context for #DH_curl_easy_post(). Keeps the data that must - * persist for Curl to make the upload. - */ - struct TALER_CURL_PostContext ctx; - - /** - * Handle for the request. - */ - struct GNUNET_CURL_Job *job; - - /** - * Function to call with the result. - */ - DONAU_DepositGetCallback cb; - - /** - * Closure for @a cb. - */ - void *cb_cls; - - /** - * Hash over the wiring information of the charity. - */ - struct TALER_CharityWireHashP h_wire; - - /** - * Hash over the contract for which this deposit is made. - */ - struct TALER_PrivateContractHashP h_contract_terms; - - /** - * The coin's public key. This is the value that must have been - * signed (blindly) by the Donau. - */ - struct TALER_CoinSpendPublicKeyP coin_pub; - -}; - - -struct DONAU_DepositGetHandle * -DONAU_deposits_get ( - struct GNUNET_CURL_Context *ctx, - const char *url, - struct DONAU_Keys *keys, - const struct TALER_CharityPrivateKeyP *charity_priv, - const struct TALER_CharityWireHashP *h_wire, - const struct TALER_PrivateContractHashP *h_contract_terms, - const struct TALER_CoinSpendPublicKeyP *coin_pub, - struct GNUNET_TIME_Relative timeout, - DONAU_DepositGetCallback cb, - void *cb_cls) -{ - struct DONAU_CharityPublicKeyP charity; - struct DONAU_CharitySignatureP charity_sig; - struct DONAU_DepositGetHandle *dwh; - CURL *eh; - char arg_str[(sizeof (struct TALER_CoinSpendPublicKeyP) - + sizeof (struct TALER_CharityWireHashP) - + sizeof (struct DONAU_CharityPublicKeyP) - + sizeof (struct TALER_PrivateContractHashP) - + sizeof (struct DONAU_CharitySignatureP)) * 2 + 48]; - - GNUNET_CRYPTO_eddsa_key_get_public (&charity_priv->eddsa_priv, - &charity.eddsa_pub); - TALER_charity_deposit_sign (h_contract_terms, - h_wire, - coin_pub, - charity_priv, - &charity_sig); - { - char cpub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2]; - char mpub_str[sizeof (struct DONAU_CharityPublicKeyP) * 2]; - char msig_str[sizeof (struct DONAU_CharitySignatureP) * 2]; - char chash_str[sizeof (struct TALER_PrivateContractHashP) * 2]; - char whash_str[sizeof (struct TALER_CharityWireHashP) * 2]; - char timeout_str[24]; - char *end; - - end = GNUNET_STRINGS_data_to_string (h_wire, - sizeof (*h_wire), - whash_str, - sizeof (whash_str)); - *end = '\0'; - end = GNUNET_STRINGS_data_to_string (&charity, - sizeof (charity), - mpub_str, - sizeof (mpub_str)); - *end = '\0'; - end = GNUNET_STRINGS_data_to_string (h_contract_terms, - sizeof (*h_contract_terms), - chash_str, - sizeof (chash_str)); - *end = '\0'; - end = GNUNET_STRINGS_data_to_string (coin_pub, - sizeof (*coin_pub), - cpub_str, - sizeof (cpub_str)); - *end = '\0'; - end = GNUNET_STRINGS_data_to_string (&charity_sig, - sizeof (charity_sig), - msig_str, - sizeof (msig_str)); - *end = '\0'; - if (GNUNET_TIME_relative_is_zero (timeout)) - { - timeout_str[0] = '\0'; - } - else - { - GNUNET_snprintf ( - timeout_str, - sizeof (timeout_str), - "%llu", - (unsigned long long) ( - timeout.rel_value_us - / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us)); - } - - GNUNET_snprintf (arg_str, - sizeof (arg_str), - "deposits/%s/%s/%s/%s?charity_sig=%s%s%s", - whash_str, - mpub_str, - chash_str, - cpub_str, - msig_str, - GNUNET_TIME_relative_is_zero (timeout) - ? "" - : "&timeout_ms=", - timeout_str); - } - - dwh = GNUNET_new (struct DONAU_DepositGetHandle); - dwh->cb = cb; - dwh->cb_cls = cb_cls; - dwh->url = TALER_url_join (url, - arg_str, - NULL); - if (NULL == dwh->url) - { - GNUNET_free (dwh); - return NULL; - } - dwh->h_wire = *h_wire; - dwh->h_contract_terms = *h_contract_terms; - dwh->coin_pub = *coin_pub; - eh = DONAU_curl_easy_get_ (dwh->url); - if (NULL == eh) - { - GNUNET_break (0); - GNUNET_free (dwh->url); - GNUNET_free (dwh); - return NULL; - } - dwh->job = GNUNET_CURL_job_add (ctx, - eh, - &handle_deposit_wtid_finished, - dwh); - dwh->keys = DONAU_keys_incref (keys); - return dwh; -} - - -void -DONAU_deposits_get_cancel (struct DONAU_DepositGetHandle *dwh) -{ - if (NULL != dwh->job) - { - GNUNET_CURL_job_cancel (dwh->job); - dwh->job = NULL; - } - GNUNET_free (dwh->url); - TALER_curl_easy_post_finished (&dwh->ctx); - DONAU_keys_decref (dwh->keys); - GNUNET_free (dwh); -} - - -/* end of donau_api_deposits_get.c */ diff --git a/src/testing/testing_api_misc.c b/src/testing/testing_api_misc.c @@ -129,17 +129,6 @@ TALER_TESTING_get_credentials ( "BASE_URL"); return GNUNET_SYSERR; } - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (ua->cfg, - "auditor", - "BASE_URL", - &ua->auditor_url)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "auditor", - "BASE_URL"); - return GNUNET_SYSERR; - } switch (bs) {