aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Blättler <blatc2@bfh.ch>2024-06-13 11:28:17 +0200
committerChristian Blättler <blatc2@bfh.ch>2024-06-13 11:28:17 +0200
commitb9315cf4675bfb2ae94b71cf8931963b27873a5b (patch)
tree1716ba21f5c52f8950499b2520e4bcc8de437661 /src
parent25ae6b68400c6051a742a93061f9ae222cbd4620 (diff)
rename spent_tokens —> used_tokens
Diffstat (limited to 'src')
-rw-r--r--src/backend/taler-merchant-httpd.c4
-rw-r--r--src/backenddb/merchant-0008.sql9
-rw-r--r--src/backenddb/pg_insert_issued_token.c2
-rw-r--r--src/backenddb/pg_insert_spent_token.c4
-rw-r--r--src/backenddb/pg_lookup_spent_tokens_by_order.c2
5 files changed, 15 insertions, 6 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index 7384bfc9..95ba9bf1 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -2212,6 +2212,10 @@ run (void *cls,
return;
}
+ /* TODO: Load config variables for merchant token family
+ cipher type "rsa" or "cs" and key size.
+ Defaults to "rsa" and 2048 bits. */
+
if (GNUNET_OK !=
TALER_CONFIG_parse_currencies (cfg,
&TMH_num_cspecs,
diff --git a/src/backenddb/merchant-0008.sql b/src/backenddb/merchant-0008.sql
index bf50d4d6..74ed839d 100644
--- a/src/backenddb/merchant-0008.sql
+++ b/src/backenddb/merchant-0008.sql
@@ -33,15 +33,16 @@ CREATE TABLE IF NOT EXISTS merchant_issued_tokens
,token_family_key_serial BIGINT REFERENCES merchant_token_family_keys(token_family_key_serial) ON DELETE CASCADE
,blind_sig BYTEA NOT NULL
);
-COMMENT ON TABLE merchant_spent_tokens
+COMMENT ON TABLE merchant_issued_tokens
IS 'Tokens that have been (blindly) issued to customers.';
-COMMENT ON COLUMN merchant_spent_tokens.h_contract_terms
+COMMENT ON COLUMN merchant_issued_tokens.h_contract_terms
IS 'This is no foreign key by design.';
-COMMENT ON COLUMN merchant_spent_tokens.token_family_key_serial
+COMMENT ON COLUMN merchant_issued_tokens.token_family_key_serial
IS 'Token family key to which the spent token belongs.';
-COMMENT ON COLUMN merchant_spent_tokens.blind_sig
+COMMENT ON COLUMN merchant_issued_tokens.blind_sig
IS 'Blind signature made with token issue key to prove validity of token.';
+ALTER TABLE merchant_spent_tokens RENAME TO merchant_used_tokens;
-- Complete transaction
COMMIT;
diff --git a/src/backenddb/pg_insert_issued_token.c b/src/backenddb/pg_insert_issued_token.c
index 2523d427..2c07450f 100644
--- a/src/backenddb/pg_insert_issued_token.c
+++ b/src/backenddb/pg_insert_issued_token.c
@@ -52,6 +52,8 @@ TMH_PG_insert_issued_token (void *cls,
" JOIN merchant_token_family_keys"
" USING (token_family_serial)"
" WHERE h_pub = $1");
+
+ /* TODO: Increase issued counter on merchant_token_family table. */
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"issued_token_insert",
params);
diff --git a/src/backenddb/pg_insert_spent_token.c b/src/backenddb/pg_insert_spent_token.c
index 466b0b11..1f11c5a3 100644
--- a/src/backenddb/pg_insert_spent_token.c
+++ b/src/backenddb/pg_insert_spent_token.c
@@ -50,7 +50,7 @@ TMH_PG_insert_spent_token (void *cls,
check_connection (pg);
PREPARE (pg,
"spent_token_insert",
- "INSERT INTO merchant_spent_tokens"
+ "INSERT INTO merchant_used_tokens"
"(merchant_serial" /* TODO: Remove merchant_serial field from the db, it's already given by token_family.merchant_serial. */
",token_family_key_serial"
",h_contract_terms"
@@ -62,6 +62,8 @@ TMH_PG_insert_spent_token (void *cls,
" JOIN merchant_token_family_keys"
" USING (token_family_serial)"
" WHERE h_pub = $1");
+
+ /* TODO: Increase used counter on merchant_token_family table. */
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"spent_token_insert",
params);
diff --git a/src/backenddb/pg_lookup_spent_tokens_by_order.c b/src/backenddb/pg_lookup_spent_tokens_by_order.c
index 667cbcbc..5c27e072 100644
--- a/src/backenddb/pg_lookup_spent_tokens_by_order.c
+++ b/src/backenddb/pg_lookup_spent_tokens_by_order.c
@@ -143,7 +143,7 @@ TMH_PG_lookup_spent_tokens_by_order (void *cls,
",token_pub"
",token_sig"
",blind_sig"
- " FROM merchant_spent_tokens"
+ " FROM merchant_used_tokens"
" JOIN merchant_contract_terms"
" USING (h_contract_terms)"
" JOIN merchant_token_family_keys"