gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: enable meta-data upload in REST


From: gnunet
Subject: [taler-anastasis] branch master updated: enable meta-data upload in REST client logic
Date: Wed, 19 Jan 2022 13:29:50 +0100

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

grothoff pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new b973491  enable meta-data upload in REST client logic
b973491 is described below

commit b973491c643a5e86e3df3acb9fc62a62d9401438
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Jan 19 13:29:47 2022 +0100

    enable meta-data upload in REST client logic
---
 src/include/anastasis_service.h             |  6 +++++-
 src/lib/anastasis_backup.c                  |  1 +
 src/restclient/anastasis_api_policy_store.c | 29 ++++++++++++++++++++++++++++-
 src/testing/testing_api_cmd_policy_store.c  |  1 +
 4 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index 5a8ca21..ee24b7a 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -192,7 +192,7 @@ struct ANASTASIS_MetaDownloadDetails
   /**
    * Number of entries in @e metas.
    */
-  unsigned int metas_length;
+  size_t metas_length;
 
 };
 
@@ -473,6 +473,8 @@ typedef void
  * @param anastasis_priv private key of the user's account
  * @param recovery_data policy data to be stored
  * @param recovery_data_size number of bytes in @a recovery_data
+ * @param recovery_meta_data policy meta data to be stored, can be NULL
+ * @param recovery_meta_data_size number of bytes in @a recovery_meta_data
  * @param payment_years_requested for how many years would the client like the 
service to store the truth?
  * @param payment_secret payment identifier of last payment
  * @param payment_timeout how long to wait for the payment, use
@@ -488,6 +490,8 @@ ANASTASIS_policy_store (
   const struct ANASTASIS_CRYPTO_AccountPrivateKeyP *anastasis_priv,
   const void *recovery_data,
   size_t recovery_data_size,
+  const void *recovery_meta_data,
+  size_t recovery_meta_data_size,
   uint32_t payment_years_requested,
   const struct ANASTASIS_PaymentSecretP *payment_secret,
   struct GNUNET_TIME_Relative payment_timeout,
diff --git a/src/lib/anastasis_backup.c b/src/lib/anastasis_backup.c
index 21dd291..f5b91fb 100644
--- a/src/lib/anastasis_backup.c
+++ b/src/lib/anastasis_backup.c
@@ -919,6 +919,7 @@ ANASTASIS_secret_share (struct GNUNET_CURL_Context *ctx,
       &anastasis_priv,
       recovery_data,
       recovery_data_size,
+      NULL, 0, /* FIXME: meta-data! */
       payment_years_requested,
       (! GNUNET_is_zero (&pss->payment_secret))
       ? &pss->payment_secret
diff --git a/src/restclient/anastasis_api_policy_store.c 
b/src/restclient/anastasis_api_policy_store.c
index b709472..2432079 100644
--- a/src/restclient/anastasis_api_policy_store.c
+++ b/src/restclient/anastasis_api_policy_store.c
@@ -1,6 +1,6 @@
 /*
   This file is part of ANASTASIS
-  Copyright (C) 2014-2021 Anastasis SARL
+  Copyright (C) 2014-2022 Anastasis SARL
 
   ANASTASIS is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as
@@ -356,6 +356,8 @@ ANASTASIS_policy_store (
   const struct ANASTASIS_CRYPTO_AccountPrivateKeyP *anastasis_priv,
   const void *recovery_data,
   size_t recovery_data_size,
+  const void *recovery_meta_data,
+  size_t recovery_meta_data_size,
   uint32_t payment_years_requested,
   const struct ANASTASIS_PaymentSecretP *payment_secret,
   struct GNUNET_TIME_Relative payment_timeout,
@@ -425,6 +427,31 @@ ANASTASIS_policy_store (
     }
     job_headers = ext;
 
+    /* Setup meta-data header */
+    if (NULL != recovery_meta_data)
+    {
+      char *meta_val;
+
+      meta_val = GNUNET_STRINGS_data_to_string_alloc (
+        recovery_meta_data,
+        recovery_meta_data_size);
+      GNUNET_asprintf (&hdr,
+                       "%s: %s",
+                       ANASTASIS_HTTP_HEADER_POLICY_META_DATA,
+                       meta_val);
+      GNUNET_free (meta_val);
+      ext = curl_slist_append (job_headers,
+                               hdr);
+      GNUNET_free (hdr);
+      if (NULL == ext)
+      {
+        GNUNET_break (0);
+        curl_slist_free_all (job_headers);
+        return NULL;
+      }
+      job_headers = ext;
+    }
+
     /* Setup Payment-Identifier header */
     if (NULL != payment_secret)
     {
diff --git a/src/testing/testing_api_cmd_policy_store.c 
b/src/testing/testing_api_cmd_policy_store.c
index d1ee3c0..08e567c 100644
--- a/src/testing/testing_api_cmd_policy_store.c
+++ b/src/testing/testing_api_cmd_policy_store.c
@@ -281,6 +281,7 @@ policy_store_run (void *cls,
     &pss->anastasis_priv,
     pss->recovery_data,
     pss->recovery_data_size,
+    NULL, 0, /* meta-data */
     (0 != (ANASTASIS_TESTING_PSO_REQUEST_PAYMENT & pss->psopt)),
     pss->payment_secret_set ? &pss->payment_secret_request : NULL,
     GNUNET_TIME_UNIT_ZERO,

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