gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] 04/04: cmd to add/del wire methods from list of account


From: gnunet
Subject: [taler-exchange] 04/04: cmd to add/del wire methods from list of accounts
Date: Fri, 27 Nov 2020 00:05:46 +0100

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

grothoff pushed a commit to branch master
in repository exchange.

commit 1e6091d1dd8ac9886d44969d3756868a4a359780
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Nov 27 00:05:34 2020 +0100

    cmd to add/del wire methods from list of accounts
---
 src/include/taler_exchange_service.h               |  10 +-
 src/include/taler_signatures.h                     |  72 +++++++++-
 src/include/taler_testing_lib.h                    |  12 +-
 src/lib/exchange_api_management_wire_disable.c     |   2 +-
 src/lib/exchange_api_management_wire_enable.c      |  20 +--
 src/testing/Makefile.am                            |   2 +
 src/testing/testing_api_cmd_auditor_add.c          |   2 +-
 src/testing/testing_api_cmd_auditor_del.c          |   2 +-
 ...md_auditor_del.c => testing_api_cmd_wire_add.c} | 155 +++++++++------------
 ...md_auditor_del.c => testing_api_cmd_wire_del.c} | 130 +++++++----------
 10 files changed, 217 insertions(+), 190 deletions(-)

diff --git a/src/include/taler_exchange_service.h 
b/src/include/taler_exchange_service.h
index 8a5ba311..4ad05a68 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -2451,7 +2451,10 @@ struct TALER_EXCHANGE_ManagementWireEnableHandle;
  * @param salt salt to use when hashing the account for the signature
  * @param payto_uri RFC 8905 URI of the exchange's bank account
  * @param validity_start when was this decided?
- * @param master_sig signature affirming the wire addition
+ * @param master_sig1 signature affirming the wire addition
+ *        of purpose #TALER_SIGNATURE_MASTER_ADD_WIRE
+ * @param master_sig2 signature affirming the validity of the account for 
clients;
+ *        of purpose #TALER_SIGNATURE_MASTER_WIRE_DETAILS.
  * @param cb function to call with the exchange's result
  * @param cb_cls closure for @a cb
  * @return the request handle; NULL upon error
@@ -2460,10 +2463,10 @@ struct TALER_EXCHANGE_ManagementWireEnableHandle *
 TALER_EXCHANGE_management_enable_wire (
   struct GNUNET_CURL_Context *ctx,
   const char *url,
-  const char *salt,
   const char *payto_uri,
   struct GNUNET_TIME_Absolute validity_start,
-  const struct TALER_MasterSignatureP *master_sig,
+  const struct TALER_MasterSignatureP *master_sig1,
+  const struct TALER_MasterSignatureP *master_sig2,
   TALER_EXCHANGE_ManagementWireEnableCallback cb,
   void *cb_cls);
 
@@ -2504,6 +2507,7 @@ struct TALER_EXCHANGE_ManagementWireDisableHandle;
  * @param payto_uri RFC 8905 URI of the exchange's bank account
  * @param validity_end when was this decided?
  * @param master_sig signature affirming the wire addition
+ *        of purpose #TALER_SIGNATURE_MASTER_DEL_WIRE
  * @param cb function to call with the exchange's result
  * @param cb_cls closure for @a cb
  * @return the request handle; NULL upon error
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index e732f13b..90d77244 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -46,6 +46,21 @@
 /* Exchange offline signatures (with master key) */
 /*********************************************/
 
+/**
+ * The given revocation key was revoked and must no longer be used.
+ */
+#define TALER_SIGNATURE_MASTER_SIGNING_KEY_REVOKED 1020
+
+/**
+ * Add payto URI to the list of our wire methods.
+ */
+#define TALER_SIGNATURE_MASTER_ADD_WIRE 1021
+
+/**
+ * Remove payto URI from the list of our wire methods.
+ */
+#define TALER_SIGNATURE_MASTER_DEL_WIRE 1023
+
 /**
  * Purpose for signing public keys signed by the exchange master key.
  */
