From cb291cc29d573cf60ef355454e25411111dc6295 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Fri, 7 Oct 2016 00:30:02 +0200 Subject: porting exchange API to new style --- api-common.rst | 10 +++++++++- api-exchange.rst | 46 ++++++++++++++++++++++++++-------------------- api-merchant.rst | 3 ++- exts/tsref.py | 3 --- 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/api-common.rst b/api-common.rst index c1d4cae9..a1f898b5 100644 --- a/api-common.rst +++ b/api-common.rst @@ -507,7 +507,6 @@ within the :ref:`exchange's codebase `. }; .. _TALER_DenominationKeyValidityPS: - .. sourcecode:: c struct TALER_DenominationKeyValidityPS { @@ -527,6 +526,9 @@ within the :ref:`exchange's codebase `. struct GNUNET_HashCode denom_hash; }; +.. _TALER_MasterWireDetailsPS: +.. sourcecode:: c + struct TALER_MasterWireDetailsPS { /** * purpose.purpose = TALER_SIGNATURE_MASTER_SEPA_DETAILS || TALER_SIGNATURE_MASTER_TEST_DETAILS @@ -572,6 +574,9 @@ within the :ref:`exchange's codebase `. struct GNUNET_HashCode h_details; }; +.. _TALER_ExchangeKeyValidityPS: +.. sourcecode:: c + struct TALER_ExchangeKeyValidityPS { /** * purpose.purpose = TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS @@ -590,6 +595,9 @@ within the :ref:`exchange's codebase `. struct GNUNET_HashCode denom_hash; }; + +.. sourcecode:: c + struct TALER_ContractPS { /** * purpose.purpose = TALER_SIGNATURE_MERCHANT_CONTRACT diff --git a/api-exchange.rst b/api-exchange.rst index 9edcaf75..9bf1eb40 100644 --- a/api-exchange.rst +++ b/api-exchange.rst @@ -81,13 +81,13 @@ possibly by using HTTPS. // is sabotaging end-user anonymity by giving disjoint denomination keys to // different users. If a exchange were to do this, this signature allows the // clients to demonstrate to the public that the exchange is dishonest. - eddsa_sig: string; + eddsa_sig: EddsaSignature; // Public EdDSA key of the exchange that was used to generate the signature. // Should match one of the exchange's signing keys from /keys. It is given // explicitly as the client might otherwise be confused by clock skew as to // which signing key was used. - eddsa_pub: string; + eddsa_pub: EddsaPublicKey; } .. _tsref-type-Denom: @@ -109,8 +109,8 @@ possibly by using HTTPS. // transactions involving this coin. stamp_expire_legal: Timestamp; - // Public (RSA) key for the denomination in base32 encoding. - denom_pub: string; + // Public (RSA) key for the denomination. + denom_pub: RsaPublicKey; // Fee charged by the exchange for withdrawing a coin of this denomination fee_withdraw: Amount; @@ -169,7 +169,7 @@ possibly by using HTTPS. auditor_pub: EddsaPublicKey; // The auditor's URL. - auditor_url: String; + auditor_url: string; // An array of denomination keys the auditor affirms with its signature. // Note that the message only includes the hash of the public key, while the @@ -188,10 +188,7 @@ possibly by using HTTPS. // thus not repeated here. denom_pub_h: HashCode; - // A signature_ (binary-only) with purpose - // `TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS` over the exchange's public key and the - // denomination key information. To verify the signature, the `denom_pub_h` - // must be resolved with the information from `denoms` + // Signature of `TALER_ExchangeKeyValidityPS`_ auditor_sig: EddsaSignature; } @@ -234,7 +231,7 @@ Obtaining wire-transfer information // // A single /wire response can contain an arbitrary number of these // string-object pairs. However, the keys must be unique. - string : Object; + string : Object; // <- FIXME: is this key-value notation correct? } Possible encodings for the objects are right now the following: @@ -248,10 +245,21 @@ Obtaining wire-transfer information type: "test"; // Account number at the bank - account_number: Integer; + account_number: number; // URI of the bank bank_uri: string; + + // Name of the account's owner + name: string; + + // Salt used to sign, `base32`_ encoded + salt: string; + + // Signaure of `TALER_MasterWireDetailsPS`_ with purpose TALER_SIGNATURE_MASTER_TEST_DETAILS + // FIXME: Specify how to compute the hash which then + // gets signed over + sig: EddsaSignature; } .. _WireSepaResponse: @@ -271,9 +279,9 @@ Obtaining wire-transfer information // BIC of the bank. bic: string; - // the EdDSA signature (binary-only) with purpose - // `TALER_SIGNATURE_EXCHANGE_PAYMENT_METHOD_SEPA` signing over the hash over the - // 0-terminated strings representing the receiver's name, IBAN and the BIC. + // Signaure of `TALER_MasterWireDetailsPS`_ with purpose TALER_SIGNATURE_MASTER_SEPA_DETAILS + // FIXME: Specify how to compute the hash which then + // gets signed over sig: EddsaSignature; } @@ -349,13 +357,11 @@ exchange. // Transfer details uniquely identifying the transfer, only present if type is "DEPOSIT". transfer_details?: any; - // binary encoding of the transaction data as a `TALER_WithdrawRequestPS` - // struct described in :ref:`Signatures`, only present if the `type` was - // "WITHDRAW". Its `purpose` should match our `type`, `amount_with_fee`, - // should match our `amount`, and its `size` should be consistent. - string?: details; + // `base32`_ encoding of `TALER_WithdrawRequestPS`_. This field appears only if `type` + // is "WITHDRAW". + details?: string; - // Signature over the transaction details. + // Signature over the transaction `details`. // Purpose: TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW signature?: EddsaSignature; } diff --git a/api-merchant.rst b/api-merchant.rst index b0e6c243..c2b48960 100644 --- a/api-merchant.rst +++ b/api-merchant.rst @@ -58,7 +58,8 @@ The Frontent HTTP API interface DepositPermission { // the hashed :ref:`wire details ` of this merchant. The wallet takes this value as-is from the contract - H_wire: HashCode; + // `MyStruct`_ + H_wire: MyStruct; // the base32 encoding of the field `h_contract` of the contract `blob `. The wallet can choose whether to take this value obtained from the field `h_contract`, or regenerating one starting from the values it gets within the contract H_contract: HashCode; diff --git a/exts/tsref.py b/exts/tsref.py index 91574929..8187f67f 100644 --- a/exts/tsref.py +++ b/exts/tsref.py @@ -231,6 +231,3 @@ def setup(app): app.add_lexer('tsref', lexer) app.add_builder(MyHtmlBuilder) app.connect("doctree-read", remember_targets) - - - -- cgit v1.2.3