gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: db reorg and comments


From: gnunet
Subject: [taler-anastasis] branch master updated: db reorg and comments
Date: Mon, 16 Nov 2020 16:25:01 +0100

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 b656a23  db reorg and comments
b656a23 is described below

commit b656a23c5c7b6da6ae531bc9040c60ed985422d0
Author: Dominik Meister <dominik.meister@hotmail.ch>
AuthorDate: Mon Nov 16 16:24:51 2020 +0100

    db reorg and comments
---
 src/lib/anastasis_api_redux.c              |  4 +-
 src/lib/test_anastasis_api.conf            |  2 +-
 src/stasis/plugin_anastasis_postgres.c     | 14 +++---
 src/stasis/stasis-0001.sql                 | 80 +++++++++++++++++++++++++++---
 src/stasis/test_anastasis_db_postgres.conf |  2 +-
 5 files changed, 85 insertions(+), 17 deletions(-)

diff --git a/src/lib/anastasis_api_redux.c b/src/lib/anastasis_api_redux.c
index 09c1cf7..8100b9e 100644
--- a/src/lib/anastasis_api_redux.c
+++ b/src/lib/anastasis_api_redux.c
@@ -717,7 +717,7 @@ select_country (json_t *state,
   {
     ANASTASIS_redux_fail (cb,
                           cb_cls,
-                          TALER_EC_ANASTASIS_REDUCER_ARGUMENTS_MISSING,
+                          TALER_EC_ANASTASIS_REDUCER_ACTION_INVALID,
                           "select_country");
     return NULL;
   }
@@ -946,7 +946,7 @@ enter_user_attributes (json_t *state,
   {
     ANASTASIS_redux_fail (cb,
                           cb_cls,
-                          TALER_EC_ANASTASIS_REDUCER_ARGUMENTS_MISSING,
+                          TALER_EC_ANASTASIS_REDUCER_ACTION_INVALID,
                           "enter_user_attributes");
     return NULL;
   }
diff --git a/src/lib/test_anastasis_api.conf b/src/lib/test_anastasis_api.conf
index 91db82a..0ca4c47 100644
--- a/src/lib/test_anastasis_api.conf
+++ b/src/lib/test_anastasis_api.conf
@@ -70,7 +70,7 @@ UPLOAD_LIMIT_MB = 1
 SUPPORTED_METHODS = question
 
 # This specifies which database the postgres backend uses.
-[anastasisdb-postgres]
+[stasis-postgres]
 CONFIG = postgres:///anastasischeck
 
 ##########################################
diff --git a/src/stasis/plugin_anastasis_postgres.c 
b/src/stasis/plugin_anastasis_postgres.c
index edec66f..b518b62 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -1980,7 +1980,7 @@ libanastasis_plugin_db_postgres_init (void *cls)
                             ",amount_val"
                             ",amount_frac"
                             ",payment_identifier"
-                            ",timestamp"
+                            ",creation_date"
                             ") VALUES "
                             "($1, $2, $3, $4, $5, $6);",
                             4),
@@ -1990,7 +1990,7 @@ libanastasis_plugin_db_postgres_init (void *cls)
                             ",amount_val"
                             ",amount_frac"
                             ",payment_identifier"
-                            ",timestamp"
+                            ",creation_date"
                             ") VALUES "
                             "($1, $2, $3, $4, $5);",
                             5),
@@ -2018,7 +2018,7 @@ libanastasis_plugin_db_postgres_init (void *cls)
                             2),
     GNUNET_PQ_make_prepare ("recdoc_payment_select",
                             "SELECT"
-                            " timestamp"
+                            " creation_date"
                             ",post_counter"
                             ",amount_val"
                             ",amount_frac"
@@ -2028,7 +2028,7 @@ libanastasis_plugin_db_postgres_init (void *cls)
                             1),
     GNUNET_PQ_make_prepare ("challenge_payment_select",
                             "SELECT"
-                            " timestamp"
+                            " creation_date"
                             ",amount_val"
                             ",amount_frac"
                             ",paid"
@@ -2057,7 +2057,7 @@ libanastasis_plugin_db_postgres_init (void *cls)
                             0),
     GNUNET_PQ_make_prepare ("recdoc_payments_select_by_account",
                             "SELECT"
-                            " timestamp"
+                            " creation_date"
                             ",payment_identifier"
                             ",amount_val"
                             ",amount_frac"
@@ -2077,14 +2077,14 @@ libanastasis_plugin_db_postgres_init (void *cls)
                             "WHERE"
                             "  paid=FALSE"
                             " AND"
-                            "  timestamp < $1;",
+                            "  creation_date < $1;",
                             1),
     GNUNET_PQ_make_prepare ("gc_challenge_pending_payments",
                             "DELETE FROM anastasis_challenge_payment "
                             "WHERE"
                             "  paid=FALSE"
                             " AND"
-                            "  timestamp < $1;",
+                            "  creation_date < $1;",
                             1),
     GNUNET_PQ_make_prepare ("truth_insert",
                             "INSERT INTO anastasis_truth "
diff --git a/src/stasis/stasis-0001.sql b/src/stasis/stasis-0001.sql
index 0e655a6..532936e 100644
--- a/src/stasis/stasis-0001.sql
+++ b/src/stasis/stasis-0001.sql
@@ -35,12 +35,29 @@ CREATE TABLE IF NOT EXISTS anastasis_truth
    expiration TIMESTAMP NOT NULL);
 COMMENT ON TABLE anastasis_truth
   IS 'Truth data is needed to authenticate clients during recovery';
