diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2023-09-01 14:27:48 +0200 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2023-09-01 14:27:48 +0200 |
commit | 35dcd4514a93ba0f5353ecd1194fc9b515f2aad4 (patch) | |
tree | 399d8f8fbebf5e8ac383fc318b7be08901279a31 /src/backenddb/merchant-0001.sql | |
parent | 858e3047b8b595ab693e16ce0bbe0b8983b072ed (diff) |
new CRUD APIs for OTP devices and merchant accounts (fixes #7929, #7824), one minor test is still failing...
Diffstat (limited to 'src/backenddb/merchant-0001.sql')
-rw-r--r-- | src/backenddb/merchant-0001.sql | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/backenddb/merchant-0001.sql b/src/backenddb/merchant-0001.sql index bbc97828..4d286db6 100644 --- a/src/backenddb/merchant-0001.sql +++ b/src/backenddb/merchant-0001.sql @@ -291,6 +291,7 @@ CREATE TABLE IF NOT EXISTS merchant_contract_terms REFERENCES merchant_instances (merchant_serial) ON DELETE CASCADE ,order_id TEXT NOT NULL ,contract_terms BYTEA NOT NULL + ,wallet_data BYTEA DEFAULT NULL ,h_contract_terms BYTEA NOT NULL CHECK (LENGTH(h_contract_terms)=64) ,creation_time INT8 NOT NULL ,pay_deadline INT8 NOT NULL @@ -313,6 +314,8 @@ COMMENT ON COLUMN merchant_contract_terms.merchant_serial IS 'Identifies the instance offering the contract'; COMMENT ON COLUMN merchant_contract_terms.contract_terms IS 'These contract terms include the wallet nonce'; +COMMENT ON COLUMN merchant_contract_terms.wallet_data + IS 'Data provided by the wallet when paying for the contract (subcontract selection, blinded tokens, etc.)'; COMMENT ON COLUMN merchant_contract_terms.h_contract_terms IS 'Hash over contract_terms'; COMMENT ON COLUMN merchant_contract_terms.refund_deadline @@ -643,14 +646,37 @@ COMMENT ON COLUMN merchant_kyc.exchange_url IS 'Which exchange base URL is this KYC status valid for'; +CREATE TABLE IF NOT EXISTS merchant_otp_devices + (otp_serial BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY + ,merchant_serial BIGINT NOT NULL + REFERENCES merchant_instances (merchant_serial) ON DELETE CASCADE + ,otp_id TEXT NOT NULL + ,otp_description TEXT NOT NULL + ,otp_key TEXT DEFAULT NULL + ,otp_algorithm INT NOT NULL DEFAULT (0) + ,otp_ctr INT8 NOT NULL DEFAULT (0) + ,UNIQUE (merchant_serial, otp_id) + ); +COMMENT ON TABLE merchant_otp_devices + IS 'OTP device owned by a merchant'; +COMMENT ON COLUMN merchant_otp_devices.otp_description + IS 'Human-readable OTP device description'; +COMMENT ON COLUMN merchant_otp_devices.otp_key + IS 'A base64-encoded key of the point-of-sale. It will be use by the OTP device'; +COMMENT ON COLUMN merchant_otp_devices.otp_algorithm + IS 'algorithm to used to generate the confirmation code. It is linked with the otp_key and otp_ctr'; +COMMENT ON COLUMN merchant_otp_devices.otp_ctr + IS 'counter for counter-based OTP generators'; + + CREATE TABLE IF NOT EXISTS merchant_template (template_serial BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY ,merchant_serial BIGINT NOT NULL REFERENCES merchant_instances (merchant_serial) ON DELETE CASCADE ,template_id TEXT NOT NULL ,template_description TEXT NOT NULL - ,pos_key TEXT DEFAULT NULL - ,pos_algorithm INT NOT NULL DEFAULT (0) + ,otp_device_id BIGINT + REFERENCES merchant_otp_devices (otp_serial) ON DELETE SET NULL ,template_contract TEXT NOT NULL -- in JSON format ,UNIQUE (merchant_serial, template_id) ); @@ -658,14 +684,11 @@ COMMENT ON TABLE merchant_template IS 'template used by the merchant (may be incomplete, frontend can override)'; COMMENT ON COLUMN merchant_template.template_description IS 'Human-readable template description'; -COMMENT ON COLUMN merchant_template.pos_key - IS 'A base64-encoded key of the point-of-sale. It will be use by the TOTP'; -COMMENT ON COLUMN merchant_template.pos_algorithm - IS 'algorithm to used to generate the confirmation code. It is link with the pos_key'; COMMENT ON COLUMN merchant_template.template_contract IS 'The template contract will contains some additional information.'; + CREATE TABLE IF NOT EXISTS merchant_webhook (webhook_serial BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY ,merchant_serial BIGINT NOT NULL |