summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-11-01 15:15:35 +0100
committerChristian Grothoff <christian@grothoff.org>2022-11-01 15:15:35 +0100
commit22357678a088836aca5cd2c7e78c2c6702b6092c (patch)
tree93173e6b4ef16e48c9113ea9bfc0ca88aa71bda4 /src/include
parent67d393549d9a8c10dfc54b87024e377effae2dfd (diff)
downloadexchange-22357678a088836aca5cd2c7e78c2c6702b6092c.tar.gz
exchange-22357678a088836aca5cd2c7e78c2c6702b6092c.tar.bz2
exchange-22357678a088836aca5cd2c7e78c2c6702b6092c.zip
purse auditor helper theoretically complete (but DB logic still missing)
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_auditordb_plugin.h55
-rw-r--r--src/include/taler_crypto_lib.h4
-rw-r--r--src/include/taler_exchangedb_plugin.h89
3 files changed, 141 insertions, 7 deletions
diff --git a/src/include/taler_auditordb_plugin.h b/src/include/taler_auditordb_plugin.h
index 129b51714..709a956cb 100644
--- a/src/include/taler_auditordb_plugin.h
+++ b/src/include/taler_auditordb_plugin.h
@@ -605,6 +605,23 @@ typedef enum GNUNET_GenericReturnValue
/**
+ * Function called on expired purses.
+ *
+ * @param cls closure
+ * @param purse_pub public key of the purse
+ * @param balance amount of money in the purse
+ * @param expiration_date when did the purse expire?
+ * @return #GNUNET_OK to continue to iterate
+ */
+typedef enum GNUNET_GenericReturnValue
+(*TALER_AUDITORDB_ExpiredPurseCallback)(
+ void *cls,
+ const struct TALER_PurseContractPublicKeyP *purse_pub,
+ const struct TALER_Amount *balance,
+ struct GNUNET_TIME_Timestamp expiration_date);
+
+
+/**
* @brief The plugin API, returned from the plugin's "init" function.
* The argument given to "init" is simply a configuration handle.
*
@@ -1220,7 +1237,7 @@ struct TALER_AUDITORDB_Plugin
* @param purse_pub public key of the purse
* @param master_pub master public key of the exchange
* @param balance balance of the purse
- * @param expiration_date expiration date of the reserve
+ * @param expiration_date expiration date of the purse
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
@@ -1245,7 +1262,7 @@ struct TALER_AUDITORDB_Plugin
enum GNUNET_DB_QueryStatus
(*update_purse_info)(
void *cls,
- const struct TALER_ReservePublicKeyP *reserve_pub,
+ const struct TALER_PurseContractPublicKeyP *purse_pub,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_Amount *balance);
@@ -1254,7 +1271,7 @@ struct TALER_AUDITORDB_Plugin
* Get information about a purse.
*
* @param cls the @e cls of this struct with the plugin-specific state
- * @param reserve_pub public key of the reserve
+ * @param purse_pub public key of the purse
* @param master_pub master public key of the exchange
* @param[out] rowid which row did we get the information from
* @param[out] balance set to balance of the purse
@@ -1275,6 +1292,38 @@ struct TALER_AUDITORDB_Plugin
* Delete information about a purse.
*
* @param cls the @e cls of this struct with the plugin-specific state
+ * @param purse_pub public key of the reserve
+ * @param master_pub master public key of the exchange
+ * @return transaction status code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*delete_purse_info)(
+ void *cls,
+ const struct TALER_PurseContractPublicKeyP *purse_pub,
+ const struct TALER_MasterPublicKeyP *master_pub);
+
+
+ /**
+ * Get information about expired purses.
+ *
+ * @param cls the @e cls of this struct with the plugin-specific state
+ * @param master_pub master public key of the exchange
+ * @param cb function to call on expired purses
+ * @param cb_cls closure for @a cb
+ * @return transaction status code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*select_purse_expired)(
+ void *cls,
+ const struct TALER_MasterPublicKeyP *master_pub,
+ TALER_AUDITORDB_ExpiredPurseCallback cb,
+ void *cb_cls);
+
+
+ /**
+ * Delete information about a purse.
+ *
+ * @param cls the @e cls of this struct with the plugin-specific state
* @param purse_pub public key of the purse
* @param master_pub master public key of the exchange
* @return transaction status code
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index df992c6ee..2e85f6d91 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -2771,7 +2771,7 @@ TALER_CRYPTO_helper_esign_disconnect (
void
TALER_wallet_purse_create_sign (
struct GNUNET_TIME_Timestamp purse_expiration,
- struct TALER_PrivateContractHashP *h_contract_terms,
+ const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_PurseMergePublicKeyP *merge_pub,
uint32_t min_age,
const struct TALER_Amount *amount,
@@ -2794,7 +2794,7 @@ TALER_wallet_purse_create_sign (
enum GNUNET_GenericReturnValue
TALER_wallet_purse_create_verify (
struct GNUNET_TIME_Timestamp purse_expiration,
- struct TALER_PrivateContractHashP *h_contract_terms,
+ const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_PurseMergePublicKeyP *merge_pub,
uint32_t min_age,
const struct TALER_Amount *amount,
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index 4965a27b1..de4babfd0 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -2356,7 +2356,7 @@ typedef enum GNUNET_GenericReturnValue
* @param cls closure
* @param rowid unique serial ID for the deposit in our DB
* @param purse_pub public key of the purse
- * @param reserve_pub public key of the target reserve, NULL if not known
+ * @param reserve_pub public key of the target reserve, NULL if not known / refunded
* @param purse_value what is the (target) value of the purse
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/
@@ -2370,6 +2370,24 @@ typedef enum GNUNET_GenericReturnValue
/**
+ * Function called with details about purse decisions that have been made, with
+ * the goal of auditing the purse's execution.
+ *
+ * @param cls closure
+ * @param rowid unique serial ID for the deposit in our DB
+ * @param purse_pub public key of the purse
+ * @param refunded true if decision was to refund
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
+ */
+typedef enum GNUNET_GenericReturnValue
+(*TALER_EXCHANGEDB_AllPurseDecisionCallback)(
+ void *cls,
+ uint64_t rowid,
+ const struct TALER_PurseContractPublicKeyP *purse_pub,
+ bool refunded);
+
+
+/**
* Function called with details about purse refunds that have been made, with
* the goal of auditing the purse refund's execution.
*
@@ -2994,6 +3012,34 @@ typedef void
/**
+ * Function called on purse requests.
+ *
+ * @param cls closure
+ * @param purse_pub public key of the purse
+ * @param merge_pub public key representing the merge capability
+ * @param purse_creation when was the purse created?
+ * @param purse_expiration when would an unmerged purse expire
+ * @param h_contract_terms contract associated with the purse
+ * @param age_limit the age limit for deposits into the purse
+ * @param target_amount amount to be put into the purse
+ * @param purse_sig signature of the purse over the initialization data
+ * @return #GNUNET_OK to continue to iterate
+ */
+typedef enum GNUNET_GenericReturnValue
+(*TALER_EXCHANGEDB_PurseRequestCallback)(
+ void *cls,
+ uint64_t rowid,
+ const struct TALER_PurseContractPublicKeyP *purse_pub,
+ const struct TALER_PurseMergePublicKeyP *merge_pub,
+ struct GNUNET_TIME_Timestamp purse_creation,
+ struct GNUNET_TIME_Timestamp purse_expiration,
+ const struct TALER_PrivateContractHashP *h_contract_terms,
+ uint32_t age_limit,
+ const struct TALER_Amount *target_amount,
+ const struct TALER_PurseContractSignatureP *purse_sig);
+
+
+/**
* Function called with information about the exchange's denomination keys.
* Note that the 'master' field in @a issue will not yet be initialized when
* this function is called!
@@ -4594,6 +4640,25 @@ struct TALER_EXCHANGEDB_Plugin
TALER_EXCHANGEDB_DepositCallback cb,
void *cb_cls);
+
+ /**
+ * Function called to return meta data about a purses
+ * above a certain serial ID.
+ *
+ * @param cls the @e cls of this struct with the plugin-specific state
+ * @param serial_id number to select requests by
+ * @param cb function to call on each request
+ * @param cb_cls closure for @a cb
+ * @return transaction status code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*select_purse_requests_above_serial_id)(
+ void *cls,
+ uint64_t serial_id,
+ TALER_EXCHANGEDB_PurseRequestCallback cb,
+ void *cb_cls);
+
+
/**
* Select purse deposits above @a serial_id in monotonically increasing
* order.
@@ -4687,6 +4752,24 @@ struct TALER_EXCHANGEDB_Plugin
/**
+ * Select all purse refunds above @a serial_id in monotonically increasing
+ * order.
+ *
+ * @param cls closure
+ * @param serial_id highest serial ID to exclude (select strictly larger)
+ * @param cb function to call on each result
+ * @param cb_cls closure for @a cb
+ * @return transaction status code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*select_all_purse_decisions_above_serial_id)(
+ void *cls,
+ uint64_t serial_id,
+ TALER_EXCHANGEDB_AllPurseDecisionCallback cb,
+ void *cb_cls);
+
+
+ /**
* Select coins deposited into a purse.
*
* @param cls closure
@@ -5647,6 +5730,7 @@ struct TALER_EXCHANGEDB_Plugin
*
* @param cls the @e cls of this struct with the plugin-specific state
* @param purse_pub public key of the new purse
+ * @param[out] purse_creation set to time when the purse was created
* @param[out] purse_expiration set to time when the purse will expire
* @param[out] amount set to target amount (with fees) to be put into the purse
* @param[out] deposited set to actual amount put into the purse so far
@@ -5658,6 +5742,7 @@ struct TALER_EXCHANGEDB_Plugin
(*select_purse)(
void *cls,
const struct TALER_PurseContractPublicKeyP *purse_pub,
+ struct GNUNET_TIME_Timestamp *purse_creation,
struct GNUNET_TIME_Timestamp *purse_expiration,
struct TALER_Amount *amount,
struct TALER_Amount *deposited,
@@ -5681,7 +5766,7 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
- (*select_purse_request)(
+ (*get_purse_request)(
void *cls,
const struct TALER_PurseContractPublicKeyP *purse_pub,
struct TALER_PurseMergePublicKeyP *merge_pub,