commit d4d2af834cf28f5df1f1b3660a94551d24816fa0
parent 14d08c0bb8a3121abde4a2a117ac1f7349540146
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
Date: Tue, 28 May 2024 15:07:00 +0200
added db comments
Diffstat:
7 files changed, 116 insertions(+), 16 deletions(-)
diff --git a/src/donau/donau-httpd_batch-submit.c b/src/donau/donau-httpd_batch-submit.c
@@ -192,11 +192,10 @@ DH_handler_submit_receipts_post (struct DH_RequestContext *rc,
if (qs < 0)
{
GNUNET_break (0);
- // FIXME change error message
return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_PARAMETER_MALFORMED,
- "donation_receipts");
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ NULL);
}
return MHD_HTTP_CREATED;
diff --git a/src/donaudb/0002-donation_units.sql b/src/donaudb/0002-donation_units.sql
@@ -23,5 +23,9 @@ CREATE TABLE donation_units
);
COMMENT ON TABLE donation_units
IS 'Main donation_unit table. All the valid donation units the Donau knows about.';
+COMMENT ON COLUMN donation_units.h_donation_unit_pub
+ IS 'Hash value of the donation unit public key.';
+COMMENT ON COLUMN donation_units.validity_year
+ IS 'The year, for which the donation unit is valid.';
COMMENT ON COLUMN donation_units.value
- IS 'Value the donation unit has in Taler amount';
+ IS 'The amount and currency that this donation unit represents.';
diff --git a/src/donaudb/0002-donau_charities.sql b/src/donaudb/0002-donau_charities.sql
@@ -24,10 +24,10 @@ CREATE TABLE charities
,current_year INT8 NOT NULL
);
COMMENT ON TABLE charities
- IS 'Table with master public keys of charities.';
+ IS 'Table with public keys of all recognized charities.';
COMMENT ON COLUMN charities.charity_pub
- IS 'Public key of the charity.';
+ IS 'Charity EdDSA public key.';
COMMENT ON COLUMN charities.max_per_year
- IS 'The annual donation limit.';
+ IS 'The annual donation limit according to local law.';
COMMENT ON COLUMN charities.receipts_to_date
IS 'The current amount of donations in the current year. Reset to 0 when incrementing the current_year (but remember historic values in history table when doing so).';
diff --git a/src/donaudb/0002-donau_receipts_issued.sql b/src/donaudb/0002-donau_receipts_issued.sql
@@ -22,8 +22,8 @@ CREATE TABLE receipts_issued
,amount taler_amount NOT NULL
);
COMMENT ON TABLE receipts_issued
- IS 'Table containing the issued blinded donation receipts to the charity.';
+ IS 'Table containing the issued blinded donation receipts.';
COMMENT ON COLUMN receipts_issued.blinded_sig
- IS 'Signature from the charity.';
+ IS 'Array of blinded signatures. Blind signed BKPs by the Donau';
COMMENT ON COLUMN receipts_issued.receipt_hash
IS 'Hash value over all the blinded donation receipt received plus the hash of the donation units public key.';
diff --git a/src/donaudb/0002-donau_receipts_submitted.sql b/src/donaudb/0002-donau_receipts_submitted.sql
@@ -23,8 +23,12 @@ CREATE TABLE receipts_submitted
,donation_year INT8 NOT NULL
);
COMMENT ON TABLE receipts_submitted
- IS 'Table containing information of the donation receips submitted from the donor.';
+ IS 'Table containing the donation receips submitted from the donor.';
COMMENT ON COLUMN receipts_submitted.h_tax_number
IS 'The hash of the tax number and salt.';
+COMMENT ON COLUMN receipts_submitted.nonce
+ IS 'The nonce used in the Unique Donor Identifier.';
COMMENT ON COLUMN receipts_submitted.donation_unit_pub
IS 'Reference to public key used to sign.';
+COMMENT ON COLUMN receipts_submitted.donation_unit_sig
+ IS 'The unblided signature the Donau made.';
diff --git a/src/donaudb/0002-donau_sign_keys.sql b/src/donaudb/0002-donau_sign_keys.sql
@@ -22,12 +22,12 @@ CREATE TABLE donau_sign_keys
,expire_legal INT8 NOT NULL
);
COMMENT ON TABLE donau_sign_keys
- IS 'Table with master public key signatures on donau online signing keys.';
+ IS 'Table with all Donau EdDSA signing keys.';
COMMENT ON COLUMN donau_sign_keys.donau_pub
- IS 'Public online signing key of the donau.';
+ IS 'Donau EdDSA public key.';
COMMENT ON COLUMN donau_sign_keys.valid_from
- IS 'Time when this online signing key will first be used to sign messages.';
+ IS 'Time when this signing key will first be used to sign messages.';
COMMENT ON COLUMN donau_sign_keys.expire_sign
- IS 'Time when this online signing key will no longer be used to sign.';
+ IS 'Time when this signing key will no longer be used to sign.';
COMMENT ON COLUMN donau_sign_keys.expire_legal
- IS 'Time when this online signing key legally expires.';
+ IS 'Time when this signing key legally expires.';
diff --git a/src/donaudb/test_donaudb.c b/src/donaudb/test_donaudb.c
@@ -134,6 +134,99 @@ iterate_active_signing_keys_cb (
}
+#if 0
+struct DenomKeyPair
+{
+ struct TALER_DenominationPrivateKey priv;
+ struct TALER_DenominationPublicKey pub;
+};
+
+
+/**
+ * Create a denomination key pair by registering the denomination in the DB.
+ *
+ * @param size the size of the denomination key
+ * @param now time to use for key generation, legal expiration will be 3h later.
+ * @param fees fees to use
+ * @return the denominaiton key pair; NULL upon error
+ */
+static struct DenomKeyPair *
+create_denom_key_pair (unsigned int size,
+ struct GNUNET_TIME_Timestamp now,
+ const struct TALER_Amount *value,
+ const struct TALER_DenomFeeSet *fees)
+{
+ struct DenomKeyPair *dkp;
+ struct TALER_EXCHANGEDB_DenominationKey dki;
+ struct TALER_EXCHANGEDB_DenominationKeyInformation issue2;
+
+ dkp = GNUNET_new (struct DenomKeyPair);
+ GNUNET_assert (GNUNET_OK ==
+ TALER_denom_priv_create (&dkp->priv,
+ &dkp->pub,
+ GNUNET_CRYPTO_BSA_RSA,
+ size));
+ /* Using memset() as fields like master key and signature
+ are not properly initialized for this test. */
+ memset (&dki,
+ 0,
+ sizeof (struct TALER_EXCHANGEDB_DenominationKey));
+ dki.denom_pub = dkp->pub;
+ dki.issue.start = now;
+ dki.issue.expire_withdraw
+ = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (
+ now.abs_time,
+ GNUNET_TIME_UNIT_HOURS));
+ dki.issue.expire_deposit
+ = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (
+ now.abs_time,
+ GNUNET_TIME_relative_multiply (
+ GNUNET_TIME_UNIT_HOURS, 2)));
+ dki.issue.expire_legal
+ = GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_absolute_add (
+ now.abs_time,
+ GNUNET_TIME_relative_multiply (
+ GNUNET_TIME_UNIT_HOURS, 3)));
+ dki.issue.value = *value;
+ dki.issue.fees = *fees;
+ TALER_denom_pub_hash (&dkp->pub,
+ &dki.issue.denom_hash);
+ if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
+ plugin->insert_denomination_info (plugin->cls,
+ &dki.denom_pub,
+ &dki.issue))
+ {
+ GNUNET_break (0);
+ destroy_denom_key_pair (dkp);
+ return NULL;
+ }
+ memset (&issue2, 0, sizeof (issue2));
+ if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
+ plugin->get_denomination_info (plugin->cls,
+ &dki.issue.denom_hash,
+ &issue2))
+ {
+ GNUNET_break (0);
+ destroy_denom_key_pair (dkp);
+ return NULL;
+ }
+ if (0 != GNUNET_memcmp (&dki.issue,
+ &issue2))
+ {
+ GNUNET_break (0);
+ destroy_denom_key_pair (dkp);
+ return NULL;
+ }
+ return dkp;
+}
+
+
+#endif
+
+
/**
* Main function that will be run by the scheduler.
*