+COMMENT ON COLUMN anastasis_truth.truth_public_key
+  IS 'The truth public key identifies this truth record';
+COMMENT ON COLUMN anastasis_truth.key_share_data
+  IS 'Stores the encrypted key share used to recover the key';
+COMMENT ON COLUMN anastasis_truth.method
+  IS 'Defines the authentication method (SMS, E-Mail, Question..)';
+COMMENT ON COLUMN anastasis_truth.encrypted_truth
+  IS 'Stores the encrypted authentication data';
+COMMENT ON COLUMN anastasis_truth.truth_mime
+  IS 'Defines the mime type of the stored authentcation data';
+COMMENT ON COLUMN anastasis_truth.expiration
+  IS 'At which date will the truth record expire';
 
 CREATE TABLE IF NOT EXISTS anastasis_user
   (user_id BYTEA PRIMARY KEY CHECK(LENGTH(user_id)=32),
    expiration_date TIMESTAMP NOT NULL);
+COMMENT ON TABLE anastasis_user
+  IS 'Saves a user which is using Anastasis';
+COMMENT ON COLUMN anastasis_user.user_id
+  IS 'Identifier of the user account';
+COMMENT ON COLUMN anastasis_user.expiration_date
+  IS 'At which date will the user record expire';
 
--- FIXME: rename column, do NOT use SQL keyword 'timestamp' for column name!
 CREATE TABLE IF NOT EXISTS anastasis_recdoc_payment
   (payment_id BIGSERIAL PRIMARY KEY,
    user_id BYTEA NOT NULL REFERENCES anastasis_user(user_id),
@@ -48,24 +65,52 @@ CREATE TABLE IF NOT EXISTS anastasis_recdoc_payment
    amount_val INT8 NOT NULL,
    amount_frac INT4 NOT NULL,
    payment_identifier BYTEA NOT NULL CHECK(LENGTH(payment_identifier)=32),
-   timestamp TIMESTAMP NOT NULL DEFAULT NOW(),
+   creation_date TIMESTAMP NOT NULL DEFAULT NOW(),
    paid BOOLEAN NOT NULL DEFAULT FALSE);
+COMMENT ON TABLE anastasis_recdoc_payment
+  IS 'Records a payment for a recovery document';
+COMMENT ON COLUMN anastasis_recdoc_payment.payment_id
+  IS 'Serial number which identifies the payment';
+COMMENT ON COLUMN anastasis_recdoc_payment.user_id
+  IS 'Link to the corresponding user who paid';
+COMMENT ON COLUMN anastasis_recdoc_payment.post_counter
+  IS 'For how many posts does the user pay';
 COMMENT ON COLUMN anastasis_recdoc_payment.amount_val
   IS 'Amount we were paid';
+COMMENT ON COLUMN anastasis_recdoc_payment.amount_frac
+  IS 'Amount we were paid fraction';
+COMMENT ON COLUMN anastasis_recdoc_payment.payment_identifier
+  IS 'Payment identifier which the user has to provide';
+COMMENT ON COLUMN anastasis_recdoc_payment.creation_date
+  IS 'Creation date of the payment';
+COMMENT ON COLUMN anastasis_recdoc_payment.paid
+  IS 'Is the payment finished';
 
