diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-05-08 11:37:37 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-05-08 11:37:37 +0200 |
commit | d3a63881999aa1c6d763263346a0a5979ec6efac (patch) | |
tree | 92f220ad08ce79d1f18366346ffabfa93cf33d75 /src/include | |
parent | 6b8e732bf8d8bfae268e7f5a9a09af9167fd0d47 (diff) | |
download | exchange-d3a63881999aa1c6d763263346a0a5979ec6efac.tar.xz |
pass purse_fee to determine how purse creation is paid for
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_crypto_lib.h | 52 | ||||
-rw-r--r-- | src/include/taler_exchange_service.h | 2 | ||||
-rw-r--r-- | src/include/taler_exchangedb_plugin.h | 4 |
3 files changed, 54 insertions, 4 deletions
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index e55725604..3c413aaf6 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -2862,8 +2862,7 @@ TALER_wallet_purse_deposit_verify ( /** * Sign a request by a purse to merge it into an account. * - * @param reserve_url identifies the location of the reserve, - * included public key must match @e reserve_priv + * @param reserve_url identifies the location of the reserve * @param merge_timestamp time when the merge happened * @param purse_pub key identifying the purse * @param merge_priv key identifying the merge capability @@ -2881,8 +2880,7 @@ TALER_wallet_purse_merge_sign ( /** * Verify a purse merge request. * - * @param reserve_url identifies the location of the reserve, - * included public key must match @e reserve_priv + * @param reserve_url identifies the location of the reserve * @param merge_timestamp time when the merge happened * @param purse_pub public key of the purse to merge * @param merge_pub public key of the merge capability @@ -2899,6 +2897,42 @@ TALER_wallet_purse_merge_verify ( /** + * Flags for a merge signature. + */ +enum TALER_WalletAccountMergeFlags +{ + + /** + * A mode must be set. None is not a legal mode! + */ + TALER_WAMF_MODE_NONE = 0, + + /** + * We are merging a fully paid-up purse into a reserve. + */ + TALER_WAMF_MODE_MERGE_FULLY_PAID_PURSE = 1, + + /** + * We are creating a fresh purse, from the contingent + * of free purses that our account brings. + */ + TALER_WAMF_MODE_CREATE_FROM_PURSE_QUOTA = 2, + + /** + * The account owner is willing to pay the purse_fee for the purse to be + * created from the account balance. + */ + TALER_WAMF_MODE_CREATE_WITH_PURSE_FEE = 3, + + /** + * Bitmask to AND the full flags with to get the mode. + */ + TALER_WAMF_MERGE_MODE_MASK = 3 + +}; + + +/** * Sign a request by an account to merge a purse. * * @param merge_timestamp time when the merge happened @@ -2906,7 +2940,10 @@ TALER_wallet_purse_merge_verify ( * @param purse_expiration when should the purse expire * @param h_contract_terms contract the two parties agree on * @param amount total amount in the purse (including fees) + * @param purse_fee purse fee the reserve will pay, + * only used if @a flags is #TALER_WAMF_MODE_CREATE_WITH_PURSE_FEE * @param min_age age restriction to apply for deposits into the purse + * @param flags flags for the operation * @param reserve_priv key identifying the reserve * @param[out] reserve_sig resulting signature */ @@ -2917,7 +2954,9 @@ TALER_wallet_account_merge_sign ( struct GNUNET_TIME_Timestamp purse_expiration, const struct TALER_PrivateContractHashP *h_contract_terms, const struct TALER_Amount *amount, + const struct TALER_Amount *purse_fee, uint32_t min_age, + enum TALER_WalletAccountMergeFlags flags, const struct TALER_ReservePrivateKeyP *reserve_priv, struct TALER_ReserveSignatureP *reserve_sig); @@ -2930,7 +2969,10 @@ TALER_wallet_account_merge_sign ( * @param purse_expiration when should the purse expire * @param h_contract_terms contract the two parties agree on * @param amount total amount in the purse (including fees) + * @param purse_fee purse fee the reserve will pay, + * only used if @a flags is #TALER_WAMF_MODE_CREATE_WITH_PURSE_FEE * @param min_age age restriction to apply for deposits into the purse + * @param flags flags for the operation * @param reserve_pub account’s public key * @param reserve_sig the signature made with purpose #TALER_SIGNATURE_WALLET_ACCOUNT_MERGE * @return #GNUNET_OK if the signature is valid @@ -2942,7 +2984,9 @@ TALER_wallet_account_merge_verify ( struct GNUNET_TIME_Timestamp purse_expiration, const struct TALER_PrivateContractHashP *h_contract_terms, const struct TALER_Amount *amount, + const struct TALER_Amount *purse_fee, uint32_t min_age, + enum TALER_WalletAccountMergeFlags flags, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReserveSignatureP *reserve_sig); diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index 756e9cd99..cb4d83520 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -4441,6 +4441,7 @@ struct TALER_EXCHANGE_PurseCreateMergeHandle; * @param contract_priv private key to get the contract * @param contract_terms contract the purse is about * @param upload_contract true to upload the contract + * @param pay_for_purse true to pay for purse creation * @paran merge_timestamp when should the merge happen (use current time) * @param cb function to call with the exchange's result * @param cb_cls closure for @a cb @@ -4455,6 +4456,7 @@ TALER_EXCHANGE_purse_create_with_merge ( const struct TALER_ContractDiffiePrivateP *contract_priv, const json_t *contract_terms, bool upload_contract, + bool pay_for_purse, struct GNUNET_TIME_Timestamp merge_timestamp, TALER_EXCHANGE_PurseCreateMergeCallback cb, void *cb_cls); diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index 9cdbb9448..7fafdb26e 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -4578,6 +4578,8 @@ struct TALER_EXCHANGEDB_Plugin * @param purse_expiration time when the purse will expire * @param h_contract_terms hash of the contract for the purse * @param age_limit age limit to enforce for payments into the purse + * @param flags flags for the operation + * @param purse_fee fee we are allowed to charge to the reserve (depending on @a flags) * @param amount target amount (with fees) to be put into the purse * @param purse_sig signature with @a purse_pub's private key affirming the above * @param[out] in_conflict set to true if the meta data @@ -4594,6 +4596,8 @@ struct TALER_EXCHANGEDB_Plugin struct GNUNET_TIME_Timestamp purse_expiration, const struct TALER_PrivateContractHashP *h_contract_terms, uint32_t age_limit, + enum TALER_WalletAccountMergeFlags flags, + const struct TALER_Amount *purse_fee, const struct TALER_Amount *amount, const struct TALER_PurseContractSignatureP *purse_sig, bool *in_conflict); |