gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated (7fc151fb -> 64e64141)


From: gnunet
Subject: [taler-merchant] branch master updated (7fc151fb -> 64e64141)
Date: Tue, 21 Dec 2021 10:25:49 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a change to branch master
in repository merchant.

    from 7fc151fb -protocol bump
     new 5f57dbbc -introduce new types for tip identifiers and tip pickups
     new 64e64141 introduce new data type for the post-orders hash used for 
idempotency checks, as well as the hash and salt for authentication checks

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/backend/taler-merchant-httpd.c                 | 10 +--
 src/backend/taler-merchant-httpd.h                 |  8 +--
 src/backend/taler-merchant-httpd_get-orders-ID.c   |  2 +-
 src/backend/taler-merchant-httpd_get-tips-ID.c     |  8 +--
 src/backend/taler-merchant-httpd_get-tips-ID.h     |  4 +-
 .../taler-merchant-httpd_post-orders-ID-claim.c    |  2 +-
 .../taler-merchant-httpd_post-tips-ID-pickup.c     | 12 ++--
 ...taler-merchant-httpd_private-delete-orders-ID.c |  2 +-
 ...taler-merchant-httpd_private-get-instances-ID.c |  2 +-
 .../taler-merchant-httpd_private-get-orders-ID.c   |  2 +-
 .../taler-merchant-httpd_private-get-orders.c      |  2 +-
 .../taler-merchant-httpd_private-get-tips-ID.c     |  4 +-
 .../taler-merchant-httpd_private-get-tips.c        |  2 +-
 .../taler-merchant-httpd_private-post-orders.c     | 16 ++---
 ...-httpd_private-post-reserves-ID-authorize-tip.c |  4 +-
 src/backenddb/plugin_merchantdb_postgres.c         | 22 +++----
 src/include/taler_merchant_service.h               | 21 +++---
 src/include/taler_merchant_testing_lib.h           |  3 +-
 src/include/taler_merchantdb_plugin.h              | 74 +++++++++++++++++-----
 src/lib/merchant_api_common.c                      |  6 +-
 src/lib/merchant_api_merchant_get_tip.c            |  2 +-
 src/lib/merchant_api_tip_authorize.c               |  2 +-
 src/lib/merchant_api_tip_pickup.c                  |  2 +-
 src/lib/merchant_api_tip_pickup2.c                 |  2 +-
 src/lib/merchant_api_wallet_get_tip.c              |  2 +-
 src/testing/testing_api_cmd_get_reserve.c          |  2 +-
 src/testing/testing_api_cmd_get_tips.c             |  2 +-
 src/testing/testing_api_cmd_merchant_get_tip.c     |  2 +-
 src/testing/testing_api_cmd_tip_authorize.c        |  7 +-
 src/testing/testing_api_cmd_tip_pickup.c           |  2 +-
 src/testing/testing_api_cmd_wallet_get_tip.c       |  2 +-
 31 files changed, 137 insertions(+), 96 deletions(-)

diff --git a/src/backend/taler-merchant-httpd.c 
b/src/backend/taler-merchant-httpd.c
index cae16909..f2de7373 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -150,8 +150,8 @@ char *TMH_default_auth;
 
 enum GNUNET_GenericReturnValue
 TMH_check_auth (const char *token,
-                const struct GNUNET_ShortHashCode *salt,
-                const struct GNUNET_HashCode *hash)
+                struct TALER_MerchantAuthenticationSaltP *salt,
+                struct TALER_MerchantAuthenticationHashP *hash)
 {
   struct GNUNET_HashCode val;
   char *dec;
@@ -180,7 +180,7 @@ TMH_check_auth (const char *token,
                                     0));
   GNUNET_free (dec);
   return (0 == GNUNET_memcmp (&val,
-                              hash))
+                              &hash->hash))
     ? GNUNET_OK
     : GNUNET_SYSERR;
 }
@@ -188,8 +188,8 @@ TMH_check_auth (const char *token,
 
 void
 TMH_compute_auth (const char *token,
-                  struct GNUNET_ShortHashCode *salt,
-                  struct GNUNET_HashCode *hash)
+                  struct TALER_MerchantAuthenticationSaltP *salt,
+                  struct TALER_MerchantAuthenticationHashP *hash)
 {
   GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
                               salt,
diff --git a/src/backend/taler-merchant-httpd.h 
b/src/backend/taler-merchant-httpd.h
index 93ca63d3..fce507ef 100644
--- a/src/backend/taler-merchant-httpd.h
+++ b/src/backend/taler-merchant-httpd.h
@@ -680,8 +680,8 @@ TMH_reload_instances (const char *id);
  */
 enum GNUNET_GenericReturnValue
 TMH_check_auth (const char *token,
-                const struct GNUNET_ShortHashCode *salt,
-                const struct GNUNET_HashCode *hash);
+                struct TALER_MerchantAuthenticationSaltP *salt,
+                struct TALER_MerchantAuthenticationHashP *hash);
 
 
 /**
@@ -694,8 +694,8 @@ TMH_check_auth (const char *token,
  */
 void
 TMH_compute_auth (const char *token,
-                  struct GNUNET_ShortHashCode *salt,
-                  struct GNUNET_HashCode *hash);
+                  struct TALER_MerchantAuthenticationSaltP *salt,
+                  struct TALER_MerchantAuthenticationHashP *hash);
 
 
 #endif
diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c 
b/src/backend/taler-merchant-httpd_get-orders-ID.c
index db1c3fee..d6abdc62 100644
--- a/src/backend/taler-merchant-httpd_get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_get-orders-ID.c
@@ -1083,7 +1083,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
   else
   {
     struct TALER_ClaimTokenP db_claim_token;
-    struct GNUNET_HashCode unused; /* h_post_data */
+    struct TALER_MerchantPostDataHashP unused;
 
     qs = TMH_db->lookup_order (TMH_db->cls,
                                hc->instance->settings.id,
diff --git a/src/backend/taler-merchant-httpd_get-tips-ID.c 
b/src/backend/taler-merchant-httpd_get-tips-ID.c
index 4b4b2858..f427b168 100644
--- a/src/backend/taler-merchant-httpd_get-tips-ID.c
+++ b/src/backend/taler-merchant-httpd_get-tips-ID.c
@@ -30,7 +30,7 @@
 
 char *
 TMH_make_taler_tip_uri (struct MHD_Connection *con,
-                        const struct GNUNET_HashCode *tip_id,
+                        const struct TALER_TipIdentifierP *tip_id,
                         const char *instance_id)
 {
   const char *host;
@@ -92,7 +92,7 @@ TMH_make_taler_tip_uri (struct MHD_Connection *con,
 
 char *
 TMH_make_tip_status_url (struct MHD_Connection *con,
-                         const struct GNUNET_HashCode *tip_id,
+                         const struct TALER_TipIdentifierP *tip_id,
                          const char *instance_id)
 {
   const char *host;
@@ -155,7 +155,7 @@ TMH_get_tips_ID (const struct TMH_RequestHandler *rh,
                  struct MHD_Connection *connection,
                  struct TMH_HandlerContext *hc)
 {
-  struct GNUNET_HashCode tip_id;
+  struct TALER_TipIdentifierP tip_id;
   enum GNUNET_DB_QueryStatus qs;
   struct TALER_Amount total_authorized;
   struct TALER_Amount total_picked_up;
@@ -165,7 +165,7 @@ TMH_get_tips_ID (const struct TMH_RequestHandler *rh,
 
   if (GNUNET_OK !=
       GNUNET_CRYPTO_hash_from_string (hc->infix,
-                                      &tip_id))
+                                      &tip_id.hash))
   {
     /* tip_id has wrong encoding */
     GNUNET_break_op (0);
diff --git a/src/backend/taler-merchant-httpd_get-tips-ID.h 
b/src/backend/taler-merchant-httpd_get-tips-ID.h
index 725d305c..bd50da6f 100644
--- a/src/backend/taler-merchant-httpd_get-tips-ID.h
+++ b/src/backend/taler-merchant-httpd_get-tips-ID.h
@@ -34,7 +34,7 @@
  */
 char *
 TMH_make_taler_tip_uri (struct MHD_Connection *con,
-                        const struct GNUNET_HashCode *tip_id,
+                        const struct TALER_TipIdentifierP *tip_id,
                         const char *instance_id);
 
 /**
@@ -48,7 +48,7 @@ TMH_make_taler_tip_uri (struct MHD_Connection *con,
  */
 char *
 TMH_make_tip_status_url (struct MHD_Connection *con,
-                         const struct GNUNET_HashCode *tip_id,
+                         const struct TALER_TipIdentifierP *tip_id,
                          const char *instance_id);
 
 /**
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-claim.c 
b/src/backend/taler-merchant-httpd_post-orders-ID-claim.c
index 16990d4b..1f9d8e2b 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-claim.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-claim.c
@@ -122,7 +122,7 @@ claim_order (const char *instance_id,
   /* Now we need to claim the order. */
 
   {
-    struct GNUNET_HashCode unused;
+    struct TALER_MerchantPostDataHashP unused;
     struct GNUNET_TIME_Timestamp timestamp;
     struct GNUNET_JSON_Specification spec[] = {
       GNUNET_JSON_spec_timestamp ("timestamp",
diff --git a/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c 
b/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
index c60ba021..03b232d4 100644
--- a/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
+++ b/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
@@ -144,13 +144,13 @@ struct PickupContext
   /**
    * Which tip is being picked up?
    */
-  struct GNUNET_HashCode tip_id;
+  struct TALER_TipIdentifierP tip_id;
 
   /**
    * What is the ID of the pickup operation? (Basically a
    * hash over the key inputs).
    */
-  struct GNUNET_HashCode pickup_id;
+  struct TALER_PickupIdentifierP pickup_id;
 
   /**
    * Array of our planchets.
@@ -636,7 +636,7 @@ TMH_post_tips_ID_pickup (const struct TMH_RequestHandler 
*rh,
     GNUNET_assert (NULL != hc->infix);
     if (GNUNET_OK !=
         GNUNET_CRYPTO_hash_from_string (hc->infix,
-                                        &pc->tip_id))
+                                        &pc->tip_id.hash))
     {
       /* tip_id has wrong encoding */
       GNUNET_break_op (0);
@@ -722,7 +722,7 @@ TMH_post_tips_ID_pickup (const struct TMH_RequestHandler 
*rh,
                                          pd->coin_ev_size);
       }
       GNUNET_CRYPTO_hash_context_finish (hc,
-                                         &pc->pickup_id);
+                                         &pc->pickup_id.hash);
     }
   }
 
@@ -804,7 +804,7 @@ RETRY:
                                 sigs);
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                 "Lookup pickup `%s' resulted in %d\n",
-                GNUNET_h2s (&pc->pickup_id),
+                GNUNET_h2s (&pc->pickup_id.hash),
                 qs);
     if (qs > GNUNET_DB_STATUS_SUCCESS_ONE_RESULT)
       qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
@@ -830,7 +830,7 @@ RETRY:
         }
         GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                     "Lookup pickup `%s' initiated withdraw #%u\n",
-                    GNUNET_h2s (&pc->pickup_id),
+                    GNUNET_h2s (&pc->pickup_id.hash),
                     i);
         try_withdraw (pc,
                       exchange_url,
diff --git a/src/backend/taler-merchant-httpd_private-delete-orders-ID.c 
b/src/backend/taler-merchant-httpd_private-delete-orders-ID.c
index b9dd4bc9..9eaa8b0e 100644
--- a/src/backend/taler-merchant-httpd_private-delete-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-delete-orders-ID.c
@@ -63,7 +63,7 @@ TMH_private_delete_orders_ID (const struct TMH_RequestHandler 
*rh,
                                        NULL);
   case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
     {
-      struct GNUNET_HashCode unused;
+      struct TALER_MerchantPostDataHashP unused;
 
       qs = TMH_db->lookup_order (TMH_db->cls,
                                  mi->settings.id,
diff --git a/src/backend/taler-merchant-httpd_private-get-instances-ID.c 
b/src/backend/taler-merchant-httpd_private-get-instances-ID.c
index 85b3c7df..5087d637 100644
--- a/src/backend/taler-merchant-httpd_private-get-instances-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-instances-ID.c
@@ -63,7 +63,7 @@ get_instances_ID (struct TMH_MerchantInstance *mi,
 
   auth = GNUNET_JSON_PACK (
     GNUNET_JSON_pack_string ("method",
-                             GNUNET_is_zero (mi->auth.auth_hash.bits)
+                             GNUNET_is_zero (&mi->auth.auth_hash)
                                                     ? "external"
                                                     : "token"));
   return TALER_MHD_REPLY_JSON_PACK (
diff --git a/src/backend/taler-merchant-httpd_private-get-orders-ID.c 
b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
index 328ffbf0..b4067f56 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -1012,7 +1012,7 @@ TMH_private_get_orders_ID (const struct 
TMH_RequestHandler *rh,
   }
 
   {
-    struct GNUNET_HashCode unused;
+    struct TALER_MerchantPostDataHashP unused;
     json_t *ct = NULL;
 
     /* We need the order for two cases:  Either when the contract doesn't 
exist yet,
diff --git a/src/backend/taler-merchant-httpd_private-get-orders.c 
b/src/backend/taler-merchant-httpd_private-get-orders.c
index 29b6e65a..444e564d 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders.c
@@ -328,7 +328,7 @@ add_order (void *cls,
   if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
   {
     /* Might still be unclaimed, so try order table */
-    struct GNUNET_HashCode unused;
+    struct TALER_MerchantPostDataHashP unused;
 
     qs = TMH_db->lookup_order (TMH_db->cls,
                                po->instance_id,
diff --git a/src/backend/taler-merchant-httpd_private-get-tips-ID.c 
b/src/backend/taler-merchant-httpd_private-get-tips-ID.c
index 0460b3c7..9b2e0de2 100644
--- a/src/backend/taler-merchant-httpd_private-get-tips-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-tips-ID.c
@@ -33,7 +33,7 @@ TMH_private_get_tips_ID (const struct TMH_RequestHandler *rh,
                          struct MHD_Connection *connection,
                          struct TMH_HandlerContext *hc)
 {
-  struct GNUNET_HashCode tip_id;
+  struct TALER_TipIdentifierP tip_id;
   struct TALER_Amount total_authorized;
   struct TALER_Amount total_picked_up;
   char *reason;
@@ -48,7 +48,7 @@ TMH_private_get_tips_ID (const struct TMH_RequestHandler *rh,
   GNUNET_assert (NULL != hc->infix);
   if (GNUNET_OK !=
       GNUNET_CRYPTO_hash_from_string (hc->infix,
-                                      &tip_id))
+                                      &tip_id.hash))
   {
     /* tip_id has wrong encoding */
     GNUNET_break_op (0);
diff --git a/src/backend/taler-merchant-httpd_private-get-tips.c 
b/src/backend/taler-merchant-httpd_private-get-tips.c
index e222daae..4f358be2 100644
--- a/src/backend/taler-merchant-httpd_private-get-tips.c
+++ b/src/backend/taler-merchant-httpd_private-get-tips.c
@@ -33,7 +33,7 @@
 static void
 add_tip (void *cls,
          uint64_t row_id,
-         struct GNUNET_HashCode tip_id,
+         struct TALER_TipIdentifierP tip_id,
          struct TALER_Amount amount)
 {
   json_t *pa = cls;
diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c 
b/src/backend/taler-merchant-httpd_private-post-orders.c
index 35cdf790..666505f9 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders.c
@@ -197,7 +197,7 @@ struct InventoryProduct
 static enum GNUNET_DB_QueryStatus
 execute_transaction (struct TMH_HandlerContext *hc,
                      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 json_t *order,
                      const struct TALER_ClaimTokenP *claim_token,
@@ -315,7 +315,7 @@ execute_transaction (struct TMH_HandlerContext *hc,
 static MHD_RESULT
 execute_order (struct MHD_Connection *connection,
                struct TMH_HandlerContext *hc,
-               const struct GNUNET_HashCode *h_post_data,
+               const struct TALER_MerchantPostDataHashP *h_post_data,
                json_t *order,
                const struct TALER_ClaimTokenP *claim_token,
                unsigned int inventory_products_length,
@@ -424,7 +424,7 @@ execute_order (struct MHD_Connection *connection,
   {
     struct TALER_ClaimTokenP token;
     json_t *contract_terms;
-    struct GNUNET_HashCode orig_post;
+    struct TALER_MerchantPostDataHashP orig_post;
 
     TMH_db->preflight (TMH_db->cls);
     qs = TMH_db->lookup_order (TMH_db->cls,
@@ -640,7 +640,7 @@ execute_order (struct MHD_Connection *connection,
 static MHD_RESULT
 patch_order (struct MHD_Connection *connection,
              struct TMH_HandlerContext *hc,
-             const struct GNUNET_HashCode *h_post_data,
+             const struct TALER_MerchantPostDataHashP *h_post_data,
              json_t *order,
              const struct TALER_ClaimTokenP *claim_token,
              struct GNUNET_TIME_Relative refund_delay,
@@ -1105,7 +1105,7 @@ patch_order (struct MHD_Connection *connection,
 static MHD_RESULT
 add_payment_details (struct MHD_Connection *connection,
                      struct TMH_HandlerContext *hc,
-                     const struct GNUNET_HashCode *h_post_data,
+                     const struct TALER_MerchantPostDataHashP *h_post_data,
                      json_t *order,
                      const struct TALER_ClaimTokenP *claim_token,
                      struct GNUNET_TIME_Relative refund_delay,
@@ -1178,7 +1178,7 @@ add_payment_details (struct MHD_Connection *connection,
 static MHD_RESULT
 merge_inventory (struct MHD_Connection *connection,
                  struct TMH_HandlerContext *hc,
-                 const struct GNUNET_HashCode *h_post_data,
+                 const struct TALER_MerchantPostDataHashP *h_post_data,
                  json_t *order,
                  const struct TALER_ClaimTokenP *claim_token,
                  struct GNUNET_TIME_Relative refund_delay,
@@ -1357,7 +1357,7 @@ TMH_private_post_orders (const struct TMH_RequestHandler 
*rh,
     GNUNET_JSON_spec_end ()
   };
   enum GNUNET_GenericReturnValue ret;
-  struct GNUNET_HashCode h_post_data;
+  struct TALER_MerchantPostDataHashP h_post_data;
 
   (void) rh;
   ret = TALER_MHD_parse_json_data (connection,
@@ -1407,7 +1407,7 @@ TMH_private_post_orders (const struct TMH_RequestHandler 
*rh,
     }
     GNUNET_CRYPTO_hash (req_body_enc,
                         strlen (req_body_enc),
-                        &h_post_data);
+                        &h_post_data.hash);
     GNUNET_free (req_body_enc);
   }
 
diff --git 
a/src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c 
b/src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c
index 1b69fa21..0072007d 100644
--- a/src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c
+++ b/src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c
@@ -45,7 +45,7 @@ authorize_tip (const struct TMH_RequestHandler *rh,
 {
   enum TALER_ErrorCode ec;
   struct GNUNET_TIME_Timestamp expiration;
-  struct GNUNET_HashCode tip_id;
+  struct TALER_TipIdentifierP tip_id;
   const char *justification;
   const char *next_url;
   struct TALER_Amount amount;
@@ -119,7 +119,7 @@ authorize_tip (const struct TMH_RequestHandler *rh,
     struct GNUNET_CRYPTO_HashAsciiEncoded hash_enc;
     MHD_RESULT res;
 
-    GNUNET_CRYPTO_hash_to_enc (&tip_id,
+    GNUNET_CRYPTO_hash_to_enc (&tip_id.hash,
                                &hash_enc);
     taler_tip_uri = TMH_make_taler_tip_uri (connection,
                                             &tip_id,
diff --git a/src/backenddb/plugin_merchantdb_postgres.c 
b/src/backenddb/plugin_merchantdb_postgres.c
index 1b55ecd6..5465b4e8 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -1639,7 +1639,7 @@ postgres_lookup_order (void *cls,
                        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)
 {
   struct PostgresClosure *pg = cls;
@@ -1881,7 +1881,7 @@ static enum GNUNET_DB_QueryStatus
 postgres_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)
@@ -5919,7 +5919,7 @@ postgres_authorize_tip (void *cls,
                         const struct TALER_Amount *amount,
                         const char *justification,
                         const char *next_url,
-                        struct GNUNET_HashCode *tip_id,
+                        struct TALER_TipIdentifierP *tip_id,
                         struct GNUNET_TIME_Timestamp *expiration)
 {
   struct PostgresClosure *pg = cls;
@@ -6196,8 +6196,8 @@ lookup_signatures_cb (void *cls,
 static enum GNUNET_DB_QueryStatus
 postgres_lookup_pickup (void *cls,
                         const char *instance_id,
-                        const struct GNUNET_HashCode *tip_id,
-                        const struct GNUNET_HashCode *pickup_id,
+                        const struct TALER_TipIdentifierP *tip_id,
+                        const struct TALER_PickupIdentifierP *pickup_id,
                         char **exchange_url,
                         struct TALER_ReservePrivateKeyP *reserve_priv,
                         unsigned int sigs_length,
@@ -6266,7 +6266,7 @@ postgres_lookup_pickup (void *cls,
 static enum GNUNET_DB_QueryStatus
 postgres_lookup_tip (void *cls,
                      const char *instance_id,
-                     const struct GNUNET_HashCode *tip_id,
+                     const struct TALER_TipIdentifierP *tip_id,
                      struct TALER_Amount *total_authorized,
                      struct TALER_Amount *total_picked_up,
                      struct GNUNET_TIME_Timestamp *expiration,
@@ -6346,7 +6346,7 @@ lookup_tips_cb (void *cls,
   for (unsigned int i = 0; i < num_results; i++)
   {
     uint64_t row_id;
-    struct GNUNET_HashCode tip_id;
+    struct TALER_TipIdentifierP tip_id;
     struct TALER_Amount tip_amount;
     struct GNUNET_PQ_ResultSpec rs[] = {
       GNUNET_PQ_result_spec_uint64 ("tip_serial",
@@ -6533,7 +6533,7 @@ lookup_pickup_details_cb (void *cls,
 static enum GNUNET_DB_QueryStatus
 postgres_lookup_tip_details (void *cls,
                              const char *instance_id,
-                             const struct GNUNET_HashCode *tip_id,
+                             const struct TALER_TipIdentifierP *tip_id,
                              bool fpu,
                              struct TALER_Amount *total_authorized,
                              struct TALER_Amount *total_picked_up,
@@ -6629,9 +6629,9 @@ postgres_lookup_tip_details (void *cls,
 static enum GNUNET_DB_QueryStatus
 postgres_insert_pickup (void *cls,
                         const char *instance_id,
-                        const struct GNUNET_HashCode *tip_id,
+                        const struct TALER_TipIdentifierP *tip_id,
                         const struct TALER_Amount *total_picked_up,
-                        const struct GNUNET_HashCode *pickup_id,
+                        const struct TALER_PickupIdentifierP *pickup_id,
                         const struct TALER_Amount *total_requested)
 {
   struct PostgresClosure *pg = cls;
@@ -6733,7 +6733,7 @@ postgres_insert_pickup (void *cls,
 static enum GNUNET_DB_QueryStatus
 postgres_insert_pickup_blind_signature (
   void *cls,
-  const struct GNUNET_HashCode *pickup_id,
+  const struct TALER_PickupIdentifierP *pickup_id,
   uint32_t offset,
   const struct TALER_BlindedDenominationSignature *blind_sig)
 {
diff --git a/src/include/taler_merchant_service.h 
b/src/include/taler_merchant_service.h
index 7520b553..f4eded04 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -3140,7 +3140,7 @@ struct TALER_MERCHANT_TipDetails
   /**
    * Identifier for the tip.
    */
-  struct GNUNET_HashCode tip_id;
+  struct TALER_TipIdentifierP tip_id;
 
   /**
    * Total value of the tip (including fees).
@@ -3230,7 +3230,7 @@ typedef void
 (*TALER_MERCHANT_TipAuthorizeCallback) (
   void *cls,
   const struct TALER_MERCHANT_HttpResponse *hr,
-  struct GNUNET_HashCode *tip_id,
+  struct TALER_TipIdentifierP *tip_id,
   const char *tip_uri,
   struct GNUNET_TIME_Timestamp tip_expiration);
 
@@ -3403,7 +3403,7 @@ typedef void
 struct TALER_MERCHANT_TipWalletGetHandle *
 TALER_MERCHANT_wallet_tip_get (struct GNUNET_CURL_Context *ctx,
                                const char *backend_url,
-                               const struct GNUNET_HashCode *tip_id,
+                               const struct TALER_TipIdentifierP *tip_id,
                                TALER_MERCHANT_TipWalletGetCallback cb,
                                void *cb_cls);
 
@@ -3414,8 +3414,8 @@ TALER_MERCHANT_wallet_tip_get (struct GNUNET_CURL_Context 
*ctx,
  * @param tgh handle to the request to be canceled
  */
 void
-TALER_MERCHANT_wallet_tip_get_cancel (struct
-                                      TALER_MERCHANT_TipWalletGetHandle *tgh);
+TALER_MERCHANT_wallet_tip_get_cancel (
+  struct TALER_MERCHANT_TipWalletGetHandle *tgh);
 
 
 /**
@@ -3432,7 +3432,7 @@ struct TALER_MERCHANT_PickupDetail
   /**
    * Identifier of the pickup.
    */
-  struct GNUNET_HashCode pickup_id;
+  struct TALER_PickupIdentifierP pickup_id;
 
   /**
    * Number of planchets involved.
@@ -3445,6 +3445,7 @@ struct TALER_MERCHANT_PickupDetail
   struct TALER_Amount requested_amount;
 };
 
+
 /**
  * Callback to process a GET /private/tips/$TIP_ID request
  *
@@ -3486,7 +3487,7 @@ typedef void
 struct TALER_MERCHANT_TipMerchantGetHandle *
 TALER_MERCHANT_merchant_tip_get (struct GNUNET_CURL_Context *ctx,
                                  const char *backend_url,
-                                 const struct GNUNET_HashCode *tip_id,
+                                 const struct TALER_TipIdentifierP *tip_id,
                                  bool pickups,
                                  TALER_MERCHANT_TipMerchantGetCallback cb,
                                  void *cb_cls);
@@ -3521,7 +3522,7 @@ struct TALER_MERCHANT_TipEntry
   /**
    * Identifier for the tip.
    */
-  struct GNUNET_HashCode tip_id;
+  struct TALER_TipIdentifierP tip_id;
 
   /**
    * Total value of the tip (including fees).
@@ -3650,7 +3651,7 @@ struct TALER_MERCHANT_PlanchetData
 struct TALER_MERCHANT_TipPickupHandle *
 TALER_MERCHANT_tip_pickup (struct GNUNET_CURL_Context *ctx,
                            const char *backend_url,
-                           const struct GNUNET_HashCode *tip_id,
+                           const struct TALER_TipIdentifierP *tip_id,
                            unsigned int num_planchets,
                            const struct TALER_MERCHANT_PlanchetData 
planchets[],
                            TALER_MERCHANT_TipPickupCallback pickup_cb,
@@ -3706,7 +3707,7 @@ typedef void
 struct TALER_MERCHANT_TipPickup2Handle *
 TALER_MERCHANT_tip_pickup2 (struct GNUNET_CURL_Context *ctx,
                             const char *backend_url,
-                            const struct GNUNET_HashCode *tip_id,
+                            const struct TALER_TipIdentifierP *tip_id,
                             unsigned int num_planchets,
                             const struct TALER_PlanchetDetail planchets[],
                             TALER_MERCHANT_TipPickup2Callback pickup_cb,
diff --git a/src/include/taler_merchant_testing_lib.h 
b/src/include/taler_merchant_testing_lib.h
index 18a1e0cc..b846b622 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -1496,7 +1496,8 @@ TALER_TESTING_cmd_merchant_kyc_get (const char *label,
 // FIXME: rename: refund_entry->refund_detail
 #define TALER_MERCHANT_TESTING_SIMPLE_TRAITS(op) \
   op (claim_nonce, const struct GNUNET_CRYPTO_EddsaPublicKey) \
-  op (tip_id, const struct GNUNET_HashCode) \
+  op (tip_id, const struct TALER_TipIdentifierP) \
+  op (pickup_id, const struct TALER_PickupIdentifierP) \
   op (instance_name, const char *) \
   op (instance_id, const char *) \
   op (address, const json_t) \
diff --git a/src/include/taler_merchantdb_plugin.h 
b/src/include/taler_merchantdb_plugin.h
index 3925011a..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;
 };
 
 /**
@@ -552,7 +596,7 @@ struct TALER_MERCHANTDB_TipDetails
   /**
    * ID of the tip.
    */
-  struct GNUNET_HashCode tip_id;
+  struct TALER_TipIdentifierP tip_id;
 
   /**
    * Total amount of the tip.
@@ -633,7 +677,7 @@ typedef void
 typedef void
 (*TALER_MERCHANTDB_TipsCallback)(void *cls,
                                  uint64_t row_id,
-                                 struct GNUNET_HashCode tip_id,
+                                 struct TALER_TipIdentifierP tip_id,
                                  struct TALER_Amount amount);
 
 
@@ -675,7 +719,7 @@ struct TALER_MERCHANTDB_PickupDetails
   /**
    * Identifier for the pickup operation.
    */
-  struct GNUNET_HashCode pickup_id;
+  struct TALER_PickupIdentifierP pickup_id;
 
   /**
    * Total amount requested for this @e pickup_id.
@@ -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);
@@ -2168,7 +2212,7 @@ struct TALER_MERCHANTDB_Plugin
                    const struct TALER_Amount *amount,
                    const char *justification,
                    const char *next_url,
-                   struct GNUNET_HashCode *tip_id,
+                   struct TALER_TipIdentifierP *tip_id,
                    struct GNUNET_TIME_Timestamp *expiration);
 
 
@@ -2189,8 +2233,8 @@ struct TALER_MERCHANTDB_Plugin
   enum GNUNET_DB_QueryStatus
   (*lookup_pickup)(void *cls,
                    const char *instance_id,
-                   const struct GNUNET_HashCode *tip_id,
-                   const struct GNUNET_HashCode *pickup_id,
+                   const struct TALER_TipIdentifierP *tip_id,
+                   const struct TALER_PickupIdentifierP *pickup_id,
                    char **exchange_url,
                    struct TALER_ReservePrivateKeyP *reserve_priv,
                    unsigned int sigs_length,
@@ -2213,7 +2257,7 @@ struct TALER_MERCHANTDB_Plugin
   enum GNUNET_DB_QueryStatus
   (*lookup_tip)(void *cls,
                 const char *instance_id,
-                const struct GNUNET_HashCode *tip_id,
+                const struct TALER_TipIdentifierP *tip_id,
                 struct TALER_Amount *total_authorized,
                 struct TALER_Amount *total_picked_up,
                 struct GNUNET_TIME_Timestamp *expiration,
@@ -2263,7 +2307,7 @@ struct TALER_MERCHANTDB_Plugin
   enum GNUNET_DB_QueryStatus
   (*lookup_tip_details)(void *cls,
                         const char *instance_id,
-                        const struct GNUNET_HashCode *tip_id,
+                        const struct TALER_TipIdentifierP *tip_id,
                         bool fpu,
                         struct TALER_Amount *total_authorized,
                         struct TALER_Amount *total_picked_up,
@@ -2295,9 +2339,9 @@ struct TALER_MERCHANTDB_Plugin
   enum GNUNET_DB_QueryStatus
   (*insert_pickup)(void *cls,
                    const char *instance_id,
-                   const struct GNUNET_HashCode *tip_id,
+                   const struct TALER_TipIdentifierP *tip_id,
                    const struct TALER_Amount *total_picked_up,
-                   const struct GNUNET_HashCode *pickup_id,
+                   const struct TALER_PickupIdentifierP *pickup_id,
                    const struct TALER_Amount *total_requested);
 
 
@@ -2316,7 +2360,7 @@ struct TALER_MERCHANTDB_Plugin
   enum GNUNET_DB_QueryStatus
   (*insert_pickup_blind_signature)(
     void *cls,
-    const struct GNUNET_HashCode *pickup_id,
+    const struct TALER_PickupIdentifierP *pickup_id,
     uint32_t offset,
     const struct TALER_BlindedDenominationSignature *blind_sig);
 
diff --git a/src/lib/merchant_api_common.c b/src/lib/merchant_api_common.c
index c2fbaa39..7e22f645 100644
--- a/src/lib/merchant_api_common.c
+++ b/src/lib/merchant_api_common.c
@@ -21,12 +21,8 @@
  */
 #include "platform.h"
 #include <curl/curl.h>
-#include <jansson.h>
-#include <microhttpd.h> /* just for HTTP status codes */
-#include <gnunet/gnunet_util_lib.h>
-#include <gnunet/gnunet_uri_lib.h>
-#include <gnunet/gnunet_curl_lib.h>
 #include "taler_merchant_service.h"
+#include <gnunet/gnunet_uri_lib.h>
 #include <taler/taler_json_lib.h>
 
 
diff --git a/src/lib/merchant_api_merchant_get_tip.c 
b/src/lib/merchant_api_merchant_get_tip.c
index 374634b4..020167c4 100644
--- a/src/lib/merchant_api_merchant_get_tip.c
+++ b/src/lib/merchant_api_merchant_get_tip.c
@@ -257,7 +257,7 @@ handle_merchant_tip_get_finished (void *cls,
 struct TALER_MERCHANT_TipMerchantGetHandle *
 TALER_MERCHANT_merchant_tip_get (struct GNUNET_CURL_Context *ctx,
                                  const char *backend_url,
-                                 const struct GNUNET_HashCode *tip_id,
+                                 const struct TALER_TipIdentifierP *tip_id,
                                  bool pickups,
                                  TALER_MERCHANT_TipMerchantGetCallback cb,
                                  void *cb_cls)
diff --git a/src/lib/merchant_api_tip_authorize.c 
b/src/lib/merchant_api_tip_authorize.c
index c56fab38..f8990b4c 100644
--- a/src/lib/merchant_api_tip_authorize.c
+++ b/src/lib/merchant_api_tip_authorize.c
@@ -86,7 +86,7 @@ check_ok (struct TALER_MERCHANT_TipAuthorizeHandle *tao,
 {
   const char *tip_status_url;
   const char *taler_tip_uri;
-  struct GNUNET_HashCode tip_id;
+  struct TALER_TipIdentifierP tip_id;
   struct GNUNET_TIME_Timestamp expiration_time;
   struct GNUNET_JSON_Specification spec[] = {
     GNUNET_JSON_spec_string ("tip_status_url", &tip_status_url),
diff --git a/src/lib/merchant_api_tip_pickup.c 
b/src/lib/merchant_api_tip_pickup.c
index 9d3a27d7..c16866a5 100644
--- a/src/lib/merchant_api_tip_pickup.c
+++ b/src/lib/merchant_api_tip_pickup.c
@@ -169,7 +169,7 @@ pickup_done_cb (void *cls,
 struct TALER_MERCHANT_TipPickupHandle *
 TALER_MERCHANT_tip_pickup (struct GNUNET_CURL_Context *ctx,
                            const char *backend_url,
-                           const struct GNUNET_HashCode *tip_id,
+                           const struct TALER_TipIdentifierP *tip_id,
                            unsigned int num_planchets,
                            const struct TALER_MERCHANT_PlanchetData *pds,
                            TALER_MERCHANT_TipPickupCallback pickup_cb,
diff --git a/src/lib/merchant_api_tip_pickup2.c 
b/src/lib/merchant_api_tip_pickup2.c
index f11f4a6d..ef9ccc21 100644
--- a/src/lib/merchant_api_tip_pickup2.c
+++ b/src/lib/merchant_api_tip_pickup2.c
@@ -232,7 +232,7 @@ handle_tip_pickup_finished (void *cls,
 struct TALER_MERCHANT_TipPickup2Handle *
 TALER_MERCHANT_tip_pickup2 (struct GNUNET_CURL_Context *ctx,
                             const char *backend_url,
-                            const struct GNUNET_HashCode *tip_id,
+                            const struct TALER_TipIdentifierP *tip_id,
                             unsigned int num_planchets,
                             const struct TALER_PlanchetDetail planchets[],
                             TALER_MERCHANT_TipPickup2Callback pickup_cb,
diff --git a/src/lib/merchant_api_wallet_get_tip.c 
b/src/lib/merchant_api_wallet_get_tip.c
index cd40dc4e..07a46ab7 100644
--- a/src/lib/merchant_api_wallet_get_tip.c
+++ b/src/lib/merchant_api_wallet_get_tip.c
@@ -159,7 +159,7 @@ handle_wallet_tip_get_finished (void *cls,
 struct TALER_MERCHANT_TipWalletGetHandle *
 TALER_MERCHANT_wallet_tip_get (struct GNUNET_CURL_Context *ctx,
                                const char *backend_url,
-                               const struct GNUNET_HashCode *tip_id,
+                               const struct TALER_TipIdentifierP *tip_id,
                                TALER_MERCHANT_TipWalletGetCallback cb,
                                void *cb_cls)
 {
diff --git a/src/testing/testing_api_cmd_get_reserve.c 
b/src/testing/testing_api_cmd_get_reserve.c
index 95d0c3a8..03b6a071 100644
--- a/src/testing/testing_api_cmd_get_reserve.c
+++ b/src/testing/testing_api_cmd_get_reserve.c
@@ -139,7 +139,7 @@ get_reserve_cb (void *cls,
       tip_cmd = TALER_TESTING_interpreter_lookup_command (grs->is,
                                                           grs->tips[i]);
       {
-        const struct GNUNET_HashCode *tip_id;
+        const struct TALER_TipIdentifierP *tip_id;
 
         if (GNUNET_OK !=
             TALER_TESTING_get_trait_tip_id (tip_cmd,
diff --git a/src/testing/testing_api_cmd_get_tips.c 
b/src/testing/testing_api_cmd_get_tips.c
index 9b9a4671..89a82202 100644
--- a/src/testing/testing_api_cmd_get_tips.c
+++ b/src/testing/testing_api_cmd_get_tips.c
@@ -121,7 +121,7 @@ get_tips_cb (void *cls,
         gts->is,
         gts->tips[i]);
       {
-        const struct GNUNET_HashCode *tip_id;
+        const struct TALER_TipIdentifierP *tip_id;
 
         if (GNUNET_OK !=
             TALER_TESTING_get_trait_tip_id (tip_cmd,
diff --git a/src/testing/testing_api_cmd_merchant_get_tip.c 
b/src/testing/testing_api_cmd_merchant_get_tip.c
index 6b247e75..a4841da1 100644
--- a/src/testing/testing_api_cmd_merchant_get_tip.c
+++ b/src/testing/testing_api_cmd_merchant_get_tip.c
@@ -269,7 +269,7 @@ merchant_get_tip_run (void *cls,
 {
   struct MerchantTipGetState *tgs = cls;
   const struct TALER_TESTING_Command *tip_cmd;
-  const struct GNUNET_HashCode *tip_id;
+  const struct TALER_TipIdentifierP *tip_id;
 
   tip_cmd = TALER_TESTING_interpreter_lookup_command (is,
                                                       tgs->tip_reference);
diff --git a/src/testing/testing_api_cmd_tip_authorize.c 
b/src/testing/testing_api_cmd_tip_authorize.c
index cc83605f..3d6893d9 100644
--- a/src/testing/testing_api_cmd_tip_authorize.c
+++ b/src/testing/testing_api_cmd_tip_authorize.c
@@ -76,7 +76,7 @@ struct TipAuthorizeState
   /**
    * The tip id; set when the CMD succeeds.
    */
-  struct GNUNET_HashCode tip_id;
+  struct TALER_TipIdentifierP tip_id;
 
   /**
    * Expiration date for this tip.
@@ -134,7 +134,7 @@ do_retry (void *cls);
 static void
 tip_authorize_cb (void *cls,
                   const struct TALER_MERCHANT_HttpResponse *hr,
-                  struct GNUNET_HashCode *tip_id,
+                  struct TALER_TipIdentifierP *tip_id,
                   const char *taler_tip_uri,
                   struct GNUNET_TIME_Timestamp expiration)
 {
@@ -299,8 +299,7 @@ tip_authorize_fake_run (void *cls,
   /* Make up a tip id.  */
   GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
                               &tas->tip_id,
-                              sizeof (struct GNUNET_HashCode));
-
+                              sizeof (struct TALER_TipIdentifierP));
   TALER_TESTING_interpreter_next (is);
 }
 
diff --git a/src/testing/testing_api_cmd_tip_pickup.c 
b/src/testing/testing_api_cmd_tip_pickup.c
index cd73c53d..3c01b416 100644
--- a/src/testing/testing_api_cmd_tip_pickup.c
+++ b/src/testing/testing_api_cmd_tip_pickup.c
@@ -187,7 +187,7 @@ tip_pickup_run (void *cls,
   unsigned int num_planchets;
   const struct TALER_TESTING_Command *replay_cmd;
   const struct TALER_TESTING_Command *authorize_cmd;
-  const struct GNUNET_HashCode *tip_id;
+  const struct TALER_TipIdentifierP *tip_id;
 
   tps->is = is;
   tps->exchange_url = TALER_EXCHANGE_get_base_url (is->exchange);
diff --git a/src/testing/testing_api_cmd_wallet_get_tip.c 
b/src/testing/testing_api_cmd_wallet_get_tip.c
index 7e13acc9..f7786973 100644
--- a/src/testing/testing_api_cmd_wallet_get_tip.c
+++ b/src/testing/testing_api_cmd_wallet_get_tip.c
@@ -167,7 +167,7 @@ wallet_get_tip_run (void *cls,
 {
   struct WalletTipGetState *tgs = cls;
   const struct TALER_TESTING_Command *tip_cmd;
-  const struct GNUNET_HashCode *tip_id;
+  const struct TALER_TipIdentifierP *tip_id;
 
   tip_cmd = TALER_TESTING_interpreter_lookup_command (is,
                                                       tgs->tip_reference);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]