commit 631ba9db07f0613fd3ec673932dae1f68e86ae80
parent 4be8fe916b1596ec13339d5f91034b878ef9ace4
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Tue, 5 Sep 2023 23:39:47 +0200
define table for login tokens
Diffstat:
1 file changed, 25 insertions(+), 0 deletions(-)
diff --git 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),