donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit 9eff9f5aea89fc97d591a6cdfd9f2ef9a2c7cc49
parent a2bd2193af616f11b872e3eaeacc6e6044f62d62
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
Date:   Thu,  5 Oct 2023 13:14:33 +0200

[db] Added donation units tables, modified other tables

Diffstat:
Asrc/donaudb/0002-donation_unit_revocations.sql | 22++++++++++++++++++++++
Asrc/donaudb/0002-donation_units.sql | 32++++++++++++++++++++++++++++++++
Msrc/donaudb/0002-donau_receipts_issued.sql | 8++------
Msrc/donaudb/0002-donau_receipts_submitted.sql | 8++++----
Msrc/donaudb/0002-donau_sign_keys.sql | 4+---
Msrc/donaudb/0002-signkey_revocations.sql | 3+--
6 files changed, 62 insertions(+), 15 deletions(-)

diff --git a/src/donaudb/0002-donation_unit_revocations.sql b/src/donaudb/0002-donation_unit_revocations.sql @@ -0,0 +1,22 @@ +-- +-- This file is part of TALER +-- Copyright (C) 2014--2022 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER 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 General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +CREATE TABLE IF NOT EXISTS donation_unit_revocations + (donation_unit_revocations_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE + ,donation_unit_serial INT8 PRIMARY KEY REFERENCES donation_units (donation_unit_serial) ON DELETE CASCADE + ); +COMMENT ON TABLE donation_unit_revocations + IS 'remembering which donation_unit keys have been revoked'; diff --git a/src/donaudb/0002-donation_units.sql b/src/donaudb/0002-donation_units.sql @@ -0,0 +1,32 @@ +-- +-- This file is part of TALER +-- Copyright (C) 2014--2022 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 3, or (at your option) any later version. +-- +-- TALER 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 General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +CREATE TABLE donation_units + (donation_unit_serial BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE + ,donation_unit_pub_hash BYTEA PRIMARY KEY CHECK (LENGTH(donation_unit_pub_hash)=64) + ,donation_unit_pub BYTEA NOT NULL + ,valid_from INT8 NOT NULL + ,expire_legal INT8 NOT NULL + ,donation_unit taler_amount NOT NULL + ); +COMMENT ON TABLE donation_units + IS 'Main donation_unit table. All the valid donation_unit the exchange knows about.'; +COMMENT ON COLUMN donation_units.donation_unit_serial + IS 'needed for exchange-auditor replication logic'; + +CREATE INDEX donation_units_by_expire_legal_index + ON donation_units + (expire_legal); diff --git a/src/donaudb/0002-donau_receipts_issued.sql b/src/donaudb/0002-donau_receipts_issued.sql @@ -18,10 +18,8 @@ CREATE TABLE receipts_issued (receipt_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE ,charity_sig BYTEA CHECK (LENGTH(charity_sig)=64) ,charity_id BIGINT NOT NULL REFERENCES charities (charity_id) ON DELETE CASCADE - ,receipt_hash BYTEA NOT NULL -- H(BDID+...) - -- + amount --- ,donation_unit_key_id INT8 NOT NULL --- ,donation_unit_sig BYTEA CHECK (LENGTH(donation_unit_sig)=64) + ,receipt_hash BYTEA NOT NULL + ,amount taler_amount NOT NULL ); COMMENT ON TABLE receipts_issued IS 'Table containing the issued blinded donation receipts to the charity.'; @@ -29,5 +27,3 @@ COMMENT ON COLUMN receipts_issued.charity_sig IS 'Signature from the charity.'; COMMENT ON COLUMN receipts_issued.receipt_hash IS 'Hash value of the receipt received.'; - --- Sign (total-amount, H(BDID_1 + H(p1), BDID_2 + H(p2), ...)) diff --git a/src/donaudb/0002-donau_receipts_submitted.sql b/src/donaudb/0002-donau_receipts_submitted.sql @@ -17,8 +17,8 @@ CREATE TABLE receipts_submitted (receipt_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE ,hash_tax_number BYTEA NOT NULL - ,nonce BYTEA NOT NULL UNIQUE -- LENGTH constraint - ,total_amount taler_amount NOT NULL -- or maybe better: reference to public key used to sign! => donation unit key + ,nonce BYTEA NOT NULL UNIQUE CHECK (LENGTH(nonce)=32) + ,donation_unit_pub BYTEA NOT NULL REFERENCES donation_units (donation_unit_pub) ,donau_sig BYTEA NOT NULL UNIQUE ,donation_year INT8 NOT NULL ); @@ -26,5 +26,5 @@ COMMENT ON TABLE receipts_submitted IS 'Table containing information of the donation receips submitted from the donor.'; COMMENT ON COLUMN receipts_submitted.hash_tax_number IS 'The hash of the tax number and salt.'; -COMMENT ON COLUMN receipts_submitted.total_amount - IS 'The total amount over all donation receipts.'; +COMMENT ON COLUMN receipts_submitted.donation_unit_pub + IS 'Reference to public key used to sign.'; diff --git a/src/donaudb/0002-donau_sign_keys.sql b/src/donaudb/0002-donau_sign_keys.sql @@ -15,7 +15,7 @@ -- CREATE TABLE donau_sign_keys - (esk_serial BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE + (dsk_serial BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE ,donau_pub BYTEA PRIMARY KEY CHECK (LENGTH(donau_pub)=32) ,valid_from INT8 NOT NULL ,expire_sign INT8 NOT NULL @@ -25,8 +25,6 @@ COMMENT ON TABLE donau_sign_keys IS 'Table with master public key signatures on donau online signing keys.'; COMMENT ON COLUMN donau_sign_keys.donau_pub IS 'Public online signing key of the donau.'; -COMMENT ON COLUMN donau_sign_keys.master_sig - IS 'Signature affirming the validity of the signing key of purpose TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY.'; COMMENT ON COLUMN donau_sign_keys.valid_from IS 'Time when this online signing key will first be used to sign messages.'; COMMENT ON COLUMN donau_sign_keys.expire_sign diff --git a/src/donaudb/0002-signkey_revocations.sql b/src/donaudb/0002-signkey_revocations.sql @@ -16,8 +16,7 @@ CREATE TABLE signkey_revocations (signkey_revocations_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE - ,esk_serial INT8 PRIMARY KEY REFERENCES donau_sign_keys (esk_serial) ON DELETE CASCADE - ,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64) + ,dsk_serial INT8 PRIMARY KEY REFERENCES donau_sign_keys (dsk_serial) ON DELETE CASCADE ); COMMENT ON TABLE signkey_revocations IS 'Table storing which online signing keys have been revoked';