summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_keys.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchange/taler-exchange-httpd_keys.h')
-rw-r--r--src/exchange/taler-exchange-httpd_keys.h160
1 files changed, 105 insertions, 55 deletions
diff --git a/src/exchange/taler-exchange-httpd_keys.h b/src/exchange/taler-exchange-httpd_keys.h
index 6d0cb5b5a..e526385ff 100644
--- a/src/exchange/taler-exchange-httpd_keys.h
+++ b/src/exchange/taler-exchange-httpd_keys.h
@@ -113,11 +113,6 @@ struct TEH_GlobalFee
struct GNUNET_TIME_Relative purse_timeout;
/**
- * How long do we keep accounts without KYC?
- */
- struct GNUNET_TIME_Relative kyc_timeout;
-
- /**
* What is the longest history we return?
*/
struct GNUNET_TIME_Relative history_expiration;
@@ -159,6 +154,48 @@ struct TEH_KeyStateHandle;
void
TEH_check_invariants (void);
+/**
+ * Clean up wire subsystem.
+ */
+void
+TEH_wire_done (void);
+
+
+/**
+ * Look up wire fee structure by @a ts.
+ *
+ * @param ts timestamp to lookup wire fees at
+ * @param method wire method to lookup fees for
+ * @return the wire fee details, or
+ * NULL if none are configured for @a ts and @a method
+ */
+const struct TALER_WireFeeSet *
+TEH_wire_fees_by_time (
+ struct GNUNET_TIME_Timestamp ts,
+ const char *method);
+
+
+/**
+ * Initialize wire subsystem.
+ *
+ * @return #GNUNET_OK on success
+ */
+enum GNUNET_GenericReturnValue
+TEH_wire_init (void);
+
+
+/**
+ * Something changed in the database. Rebuild the wire replies. This function
+ * should be called if the exchange learns about a new signature from our
+ * master key.
+ *
+ * (We do not do so immediately, but merely signal to all threads that they
+ * need to rebuild their wire state upon the next call to
+ * #TEH_keys_get_state()).
+ */
+void
+TEH_wire_update_state (void);
+
/**
* Return the current key state for this thread. Possibly re-builds the key
@@ -173,18 +210,12 @@ TEH_check_invariants (void);
struct TEH_KeyStateHandle *
TEH_keys_get_state (void);
-
/**
- * Obtain the key state. Should ONLY be used
- * directly if @a management_only is true. Otherwise use #TEH_keys_get_state().
- *
- * @param management_only if we should NOT run finish_keys_response()
- * because we only need the state for the /management/keys API
- * @return NULL on error
+ * Obtain the key state if we should NOT run finish_keys_response() because we
+ * only need the state for the /management/keys API
*/
struct TEH_KeyStateHandle *
-TEH_keys_get_state2 (bool management_only);
-
+TEH_keys_get_state_for_management_only (void);
/**
* Something changed in the database. Rebuild all key states. This function
@@ -245,75 +276,94 @@ TEH_keys_denomination_by_hash (
* or NULL if @a h_denom_pub could not be found
*/
struct TEH_DenominationKey *
-TEH_keys_denomination_by_hash2 (
- struct TEH_KeyStateHandle *ksh,
+TEH_keys_denomination_by_hash_from_state (
+ const struct TEH_KeyStateHandle *ksh,
const struct TALER_DenominationHashP *h_denom_pub,
struct MHD_Connection *conn,
MHD_RESULT *mret);
+/**
+ * Information needed to create a blind signature.
+ */
+struct TEH_CoinSignData
+{
+ /**
+ * Hash of key to sign with.
+ */
+ const struct TALER_DenominationHashP *h_denom_pub;
+
+ /**
+ * Blinded planchet to sign over.
+ */
+ const struct TALER_BlindedPlanchet *bp;
+};
+
/**
- * Request to sign @a msg using the public key corresponding to
- * @a h_denom_pub during a withdraw operation.
+ * Request to sign @a csds.
*
- * @param h_denom_pub hash of the public key to use to sign
- * @param bp blinded planchet to sign
- * @param[out] bs set to the blind signature on success
+ * @param csds array with data to blindly sign (and keys to sign with)
+ * @param csds_length length of @a csds array
+ * @param for_melt true if this is for a melt operation
+ * @param[out] bss array set to the blind signature on success; must be of length @a csds_length
* @return #TALER_EC_NONE on success
*/
enum TALER_ErrorCode
-TEH_keys_denomination_sign_withdraw (
- const struct TALER_DenominationHashP *h_denom_pub,
- const struct TALER_BlindedPlanchet *bp,
- struct TALER_BlindedDenominationSignature *bs);
+TEH_keys_denomination_batch_sign (
+ unsigned int csds_length,
+ const struct TEH_CoinSignData csds[static csds_length],
+ bool for_melt,
+ struct TALER_BlindedDenominationSignature bss[static csds_length]);
/**
- * Request to sign @a msg using the public key corresponding to
- * @a h_denom_pub during a refresh operation.
- *
- * @param h_denom_pub hash of the public key to use to sign
- * @param bp blinded planchet to sign
- * @param[out] bs set to the blind signature on success
- * @return #TALER_EC_NONE on success
+ * Information needed to derive the CS r_pub.
*/
-enum TALER_ErrorCode
-TEH_keys_denomination_sign_melt (
- const struct TALER_DenominationHashP *h_denom_pub,
- const struct TALER_BlindedPlanchet *bp,
- struct TALER_BlindedDenominationSignature *bs);
+struct TEH_CsDeriveData
+{
+ /**
+ * Hash of key to sign with.
+ */
+ const struct TALER_DenominationHashP *h_denom_pub;
+
+ /**
+ * Nonce to use.
+ */
+ const struct GNUNET_CRYPTO_CsSessionNonce *nonce;
+};
/**
- * Request to derive CS @a r_pub using the denomination corresponding to @a h_denom_pub
- * and @a nonce for withdrawing.
+ * Request to derive CS @a r_pub using the denomination and nonce from @a cdd.
*
- * @param h_denom_pub hash of the public key to use to derive r_pub
- * @param nonce withdraw/refresh nonce
+ * @param cdd data to compute @a r_pub from
+ * @param for_melt true if this is for a melt operation
* @param[out] r_pub where to write the result
* @return #TALER_EC_NONE on success
*/
enum TALER_ErrorCode
-TEH_keys_denomination_cs_r_pub_withdraw (
- const struct TALER_DenominationHashP *h_denom_pub,
- const struct TALER_CsNonce *nonce,
- struct TALER_DenominationCSPublicRPairP *r_pub);
+TEH_keys_denomination_cs_r_pub (
+ const struct TEH_CsDeriveData *cdd,
+ bool for_melt,
+ struct GNUNET_CRYPTO_CSPublicRPairP *r_pub);
/**
- * Request to derive CS @a r_pub using the denomination corresponding to @a h_denom_pub
- * and @a nonce for melting.
+ * Request to derive a bunch of CS @a r_pubs using the
+ * denominations and nonces from @a cdds.
*
- * @param h_denom_pub hash of the public key to use to derive r_pub
- * @param nonce withdraw/refresh nonce
- * @param[out] r_pub where to write the result
+ * @param cdds array to compute @a r_pubs from
+ * @param cdds_length length of the @a cdds array
+ * @param for_melt true if this is for a melt operation
+ * @param[out] r_pubs array where to write the result; must be of length @a cdds_length
* @return #TALER_EC_NONE on success
*/
enum TALER_ErrorCode
-TEH_keys_denomination_cs_r_pub_melt (
- const struct TALER_DenominationHashP *h_denom_pub,
- const struct TALER_CsNonce *nonce,
- struct TALER_DenominationCSPublicRPairP *r_pub);
+TEH_keys_denomination_cs_batch_r_pub (
+ unsigned int cdds_length,
+ const struct TEH_CsDeriveData cdds[static cdds_length],
+ bool for_melt,
+ struct GNUNET_CRYPTO_CSPublicRPairP r_pubs[static cdds_length]);
/**
@@ -340,7 +390,7 @@ TEH_keys_finished (void);
/**
- * Resumse all suspended /keys requests, we may now have key material
+ * Resumes all suspended /keys requests, we may now have key material
* (or are shutting down).
*
* @param do_shutdown are we shutting down?