gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] branch master updated: more traits


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated: more traits
Date: Sun, 21 Jan 2018 16:01:15 +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 6ba7747  more traits
6ba7747 is described below

commit 6ba7747ac332d71465ff94b04f44f06c32477145
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Jan 21 16:01:08 2018 +0100

    more traits
---
 src/exchange-lib/Makefile.am                       |  9 ++-
 .../testing_api_cmd_fakebank_transfer.c            | 30 ++++++---
 ...oin_priv.c => testing_api_trait_blinding_key.c} | 28 ++++----
 src/exchange-lib/testing_api_trait_coin_priv.c     |  2 +-
 ...t_coin_priv.c => testing_api_trait_denom_pub.c} | 26 ++++----
 ...t_coin_priv.c => testing_api_trait_denom_sig.c} | 28 ++++----
 src/include/taler_testing_lib.h                    | 75 ++++++++++++++++++++++
 7 files changed, 143 insertions(+), 55 deletions(-)

diff --git a/src/exchange-lib/Makefile.am b/src/exchange-lib/Makefile.am
index 202e52a..797337f 100644
--- a/src/exchange-lib/Makefile.am
+++ b/src/exchange-lib/Makefile.am
@@ -39,11 +39,14 @@ libtalertesting_la_LDFLAGS = \
   -version-info 0:0:0 \
   -no-undefined
 libtalertesting_la_SOURCES = \
+  testing_api_cmd_fakebank_transfer.c \
   testing_api_loop.c \
   testing_api_traits.c \
-  testing_api_cmd_fakebank_transfer.c \
-  testing_api_trait_reserve_priv.c \
-  testing_api_trait_coin_priv.c
+  testing_api_trait_blinding_key.c \
+  testing_api_trait_coin_priv.c \
+  testing_api_trait_denom_pub.c \
+  testing_api_trait_denom_sig.c \
+  testing_api_trait_reserve_priv.c
 
 libtalertesting_la_LIBADD = \
   $(top_builddir)/src/json/libtalerjson.la \
