gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: add logic to store attributes


From: gnunet
Subject: [taler-exchange] branch master updated: add logic to store attributes
Date: Fri, 27 Jan 2023 15:10:28 +0100

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new d79c23aa add logic to store attributes
d79c23aa is described below

commit d79c23aaabb5dc1c9073555d574bea01b75668cd
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Jan 27 15:10:25 2023 +0100

    add logic to store attributes
---
 src/exchange/taler-exchange-httpd_kyc-proof.c | 39 +++++++++++++++++++++++++--
 src/include/taler_crypto_lib.h                | 12 ++++-----
 2 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_kyc-proof.c 
b/src/exchange/taler-exchange-httpd_kyc-proof.c
index 1904c4ac..11d17966 100644
--- a/src/exchange/taler-exchange-httpd_kyc-proof.c
+++ b/src/exchange/taler-exchange-httpd_kyc-proof.c
@@ -195,8 +195,43 @@ proof_cb (
   if (TALER_KYCLOGIC_STATUS_SUCCESS == status)
   {
     enum GNUNET_DB_QueryStatus qs;
-
-    // FIXME: also store 'attributes' in DB!
+    size_t eas;
+    void *ea;
+    const char *birthdate;
+    struct GNUNET_ShortHashCode kyc_prox;
+
+    // FIXME: compute kyc_prox properly!
+    memset (&kyc_prox,
+            0,
+            sizeof (kyc_prox));
+    birthdate = json_string_value (json_object_get (attributes,
+                                                    "birthdate"));
+    TALER_CRYPTO_kyc_attributes_encrypt (&TEH_attribute_key,
+                                         attributes,
+                                         &ea,
+                                         &eas);
+    qs = TEH_plugin->insert_kyc_attributes (
+      TEH_plugin->cls,
+      &kpc->h_payto,
+      &kyc_prox,
+      kpc->provider_section,
+      birthdate,
+      GNUNET_TIME_timestamp_get (),
+      GNUNET_TIME_absolute_to_timestamp (expiration),
+      eas,
+      ea);
+    GNUNET_free (ea);
+    if (GNUNET_DB_STATUS_HARD_ERROR == qs)
+    {
+      GNUNET_break (0);
+      if (NULL != response)
+        MHD_destroy_response (response);
+      kpc->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
+      kpc->response = TALER_MHD_make_error (TALER_EC_GENERIC_DB_STORE_FAILED,
+                                            "insert_kyc_attributes");
+      GNUNET_async_scope_restore (&old_scope);
+      return;
+    }
     qs = TEH_plugin->update_kyc_process_by_row (TEH_plugin->cls,
                                                 kpc->process_row,
                                                 kpc->provider_section,
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 35a6bd6d..6658ee0a 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -1259,13 +1259,13 @@ struct TALER_AgeAttestation
 #endif
 };
 
+
 extern const struct TALER_AgeCommitmentHash TALER_ZeroAgeCommitmentHash;
-#define TALER_AgeCommitmentHash_isNullOrZero(ph) ((NULL == ph) || \
-                                                  (0 == memcmp (ph, \
-                                                                & \
-                                                                
TALER_ZeroAgeCommitmentHash, \
-                                                                sizeof(struct \
-                                                                       
TALER_AgeCommitmentHash))))
+#define TALER_AgeCommitmentHash_isNullOrZero(ph) \
+  ((NULL == ph) ||                               \
+   (0 == memcmp (ph,                             \
+                 &TALER_ZeroAgeCommitmentHash,   \
+                 sizeof(struct TALER_AgeCommitmentHash))))
 
 /**
  * @brief Type of public signing keys for verifying blindly signed coins.

-- 
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]