gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] 23/29: [age-withdraw] added handlers for age-withdraw t


From: gnunet
Subject: [taler-exchange] 23/29: [age-withdraw] added handlers for age-withdraw to router
Date: Mon, 03 Jul 2023 16:23:59 +0200

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

oec pushed a commit to branch master
in repository exchange.

commit 1be14a34161cd04c61f6df506bead0d8ca64b76d
Author: Özgür Kesim <oec-taler@kesim.org>
AuthorDate: Tue Jun 27 09:48:51 2023 +0200

    [age-withdraw] added handlers for age-withdraw to router
---
 src/exchange/taler-exchange-httpd.c | 52 +++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/src/exchange/taler-exchange-httpd.c 
b/src/exchange/taler-exchange-httpd.c
index 348967f7..25af862b 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -30,6 +30,8 @@
 #include "taler_kyclogic_lib.h"
 #include "taler_templating_lib.h"
 #include "taler_mhd_lib.h"
+#include "taler-exchange-httpd_age-withdraw.h"
+#include "taler-exchange-httpd_age-withdraw_reveal.h"
 #include "taler-exchange-httpd_aml-decision.h"
 #include "taler-exchange-httpd_auditors.h"
 #include "taler-exchange-httpd_batch-deposit.h"
@@ -571,6 +573,46 @@ handle_get_aml (struct TEH_RequestContext *rc,
 }
 
 
+/**
+ * Handle a "/age-withdraw/$ACH/reveal" POST request.  Parses the "ACH"
+ * hash of the commitment from a previous call to
+ * /reserves/$reserve_pub/age-withdraw
+ *
+ * @param rc request context
+ * @param root uploaded JSON data
+ * @param args array of additional options
+ * @return MHD result code
+ */
+static MHD_RESULT
+handle_post_age_withdraw (struct TEH_RequestContext *rc,
+                          const json_t *root,
+                          const char *const args[2])
+{
+  struct TALER_AgeWithdrawCommitmentHashP ach;
+
+  if (0 != strcmp ("reveal", args[1]))
+    return r404 (rc->connection,
+                 args[1]);
+
+  if (GNUNET_OK !=
+      GNUNET_STRINGS_string_to_data (args[0],
+                                     strlen (args[0]),
+                                     &ach,
+                                     sizeof (ach)))
+  {
+    GNUNET_break_op (0);
+    return TALER_MHD_reply_with_error (rc->connection,
+                                       MHD_HTTP_BAD_REQUEST,
+                                       TALER_EC_GENERIC_RESERVE_PUB_MALFORMED,
+                                       args[0]);
+  }
+
+  return TEH_handler_age_withdraw_reveal (rc,
+                                          &ach,
+                                          root);
+}
+
+
 /**
  * Signature of functions that handle operations on reserves.
  *
@@ -617,6 +659,10 @@ handle_post_reserves (struct TEH_RequestContext *rc,
       .op = "batch-withdraw",
       .handler = &TEH_handler_batch_withdraw
     },
+    {
+      .op = "age-withdraw",
+      .handler = &TEH_handler_age_withdraw
+    },
     {
       .op = "withdraw",
       .handler = &TEH_handler_withdraw
@@ -1454,6 +1500,12 @@ handle_mhd_request (void *cls,
       .handler.post = &handle_post_reserves,
       .nargs = 2
     },
+    {
+      .url = "age-withdraw",
+      .method = MHD_HTTP_METHOD_POST,
+      .handler.post = &handle_post_age_withdraw,
+      .nargs = 2
+    },
     {
       .url = "reserves-attest",
       .method = MHD_HTTP_METHOD_GET,

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