@@ -806,7 +821,7 @@ struct TALER_ExchangeKeySetPS
  * @brief Signature made by the exchange offline key over the information of
  * an auditor to be added to the exchange's set of auditors.
  */
-struct TALER_ExchangeAddAuditorPS
+struct TALER_MasterAddAuditorPS
 {
 
   /**
@@ -834,9 +849,9 @@ struct TALER_ExchangeAddAuditorPS
 
 /**
  * @brief Signature made by the exchange offline key over the information of
- * an auditor to be removed to the exchange's set of auditors.
+ * an auditor to be removed from the exchange's set of auditors.
  */
-struct TALER_ExchangeDelAuditorPS
+struct TALER_MasterDelAuditorPS
 {
 
   /**
@@ -858,6 +873,57 @@ struct TALER_ExchangeDelAuditorPS
 };
 
 
+/**
+ * @brief Signature made by the exchange offline key over the information of
+ * a payto:// URI to be added to the exchange's set of active wire accounts.
+ */
+struct TALER_MasterAddWirePS
+{
+
+  /**
+   * Purpose is #TALER_SIGNATURE_MASTER_ADD_WIRE.   Signed
+   * by a `struct TALER_MasterPublicKeyP` using EdDSA.
+   */
+  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
+
+  /**
+   * Time of the change.
+   */
+  struct GNUNET_TIME_AbsoluteNBO start_date;
+
+  /**
+   * Hash over the exchange's payto URI.
+   */
+  struct GNUNET_HashCode h_wire GNUNET_PACKED;
+};
+
+
+/**
+ * @brief Signature made by the exchange offline key over the information of
+ * a  wire method to be removed to the exchange's set of active accounts.
+ */
+struct TALER_MasterDelWirePS
+{
+
+  /**
+   * Purpose is #TALER_SIGNATURE_MASTER_DEL_WIRE.   Signed
+   * by a `struct TALER_MasterPublicKeyP` using EdDSA.
+   */
+  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
+
+  /**
+   * Time of the change.
+   */
+  struct GNUNET_TIME_AbsoluteNBO end_date;
+
+  /**
+   * Hash over the exchange's payto URI.
+   */
+  struct GNUNET_HashCode h_wire GNUNET_PACKED;
+
+};
+
+
 /**
  * @brief Information about a denomination key. Denomination keys
  * are used to sign coins of a certain value into existence.
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index b89a775e..05172644 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -2057,11 +2057,15 @@ TALER_TESTING_cmd_auditor_del (const char *label,
  *
  * @param label command label.
  * @param payto_uri URI identifying the bank account
+ * @param expected_http_status expected HTTP status from exchange
+ * @param bad_sig should we use a bogus signature?
  * @return the command
  */
 struct TALER_TESTING_Command
 TALER_TESTING_cmd_wire_add (const char *label,
-                            const char *payto_uri);
+                            const char *payto_uri,
+                            unsigned int expected_http_status,
+                            bool bad_sig);
 
 
 /**
@@ -2070,11 +2074,15 @@ TALER_TESTING_cmd_wire_add (const char *label,
  *
  * @param label command label.
  * @param payto_uri URI identifying the bank account
+ * @param expected_http_status expected HTTP status from exchange
+ * @param bad_sig should we use a bogus signature?
  * @return the command
  */
 struct TALER_TESTING_Command
 TALER_TESTING_cmd_wire_del (const char *label,
-                            const char *payto_uri);
+                            const char *payto_uri,
+                            unsigned int expected_http_status,
+                            bool bad_sig);
 
 
 /**
diff --git a/src/lib/exchange_api_management_wire_disable.c 
b/src/lib/exchange_api_management_wire_disable.c
index b510970a..157d146b 100644
--- a/src/lib/exchange_api_management_wire_disable.c
+++ b/src/lib/exchange_api_management_wire_disable.c
@@ -152,7 +152,7 @@ TALER_EXCHANGE_management_disable_wire (
   body = json_pack ("{s:s, s:o, s:o}",
                     "payto_uri",
                     payto_uri,
-                    "master_sig",
+                    "master_sig_del",
                     GNUNET_JSON_from_data_auto (master_sig),
                     "validity_end",
                     GNUNET_JSON_from_time_abs (validity_end));
diff --git a/src/lib/exchange_api_management_wire_enable.c 
b/src/lib/exchange_api_management_wire_enable.c
index 298fe5d2..9de52fe0 100644
--- a/src/lib/exchange_api_management_wire_enable.c
+++ b/src/lib/exchange_api_management_wire_enable.c
@@ -122,10 +122,12 @@ handle_auditor_enable_finished (void *cls,
  *
  * @param ctx the context
  * @param url HTTP base URL for the exchange
- * @param salt salt to use when hashing the account for the signature
  * @param payto_uri RFC 8905 URI of the exchange's bank account
  * @param validity_start when was this decided?
- * @param master_sig signature affirming the wire addition
+ * @param master_sig1 signature affirming the wire addition
+ *        of purpose #TALER_SIGNATURE_MASTER_ADD_WIRE
+ * @param master_sig2 signature affirming the validity of the account for 
clients;
+ *        of purpose #TALER_SIGNATURE_MASTER_WIRE_DETAILS.
  * @param cb function to call with the exchange's result
  * @param cb_cls closure for @a cb
  * @return the request handle; NULL upon error
@@ -134,10 +136,10 @@ struct TALER_EXCHANGE_ManagementWireEnableHandle *
 TALER_EXCHANGE_management_enable_wire (
   struct GNUNET_CURL_Context *ctx,
   const char *url,
-  const char *salt,
   const char *payto_uri,
   struct GNUNET_TIME_Absolute validity_start,
-  const struct TALER_MasterSignatureP *master_sig,
+  const struct TALER_MasterSignatureP *master_sig1,
+  const struct TALER_MasterSignatureP *master_sig2,
   TALER_EXCHANGE_ManagementWireEnableCallback cb,
   void *cb_cls)
 {
@@ -159,13 +161,13 @@ TALER_EXCHANGE_management_enable_wire (
     GNUNET_free (wh);
     return NULL;
   }
-  body = json_pack ("{s:s, s:s, s:o, s:o}",
+  body = json_pack ("{s:s, s:s, s:o, s:o, s:o}",
                     "payto_uri",
                     payto_uri,
-                    "salt",
-                    salt,
-                    "master_sig",
-                    GNUNET_JSON_from_data_auto (master_sig),
+                    "master_sig_add",
+                    GNUNET_JSON_from_data_auto (master_sig1),
+                    "master_sig_wire",
+                    GNUNET_JSON_from_data_auto (master_sig2),
                     "validity_start",
                     GNUNET_JSON_from_time_abs (validity_start));
   if (NULL == body)
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index 1c55e30f..0850f842 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -73,6 +73,8 @@ libtalertesting_la_SOURCES = \
   testing_api_cmd_transfer_get.c \
   testing_api_cmd_wait.c \
   testing_api_cmd_wire.c \
+  testing_api_cmd_wire_add.c \
+  testing_api_cmd_wire_del.c \
   testing_api_cmd_withdraw.c \
   testing_api_helpers_auditor.c \
   testing_api_helpers_bank.c \
diff --git a/src/testing/testing_api_cmd_auditor_add.c 
b/src/testing/testing_api_cmd_auditor_add.c
index 5112d1fb..0a37c73d 100644
--- a/src/testing/testing_api_cmd_auditor_add.c
+++ b/src/testing/testing_api_cmd_auditor_add.c
@@ -218,7 +218,7 @@ auditor_add_run (void *cls,
 
     /* now sign */
     {
-      struct TALER_ExchangeAddAuditorPS kv = {
+      struct TALER_MasterAddAuditorPS kv = {
         .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_ADD_AUDITOR),
         .purpose.size = htonl (sizeof (kv)),
         .start_date = GNUNET_TIME_absolute_hton (now),
diff --git a/src/testing/testing_api_cmd_auditor_del.c 
b/src/testing/testing_api_cmd_auditor_del.c
index d6685884..11efbd40 100644
--- a/src/testing/testing_api_cmd_auditor_del.c
+++ b/src/testing/testing_api_cmd_auditor_del.c
@@ -200,7 +200,7 @@ auditor_del_run (void *cls,
 
     /* now sign */
     {
-      struct TALER_ExchangeDelAuditorPS kv = {
+      struct TALER_MasterDelAuditorPS kv = {
         .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DEL_AUDITOR),
         .purpose.size = htonl (sizeof (kv)),
         .end_date = GNUNET_TIME_absolute_hton (now),
diff --git a/src/testing/testing_api_cmd_auditor_del.c 
b/src/testing/testing_api_cmd_wire_add.c
similarity index 59%
copy from src/testing/testing_api_cmd_auditor_del.c
copy to src/testing/testing_api_cmd_wire_add.c
index d6685884..0384e78a 100644
--- a/src/testing/testing_api_cmd_auditor_del.c
+++ b/src/testing/testing_api_cmd_wire_add.c
@@ -17,8 +17,8 @@
   <http://www.gnu.org/licenses/>
 */
 /**
- * @file testing/testing_api_cmd_auditor_del.c
- * @brief command for testing /management/auditor/disable.
+ * @file testing/testing_api_cmd_wire_add.c
+ * @brief command for testing POST to /management/wire
  * @author Christian Grothoff
  */
 #include "platform.h"
@@ -30,21 +30,26 @@
 
 
 /**
- * State for a "auditor_del" CMD.
+ * State for a "wire_add" CMD.
  */
-struct AuditorDelState
+struct WireAddState
 {
 
   /**
-   * Auditor enable handle while operation is running.
+   * Wire enable handle while operation is running.
    */
-  struct TALER_EXCHANGE_ManagementAuditorDisableHandle *dh;
+  struct TALER_EXCHANGE_ManagementWireEnableHandle *dh;
 
   /**
    * Our interpreter.
    */
   struct TALER_TESTING_Interpreter *is;
 
+  /**
+   * Account to add.
+   */
+  const char *payto_uri;
+
   /**
    * Expected HTTP response code.
    */
@@ -58,17 +63,17 @@ struct AuditorDelState
 
 
 /**
- * Callback to analyze the /management/auditors response, just used to check
+ * Callback to analyze the /management/wire response, just used to check
  * if the response code is acceptable.
  *
  * @param cls closure.
  * @param hr HTTP response details
  */
 static void
-auditor_del_cb (void *cls,
-                const struct TALER_EXCHANGE_HttpResponse *hr)
+wire_add_cb (void *cls,
+             const struct TALER_EXCHANGE_HttpResponse *hr)
 {
-  struct AuditorDelState *ds = cls;
+  struct WireAddState *ds = cls;
 
   ds->dh = NULL;
   if (ds->expected_response_code != hr->http_status)
@@ -97,14 +102,14 @@ auditor_del_cb (void *cls,
  * @param is the interpreter state.
  */
 static void
-auditor_del_run (void *cls,
-                 const struct TALER_TESTING_Command *cmd,
-                 struct TALER_TESTING_Interpreter *is)
+wire_add_run (void *cls,
+              const struct TALER_TESTING_Command *cmd,
+              struct TALER_TESTING_Interpreter *is)
 {
-  struct AuditorDelState *ds = cls;
-  struct TALER_AuditorPublicKeyP auditor_pub;
+  struct WireAddState *ds = cls;
   char *exchange_url;
-  struct TALER_MasterSignatureP master_sig;
+  struct TALER_MasterSignatureP master_sig1;
+  struct TALER_MasterSignatureP master_sig2;
   struct GNUNET_TIME_Absolute now;
 
   (void) cmd;
@@ -113,15 +118,17 @@ auditor_del_run (void *cls,
   ds->is = is;
   if (ds->bad_sig)
   {
-    memset (&master_sig,
+    memset (&master_sig1,
             42,
-            sizeof (master_sig));
+            sizeof (master_sig1));
+    memset (&master_sig2,
+            42,
+            sizeof (master_sig2));
   }
   else
   {
     char *fn;
     struct TALER_MasterPrivateKeyP master_priv;
-    struct TALER_AuditorPrivateKeyP auditor_priv;
 
     if (GNUNET_OK !=
         GNUNET_CONFIGURATION_get_value_filename (is->cfg,
@@ -159,58 +166,27 @@ auditor_del_run (void *cls,
     }
     GNUNET_free (fn);
 
-
-    if (GNUNET_OK !=
-        GNUNET_CONFIGURATION_get_value_filename (is->cfg,
-                                                 "auditor",
-                                                 "AUDITOR_PRIV_FILE",
-                                                 &fn))
-    {
-      GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                                 "auditor",
-                                 "AUDITOR_PRIV_FILE");
-      TALER_TESTING_interpreter_next (ds->is);
-      return;
-    }
-    if (GNUNET_SYSERR ==
-        GNUNET_DISK_directory_create_for_file (fn))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Could not setup directory for auditor private key file 
`%s'\n",
-                  fn);
-      GNUNET_free (fn);
-      TALER_TESTING_interpreter_next (ds->is);
-      return;
-    }
-    if (GNUNET_OK !=
-        GNUNET_CRYPTO_eddsa_key_from_file (fn,
-                                           GNUNET_YES,
-                                           &auditor_priv.eddsa_priv))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Could not load auditor private key from `%s'\n",
-                  fn);
-      GNUNET_free (fn);
-      TALER_TESTING_interpreter_next (ds->is);
-      return;
-    }
-    GNUNET_free (fn);
-    GNUNET_CRYPTO_eddsa_key_get_public (&auditor_priv.eddsa_priv,
-                                        &auditor_pub.eddsa_pub);
-
     /* now sign */
     {
-      struct TALER_ExchangeDelAuditorPS kv = {
-        .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DEL_AUDITOR),
+      struct TALER_MasterAddWirePS kv = {
+        .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_ADD_WIRE),
         .purpose.size = htonl (sizeof (kv)),
-        .end_date = GNUNET_TIME_absolute_hton (now),
-        .auditor_pub = auditor_pub,
+        .start_date = GNUNET_TIME_absolute_hton (now),
+      };
+      struct TALER_MasterWireDetailsPS wd = {
+        .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_DETAILS),
+        .purpose.size = htonl (sizeof (wd)),
       };
 
-      /* Finally sign ... */
+      TALER_exchange_wire_signature_hash (ds->payto_uri,
+                                          &kv.h_wire);
+      wd.h_wire_details = kv.h_wire;
       GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv,
                                 &kv,
-                                &master_sig.eddsa_signature);
+                                &master_sig1.eddsa_signature);
+      GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv,
+                                &wd,
+                                &master_sig2.eddsa_signature);
     }
   }
   if (GNUNET_OK !=
@@ -225,13 +201,14 @@ auditor_del_run (void *cls,
     TALER_TESTING_interpreter_next (ds->is);
     return;
   }
-  ds->dh = TALER_EXCHANGE_management_disable_auditor (
+  ds->dh = TALER_EXCHANGE_management_enable_wire (
     is->ctx,
     exchange_url,
-    &auditor_pub,
+    ds->payto_uri,
     now,
-    &master_sig,
-    &auditor_del_cb,
+    &master_sig1,
+    &master_sig2,
+    &wire_add_cb,
     ds);
   GNUNET_free (exchange_url);
   if (NULL == ds->dh)
@@ -244,17 +221,17 @@ auditor_del_run (void *cls,
 
 
 /**
- * Free the state of a "auditor_del" CMD, and possibly cancel a
+ * Free the state of a "wire_add" CMD, and possibly cancel a
  * pending operation thereof.
  *
- * @param cls closure, must be a `struct AuditorDelState`.
+ * @param cls closure, must be a `struct WireAddState`.
  * @param cmd the command which is being cleaned up.
  */
 static void
-auditor_del_cleanup (void *cls,
-                     const struct TALER_TESTING_Command *cmd)
+wire_add_cleanup (void *cls,
+                  const struct TALER_TESTING_Command *cmd)
 {
-  struct AuditorDelState *ds = cls;
+  struct WireAddState *ds = cls;
 
   if (NULL != ds->dh)
   {
@@ -262,7 +239,7 @@ auditor_del_cleanup (void *cls,
                 "Command %u (%s) did not complete\n",
                 ds->is->ip,
                 cmd->label);
-    TALER_EXCHANGE_management_disable_auditor_cancel (ds->dh);
+    TALER_EXCHANGE_management_enable_wire_cancel (ds->dh);
     ds->dh = NULL;
   }
   GNUNET_free (ds);
@@ -270,7 +247,7 @@ auditor_del_cleanup (void *cls,
 
 
 /**
- * Offer internal data from a "auditor_del" CMD, to other commands.
+ * Offer internal data from a "wire_add" CMD, to other commands.
  *
  * @param cls closure.
  * @param[out] ret result.
@@ -280,32 +257,34 @@ auditor_del_cleanup (void *cls,
  * @return #GNUNET_OK on success.
  */
 static int
-auditor_del_traits (void *cls,
-                    const void **ret,
-                    const char *trait,
-                    unsigned int index)
+wire_add_traits (void *cls,
+                 const void **ret,
+                 const char *trait,
+                 unsigned int index)
 {
   return GNUNET_NO;
 }
 
 
 struct TALER_TESTING_Command
-TALER_TESTING_cmd_auditor_del (const char *label,
-                               unsigned int expected_http_status,
-                               bool bad_sig)
+TALER_TESTING_cmd_wire_add (const char *label,
+                            const char *payto_uri,
+                            unsigned int expected_http_status,
+                            bool bad_sig)
 {
-  struct AuditorDelState *ds;
+  struct WireAddState *ds;
 
-  ds = GNUNET_new (struct AuditorDelState);
+  ds = GNUNET_new (struct WireAddState);
   ds->expected_response_code = expected_http_status;
   ds->bad_sig = bad_sig;
+  ds->payto_uri = payto_uri;
   {
     struct TALER_TESTING_Command cmd = {
       .cls = ds,
       .label = label,
-      .run = &auditor_del_run,
-      .cleanup = &auditor_del_cleanup,
-      .traits = &auditor_del_traits
+      .run = &wire_add_run,
+      .cleanup = &wire_add_cleanup,
+      .traits = &wire_add_traits
     };
 
     return cmd;
@@ -313,4 +292,4 @@ TALER_TESTING_cmd_auditor_del (const char *label,
 }
 
 
-/* end of testing_api_cmd_auditor_del.c */
+/* end of testing_api_cmd_wire_add.c */
diff --git a/src/testing/testing_api_cmd_auditor_del.c 
b/src/testing/testing_api_cmd_wire_del.c
similarity index 61%
copy from src/testing/testing_api_cmd_auditor_del.c
copy to src/testing/testing_api_cmd_wire_del.c
index d6685884..06de499a 100644
--- a/src/testing/testing_api_cmd_auditor_del.c
+++ b/src/testing/testing_api_cmd_wire_del.c
@@ -17,8 +17,8 @@
   <http://www.gnu.org/licenses/>
 */
 /**
- * @file testing/testing_api_cmd_auditor_del.c
- * @brief command for testing /management/auditor/disable.
+ * @file testing/testing_api_cmd_wire_del.c
+ * @brief command for testing POST to /management/wire
  * @author Christian Grothoff
  */
 #include "platform.h"
@@ -30,21 +30,26 @@
 
 
 /**
- * State for a "auditor_del" CMD.
+ * State for a "wire_del" CMD.
  */
-struct AuditorDelState
+struct WireDelState
 {
 
   /**
-   * Auditor enable handle while operation is running.
+   * Wire enable handle while operation is running.
    */
-  struct TALER_EXCHANGE_ManagementAuditorDisableHandle *dh;
+  struct TALER_EXCHANGE_ManagementWireDisableHandle *dh;
 
   /**
    * Our interpreter.
    */
   struct TALER_TESTING_Interpreter *is;
 
+  /**
+   * Account to del.
+   */
+  const char *payto_uri;
+
   /**
    * Expected HTTP response code.
    */
@@ -58,17 +63,17 @@ struct AuditorDelState
 
 
 /**
- * Callback to analyze the /management/auditors response, just used to check
+ * Callback to analyze the /management/wire response, just used to check
  * if the response code is acceptable.
  *
  * @param cls closure.
  * @param hr HTTP response details
  */
 static void
-auditor_del_cb (void *cls,
-                const struct TALER_EXCHANGE_HttpResponse *hr)
+wire_del_cb (void *cls,
+             const struct TALER_EXCHANGE_HttpResponse *hr)
 {
-  struct AuditorDelState *ds = cls;
+  struct WireDelState *ds = cls;
 
   ds->dh = NULL;
   if (ds->expected_response_code != hr->http_status)
@@ -97,12 +102,11 @@ auditor_del_cb (void *cls,
  * @param is the interpreter state.
  */
 static void
-auditor_del_run (void *cls,
-                 const struct TALER_TESTING_Command *cmd,
-                 struct TALER_TESTING_Interpreter *is)
+wire_del_run (void *cls,
+              const struct TALER_TESTING_Command *cmd,
+              struct TALER_TESTING_Interpreter *is)
 {
-  struct AuditorDelState *ds = cls;
-  struct TALER_AuditorPublicKeyP auditor_pub;
+  struct WireDelState *ds = cls;
   char *exchange_url;
   struct TALER_MasterSignatureP master_sig;
   struct GNUNET_TIME_Absolute now;
@@ -121,7 +125,6 @@ auditor_del_run (void *cls,
   {
     char *fn;
     struct TALER_MasterPrivateKeyP master_priv;
-    struct TALER_AuditorPrivateKeyP auditor_priv;
 
     if (GNUNET_OK !=
         GNUNET_CONFIGURATION_get_value_filename (is->cfg,
@@ -159,55 +162,16 @@ auditor_del_run (void *cls,
     }
     GNUNET_free (fn);
 
-
-    if (GNUNET_OK !=
-        GNUNET_CONFIGURATION_get_value_filename (is->cfg,
-                                                 "auditor",
-                                                 "AUDITOR_PRIV_FILE",
-                                                 &fn))
-    {
-      GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                                 "auditor",
-                                 "AUDITOR_PRIV_FILE");
-      TALER_TESTING_interpreter_next (ds->is);
-      return;
-    }
-    if (GNUNET_SYSERR ==
-        GNUNET_DISK_directory_create_for_file (fn))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Could not setup directory for auditor private key file 
`%s'\n",
-                  fn);
-      GNUNET_free (fn);
-      TALER_TESTING_interpreter_next (ds->is);
-      return;
-    }
-    if (GNUNET_OK !=
-        GNUNET_CRYPTO_eddsa_key_from_file (fn,
-                                           GNUNET_YES,
-                                           &auditor_priv.eddsa_priv))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Could not load auditor private key from `%s'\n",
-                  fn);
-      GNUNET_free (fn);
-      TALER_TESTING_interpreter_next (ds->is);
-      return;
-    }
-    GNUNET_free (fn);
-    GNUNET_CRYPTO_eddsa_key_get_public (&auditor_priv.eddsa_priv,
-                                        &auditor_pub.eddsa_pub);
-
     /* now sign */
     {
-      struct TALER_ExchangeDelAuditorPS kv = {
-        .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DEL_AUDITOR),
+      struct TALER_MasterDelWirePS kv = {
+        .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DEL_WIRE),
         .purpose.size = htonl (sizeof (kv)),
         .end_date = GNUNET_TIME_absolute_hton (now),
-        .auditor_pub = auditor_pub,
       };
 
-      /* Finally sign ... */
+      TALER_exchange_wire_signature_hash (ds->payto_uri,
+                                          &kv.h_wire);
       GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv,
                                 &kv,
                                 &master_sig.eddsa_signature);
@@ -225,13 +189,13 @@ auditor_del_run (void *cls,
     TALER_TESTING_interpreter_next (ds->is);
     return;
   }
-  ds->dh = TALER_EXCHANGE_management_disable_auditor (
+  ds->dh = TALER_EXCHANGE_management_disable_wire (
     is->ctx,
     exchange_url,
-    &auditor_pub,
+    ds->payto_uri,
     now,
     &master_sig,
-    &auditor_del_cb,
+    &wire_del_cb,
     ds);
   GNUNET_free (exchange_url);
   if (NULL == ds->dh)
@@ -244,17 +208,17 @@ auditor_del_run (void *cls,
 
 
 /**
- * Free the state of a "auditor_del" CMD, and possibly cancel a
+ * Free the state of a "wire_del" CMD, and possibly cancel a
  * pending operation thereof.
  *
- * @param cls closure, must be a `struct AuditorDelState`.
+ * @param cls closure, must be a `struct WireDelState`.
  * @param cmd the command which is being cleaned up.
  */
 static void
-auditor_del_cleanup (void *cls,
-                     const struct TALER_TESTING_Command *cmd)
+wire_del_cleanup (void *cls,
+                  const struct TALER_TESTING_Command *cmd)
 {
-  struct AuditorDelState *ds = cls;
+  struct WireDelState *ds = cls;
 
   if (NULL != ds->dh)
   {
@@ -262,7 +226,7 @@ auditor_del_cleanup (void *cls,
                 "Command %u (%s) did not complete\n",
                 ds->is->ip,
                 cmd->label);
-    TALER_EXCHANGE_management_disable_auditor_cancel (ds->dh);
+    TALER_EXCHANGE_management_disable_wire_cancel (ds->dh);
     ds->dh = NULL;
   }
   GNUNET_free (ds);
@@ -270,7 +234,7 @@ auditor_del_cleanup (void *cls,
 
 
 /**
- * Offer internal data from a "auditor_del" CMD, to other commands.
+ * Offer internal data from a "wire_del" CMD, to other commands.
  *
  * @param cls closure.
  * @param[out] ret result.
@@ -280,32 +244,34 @@ auditor_del_cleanup (void *cls,
  * @return #GNUNET_OK on success.
  */
 static int
-auditor_del_traits (void *cls,
-                    const void **ret,
-                    const char *trait,
-                    unsigned int index)
+wire_del_traits (void *cls,
+                 const void **ret,
+                 const char *trait,
+                 unsigned int index)
 {
   return GNUNET_NO;
 }
 
 
 struct TALER_TESTING_Command
-TALER_TESTING_cmd_auditor_del (const char *label,
-                               unsigned int expected_http_status,
-                               bool bad_sig)
+TALER_TESTING_cmd_wire_del (const char *label,
+                            const char *payto_uri,
+                            unsigned int expected_http_status,
+                            bool bad_sig)
 {
-  struct AuditorDelState *ds;
+  struct WireDelState *ds;
 
-  ds = GNUNET_new (struct AuditorDelState);
+  ds = GNUNET_new (struct WireDelState);
   ds->expected_response_code = expected_http_status;
   ds->bad_sig = bad_sig;
+  ds->payto_uri = payto_uri;
   {
     struct TALER_TESTING_Command cmd = {
       .cls = ds,
       .label = label,
-      .run = &auditor_del_run,
-      .cleanup = &auditor_del_cleanup,
-      .traits = &auditor_del_traits
+      .run = &wire_del_run,
+      .cleanup = &wire_del_cleanup,
+      .traits = &wire_del_traits
     };
 
     return cmd;
@@ -313,4 +279,4 @@ TALER_TESTING_cmd_auditor_del (const char *label,
 }
 
 
-/* end of testing_api_cmd_auditor_del.c */
+/* end of testing_api_cmd_wire_del.c */

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