aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2022-04-01 16:39:07 +0200
committerChristian Grothoff <grothoff@gnunet.org>2022-04-01 16:39:07 +0200
commitcaf66486e70d896b1dd4eca3785fd42185a540cd (patch)
treebc4323b6fc7d1e256b485daaf7c20bdfa9037cfd /src/include
parent747ae5ef094731650911838a51e49db778b18ab6 (diff)
downloadexchange-caf66486e70d896b1dd4eca3785fd42185a540cd.tar.xz
work on purse creation logic
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_crypto_lib.h27
-rw-r--r--src/include/taler_exchangedb_plugin.h23
-rw-r--r--src/include/taler_signatures.h5
3 files changed, 52 insertions, 3 deletions
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index bafcca08e..6b554dfb1 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -3811,6 +3811,33 @@ TALER_exchange_online_reserve_closed_verify (
const struct TALER_ExchangeSignatureP *sig);
+enum TALER_ErrorCode
+TALER_exchange_online_purse_created_sign (
+ TALER_ExchangeSignCallback scb,
+ struct GNUNET_TIME_Timestamp exchange_time,
+ struct GNUNET_TIME_Timestamp purse_expiration,
+ const struct TALER_Amount *amount_without_fee,
+ const struct TALER_Amount *total_deposited,
+ const struct TALER_PurseContractPublicKeyP *purse_pub,
+ const struct TALER_PurseMergePublicKeyP *merge_pub,
+ const struct TALER_PrivateContractHashP *h_contract_terms,
+ struct TALER_ExchangePublicKeyP *pub,
+ struct TALER_ExchangeSignatureP *sig);
+
+
+enum GNUNET_GenericReturnValue
+TALER_exchange_online_purse_created_verify (
+ struct GNUNET_TIME_Timestamp exchange_time,
+ struct GNUNET_TIME_Timestamp purse_expiration,
+ const struct TALER_Amount *amount_without_fee,
+ const struct TALER_Amount *total_deposited,
+ const struct TALER_PurseContractPublicKeyP *purse_pub,
+ const struct TALER_PurseMergePublicKeyP *merge_pub,
+ const struct TALER_PrivateContractHashP *h_contract_terms,
+ const struct TALER_ExchangePublicKeyP *pub,
+ const struct TALER_ExchangeSignatureP *sig);
+
+
/* ********************* offline signing ************************** */
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index 6b86dc3ce..488ffd519 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -4389,6 +4389,10 @@ struct TALER_EXCHANGEDB_Plugin
* @param pub_ckey ephemeral key for DH used to encrypt the contract
* @param econtract_size number of bytes in @a econtract
* @param econtract the encrypted contract
+ * @param[out] in_conflict set to true if @a econtract
+ * conflicts with an existing contract;
+ * in this case, the return value will be
+ * #GNUNET_DB_STATUS_SUCCESS_ONE despite the failure
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
@@ -4396,7 +4400,8 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_PurseContractPublicKeyP *purse_pub,
const struct TALER_ContractDiffiePublicP *pub_ckey,
size_t econtract_size,
- const void *econtract);
+ const void *econtract,
+ bool *in_conflict);
/**
@@ -4428,6 +4433,10 @@ struct TALER_EXCHANGEDB_Plugin
* @param age_limit age limit to enforce for payments into the purse
* @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
+ * conflicts with an existing purse;
+ * in this case, the return value will be
+ * #GNUNET_DB_STATUS_SUCCESS_ONE despite the failure
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
@@ -4439,7 +4448,8 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_PrivateContractHashP *h_contract_terms,
uint32_t age_limit,
const struct TALER_Amount *amount,
- const struct TALER_PurseContractSignatureP *purse_sig);
+ const struct TALER_PurseContractSignatureP *purse_sig,
+ bool *in_conflict);
/**
@@ -4507,6 +4517,11 @@ struct TALER_EXCHANGEDB_Plugin
* @param coin_pub coin to deposit (debit)
* @param amount fraction of the coin's value to deposit
* @param coin_sig signature affirming the operation
+ * @param amount_minus_fee amount to add to the purse
+ * @param[out] balance_ok set to false if the coin's
+ * remaining balance is below @a amount;
+ * in this case, the return value will be
+ * #GNUNET_DB_STATUS_SUCCESS_ONE despite the failure
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
@@ -4515,7 +4530,9 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_PurseContractPublicKeyP *purse_pub,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *amount,
- const struct TALER_CoinSpendSignatureP *coin_sig);
+ const struct TALER_CoinSpendSignatureP *coin_sig,
+ const struct TALER_Amount *amount_minus_fee,
+ bool *balance_ok);
/**
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index 52c294cef..70c917b67 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -176,6 +176,11 @@
*/
#define TALER_SIGNATURE_EXCHANGE_ACCOUNT_SETUP_SUCCESS 1044
+/**
+ * Signature by which the exchange affirms that a purse
+ * was created with a certain amount deposited into it.
+ */
+#define TALER_SIGNATURE_EXCHANGE_CONFIRM_PURSE_CREATION 1045
/**********************/
/* Auditor signatures */