summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-19 12:24:14 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-19 12:24:14 +0100
commit64e64141962fbea4e8acea87f57f98e93360a7c4 (patch)
tree37653111c82d9bc3e3440a2b8a0ccef756aea4b0 /src/include
parent5f57dbbc7b1e1ed21fff24daa537b949727b7966 (diff)
downloadmerchant-64e64141962fbea4e8acea87f57f98e93360a7c4.tar.gz
merchant-64e64141962fbea4e8acea87f57f98e93360a7c4.tar.bz2
merchant-64e64141962fbea4e8acea87f57f98e93360a7c4.zip
introduce new data type for the post-orders hash used for idempotency checks, as well as the hash and salt for authentication checks
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_merchantdb_plugin.h52
1 files changed, 48 insertions, 4 deletions
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h
index b4dc17b2..d301eeef 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -33,6 +33,50 @@
struct TALER_MERCHANTDB_Plugin;
+GNUNET_NETWORK_STRUCT_BEGIN
+
+
+/**
+ * @brief Hash over an order request, used for the idempotency check.
+ */
+struct TALER_MerchantPostDataHashP
+{
+ /**
+ * The authentication hash is a SHA-512 hash code.
+ */
+ struct GNUNET_HashCode hash;
+};
+
+
+/**
+ * @brief Hash used for client authenticiation. Computed with a
+ * `struct TALER_MerchantAuthenticationSaltP`.
+ */
+struct TALER_MerchantAuthenticationHashP
+{
+ /**
+ * The authentication hash is a SHA-512 hash code.
+ * All zeros if authentication is off.
+ */
+ struct GNUNET_HashCode hash;
+};
+
+
+/**
+ * @brief Salt used for client authenticiation.
+ */
+struct TALER_MerchantAuthenticationSaltP
+{
+ /**
+ * The authentication salt is a 256-bit value.
+ */
+ uint32_t salt[256 / 8 / sizeof(uint32_t)]; /* = 8 */
+};
+
+
+GNUNET_NETWORK_STRUCT_END
+
+
/**
* Details about a wire account of the merchant.
*/
@@ -68,13 +112,13 @@ struct TALER_MERCHANTDB_InstanceAuthSettings
/**
* Hash used for authentication. All zero if authentication is off.
*/
- struct GNUNET_HashCode auth_hash;
+ struct TALER_MerchantAuthenticationHashP auth_hash;
/**
* Salt used to hash the "Authentication" header, the result must then
* match the @e auth_hash.
*/
- struct GNUNET_ShortHashCode auth_salt;
+ struct TALER_MerchantAuthenticationSaltP auth_salt;
};
/**
@@ -1184,7 +1228,7 @@ struct TALER_MERCHANTDB_Plugin
const char *instance_id,
const char *order_id,
struct TALER_ClaimTokenP *claim_token,
- struct GNUNET_HashCode *h_post_data,
+ struct TALER_MerchantPostDataHashP *h_post_data,
json_t **contract_terms);
@@ -1240,7 +1284,7 @@ struct TALER_MERCHANTDB_Plugin
(*insert_order)(void *cls,
const char *instance_id,
const char *order_id,
- const struct GNUNET_HashCode *h_post_data,
+ const struct TALER_MerchantPostDataHashP *h_post_data,
struct GNUNET_TIME_Timestamp pay_deadline,
const struct TALER_ClaimTokenP *claim_token,
const json_t *contract_terms);