donau

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

commit 308530a8295885bcadbe317ffc8663686c538be5
parent db30e16e83d232e343c5e1bb99bc90a8c9f8260f
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Tue, 10 Oct 2023 15:56:13 +0200

API help

Diffstat:
Msrc/include/taler_donau_service.h | 189++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 121 insertions(+), 68 deletions(-)

diff --git a/src/include/taler_donau_service.h b/src/include/taler_donau_service.h @@ -33,11 +33,23 @@ /* ********************* /keys *********************** */ +/** + * Regular online message signing key used by Donau. + */ +struct TALER_DONAU_PublicKeyP +{ + /** + * Donau uses EdDSA for online signing. + */ + struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub; + +}; + /** * @brief Donau's statement signing public key */ -struct TALER_DONAU_SigningPublicKey +struct TALER_DONAU_SigningPublicKeyAndValidity { /** * The signing public key @@ -53,9 +65,38 @@ struct TALER_DONAU_SigningPublicKey /** + * @brief Type of public signing keys for verifying blindly signed donation receipts. + */ +struct TALER_DonationUnitPublicKey +{ + + /** + * Type of the public key (RSA or CS). + */ + enum TALER_DenominationCipher cipher; + + /** + * Details, depending on @e cipher. + */ + union + { + /** + * If we use #TALER_DENOMINATION_CS in @a cipher. + */ + struct GNUNET_CRYPTO_CsPublicKey cs_public_key; + + /** + * If we use #TALER_DENOMINATION_RSA in @a cipher. + */ + struct GNUNET_CRYPTO_RsaPublicKey *rsa_public_key; + + } details; +}; + +/** * @brief Public information about a donau's donation unit signing key */ -struct TALER_DONAU_DonationUnitPublicKey +struct TALER_DONAU_DonationUnitInformation { /** * The public key @@ -83,12 +124,12 @@ struct TALER_DONAU_Keys /** * Array of the donau's online signing keys. */ - struct TALER_DONAU_SigningPublicKey *sign_keys; + struct TALER_DONAU_SigningPublicKeyAndValidity *sign_keys; /** * Array of the donau'sdonation unit keys. */ - struct TALER_DONAU_DonationUnitPublicKey *donation_unit_keys; + struct TALER_DONAU_DonationUnitInformation *donation_unit_keys; /** * Supported protocol version by the donau. @@ -118,7 +159,7 @@ struct TALER_DONAU_Keys * Specifies how an amount's fractional digits should be rendered. * More details in DD51. */ - struct CurrencySpecification currency_specification; + struct TALER_CurrencySpecification currency_specification; /** * Length of the @e sign_keys array (number of valid entries). @@ -373,6 +414,7 @@ TALER_DONAU_keys_decref (struct TALER_DONAU_Keys *keys); * * @param keys the donau's key set * @param pub claimed current online signing key for the donau + * // +year? * @return #GNUNET_OK if @a pub is (according to /keys) a current signing key */ enum GNUNET_GenericReturnValue @@ -382,44 +424,20 @@ TALER_DONAU_test_signing_key ( /** - * Obtain thedonation unit key details from the donau. + * Obtain the donation unit key details from the donau. * * @param keys the donau's key set - * @param pk public key of thedonation unit to lookup - * @return details about the givendonation unit key, NULL if the key is not + * @param pk public key of the donation unit to lookup + * @return details about the given donation unit key, NULL if the key is not * found */ -const struct TALER_DONAU_DonationUnitPublicKey * +const struct TALER_DONAU_DonationUnitInformation * TALER_DONAU_get_donation_unit_key ( const struct TALER_DONAU_Keys *keys, const struct TALER_DonationUnitPublicKey *pk); /** - * Create a copy of adonation unit public key. - * - * @param key key to copy - * @returns a copy, must be freed with #TALER_DONAU_destroy_donation_unit_key() - * @deprecated - */ -struct TALER_DONAU_DonationUnitPublicKey * -TALER_DONAU_copy_donation_unit_key ( - const struct TALER_DONAU_DonationUnitPublicKey *key); - - -/** - * Destroy adonation unit public key. - * Should only be called with keys created by #TALER_DONAU_copy_donation_unit_key(). - * - * @param key key to destroy. - * @deprecated - */ -void -TALER_DONAU_destroy_donation_unit_key ( - struct TALER_DONAU_DonationUnitPublicKey *key); - - -/** * Obtain thedonation unit key details from the donau. * * @param keys the donau's key set @@ -450,25 +468,50 @@ TALER_DONAU_get_signing_key_info ( /** - * Information needed for a donation receipt to be signed. + * @brief Type including Parameters to create blinded signature */ -struct TALER_DONAU_DonationReceipt +struct TALER_BlindedDonationEnvelope { - /** - * The hash of the coin donation unit's public key. - */ - struct TALER_DonationUnitHashP h_donation_unit_pub; + * Type of the sign blinded message + */ + enum TALER_DenominationCipher cipher; + + /** + * Details, depending on @e cipher. + */ + union + { + /** + * If we use #TALER_DENOMINATION_CS in @a cipher. + */ + struct TALER_BlindedCsPlanchet cs_blinded_donor; + + /** + * If we use #TALER_DENOMINATION_RSA in @a cipher. + */ + struct TALER_BlindedRsaPlanchet rsa_blinded_donor; + } details; +}; + + +/** + * Information needed for a donation receipt to be signed. + */ +struct TALER_DONAU_BlindedDonationReceipt +{ + /** - * The nonce of the donation receipt. + * The hash of the donation unit's public key. */ - char TALER_Nonce *nonce; + struct TALER_DonationUnitHashP h_donation_unit_pub; /** - * Donau’s unblinded signature of the donation receipt. + * Donor's blinded donation receipt to be blindly + * signed. */ - struct TALER_DonationUnitSignature donation_unit_sig; + struct TALER_BlindedDonationEnvelope bd_env; }; @@ -499,16 +542,18 @@ struct TALER_DONAU_BatchSubmitResult */ struct { + + unsigned int num_donau_sigs; + /** - * Eddsa signature provided by the donau + * Blind signature provided by the donau */ - const struct TALER_DonauSignatureP donau_sig; + const struct TALER_DonauBlindSignatureP *donau_sigs; /** * total amount over all donation receipts of a year specified by the request. */ - const struct TALER_Amount total_amount - + const struct TALER_Amount total_amount; } ok; @@ -561,27 +606,15 @@ typedef void * signatures fail to verify). In this case, the callback is not called. */ struct TALER_DONAU_BatchSubmitHandle * -TALER_DONAU_batch_ ( +TALER_DONAU_charity_issue_receipt ( struct GNUNET_CURL_Context *ctx, const char *url, struct TALER_DONAU_Keys *keys, - const struct TALER_DONAU_SubmitContractDetail *dcd, - unsigned int num_cdds, - const struct TALER_DONAU_CoinSubmitDetail cdds[static num_cdds], - TALER_DONAU_BatchSubmitResultCallback cb, - void *cb_cls, - enum TALER_ErrorCode *ec); - - -/** - * Change the chance that our confirmation will be given to the - * auditor to 100%. - * - * @param[in,out] the batch deposit permission request handle - */ -//void -//TALER_DONAU_batch__force_dc ( - //struct TALER_DONAU_BatchSubmitHandle *); + const struct TALER_DONAU_CharityPrivateKey *charity_priv, + unsigned int num_bdrs, + const struct TALER_DONAU_BlindedDonationReceipts bdr[static num_bdrs], + TALER_DONAU_XXXBatchSubmitResultCallback cb, + void *cb_cls); /** @@ -591,10 +624,28 @@ TALER_DONAU_batch_ ( * @param[in] the deposit permission request handle */ void -TALER_DONAU_batch__cancel ( +TALER_DONAU_charity_issue_receipt_cancel ( struct TALER_DONAU_BatchSubmitHandle *); +// + data types + +struct TALER_DONAU_BatchSubmitHandle * +TALER_DONAU_donor_receipts_to_statement ( + struct GNUNET_CURL_Context *ctx, + const char *url, + struct TALER_DONAU_Keys *keys, + const struct TALER_DONAU_HashDonorTaxId *donor_id, + unsigned int num_drs, + const struct TALER_DONAU_DonauSignaturesAndPublicKey drs[static num_drs], + TALER_DONAU_XXXBatchSubmitResultCallback cb, + void *cb_cls); + +// + _cancel + + + + /* ********************* POST /csr batch-issue (equivalent to withdraw of exchange) *********************** */ @@ -670,7 +721,7 @@ typedef void * In this case, the callback is not called. */ struct TALER_DONAU_CsRBatchIssueHandle * -TALER_DONAU_csr_batch-issue ( +TALER_DONAU_csr_batch_issue ( struct GNUNET_CURL_Context *curl_ctx, const char *donau_url, const struct TALER_DONAU_DonationUnitPublicKey *pk, @@ -687,10 +738,12 @@ TALER_DONAU_csr_batch-issue ( * @param csrh the batch-issue handle */ void -TALER_DONAU_csr_batch-issue_cancel ( +TALER_DONAU_csr_batch_issue_cancel ( struct TALER_DONAU_CsRBatchIssueHandle *csrh); + + /* ********************* GET /charities/$CHARITY_ID *********************** */ /**