[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: Worked on keyshare
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: Worked on keyshare |
Date: |
Tue, 29 Oct 2019 15:13:19 +0100 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new a8492d5 Worked on keyshare
a8492d5 is described below
commit a8492d5b6cb68f297a922df59978f3acdee49644
Author: Dennis Neufeld <address@hidden>
AuthorDate: Tue Oct 29 14:13:02 2019 +0000
Worked on keyshare
---
src/backup-db/plugin_anastasis_postgres.c | 212 ++++++++++++++++++------------
src/include/anastasis_database_plugin.h | 31 +++--
src/include/anastasis_db_lib.h | 77 +++++++++++
3 files changed, 229 insertions(+), 91 deletions(-)
diff --git a/src/backup-db/plugin_anastasis_postgres.c
b/src/backup-db/plugin_anastasis_postgres.c
index 37ca7af..25d4959 100644
--- a/src/backup-db/plugin_anastasis_postgres.c
+++ b/src/backup-db/plugin_anastasis_postgres.c
@@ -73,10 +73,8 @@ postgres_drop_tables (void *cls)
GNUNET_PQ_make_try_execute ("DROP TABLE IF EXISTS anastasis_payment;"),
GNUNET_PQ_make_try_execute (
"DROP TABLE IF EXISTS anastasis_recoverydocument;"),
-
GNUNET_PQ_EXECUTE_STATEMENT_END
};
-
return GNUNET_PQ_exec_statements (pg->conn,
es);
}
@@ -129,7 +127,12 @@ postgres_preflight (void *cls)
pg->transaction_name = NULL;
}
-
+/**
+ * Start a transaction.
+ *
+ * @param cls the `struct PostgresClosure` with the plugin-specific state
+ * @return #GNUNET_OK on success
+ */
static int
begin_transaction (struct PostgresClosure *pg,
const char *name)
@@ -151,8 +154,12 @@ begin_transaction (struct PostgresClosure *pg,
}
return GNUNET_OK;
}
-
-
+/**
+* Roll back the current transaction of a database connection.
+*
+* @param cls the `struct PostgresClosure` with the plugin-specific state
+* @return #GNUNET_OK on success
+*/
static void
rollback (struct PostgresClosure *pg)
{
@@ -171,11 +178,17 @@ rollback (struct PostgresClosure *pg)
pg->transaction_name = NULL;
}
+/**
+ * Commit the current transaction of a database connection.
+ *
+ * @param cls the `struct PostgresClosure` with the plugin-specific state
+ * @return transaction status code
+ */
-static enum GNUNET_DB_QueryStatus
+static enum ANASTASIS_DB_QueryStatus
commit_transaction (struct PostgresClosure *pg)
{
- enum GNUNET_DB_QueryStatus qs;
+ enum ANASTASIS_DB_QueryStatus qs;
struct GNUNET_PQ_QueryParam no_params[] = {
GNUNET_PQ_query_param_end
};
@@ -187,7 +200,6 @@ commit_transaction (struct PostgresClosure *pg)
return qs;
}
-
/**
* Upload encrypted recovery document.
*
@@ -200,7 +212,8 @@ commit_transaction (struct PostgresClosure *pg)
* @return transaction status, 0 if upload could not be finished because @a
payment_secret
* did not have enough upload left; HARD error if @a payment_secret
is unknown, ...
*/
-static enum GNUNET_DB_QueryStatus
+
+static enum ANASTASIS_DB_QueryStatus
postgres_store_recovery_document (void *cls,
const struct
ANASTASIS_AccountPubP *anastasis_pub,
@@ -211,7 +224,7 @@ postgres_store_recovery_document (void *cls,
uint32_t *version)
{
struct PostgresClosure *pg = cls;
- enum GNUNET_DB_QueryStatus qs;
+ enum ANASTASIS_DB_QueryStatus qs;
uint32_t postcounter;
struct GNUNET_TIME_Absolute paid_until;
@@ -220,7 +233,7 @@ postgres_store_recovery_document (void *cls,
"store_recovery_document"))
{
GNUNET_break (0);
- return GNUNET_DB_STATUS_HARD_ERROR;
+ return ANASTASIS_DB_STATUS_HARD_ERROR;
}
/* Check if user has paid */
@@ -242,16 +255,16 @@ postgres_store_recovery_document (void *cls,
}
switch (qs)
{
- case GNUNET_DB_STATUS_HARD_ERROR:
+ case ANASTASIS_DB_STATUS_HARD_ERROR:
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SOFT_ERROR:
+ case ANASTASIS_DB_STATUS_SOFT_ERROR:
// FIXME: or: retry internally?
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
- return -42; // GNUNET_DB_STATUS_UNKNOWN_USER; // FIXME: This status has to
be defined!
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ case ANASTASIS_DB_STATUS_SUCCESS_NO_RESULTS:
+ return ANASTASIS_DB_STATUS_UNKNOWN_USER;
+ case ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT:
paid_until = GNUNET_TIME_absolute_max (GNUNET_TIME_absolute_get (),
paid_until);
break;
@@ -262,7 +275,7 @@ postgres_store_recovery_document (void *cls,
paid_until).rel_value_us == 0)
{
rollback (pg);
- return GNUNET_DB_STATUS_SOFT_ERROR; // FIXME maybe differnet errorcode?
+ return ANASTASIS_DB_STATUS_PAYMENT_EXPIRED;
}
// lookup if the user has enough uploads left and decrement
@@ -285,29 +298,29 @@ postgres_store_recovery_document (void *cls,
switch (qs)
{
- case GNUNET_DB_STATUS_HARD_ERROR:
+ case ANASTASIS_DB_STATUS_HARD_ERROR:
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SOFT_ERROR:
+ case ANASTASIS_DB_STATUS_SOFT_ERROR:
// FIXME: or: retry internally?
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ case ANASTASIS_DB_STATUS_SUCCESS_NO_RESULTS:
rollback (pg);
- return GNUNET_DB_STATUS_HARD_ERROR;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ return ANASTASIS_DB_STATUS_HARD_ERROR;
+ case ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT:
break;
}
if (postcounter == 0 )
{
rollback (pg);
- return GNUNET_DB_STATUS_SOFT_ERROR; // FIXME maybe differnet errorcode?
+ return ANASTASIS_DB_STATUS_NOT_SUFFICIENT_POSTS;
}
- // decrement the postcounter
+ /*Decrement the postcounter by one*/
postcounter--;
- // update the postcounter
+ /* Update the postcounter in the Database */
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint32 (&postcounter),
@@ -322,21 +335,21 @@ postgres_store_recovery_document (void *cls,
}
switch (qs)
{
- case GNUNET_DB_STATUS_HARD_ERROR:
+ case ANASTASIS_DB_STATUS_HARD_ERROR:
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SOFT_ERROR:
+ case ANASTASIS_DB_STATUS_SOFT_ERROR:
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ case ANASTASIS_DB_STATUS_SUCCESS_NO_RESULTS:
GNUNET_break (0);
rollback (pg);
- return GNUNET_DB_STATUS_HARD_ERROR;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ return ANASTASIS_DB_STATUS_HARD_ERROR;
+ case ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT:
break;
}
- // get the version for the recoverydocument
+ /* get the version for the recoverydocument */
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
@@ -354,17 +367,17 @@ postgres_store_recovery_document (void *cls,
}
switch (qs)
{
- case GNUNET_DB_STATUS_HARD_ERROR:
+ case ANASTASIS_DB_STATUS_HARD_ERROR:
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SOFT_ERROR:
+ case ANASTASIS_DB_STATUS_SOFT_ERROR:
// FIXME: or: retry internally?
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ case ANASTASIS_DB_STATUS_SUCCESS_NO_RESULTS:
*version = 1;
break;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ case ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT:
(*version)++;
break;
}
@@ -383,32 +396,29 @@ postgres_store_recovery_document (void *cls,
switch (qs)
{
- case GNUNET_DB_STATUS_HARD_ERROR:
+ case ANASTASIS_DB_STATUS_HARD_ERROR:
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SOFT_ERROR:
+ case ANASTASIS_DB_STATUS_SOFT_ERROR:
// FIXME: or: retry internally?
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ case ANASTASIS_DB_STATUS_SUCCESS_NO_RESULTS:
GNUNET_break (0);
rollback (pg);
- return GNUNET_DB_STATUS_HARD_ERROR;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ return ANASTASIS_DB_STATUS_HARD_ERROR;
+ case ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT:
break;
}
qs = commit_transaction (pg);
if (qs < 0)
return qs;
- return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
+ return ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT;
}
-
-
/**
- * FIXME
*
* @param cls closure
* @param amount amount of taler to be paid
@@ -418,7 +428,7 @@ postgres_store_recovery_document (void *cls,
* @param payment_secret payment secret which the user must provide with every
upload
* @return transaction status
*/
-static enum GNUNET_DB_QueryStatus
+static enum ANASTASIS_DB_QueryStatus
postgres_record_payment (void *cls,
const struct TALER_Amount *amount,
const struct ANASTASIS_AccountPubP *anastasis_pub,
@@ -427,7 +437,7 @@ postgres_record_payment (void *cls,
const struct ANASTASIS_PaymentSecretP *payment_secret)
{
struct PostgresClosure *pg = cls;
- enum GNUNET_DB_QueryStatus qs;
+ enum ANASTASIS_DB_QueryStatus qs;
struct GNUNET_TIME_Absolute paid_until;
check_connection (pg);
@@ -436,7 +446,7 @@ postgres_record_payment (void *cls,
"record_payment"))
{
GNUNET_break (0);
- return GNUNET_DB_STATUS_HARD_ERROR;
+ return ANASTASIS_DB_STATUS_HARD_ERROR;
}
{
@@ -456,17 +466,17 @@ postgres_record_payment (void *cls,
rs);
switch (qs)
{
- case GNUNET_DB_STATUS_HARD_ERROR:
+ case ANASTASIS_DB_STATUS_HARD_ERROR:
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SOFT_ERROR:
+ case ANASTASIS_DB_STATUS_SOFT_ERROR:
// FIXME: or: retry internally?
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ case ANASTASIS_DB_STATUS_SUCCESS_NO_RESULTS:
paid_until = GNUNET_TIME_absolute_get ();
break;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ case ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT:
paid_until = GNUNET_TIME_absolute_max (GNUNET_TIME_absolute_get (),
paid_until);
break;
@@ -474,7 +484,7 @@ postgres_record_payment (void *cls,
}
paid_until = GNUNET_TIME_absolute_add (paid_until,
lifetime_inc);
- if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
+ if (ANASTASIS_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
/* user did not yet exist, create */
struct GNUNET_PQ_QueryParam params[] = {
@@ -502,18 +512,18 @@ postgres_record_payment (void *cls,
}
switch (qs)
{
- case GNUNET_DB_STATUS_HARD_ERROR:
+ case ANASTASIS_DB_STATUS_HARD_ERROR:
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SOFT_ERROR:
+ case ANASTASIS_DB_STATUS_SOFT_ERROR:
// FIXME: or: retry internally?
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ case ANASTASIS_DB_STATUS_SUCCESS_NO_RESULTS:
GNUNET_break (0);
rollback (pg);
- return GNUNET_DB_STATUS_HARD_ERROR;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ return ANASTASIS_DB_STATUS_HARD_ERROR;
+ case ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT:
break;
}
@@ -531,17 +541,17 @@ postgres_record_payment (void *cls,
switch (qs)
{
- case GNUNET_DB_STATUS_HARD_ERROR:
+ case ANASTASIS_DB_STATUS_HARD_ERROR:
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SOFT_ERROR:
+ case ANASTASIS_DB_STATUS_SOFT_ERROR:
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ case ANASTASIS_DB_STATUS_SUCCESS_NO_RESULTS:
GNUNET_break (0);
rollback (pg);
- return GNUNET_DB_STATUS_HARD_ERROR;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ return ANASTASIS_DB_STATUS_HARD_ERROR;
+ case ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT:
break;
}
}
@@ -549,10 +559,9 @@ postgres_record_payment (void *cls,
qs = commit_transaction (pg);
if (qs < 0)
return qs;
- return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
+ return ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT;
}
-
/**
* Upload Truth, which contains the Truth and the KeyShare.
*
@@ -563,7 +572,7 @@ postgres_record_payment (void *cls,
* @param truth_expiration time till the according data will be stored
* @return transaction status
*/
-static enum GNUNET_DB_QueryStatus
+static enum ANASTASIS_DB_QueryStatus
postgres_store_truth (void *cls,
const struct ANASTASIS_uuid *uuid,
const void *truth_data,
@@ -571,7 +580,7 @@ postgres_store_truth (void *cls,
struct GNUNET_TIME_Relative truth_expiration)
{
struct PostgresClosure *pg = cls;
- enum GNUNET_DB_QueryStatus qs;
+ enum ANASTASIS_DB_QueryStatus qs;
struct GNUNET_TIME_Absolute expiration = GNUNET_TIME_absolute_get ();
expiration = GNUNET_TIME_absolute_add (expiration, truth_expiration);
@@ -580,7 +589,7 @@ postgres_store_truth (void *cls,
"store_truth"))
{
GNUNET_break (0);
- return GNUNET_DB_STATUS_HARD_ERROR;
+ return ANASTASIS_DB_STATUS_HARD_ERROR;
}
{
@@ -597,17 +606,17 @@ postgres_store_truth (void *cls,
}
switch (qs)
{
- case GNUNET_DB_STATUS_HARD_ERROR:
+ case ANASTASIS_DB_STATUS_HARD_ERROR:
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SOFT_ERROR:
+ case ANASTASIS_DB_STATUS_SOFT_ERROR:
rollback (pg);
return qs;
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ case ANASTASIS_DB_STATUS_SUCCESS_NO_RESULTS:
GNUNET_break (0);
rollback (pg);
- return GNUNET_DB_STATUS_HARD_ERROR;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ return ANASTASIS_DB_STATUS_HARD_ERROR;
+ case ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT:
break;
}
@@ -617,12 +626,12 @@ postgres_store_truth (void *cls,
return qs;
}
- return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
+ return ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT;
}
/**
- * DOCUMENT.
+ * Get the challenge from the truth i.e. Security Question, SMS, E-Mail
*
* @param cls closure
* @param uuid the identifier for the Truth
@@ -631,7 +640,7 @@ postgres_store_truth (void *cls,
* @param truth_mime mime type of truth
* @return transaction status
*/
-enum GNUNET_DB_QueryStatus
+enum ANASTASIS_DB_QueryStatus
postgres_get_escrow_challenge (void *cls,
const struct ANASTASIS_uuid *uuid,
void **truth,
@@ -659,6 +668,37 @@ postgres_get_escrow_challenge (void *cls,
rs);
}
+/**
+* @param cls closure
+* @param uuid the identifier for the Truth
+* @param key_share contains the encrypted Keyshare
+* @param key_share_size size of the Keyshare
+* @return transaction status
+*/
+enum ANASTASIS_DB_QueryStatus
+postgres_get_key_share (void *cls,
+ const struct ANASTASIS_uuid *uuid,
+ void **key_share,
+ size_t *key_share_size)
+{
+ struct PostgresClosure *pg = cls;
+ 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 ("key_share",
+ key_share,
+ key_share_size),
+ GNUNET_PQ_result_spec_end
+ };
+
+ check_connection (pg);
+ return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+ "key_share_select",
+ params,
+ rs);
+}
/**
* Fetch latest recovery document for user.
@@ -670,7 +710,7 @@ postgres_get_escrow_challenge (void *cls,
* @param data blob which contains the recovery document
* @return transaction status
*/
-enum GNUNET_DB_QueryStatus
+enum ANASTASIS_DB_QueryStatus
postgres_get_latest_recovery_document (void *cls,
const struct
ANASTASIS_AccountPubP *anastasis_pub,
@@ -708,7 +748,7 @@ postgres_get_latest_recovery_document (void *cls,
* @param data blob which contains the recovery document
* @return transaction status
*/
-enum GNUNET_DB_QueryStatus
+enum ANASTASIS_DB_QueryStatus
postgres_get_recovery_document (void *cls,
const struct
ANASTASIS_AccountPubP *anastasis_pub,
@@ -737,7 +777,6 @@ postgres_get_recovery_document (void *cls,
rs);
}
-
/**
* Initialize Postgres database subsystem.
*
@@ -757,6 +796,8 @@ libtaler_plugin_anastasis_db_postgres_init (void *cls)
GNUNET_PQ_make_execute ("CREATE TABLE anastasis_truth"
"( truth_id UUID PRIMARY KEY NOT NULL,"
"truth BYTEA NOT NULL,"
+ "truth_mime VARCHAR,"
+ "key_share BYTEA NOT NULL,"
"expiration TIMESTAMP NOT NULL"
");"),
GNUNET_PQ_make_execute ("CREATE TABLE anastasis_user"
@@ -772,8 +813,8 @@ libtaler_plugin_anastasis_db_postgres_init (void *cls)
");"),
GNUNET_PQ_make_execute ("CREATE TABLE anastasis_recoverydocument"
"( user_id BYTEA NOT NULL REFERENCES
anastasis_user(user_id),"
- " version INTEGER,"
- " recovery_data BYTEA,"
+ " version INTEGER NOT NULL,"
+ " recovery_data BYTEA NOT NULL,"
" PRIMARY KEY (user_id, version)"
");"),
GNUNET_PQ_EXECUTE_STATEMENT_END
@@ -829,7 +870,8 @@ libtaler_plugin_anastasis_db_postgres_init (void *cls)
3),
GNUNET_PQ_make_prepare ("truth_select",
"SELECT "
- "truth "
+ "truth,"
+ "truth_mime"
"FROM anastasis_truth "
"WHERE truth_id =$1;",
1),
@@ -871,6 +913,14 @@ libtaler_plugin_anastasis_db_postgres_init (void *cls)
"WHERE user_id =$2 "
"AND payment_identifier=$3;",
3),
+
+ GNUNET_PQ_make_prepare ("key_share_select",
+ "SELECT "
+ "key_share "
+ "FROM "
+ "anastasis_truth "
+ "WHERE truth_id =$1;",
+ 1),
GNUNET_PQ_PREPARED_STATEMENT_END
};
diff --git a/src/include/anastasis_database_plugin.h
b/src/include/anastasis_database_plugin.h
index bcf6df1..172afe1 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -22,7 +22,7 @@
#define ANASTASIS_DATABASE_PLUGIN_H
#include <gnunet/gnunet_util_lib.h>
-#include <gnunet/gnunet_db_lib.h>
+#include <anastasis_db_lib.h>
#include <jansson.h>
#include <taler/taler_util.h>
@@ -96,7 +96,7 @@ struct ANASTASIS_DatabasePlugin
* values might be something like 6-10 years in the past)
* @return transaction status
*/
- enum GNUNET_DB_QueryStatus
+ enum ANASTASIS_DB_QueryStatus
(*gc)(void *cls,
struct GNUNET_TIME_Absolute fin_expire);
@@ -134,7 +134,7 @@ struct ANASTASIS_DatabasePlugin
* @param cls the `struct PostgresClosure` with the plugin-specific state
* @return transaction status code
*/
- enum GNUNET_DB_QueryStatus
+ enum ANASTASIS_DB_QueryStatus
(*commit)(void *cls);
/**
@@ -149,7 +149,7 @@ struct ANASTASIS_DatabasePlugin
* @param payment_secret identifier for the payment, used to later charge on
uploads
* @return transaction status
*/
- enum GNUNET_DB_QueryStatus
+ enum ANASTASIS_DB_QueryStatus
(*record_payment)(void *cls,
const struct TALER_Amount *amount,
const struct ANASTASIS_AccountPubP *anastasis_pub,
@@ -169,7 +169,7 @@ struct ANASTASIS_DatabasePlugin
* @return transaction status, 0 if upload could not be finished because @a
payment_secret
* did not have enough upload left; HARD error if @a payment_secret
is unknown, ...
*/
- enum GNUNET_DB_QueryStatus
+ enum ANASTASIS_DB_QueryStatus
(*store_recovery_document)(void *cls,
const struct ANASTASIS_AccountPubP *anastasis_pub,
const void *data,
@@ -188,7 +188,7 @@ struct ANASTASIS_DatabasePlugin
* @param data blob which contains the recovery document
* @return transaction status
*/
- enum GNUNET_DB_QueryStatus
+ enum ANASTASIS_DB_QueryStatus
(*get_recovery_document)(void *cls,
const struct ANASTASIS_AccountPubP *anastasis_pub,
uint32_t version,
@@ -205,7 +205,7 @@ struct ANASTASIS_DatabasePlugin
* @param data blob which contains the recovery document
* @return transaction status
*/
- enum GNUNET_DB_QueryStatus
+ enum ANASTASIS_DB_QueryStatus
(*get_latest_recovery_document)(void *cls,
const struct
ANASTASIS_AccountPubP *anastasis_pub,
@@ -223,7 +223,7 @@ struct ANASTASIS_DatabasePlugin
* @param truth_expiration time till the according data will be stored
* @return transaction status
*/
- enum GNUNET_DB_QueryStatus
+ enum ANASTASIS_DB_QueryStatus
(*store_truth)(void *cls,
const struct ANASTASIS_uuid *uuid,
const void *truth_data,
@@ -239,12 +239,23 @@ struct ANASTASIS_DatabasePlugin
* @param truth_mime mime type of truth
* @return transaction status
*/
- enum GNUNET_DB_QueryStatus
+ enum ANASTASIS_DB_QueryStatus
(*get_escrow_challenge)(void *cls,
const struct ANASTASIS_uuid *uuid,
void **truth,
size_t *truth_size,
char **truth_mime);
+ /**
+ * @param cls closure
+ * @param uuid the identifier for the Truth
+ * @param key_share contains the encrypted Keyshare
+ * @param key_share_size size of the Keyshare
+ * @return transaction status
+ */
+ enum ANASTASIS_DB_QueryStatus
+ (*get_key_share)(void *cls,
+ const struct ANASTASIS_uuid *uuid,
+ void **key_share,
+ size_t *key_share_size);
};
-
#endif
diff --git a/src/include/anastasis_db_lib.h b/src/include/anastasis_db_lib.h
new file mode 100644
index 0000000..3fa89b7
--- /dev/null
+++ b/src/include/anastasis_db_lib.h
@@ -0,0 +1,77 @@
+/*
+ This file is part of GNUnet
+ Copyright (C) 2017 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
+/**
+ * @file include/ANASTASIS_DB_lib.h
+ * @brief shared defintions for transactional databases
+ * @author Christian Grothoff
+ * @author Dominik Meister
+ */
+#ifndef ANASTASIS_DB_LIB_H
+#define ANASTASIS_DB_LIB_H
+
+
+/**
+ * Status code returned from functions running database commands.
+ * Can be combined with a function that returns the number
+ * of results, so all non-negative values indicate success.
+ */
+enum ANASTASIS_DB_QueryStatus
+{
+ /**
+ * A hard error occurred, retrying will not help.
+ */
+ ANASTASIS_DB_STATUS_HARD_ERROR = -2,
+
+ /**
+ * A soft error occurred, retrying the transaction may succeed.
+ * Includes DEADLOCKS and SERIALIZATION errors.
+ */
+ ANASTASIS_DB_STATUS_SOFT_ERROR = -1,
+
+ /**
+ * The transaction succeeded, but yielded zero results.
+ * May include the case where an INSERT failed with UNIQUE
+ * violation (i.e. row already exists) or where DELETE
+ * failed to remove anything (i.e. nothing matched).
+ */
+ ANASTASIS_DB_STATUS_SUCCESS_NO_RESULTS = 0,
+
+ /**
+ * The transaction succeeded, and yielded one result.
+ */
+ ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT = 1,
+
+ /**
+ * The specified User was unknown
+ */
+ ANASTASIS_DB_STATUS_UNKNOWN_USER = 6000,
+
+ /**
+ * The Users Payment had not sufficient posts left
+ */
+ ANASTASIS_DB_STATUS_NOT_SUFFICIENT_POSTS = 6001,
+
+ /**
+ * The Payment from the User has expired.
+ */
+ ANASTASIS_DB_STATUS_PAYMENT_EXPIRED = 6002
+};
+
+#endif
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: Worked on keyshare,
gnunet <=