summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2023-09-05 23:39:47 +0200
committerChristian Grothoff <grothoff@gnunet.org>2023-09-05 23:39:47 +0200
commit631ba9db07f0613fd3ec673932dae1f68e86ae80 (patch)
treed19270f7020bb74877373d232783db8a82ab5e8e
parent4be8fe916b1596ec13339d5f91034b878ef9ace4 (diff)
downloadmerchant-631ba9db07f0613fd3ec673932dae1f68e86ae80.tar.gz
merchant-631ba9db07f0613fd3ec673932dae1f68e86ae80.tar.bz2
merchant-631ba9db07f0613fd3ec673932dae1f68e86ae80.zip
define table for login tokens
-rw-r--r--src/backenddb/merchant-0001.sql25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/backenddb/merchant-0001.sql b/src/backenddb/merchant-0001.sql
index 4d286db6..03474831 100644
--- a/src/backenddb/merchant-0001.sql
+++ b/src/backenddb/merchant-0001.sql
@@ -118,6 +118,31 @@ COMMENT ON COLUMN merchant_instances.user_type
IS 'what type of user is this (individual or business)';
+CREATE TABLE IF NOT EXISTS merchant_login_tokens
+ (token BYTEA NOT NULL UNIQUE CHECK (LENGTH(token)=32),
+ creation_time INT8 NOT NULL,
+ expiration_time INT8 NOT NULL,
+ validity_scope INT4 NOT NULL,
+ merchant_serial BIGINT
+ REFERENCES merchant_instances (merchant_serial) ON DELETE CASCADE
+ );
+COMMENT ON TABLE merchant_login_tokens
+ IS 'login tokens that have been created for the given instance';
+COMMENT ON COLUMN merchant_login_tokens.token
+ IS 'binary value of the login token';
+COMMENT ON COLUMN merchant_login_tokens.creation_time
+ IS 'time when the token was created';
+COMMENT ON COLUMN merchant_login_tokens.expiration_time
+ IS 'determines when the token expires';
+COMMENT ON COLUMN merchant_login_tokens.merchant_scope
+ IS 'identifies the opeations for which the token is valid';
+COMMENT ON COLUMN merchant_login_tokens.merchant_serial
+ IS 'identifies the instance for which the token is valid';
+
+CREATE INDEX IF NOT EXISTS merchant_login_tokens_by_expiration
+ ON merchant_login_tokens
+ (expiration_time);
+
CREATE TABLE IF NOT EXISTS merchant_keys
(merchant_priv BYTEA NOT NULL UNIQUE CHECK (LENGTH(merchant_priv)=32),