--- FIXME: rename column, do NOT use SQL keyword 'timestamp' for column name!
 CREATE TABLE IF NOT EXISTS anastasis_challenge_payment
   (payment_id BIGSERIAL PRIMARY KEY,
    truth_public_key BYTEA NOT NULL,
    amount_val INT8 NOT NULL,
    amount_frac INT4 NOT NULL,
    payment_identifier BYTEA NOT NULL CHECK(LENGTH(payment_identifier)=32),
-   timestamp TIMESTAMP NOT NULL DEFAULT NOW(),
+   creation_date TIMESTAMP NOT NULL DEFAULT NOW(),
    paid BOOLEAN NOT NULL DEFAULT FALSE
   );
+COMMENT ON TABLE anastasis_recdoc_payment
+  IS 'Records a payment for a challenge';
+COMMENT ON COLUMN anastasis_challenge_payment.payment_id
+  IS 'Serial number which identifies the payment';
+COMMENT ON COLUMN anastasis_challenge_payment.truth_public_key
+  IS 'Link to the corresponding challenge which is paid';
 COMMENT ON COLUMN anastasis_challenge_payment.amount_val
   IS 'Amount we were paid';
-
+COMMENT ON COLUMN anastasis_challenge_payment.amount_frac
+  IS 'Amount we were paid fraction';
+COMMENT ON COLUMN anastasis_challenge_payment.payment_identifier
+  IS 'Payment identifier which the user has to provide';
+COMMENT ON COLUMN anastasis_challenge_payment.creation_date
+  IS 'Creation date of the payment';
+COMMENT ON COLUMN anastasis_challenge_payment.paid
+  IS 'Is the payment finished';
 
 CREATE TABLE IF NOT EXISTS anastasis_recoverydocument
   (user_id BYTEA NOT NULL REFERENCES anastasis_user(user_id),
@@ -74,6 +119,18 @@ CREATE TABLE IF NOT EXISTS anastasis_recoverydocument
    recovery_data_hash BYTEA NOT NULL CHECK(length(recovery_data_hash)=64),
    recovery_data BYTEA NOT NULL,
    PRIMARY KEY (user_id, version));
+COMMENT ON TABLE anastasis_recoverydocument
+  IS 'Stores a recovery document which contains the policy and the encrypted 
core secret';
+COMMENT ON COLUMN anastasis_recoverydocument.user_id
+  IS 'Link to the owner of this recovery document';
+COMMENT ON COLUMN anastasis_recoverydocument.version
+  IS 'The version of this recovery document';
+COMMENT ON COLUMN anastasis_recoverydocument.account_sig
+  IS 'Signature of the recovery document';
+COMMENT ON COLUMN anastasis_recoverydocument.recovery_data_hash
+  IS 'Hash of the recovery document to prevent unnecessary uploads';
+COMMENT ON COLUMN anastasis_recoverydocument.recovery_data
+  IS 'Contains the encrypted policy and core secret';
 
 CREATE TABLE IF NOT EXISTS anastasis_challengecode
   (truth_public_key BYTEA NOT NULL,
@@ -81,7 +138,18 @@ CREATE TABLE IF NOT EXISTS anastasis_challengecode
    creation_date TIMESTAMP NOT NULL DEFAULT NOW(),
    expiration_date TIMESTAMP NOT NULL,
    retry_counter INT4 NOT NULL);
-
+COMMENT ON TABLE anastasis_challengecode
+  IS 'Stores a code which is checked for the authentication by SMS, E-Mail..';
+COMMENT ON COLUMN anastasis_challengecode.truth_public_key
+  IS 'Link to the corresponding challenge which is solved';
+COMMENT ON COLUMN anastasis_challengecode.code
+  IS 'The pin code which is sent to the user and verified';
+COMMENT ON COLUMN anastasis_challengecode.creation_date
+  IS 'Creation date of the code';
+COMMENT ON COLUMN anastasis_challengecode.expiration_date
+  IS 'When will the code expire';
+COMMENT ON COLUMN anastasis_challengecode.retry_counter
+  IS 'How many tries are left for this code must be > 0';
 
 -- Complete transaction
 COMMIT;
diff --git a/src/stasis/test_anastasis_db_postgres.conf 
b/src/stasis/test_anastasis_db_postgres.conf
index a1e3d88..8971a62 100644
--- a/src/stasis/test_anastasis_db_postgres.conf
+++ b/src/stasis/test_anastasis_db_postgres.conf
@@ -1,6 +1,6 @@
 [anastasis]
 #The DB plugin to use
-DB = anastasischeck
+DB = postgres
 
 [taler]
 CURRENCY = EUR

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