aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2023-06-26 00:09:01 +0200
committerÖzgür Kesim <oec-taler@kesim.org>2023-06-26 00:09:01 +0200
commitb87d1112ea479537bda5e1ba1e1100ee53315315 (patch)
tree4a8f95d685770228ad5e76342a663eabcf355805 /src/include
parentddedf03a816e5139b235a3ebdf5b600508c5ed5f (diff)
parent421129a32ed88fee49108c76e67c16b60f95116b (diff)
downloadexchange-b87d1112ea479537bda5e1ba1e1100ee53315315.tar.xz
Merge branch 'master' into age-withdraw-merge
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_auditor_service.h170
-rw-r--r--src/include/taler_exchange_service.h459
-rw-r--r--src/include/taler_testing_lib.h26
3 files changed, 377 insertions, 278 deletions
diff --git a/src/include/taler_auditor_service.h b/src/include/taler_auditor_service.h
index 0beff983d..3d8ca9efb 100644
--- a/src/include/taler_auditor_service.h
+++ b/src/include/taler_auditor_service.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2021 Taler Systems SA
+ 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 Affero General Public License as published by the Free Software
@@ -28,12 +28,12 @@
#include <gnunet/gnunet_curl_lib.h>
-/* ********************* /version *********************** */
+/* ********************* /config *********************** */
/**
- * @brief Information we get from the auditor about auditors.
+ * @brief Information we get from the auditor about itself.
*/
-struct TALER_AUDITOR_VersionInformation
+struct TALER_AUDITOR_ConfigInformation
{
/**
* Public key of the auditing institution. Wallets and merchants
@@ -147,57 +147,90 @@ struct TALER_AUDITOR_HttpResponse
/**
+ * Response to /config request.
+ */
+struct TALER_AUDITOR_ConfigResponse
+{
+ /**
+ * HTTP response.
+ */
+ struct TALER_AUDITOR_HttpResponse hr;
+
+ /**
+ * Details depending on HTTP status.
+ */
+ union
+ {
+
+ /**
+ * Details for #MHD_HTTP_OK.
+ */
+ struct
+ {
+
+ /**
+ * Protocol compatibility evaluation.
+ */
+ enum TALER_AUDITOR_VersionCompatibility compat;
+
+ /**
+ * Config data returned by /config.
+ */
+ struct TALER_AUDITOR_ConfigInformation vi;
+
+ } ok;
+
+ } details;
+
+};
+
+
+/**
* Function called with information about the auditor.
*
* @param cls closure
- * @param hr HTTP response data
- * @param vi basic information about the auditor
- * @param compat protocol compatibility information
+ * @param vr response data
*/
-// FIXME: bad API!
typedef void
-(*TALER_AUDITOR_VersionCallback) (
+(*TALER_AUDITOR_ConfigCallback) (
void *cls,
- const struct TALER_AUDITOR_HttpResponse *hr,
- const struct TALER_AUDITOR_VersionInformation *vi,
- enum TALER_AUDITOR_VersionCompatibility compat);
+ const struct TALER_AUDITOR_ConfigResponse *vr);
/**
* @brief Handle to the auditor. This is where we interact with
* a particular auditor and keep the per-auditor information.
*/
-struct TALER_AUDITOR_Handle;
+struct TALER_AUDITOR_GetConfigHandle;
/**
- * Initialise a connection to the auditor. Will connect to the
+ * Obtain meta data about an auditor. Will connect to the
* auditor and obtain information about the auditor's master public
* key and the auditor's auditor. The respective information will
- * be passed to the @a version_cb once available, and all future
- * interactions with the auditor will be checked to be signed
- * (where appropriate) by the respective master key.
+ * be passed to the @a config_cb once available.
*
- * @param ctx the context
+ * @param ctx the context for CURL requests
* @param url HTTP base URL for the auditor
- * @param version_cb function to call with the auditor's version information
- * @param version_cb_cls closure for @a version_cb
+ * @param config_cb function to call with the auditor's config information
+ * @param config_cb_cls closure for @a config_cb
* @return the auditor handle; NULL upon error
*/
-struct TALER_AUDITOR_Handle *
-TALER_AUDITOR_connect (struct GNUNET_CURL_Context *ctx,
- const char *url,
- TALER_AUDITOR_VersionCallback version_cb,
- void *version_cb_cls);
+struct TALER_AUDITOR_GetConfigHandle *
+TALER_AUDITOR_get_config (struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ TALER_AUDITOR_ConfigCallback config_cb,
+ void *config_cb_cls);
/**
- * Disconnect from the auditor.
+ * Cancel auditor config request.
*
* @param auditor the auditor handle
*/
void
-TALER_AUDITOR_disconnect (struct TALER_AUDITOR_Handle *auditor);
+TALER_AUDITOR_get_config_cancel (struct
+ TALER_AUDITOR_GetConfigHandle *auditor);
/**
@@ -207,16 +240,28 @@ struct TALER_AUDITOR_DepositConfirmationHandle;
/**
+ * Response to /deposit-confirmation request.
+ */
+struct TALER_AUDITOR_DepositConfirmationResponse
+{
+ /**
+ * HTTP response.
+ */
+ struct TALER_AUDITOR_HttpResponse hr;
+};
+
+
+/**
* Signature of functions called with the result from our call to the
* auditor's /deposit-confirmation handler.
*
* @param cls closure
- * @param hr HTTP response data
+ * @param dcr response data
*/
typedef void
(*TALER_AUDITOR_DepositConfirmationResultCallback)(
void *cls,
- const struct TALER_AUDITOR_HttpResponse *hr);
+ const struct TALER_AUDITOR_DepositConfirmationResponse *dcr);
/**
@@ -226,13 +271,13 @@ typedef void
* that the response is well-formed. If the auditor's reply is not
* well-formed, we return an HTTP status code of zero to @a cb.
*
- * We also verify that the @a exchange_sig is valid for this deposit-confirmation
- * request, and that the @a master_sig is a valid signature for @a
- * exchange_pub. Also, the @a auditor must be ready to operate (i.e. have
- * finished processing the /version reply). If either check fails, we do
- * NOT initiate the transaction with the auditor and instead return NULL.
+ * We also verify that the @a exchange_sig is valid for this
+ * deposit-confirmation request, and that the @a master_sig is a valid
+ * signature for @a exchange_pub. If the check fails, we do NOT initiate the
+ * transaction with the auditor and instead return NULL.
*
- * @param auditor the auditor handle; the auditor must be ready to operate
+ * @param ctx the context for CURL requests
+ * @param url HTTP base URL for the auditor
* @param h_wire hash of merchant wire details
* @param h_policy hash over the policy, if any
* @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the auditor)
@@ -256,7 +301,8 @@ typedef void
*/
struct TALER_AUDITOR_DepositConfirmationHandle *
TALER_AUDITOR_deposit_confirmation (
- struct TALER_AUDITOR_Handle *auditor,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_ExtensionPolicyHashP *h_policy,
const struct TALER_PrivateContractHashP *h_contract_terms,
@@ -314,33 +360,69 @@ struct TALER_AUDITOR_ExchangeInfo
/**
+ * Response to GET /exchanges request.
+ */
+struct TALER_AUDITOR_ListExchangesResponse
+{
+ /**
+ * HTTP response.
+ */
+ struct TALER_AUDITOR_HttpResponse hr;
+
+ /**
+ * Details depending on HTTP status.
+ */
+ union
+ {
+
+ /**
+ * Details for #MHD_HTTP_OK.
+ */
+ struct
+ {
+
+ /**
+ * Length of the @e ei array.
+ */
+ unsigned int num_exchanges;
+
+ /**
+ * Array with information about exchanges
+ * audited by this auditor.
+ */
+ const struct TALER_AUDITOR_ExchangeInfo *ei;
+ } ok;
+ } details;
+};
+
+
+/**
* Function called with the result from /exchanges.
*
* @param cls closure
- * @param hr HTTP response data
- * @param num_exchanges length of array at @a ei
- * @param ei information about exchanges returned by the auditor
+ * @param ler response data
*/
typedef void
(*TALER_AUDITOR_ListExchangesResultCallback)(
void *cls,
- const struct TALER_AUDITOR_HttpResponse *hr,
- unsigned int num_exchanges,
- const struct TALER_AUDITOR_ExchangeInfo *ei);
+ const struct TALER_AUDITOR_ListExchangesResponse *ler);
+
/**
* Submit an /exchanges request to the auditor and get the
* auditor's response. If the auditor's reply is not
* well-formed, we return an HTTP status code of zero to @a cb.
*
- * @param auditor the auditor handle; the auditor must be ready to operate
+ * @param ctx the context for CURL requests
+ * @param url HTTP base URL for the auditor
* @param cb the callback to call when a reply for this request is available
* @param cb_cls closure for the above callback
* @return a handle for this request; NULL if the inputs are invalid (i.e.
* signatures fail to verify). In this case, the callback is not called.
*/
struct TALER_AUDITOR_ListExchangesHandle *
-TALER_AUDITOR_list_exchanges (struct TALER_AUDITOR_Handle *auditor,
+TALER_AUDITOR_list_exchanges (struct GNUNET_CURL_Context *ctx,
+ const char *url,
TALER_AUDITOR_ListExchangesResultCallback cb,
void *cb_cls);
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index 3e0206eb7..bc6a230b6 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -573,19 +573,40 @@ TALER_EXCHANGE_disconnect (struct TALER_EXCHANGE_Handle *exchange);
* @param exchange the exchange handle
* @return the exchange's key set
*/
-const struct TALER_EXCHANGE_Keys *
+struct TALER_EXCHANGE_Keys *
TALER_EXCHANGE_get_keys (struct TALER_EXCHANGE_Handle *exchange);
/**
+ * Increment reference counter for @a keys
+ *
+ * @param[in,out] keys object to increment reference counter for
+ * @return keys, with incremented reference counter
+ */
+struct TALER_EXCHANGE_Keys *
+TALER_EXCHANGE_keys_incref (struct TALER_EXCHANGE_Keys *keys);
+
+
+/**
+ * Deccrement reference counter for @a keys.
+ * Frees @a keys if reference counter becomes zero.
+ *
+ * @param[in,out] keys object to decrement reference counter for
+ */
+void
+TALER_EXCHANGE_keys_decref (struct TALER_EXCHANGE_Keys *keys);
+
+
+/**
* Let the user set the last valid denomination time manually.
*
* @param exchange the exchange handle.
* @param last_denom_new new last denomination time.
*/
void
-TALER_EXCHANGE_set_last_denom (struct TALER_EXCHANGE_Handle *exchange,
- struct GNUNET_TIME_Timestamp last_denom_new);
+TALER_EXCHANGE_set_last_denom (
+ struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_TIME_Timestamp last_denom_new);
/**
@@ -633,10 +654,11 @@ enum TALER_EXCHANGE_CheckKeysFlags
* @return until when the existing response is current, 0 if we are re-downloading now
*/
struct GNUNET_TIME_Timestamp
-TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
- enum TALER_EXCHANGE_CheckKeysFlags flags,
- TALER_EXCHANGE_CertificationCallback cb,
- void *cb_cls);
+TALER_EXCHANGE_check_keys_current (
+ struct TALER_EXCHANGE_Handle *exchange,
+ enum TALER_EXCHANGE_CheckKeysFlags flags,
+ TALER_EXCHANGE_CertificationCallback cb,
+ void *cb_cls);
/**
@@ -650,6 +672,16 @@ TALER_EXCHANGE_get_keys_raw (struct TALER_EXCHANGE_Handle *exchange);
/**
+ * Obtain the keys from the exchange in the raw JSON format.
+ *
+ * @param keys the keys structure
+ * @return the keys in raw JSON
+ */
+json_t *
+TALER_EXCHANGE_keys_to_json (struct TALER_EXCHANGE_Keys *keys);
+
+
+/**
* Test if the given @a pub is a the current signing key from the exchange
* according to @a keys.
*
@@ -1035,9 +1067,10 @@ struct TALER_EXCHANGE_WireHandle;
* @return a handle for this request
*/
struct TALER_EXCHANGE_WireHandle *
-TALER_EXCHANGE_wire (struct TALER_EXCHANGE_Handle *exchange,
- TALER_EXCHANGE_WireCallback wire_cb,
- void *wire_cb_cls);
+TALER_EXCHANGE_wire (
+ struct TALER_EXCHANGE_Handle *exchange,
+ TALER_EXCHANGE_WireCallback wire_cb,
+ void *wire_cb_cls);
/**
@@ -1152,135 +1185,6 @@ struct TALER_EXCHANGE_DepositContractDetail
/**
- * @brief A Deposit Handle
- */
-struct TALER_EXCHANGE_DepositHandle;
-
-
-/**
- * Structure with information about a deposit
- * operation's result.
- */
-struct TALER_EXCHANGE_DepositResult
-{
- /**
- * HTTP response data
- */
- struct TALER_EXCHANGE_HttpResponse hr;
-
- union
- {
-
- /**
- * Information returned if the HTTP status is
- * #MHD_HTTP_OK.
- */
- struct
- {
- /**
- * Time when the exchange generated the deposit confirmation
- */
- struct GNUNET_TIME_Timestamp deposit_timestamp;
-
- /**
- * signature provided by the exchange
- */
- const struct TALER_ExchangeSignatureP *exchange_sig;
-
- /**
- * exchange key used to sign @a exchange_sig.
- */
- const struct TALER_ExchangePublicKeyP *exchange_pub;
-
- /**
- * Base URL for looking up wire transfers, or
- * NULL to use the default base URL.
- */
- const char *transaction_base_url;
-
- } ok;
-
- /**
- * Information returned if the HTTP status is
- * #MHD_HTTP_CONFLICT.
- */
- struct
- {
- /* TODO: returning full details is not implemented */
- } conflict;
-
- } details;
-};
-
-
-/**
- * Callbacks of this type are used to serve the result of submitting a
- * deposit permission request to a exchange.
- *
- * @param cls closure
- * @param dr deposit response details
- */
-typedef void
-(*TALER_EXCHANGE_DepositResultCallback) (
- void *cls,
- const struct TALER_EXCHANGE_DepositResult *dr);
-
-
-/**
- * Submit a deposit permission to the exchange and get the exchange's
- * response. This API is typically used by a merchant. Note that
- * while we return the response verbatim to the caller for further
- * processing, we do already verify that the response is well-formed
- * (i.e. that signatures included in the response are all valid). If
- * the exchange's reply is not well-formed, we return an HTTP status code
- * of zero to @a cb.
- *
- * We also verify that the @a cdd.coin_sig is valid for this deposit
- * request, and that the @a cdd.ub_sig is a valid signature for @a
- * coin_pub. Also, the @a exchange must be ready to operate (i.e. have
- * finished processing the /keys reply). If either check fails, we do
- * NOT initiate the transaction with the exchange and instead return NULL.
- *
- * @param exchange the exchange handle; the exchange must be ready to operate
- * @param dcd details about the contract the deposit is for
- * @param cdd details about the coin to be deposited
- * @param cb the callback to call when a reply for this request is available
- * @param cb_cls closure for the above callback
- * @param[out] ec if NULL is returned, set to the error code explaining why the operation failed
- * @return a handle for this request; NULL if the inputs are invalid (i.e.
- * signatures fail to verify). In this case, the callback is not called.
- */
-struct TALER_EXCHANGE_DepositHandle *
-TALER_EXCHANGE_deposit (
- struct TALER_EXCHANGE_Handle *exchange,
- const struct TALER_EXCHANGE_DepositContractDetail *dcd,
- const struct TALER_EXCHANGE_CoinDepositDetail *cdd,
- TALER_EXCHANGE_DepositResultCallback cb,
- void *cb_cls,
- enum TALER_ErrorCode *ec);
-
-
-/**
- * Change the chance that our deposit confirmation will be given to the
- * auditor to 100%.
- *
- * @param deposit the deposit permission request handle
- */
-void
-TALER_EXCHANGE_deposit_force_dc (struct TALER_EXCHANGE_DepositHandle *deposit);
-
-
-/**
- * Cancel a deposit permission request. This function cannot be used
- * on a request handle if a response is already served for it.
- *
- * @param deposit the deposit permission request handle
- */
-void
-TALER_EXCHANGE_deposit_cancel (struct TALER_EXCHANGE_DepositHandle *deposit);
-
-
-/**
* @brief A Batch Deposit Handle
*/
struct TALER_EXCHANGE_BatchDepositHandle;
@@ -1374,7 +1278,9 @@ typedef void
* finished processing the /keys reply). If either check fails, we do
* NOT initiate the transaction with the exchange and instead return NULL.
*
- * @param exchange the exchange handle; the exchange must be ready to operate
+ * @param ctx curl context
+ * @param url exchange base URL
+ * @param keys exchange keys
* @param dcd details about the contract the deposit is for
* @param num_cdds length of the @a cdds array
* @param cdds array with details about the coins to be deposited
@@ -1386,7 +1292,9 @@ typedef void
*/
struct TALER_EXCHANGE_BatchDepositHandle *
TALER_EXCHANGE_batch_deposit (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ struct TALER_EXCHANGE_Keys *keys,
const struct TALER_EXCHANGE_DepositContractDetail *dcd,
unsigned int num_cdds,
const struct TALER_EXCHANGE_CoinDepositDetail *cdds,
@@ -1482,7 +1390,9 @@ typedef void
* finished processing the /keys reply). If this check fails, we do
* NOT initiate the transaction with the exchange and instead return NULL.
*
- * @param exchange the exchange handle; the exchange must be ready to operate
+ * @param ctx curl context
+ * @param url exchange base URL
+ * @param keys exchange keys
* @param amount the amount to be refunded; must be larger than the refund fee
* (as that fee is still being subtracted), and smaller than the amount
* (with deposit fee) of the original deposit contribution of this coin
@@ -1500,7 +1410,9 @@ typedef void
*/
struct TALER_EXCHANGE_RefundHandle *
TALER_EXCHANGE_refund (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ struct TALER_EXCHANGE_Keys *keys,
const struct TALER_Amount *amount,
const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
@@ -1609,7 +1521,8 @@ struct TALER_EXCHANGE_NonceKey
/**
* Get a set of CS R values using a /csr-melt request.
*
- * @param exchange the exchange handle; the exchange must be ready to operate
+ * @param ctx curl context
+ * @param url exchange base URL
* @param rms master key used for the derivation of the CS values
* @param nks_len length of the @a nks array
* @param nks array of denominations and nonces
@@ -1620,12 +1533,14 @@ struct TALER_EXCHANGE_NonceKey
* In this case, the callback is not called.
*/
struct TALER_EXCHANGE_CsRMeltHandle *
-TALER_EXCHANGE_csr_melt (struct TALER_EXCHANGE_Handle *exchange,
- const struct TALER_RefreshMasterSecretP *rms,
- unsigned int nks_len,
- struct TALER_EXCHANGE_NonceKey *nks,
- TALER_EXCHANGE_CsRMeltCallback res_cb,
- void *res_cb_cls);
+TALER_EXCHANGE_csr_melt (
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ const struct TALER_RefreshMasterSecretP *rms,
+ unsigned int nks_len,
+ struct TALER_EXCHANGE_NonceKey *nks,
+ TALER_EXCHANGE_CsRMeltCallback res_cb,
+ void *res_cb_cls);
/**
@@ -1713,11 +1628,12 @@ typedef void
* In this case, the callback is not called.
*/
struct TALER_EXCHANGE_CsRWithdrawHandle *
-TALER_EXCHANGE_csr_withdraw (struct TALER_EXCHANGE_Handle *exchange,
- const struct TALER_EXCHANGE_DenomPublicKey *pk,
- const struct TALER_CsNonce *nonce,
- TALER_EXCHANGE_CsRWithdrawCallback res_cb,
- void *res_cb_cls);
+TALER_EXCHANGE_csr_withdraw (
+ struct TALER_EXCHANGE_Handle *exchange,
+ const struct TALER_EXCHANGE_DenomPublicKey *pk,
+ const struct TALER_CsNonce *nonce,
+ TALER_EXCHANGE_CsRWithdrawCallback res_cb,
+ void *res_cb_cls);
/**
@@ -2127,7 +2043,8 @@ typedef void
* reply is not well-formed, we return an HTTP status code of zero to
* @a cb.
*
- * @param exchange the exchange handle; the exchange must be ready to operate
+ * @param ctx curl context
+ * @param url exchange base URL
* @param reserve_pub public key of the reserve to inspect
* @param timeout how long to wait for an affirmative reply
* (enables long polling if the reserve does not yet exist)
@@ -2138,7 +2055,8 @@ typedef void
*/
struct TALER_EXCHANGE_ReservesGetHandle *
TALER_EXCHANGE_reserves_get (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
const struct TALER_ReservePublicKeyP *reserve_pub,
struct GNUNET_TIME_Relative timeout,
TALER_EXCHANGE_ReservesGetCallback cb,
@@ -2235,7 +2153,9 @@ typedef void
/**
* Submit a request to obtain the reserve status.
*
- * @param exchange the exchange handle; the exchange must be ready to operate
+ * @param ctx curl context
+ * @param url exchange base URL
+ * @param keys exchange keys
* @param reserve_priv private key of the reserve to inspect
* @param cb the callback to call when a reply for this request is available
* @param cb_cls closure for the above callback
@@ -2244,7 +2164,9 @@ typedef void
*/
struct TALER_EXCHANGE_ReservesStatusHandle *
TALER_EXCHANGE_reserves_status (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ struct TALER_EXCHANGE_Keys *keys,
const struct TALER_ReservePrivateKeyP *reserve_priv,
TALER_EXCHANGE_ReservesStatusCallback cb,
void *cb_cls);
@@ -2353,7 +2275,9 @@ typedef void
/**
* Submit a request to obtain the reserve history.
*
- * @param exchange the exchange handle; the exchange must be ready to operate
+ * @param ctx curl context
+ * @param url exchange base URL
+ * @param keys exchange keys
* @param reserve_priv private key of the reserve to inspect
* @param cb the callback to call when a reply for this request is available
* @param cb_cls closure for the above callback
@@ -2362,7 +2286,9 @@ typedef void
*/
struct TALER_EXCHANGE_ReservesHistoryHandle *
TALER_EXCHANGE_reserves_history (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ struct TALER_EXCHANGE_Keys *keys,
const struct TALER_ReservePrivateKeyP *reserve_priv,
TALER_EXCHANGE_ReservesHistoryCallback cb,
void *cb_cls);
@@ -2752,11 +2678,12 @@ struct TALER_EXCHANGE_Withdraw2Handle;
* In this case, the callback is not called.
*/
struct TALER_EXCHANGE_Withdraw2Handle *
-TALER_EXCHANGE_withdraw2 (struct TALER_EXCHANGE_Handle *exchange,
- const struct TALER_PlanchetDetail *pd,
- const struct TALER_ReservePrivateKeyP *reserve_priv,
- TALER_EXCHANGE_Withdraw2Callback res_cb,
- void *res_cb_cls);
+TALER_EXCHANGE_withdraw2 (
+ struct TALER_EXCHANGE_Handle *exchange,
+ const struct TALER_PlanchetDetail *pd,
+ const struct TALER_ReservePrivateKeyP *reserve_priv,
+ TALER_EXCHANGE_Withdraw2Callback res_cb,
+ void *res_cb_cls);
/**
@@ -3014,7 +2941,9 @@ typedef void
* argument @a rd should be committed to persistent storage
* prior to calling this function.
*
- * @param exchange the exchange handle; the exchange must be ready to operate
+ * @param ctx curl context
+ * @param url exchange base URL
+ * @param keys exchange keys
* @param rms the fresh secret that defines the refresh operation
* @param rd the refresh data specifying the characteristics of the operation
* @param melt_cb the callback to call with the result
@@ -3023,11 +2952,14 @@ typedef void
* In this case, neither callback will be called.
*/
struct TALER_EXCHANGE_MeltHandle *
-TALER_EXCHANGE_melt (struct TALER_EXCHANGE_Handle *exchange,
- const struct TALER_RefreshMasterSecretP *rms,
- const struct TALER_EXCHANGE_RefreshData *rd,
- TALER_EXCHANGE_MeltCallback melt_cb,
- void *melt_cb_cls);
+TALER_EXCHANGE_melt (
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ struct TALER_EXCHANGE_Keys *keys,
+ const struct TALER_RefreshMasterSecretP *rms,
+ const struct TALER_EXCHANGE_RefreshData *rd,
+ TALER_EXCHANGE_MeltCallback melt_cb,
+ void *melt_cb_cls);
/**
@@ -3147,7 +3079,9 @@ struct TALER_EXCHANGE_RefreshesRevealHandle;
* arguments should have been committed to persistent storage
* prior to calling this function.
*
- * @param exchange the exchange handle; the exchange must be ready to operate
+ * @param ctx curl context
+ * @param url exchange base URL
+ * @param keys exchange keys
* @param rms the fresh secret that defines the refresh operation
* @param rd the refresh data that characterizes the refresh operation
* @param num_coins number of fresh coins to be created, length of the @a exchange_vals array, must match value in @a rd
@@ -3162,7 +3096,8 @@ struct TALER_EXCHANGE_RefreshesRevealHandle;
*/
struct TALER_EXCHANGE_RefreshesRevealHandle *
TALER_EXCHANGE_refreshes_reveal (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
const struct TALER_RefreshMasterSecretP *rms,
const struct TALER_EXCHANGE_RefreshData *rd,
unsigned int num_coins,
@@ -3284,7 +3219,8 @@ typedef void
* This API is typically not used by anyone, it is more a threat against those
* trying to receive a funds transfer by abusing the refresh protocol.
*
- * @param exchange the exchange handle; the exchange must be ready to operate
+ * @param ctx CURL context
+ * @param url exchange base URL
* @param coin_priv private key to request link data for
* @param age_commitment_proof age commitment to the corresponding coin, might be NULL
* @param link_cb the callback to call with the useful result of the
@@ -3294,7 +3230,8 @@ typedef void
*/
struct TALER_EXCHANGE_LinkHandle *
TALER_EXCHANGE_link (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
const struct TALER_CoinSpendPrivateKeyP *coin_priv,
const struct TALER_AgeCommitmentProof *age_commitment_proof,
TALER_EXCHANGE_LinkCallback link_cb,
@@ -3412,7 +3349,9 @@ typedef void
* Query the exchange about which transactions were combined
* to create a wire transfer.
*
- * @param exchange exchange to query
+ * @param ctx curl context
+ * @param url exchange base URL
+ * @param keys exchange keys
* @param wtid raw wire transfer identifier to get information about
* @param cb callback to call
* @param cb_cls closure for @a cb
@@ -3420,7 +3359,9 @@ typedef void
*/
struct TALER_EXCHANGE_TransfersGetHandle *
TALER_EXCHANGE_transfers_get (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ struct TALER_EXCHANGE_Keys *keys,
const struct TALER_WireTransferIdentifierRawP *wtid,
TALER_EXCHANGE_TransfersGetCallback cb,
void *cb_cls);
@@ -3550,7 +3491,9 @@ typedef void
* which aggregate wire transfer the deposit operation identified by @a coin_pub,
* @a merchant_priv and @a h_contract_terms contributed to.
*
- * @param exchange the exchange to query
+ * @param ctx curl context
+ * @param url exchange base URL
+ * @param keys exchange keys
* @param merchant_priv the merchant's private key
* @param h_wire hash of merchant's wire transfer details
* @param h_contract_terms hash of the proposal data
@@ -3562,7 +3505,9 @@ typedef void
*/
struct TALER_EXCHANGE_DepositGetHandle *
TALER_EXCHANGE_deposits_get (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ struct TALER_EXCHANGE_Keys *keys,
const struct TALER_MerchantPrivateKeyP *merchant_priv,
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_PrivateContractHashP *h_contract_terms,
@@ -3605,7 +3550,7 @@ TALER_EXCHANGE_verify_coin_history (
* Parse history given in JSON format and return it in binary
* format.
*
- * @param exchange connection to the exchange we can use
+ * @param keys exchange keys
* @param history JSON array with the history
* @param reserve_pub public key of the reserve to inspect
* @param currency currency we expect the balance to be in
@@ -3620,7 +3565,7 @@ TALER_EXCHANGE_verify_coin_history (
*/
enum GNUNET_GenericReturnValue
TALER_EXCHANGE_parse_reserve_history (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct TALER_EXCHANGE_Keys *keys,
const json_t *history,
const struct TALER_ReservePublicKeyP *reserve_pub,
const char *currency,
@@ -3702,7 +3647,9 @@ typedef void
* the emergency recoup protocol for a given denomination. The value
* of the coin will be refunded to the original customer (without fees).
*
- * @param exchange the exchange handle; the exchange must be ready to operate
+ * @param ctx curl context
+ * @param url exchange base URL
+ * @param keys exchange keys
* @param pk kind of coin to pay back
* @param denom_sig signature over the coin by the exchange using @a pk
* @param exchange_vals contribution from the exchange on the withdraw
@@ -3714,13 +3661,16 @@ typedef void
* In this case, the callback is not called.
*/
struct TALER_EXCHANGE_RecoupHandle *
-TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
- const struct TALER_EXCHANGE_DenomPublicKey *pk,
- const struct TALER_DenominationSignature *denom_sig,
- const struct TALER_ExchangeWithdrawValues *exchange_vals,
- const struct TALER_PlanchetMasterSecretP *ps,
- TALER_EXCHANGE_RecoupResultCallback recoup_cb,
- void *recoup_cb_cls);
+TALER_EXCHANGE_recoup (
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ struct TALER_EXCHANGE_Keys *keys,
+ const struct TALER_EXCHANGE_DenomPublicKey *pk,
+ const struct TALER_DenominationSignature *denom_sig,
+ const struct TALER_ExchangeWithdrawValues *exchange_vals,
+ const struct TALER_PlanchetMasterSecretP *ps,
+ TALER_EXCHANGE_RecoupResultCallback recoup_cb,
+ void *recoup_cb_cls);
/**
@@ -3793,7 +3743,9 @@ typedef void
* revoked coin was refreshed from. The original coin is then
* considered a zombie.
*
- * @param exchange the exchange handle; the exchange must be ready to operate
+ * @param ctx curl context
+ * @param url exchange base URL
+ * @param keys exchange keys
* @param pk kind of coin to pay back
* @param denom_sig signature over the coin by the exchange using @a pk
* @param exchange_vals contribution from the exchange on the withdraw
@@ -3808,7 +3760,9 @@ typedef void
*/
struct TALER_EXCHANGE_RecoupRefreshHandle *
TALER_EXCHANGE_recoup_refresh (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ struct TALER_EXCHANGE_Keys *keys,
const struct TALER_EXCHANGE_DenomPublicKey *pk,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_ExchangeWithdrawValues *exchange_vals,
@@ -4023,7 +3977,8 @@ struct TALER_EXCHANGE_KycProofHandle;
/**
* Run interaction with exchange to provide proof of KYC status.
*
- * @param eh exchange handle to use
+ * @param ctx CURL context
+ * @param url exchange base URL
* @param h_payto hash of payto URI identifying the target account
* @param logic name of the KYC logic to run
* @param args additional args to pass, can be NULL
@@ -4033,12 +3988,14 @@ struct TALER_EXCHANGE_KycProofHandle;
* @return NULL on error
*/
struct TALER_EXCHANGE_KycProofHandle *
-TALER_EXCHANGE_kyc_proof (struct TALER_EXCHANGE_Handle *eh,
- const struct TALER_PaytoHashP *h_payto,
- const char *logic,
- const char *args,
- TALER_EXCHANGE_KycProofCallback cb,
- void *cb_cls);
+TALER_EXCHANGE_kyc_proof (
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ const struct TALER_PaytoHashP *h_payto,
+ const char *logic,
+ const char *args,
+ TALER_EXCHANGE_KycProofCallback cb,
+ void *cb_cls);
/**
@@ -4116,7 +4073,8 @@ typedef void
* Run interaction with exchange to find out the wallet's KYC
* identifier.
*
- * @param eh exchange handle to use
+ * @param ctx CURL context
+ * @param url exchange base URL
* @param reserve_priv wallet private key to check
* @param balance balance (or balance threshold) crossed by the wallet
* @param cb function to call with the result
@@ -4124,11 +4082,13 @@ typedef void
* @return NULL on error
*/
struct TALER_EXCHANGE_KycWalletHandle *
-TALER_EXCHANGE_kyc_wallet (struct TALER_EXCHANGE_Handle *eh,
- const struct TALER_ReservePrivateKeyP *reserve_priv,
- const struct TALER_Amount *balance,
- TALER_EXCHANGE_KycWalletCallback cb,
- void *cb_cls);
+TALER_EXCHANGE_kyc_wallet (
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ const struct TALER_ReservePrivateKeyP *reserve_priv,
+ const struct TALER_Amount *balance,
+ TALER_EXCHANGE_KycWalletCallback cb,
+ void *cb_cls);
/**
@@ -4353,10 +4313,11 @@ struct TALER_EXCHANGE_ManagementGetKeysHandle;
* @return the request handle; NULL upon error
*/
struct TALER_EXCHANGE_ManagementGetKeysHandle *
-TALER_EXCHANGE_get_management_keys (struct GNUNET_CURL_Context *ctx,
- const char *url,
- TALER_EXCHANGE_ManagementGetKeysCallback cb,
- void *cb_cls);
+TALER_EXCHANGE_get_management_keys (
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ TALER_EXCHANGE_ManagementGetKeysCallback cb,
+ void *cb_cls);
/**
@@ -5783,7 +5744,8 @@ struct TALER_EXCHANGE_ContractsGetHandle;
/**
* Request information about a contract from the exchange.
*
- * @param exchange exchange handle
+ * @param ctx CURL context
+ * @param url exchange base URL
* @param contract_priv private key of the contract
* @param cb function to call with the exchange's result
* @param cb_cls closure for @a cb
@@ -5791,7 +5753,8 @@ struct TALER_EXCHANGE_ContractsGetHandle;
*/
struct TALER_EXCHANGE_ContractsGetHandle *
TALER_EXCHANGE_contract_get (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
const struct TALER_ContractDiffiePrivateP *contract_priv,
TALER_EXCHANGE_ContractGetCallback cb,
void *cb_cls);
@@ -5880,7 +5843,9 @@ struct TALER_EXCHANGE_PurseGetHandle;
/**
* Request information about a purse from the exchange.
*
- * @param exchange exchange handle
+ * @param ctx curl context
+ * @param url exchange base URL
+ * @param keys exchange keys
* @param purse_pub public key of the purse
* @param timeout how long to wait for a change to happen
* @param wait_for_merge true to wait for a merge event, otherwise wait for a deposit event
@@ -5890,7 +5855,9 @@ struct TALER_EXCHANGE_PurseGetHandle;
*/
struct TALER_EXCHANGE_PurseGetHandle *
TALER_EXCHANGE_purse_get (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ struct TALER_EXCHANGE_Keys *keys,
const struct TALER_PurseContractPublicKeyP *purse_pub,
struct GNUNET_TIME_Relative timeout,
bool wait_for_merge,
@@ -6004,7 +5971,9 @@ struct TALER_EXCHANGE_PurseDeposit
* Inform the exchange that a purse should be created
* and coins deposited into it.
*
- * @param exchange the exchange to interact with
+ * @param ctx curl context
+ * @param url exchange base URL
+ * @param keys exchange keys
* @param purse_priv private key of the purse
* @param merge_priv the merge credential
* @param contract_priv key needed to obtain and decrypt the contract
@@ -6020,7 +5989,9 @@ struct TALER_EXCHANGE_PurseDeposit
*/
struct TALER_EXCHANGE_PurseCreateDepositHandle *
TALER_EXCHANGE_purse_create_with_deposit (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ struct TALER_EXCHANGE_Keys *keys,
const struct TALER_PurseContractPrivateKeyP *purse_priv,
const struct TALER_PurseMergePrivateKeyP *merge_priv,
const struct TALER_ContractDiffiePrivateP *contract_priv,
@@ -6077,7 +6048,8 @@ struct TALER_EXCHANGE_PurseDeleteHandle;
* Asks the exchange to delete a purse. Will only succeed if
* the purse was not yet merged and did not yet time out.
*
- * @param exchange the exchange to interact with
+ * @param ctx CURL context
+ * @param url exchange base URL
* @param purse_priv private key of the purse
* @param cb function to call with the exchange's result
* @param cb_cls closure for @a cb
@@ -6085,7 +6057,8 @@ struct TALER_EXCHANGE_PurseDeleteHandle;
*/
struct TALER_EXCHANGE_PurseDeleteHandle *
TALER_EXCHANGE_purse_delete (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
const struct TALER_PurseContractPrivateKeyP *purse_priv,
TALER_EXCHANGE_PurseDeleteCallback cb,
void *cb_cls);
@@ -6182,7 +6155,9 @@ struct TALER_EXCHANGE_AccountMergeHandle;
* Inform the exchange that a purse should be merged
* with a reserve.
*
- * @param exchange the exchange hosting the purse
+ * @param ctx curl context
+ * @param url exchange base URL
+ * @param keys exchange keys
* @param reserve_exchange_url base URL of the exchange with the reserve
* @param reserve_priv private key of the reserve to merge into
* @param purse_pub public key of the purse to merge
@@ -6198,7 +6173,9 @@ struct TALER_EXCHANGE_AccountMergeHandle;
*/
struct TALER_EXCHANGE_AccountMergeHandle *
TALER_EXCHANGE_account_merge (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ struct TALER_EXCHANGE_Keys *keys,
const char *reserve_exchange_url,
const struct TALER_ReservePrivateKeyP *reserve_priv,
const struct TALER_PurseContractPublicKeyP *purse_pub,
@@ -6244,7 +6221,7 @@ struct TALER_EXCHANGE_PurseCreateMergeResponse
union
{
/**
- * Detailed returned on #MHD_HTTP_OK.
+ * Details returned on #MHD_HTTP_OK.
*/
struct
{
@@ -6290,7 +6267,9 @@ struct TALER_EXCHANGE_PurseCreateMergeHandle;
* Inform the exchange that a purse should be created
* and merged with a reserve.
*
- * @param exchange the exchange hosting the reserve
+ * @param ctx curl context
+ * @param url exchange base URL
+ * @param keys exchange keys
* @param reserve_priv private key of the reserve
* @param purse_priv private key of the purse
* @param merge_priv private key of the merge capability
@@ -6305,7 +6284,9 @@ struct TALER_EXCHANGE_PurseCreateMergeHandle;
*/
struct TALER_EXCHANGE_PurseCreateMergeHandle *
TALER_EXCHANGE_purse_create_with_merge (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ struct TALER_EXCHANGE_Keys *keys,
const struct TALER_ReservePrivateKeyP *reserve_priv,
const struct TALER_PurseContractPrivateKeyP *purse_priv,
const struct TALER_PurseMergePrivateKeyP *merge_priv,
@@ -6397,7 +6378,9 @@ struct TALER_EXCHANGE_PurseDepositHandle;
* Inform the exchange that a deposit should be made into
* a purse.
*
- * @param exchange the exchange that issued the coins
+ * @param ctx curl context
+ * @param url exchange base URL
+ * @param keys exchange keys
* @param purse_exchange_url base URL of the exchange hosting the purse
* @param purse_pub public key of the purse to merge
* @param min_age minimum age we need to prove for the purse
@@ -6409,7 +6392,9 @@ struct TALER_EXCHANGE_PurseDepositHandle;
*/
struct TALER_EXCHANGE_PurseDepositHandle *
TALER_EXCHANGE_purse_deposit (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ struct TALER_EXCHANGE_Keys *keys,
const char *purse_exchange_url,
const struct TALER_PurseContractPublicKeyP *purse_pub,
uint8_t min_age,
@@ -6533,7 +6518,9 @@ typedef void
/**
* Submit a request to open a reserve.
*
- * @param exchange the exchange handle; the exchange must be ready to operate
+ * @param ctx curl context
+ * @param url exchange base URL
+ * @param keys exchange keys
* @param reserve_priv private key of the reserve to open
* @param reserve_contribution amount to pay from the reserve's balance for the operation
* @param coin_payments_length length of the @a coin_payments array
@@ -6547,7 +6534,9 @@ typedef void
*/
struct TALER_EXCHANGE_ReservesOpenHandle *
TALER_EXCHANGE_reserves_open (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ struct TALER_EXCHANGE_Keys *keys,
const struct TALER_ReservePrivateKeyP *reserve_priv,
const struct TALER_Amount *reserve_contribution,
unsigned int coin_payments_length,
@@ -6635,7 +6624,8 @@ typedef void
/**
* Submit a request to get the list of attestable attributes for a reserve.
*
- * @param exchange the exchange handle; the exchange must be ready to operate
+ * @param ctx CURL context
+ * @param url exchange base URL
* @param reserve_pub public key of the reserve to get available attributes for
* @param cb the callback to call when a reply for this request is available
* @param cb_cls closure for the above callback
@@ -6644,7 +6634,8 @@ typedef void
*/
struct TALER_EXCHANGE_ReservesGetAttestHandle *
TALER_EXCHANGE_reserves_get_attestable (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
const struct TALER_ReservePublicKeyP *reserve_pub,
TALER_EXCHANGE_ReservesGetAttestCallback cb,
void *cb_cls);
@@ -6738,7 +6729,8 @@ typedef void
/**
* Submit a request to attest attributes about the owner of a reserve.
*
- * @param exchange the exchange handle; the exchange must be ready to operate
+ * @param ctx CURL context
+ * @param url exchange base URL
* @param reserve_priv private key of the reserve to attest
* @param attributes_length length of the @a attributes array
* @param attributes array of names of attributes to get attestations for
@@ -6749,7 +6741,8 @@ typedef void
*/
struct TALER_EXCHANGE_ReservesAttestHandle *
TALER_EXCHANGE_reserves_attest (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
const struct TALER_ReservePrivateKeyP *reserve_priv,
unsigned int attributes_length,
const char *const*attributes,
@@ -6847,7 +6840,8 @@ typedef void
/**
* Submit a request to close a reserve.
*
- * @param exchange the exchange handle; the exchange must be ready to operate
+ * @param ctx curl context
+ * @param url exchange base URL
* @param reserve_priv private key of the reserve to close
* @param target_payto_uri where to send the payment, NULL to send to reserve origin
* @param cb the callback to call when a reply for this request is available
@@ -6857,7 +6851,8 @@ typedef void
*/
struct TALER_EXCHANGE_ReservesCloseHandle *
TALER_EXCHANGE_reserves_close (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
const struct TALER_ReservePrivateKeyP *reserve_priv,
const char *target_payto_uri,
TALER_EXCHANGE_ReservesCloseCallback cb,
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 28213d1d7..2ef7ef602 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -514,7 +514,7 @@ typedef void
* Iterates over all of the top-level commands of an
* interpreter.
*
- * @param[in] interpreter to iterate over
+ * @param[in] is interpreter to iterate over
* @param asc true in execution order, false for reverse execution order
* @param cb function to call on each command
* @param cb_cls closure for cb
@@ -2692,9 +2692,9 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
op (fresh_coins, const struct TALER_TESTING_FreshCoinData *) \
op (claim_token, const struct TALER_ClaimTokenP) \
op (relative_time, const struct GNUNET_TIME_Relative) \
- op (auditor, struct TALER_AUDITOR_Handle) \
op (exchange, struct TALER_EXCHANGE_Handle) \
op (fakebank, struct TALER_FAKEBANK_Handle) \
+ op (keys, struct TALER_EXCHANGE_Keys) \
op (process, struct GNUNET_OS_Process *)
@@ -2741,4 +2741,26 @@ struct TALER_EXCHANGE_Handle *
TALER_TESTING_get_exchange (struct TALER_TESTING_Interpreter *is);
+/**
+ * Get exchange URL from interpreter. Convenience function.
+ *
+ * @param is interpreter state.
+ * @return the exchange URL, or NULL on error
+ */
+const char *
+TALER_TESTING_get_exchange_url (
+ struct TALER_TESTING_Interpreter *is);
+
+
+/**
+ * Get exchange keys from interpreter. Convenience function.
+ *
+ * @param is interpreter state.
+ * @return the exchange keys, or NULL on error
+ */
+struct TALER_EXCHANGE_Keys *
+TALER_TESTING_get_keys (
+ struct TALER_TESTING_Interpreter *is);
+
+
#endif