diff --git a/src/exchange-lib/testing_api_cmd_fakebank_transfer.c 
b/src/exchange-lib/testing_api_cmd_fakebank_transfer.c
index a5f5be3..588eb67 100644
--- a/src/exchange-lib/testing_api_cmd_fakebank_transfer.c
+++ b/src/exchange-lib/testing_api_cmd_fakebank_transfer.c
@@ -157,27 +157,37 @@ fakebank_transfer_run (void *cls,
   else
   {
     /* Use reserve public key as subject */
-#if FIXME_NEEDS_TRAIT
     if (NULL != fts->reserve_reference)
     {
-      ref = find_command (is,
-                          fts->reserve_reference);
-      GNUNET_assert (NULL != ref);
-      GNUNET_assert (OC_ADMIN_ADD_INCOMING == ref->oc);
-      // FIXME: needs trait...
-      fts->reserve_priv = ref->details.admin_add_incoming.reserve_priv;
+      const struct TALER_TESTING_Command *ref;
+      struct TALER_ReservePrivateKeyP *reserve_priv;
+
+      ref = TALER_TESTING_interpreter_lookup_command (is,
+                                                      fts->reserve_reference);
+      if (NULL == ref)
+      {
+        GNUNET_break (0);
+        TALER_TESTING_interpreter_fail (is);
+        return;
+      }
+      if (GNUNET_OK !=
+          TALER_TESTING_get_trait_reserve_priv (ref,
+                                                NULL,
+                                                &reserve_priv))
+      {
+        GNUNET_break (0);
+        TALER_TESTING_interpreter_fail (is);
+        return;
+      }
     }
     else
     {
-#endif
       struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
 
       priv = GNUNET_CRYPTO_eddsa_key_create ();
       fts->reserve_priv.eddsa_priv = *priv;
       GNUNET_free (priv);
-#if FIXME_NEEDS_TRAIT
     }
-#endif
     GNUNET_CRYPTO_eddsa_key_get_public (&fts->reserve_priv.eddsa_priv,
                                         &reserve_pub.eddsa_pub);
     subject = GNUNET_STRINGS_data_to_string_alloc (&reserve_pub,
diff --git a/src/exchange-lib/testing_api_trait_coin_priv.c 
b/src/exchange-lib/testing_api_trait_blinding_key.c
similarity index 61%
copy from src/exchange-lib/testing_api_trait_coin_priv.c
copy to src/exchange-lib/testing_api_trait_blinding_key.c
index 0c10ee2..d23fd93 100644
--- a/src/exchange-lib/testing_api_trait_coin_priv.c
+++ b/src/exchange-lib/testing_api_trait_blinding_key.c
@@ -15,7 +15,7 @@
   <http://www.gnu.org/licenses/>
 */
 /**
- * @file exchange-lib/testing_api_traits.c
+ * @file exchange-lib/testing_api_trait_blinding_key.c
  * @brief main interpreter loop for testcases
  * @author Christian Grothoff
  * @author Marcello Stanisci
@@ -27,41 +27,41 @@
 #include "taler_signatures.h"
 #include "taler_testing_lib.h"
 
-#define TALER_TESTING_TRAIT_COIN_PRIVATE_KEY "coin-private-key"
+#define TALER_TESTING_TRAIT_BLINDING_KEY "blinding-key"
 
 
 /**
- * Obtain a coin private key from a @a cmd.
+ * Obtain a blinding key from a @a cmd.
  *
  * @param cmd command to extract trait from
  * @param selector which coin to pick if @a cmd has multiple on offer
- * @param coin_priv[out] set to the private key of the coin
+ * @param blinding_key[out] set to the blinding key of the coin
  * @return #GNUNET_OK on success
  */
 int
-TALER_TESTING_get_trait_coin_priv (const struct TALER_TESTING_Command *cmd,
-                                   const char *selector,
-                                   struct TALER_CoinSpendPrivateKeyP 
**coin_priv)
+TALER_TESTING_get_trait_blinding_key (const struct TALER_TESTING_Command *cmd,
+                                      const char *selector,
+                                      struct TALER_DenominationBlindingKeyP 
**blinding_key)
 {
   return cmd->traits (cmd->cls,
-                      (void **) coin_priv,
-                      TALER_TESTING_TRAIT_COIN_PRIVATE_KEY,
+                      (void **) blinding_key,
+                      TALER_TESTING_TRAIT_BLINDING_KEY,
                       selector);
 }
 
 
 struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_coin_priv (const char *selector,
-                                    const struct TALER_CoinSpendPrivateKeyP 
*coin_priv)
+TALER_TESTING_make_trait_blinding_key (const char *selector,
+                                       const struct 
TALER_DenominationBlindingKeyP *blinding_key)
 {
   struct TALER_TESTING_Trait ret = {
     .selector = selector,
-    .trait_name = TALER_TESTING_TRAIT_COIN_PRIVATE_KEY,
-    .ptr = (const void *) coin_priv
+    .trait_name = TALER_TESTING_TRAIT_BLINDING_KEY,
+    .ptr = (const void *) blinding_key
   };
 
   return ret;
 }
 
 
-/* end of testing_api_trait_coin_priv.c */
+/* end of testing_api_trait_blinding_key.c */
diff --git a/src/exchange-lib/testing_api_trait_coin_priv.c 
b/src/exchange-lib/testing_api_trait_coin_priv.c
index 0c10ee2..6ec4170 100644
--- a/src/exchange-lib/testing_api_trait_coin_priv.c
+++ b/src/exchange-lib/testing_api_trait_coin_priv.c
@@ -15,7 +15,7 @@
   <http://www.gnu.org/licenses/>
 */
 /**
- * @file exchange-lib/testing_api_traits.c
+ * @file exchange-lib/testing_api_trait_coin_priv.c
  * @brief main interpreter loop for testcases
  * @author Christian Grothoff
  * @author Marcello Stanisci
diff --git a/src/exchange-lib/testing_api_trait_coin_priv.c 
b/src/exchange-lib/testing_api_trait_denom_pub.c
similarity index 65%
copy from src/exchange-lib/testing_api_trait_coin_priv.c
copy to src/exchange-lib/testing_api_trait_denom_pub.c
index 0c10ee2..3113818 100644
--- a/src/exchange-lib/testing_api_trait_coin_priv.c
+++ b/src/exchange-lib/testing_api_trait_denom_pub.c
@@ -15,7 +15,7 @@
   <http://www.gnu.org/licenses/>
 */
 /**
- * @file exchange-lib/testing_api_traits.c
+ * @file exchange-lib/testing_api_trait_denom_pub.c
  * @brief main interpreter loop for testcases
  * @author Christian Grothoff
  * @author Marcello Stanisci
@@ -27,41 +27,41 @@
 #include "taler_signatures.h"
 #include "taler_testing_lib.h"
 
-#define TALER_TESTING_TRAIT_COIN_PRIVATE_KEY "coin-private-key"
+#define TALER_TESTING_TRAIT_DENOM_PUB "denomination-public-key"
 
 
 /**
- * Obtain a coin private key from a @a cmd.
+ * Obtain a denomination public key from a @a cmd.
  *
  * @param cmd command to extract trait from
  * @param selector which coin to pick if @a cmd has multiple on offer
- * @param coin_priv[out] set to the private key of the coin
+ * @param denom_pub[out] set to the blinding key of the coin
  * @return #GNUNET_OK on success
  */
 int
-TALER_TESTING_get_trait_coin_priv (const struct TALER_TESTING_Command *cmd,
+TALER_TESTING_get_trait_denom_pub (const struct TALER_TESTING_Command *cmd,
                                    const char *selector,
-                                   struct TALER_CoinSpendPrivateKeyP 
**coin_priv)
+                                   struct TALER_EXCHANGE_DenomPublicKey 
**denom_pub)
 {
   return cmd->traits (cmd->cls,
-                      (void **) coin_priv,
-                      TALER_TESTING_TRAIT_COIN_PRIVATE_KEY,
+                      (void **) denom_pub,
+                      TALER_TESTING_TRAIT_DENOM_PUB,
                       selector);
 }
 
 
 struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_coin_priv (const char *selector,
-                                    const struct TALER_CoinSpendPrivateKeyP 
*coin_priv)
+TALER_TESTING_make_trait_denom_pub (const char *selector,
+                                    const struct TALER_EXCHANGE_DenomPublicKey 
*denom_pub)
 {
   struct TALER_TESTING_Trait ret = {
     .selector = selector,
-    .trait_name = TALER_TESTING_TRAIT_COIN_PRIVATE_KEY,
-    .ptr = (const void *) coin_priv
+    .trait_name = TALER_TESTING_TRAIT_DENOM_PUB,
+    .ptr = (const void *) denom_pub
   };
 
   return ret;
 }
 
 
-/* end of testing_api_trait_coin_priv.c */
+/* end of testing_api_trait_denom_pub.c */
diff --git a/src/exchange-lib/testing_api_trait_coin_priv.c 
b/src/exchange-lib/testing_api_trait_denom_sig.c
similarity index 62%
copy from src/exchange-lib/testing_api_trait_coin_priv.c
copy to src/exchange-lib/testing_api_trait_denom_sig.c
index 0c10ee2..66785c7 100644
--- a/src/exchange-lib/testing_api_trait_coin_priv.c
+++ b/src/exchange-lib/testing_api_trait_denom_sig.c
@@ -15,7 +15,7 @@
   <http://www.gnu.org/licenses/>
 */
 /**
- * @file exchange-lib/testing_api_traits.c
+ * @file exchange-lib/testing_api_trait_denom_sig.c
  * @brief main interpreter loop for testcases
  * @author Christian Grothoff
  * @author Marcello Stanisci
@@ -27,41 +27,41 @@
 #include "taler_signatures.h"
 #include "taler_testing_lib.h"
 
-#define TALER_TESTING_TRAIT_COIN_PRIVATE_KEY "coin-private-key"
+#define TALER_TESTING_TRAIT_DENOM_SIG "denomination-signature"
 
 
 /**
- * Obtain a coin private key from a @a cmd.
+ * Obtain a denomination signature from a @a cmd.
  *
  * @param cmd command to extract trait from
- * @param selector which coin to pick if @a cmd has multiple on offer
- * @param coin_priv[out] set to the private key of the coin
+ * @param selector which signature to pick if @a cmd has multiple on offer
+ * @param denom_sig[out] set to the signature
  * @return #GNUNET_OK on success
  */
 int
-TALER_TESTING_get_trait_coin_priv (const struct TALER_TESTING_Command *cmd,
+TALER_TESTING_get_trait_denom_sig (const struct TALER_TESTING_Command *cmd,
                                    const char *selector,
-                                   struct TALER_CoinSpendPrivateKeyP 
**coin_priv)
+                                   struct TALER_DenominationSignature 
**denom_sig)
 {
   return cmd->traits (cmd->cls,
-                      (void **) coin_priv,
-                      TALER_TESTING_TRAIT_COIN_PRIVATE_KEY,
+                      (void **) denom_sig,
+                      TALER_TESTING_TRAIT_DENOM_SIG,
                       selector);
 }
 
 
 struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_coin_priv (const char *selector,
-                                    const struct TALER_CoinSpendPrivateKeyP 
*coin_priv)
+TALER_TESTING_make_trait_denom_sig (const char *selector,
+                                    const struct TALER_DenominationSignature 
*denom_sig)
 {
   struct TALER_TESTING_Trait ret = {
     .selector = selector,
-    .trait_name = TALER_TESTING_TRAIT_COIN_PRIVATE_KEY,
-    .ptr = (const void *) coin_priv
+    .trait_name = TALER_TESTING_TRAIT_DENOM_SIG,
+    .ptr = (const void *) denom_sig
   };
 
   return ret;
 }
 
 
-/* end of testing_api_trait_coin_priv.c */
+/* end of testing_api_trait_denom_sig.c */
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index b998bf3..974172c 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -257,6 +257,81 @@ TALER_TESTING_get_trait_coin_priv (const struct 
TALER_TESTING_Command *cmd,
 
 
 
+/**
+ * @param selector
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_blinding_key (const char *selector,
+                                       const struct 
TALER_DenominationBlindingKeyP *blinding_key);
+
+
+/**
+ * Obtain a coin's blinding key from a @a cmd.
+ *
+ * @param cmd command to extract trait from
+ * @param selector which coin to pick if @a cmd has multiple on offer
+ * @param blinding_key[out] set to the blinding key of the coin
+ * @return #GNUNET_OK on success
+ */
+int
+TALER_TESTING_get_trait_blinding_key (const struct TALER_TESTING_Command *cmd,
+                                      const char *selector,
+                                      struct TALER_DenominationBlindingKeyP 
**blinding_key);
+
+
+
+
+/**
+ * @param selector
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_denom_pub (const char *selector,
+                                    const struct TALER_EXCHANGE_DenomPublicKey 
*dpk);
+
+
+/**
+ * Obtain a coin private key from a @a cmd.
+ *
+ * @param cmd command to extract trait from
+ * @param selector which coin to pick if @a cmd has multiple on offer
+ * @param dpk[out] set to a denomination key of the coin
+ * @return #GNUNET_OK on success
+ */
+int
+TALER_TESTING_get_trait_denom_pub (const struct TALER_TESTING_Command *cmd,
+                                   const char *selector,
+                                   struct TALER_EXCHANGE_DenomPublicKey **dpk);
+
+
+/**
+ * Obtain a coin denomination signature from a @a cmd.
+ *
+ * @param cmd command to extract trait from
+ * @param selector which coin to pick if @a cmd has multiple on offer
+ * @param sig[out] set to a denomination signature over the coin
+ * @return #GNUNET_OK on success
+ */
+int
+TALER_TESTING_get_trait_denom_sig (const struct TALER_TESTING_Command *cmd,
+                                   const char *selector,
+                                   struct TALER_DenominationSignature **dpk);
+
+
+/**
+ * @param selector
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_denom_sig (const char *selector,
+                                    const struct TALER_DenominationSignature 
*sig);
+
+
+
+
+
+
+
+
+
 
 
 #endif

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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