gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] 01/02: backend plugin and fixes in test


From: gnunet
Subject: [taler-anastasis] 01/02: backend plugin and fixes in test
Date: Tue, 27 Oct 2020 14:28:26 +0100

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

ds-meister pushed a commit to branch master
in repository anastasis.

commit 33166cada393e0e27d383d9b482768fc2cc3f8f0
Author: Dominik Meister <dominik.meister@hotmail.ch>
AuthorDate: Tue Oct 27 14:25:30 2020 +0100

    backend plugin and fixes in test
---
 doc/ypsomed/ypsomed.tex                           | 30 ++++++--------
 src/backend/anastasis-httpd.c                     |  1 +
 src/backend/anastasis_authorization_plugin_file.c | 50 +++++++++++++++--------
 src/include/anastasis_service.h                   |  3 +-
 src/lib/anastasis_api_challenge_run.c             | 15 +++++--
 src/lib/test_anastasis_api.c                      | 12 +++---
 src/lib/testing_api_cmd_challenge_run.c           |  3 +-
 7 files changed, 70 insertions(+), 44 deletions(-)

diff --git a/doc/ypsomed/ypsomed.tex b/doc/ypsomed/ypsomed.tex
index 8eeb1fa..da65631 100644
--- a/doc/ypsomed/ypsomed.tex
+++ b/doc/ypsomed/ypsomed.tex
@@ -397,10 +397,13 @@ To summarize, our current key software development 
objectives are:
 
 
 \section{Business model}
+Anastasis is a young company founded in July 2020 and based in Luxembourg. 
+The developers of the software work in Switzerland. 
+The company currently has two full-time developers working on the software.
+Other people in the business area work part-time for Anastasis. 
+
+The following section describes a short overview of the business model of 
Anastasis.
 
-We are currently in the process of building a start-up for
-Anastasis. This business model shows an overview how we plan to
-operate the Anastasis start-up.
 
 \subsection{Key partners}
 
@@ -428,6 +431,8 @@ commercial use. This involves the integration of different
 authentication methods and the integration of our application into the
 different consumer applications. Another key activity is the
 maintenance and deployment of our service.
+On the business side the main activity is to look for new potential customers
+and investors. 
 
 \subsection{Key resources}
 
@@ -437,15 +442,7 @@ invest in hardware. To operate our application, we will 
need servers
 to provide our service, as previously mentioned we would provide our
 service on a Cloud provider.  For the timely further development of
 our service and integration with various authentication providers,
-payment solutions and applications needing key recovery, we see an
-initial need for at least two fulltime employees. These developers
-would also be responsible for the maintenance and deployment of the
-application.
-
-Additionally, the start-up needs a person who is responsible for the
-business of Anastasis. This employee would be responsible to find new
-business partners and present our application to investors. This
-employee might initially work only part-time.
+payment solutions and applications needing key recovery.
 
 \subsection{Value propositions}
 
@@ -488,8 +485,7 @@ crypto-currencies and end-to-end encrypted communication 
services.
 
 The main cost for our start-up is the salary of our employees. We need
 to have two or more fulltime employees for the development and one
-part time employee for the business development. Additional costs for
-the start-up are the costs for registering a company. To provide
+part time employee for the business development. To provide
 Anastasis as a service, we expect to make use of existing public Cloud
 services, which also cost a little bit.
 
@@ -500,9 +496,9 @@ operate an Anastasis server and to help them integrate our 
protocol
 with their software.  Once we have many end-users utilizing Anastasis,
 they will have to pay directly for the service. The users have to pay
 a subscription fee and possibly additional fees for expensive recovery
-operations. For example a user might pay 0.10 CHF per month for the
-subscription and 0.01 CHF for each encrypted truth
-upload. Additionally, the user would have to pay for expensive
+operations. For example a user might pay 1 CHF per month for the
+subscription and 0.10 CHF for each upload.
+Additionally, the user would have to pay for expensive
 authentication methods like video identification.
 \newpage
 
diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c
index a5ac3a3..c5d56d5 100644
--- a/src/backend/anastasis-httpd.c
+++ b/src/backend/anastasis-httpd.c
@@ -341,6 +341,7 @@ url_handler (void *cls,
                     "/truth/",
                     strlen ("/truth/")))
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "arrived at truth get");
     // return handle_truth (...);
     if (0 == strcmp (method,
                      MHD_HTTP_METHOD_GET))
