Skip to content
Snippets Groups Projects
interface.rst 3.76 KiB
Newer Older
Interface
=========

Client
------

When enabled in a Tahoe-LAFS client node,
ZKAPAuthorizer publishes an HTTP-based interface inside the main Tahoe-LAFS web interface.
``PUT /storage-plugins/privatestorageio-zkapauthz-v1/voucher``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This endpoint allows an external agent which has submitted a payment to cause the plugin to redeem the voucher for tokens.
The request body for this endpoint must have the ``application/json`` content-type.
The request body contains a simple json object containing the voucher::
  {"voucher": "<voucher>"}
The endpoint responds to such a request with an **OK** HTTP response code if the voucher is accepted for processing.
If the voucher cannot be accepted at the time of the request then the response code will be anything other than **OK**.

If the response is **OK** then a repeated request with the same body will have no effect.
If the response is not **OK** then a repeated request with the same body will try to accept the number again.

``GET /storage-plugins/privatestorageio-zkapauthz-v1/voucher/<voucher>``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This endpoint allows an external agent to monitor the status of the redemption of a voucher.
This endpoint accepts no request body.

If the voucher is not known then the response is **NOT FOUND**.
For any voucher which has previously been submitted,
the response is **OK** with an ``application/json`` content-type response body like::

  {"value": <string>, "created": <iso8601 timestamp>, "redeemed": <boolean>, "token-count": <number>, "version": 1}
The ``value`` property merely indicates the voucher which was requested.
The ``created`` property indicates when the voucher was first added to the node.
The ``redeemed`` property indicates whether or not the voucher has successfully been redeemed with a payment server yet.
The ``token-count`` property gives the number of blinded token signatures the client received in exchange for redemption of the voucher
(each blinded token signature can be used to construct a one ZKAP),
if it has been redeemed.
If it has not been redeemed then it is ``null``.

The ``version`` property indicates the semantic version of the data being returned.
When properties are removed or the meaning of a property is changed,
the value of the ``version`` property will be incremented.
The addition of new properties is **not** accompanied by a bumped version number.
``GET /storage-plugins/privatestorageio-zkapauthz-v1/voucher``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This endpoint allows an external agent to retrieve the status of all vouchers.
This endpoint accepts no request body.

The response is **OK** with ``application/json`` content-type response body like::

  {"vouchers": [<voucher status object>, ...]}

The elements of the list are objects like the one returned by issuing a **GET** to a child of this collection resource.
``GET /storage-plugins/privatestorageio/zkapauthz-v1/unblinded-token``
Jean-Paul Calderone's avatar
Jean-Paul Calderone committed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This endpoint allows an external agent to retrieve unused unblinded tokens present in the node's database.
Unblinded tokens are returned in ascending text sorted order.
This order matches the order in which tokens will be used by the system.
This endpoint accepts several query arguments:

  * limit: An integer limiting the number of unblinded tokens to retrieve.
  * position: A string which can be compared against unblinded token values.
    Only unblinded tokens which sort as great than this value are returned.

This endpoint accepts no request body.

The response is **OK** with ``application/json`` content-type response body like::

  {"total": <integer>, "unblinded-tokens": [<unblinded token string>, ...]}