diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-10-15 16:19:14 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-10-15 16:19:14 +0200 |
commit | 38876c503ff53f7adf44bc82be4fec3ae9b02d01 (patch) | |
tree | 2727ceb2b71a86bcabb959b232d0af49c7847aa8 /src/include | |
parent | eebc030f6cf61d36b80e3273709fd9f254b155c3 (diff) | |
download | exchange-38876c503ff53f7adf44bc82be4fec3ae9b02d01.tar.xz |
-refactor DB for reserve history/status routines
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_crypto_lib.h | 49 | ||||
-rw-r--r-- | src/include/taler_exchangedb_plugin.h | 91 |
2 files changed, 137 insertions, 3 deletions
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index a861563b2..df992c6ee 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -3835,6 +3835,51 @@ TALER_exchange_online_melt_confirmation_verify ( /** + * Create exchange purse refund confirmation signature. + * + * @param scb function to call to create the signature + * @param amount_without_fee refunded amount + * @param refund_fee refund fee charged + * @param coin_pub coin that was refunded + * @param purse_pub public key of the expired purse + * @param[out] pub where to write the public key + * @param[out] sig where to write the signature + * @return #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_exchange_online_purse_refund_sign ( + TALER_ExchangeSignCallback scb, + const struct TALER_Amount *amount_without_fee, + const struct TALER_Amount *refund_fee, + const struct TALER_CoinSpendPublicKeyP *coin_pub, + const struct TALER_PurseContractPublicKeyP *purse_pub, + struct TALER_ExchangePublicKeyP *pub, + struct TALER_ExchangeSignatureP *sig); + + +/** + * Verify signature of exchange affirming purse refund + * from purse expiration. + * + * @param amount_without_fee refunded amount + * @param refund_fee refund fee charged + * @param coin_pub coin that was refunded + * @param purse_pub public key of the expired purse + * @param pub public key to verify signature against + * @param sig signature to verify + * @return #GNUNET_OK if the signature is valid + */ +enum GNUNET_GenericReturnValue +TALER_exchange_online_purse_refund_verify ( + const struct TALER_Amount *amount_without_fee, + const struct TALER_Amount *refund_fee, + const struct TALER_CoinSpendPublicKeyP *coin_pub, + const struct TALER_PurseContractPublicKeyP *purse_pub, + const struct TALER_ExchangePublicKeyP *pub, + const struct TALER_ExchangeSignatureP *sig); + + +/** * Create exchange key set signature. * * @param scb function to call to create the signature @@ -3860,8 +3905,8 @@ TALER_exchange_online_key_set_sign ( * * @param timestamp time when the key set was issued * @param hc hash over all the keys - * @param pub where to write the public key - * @param sig where to write the signature + * @param pub public key to verify signature against + * @param sig signature to verify * @return #GNUNET_OK if the signature is valid */ enum GNUNET_GenericReturnValue diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index a12c2ac3f..7a0d5c55e 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -1271,6 +1271,75 @@ struct TALER_EXCHANGEDB_HistoryRequest /** + * Details about a (paid for) reserve open request. + */ +struct TALER_EXCHANGEDB_OpenRequest +{ + /** + * Public key of the reserve the open request was for. + */ + struct TALER_ReservePublicKeyP reserve_pub; + + /** + * Fee paid for the request from the reserve. + */ + struct TALER_Amount open_fee; + + /** + * When was the request made. + */ + struct GNUNET_TIME_Timestamp request_timestamp; + + /** + * How long was the reserve supposed to be open. + */ + struct GNUNET_TIME_Timestamp reserve_expiration; + + /** + * Signature by the reserve approving the open request. + */ + struct TALER_ReserveSignatureP reserve_sig; + + /** + * How many open purses should be included with the + * open reserve? + */ + uint32_t purse_limit; + +}; + + +/** + * Details about an (explicit) reserve close request. + */ +struct TALER_EXCHANGEDB_CloseRequest +{ + /** + * Public key of the reserve the history request was for. + */ + struct TALER_ReservePublicKeyP reserve_pub; + + /** + * When was the request made. + */ + struct GNUNET_TIME_Timestamp request_timestamp; + + /** + * Hash of the payto://-URI of the target account + * for the closure, or all zeros for the reserve + * origin account. + */ + struct TALER_PaytoHashP target_account_h_payto; + + /** + * Signature by the reserve approving the history request. + */ + struct TALER_ReserveSignatureP reserve_sig; + +}; + + +/** * @brief Types of operations on a reserve. */ enum TALER_EXCHANGEDB_ReserveOperation @@ -1306,7 +1375,17 @@ enum TALER_EXCHANGEDB_ReserveOperation /** * Event where a wallet paid for a full reserve history. */ - TALER_EXCHANGEDB_RO_HISTORY_REQUEST = 5 + TALER_EXCHANGEDB_RO_HISTORY_REQUEST = 5, + + /** + * Event where a wallet paid to open a reserve for longer. + */ + TALER_EXCHANGEDB_RO_OPEN_REQUEST = 6, + + /** + * Event where a wallet requested a reserve to be closed. + */ + TALER_EXCHANGEDB_RO_CLOSE_REQUEST = 7 }; @@ -1367,6 +1446,16 @@ struct TALER_EXCHANGEDB_ReserveHistory */ struct TALER_EXCHANGEDB_HistoryRequest *history; + /** + * Details about a (paid for) open reserve request. + */ + struct TALER_EXCHANGEDB_OpenRequest *open_request; + + /** + * Details about an (explicit) reserve close request. + */ + struct TALER_EXCHANGEDB_CloseRequest *close_request; + } details; }; |