gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-anastasis] branch master updated: added select state


From: gnunet
Subject: [GNUnet-SVN] [taler-anastasis] branch master updated: added select statements
Date: Wed, 23 Oct 2019 16:04:08 +0200

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

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

The following commit(s) were added to refs/heads/master by this push:
     new 6a3f3d6  added select statements
6a3f3d6 is described below

commit 6a3f3d699d14978542e8bf93dc1c4c07c48e3bde
Author: Dominik Meister <address@hidden>
AuthorDate: Wed Oct 23 16:04:00 2019 +0200

    added select statements
---
 src/backup-db/plugin_anastasis_postgres.c | 176 +++++++++++++++++++++++++++++-
 1 file changed, 175 insertions(+), 1 deletion(-)

diff --git a/src/backup-db/plugin_anastasis_postgres.c 
b/src/backup-db/plugin_anastasis_postgres.c
index aa330cf..add37da 100644
--- a/src/backup-db/plugin_anastasis_postgres.c
+++ b/src/backup-db/plugin_anastasis_postgres.c
@@ -444,7 +444,7 @@ postgres_store_truth (void *cls,
                       const struct ANASTASIS_uuid *uuid,
                       const void *truth_data,
                       size_t truth_data_size,
-                      struct GNUNET_TIME_Relative truth_expiration);
+                      struct GNUNET_TIME_Relative truth_expiration)
 {
     struct PostgresClosure *pg = cls;
     enum GNUNET_DB_QueryStatus qs;
@@ -491,6 +491,156 @@ struct GNUNET_PQ_QueryParam params[] = {
     return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
 }
 
+
+
+
+/**
+  * @param cls closure
+  * @param uuid the identifier for the Truth
+  * @param response the challenge response of the user
+  * @param size_response size of the response
+  * @param data contains the encrypted key share (bytearray)
+  * @param data_size size of data
+  * @param truth_dec_key key to decrypt the truth_data
+  * @return transaction status
+  */
+enum GNUNET_DB_QueryStatus
+(*get_encrypted_key_share)(void *cls,
+                           const struct ANASTASIS_uuid *uuid,
+                           char *response,
+                           size_t size_response,
+                           void **data,
+                           size_t *data_size,
+                           uint32_t truth_dec_key[8])
+
+
+
+{
+    struct PostgresClosure *pg = cls;
+    check_connection (pg);
+
+    struct GNUNET_PQ_QueryParam params[] = {
+        GNUNET_PQ_query_param_auto_from_type (uuid),
+        GNUNET_PQ_query_param_end
+    };
+
+    struct GNUNET_PQ_ResultSpec rs[] = {
+        GNUNET_PQ_result_spec_variable_size ("truth", data, data_size),
+        GNUNET_PQ_result_spec_end
+    };
+
+    GNUNET_PQ_eval_prepared_singleton_select (pg->conn,"truth_select", params, 
rs);
+
+    //FIXME Pattern match ?
+    //return nur von recovery teil
+
+}
+
+
+/**
+* @param cls closure
+* @param uuid the identifier for the Truth
+* @param truth contains the truth (base32 encoded)
+* @param truth_size size of truth
+* @param truth_mime mime type of truth
+* @param truth_mime_size size of truth_mime
+* @return transaction status
+*/
+enum GNUNET_DB_QueryStatus
+(*get_escrow_challenge)(void *cls,
+                        const struct ANASTASIS_uuid *uuid,
+                        char **truth,
+                        size_t *truth_size,
+                        char **truth_mime,
+                        size_t *truth_mime_size)
+{
+    struct PostgresClosure *pg = cls;
+    check_connection (pg);
+    struct GNUNET_PQ_QueryParam params[] = {
+            GNUNET_PQ_query_param_auto_from_type (uuid),
+            GNUNET_PQ_query_param_end
+    };
+
+    struct GNUNET_PQ_ResultSpec rs[] = {
+        GNUNET_PQ_result_spec_variable_size ("truth", data, data_size),
+        GNUNET_PQ_result_spec_end
+    };
+
+    GNUNET_PQ_eval_prepared_singleton_select (pg->conn,"truth_select", params, 
rs);
+
+    //FIXME return nur von challange teil
+
+}
+
+
+/**
+ * Fetch latest recovery document for user.
+ *
+ * @param cls closure
+ * @param anastasis_pub public key of the user's account
+ * @param version[OUT] set to the version number of the policy being returned
+ * @param data_size size of data blob
+ * @param data blob which contains the recovery document
+ * @return transaction status
+ */
+enum GNUNET_DB_QueryStatus
+(*get_latest_recovery_document)(void *cls,
+                                const struct
+                                ANASTASIS_AccountPubP *anastasis_pub,
+                                size_t *data_size,
+                                void **data,
+                                uint32_t *version)
+{
+    check_connection(pq);
+    struct PostgresClosure *pg = cls;
+
+    struct GNUNET_PQ_QueryParam params[] = {
+        GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
+        GNUNET_PQ_query_param_end
+    };
+
+    struct GNUNET_PQ_ResultSpec rs[] = {
+        GNUNET_PQ_result_spec_variable_size ("recovery_data", data, data_size),
+        GNUNET_PQ_result_spec_end
+    };
+
+    return GNUNET_PQ_eval_prepared_singleton_select 
(pg->conn,"latest_recoverydocument_select", params, rs);
+}
+
+/**
+ * Fetch recovery document for user.
+ *
+ * @param cls closure
+ * @param anastasis_pub public key of the user's account
+ * @param version[OUT] set to the version number of the policy the user 
requested
+ * @param data_size size of data blob
+ * @param data blob which contains the recovery document
+ * @return transaction status
+ */
+enum GNUNET_DB_QueryStatus
+(*get_recovery_document)(void *cls,
+                         const struct ANASTASIS_AccountPubP *anastasis_pub,
+                         uint32_t version,
+                         size_t *data_size,
+                         void **data)
+
+{
+    check_connection(pq);
+    struct PostgresClosure *pg = cls;
+
+    struct GNUNET_PQ_QueryParam params[] = {
+        GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
+        GNUNET_PQ_query_param_uint32(version),
+        GNUNET_PQ_query_param_end
+    };
+    struct GNUNET_PQ_ResultSpec rs[] = {
+        GNUNET_PQ_result_spec_variable_size ("recovery_data", data, data_size),
+        GNUNET_PQ_result_spec_end
+    };
+
+    return GNUNET_PQ_eval_prepared_singleton_select 
(pg->conn,"recoverydocument_select", params, rs);
+}
+
 /**
  * Initialize Postgres database subsystem.
  *
@@ -532,6 +682,8 @@ libtaler_plugin_anastasis_db_postgres_init (void *cls)
                             );"),
     GNUNET_PQ_EXECUTE_STATEMENT_END
   };
+
+
   struct GNUNET_PQ_PreparedStatement ps[] = {                               
     GNUNET_PQ_make_prepare ("user_insert",
                             "INSERT INTO anastasis_user "
@@ -581,6 +733,28 @@ libtaler_plugin_anastasis_db_postgres_init (void *cls)
                             ") VALUES "
                             "($1, $2, $3);",
                             3),
+    GNUNET_PQ_make_prepare ("truth_select",
+                            "SELECT "
+                            "truth "
+                            "FROM anastasis_truth "
+                            "WHERE truth_id =$1;",
+                            1),
+    GNUNET_PQ_make_prepare ("latest_recoverydocument_select",
+                            "SELECT "
+                            "recovery_data "
+                            "FROM anastasis_recoverydocument "
+                            "WHERE user_id =$1 "
+                            "ORDER BY version DESC "
+                            "LIMIT 1;",
+                            1),
+
+    GNUNET_PQ_make_prepare ("recoverydocument_select",
+                            "SELECT "
+                            "recovery_data "
+                            "FROM anastasis_recoverydocument "
+                            "WHERE user_id =$1 "
+                            "AND version=$2;",
+                            2),
 
     GNUNET_PQ_PREPARED_STATEMENT_END
   };

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



reply via email to

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