diff --git a/src/backend/anastasis_authorization_plugin_file.c 
b/src/backend/anastasis_authorization_plugin_file.c
index 6841a4d..3a2fb11 100644
--- a/src/backend/anastasis_authorization_plugin_file.c
+++ b/src/backend/anastasis_authorization_plugin_file.c
@@ -19,6 +19,7 @@
  * @author Dominik Meister
  */
 #include "platform.h"
+#include "anastasis-httpd.h"
 #include "anastasis_authorization_plugin.h"
 
 
@@ -39,7 +40,7 @@ struct ANASTASIS_AUTHORIZATION_State
   /**
    * holds the truth information
    */
-  const char *data;
+  char *filename;
   /**
    * closure
    */
@@ -69,20 +70,20 @@ file_validate (void *cls,
                const char *data,
                size_t data_length)
 {
-  char *data_string;
+  char *filename;
 
   if (data == NULL)
   {
     return GNUNET_NO;
   }
 
-  data_string = GNUNET_STRINGS_data_to_string_alloc (data,
-                                                     data_length);
+  filename = GNUNET_STRINGS_data_to_string_alloc (data,
+                                                  data_length);
   int i = 0;
   int flag = 0;
-  for (i = 0; i<strlen (data_string); i++)
+  for (i = 0; i<strlen (filename); i++)
   {
-    if ((data_string[i] == ' ') || (data_string[i] == '/'))
+    if ((filename[i] == ' ') || (filename[i] == '/'))
     {
       flag = 1;
       break;
@@ -92,7 +93,7 @@ file_validate (void *cls,
   {
     return GNUNET_NO;
   }
-  GNUNET_free (data_string);
+  GNUNET_free (filename);
   return GNUNET_OK;
 }
 
@@ -122,8 +123,8 @@ file_start (void *cls,
   as->cls = cls;
   as->truth_public_key = truth_public_key;
   as->code = code;
-  as->data = GNUNET_STRINGS_data_to_string_alloc (data,
-                                                  data_length);
+  as->filename = GNUNET_STRINGS_data_to_string_alloc (data,
+                                                      data_length);
   return as;
 }
 
@@ -140,13 +141,22 @@ static enum ANASTASIS_AUTHORIZATION_Result
 file_process (struct ANASTASIS_AUTHORIZATION_State *as,
               struct MHD_Connection *connection)
 {
-  MHD_RESULT_Result mres;
-  FILE *f = fopen (as->data, "w");
+  MHD_RESULT mres;
+  struct MHD_Response *resp;
+  FILE *f = fopen (as->filename, "w");
 
   if (f == NULL)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Could not open file");
+    resp = TALER_MHD_make_error (TALER_EC_INTERNAL_INVARIANT_FAILURE,
+                                 "Failed to open filebuffer");
+    mres = MHD_queue_response (connection,
+                               MHD_HTTP_INTERNAL_SERVER_ERROR,
+                               resp);
+    MHD_destroy_response (resp);
+    if (MHD_YES != mres)
+      return ANASTASIS_AUTHORIZATION_RES_FAILED_REPLY_FAILED;
     return ANASTASIS_AUTHORIZATION_RES_FAILED;
   }
 
@@ -154,15 +164,25 @@ file_process (struct ANASTASIS_AUTHORIZATION_State *as,
   if (0 >= fprintf (f, "%lu", as->code))
   {
     fclose (f);
+    resp = TALER_MHD_make_error (TALER_EC_INTERNAL_INVARIANT_FAILURE,
+                                 "Failed to write to file");
     mres = MHD_queue_response (connection,
-                               foobar);
+                               MHD_HTTP_INTERNAL_SERVER_ERROR,
+                               resp);
+    MHD_destroy_response (resp);
     if (MHD_YES != mres)
       return ANASTASIS_AUTHORIZATION_RES_FAILED_REPLY_FAILED;
     return ANASTASIS_AUTHORIZATION_RES_FAILED;
   }
   fclose (f);
+  resp = MHD_create_response_from_buffer (strlen (as->filename),
+                                          as->filename,
+                                          MHD_RESPMEM_MUST_FREE);
+  TALER_MHD_add_global_headers (resp);
   mres = MHD_queue_response (connection,
-                             foobar);
+                             MHD_HTTP_OK,
+                             resp);
+  MHD_destroy_response (resp);
   if (MHD_YES != mres)
     return ANASTASIS_AUTHORIZATION_RES_SUCCESS_REPLY_FAILED;
   return ANASTASIS_AUTHORIZATION_RES_SUCCESS;
@@ -177,10 +197,8 @@ file_process (struct ANASTASIS_AUTHORIZATION_State *as,
 static void
 file_cleanup (struct ANASTASIS_AUTHORIZATION_State *as)
 {
-  GNUNET_free (as->data);
-  as->data = NULL;
+  GNUNET_free (as->filename);
   GNUNET_free (as);
-  as = NULL;
 }
 
 
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index 3336278..2a3411c 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -465,7 +465,8 @@ struct ANASTASIS_ChallengeRunOperation;
 typedef void
 (*ANASTASIS_ChallengeRunCallback) (
   void *cls,
-  unsigned int http_status);
+  unsigned int http_status,
+  char *response_string);
 
 /**
  * Cancel a GET /truth request.
diff --git a/src/lib/anastasis_api_challenge_run.c 
b/src/lib/anastasis_api_challenge_run.c
index 4089c4e..4f12b16 100644
--- a/src/lib/anastasis_api_challenge_run.c
+++ b/src/lib/anastasis_api_challenge_run.c
@@ -73,6 +73,8 @@ struct ANASTASIS_ChallengeRunOperation
    * Key to decrypt the truth on the server
    */
   const struct ANASTASIS_CRYPTO_TruthKeyP *truth_key;
+
+  char *response_string;
 };
 
 
@@ -115,9 +117,15 @@ handle_challenge_run_finished (void *cls,
                 "Backend didn't even return from GET /truth\n");
     break;
 
-  case MHD_HTTP_NO_CONTENT:
+  case MHD_HTTP_OK:
     {
-      cro->cb = NULL;
+      cro->response_string = GNUNET_STRINGS_data_to_string_alloc (data,
+                                                                  data_size);
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Response from backend: %s",cro->response_string);
+      cro->cb (cro->cb_cls,
+               response_code,
+               "run failed");
       ANASTASIS_challenge_run_cancel (cro);
       return;
     }
@@ -144,7 +152,8 @@ handle_challenge_run_finished (void *cls,
   if (NULL != cro->cb)
   {
     cro->cb (cro->cb_cls,
-             response_code);
+             response_code,
+             "run failed");
     cro->cb = NULL;
   }
   ANASTASIS_challenge_run_cancel (cro);
diff --git a/src/lib/test_anastasis_api.c b/src/lib/test_anastasis_api.c
index 6226646..330736a 100644
--- a/src/lib/test_anastasis_api.c
+++ b/src/lib/test_anastasis_api.c
@@ -275,16 +275,16 @@ run (void *cls,
                                          "file",
                                          "Truth mime",
                                          ANASTASIS_TESTING_make_hashed_answer (
-                                           "Hashed-Answer",
-                                           strlen ("Hashed-Answer")),
+                                           "Hashed-Answer-2",
+                                           strlen ("Hashed-Answer-2")),
                                          ANASTASIS_TESTING_make_truthkey (
-                                           "Truth-Key"))),
+                                           "Truth-Key-2"))),
 
     ANASTASIS_TESTING_cmd_challenge_run ("challenge-run-1",
                                          anastasis_url,
-                                         MHD_HTTP_NO_CONTENT,
+                                         MHD_HTTP_OK,
                                          ANASTASIS_TESTING_make_truthkey (
-                                           "Truth-Key"),
+                                           "Truth-Key-2"),
                                          "truth-store-2"),
 
     ANASTASIS_TESTING_cmd_keyshare_lookup ("keyshare-lookup-2",
@@ -292,7 +292,7 @@ run (void *cls,
                                            MHD_HTTP_OK,
                                            "42",
                                            ANASTASIS_TESTING_make_truthkey (
-                                             "Truth-Key"),
+                                             "Truth-Key-2"),
                                            "truth-store-2"),
     TALER_TESTING_cmd_end ()
   };
diff --git a/src/lib/testing_api_cmd_challenge_run.c 
b/src/lib/testing_api_cmd_challenge_run.c
index defa013..6c7ac55 100644
--- a/src/lib/testing_api_cmd_challenge_run.c
+++ b/src/lib/testing_api_cmd_challenge_run.c
@@ -76,7 +76,8 @@ struct ChallengeRunState
  */
 static void
 challenge_run_cb (void *cls,
-                  unsigned int http_status)
+                  unsigned int http_status,
+                  char *response_string)
 {
   struct ChallengeRunState *crs = cls;
 

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