From 4bfab9803e89e3095dd4bc751887337ebd9d7e07 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Fri, 7 Oct 2016 15:20:11 +0200 Subject: porting exchange API to new style --- api-common.rst | 110 +++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 87 insertions(+), 23 deletions(-) (limited to 'api-common.rst') diff --git a/api-common.rst b/api-common.rst index de02d483..f41b9a46 100644 --- a/api-common.rst +++ b/api-common.rst @@ -142,22 +142,23 @@ as other binary data in Crockford Base32 encoding. Timestamps ^^^^^^^^^^ - Timestamps are represented in JSON as a string literal `"\\/Date(x)\\/"`, - where `x` is the decimal representation of the number of seconds past the - Unix Epoch (January 1, 1970). The escaped slash (`\\/`) is interpreted in - JSON simply as a normal slash, but distinguishes the timestamp from a normal - string literal. We use the type "date" in the documentation below. - Additionally, the special strings "\\/never\\/" and "\\/forever\\/" are - recognized to represent the end of time. +Timestamps are represented in JSON as a string literal `"\\/Date(x)\\/"`, +where `x` is the decimal representation of the number of seconds past the +Unix Epoch (January 1, 1970). The escaped slash (`\\/`) is interpreted in +JSON simply as a normal slash, but distinguishes the timestamp from a normal +string literal. We use the type "date" in the documentation below. +Additionally, the special strings "\\/never\\/" and "\\/forever\\/" are +recognized to represent the end of time. .. _public\ key: -Public Keys -^^^^^^^^^^^ +Keys +^^^^ .. _`tsref-type-EddsaPublicKey`: .. _`tsref-type-EddsaPrivateKey`: +.. _`tsref-type-CoinPublicKey`: .. code-block:: tsref @@ -174,6 +175,17 @@ Public Keys // RSA public key converted to Crockford `Base32`_. type RsaPublicKey = string; +.. _blinded-coin: + +Blinded coin +^^^^^^^^^^^^ + +.. _`tsref-type-CoinEnvelope`: + +.. code-block:: tsref + + // Blinded coin's `public EdDSA key `_, `base32`_ encoded + type CoinEnvelope = string; .. _signature: @@ -303,10 +315,16 @@ uses 512-bit hash codes (64 bytes). uint8_t hash[64]; // usually SHA-512 }; +.. _reserve-pub: +.. sourcecode:: c + struct TALER_ReservePublicKeyP { uint8_t eddsa_pub[32]; }; +.. _reserve-priv: +.. sourcecode:: c + struct TALER_ReservePrivateKeyP { uint8_t eddsa_priv[32]; }; @@ -315,6 +333,9 @@ uses 512-bit hash codes (64 bytes). uint8_t eddsa_signature[64]; }; +.. _merchant-pub: +.. sourcecode:: c + struct TALER_MerchantPublicKeyP { uint8_t eddsa_pub[32]; }; @@ -331,14 +352,23 @@ uses 512-bit hash codes (64 bytes). uint8_t ecdhe_priv[32]; }; +.. _sign-key-pub: +.. sourcecode:: c + struct TALER_ExchangePublicKeyP { uint8_t eddsa_pub[32]; }; +.. _sign-key-priv: +.. sourcecode:: c + struct TALER_ExchangePrivateKeyP { uint8_t eddsa_priv[32]; }; +.. _eddsa-sig: +.. sourcecode:: c + struct TALER_ExchangeSignatureP { uint8_t eddsa_signature[64]; }; @@ -355,11 +385,17 @@ uses 512-bit hash codes (64 bytes). uint8_t eddsa_signature[64]; }; +.. _eddsa-coin-pub: +.. sourcecode:: c + union TALER_CoinSpendPublicKeyP { uint8_t eddsa_pub[32]; uint8_t ecdhe_pub[32]; }; +.. _coin-priv: +.. sourcecode:: c + union TALER_CoinSpendPrivateKeyP { uint8_t eddsa_priv[32]; uint8_t ecdhe_priv[32]; @@ -372,8 +408,6 @@ uses 512-bit hash codes (64 bytes). struct TALER_TransferSecretP { uint8_t key[sizeof (struct GNUNET_HashCode)]; }; - - struct TALER_LinkSecretP { uint8_t key[sizeof (struct GNUNET_HashCode)]; }; @@ -420,6 +454,7 @@ The following list contains all the data structure that can be signed in Taler. Their definition is typically found in `src/include/taler_signatures.h`, within the :ref:`exchange's codebase `. +.. _TALER_WithdrawRequestPS: .. sourcecode:: c struct TALER_WithdrawRequestPS { @@ -434,6 +469,9 @@ within the :ref:`exchange's codebase `. struct GNUNET_HashCode h_coin_envelope; }; +.. _TALER_DepositRequestPS: +.. sourcecode:: c + struct TALER_DepositRequestPS { /** * purpose.purpose = TALER_SIGNATURE_WALLET_COIN_DEPOSIT @@ -450,6 +488,9 @@ within the :ref:`exchange's codebase `. union TALER_CoinSpendPublicKeyP coin_pub; }; +.. _TALER_DepositConfirmationPS: +.. sourcecode:: c + struct TALER_DepositConfirmationPS { /** * purpose.purpose = TALER_SIGNATURE_WALLET_CONFIRM_DEPOSIT @@ -465,6 +506,9 @@ within the :ref:`exchange's codebase `. struct TALER_MerchantPublicKeyP merchant; }; +.. _TALER_RefreshMeltCoinAffirmationPS: +.. sourcecode:: c + struct TALER_RefreshMeltCoinAffirmationPS { /** * purpose.purpose = TALER_SIGNATURE_WALLET_COIN_MELT @@ -476,6 +520,9 @@ within the :ref:`exchange's codebase `. union TALER_CoinSpendPublicKeyP coin_pub; }; +.. _TALER_RefreshMeltConfirmationPS: +.. sourcecode:: c + struct TALER_RefreshMeltConfirmationPS { /** * purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT @@ -607,18 +654,35 @@ within the :ref:`exchange's codebase `. struct TALER_AmountNBO total_amount; struct TALER_AmountNBO max_fee; struct GNUNET_HashCode h_contract; - }; + }; struct TALER_ConfirmWirePS { - /** - * purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE - */ - struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - struct GNUNET_HashCode h_wire; - struct GNUNET_HashCode h_contract; - struct TALER_WireTransferIdentifierRawP wtid; - struct TALER_CoinSpendPublicKeyP coin_pub; - uint64_t transaction_id; - struct GNUNET_TIME_AbsoluteNBO execution_time; - struct TALER_AmountNBO coin_contribution; + /** + * purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE + */ + struct GNUNET_CRYPTO_EccSignaturePurpose purpose; + struct GNUNET_HashCode h_wire; + struct GNUNET_HashCode h_contract; + struct TALER_WireTransferIdentifierRawP wtid; + struct TALER_CoinSpendPublicKeyP coin_pub; + uint64_t transaction_id; + struct GNUNET_TIME_AbsoluteNBO execution_time; + struct TALER_AmountNBO coin_contribution; + }; + +.. _TALER_RefundRequestPS: +.. sourcecode:: c + + struct TALER_RefundRequestPS { + /** + * purpose.purpose = TALER_SIGNATURE_MERCHANT_REFUND + */ + struct GNUNET_CRYPTO_EccSignaturePurpose purpose; + struct GNUNET_HashCode h_contract GNUNET_PACKED; + uint64_t transaction_id GNUNET_PACKED; + struct TALER_CoinSpendPublicKeyP coin_pub; + struct TALER_MerchantPublicKeyP merchant; + uint64_t rtransaction_id GNUNET_PACKED; + struct TALER_AmountNBO refund_amount; + struct TALER_AmountNBO refund_fee; }; -- cgit v1.2.3