summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-05-08 01:07:39 +0200
committerChristian Grothoff <christian@grothoff.org>2021-05-08 01:07:39 +0200
commit4713a43afead8008efb81afeb0639dc98015c5a1 (patch)
treee45d53ed30463f46c0441c151af964b6dcddc64f
parent7214412a05e38b8b957257c3ee99d8acb6571179 (diff)
downloaddocs-4713a43afead8008efb81afeb0639dc98015c5a1.tar.gz
docs-4713a43afead8008efb81afeb0639dc98015c5a1.tar.bz2
docs-4713a43afead8008efb81afeb0639dc98015c5a1.zip
more dd13 spec updates
-rw-r--r--core/api-common.rst32
-rw-r--r--core/api-exchange.rst87
-rw-r--r--design-documents/013-peer-to-peer-payments.rst73
3 files changed, 93 insertions, 99 deletions
diff --git a/core/api-common.rst b/core/api-common.rst
index 5c05db0..bcb0570 100644
--- a/core/api-common.rst
+++ b/core/api-common.rst
@@ -1036,7 +1036,7 @@ within the
.. _TALER_ReserveStatusRequestSignaturePS:
.. sourcecode:: c
- struct TALER_PurseStatusRequestSignaturePS {
+ struct TALER_ReserveStatusRequestSignaturePS {
/**
* purpose.purpose = TALER_SIGNATURE_RESERVE_STATUS_REQUEST
*/
@@ -1047,7 +1047,7 @@ within the
.. _TALER_ReserveHistoryRequestSignaturePS:
.. sourcecode:: c
- struct TALER_PurseStatusRequestSignaturePS {
+ struct TALER_ReserveHistoryRequestSignaturePS {
/**
* purpose.purpose = TALER_SIGNATURE_RESERVE_HISTORY_REQUEST
*/
@@ -1068,7 +1068,7 @@ within the
};
-.. _TALER_PurseStatusSignaturePS:
+.. _TALER_PurseStatusResponseSignaturePS:
.. sourcecode:: c
struct TALER_PurseStatusResponseSignaturePS {
@@ -1112,12 +1112,12 @@ within the
};
-.. _TALER_PursePaymentConfirmedSignaturePS:
+.. _TALER_PurseDepositConfirmedSignaturePS:
.. sourcecode:: c
- struct TALER_PursePaymentConfirmedSignaturePS {
+ struct TALER_PurseDepositConfirmedSignaturePS {
/**
- * purpose.purpose = TALER_SIGNATURE_PURSE_PAYMENT_CONFIRMED
+ * purpose.purpose = TALER_SIGNATURE_PURSE_DEPOSIT_CONFIRMED
*/
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
struct TALER_AmountNBO total_purse_amount;
@@ -1162,20 +1162,6 @@ within the
};
-.. _TALER_PursePaymentSignaturePS:
-.. sourcecode:: c
-
- struct TALER_PursePaymentSignaturePS {
- /**
- * purpose.purpose = TALER_SIGNATURE_PURSE_PAYMENT
- */
- struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
- struct TALER_AmountNBO coin_contribution;
- struct GNUNET_TIME_AbsoluteNBO purse_expiration;
- struct TALER_PursePublicKey purse_pub;
- };
-
-
.. _TALER_PurseMergeSuccessSignaturePS:
.. sourcecode:: c
@@ -1225,9 +1211,11 @@ within the
struct TALER_WadDataSignaturePS {
/**
- * purpose.purpose = TALER_SIGNATURE_ACCOUNT_SETUP_SUCCESS
+ * purpose.purpose = TALER_SIGNATURE_WAD_DATA
*/
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
- struct GNUNET_HashCode wad_data;
+ struct GNUNET_TIME_AbsoluteNBO wad_execution_time;
+ struct TALER_AmountNBO total_amount;
+ struct GNUNET_HashCode h_items;
struct TALER_WadId wad_id;
};
diff --git a/core/api-exchange.rst b/core/api-exchange.rst
index 27886c2..a2e3257 100644
--- a/core/api-exchange.rst
+++ b/core/api-exchange.rst
@@ -1046,9 +1046,9 @@ exchange.
| ReserveClosingTransaction
| ReserveRecoupTransaction;
- .. ts:def:: AccountHistoryTransaction
+ .. ts:def:: ReserveHistoryTransaction
- interface AccountHistoryTransaction {
+ interface ReserveHistoryTransaction {
type: "HISTORY";
// Fee agreed to by the reserve owner.
@@ -1562,7 +1562,7 @@ denomination.
| CoinRecoupTransaction
| CoinOldCoinRecoupTransaction
| CoinRecoupRefreshTransaction
- | CoinPursePaymentTransaction;
+ | CoinPurseDepositTransaction;
.. ts:def:: CoinDepositTransaction
@@ -1759,10 +1759,10 @@ denomination.
new_coin_ev: RsaBlindingKeySecret;
}
- .. ts:def:: CoinPursePaymentTransaction
+ .. ts:def:: CoinPurseDepositTransaction
- interface CoinPursePaymentTransaction {
- type: "PURSE_PAYMENT";
+ interface CoinPurseDepositTransaction {
+ type: "PURSE_DEPOSIT";
// The total amount of the coin's value absorbed
// by this transaction.
@@ -2432,12 +2432,11 @@ Wallet-to-wallet transfers
TODO for the spec:
- * add reserve history requests (with fee!)
- to reserve history (changes balance!)
- * specify new database schema at exchange (add SQL to DD13!)
- - something for in-progress kyc vs. completed kyc?
- => add kyc_date to reserves?
- => or have separate KYC table instead of NULLs in reserves!
+ * update DD13 eDB SQL: tables for incoming wads!
+ * do we need some special entry in account/reserve
+ histories for incoming WAD-transfers vs. other merges,
+ or do we re-use the existing 'merge' entry and just
+ generate it from the incoming-wad table?
* update wire transfer API to enable WAD IDs (and while we are
at it, should probably also write extended version to allow
_merchants_ to query for their inbound transfers, so spec
@@ -2445,19 +2444,6 @@ TODO for the spec:
tell exchange for inbound wire transfers that they are
from a partner bank where KYC fees would be waived!
-Discussion:
-
- * when the user POSTs to /kyc for a reserve with a payto URI
- that differs from the URI that was used to establish the
- reserve, do we 409 conflict or accept?
- That seems like an attack vector:
- Say I learn your account pub and wire you money from my
- bank account, thus blocking you from /kyc'ing your account!)
- * when the user POSTs to /kyc for an account with a payto URI
- that differs from the URI that was previously used for a
- /kyc for the same account, do we allow the KYC to proceed
- and update the bank account? Is there an attack vector?
-
.. http:GET:: /purses/$PURSE_PUB
@@ -2551,12 +2537,12 @@ Discussion:
:http:statuscode:`200 OK`:
The operation succeeded, the exchange confirms that all
coins were deposited into the purse.
- The response will include a `PursePaymentSuccess` object.
+ The response will include a `PurseDepositSuccess` object.
:http:statuscode:`202 Accepted`:
The payment was accepted, but insufficient to reach the
specified purse balance. The client should make further
purse deposits before the expiration deadline.
- The response will include a `PursePaymentAccepted` object.
+ The response will include a `PurseDepositAccepted` object.
:http:statuscode:`401 Unauthorized`:
A coin signature is invalid.
This response comes with a standard `ErrorDetail` response.
@@ -2656,9 +2642,9 @@ Discussion:
}
- .. ts:def:: PursePaymentSuccess
+ .. ts:def:: PurseDepositSuccess
- interface PursePaymentSuccess {
+ interface PurseDepositSuccess {
// Total amount paid into the purse.
total_purse_amount: Amount;
@@ -2667,7 +2653,7 @@ Discussion:
total_deposit_fees: Amount;
// EdDSA signature of the exchange affirming the payment,
- // of purpose TALER_SIGNATURE_PURSE_PAYMENT_CONFIRMED
+ // of purpose TALER_SIGNATURE_PURSE_DEPOSIT_CONFIRMED
// Signs over the above and the purse public key and
// the hash of the contract terms.
exchange_sig: EddsaSignature;
@@ -2677,9 +2663,9 @@ Discussion:
}
- .. ts:def:: PursePaymentAccepted
+ .. ts:def:: PurseDepositAccepted
- interface PursePaymentAccepted {
+ interface PurseDepositAccepted {
// Total amount paid so far into the purse, in this
// and previous requests.
@@ -2812,32 +2798,6 @@ Discussion:
// purse with the payment.
contract?: EncryptedContract;
- // Array of payments made to pay for the creation of the
- // purse. Can be empty, say if no payment is needed.
- payments: CreatePurseDeposit[];
-
- }
-
- .. ts:def:: CreatePurseDeposit {
-
- // Public key of the coin being used to pay for creating a purse.
- coin_pub: EddsaPublicKey;
-
- // Amount to be deposited, can be a fraction of the
- // coin's total value.
- contribution: Amount;
-
- // Hash of denomination RSA key with which the coin is signed.
- denom_pub_hash: HashCode;
-
- // Exchange's unblinded RSA signature of the coin.
- ub_sig: RsaSignature;
-
- // Signature of purpose TALER_SIGNATURE_PURSE_PAYMENT.
- // made by the customer with the
- // `coin's private key <coin-priv>`.
- coin_sig: EddsaSignature;
-
}
.. ts:def:: MergeSuccess
@@ -2882,6 +2842,8 @@ Discussion:
(from wire transfers or merges of purses) already have a
sufficient balance to cover the KYC fee. The signature
affirms that the KYC fee can and should be charged to the reserve.
+ The request always updates the payto URI associated with
+ the reserve, even if the KYC process fails or is not completed.
**Request:** The request body must be a `AccountSetupRequest` object.
@@ -2900,11 +2862,6 @@ Discussion:
the required KYC checks to open the account. Afterwards, the
request should be repeated.
The response will be an `AccountKycRedirect` object.
- :http:statuscode:`409 Conflict`:
- The reserve or account was previously associated with a different
- payto URI, and changing the associated bank account is not
- permitted. FIXME: should we allow it? Should we use PATCH for this?
- Or only conflict if this was an account and not a reserve!??
:http:statuscode:`504 Gateway Timeout`:
The exchange did not receive a confirmation from the KYC service
within the specified time period. Used when long-polling for the
@@ -3002,6 +2959,10 @@ wallet-to-wallet payments. Only another exchange should access this endpoint.
// Total transfer amount claimed by the exchange.
total: Amount;
+ // Indicative time by which the wad was given to the
+ // bank to execute the wire transfer.
+ wad_execution_time: Timestamp;
+
// Transfers aggregated in the wad.
items: WadItem[];
diff --git a/design-documents/013-peer-to-peer-payments.rst b/design-documents/013-peer-to-peer-payments.rst
index 3a998c7..5e78620 100644
--- a/design-documents/013-peer-to-peer-payments.rst
+++ b/design-documents/013-peer-to-peer-payments.rst
@@ -655,29 +655,44 @@ database.)
--
CREATE TABLE IF NOT EXISTS kyc_requests
(kyc_request_serial_id BIGSERIAL UNIQUE
- ,reserve_pub BYTEA NOT NULL REFERENCES reserves (reserve_pub) ON DELETE CASCADE
+ ,reserve_uuid INT8 NOT NULL REFERENCES reserves (reserve_uuid) ON DELETE CASCADE
,kyc_date INT8 NOT NULL
+ ,kyc_retry INT8 NOT NULL
,kyc_fee_val INT8 NOT NULL
,kyc_fee_frac INT4 NOT NULL
- ,payto_uri TEXT NOT NULL
,reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64))
- ,PRIMARY KEY (reserve_pub, kyc_date)
+ ,kyc_id TEXT NOT NULL
+ ,PRIMARY KEY (reserve_uuid, kyc_date)
);
+ COMMENT ON COLUMN kyc_requests.reserve_uuid
+ IS 'Reserve for which the KYC request was triggered.';
+ COMMENT ON COLUMN kyc_requests.reserve_sig
+ IS 'Signature affirming the KYC request';
+ COMMENT ON COLUMN kyc_requests.kyc_fee_val
+ IS 'Amount paid by the reserve for the KYC process.';
+ COMMENT ON COLUMN kyc_requests.kyc_date
+ IS 'When was the KYC process originally initiated.';
+ COMMENT ON COLUMN kyc_requests.kyc_retry
+ IS 'Timestamp when we should next query the KYC backend for the KYC status. The maximum possible numeric value indicates that we do not need to ever check the status of this KYC process again.';
+ COMMENT ON COLUMN kyc_requests.kyc_id
+ IS 'ID of the KYC process, used to compute the URL returned to the client as well as for the exchange to check if the KYC has completed. Format depends on the KYC process of the bank.';
+ --
CREATE TABLE IF NOT EXISTS mergers
(merge_request_serial_id BIGSERIAL UNIQUE
- ,reserve_pub BYTEA NOT NULL REFERENCES reserves (reserve_pub) ON DELETE CASCADE
+ ,reserve_uuid BYTEA NOT NULL REFERENCES reserves (reserve_uuid) ON DELETE CASCADE
,purse_url TEXT NOT NULL,
,purse_pub BYTEA NOT NULL CHECK (LENGTH(purse_pub)=32),
,reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64))
- ,purse_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64))
+ ,purse_sig BYTEA NOT NULL CHECK (LENGTH(purse_sig)=64))
,merge_timestamp INT8 NOT NULL
,purse_expiration INT8 NOT NULL
,h_contract_terms BYTEA NOT NULL CHECK (LENGTH(h_contract_terms)=64))
- ,h_wire BYTEA NOT NULL CHECK (LENGTH(h_contract_terms)=64))
+ ,h_wire BYTEA NOT NULL CHECK (LENGTH(h_wire)=64))
,purse_val INT8 NOT NULL
,purse_frac INT4 NOT NULL
,PRIMARY KEY (purse_pub)
);
+ --
CREATE TABLE IF NOT EXISTS contracts
(contract_serial_id BIGSERIAL UNIQUE
,purse_pub BYTEA NOT NULL CHECK (LENGTH(purse_pub)=32),
@@ -685,12 +700,23 @@ database.)
,e_contract BYTEA NOT NULL,
,PRIMARY KEY (purse_pub)
);
+ --
CREATE TABLE IF NOT EXISTS history_requests
- (reserve_pub BYTEA NOT NULL CHECK (LENGTH(purse_pub)=32),
+ (reserve_uuid INT8 NOT NULL REFERENCES reserves(reserve_uuid) ON DELETE CASCADE,
,request_timestamp INT8 NOT NULL
,reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64))
- ,PRIMARY KEY (reserve_pub,request_timestamp)
+ ,PRIMARY KEY (reserve_uuid,request_timestamp)
);
+ --
+ CREATE TABLE IF NOT EXISTS close_requests
+ (reserve_uuid INT8 NOT NULL REFERENCES reserves(reserve_uuid) ON DELETE CASCADE,
+ ,close_timestamp INT8 NOT NULL
+ ,reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64))
+ ,close_val INT8 NOT NULL
+ ,close_frac INT4 NOT NULL
+ ,PRIMARY KEY (reserve_uuid,close_timestamp)
+ );
+ --
CREATE TABLE IF NOT EXISTS purse_deposits
(purse_deposit_serial_id BIGSERIAL UNIQUE
,purse_pub BYTEA NOT NULL CHECK (LENGTH(purse_pub)=32),
@@ -701,16 +727,35 @@ database.)
,coin_sig BYTEA NOT NULL CHECK(LENGTH(coin_sig)=64)
,PRIMARY KEY (purse_pub,coin_pub)
);
+ --
CREATE TABLE IF NOT EXISTS wads
(wad_serial_id BIGSERIAL UNIQUE
- ,reserve_pub BYTEA NOT NULL REFERENCES reserves (reserve_pub) ON DELETE CASCADE
- ,kyc_date INT8 NOT NULL
- ,kyc_fee_val INT8 NOT NULL
- ,kyc_fee_frac INT4 NOT NULL
- ,payto_uri TEXT NOT NULL
+ ,wad_id BYTEA PRIMARY KEY CHECK (LENGTH(wad_id)=24)
+ ,exchange_url TEXT NOT NULL
+ ,amount_val INT8 NOT NULL
+ ,amount_frac INT4 NOT NULL
+ ,execution_time INT8 NOT NULL
+ ,UNIQUE (exchange_url, execution_time)
+ );
+ --
+ CREATE TABLE IF NOT EXISTS wad_entries
+ (wad_entry_serial_id BIGSERIAL UNIQUE
+ ,wad_serial_id INT8 REFERENCES wads (wad_serial_id) ON DELETE CASCADE
+ ,reserve_pub BYTEA NOT NULL CHECK(LENGTH(reserve_pub)=32)
+ ,purse_pub BYTEA PRIMARY KEY CHECK(LENGTH(purse_pub)=32)
+ ,h_contract BYTEA NOT NULL CHECK(LENGTH(h_contract)=64)
+ ,purse_expiration INT8 NOT NULL
+ ,merge_timestamp INT8 NOT NULL
+ ,amount_with_fee_val INT8 NOT NULL
+ ,amount_with_fee_frac INT4 NOT NULL
+ ,wad_fee_val INT8 NOT NULL
+ ,wad_fee_frac INT4 NOT NULL
+ ,deposit_fees_val INT8 NOT NULL
+ ,deposit_fees_frac INT4 NOT NULL
,reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64))
- ,PRIMARY KEY (reserve_pub, kyc_date)
+ ,purse_sig BYTEA NOT NULL CHECK (LENGTH(purse_sig)=64))
);
+ -- FIXME: need more tables for exchange RECEIVING a wad!
-- Complete transaction
COMMIT;