donau

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

commit d6285f915cda8b6f98cd720e8c4f43487e9fae5d
parent e04653626ebded0bc650c4ca6d8f8fe0dc52ac36
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date:   Sun, 22 Oct 2023 14:13:09 +0200

implement post delete patch charity

Diffstat:
Dsrc/include/.taler_donau_service.h.swp | 0
Msrc/include/taler_donau_crypto_lib.h | 11++++++++++-
Msrc/include/taler_donau_service.h | 2305+++++--------------------------------------------------------------------------
Msrc/include/taler_donau_util.h | 10+++++-----
4 files changed, 139 insertions(+), 2187 deletions(-)

diff --git a/src/include/.taler_donau_service.h.swp b/src/include/.taler_donau_service.h.swp Binary files differ. diff --git a/src/include/taler_donau_crypto_lib.h b/src/include/taler_donau_crypto_lib.h @@ -86,5 +86,14 @@ struct TALER_DONAU_CharitySignatureP struct GNUNET_CRYPTO_EddsaSignature eddsa_signature; }; -//TODO:Bearer Token +/** + * Token used for access control for admin to the donau. + */ +struct TALER_DONAU_BearerToken +{ + /** + * The token is a 128-bit UUID. + */ + struct GNUNET_Uuid token; +}; #endif diff --git a/src/include/taler_donau_service.h b/src/include/taler_donau_service.h @@ -1114,2289 +1114,232 @@ TALER_DONAU_charity_get_cancel ( struct TALER_DONAU_charityGetHandle *rgh); -/* ********************* POST /charities/$CHARITY_ID *********************** */ +/* ********************* POST /charities/ *********************** */ /** - * A BDID blinded unique donation identifier. + * @brief A /charities Post Handle */ -struct TALER_DONAU_BlindedDonationIdentifier -{ - /** - * The hash of the donation unit's public key - */ - struct TALER_DonationUnitHashP h_donation_unit_pub; - - /** - * The blinded UDID unique donation identifier and the corresponding - * donation unit public key. - */ - struct TALER_DONAU_BlindedUniqueIdentifier blinded_identifier; -}; - -/** - * @brief A /charitys/$CHARITY_ID/batch-issue Handle - */ -struct TALER_DONAU_BatchIssueHandle; - - -/** - * Charity issue receipt transaction. - */ -struct TALER_DONAU_BatchIssueInput -{ - /** - * Year of validity. - */ - unsigned int year; - - /** - * Hash of the BDIDs to be signed - */ - struct TALER_DONAU_BlindedDonationIdentifier *bdids; - - /** - * Charity's eddsa signature. - */ - struct TALER_DonauSignatureP donau_sig; - - /** - * Length of BDIDs. - */ - unsigned int bdids_length; -}; - -/** - * How a successful charity issue request is stored. - */ -struct TALER_DONAU_BatchIssueStore -{ - - /** - * Year of validity. - */ - unsigned int year; - - /** - * Hash of the BDIDs to be signed - */ - struct TALER_EnvelopeHash h_blinded_bdids; - - /** - * Charity's eddsa signature. - */ - struct TALER_DonauSignatureP donau_sig; -}; - - - -/** - * Information input into the batch-issue process per coin. - */ -struct TALER_DONAU_BatchIssueCoinInput -{ - /** - *donation unit of the coin. - */ - const struct TALER_DonationUnitPublicKey *pk; - - /** - * Master key material for the coin. - */ - const struct TALER_PlanchetMasterSecretP *ps; - - /** - * Age commitment for the coin. - */ - const struct TALER_AgeCommitmentHash *ach; - -}; - - -/** - * All the details about a coin that are generated during withdrawal and that - * may be needed for future operations on the coin. - */ -struct TALER_DONAU_PrivateCoinDetails -{ - /** - * Private key of the coin. - */ - struct TALER_CoinSpendPrivateKeyP coin_priv; - - /** - * Value used to blind the key for the signature. - * Needed for recoup operations. - */ - union TALER_DonationUnitBlindingKeyP bks; - - /** - * Signature over the coin. - */ - struct TALER_DonationUnitSignature sig; - - /** - * Values contributed from the donau during the - * batch-issue protocol. - */ - struct TALER_DonauBatchIssueValues donau_vals; -}; - - -/** - * Details about a response for a batch-issue request. - */ -struct TALER_DONAU_BatchIssueResponse -{ - /** - * HTTP response data. - */ - struct TALER_DONAU_HttpResponse hr; - - /** - * Details about the response. - */ - union - { - /** - * Details if the status is #MHD_HTTP_OK. - */ - struct TALER_DONAU_PrivateCoinDetails ok; - - /** - * Details if the status is #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS. - */ - struct - { - /** - * Requirement row that the charity should use - * to check for its KYC status. - */ - uint64_t requirement_row; - - /** - * Hash of the payto-URI of the account to KYC; - */ - struct TALER_PaytoHashP h_payto; - - } unavailable_for_legal_reasons; - - /** - * Details if the status is #MHD_HTTP_CONFLICT. - */ - struct - { - /* TODO: returning full details is not implemented */ - } conflict; - - /** - * Details if the status is #MHD_HTTP_GONE. - */ - struct - { - /* TODO: returning full details is not implemented */ - } gone; - - } details; -}; - - -/** - * Callbacks of this type are used to serve the result of submitting a - * batch-issue request to a donau. - * - * @param cls closure - * @param wr response details - */ -typedef void -(*TALER_DONAU_BatchIssueCallback) ( - void *cls, - const struct TALER_DONAU_BatchIssueResponse *wr); - - -/** - * BatchIssue a coin from the donau using a /charitys/$CHARITY_PUB/issueReceipts - * request. This API is typically used by a wallet to batch-issue from a - * charity. - * - * Note that to ensure that no money is lost in case of hardware - * failures, the caller must have committed (most of) the arguments to - * disk before calling, and be ready to repeat the request with the - * same arguments in case of failures. - * - * @param curl_ctx The curl context to use - * @param donau_url The base-URL of the donau - * @param keys The /keys material from the donau - * @param charity_priv private key of the charity to batch-issue from - * @param wci inputs that determine the planchet - * @param res_cb the callback to call when the final result for this request is available - * @param res_cb_cls closure for @a res_cb - * @return NULL - * if the inputs are invalid (i.e.donation unit key not with this donau). - * In this case, the callback is not called. - */ -struct TALER_DONAU_BatchIssueHandle * -TALER_DONAU_batch-issue ( - struct GNUNET_CURL_Context *curl_ctx, - const char *donau_url, - struct TALER_DONAU_Keys *keys, - const struct TALER_charityPrivateKeyP *charity_priv, - const struct TALER_DONAU_BatchIssueCoinInput *wci, - TALER_DONAU_BatchIssueCallback res_cb, - void *res_cb_cls); - - -/** - * Cancel a batch-issue status request. This function cannot be used - * on a request handle if a response is already served for it. - * - * @param wh the batch-issue handle - */ -void -TALER_DONAU_batch-issue_cancel (struct TALER_DONAU_BatchIssueHandle *wh); - - -/** - * @brief A /charitys/$CHARITY_PUB/batch-batch-issue Handle - */ -struct TALER_DONAU_BatchBatchIssueHandle; - - -/** - * Details about a response for a batch batch-issue request. - */ -struct TALER_DONAU_BatchBatchIssueResponse -{ - /** - * HTTP response data. - */ - struct TALER_DONAU_HttpResponse hr; - - /** - * Details about the response. - */ - union - { - /** - * Details if the status is #MHD_HTTP_OK. - */ - struct - { - - /** - * Array of coins returned by the batch batch-issue operation. - */ - struct TALER_DONAU_PrivateCoinDetails *coins; - - /** - * Length of the @e coins array. - */ - unsigned int num_coins; - } ok; - - /** - * Details if the status is #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS. - */ - struct - { - - /** - * Hash of the payto-URI of the account to KYC; - */ - struct TALER_PaytoHashP h_payto; - - /** - * Legitimization requirement that the charity should use - * to check for its KYC status, 0 if not known. - */ - uint64_t requirement_row; - } unavailable_for_legal_reasons; - - /** - * Details if the status is #MHD_HTTP_CONFLICT. - */ - struct - { - /* TODO: returning full details is not implemented */ - } conflict; - - /** - * Details if the status is #MHD_HTTP_GONE. - */ - struct - { - /* TODO: returning full details is not implemented */ - } gone; - - } details; -}; - - -/** - * Callbacks of this type are used to serve the result of submitting a - * batch batch-issue request to a donau. - * - * @param cls closure - * @param wr response details - */ -typedef void -(*TALER_DONAU_BatchBatchIssueCallback) ( - void *cls, - const struct TALER_DONAU_BatchBatchIssueResponse *wr); - - -/** - * BatchIssue multiple coins from the donau using a /charitys/$CHARITY_PUB/batch-withdraw - * request. This API is typically used by a wallet to batch-issue many coins from a - * charity. - * - * Note that to ensure that no money is lost in case of hardware - * failures, the caller must have committed (most of) the arguments to - * disk before calling, and be ready to repeat the request with the - * same arguments in case of failures. - * - * @param curl_ctx The curl context to use - * @param donau_url The base-URL of the donau - * @param keys The /keys material from the donau - * @param charity_priv private key of the charity to batch-issue from - * @param wci_length number of entries in @a wcis - * @param wcis inputs that determine the planchets - * @param res_cb the callback to call when the final result for this request is available - * @param res_cb_cls closure for @a res_cb - * @return NULL - * if the inputs are invalid (i.e.donation unit key not with this donau). - * In this case, the callback is not called. - */ -struct TALER_DONAU_BatchBatchIssueHandle * -TALER_DONAU_batch_batch-issue ( - struct GNUNET_CURL_Context *curl_ctx, - const char *donau_url, - const struct TALER_DONAU_Keys *keys, - const struct TALER_charityPrivateKeyP *charity_priv, - unsigned int wci_length, - const struct TALER_DONAU_BatchIssueCoinInput wcis[static wci_length], - TALER_DONAU_BatchBatchIssueCallback res_cb, - void *res_cb_cls); - - -/** - * Cancel a batch batch-issue status request. This function cannot be used on a - * request handle if a response is already served for it. - * - * @param wh the batch batch-issue handle - */ -void -TALER_DONAU_batch_batch-issue_cancel ( - struct TALER_DONAU_BatchBatchIssueHandle *wh); - - -/** - * Response from a withdraw2 request. - */ -struct TALER_DONAU_BatchIssue2Response -{ - /** - * HTTP response data - */ - struct TALER_DONAU_HttpResponse hr; - - /** - * Response details depending on the HTTP status. - */ - union - { - /** - * Details if HTTP status is #MHD_HTTP_OK. - */ - struct - { - /** - * blind signature over the coin - */ - struct TALER_BlindedDonationUnitSignature blind_sig; - } ok; - } details; - -}; - -/** - * Callbacks of this type are used to serve the result of submitting a - * batch-issue request to a donau without the (un)blinding factor. - * - * @param cls closure - * @param w2r response data - */ -typedef void -(*TALER_DONAU_BatchIssue2Callback) ( - void *cls, - const struct TALER_DONAU_BatchIssue2Response *w2r); - - -/** - * @brief A /charitys/$CHARITY_PUB/batch-issue Handle, 2nd variant. - * This variant does not do the blinding/unblinding and only - * fetches the blind signature on the already blinded planchet. - * Used internally by the `struct TALER_DONAU_BatchIssueHandle` - * implementation as well as for the tipping logic of charities. - */ -struct TALER_DONAU_BatchIssue2Handle; - - -/** - * BatchIssue a coin from the donau using a /charitys/$CHARITY_PUB/withdraw - * request. This API is typically used by a charity to batch-issue a tip - * where the blinding factor is unknown to the charity. - * - * Note that to ensure that no money is lost in case of hardware - * failures, the caller must have committed (most of) the arguments to - * disk before calling, and be ready to repeat the request with the - * same arguments in case of failures. - * - * @param curl_ctx The curl-context to use - * @param donau_url The base-URL of the donau - * @param keys The /keys material from the donau - * @param pd planchet details of the planchet to withdraw - * @param charity_priv private key of the charity to batch-issue from - * @param res_cb the callback to call when the final result for this request is available - * @param res_cb_cls closure for @a res_cb - * @return NULL - * if the inputs are invalid (i.e.donation unit key not with this donau). - * In this case, the callback is not called. - */ -struct TALER_DONAU_BatchIssue2Handle * -TALER_DONAU_batch-issue2 ( - struct GNUNET_CURL_Context *curl_ctx, - const char *donau_url, - struct TALER_DONAU_Keys *keys, - const struct TALER_PlanchetDetail *pd, - const struct TALER_charityPrivateKeyP *charity_priv, - TALER_DONAU_BatchIssue2Callback res_cb, - void *res_cb_cls); - - -/** - * Cancel a batch-issue status request. This function cannot be used - * on a request handle if a response is already served for it. - * - * @param wh the batch-issue handle - */ -void -TALER_DONAU_batch-issue2_cancel (struct TALER_DONAU_BatchIssue2Handle *wh); - - -/** - * Response from a batch-batch-issue request (2nd variant). - */ -struct TALER_DONAU_BatchBatchIssue2Response -{ - /** - * HTTP response data - */ - struct TALER_DONAU_HttpResponse hr; - - /** - * Response details depending on the HTTP status. - */ - union - { - /** - * Details if HTTP status is #MHD_HTTP_OK. - */ - struct - { - /** - * array of blind signatures over the coins. - */ - const struct TALER_BlindedDonationUnitSignature *blind_sigs; - - /** - * length of @e blind_sigs - */ - unsigned int blind_sigs_length; - - } ok; - } details; - -}; - - -/** - * Callbacks of this type are used to serve the result of submitting a batch - * batch-issue request to a donau without the (un)blinding factor. - * - * @param cls closure - * @param bw2r response data - */ -typedef void -(*TALER_DONAU_BatchBatchIssue2Callback) ( - void *cls, - const struct TALER_DONAU_BatchBatchIssue2Response *bw2r); - - -/** - * @brief A /charitys/$CHARITY_PUB/batch-batch-issue Handle, 2nd variant. - * This variant does not do the blinding/unblinding and only - * fetches the blind signatures on the already blinded planchets. - * Used internally by the `struct TALER_DONAU_BatchBatchIssueHandle` - * implementation as well as for the tipping logic of charities. - */ -struct TALER_DONAU_BatchBatchIssue2Handle; - - -/** - * BatchIssue a coin from the donau using a /charitys/$CHARITY_PUB/batch-withdraw - * request. This API is typically used by a charity to batch-issue a tip - * where the blinding factor is unknown to the charity. - * - * Note that to ensure that no money is lost in case of hardware - * failures, the caller must have committed (most of) the arguments to - * disk before calling, and be ready to repeat the request with the - * same arguments in case of failures. - * - * @param curl_ctx The curl context to use - * @param donau_url The base-URL of the donau - * @param keys The /keys material from the donau - * @param pds array of planchet details of the planchet to withdraw - * @param pds_length number of entries in the @a pds array - * @param charity_priv private key of the charity to batch-issue from - * @param res_cb the callback to call when the final result for this request is available - * @param res_cb_cls closure for @a res_cb - * @return NULL - * if the inputs are invalid (i.e.donation unit key not with this donau). - * In this case, the callback is not called. - */ -struct TALER_DONAU_BatchBatchIssue2Handle * -TALER_DONAU_batch_batch-issue2 ( - struct GNUNET_CURL_Context *curl_ctx, - const char *donau_url, - const struct TALER_DONAU_Keys *keys, - const struct TALER_charityPrivateKeyP *charity_priv, - unsigned int pds_length, - const struct TALER_PlanchetDetail pds[static pds_length], - TALER_DONAU_BatchBatchIssue2Callback res_cb, - void *res_cb_cls); - - -/** - * Cancel a batch batch-issue request. This function cannot be used - * on a request handle if a response is already served for it. - * - * @param wh the batch-issue handle - */ -void -TALER_DONAU_batch_batch-issue2_cancel ( - struct TALER_DONAU_BatchBatchIssue2Handle *wh); - - -/* ********************* GET /batch-issue/ *********************** */ - - -/** - * @brief A /batch-issue/ GET Handle - */ -struct TALER_DONAU_SubmitGetHandle; - - -/** - * Data returned for a successful GET /batch-issue/ request. - */ -struct TALER_DONAU_GetSubmitResponse -{ - - /** - * HTTP response data. - */ - struct TALER_DONAU_HttpResponse hr; - - /** - * Details about the response. - */ - union - { - - /** - * Response if the status was #MHD_HTTP_OK - */ - struct TALER_DONAU_SubmitData - { - /** - * donau key used to sign, all zeros if donau did not - * yet execute the transaction - */ - struct TALER_DONAU_EddsaPublicKeyP donau_pub; - - /** - * signature from the donau over the data, all zeros if donau did not - * yet execute the transaction - */ - struct TALER_DonauSignatureP donau_sig; - - /** - * wire transfer identifier used by the donau, all zeros if donau did not - * yet execute the transaction - */ - struct TALER_WireTransferIdentifierRawP wtid; - - /** - * actual execution time for the wire transfer - */ - struct GNUNET_TIME_Timestamp execution_time; - - /** - * contribution to the total amount by this coin, all zeros if donau did not - * yet execute the transaction - */ - struct TALER_Amount coin_contribution; - - } ok; - - /** - * Response if the status was #MHD_HTTP_ACCEPTED - */ - struct - { - - /** - * planned execution time for the wire transfer - */ - struct GNUNET_TIME_Timestamp execution_time; - - /** - * KYC legitimization requirement that the charity should use to check - * for its KYC status. - */ - uint64_t requirement_row; - - /** - * Current AML state for the account. May explain why transfers are - * not happening. - */ - enum TALER_AmlDecisionState aml_decision; - - /** - * Set to 'true' if the KYC check is already finished and - * the donau is merely waiting for the @e execution_time. - */ - bool kyc_ok; - } accepted; - - } details; -}; - - -/** - * Function called with detailed wire transfer data. - * - * @param cls closure - * @param dr details about the response - */ -typedef void -(*TALER_DONAU_SubmitGetCallback)( - void *cls, - const struct TALER_DONAU_GetSubmitResponse *dr); - - -/** - * Obtain the wire transfer details for a given transaction. Tells the client - * which aggregate wire transfer the operation identified by @a coin_pub, - * @a charity_priv and @a h_contract_terms contributed to. - * - * @param ctx curl context - * @param url donau base URL - * @param keys donau keys - * @param charity_priv the charity's private key - * @param h_wire hash of charity's wire transfer details - * @param h_contract_terms hash of the proposal data - * @param coin_pub public key of the coin - * @param timeout timeout to use for long-polling, 0 for no long polling - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return handle to abort request - */ -struct TALER_DONAU_SubmitGetHandle * -TALER_DONAU_s_get ( - struct GNUNET_CURL_Context *ctx, - const char *url, - struct TALER_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, - TALER_DONAU_SubmitGetCallback cb, - void *cb_cls); - - -/** - * Cancel wtid request. This function cannot be used on a request - * handle if a response is already served for it. - * - * @param dwh the wire s request handle - */ -void -TALER_DONAU_s_get_cancel ( - struct TALER_DONAU_SubmitGetHandle *dwh); - - -/** - * Convenience function. Verifies a coin's transaction history as - * returned by the donau. - * - * @param dk fee structure for the coin - * @param coin_pub public key of the coin - * @param history history of the coin in json encoding - * @param[out] total how much of the coin has been spent according to @a history - * @return #GNUNET_OK if @a history is valid, #GNUNET_SYSERR if not - */ -enum GNUNET_GenericReturnValue -TALER_DONAU_verify_coin_history ( - const struct TALER_DonationUnitPublicKey *dk, - const struct TALER_CoinSpendPublicKeyP *coin_pub, - const json_t *history, - struct TALER_Amount *total); - - -/** - * Parse history given in JSON format and return it in binary - * format. - * - * @param keys donau keys - * @param history JSON array with the history - * @param charity_pub public key of the charity to inspect - * @param currency currency we expect the balance to be in - * @param[out] total_in set to value of credits to charity - * @param[out] total_out set to value of debits from charity - * @param history_length number of entries in @a history - * @param[out] rhistory array of length @a history_length, set to the - * parsed history entries - * @return #GNUNET_OK if history was valid and @a rhistory and @a balance - * were set, - * #GNUNET_SYSERR if there was a protocol violation in @a history - */ -enum GNUNET_GenericReturnValue -TALER_DONAU_parse_charity_history ( - const struct TALER_DONAU_Keys *keys, - const json_t *history, - const struct TALER_charityPublicKeyP *charity_pub, - const char *currency, - struct TALER_Amount *total_in, - struct TALER_Amount *total_out, - unsigned int history_length, - struct TALER_DONAU_charityHistoryEntry rhistory[static history_length]); - - -/** - * Free memory (potentially) allocated by #TALER_DONAU_parse_charity_history(). - * - * @param len number of entries in @a rhistory - * @param[in] rhistory result to free - */ -void -TALER_DONAU_free_charity_history ( - unsigned int len, - struct TALER_DONAU_charityHistoryEntry rhistory[static len]); - - -/* ********************* /management *********************** */ - - -/** - * @brief Future Donau's signature key - */ -struct TALER_DONAU_FutureSigningPublicKey -{ - /** - * The signing public key - */ - struct TALER_DONAU_EddsaPublicKeyP key; - - /** - * Signature by the security module affirming it owns this key. - */ - struct TALER_SecurityModuleSignatureP signkey_secmod_sig; - - /** - * Validity start time - */ - struct GNUNET_TIME_Timestamp valid_from; - - /** - * Validity expiration time (how long the donau may use it). - */ - struct GNUNET_TIME_Timestamp valid_until; - - /** - * Validity expiration time for legal disputes. - */ - struct GNUNET_TIME_Timestamp valid_legal; -}; - - -/** - * @brief Public information about a future donau's donation unit key - */ -struct TALER_DONAU_FutureDonationUnitPublicKey -{ - /** - * The public key - */ - struct TALER_DonationUnitPublicKey key; - - /** - * Signature by the security module affirming it owns this key. - */ - struct TALER_SecurityModuleSignatureP donation_unit_secmod_sig; - - /** - * Timestamp indicating when thedonation unit key becomes valid - */ - struct GNUNET_TIME_Timestamp valid_from; - - /** - * Timestamp indicating when thedonation unit key can’t be used anymore to - * batch-issue new coins. - */ - struct GNUNET_TIME_Timestamp batch-issue_valid_until; - - /** - * Timestamp indicating when coins of thisdonation unit become invalid. - */ - struct GNUNET_TIME_Timestamp expire_; - - /** - * When do signatures with thisdonation unit key become invalid? - * After this point, these signatures cannot be used in (legal) - * disputes anymore, as the Donau is then allowed to destroy its side - * of the evidence. @e expire_legal is expected to be significantly - * larger than @e expire_ (by a year or more). - */ - struct GNUNET_TIME_Timestamp expire_legal; - - /** - * The value of thisdonation unit - */ - struct TALER_Amount value; - - /** - * The applicable fee for withdrawing a coin of thisdonation unit - */ - struct TALER_Amount fee_batch-issue; - - /** - * The applicable fee to spend a coin of thisdonation unit - */ - struct TALER_Amount fee_; - - /** - * The applicable fee to melt/refresh a coin of thisdonation unit - */ - struct TALER_Amount fee_refresh; - - /** - * The applicable fee to refund a coin of thisdonation unit - */ - struct TALER_Amount fee_refund; - -}; - - -/** - * @brief Information about future keys from the donau. - */ -struct TALER_DONAU_FutureKeys -{ - - /** - * Array of the donau's online signing keys. - */ - struct TALER_DONAU_FutureSigningPublicKey *sign_keys; - - /** - * Array of the donau'sdonation unit keys. - */ - struct TALER_DONAU_FutureDonationUnitPublicKey *donation_unit_keys; - - /** - * Public key of the signkey security module. - */ - struct TALER_SecurityModulePublicKeyP signkey_secmod_public_key; - - /** - * Public key of the RSAdonation unit security module. - */ - struct TALER_SecurityModulePublicKeyP donation_unit_secmod_public_key; - - /** - * Public key of the CSdonation unit security module. - */ - struct TALER_SecurityModulePublicKeyP donation_unit_secmod_cs_public_key; - - /** - * Offline master public key used by this donau. - */ - struct TALER_MasterPublicKeyP master_pub; - - /** - * Length of the @e sign_keys array (number of valid entries). - */ - unsigned int num_sign_keys; - - /** - * Length of the @e donation_unit_keys array. - */ - unsigned int num_donation_unit_keys; - -}; - - -/** - * Response from a /management/keys request. - */ -struct TALER_DONAU_ManagementGetKeysResponse -{ - /** - * HTTP response data - */ - struct TALER_DONAU_HttpResponse hr; - - /** - * Response details depending on the HTTP status. - */ - union - { - /** - * Details if HTTP status is #MHD_HTTP_OK. - */ - struct - { - /** - * information about the various keys used - * by the donau - */ - struct TALER_DONAU_FutureKeys keys; - - } ok; - } details; - -}; - - -/** - * Function called with information about future keys. - * - * @param cls closure - * @param mgr HTTP response data - */ -typedef void -(*TALER_DONAU_ManagementGetKeysCallback) ( - void *cls, - const struct TALER_DONAU_ManagementGetKeysResponse *mgr); - - -/** - * @brief Handle for a GET /management/keys request. - */ -struct TALER_DONAU_ManagementGetKeysHandle; - - -/** - * Request future keys from the donau. The obtained information will be - * passed to the @a cb. - * - * @param ctx the context - * @param url HTTP base URL for the donau - * @param cb function to call with the donau's future keys result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error - */ -struct TALER_DONAU_ManagementGetKeysHandle * -TALER_DONAU_get_management_keys ( - struct GNUNET_CURL_Context *ctx, - const char *url, - TALER_DONAU_ManagementGetKeysCallback cb, - void *cb_cls); - - -/** - * Cancel #TALER_DONAU_get_management_keys() operation. - * - * @param gh handle of the operation to cancel - */ -void -TALER_DONAU_get_management_keys_cancel ( - struct TALER_DONAU_ManagementGetKeysHandle *gh); - - -/** - * @brief Public information about a signature on an donau's online signing key - */ -struct TALER_DONAU_SigningKeySignature -{ - /** - * The signing public key - */ - struct TALER_DONAU_EddsaPublicKeyP donau_pub; - - /** - * Signature over this signing key by the donau's master signature. - * Of purpose #TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY - */ - struct TALER_MasterSignatureP master_sig; - -}; - - -/** - * @brief Public information about a signature on an donau'sdonation unit key - */ -struct TALER_DonationUnitKeySignature -{ - /** - * The hash of thedonation unit's public key - */ - struct TALER_DonationUnitHashP h_donation_unit_pub; - - /** - * Signature over thisdonation unit key by the donau's master signature. - * Of purpose #TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY. - */ - struct TALER_MasterSignatureP master_sig; - -}; - - -/** - * Information needed for a POST /management/keys operation. - */ -struct TALER_DONAU_ManagementPostKeysData -{ - - /** - * Array of the master signatures for the donau's online signing keys. - */ - struct TALER_DONAU_SigningKeySignature *sign_sigs; - - /** - * Array of the master signatures for the donau'sdonation unit keys. - */ - struct TALER_DonationUnitKeySignature *donation_unit_sigs; - - /** - * Length of the @e sign_keys array (number of valid entries). - */ - unsigned int num_sign_sigs; - - /** - * Length of the @e donation_unit_keys array. - */ - unsigned int num_donation_unit_sigs; -}; - - -/** - * Response from a POST /management/keys request. - */ -struct TALER_DONAU_ManagementPostKeysResponse -{ - /** - * HTTP response data - */ - struct TALER_DONAU_HttpResponse hr; - -}; - - -/** - * Function called with information about the post keys operation result. - * - * @param cls closure - * @param mr response data - */ -typedef void -(*TALER_DONAU_ManagementPostKeysCallback) ( - void *cls, - const struct TALER_DONAU_ManagementPostKeysResponse *mr); - - -/** - * @brief Handle for a POST /management/keys request. - */ -struct TALER_DONAU_ManagementPostKeysHandle; - - -/** - * Provide master-key signatures to the donau. - * - * @param ctx the context - * @param url HTTP base URL for the donau - * @param pkd signature data to POST - * @param cb function to call with the donau's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error - */ -struct TALER_DONAU_ManagementPostKeysHandle * -TALER_DONAU_post_management_keys ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const struct TALER_DONAU_ManagementPostKeysData *pkd, - TALER_DONAU_ManagementPostKeysCallback cb, - void *cb_cls); - - -/** - * Cancel #TALER_DONAU_post_management_keys() operation. - * - * @param ph handle of the operation to cancel - */ -void -TALER_DONAU_post_management_keys_cancel ( - struct TALER_DONAU_ManagementPostKeysHandle *ph); - - -/** - * Information needed for a POST /management/extensions operation. - * - * It represents the interface DonauKeysResponse as defined in - * https://docs.taler.net/design-documents/006-extensions.html#donau - */ -struct TALER_DONAU_ManagementPostExtensionsData -{ - const json_t *extensions; - struct TALER_MasterSignatureP extensions_sig; -}; - - -/** - * Response from a POST /management/extensions request. - */ -struct TALER_DONAU_ManagementPostExtensionsResponse -{ - /** - * HTTP response data - */ - struct TALER_DONAU_HttpResponse hr; - -}; - - -/** - * Function called with information about the post extensions operation result. - * - * @param cls closure - * @param hr HTTP response data - */ -typedef void -(*TALER_DONAU_ManagementPostExtensionsCallback) ( - void *cls, - const struct TALER_DONAU_ManagementPostExtensionsResponse *hr); - -/** - * @brief Handle for a POST /management/extensions request. - */ -struct TALER_DONAU_ManagementPostExtensionsHandle; - - -/** - * Uploads the configurations of enabled extensions to the donau, signed - * with the master key. - * - * @param ctx the context - * @param url HTTP base URL for the donau - * @param ped signature data to POST - * @param cb function to call with the donau's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error - */ -struct TALER_DONAU_ManagementPostExtensionsHandle * -TALER_DONAU_management_post_extensions ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const struct TALER_DONAU_ManagementPostExtensionsData *ped, - TALER_DONAU_ManagementPostExtensionsCallback cb, - void *cb_cls); - - -/** - * Cancel #TALER_DONAU_management_post_extensions() operation. - * - * @param ph handle of the operation to cancel - */ -void -TALER_DONAU_management_post_extensions_cancel ( - struct TALER_DONAU_ManagementPostExtensionsHandle *ph); - - -/** - * Response from a POST /management/drain request. - */ -struct TALER_DONAU_ManagementDrainResponse -{ - /** - * HTTP response data - */ - struct TALER_DONAU_HttpResponse hr; - -}; - - -/** - * Function called with information about the drain profits result. - * - * @param cls closure - * @param hr HTTP response data - */ -typedef void -(*TALER_DONAU_ManagementDrainProfitsCallback) ( - void *cls, - const struct TALER_DONAU_ManagementDrainResponse *hr); - - -/** - * @brief Handle for a POST /management/drain request. - */ -struct TALER_DONAU_ManagementDrainProfitsHandle; - - -/** - * Uploads the drain profits request. - * - * @param ctx the context - * @param url HTTP base URL for the donau - * @param wtid wire transfer identifier to use - * @param amount total to transfer - * @param date when was the request created - * @param account_section configuration section identifying account to debit - * @param payto_uri RFC 8905 URI of the account to credit - * @param master_sig signature affirming the operation - * @param cb function to call with the donau's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error - */ -struct TALER_DONAU_ManagementDrainProfitsHandle * -TALER_DONAU_management_drain_profits ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const struct TALER_WireTransferIdentifierRawP *wtid, - const struct TALER_Amount *amount, - struct GNUNET_TIME_Timestamp date, - const char *account_section, - const char *payto_uri, - const struct TALER_MasterSignatureP *master_sig, - TALER_DONAU_ManagementDrainProfitsCallback cb, - void *cb_cls); - - -/** - * Cancel #TALER_DONAU_management_drain_profits() operation. - * - * @param dp handle of the operation to cancel - */ -void -TALER_DONAU_management_drain_profits_cancel ( - struct TALER_DONAU_ManagementDrainProfitsHandle *dp); - - -/** - * Response from a POST /management/DonationUnits/$DENOM/revoke request. - */ -struct TALER_DONAU_ManagementRevokeDonationUnitResponse -{ - /** - * HTTP response data - */ - struct TALER_DONAU_HttpResponse hr; - -}; - - -/** - * Function called with information about the post revocation operation result. - * - * @param cls closure - * @param hr HTTP response data - */ -typedef void -(*TALER_DONAU_ManagementRevokeDonationUnitKeyCallback) ( - void *cls, - const struct TALER_DONAU_ManagementRevokeDonationUnitResponse *hr); - - -/** - * @brief Handle for a POST /management/DonationUnits/$H_DENOM_PUB/revoke request. - */ -struct TALER_DONAU_ManagementRevokeDonationUnitKeyHandle; - - -/** - * Inform the donau that adonation unit key was revoked. - * - * @param ctx the context - * @param url HTTP base URL for the donau - * @param h_donation_unit_pub hash of thedonation unit public key that was revoked - * @param master_sig signature affirming the revocation - * @param cb function to call with the donau's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error - */ -struct TALER_DONAU_ManagementRevokeDonationUnitKeyHandle * -TALER_DONAU_management_revoke_donation_unit_key ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const struct TALER_DonationUnitHashP *h_donation_unit_pub, - const struct TALER_MasterSignatureP *master_sig, - TALER_DONAU_ManagementRevokeDonationUnitKeyCallback cb, - void *cb_cls); - - -/** - * Cancel #TALER_DONAU_management_revoke_donation_unit_key() operation. - * - * @param rh handle of the operation to cancel - */ -void -TALER_DONAU_management_revoke_donation_unit_key_cancel ( - struct TALER_DONAU_ManagementRevokeDonationUnitKeyHandle *rh); - - -/** - * Response from a POST /management/signkeys/$SK/revoke request. - */ -struct TALER_DONAU_ManagementRevokeSigningKeyResponse -{ - /** - * HTTP response data - */ - struct TALER_DONAU_HttpResponse hr; - -}; - -/** - * Function called with information about the post revocation operation result. - * - * @param cls closure - * @param hr HTTP response data - */ -typedef void -(*TALER_DONAU_ManagementRevokeSigningKeyCallback) ( - void *cls, - const struct TALER_DONAU_ManagementRevokeSigningKeyResponse *hr); - - -/** - * @brief Handle for a POST /management/signkeys/$H_DENOM_PUB/revoke request. - */ -struct TALER_DONAU_ManagementRevokeSigningKeyHandle; - - -/** - * Inform the donau that a signing key was revoked. - * - * @param ctx the context - * @param url HTTP base URL for the donau - * @param donau_pub the public signing key that was revoked - * @param master_sig signature affirming the revocation - * @param cb function to call with the donau's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error - */ -struct TALER_DONAU_ManagementRevokeSigningKeyHandle * -TALER_DONAU_management_revoke_signing_key ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const struct TALER_DONAU_EddsaPublicKeyP *donau_pub, - const struct TALER_MasterSignatureP *master_sig, - TALER_DONAU_ManagementRevokeSigningKeyCallback cb, - void *cb_cls); - - -/** - * Cancel #TALER_DONAU_management_revoke_signing_key() operation. - * - * @param rh handle of the operation to cancel - */ -void -TALER_DONAU_management_revoke_signing_key_cancel ( - struct TALER_DONAU_ManagementRevokeSigningKeyHandle *rh); - - -/** - * Response from a POST /management/aml-officers request. - */ -struct TALER_DONAU_ManagementUpdateAmlOfficerResponse -{ - /** - * HTTP response data - */ - struct TALER_DONAU_HttpResponse hr; - -}; - -/** - * Function called with information about the change to - * an AML officer status. - * - * @param cls closure - * @param hr HTTP response data - */ -typedef void -(*TALER_DONAU_ManagementUpdateAmlOfficerCallback) ( - void *cls, - const struct TALER_DONAU_ManagementUpdateAmlOfficerResponse *hr); - - -/** - * @brief Handle for a POST /management/aml-officers/$OFFICER_PUB request. - */ -struct TALER_DONAU_ManagementUpdateAmlOfficer; - - -/** - * Inform the donau that the status of an AML officer has changed. - * - * @param ctx the context - * @param url HTTP base URL for the donau - * @param officer_pub the public signing key of the officer - * @param officer_name name of the officer - * @param change_date when to affect the status change - * @param is_active true to enable the officer - * @param read_only true to only allow read-only access - * @param master_sig signature affirming the change - * @param cb function to call with the donau's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error - */ -struct TALER_DONAU_ManagementUpdateAmlOfficer * -TALER_DONAU_management_update_aml_officer ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const struct TALER_AmlOfficerPublicKeyP *officer_pub, - const char *officer_name, - struct GNUNET_TIME_Timestamp change_date, - bool is_active, - bool read_only, - const struct TALER_MasterSignatureP *master_sig, - TALER_DONAU_ManagementUpdateAmlOfficerCallback cb, - void *cb_cls); - - -/** - * Cancel #TALER_DONAU_management_update_aml_officer() operation. - * - * @param rh handle of the operation to cancel - */ -void -TALER_DONAU_management_update_aml_officer_cancel ( - struct TALER_DONAU_ManagementUpdateAmlOfficer *rh); - - -/** - * Summary data about an AML decision. - */ -struct TALER_DONAU_AmlDecisionSummary -{ - /** - * What is the current monthly threshold. - */ - struct TALER_Amount threshold; - - /** - * Account the decision was made for. - */ - struct TALER_PaytoHashP h_payto; - - /** - * RowID of this decision. - */ - uint64_t rowid; - - /** - * Current decision state. - */ - enum TALER_AmlDecisionState current_state; -}; - - -/** - * Information about AML decisions returned by the donau. - */ -struct TALER_DONAU_AmlDecisionsResponse -{ - /** - * HTTP response details. - */ - struct TALER_DONAU_HttpResponse hr; - - /** - * Details depending on the HTTP response code. - */ - union - { - - /** - * Information returned on success (#MHD_HTTP_OK). - */ - struct - { - - /** - * Array of AML decision summaries returned by the donau. - */ - const struct TALER_DONAU_AmlDecisionSummary *decisions; - - /** - * Length of the @e decisions array. - */ - unsigned int decisions_length; - - } ok; - - } details; -}; - - -/** - * Function called with summary information about - * AML decisions. - * - * @param cls closure - * @param adr response data - */ -typedef void -(*TALER_DONAU_LookupAmlDecisionsCallback) ( - void *cls, - const struct TALER_DONAU_AmlDecisionsResponse *adr); - - -/** - * @brief Handle for a POST /aml/$OFFICER_PUB/decisions/$STATUS request. - */ -struct TALER_DONAU_LookupAmlDecisions; - - -/** - * Inform the donau that an AML decision has been taken. - * - * @param ctx the context - * @param donau_url HTTP base URL for the donau - * @param start row number starting point (exclusive rowid) - * @param delta number of records to return, negative for descending, positive for ascending from start - * @param state type of AML decisions to return - * @param officer_priv private key of the deciding AML officer - * @param cb function to call with the donau's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error - */ -struct TALER_DONAU_LookupAmlDecisions * -TALER_DONAU_lookup_aml_decisions ( - struct GNUNET_CURL_Context *ctx, - const char *donau_url, - uint64_t start, - int delta, - enum TALER_AmlDecisionState state, - const struct TALER_AmlOfficerPrivateKeyP *officer_priv, - TALER_DONAU_LookupAmlDecisionsCallback cb, - void *cb_cls); - - -/** - * Cancel #TALER_DONAU_lookup_aml_decisions() operation. - * - * @param lh handle of the operation to cancel - */ -void -TALER_DONAU_lookup_aml_decisions_cancel ( - struct TALER_DONAU_LookupAmlDecisions *lh); - - -/** - * Detailed data about an AML decision. - */ -struct TALER_DONAU_AmlDecisionDetail -{ - /** - * When was the decision made. - */ - struct GNUNET_TIME_Timestamp decision_time; - - /** - * New threshold set by this decision. - */ - struct TALER_Amount new_threshold; - - /** - * Who made the decision? - */ - struct TALER_AmlOfficerPublicKeyP decider_pub; - - /** - * Justification given for the decision. - */ - const char *justification; - - /** - * New decision state. - */ - enum TALER_AmlDecisionState new_state; -}; - - -/** - * Detailed data collected during a KYC process for the account. - */ -struct TALER_DONAU_KycHistoryDetail -{ - /** - * Configuration section name of the KYC provider that contributed the data. - */ - const char *provider_section; - - /** - * The collected KYC data. - */ - const json_t *attributes; - - /** - * When was the data collection made. - */ - struct GNUNET_TIME_Timestamp collection_time; - -}; - - -/** - * Information about AML decision details returned by the donau. - */ -struct TALER_DONAU_AmlDecisionResponse -{ - /** - * HTTP response details. - */ - struct TALER_DONAU_HttpResponse hr; - - /** - * Details depending on the HTTP response code. - */ - union - { - - /** - * Information returned on success (#MHD_HTTP_OK). - */ - struct - { - - /** - * Array of AML decision details returned by the donau. - */ - const struct TALER_DONAU_AmlDecisionDetail *aml_history; - - /** - * Length of the @e aml_history array. - */ - unsigned int aml_history_length; - - /** - * Array of KYC data collections returned by the donau. - */ - const struct TALER_DONAU_KycHistoryDetail *kyc_attributes; - - /** - * Length of the @e kyc_attributes array. - */ - unsigned int kyc_attributes_length; - - } ok; - - } details; -}; - - -/** - * Function called with summary information about - * AML decisions. - * - * @param cls closure - * @param adr response data - */ -typedef void -(*TALER_DONAU_LookupAmlDecisionCallback) ( - void *cls, - const struct TALER_DONAU_AmlDecisionResponse *adr); - - -/** - * @brief Handle for a POST /aml/$OFFICER_PUB/decision/$H_PAYTO request. - */ -struct TALER_DONAU_LookupAmlDecision; - - -/** - * Inform the donau that an AML decision has been taken. - * - * @param ctx the context - * @param donau_url HTTP base URL for the donau - * @param h_payto which account to return the decision history for - * @param officer_priv private key of the deciding AML officer - * @param history true to return the full history, otherwise only the last decision - * @param cb function to call with the donau's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error - */ -struct TALER_DONAU_LookupAmlDecision * -TALER_DONAU_lookup_aml_decision ( - struct GNUNET_CURL_Context *ctx, - const char *donau_url, - const struct TALER_PaytoHashP *h_payto, - const struct TALER_AmlOfficerPrivateKeyP *officer_priv, - bool history, - TALER_DONAU_LookupAmlDecisionCallback cb, - void *cb_cls); - - -/** - * Cancel #TALER_DONAU_lookup_aml_decision() operation. - * - * @param rh handle of the operation to cancel - */ -void -TALER_DONAU_lookup_aml_decision_cancel ( - struct TALER_DONAU_LookupAmlDecision *rh); - - -/** - * @brief Handle for a POST /aml-decision/$OFFICER_PUB request. - */ -struct TALER_DONAU_AddAmlDecision; - - -/** - * Response when making an AML decision. - */ -struct TALER_DONAU_AddAmlDecisionResponse -{ - /** - * HTTP response data. - */ - struct TALER_DONAU_HttpResponse hr; -}; - - -/** - * Function called with information about storing an - * an AML decision. - * - * @param cls closure - * @param adr response data - */ -typedef void -(*TALER_DONAU_AddAmlDecisionCallback) ( - void *cls, - const struct TALER_DONAU_AddAmlDecisionResponse *adr); - -/** - * Inform the donau that an AML decision has been taken. - * - * @param ctx the context - * @param url HTTP base URL for the donau - * @param justification human-readable justification - * @param decision_time when was the decision made - * @param new_threshold at what monthly amount threshold - * should a revision be triggered - * @param h_payto payto URI hash of the account the - * decision is about - * @param new_state updated AML state - * @param kyc_requirements JSON array of KYC requirements being imposed, NULL for none - * @param officer_priv private key of the deciding AML officer - * @param cb function to call with the donau's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error - */ -struct TALER_DONAU_AddAmlDecision * -TALER_DONAU_add_aml_decision ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *justification, - struct GNUNET_TIME_Timestamp decision_time, - const struct TALER_Amount *new_threshold, - const struct TALER_PaytoHashP *h_payto, - enum TALER_AmlDecisionState new_state, - const json_t *kyc_requirements, - const struct TALER_AmlOfficerPrivateKeyP *officer_priv, - TALER_DONAU_AddAmlDecisionCallback cb, - void *cb_cls); +struct TALER_DONAU_CharityPostHandle; /** - * Cancel #TALER_DONAU_add_aml_decision() operation. - * - * @param rh handle of the operation to cancel - */ -void -TALER_DONAU_add_aml_decision_cancel ( - struct TALER_DONAU_AddAmlDecision *rh); - - -/** - * Response when adding a partner donau. + * @brief new charity ID Response */ -struct TALER_DONAU_ManagementAddPartnerResponse +struct TALER_DONAU_PostCharityResponse { - /** - * HTTP response data. - */ - struct TALER_DONAU_HttpResponse hr; -}; - -/** - * Function called with information about the change to - * an AML officer status. - * - * @param cls closure - * @param apr response data - */ -typedef void -(*TALER_DONAU_ManagementAddPartnerCallback) ( - void *cls, - const struct TALER_DONAU_ManagementAddPartnerResponse *apr); - - -/** - * @brief Handle for a POST /management/partners/$PARTNER_PUB request. - */ -struct TALER_DONAU_ManagementAddPartner; - - -/** - * Inform the donau that the status of a partnering - * donau was defined. - * - * @param ctx the context - * @param url HTTP base URL for the donau - * @param partner_pub the offline signing key of the partner - * @param start_date validity period start - * @param end_date validity period end - * @param wad_frequency how often will we do wad transfers to this partner - * @param wad_fee what is the wad fee to this partner - * @param partner_base_url what is the base URL of the @a partner_pub donau - * @param master_sig the signature the signature - * @param cb function to call with the donau's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error - */ -struct TALER_DONAU_ManagementAddPartner * -TALER_DONAU_management_add_partner ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const struct TALER_MasterPublicKeyP *partner_pub, - struct GNUNET_TIME_Timestamp start_date, - struct GNUNET_TIME_Timestamp end_date, - struct GNUNET_TIME_Relative wad_frequency, - const struct TALER_Amount *wad_fee, - const char *partner_base_url, - const struct TALER_MasterSignatureP *master_sig, - TALER_DONAU_ManagementAddPartnerCallback cb, - void *cb_cls); - - -/** - * Cancel #TALER_DONAU_management_add_partner() operation. - * - * @param rh handle of the operation to cancel - */ -void -TALER_DONAU_management_add_partner_cancel ( - struct TALER_DONAU_ManagementAddPartner *rh); - -/** - * Response when enabling an auditor. - */ -struct TALER_DONAU_ManagementAuditorEnableResponse -{ /** - * HTTP response data. + * High-level HTTP response details. */ struct TALER_DONAU_HttpResponse hr; -}; - -/** - * Function called with information about the auditor setup operation result. - * - * @param cls closure - * @param aer response data - */ -typedef void -(*TALER_DONAU_ManagementAuditorEnableCallback) ( - void *cls, - const struct TALER_DONAU_ManagementAuditorEnableResponse *aer); - - -/** - * @brief Handle for a POST /management/auditors request. - */ -struct TALER_DONAU_ManagementAuditorEnableHandle; - - -/** - * Inform the donau that an auditor should be enable or enabled. - * - * @param ctx the context - * @param url HTTP base URL for the donau - * @param auditor_pub the public signing key of the auditor - * @param auditor_url base URL of the auditor - * @param auditor_name human readable name for the auditor - * @param validity_start when was this decided? - * @param master_sig signature affirming the auditor addition - * @param cb function to call with the donau's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error - */ -struct TALER_DONAU_ManagementAuditorEnableHandle * -TALER_DONAU_management_enable_auditor ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const struct TALER_AuditorPublicKeyP *auditor_pub, - const char *auditor_url, - const char *auditor_name, - struct GNUNET_TIME_Timestamp validity_start, - const struct TALER_MasterSignatureP *master_sig, - TALER_DONAU_ManagementAuditorEnableCallback cb, - void *cb_cls); - - -/** - * Cancel #TALER_DONAU_management_enable_auditor() operation. - * - * @param ah handle of the operation to cancel - */ -void -TALER_DONAU_management_enable_auditor_cancel ( - struct TALER_DONAU_ManagementAuditorEnableHandle *ah); -/** - * Response when disabling an auditor. - */ -struct TALER_DONAU_ManagementAuditorDisableResponse -{ /** - * HTTP response data. + * Details depending on @e hr.http_status. */ - struct TALER_DONAU_HttpResponse hr; -}; - -/** - * Function called with information about the auditor disable operation result. - * - * @param cls closure - * @param adr HTTP response data - */ -typedef void -(*TALER_DONAU_ManagementAuditorDisableCallback) ( - void *cls, - const struct TALER_DONAU_ManagementAuditorDisableResponse *adr); - - -/** - * @brief Handle for a POST /management/auditors/$AUDITOR_PUB/disable request. - */ -struct TALER_DONAU_ManagementAuditorDisableHandle; + union + { + /** + * Information returned on success, if + * @e hr.http_status is #MHD_HTTP_OK + */ + struct + { -/** - * Inform the donau that an auditor should be disabled. - * - * @param ctx the context - * @param url HTTP base URL for the donau - * @param auditor_pub the public signing key of the auditor - * @param validity_end when was this decided? - * @param master_sig signature affirming the auditor addition - * @param cb function to call with the donau's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error - */ -struct TALER_DONAU_ManagementAuditorDisableHandle * -TALER_DONAU_management_disable_auditor ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const struct TALER_AuditorPublicKeyP *auditor_pub, - struct GNUNET_TIME_Timestamp validity_end, - const struct TALER_MasterSignatureP *master_sig, - TALER_DONAU_ManagementAuditorDisableCallback cb, - void *cb_cls); + /** + * charity id + */ + unsigned int charity_id; -/** - * Cancel #TALER_DONAU_management_disable_auditor() operation. - * - * @param ah handle of the operation to cancel - */ -void -TALER_DONAU_management_disable_auditor_cancel ( - struct TALER_DONAU_ManagementAuditorDisableHandle *ah); + } ok; + } details; -/** - * Response from an donau account/enable operation. - */ -struct TALER_DONAU_ManagementWireEnableResponse -{ - /** - * HTTP response data. - */ - struct TALER_DONAU_HttpResponse hr; }; /** - * Function called with information about the wire enable operation result. + * Callbacks of this type are used to serve the result of a + * charity post request to a donau. * * @param cls closure - * @param wer HTTP response data + * @param rs HTTP response data */ typedef void -(*TALER_DONAU_ManagementWireEnableCallback) ( +(*TALER_DONAU_PostCharityResponseCallback) ( void *cls, - const struct TALER_DONAU_ManagementWireEnableResponse *wer); - - -/** - * @brief Handle for a POST /management/wire request. - */ -struct TALER_DONAU_ManagementWireEnableHandle; + const struct TALER_DONAU_PostCharityResponse *rs); /** - * Inform the donau that a wire account should be enabled. + * Submit a request to obtain the transaction history of a charity + * from the donau. Note that while we return the full response 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 and add up to the balance). If the donau's + * reply is not well-formed, we return an HTTP status code of zero to + * @a cb. * - * @param ctx the context - * @param url HTTP base URL for the donau - * @param payto_uri RFC 8905 URI of the donau's bank account - * @param conversion_url URL of the conversion service, or NULL if none - * @param debit_restrictions JSON encoding of debit restrictions on the account; see AccountRestriction in the spec - * @param credit_restrictions JSON encoding of credit restrictions on the account; see AccountRestriction in the spec - * @param validity_start when was this decided? - * @param master_sig1 signature affirming the wire addition - * of purpose #TALER_SIGNATURE_MASTER_ADD_WIRE - * @param master_sig2 signature affirming the validity of the account for clients; - * of purpose #TALER_SIGNATURE_MASTER_WIRE_DETAILS. - * @param cb function to call with the donau's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error + * @param ctx curl context + * @param url donau base URL + * @param name name of the charity + * @param amount Max donation amout for this charitiy and year. + * @param charity_pub public key of the charity + * @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_DONAU_ManagementWireEnableHandle * -TALER_DONAU_management_enable_wire ( +struct TALER_DONAU_CharityPostHandle * +TALER_DONAU_charity_post ( struct GNUNET_CURL_Context *ctx, const char *url, - const char *payto_uri, - const char *conversion_url, - const json_t *debit_restrictions, - const json_t *credit_restrictions, - struct GNUNET_TIME_Timestamp validity_start, - const struct TALER_MasterSignatureP *master_sig1, - const struct TALER_MasterSignatureP *master_sig2, - TALER_DONAU_ManagementWireEnableCallback cb, + const char *name, + const struct TALER_Amount amount, + const struct TALER_DONAU_EddsaPublicKeyP charity_pub, + TALER_DONAU_PostCharityResponseCallback cb, void *cb_cls); +/* ********************* PATCH /charities/$CHARITY_ID *********************** */ /** - * Cancel #TALER_DONAU_management_enable_wire() operation. - * - * @param wh handle of the operation to cancel + * @brief A /charities/$CHARITY_ID Patch Handle */ -void -TALER_DONAU_management_enable_wire_cancel ( - struct TALER_DONAU_ManagementWireEnableHandle *wh); +struct TALER_DONAU_CharityPatchHandle; /** - * Response from an donau account/disable operation. + * @brief charity patch response */ -struct TALER_DONAU_ManagementWireDisableResponse +struct TALER_DONAU_PatchCharityResponse { + /** - * HTTP response data. + * High-level HTTP response details. */ struct TALER_DONAU_HttpResponse hr; + }; + /** - * Function called with information about the wire disable operation result. + * Callbacks of this type are used to serve the result of a + * charity post request to a donau. * * @param cls closure - * @param wdr response data + * @param rs HTTP response data */ typedef void -(*TALER_DONAU_ManagementWireDisableCallback) ( +(*TALER_DONAU_PatchCharityResponseCallback) ( void *cls, - const struct TALER_DONAU_ManagementWireDisableResponse *wdr); - - -/** - * @brief Handle for a POST /management/wire/disable request. - */ -struct TALER_DONAU_ManagementWireDisableHandle; + const struct TALER_DONAU_PatchCharityResponse *rs); /** - * Inform the donau that a wire account should be disabled. + * Submit a request to obtain the transaction history of a charity + * from the donau. Note that while we return the full response 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 and add up to the balance). If the donau's + * reply is not well-formed, we return an HTTP status code of zero to + * @a cb. * - * @param ctx the context - * @param url HTTP base URL for the donau - * @param payto_uri RFC 8905 URI of the donau's bank account - * @param validity_end when was this decided? - * @param master_sig signature affirming the wire addition - * of purpose #TALER_SIGNATURE_MASTER_DEL_WIRE - * @param cb function to call with the donau's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error + * @param ctx curl context + * @param url donau base URL + * @param name name of the charity + * @param amount Max donation amout for this charitiy and year. + * @param charity_pub public key of the charity + * @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_DONAU_ManagementWireDisableHandle * -TALER_DONAU_management_disable_wire ( +struct TALER_DONAU_CharityPatchHandle * +TALER_DONAU_charity_patch ( struct GNUNET_CURL_Context *ctx, const char *url, - const char *payto_uri, - struct GNUNET_TIME_Timestamp validity_end, - const struct TALER_MasterSignatureP *master_sig, - TALER_DONAU_ManagementWireDisableCallback cb, + const char *name, + const struct TALER_Amount amount, + const struct TALER_DONAU_EddsaPublicKeyP charity_pub, + TALER_DONAU_PatchCharityResponseCallback cb, void *cb_cls); +/* ********************* DELETE /charities/$CHARITY_ID *********************** */ + /** - * Cancel #TALER_DONAU_management_disable_wire() operation. - * - * @param wh handle of the operation to cancel + * @brief A /charities/$CHARITY_ID Delete Handle */ -void -TALER_DONAU_management_disable_wire_cancel ( - struct TALER_DONAU_ManagementWireDisableHandle *wh); +struct TALER_DONAU_CharityDeleteHandle; /** - * Response when setting wire fees. + * @brief new charity ID Response */ -struct TALER_DONAU_ManagementSetWireFeeResponse +struct TALER_DONAU_DeleteCharityResponse { + /** - * HTTP response data. + * High-level HTTP response details. */ struct TALER_DONAU_HttpResponse hr; + }; + /** - * Function called with information about the wire enable operation result. + * Callbacks of this type are used to serve the result of a + * charity post request to a donau. * * @param cls closure - * @param wfr response data + * @param rs HTTP response data */ typedef void -(*TALER_DONAU_ManagementSetWireFeeCallback) ( +(*TALER_DONAU_DeleteCharityResponseCallback) ( void *cls, - const struct TALER_DONAU_ManagementSetWireFeeResponse *wfr); - - -/** - * @brief Handle for a POST /management/wire-fees request. - */ -struct TALER_DONAU_ManagementSetWireFeeHandle; + const struct TALER_DONAU_DeleteCharityResponse *rs); /** - * Inform the donau about future wire fees. + * Submit a request to obtain the transaction history of a charity + * from the donau. Note that while we return the full response 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 and add up to the balance). If the donau's + * reply is not well-formed, we return an HTTP status code of zero to + * @a cb. * - * @param ctx the context - * @param donau_base_url HTTP base URL for the donau - * @param wire_method for which wire method are fees provided - * @param validity_start start date for the provided wire fees - * @param validity_end end date for the provided wire fees - * @param fees the wire fees for this time period - * @param master_sig signature affirming the wire fees; - * of purpose #TALER_SIGNATURE_MASTER_WIRE_FEES - * @param cb function to call with the donau's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error + * @param ctx curl context + * @param url donau base URL + * @param name name of the charity + * @param amount Max donation amout for this charitiy and year. + * @param charity_pub public key of the charity + * @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_DONAU_ManagementSetWireFeeHandle * -TALER_DONAU_management_set_wire_fees ( +struct TALER_DONAU_CharityPostHandle * +TALER_DONAU_charity_delete ( struct GNUNET_CURL_Context *ctx, - const char *donau_base_url, - const char *wire_method, - struct GNUNET_TIME_Timestamp validity_start, - struct GNUNET_TIME_Timestamp validity_end, - const struct TALER_WireFeeSet *fees, - const struct TALER_MasterSignatureP *master_sig, - TALER_DONAU_ManagementSetWireFeeCallback cb, + const char *url, + TALER_DONAU_DeleteCharityResponseCallback cb, void *cb_cls); - /** - * Cancel #TALER_DONAU_management_enable_wire() operation. + * Cancel a charity POST request. This function cannot be used + * on a request handle if a response is already served for it. * - * @param swfh handle of the operation to cancel + * @param rgh the charity request handle */ void -TALER_DONAU_management_set_wire_fees_cancel ( - struct TALER_DONAU_ManagementSetWireFeeHandle *swfh); - - -/** - * Response when setting global fees. - */ -struct TALER_DONAU_ManagementSetGlobalFeeResponse -{ - /** - * HTTP response data. - */ - struct TALER_DONAU_HttpResponse hr; -}; - - -/** - * Function called with information about the global fee setting operation result. - * - * @param cls closure - * @param gfr HTTP response data - */ -typedef void -(*TALER_DONAU_ManagementSetGlobalFeeCallback) ( - void *cls, - const struct TALER_DONAU_ManagementSetGlobalFeeResponse *gfr); +TALER_DONAU_charity_post_delete ( + struct TALER_DONAU_CharityDeleteHandle *rgh); -/** - * @brief Handle for a POST /management/global-fees request. - */ -struct TALER_DONAU_ManagementSetGlobalFeeHandle; -/** - * Inform the donau about global fees. - * - * @param ctx the context - * @param donau_base_url HTTP base URL for the donau - * @param validity_start start date for the provided wire fees - * @param validity_end end date for the provided wire fees - * @param fees the wire fees for this time period - * @param purse_timeout when do purses time out - * @param history_expiration how long are account histories pcharityd - * @param purse_account_limit how many purses are free per account - * @param master_sig signature affirming the wire fees; - * of purpose #TALER_SIGNATURE_MASTER_GLOBAL_FEES - * @param cb function to call with the donau's result - * @param cb_cls closure for @a cb - * @return the request handle; NULL upon error - */ -struct TALER_DONAU_ManagementSetGlobalFeeHandle * -TALER_DONAU_management_set_global_fees ( - struct GNUNET_CURL_Context *ctx, - const char *donau_base_url, - struct GNUNET_TIME_Timestamp validity_start, - struct GNUNET_TIME_Timestamp validity_end, - const struct TALER_GlobalFeeSet *fees, - struct GNUNET_TIME_Relative purse_timeout, - struct GNUNET_TIME_Relative history_expiration, - uint32_t purse_account_limit, - const struct TALER_MasterSignatureP *master_sig, - TALER_DONAU_ManagementSetGlobalFeeCallback cb, - void *cb_cls); /** diff --git a/src/include/taler_donau_util.h b/src/include/taler_donau_util.h @@ -18,11 +18,11 @@ * @brief Interface for common utility functions * @author Sree Harsha Totakura <sreeharsha@totakura.in> */ -#ifndef TALER_UTIL_H -#define TALER_UTIL_H +#ifndef TALER_DONAU_UTIL_H +#define TALER_DONAU_UTIL_H #include <gnunet/gnunet_common.h> -#define __TALER_UTIL_LIB_H_INSIDE__ +#define __TALER_DONAU_UTIL_LIB_H_INSIDE__ #include <gnunet/gnunet_util_lib.h> #include <microhttpd.h> @@ -778,6 +778,6 @@ void TALER_JSON_external_conversion_stop ( struct TALER_JSON_ExternalConversion *ec); -#undef __TALER_UTIL_LIB_H_INSIDE__ +#undef __TALER_DONAU_UTIL_LIB_H_INSIDE__ -#endifTALER_CURRENCY_LEN +#endif