gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: age restriction support in excha


From: gnunet
Subject: [taler-exchange] branch master updated: age restriction support in exchange_api_purse_create_with_deposit added
Date: Mon, 27 Jun 2022 14:11:49 +0200

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

oec pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 87025cfd age restriction support in 
exchange_api_purse_create_with_deposit added
87025cfd is described below

commit 87025cfd178780f2e928019163ce81c1b7675c57
Author: Özgür Kesim <oec-taler@kesim.org>
AuthorDate: Mon Jun 27 14:11:46 2022 +0200

    age restriction support in exchange_api_purse_create_with_deposit added
---
 src/include/taler_exchange_service.h               |  6 ++--
 src/lib/exchange_api_purse_create_with_deposit.c   | 35 +++++++++++-----------
 src/testing/testing_api_cmd_purse_create_deposit.c | 10 +------
 src/testing/testing_api_cmd_purse_deposit.c        | 10 +------
 4 files changed, 22 insertions(+), 39 deletions(-)

diff --git a/src/include/taler_exchange_service.h 
b/src/include/taler_exchange_service.h
index ae48e0c5..328e68fe 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -4516,12 +4516,10 @@ struct TALER_EXCHANGE_PurseCreateDepositHandle;
  */
 struct TALER_EXCHANGE_PurseDeposit
 {
-#if FIXME_OEC
   /**
-   * Age commitment data.
+   * Age commitment data, might be NULL.
    */
-  struct TALER_AgeCommitment age_commitment;
-#endif
+  const struct TALER_AgeCommitmentProof *age_commitment_proof;
 
   /**
    * Private key of the coin.
diff --git a/src/lib/exchange_api_purse_create_with_deposit.c 
b/src/lib/exchange_api_purse_create_with_deposit.c
index f2d80b94..fa1de60b 100644
--- a/src/lib/exchange_api_purse_create_with_deposit.c
+++ b/src/lib/exchange_api_purse_create_with_deposit.c
@@ -568,28 +568,31 @@ TALER_EXCHANGE_purse_create_with_deposit (
   for (unsigned int i = 0; i<num_deposits; i++)
   {
     const struct TALER_EXCHANGE_PurseDeposit *deposit = &deposits[i];
+    const struct TALER_AgeCommitmentProof *acp = deposit->age_commitment_proof;
     struct Deposit *d = &pch->deposits[i];
     json_t *jdeposit;
-#if FIXME_OEC
     struct TALER_AgeCommitmentHash agh;
     struct TALER_AgeCommitmentHash *aghp = NULL;
     struct TALER_AgeAttestation attest;
+    struct TALER_AgeAttestation *attestp = NULL;
 
-    TALER_age_commitment_hash (&deposit->age_commitment,
-                               &agh);
-    aghp = &agh;
-    if (GNUNET_OK !=
-        TALER_age_commitment_attest (&deposit->age_proof,
-                                     min_age,
-                                     &attest))
+    if (NULL != acp)
     {
-      GNUNET_break (0);
-      json_decref (deposit_arr);
-      GNUNET_free (url);
-      GNUNET_free (pch);
-      return NULL;
+      TALER_age_commitment_hash (&acp->commitment,
+                                 &agh);
+      aghp = &agh;
+      if (GNUNET_OK !=
+          TALER_age_commitment_attest (acp,
+                                       min_age,
+                                       &attest))
+      {
+        GNUNET_break (0);
+        json_decref (deposit_arr);
+        GNUNET_free (url);
+        GNUNET_free (pch);
+        return NULL;
+      }
     }
-#endif
     d->contribution = deposit->amount;
     d->h_denom_pub = deposit->h_denom_pub;
     GNUNET_CRYPTO_eddsa_key_get_public (&deposit->coin_priv.eddsa_priv,
@@ -601,14 +604,12 @@ TALER_EXCHANGE_purse_create_with_deposit (
       &deposit->coin_priv,
       &d->coin_sig);
     jdeposit = GNUNET_JSON_PACK (
-#if FIXME_OEC
       GNUNET_JSON_pack_allow_null (
         GNUNET_JSON_pack_data_auto ("h_age_commitment",
                                     aghp)),
       GNUNET_JSON_pack_allow_null (
         GNUNET_JSON_pack_data_auto ("age_attestation",
-                                    &attest)),
-#endif
+                                    attestp)),
       TALER_JSON_pack_amount ("amount",
                               &deposit->amount),
       GNUNET_JSON_pack_data_auto ("denom_pub_hash",
diff --git a/src/testing/testing_api_cmd_purse_create_deposit.c 
b/src/testing/testing_api_cmd_purse_create_deposit.c
index ef98c905..c49c4bbb 100644
--- a/src/testing/testing_api_cmd_purse_create_deposit.c
+++ b/src/testing/testing_api_cmd_purse_create_deposit.c
@@ -207,7 +207,6 @@ deposit_run (void *cls,
     const struct TALER_TESTING_Command *coin_cmd;
     const struct TALER_CoinSpendPrivateKeyP *coin_priv;
     const struct TALER_AgeCommitmentProof *age_commitment_proof = NULL;
-    struct TALER_AgeCommitmentHash h_age_commitment = {0};
     const struct TALER_EXCHANGE_DenomPublicKey *denom_pub;
     const struct TALER_DenominationSignature *denom_pub_sig;
 
@@ -242,14 +241,7 @@ deposit_run (void *cls,
       TALER_TESTING_interpreter_fail (is);
       return;
     }
-    if (NULL != age_commitment_proof)
-    {
-      TALER_age_commitment_hash (&age_commitment_proof->commitment,
-                                 &h_age_commitment);
-    }
-#if FIXME_OEC
-    pd->age_commitment = *h_age_commitment;
-#endif
+    pd->age_commitment_proof = age_commitment_proof;
     pd->denom_sig = *denom_pub_sig;
     pd->coin_priv = *coin_priv;
     pd->amount = cr->deposit_with_fee;
diff --git a/src/testing/testing_api_cmd_purse_deposit.c 
b/src/testing/testing_api_cmd_purse_deposit.c
index 57cc48cf..b10c6d32 100644
--- a/src/testing/testing_api_cmd_purse_deposit.c
+++ b/src/testing/testing_api_cmd_purse_deposit.c
@@ -286,7 +286,6 @@ deposit_run (void *cls,
     const struct TALER_TESTING_Command *coin_cmd;
     const struct TALER_CoinSpendPrivateKeyP *coin_priv;
     const struct TALER_AgeCommitmentProof *age_commitment_proof = NULL;
-    struct TALER_AgeCommitmentHash h_age_commitment = {0};
     const struct TALER_EXCHANGE_DenomPublicKey *denom_pub;
     const struct TALER_DenominationSignature *denom_pub_sig;
 
@@ -321,14 +320,7 @@ deposit_run (void *cls,
       TALER_TESTING_interpreter_fail (is);
       return;
     }
-    if (NULL != age_commitment_proof)
-    {
-      TALER_age_commitment_hash (&age_commitment_proof->commitment,
-                                 &h_age_commitment);
-    }
-#if FIXME_OEC
-    pd->age_commitment = *h_age_commitment;
-#endif
+    pd->age_commitment_proof = age_commitment_proof;
     pd->denom_sig = *denom_pub_sig;
     pd->coin_priv = *coin_priv;
     pd->amount = cr->deposit_with_fee;

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