taler-docs

Documentation for GNU Taler components, APIs and protocols
Log | Files | Refs | README | LICENSE

api-common.rst (68959B)


      1 ..
      2   This file is part of GNU TALER.
      3   Copyright (C) 2014, 2015, 2016 GNUnet e.V. and INRIA
      4 
      5   TALER is free software; you can redistribute it and/or modify it under the
      6   terms of the GNU Affero Public License as published by the Free Software
      7   Foundation; either version 2.1, or (at your option) any later version.
      8 
      9   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
     10   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11   A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
     12 
     13   You should have received a copy of the GNU Affero General Public License along with
     14   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15 
     16   @author Christian Grothoff
     17   @author Marcello Stanisci
     18   @author Özgür Kesim
     19 
     20 .. _http-common:
     21 
     22 .. _foo_bar:
     23 
     24 ==================================
     25 Conventions for Taler RESTful APIs
     26 ==================================
     27 
     28 .. contents:: Table of Contents
     29   :local:
     30 
     31 -------------------------
     32 HTTP Request and Response
     33 -------------------------
     34 
     35 Certain response formats are common for all requests. They are documented here
     36 instead of with each individual request.  Furthermore, we note that clients may
     37 theoretically fail to receive any response.  In this case, the client should
     38 verify that the Internet connection is working properly, and then proceed to
     39 handle the error as if an internal error (500) had been returned.
     40 
     41 .. http:any:: /*
     42 
     43 
     44   **Request:**
     45 
     46   Unless specified otherwise, HTTP requests that carry a message body must
     47   have the content type ``application/json``.
     48 
     49   :reqheader Content-Type: application/json
     50 
     51   **Response:**
     52 
     53   :resheader Content-Type: application/json
     54 
     55   :http:statuscode:`200 Ok`:
     56     The request was successful.
     57   :http:statuscode:`301 Moved permanently`:
     58     The server responsible for the reserve
     59     changed, the client MUST follow the link to the new location. If possible,
     60     the client SHOULD remember the new URL for the reserve for future
     61     requests.  Only applicable if the request method is GET.
     62   :http:statuscode:`302 Found`:
     63     The server responsible for the reserve changed, the
     64     client MUST follow the link to the new location, but MUST NOT retain the
     65     new URL for future requests.  Only applicable if the request method is GET.
     66   :http:statuscode:`307 Temporary redirect`:
     67     The server responsible for the reserve changed, the
     68     client MUST follow the link to the new location, but MUST NOT retain the
     69     new URL for future requests.
     70   :http:statuscode:`308 Permanent redirect`:
     71     The server responsible for the reserve
     72     changed, the client MUST follow the link to the new location. If possible,
     73     the client SHOULD remember the new URL for the reserve for future
     74     requests.
     75   :http:statuscode:`400 Bad request`:
     76     One of the arguments to the request is missing or malformed.
     77   :http:statuscode:`415 Unsupported Media Type`:
     78     The Content-Type header was not set, or it was set to an unsupported MIME type.
     79   :http:statuscode:`500 Internal server error`:
     80     This always indicates some serious internal operational error of the exchange,
     81     such as a program bug, database problems, etc., and must not be used for
     82     client-side problems.  When facing an internal server error, clients should
     83     retry their request after some delay.  We recommended initially trying after
     84     1s, twice more at randomized times within 1 minute, then the user should be
     85     informed and another three retries should be scheduled within the next 24h.
     86     If the error persists, a report should ultimately be made to the auditor,
     87     although the auditor API for this is not yet specified.  However, as internal
     88     server errors are always reported to the exchange operator, a good operator
     89     should naturally be able to address them in a timely fashion, especially
     90     within 24h.
     91 
     92   Unless specified otherwise, all error status codes (4xx and 5xx) have a message
     93   body with an `ErrorDetail` JSON object.
     94 
     95   **Details:**
     96 
     97   .. ts:def:: ErrorDetail
     98 
     99     interface ErrorDetail {
    100 
    101       // Numeric `error code <error-codes>` unique to the condition.
    102       // The other arguments are specific to the error value reported here.
    103       code: Integer;
    104 
    105       // Human-readable description of the error, i.e. "missing parameter", "commitment violation", ...
    106       // Should give a human-readable hint about the error's nature. Optional, may change without notice!
    107       hint?: string;
    108 
    109       // Optional detail about the specific input value that failed. May change without notice!
    110       detail?: string;
    111 
    112       // Name of the parameter that was bogus (if applicable).
    113       parameter?: string;
    114 
    115       // Path to the argument that was bogus (if applicable).
    116       path?: string;
    117 
    118       // Offset of the argument that was bogus (if applicable).
    119       offset?: string;
    120 
    121       // Index of the argument that was bogus (if applicable).
    122       index?: string;
    123 
    124       // Name of the object that was bogus (if applicable).
    125       object?: string;
    126 
    127       // Name of the currency that was problematic (if applicable).
    128       currency?: string;
    129 
    130       // Expected type (if applicable).
    131       type_expected?: string;
    132 
    133       // Type that was provided instead (if applicable).
    134       type_actual?: string;
    135 
    136       // Extra information that doesn't fit into the above (if applicable).
    137       extra?: Object;
    138     }
    139 
    140 -----------------------
    141 Protocol Version Ranges
    142 -----------------------
    143 
    144 Some of the Taler services (e.g. exchange, merchant, bank integration API)
    145 expose the range of API versions they support.  Clients in turn have an API
    146 version range they support.  These version ranges are written down in the
    147 `libtool version format <https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html>`__.
    148 
    149 A protocol version is a positive, non-zero integer.  A protocol version range consists of three components:
    150 
    151 1. The ``current`` version.  This is the latest version of the protocol supported by the client or service.
    152 2. The ``revision`` number.  This value should usually not be interpreted by the client/server, but serves
    153    purely as a comment.  Each time a service/client for a protocol is updated while supporting the same
    154    set of protocol versions, the revision should be increased.
    155    In rare cases, the revision number can be used to work around unintended breakage in deployed
    156    versions of a service.  This is discouraged and should only be used in exceptional situations.
    157 3. The ``age`` number.  This non-zero integer identifies with how many previous protocol versions this
    158    implementation is compatible.  An ``age`` of 0 implies that the implementation only supports
    159    the ``current`` protocol version.  The ``age`` must be less or equal than the ``current`` protocol version.
    160 
    161 To avoid confusion with semantic versions, the protocol version range is written down in the following format:
    162 
    163 .. code:: none
    164 
    165   current[:revision[:age]]
    166 
    167 The angle brackets mark optional components. If either ``revision`` or ``age`` are omitted, they default to 0.
    168 
    169 Examples:
    170 
    171 * "1" and "1" are compatible
    172 * "1" and "2" are **incompatible**
    173 * "2:0:1" and "1:0:0" are compatible
    174 * "2:5:1" and "1:10:0" are compatible
    175 * "4:0:1" and "2:0:0" are **incompatible**
    176 * "4:0:1" and "3:0:0" are compatible
    177 
    178 .. note::
    179 
    180   `Semantic versions <https://semver.org/>`__ are not a good tool for this job, as we concisely want to express
    181   that the client/server supports the last ``n`` versions of the protocol.
    182   Semantic versions don't support this, and semantic version ranges are too complex for this.
    183 
    184 .. warning::
    185 
    186   A client doesn't have one single protocol version range.  Instead, it has
    187   a protocol version range for each type of service it talks to.
    188 
    189 .. warning::
    190 
    191   For privacy reasons, the protocol version range of a client should not be
    192   sent to the service.  Instead, the client should just use the two version ranges
    193   to decide whether it will talk to the service.
    194 
    195 .. _error-codes:
    196 
    197 -----------
    198 Error Codes
    199 -----------
    200 
    201 All error codes used in GNU Taler are defined in
    202 `GANA <https://git.gnunet.org/gana.git/tree/gnu-taler-error-codes/>`__.
    203 
    204 This centralized registry also contains generators that create enumerations
    205 and mappings from error codes to HTTP status codes and human-readable error
    206 messages for various programming languages.
    207 
    208 All error codes have numeric values below 100 or above 1000, so as to never be
    209 confused with HTTP status codes.  A value of 0 is reserved for "no error" or
    210 "success".
    211 
    212 In C, the respective enumeration is the ``enum TALER_ErrorCode``.
    213 
    214 Developers may have to re-run ``bootstrap`` and/or update their Git
    215 submodules to ensure that they have the lastest GANA registry.
    216 
    217 ---------------------
    218 Common query patterns
    219 ---------------------
    220 
    221 .. _row-id-pagination:
    222 
    223 Row ID pagination
    224 ^^^^^^^^^^^^^^^^^
    225 
    226 Some endpoints paginate elements identified by an opaque numeric identifier,
    227 referred to here as *row ID*. The semantics of the row ID (including its
    228 sorting order) are determined by the server and are completely opaque to the
    229 client.
    230 
    231 The list of returned elements is determined by a row ID *offset*
    232 and a non-zero signed integer *limit*:
    233 
    234 * If *limit* is positive, return a list of up to *limit* elements (all matching
    235   the filter criteria) strictly **after** the *offset*. The elements are sorted
    236   in **ascending** order of the row ID.
    237 * If *limit* is negative, return a list of up to *-limit* elements (all matching
    238   the filter criteria) strictly **before** the *offset*. The elements are sorted
    239   in **descending** order of the row ID.
    240 
    241 If *offset* is not explicitly given, it defaults to:
    242 
    243 * A value **smaller** than all other row IDs if *limit* is **positive**.
    244 * A value **larger** than all other row IDs if *limit* is **negative**.
    245 
    246 :query limit: *Optional.*
    247   At most return the given number of results. Negative for descending by row
    248   ID, positive for ascending by row ID.
    249 :query offset: *Optional.*
    250   Starting row ID for an iteration.
    251 
    252 .. _long-polling:
    253 
    254 Long polling
    255 ^^^^^^^^^^^^
    256 
    257 Endpoints can result in an empty response (pagination) or a negative response
    258 (uncompleted operation, etc). Some endpoints allow clients to perform a form of
    259 long polling by asking the server to wait until *timeout_ms* for a non-empty or
    260 positive result.
    261 
    262 In the case of pagination, the response is sent as soon as a matching element
    263 is found and, therefore, the response MAY contain fewer than *limit* elements.
    264 
    265 A client MUST never rely on this behavior, as a response can be sent
    266 immediately or after waiting only a fraction of *timeout_ms*.
    267 
    268 :query timeout_ms: *Optional.*
    269   Timeout in milliseconds to wait for the response to be non-empty or positive.
    270 
    271 .. _encodings-ref:
    272 
    273 ----------------
    274 Common encodings
    275 ----------------
    276 
    277 This section describes how certain types of values are represented throughout the API.
    278 
    279 .. _payto:
    280 
    281 
    282 Payto URIs:
    283 ^^^^^^^^^^^
    284 
    285 RFC 8905 defines payto://-URIs which GNU Taler uses to identify bank
    286 accounts. In GNU Taler, we primarily distinguish three types of
    287 payto://-URIs:
    288 
    289 * First, a **normalized** payto-URI uniquely identifies a bank account (or
    290   wallet) and must be able to serve as a canonical representation of such a
    291   bank account.  Thus, optional arguments such as the *receiver-name* or
    292   optional path components such as the BIC must be removed and the account
    293   must be given in a canonical form for the wire method (for example,
    294   everything in lower-case).
    295 
    296 * Second, a **full** payto-URI is not expected to have a canonical form for
    297   a bank account (there can be many full payto-URIs for the same bank
    298   account) and must include at least the *receiver-name* but possibly also
    299   other (in RFC 8905 optional) arguments to identify the recipient, as
    300   those may be needed to do a wire transfer.
    301 
    302 * On occation, we also use full payto://-URIs that additionally specify the
    303   *amount* and wire transfer *subject* and are actually intended to trigger
    304   a wire transfer.
    305 
    306 
    307 .. _base32:
    308 
    309 Binary Data
    310 ^^^^^^^^^^^
    311 
    312 .. ts:def:: Base32
    313 
    314   type Base32 = string;
    315 
    316 Binary data is generally encoded using Crockford's variant of Base32
    317 (http://www.crockford.com/wrmg/base32.html), except that "U" is not excluded
    318 but also decodes to "V" to make OCR easy. Also, in contrast to Crockford, we
    319 do *not* allow the use of "-" and also do *not* allow the (optional) checksum
    320 from Crockford's proposal. So we really only use the alphabet, plus "u".  We
    321 will still simply use the JSON type "base32" and the term "Crockford Base32"
    322 in the text to refer to the resulting encoding.  Encoders and decoders
    323 can be found in libgnunetutil.
    324 
    325 
    326 Hash codes
    327 ^^^^^^^^^^
    328 
    329 Hash codes are strings representing base32 encoding of the respective
    330 hashed data. See `base32`_.
    331 
    332 .. ts:def:: HashCode
    333 
    334   // 64-byte hash code.
    335   type HashCode = string;
    336 
    337 .. ts:def:: ShortHashCode
    338 
    339   // 32-byte hash code.
    340   type ShortHashCode = string;
    341 
    342 .. ts:def:: AccountAccessToken
    343 
    344   // 32-byte nonce.
    345   type AccountAccessToken = string;
    346 
    347 .. ts:def:: WireSalt
    348 
    349   // 16-byte salt.
    350   type WireSalt = string;
    351 
    352 .. ts:def:: SHA256HashCode
    353 
    354    type SHA256HashCode = ShortHashCode;
    355 
    356 .. ts:def:: SHA512HashCode
    357 
    358    type SHA512HashCode = HashCode;
    359 
    360 .. ts:def:: CSNonce
    361 
    362    // 32-byte nonce value, must only be used once.
    363    type CSNonce = string;
    364 
    365 .. ts:def:: RefreshMasterSeed
    366 
    367    // 32-byte nonce value, must only be used once.
    368    type RefreshMasterSeed = string;
    369 
    370 .. ts:def:: RefreshCommitmentHash
    371 
    372     // A refresh commitment corresponding to a call to /melt
    373     // This is the Hash over:
    374     //   1. refresh_seed
    375     //   2. blinding_seed, if provided, skip otherwise
    376     //   3. denominations in order
    377     //   4. amount_with_fee
    378     //   5. κ*n blinded planchet hashes (which include denomination information),
    379     //      depths first: [0..n)[0..n)[0..n)
    380     type RefreshCommitmentHash = HashCode;
    381 
    382 .. ts:def:: BlindingMasterSeed
    383 
    384    // 32-byte nonce value, must only be used once.
    385    type BlindingMasterSeed = string;
    386 
    387 .. ts:def:: Cs25519Point
    388 
    389    // 32-byte value representing a point on Curve25519.
    390    type Cs25519Point = string;
    391 
    392 .. ts:def:: Cs25519Scalar
    393 
    394    // 32-byte value representing a scalar multiplier
    395    // for scalar operations on points on Curve25519.
    396    type Cs25519Scalar = string;
    397 
    398 
    399 Safe Integers
    400 ^^^^^^^^^^^^^
    401 
    402 For easier browser-side processing, we restrict some integers to
    403 the range that is safely representable in JavaScript.
    404 
    405 .. ts:def:: SafeUint64
    406 
    407   // Subset of numbers:  Integers in the
    408   // inclusive range 0 .. (2^53 - 1).
    409   type SafeUint64 = Integer;
    410 
    411 Large numbers
    412 ^^^^^^^^^^^^^
    413 
    414 Large numbers such as RSA blinding factors and 256 bit keys, are transmitted
    415 as other binary data in Crockford Base32 encoding.
    416 
    417 Decimal numbers
    418 ^^^^^^^^^^^^^^^
    419 
    420 ..
    421   FIXME: explain the representation with strings.
    422 
    423 .. ts:def:: DecimalNumber
    424 
    425    // Number with at most 8 fractional digits.
    426    type DecimalNumber = string;
    427 
    428 Timestamps
    429 ^^^^^^^^^^
    430 
    431 Timestamps are represented by the following structure:
    432 
    433 .. ts:def:: Timestamp
    434 
    435   interface Timestamp {
    436     // Seconds since epoch, or the special
    437     // value "never" to represent an event that will
    438     // never happen.
    439     t_s: Integer | "never";
    440   }
    441 
    442 .. ts:def:: RelativeTime
    443 
    444   interface RelativeTime {
    445     // Duration in microseconds or "forever"
    446     // to represent an infinite duration. Numeric
    447     // values are capped at 2^53 - 1 inclusive.
    448     d_us: Integer | "forever";
    449   }
    450 
    451 
    452 .. _public\ key:
    453 
    454 
    455 Integers
    456 ^^^^^^^^
    457 
    458 .. ts:def:: Integer
    459 
    460   // JavaScript numbers restricted to integers.
    461   type Integer = number;
    462 
    463 Floats
    464 ^^^^^^
    465 
    466 .. ts:def:: Float
    467 
    468   // JavaScript numbers.
    469   type Float = number;
    470 
    471 Ages
    472 ^^^^
    473 
    474 .. ts:def:: Age
    475 
    476    // An age is an integer between 0 and 255 measured in years.
    477    type Age = Integer;
    478 
    479 
    480 .. ts:def:: AgeMask
    481 
    482     // Binary representation of the age groups.
    483     // The bits set in the mask mark the edges at the beginning of a next age
    484     // group.  F.e. for the age groups
    485     //     0-7, 8-9, 10-11, 12-13, 14-15, 16-17, 18-20, 21-*
    486     // the following bits are set:
    487     //
    488     //   31     24        16        8         0
    489     //   |      |         |         |         |
    490     //   oooooooo  oo1oo1o1  o1o1o1o1  ooooooo1
    491     //
    492     // A value of 0 means that the exchange does not support the extension for
    493     // age-restriction.
    494     type AgeMask = Integer;
    495 
    496 
    497 Versions
    498 ^^^^^^^^
    499 
    500 We use the type ``LibtoolVersion`` in the design documents to refer to a string
    501 that represents a version with the semantic as defined by
    502 `libtool <https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html>`__.
    503 
    504 .. ts:def:: LibtoolVersion
    505 
    506    // Version information in libtool version format and semantics
    507    // current[:revision[:age]], f.e. "1", "2:0" or "3:1:2".
    508    // see https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html.
    509    type LibtoolVersion = string;
    510 
    511 We use the type ``SemVer`` to refer to a string that represents a version with
    512 the semantic as defined by `semantic versioning <https://semver.org/>`__.
    513 
    514 .. ts:def:: SemVer
    515 
    516    // Version information in semantic versioning format and semantics,
    517    // like "X.Z.Y", see https://semver.org/.
    518    type SemVer = string;
    519 
    520 Objects
    521 ^^^^^^^
    522 
    523 .. ts:def:: Object
    524 
    525   // JavaScript objects, no further restrictions.
    526   type Object = object;
    527 
    528 
    529 Contact details
    530 ^^^^^^^^^^^^^^^
    531 
    532 .. ts:def:: EmailAddress
    533 
    534   type EmailAddress = string;
    535 
    536 .. ts:def:: PhoneNumber
    537 
    538   type PhoneNumber = string;
    539 
    540 Phone numbers should start with the ``+`` symbol and the country code.
    541 
    542 Permissions
    543 ^^^^^^^^^^^
    544 
    545 This type epresses which permissions for a subject
    546 apply on a resource.
    547 
    548 .. ts:def:: LibeufinPermission
    549 
    550   interface LibeufinPermission {
    551     subjectType: string;
    552     subjectId: string;
    553     resourceType: string;
    554     resourceId: string;
    555     permissionName: string
    556   }
    557 
    558 
    559 Fetch params
    560 ^^^^^^^^^^^^
    561 
    562 .. _fetch-params:
    563 
    564 .. ts:def:: FetchParams
    565 
    566   interface FetchParams {
    567 
    568     // Because transactions are delivered by banks in "batches",
    569     // then every batch can have different qualities.  This value
    570     // lets the request specify which type of batch ought to be
    571     // returned.  Currently, the following two type are supported:
    572     //
    573     // 'report': typically includes only non booked transactions.
    574     // 'statement': typically includes only booked transactions.
    575     level: "report" | "statement" | "all";
    576 
    577     // This type indicates the time range of the query.
    578     // It allows the following values:
    579     //
    580     // 'latest': retrieves the last transactions from the bank.
    581     //           If there are older unread transactions, those will *not*
    582     //           be downloaded.
    583     //
    584     // 'all': retrieves all the transactions from the bank,
    585     //        until the oldest.
    586     //
    587     // 'previous-days': currently *not* implemented, it will allow
    588     //                  the request to download transactions from
    589     //                  today until N days before.
    590     //
    591     // 'since-last': retrieves all the transactions since the last
    592     //               time one was downloaded.
    593     //
    594     rangeType: "latest" | "all" | "previous-days" | "since-last";
    595   };
    596 
    597 
    598 Keys
    599 ^^^^
    600 
    601 .. ts:def:: ClaimToken
    602 
    603   // 16-byte access token used to authorize access.
    604   type ClaimToken = string;
    605 
    606 .. ts:def:: EddsaPublicKey
    607 
    608    // EdDSA and ECDHE public keys always point on Curve25519
    609    // and represented  using the standard 256 bits Ed25519 compact format,
    610    // converted to Crockford `Base32`.
    611    type EddsaPublicKey = string;
    612 
    613 .. ts:def:: EddsaPrivateKey
    614 
    615    // EdDSA and ECDHE public keys always point on Curve25519
    616    // and represented  using the standard 256 bits Ed25519 compact format,
    617    // converted to Crockford `Base32`.
    618    type EddsaPrivateKey = string;
    619 
    620 .. ts:def:: Edx25519PublicKey
    621 
    622    // Edx25519 public keys are points on Curve25519 and represented using the
    623    // standard 256 bits Ed25519 compact format converted to Crockford
    624    // `Base32`.
    625    type Edx25519PublicKey = string;
    626 
    627 .. ts:def:: Edx25519PrivateKey
    628 
    629    // Edx25519 private keys are always points on Curve25519
    630    // and represented using the standard 256 bits Ed25519 compact format,
    631    // converted to Crockford `Base32`.
    632    type Edx25519PrivateKey = string;
    633 
    634 .. ts:def:: EcdhePublicKey
    635 
    636    // EdDSA and ECDHE public keys always point on Curve25519
    637    // and represented  using the standard 256 bits Ed25519 compact format,
    638    // converted to Crockford `Base32`.
    639    type EcdhePublicKey = string;
    640 
    641 .. ts:def:: CSRPublic
    642 
    643    // Point on Curve25519 represented using the standard 256 bits Ed25519 compact format,
    644    // converted to Crockford `Base32`.
    645    type CSRPublic = string;
    646 
    647 .. ts:def:: EcdhePrivateKey
    648 
    649    // EdDSA and ECDHE public keys always point on Curve25519
    650    // and represented  using the standard 256 bits Ed25519 compact format,
    651    // converted to Crockford `Base32`.
    652    type EcdhePrivateKey = string;
    653 
    654 .. ts:def:: CoinPublicKey
    655 
    656    type CoinPublicKey = EddsaPublicKey;
    657 
    658 .. ts:def:: RsaPublicKey
    659 
    660    // RSA public key converted to Crockford `Base32`.
    661    type RsaPublicKey = string;
    662 
    663 .. ts:def:: PursePublicKey
    664 
    665    type PursePublicKey = EddsaPublicKey;
    666 
    667 
    668 .. _blinded-coin:
    669 
    670 Blinded coin
    671 ^^^^^^^^^^^^
    672 
    673 .. ts:def:: CoinEnvelope
    674 
    675   // The type of a coin's blinded envelope depends on the cipher that is used
    676   // for signing with a denomination key.
    677   type CoinEnvelope = RSACoinEnvelope | CSCoinEnvelope ;
    678 
    679 .. ts:def:: RSACoinEnvelope
    680 
    681   // For denomination signatures based on RSA, the planchet is just a blinded
    682   // coin's `public EdDSA key <eddsa-coin-pub>`.
    683   interface RSACoinEnvelope {
    684     cipher: "RSA" | "RSA+age_restricted";
    685     rsa_blinded_planchet: BlindedRsaSignature;
    686   }
    687 
    688 .. ts:def:: CSCoinEnvelope
    689 
    690   // For denomination signatures based on Blind Clause-Schnorr, the planchet
    691   // consists of the public nonce and two Curve25519 scalars which are two
    692   // blinded challenges in the Blinded Clause-Schnorr signature scheme.
    693   // See https://taler.net/papers/cs-thesis.pdf for details.
    694   interface CSCoinEnvelope {
    695     cipher: "CS" | "CS+age_restricted";
    696     cs_nonce: string;      // Crockford `Base32` encoded
    697     cs_blinded_c0: string; // Crockford `Base32` encoded
    698     cs_blinded_c1: string; // Crockford `Base32` encoded
    699   }
    700 
    701 .. ts:def:: DenominationBlindingKeyP
    702 
    703    // Secret for blinding/unblinding.
    704    // An RSA blinding secret, which is basically
    705    // a 256-bit nonce, converted to Crockford `Base32`.
    706    type DenominationBlindingKeyP = string;
    707 
    708 
    709 .. _unblinded-coin:
    710 
    711 Unblinded coin
    712 ^^^^^^^^^^^^^^
    713 
    714 .. ts:def:: UnblindedSignature
    715 
    716   // The type of a coin's unblinded signature depends on the cipher that was used
    717   // for signing with a denomination key.
    718   // Note that for now, only RSA is supported.
    719   type UnblindedSignature = RsaUnblindedSignature | CsUnblindedSignature;
    720 
    721 .. ts:def:: RsaUnblindedSignature
    722 
    723   interface RsaUnblindedSignature {
    724     cipher: "RSA";
    725     rsa_signature: RsaSignature;
    726   }
    727 
    728 .. ts:def:: CsUnblindedSignature
    729 
    730   // Note, this is here for the sake of completeness, but not yet supported
    731   interface CsUnblindedSignature {
    732     cipher: "CS";
    733 
    734     cs_signature_r: Cs25519Point;
    735     cs_signature_s: Cs25519Scalar;
    736   }
    737 
    738 
    739 .. _signature:
    740 
    741 Signatures
    742 ^^^^^^^^^^
    743 
    744 
    745 .. ts:def:: EddsaSignature
    746 
    747   // EdDSA signatures are transmitted as 64-bytes `base32`
    748   // binary-encoded objects with just the R and S values (base32_ binary-only).
    749   type EddsaSignature = string;
    750 
    751 .. ts:def:: Edx25519Signature
    752 
    753   // Edx25519 signatures are transmitted as 64-bytes `base32`
    754   // binary-encoded objects with just the R and S values (base32_ binary-only).
    755   type Edx25519Signature = string;
    756 
    757 .. ts:def:: RsaSignature
    758 
    759   // `base32` encoded RSA signature.
    760   type RsaSignature = string;
    761 
    762 .. ts:def:: BlindedRsaSignature
    763 
    764   // `base32` encoded RSA blinded signature.
    765   type BlindedRsaSignature = string;
    766 
    767 .. ts:def:: RsaBlindingKeySecret
    768 
    769   // `base32` encoded RSA blinding secret.
    770   type RsaBlindingKeySecret = string;
    771 
    772 .. ts:def:: DenominationBlindingKeySecret
    773 
    774   // Union, not (!) discriminated!
    775   // (Note: CS Blinding Key secret is yet to be defined&added here).
    776   type DenominationBlindingKeySecret =
    777     | RsaBlindingKeySecret;
    778 
    779 
    780 .. ts:def:: DenomCipher
    781 
    782    interface DenomCipher = {
    783      // specifier for the ciper
    784      cipher: string;
    785    }
    786 
    787 .. ts:def:: BlindedDenominationSignature
    788 
    789   type BlindedDenominationSignature = DenomCipher & (
    790     | RsaBlindedDenominationSignature
    791     | CSBlindedDenominationSignature
    792   )
    793 
    794 .. ts:def:: RsaBlindedDenominationSignature
    795 
    796   interface RsaBlindedDenominationSignature extends DenomCipher {
    797     cipher: "RSA";
    798 
    799     // (blinded) RSA signature
    800     blinded_rsa_signature: BlindedRsaSignature;
    801   }
    802 
    803 .. ts:def:: CSBlindedDenominationSignature
    804 
    805   interface CSBlindedDenominationSignature extends DenomCipher {
    806     cipher: "CS";
    807 
    808     // Signer chosen bit value, 0 or 1, used
    809     // in Clause Blind Schnorr to make the
    810     // ROS problem harder.
    811     b: Integer;
    812 
    813     // Blinded scalar calculated from c_b.
    814     s: Cs25519Scalar;
    815 
    816   }
    817 .. ts:def:: PurseContractSignature
    818 
    819    type PurseContractSignature = EddsaSignature
    820 
    821 
    822 .. _amount:
    823 
    824 Amounts
    825 ^^^^^^^
    826 
    827 Amounts of currency are always expressed in terms of a base value, a
    828 fractional value and the denomination of the currency.
    829 
    830 .. ts:def:: Amount
    831 
    832   type Amount = string;
    833 
    834 Amounts of currency are serialized as a string of the format
    835 ``<Currency>:<DecimalAmount>``.  Taler treats monetary amounts as
    836 fixed-precision numbers, with 8 decimal places.  Unlike floating point numbers,
    837 this allows accurate representation of monetary amounts.
    838 
    839 The following constrains apply for a valid amount:
    840 
    841 1. The ``<Currency>`` part must be at most 11 characters long and may only consist
    842    of ASCII letters (``a-zA-Z``).
    843 2. The integer part of ``<DecimalAmount>`` may be at most 2^52.
    844 3. The fractional part of ``<DecimalAmount>`` may contain at most 8 decimal digits.
    845 
    846 .. note::
    847 
    848   "EUR:1.50" and "EUR:10" are valid amounts.  These are all invalid amounts: "A:B:1.5", "EUR:4503599627370501.0", "EUR:1.", "EUR:.1".
    849 
    850 An amount that is prefixed with a ``+`` or ``-`` character is also used in certain contexts.
    851 When no sign is present, the amount is assumed to be positive.
    852 
    853 .. note::
    854 
    855   In some setups, when Libeufin-Bank offers cashouts towards traditional
    856   currencies like EUR for example, the fractional part gets restricted
    857   to at most 2 digits.
    858 
    859 .. ts:def:: SignedAmount
    860 
    861   type SignedAmount = string;
    862 
    863 .. sourcecode:: c
    864 
    865   struct TALER_AmountNBO {
    866     // Non-negative integer value in the currency (in network byte order),
    867     // can be at most 2^52.
    868     // Note that "1" here would correspond to 1 EUR or 1 USD,
    869     // depending on `currency`, not 1 cent.
    870     uint64_t value;
    871 
    872     // Unsigned 32 bit fractional value (in network byte order)
    873     // to be added to ``value`` representing
    874     // an additional currency fraction, in units of one hundred millionth (1e-8)
    875     // of the base currency value.  For example, a fraction
    876     // of 50,000,000 would correspond to 50 cents.
    877     uint32_t fraction;
    878 
    879     // Name of the currency, using either a three-character ISO 4217 currency
    880     // code, or a regional currency identifier between 4 and 11 characters,
    881     // consisting of ASCII alphabetic characters ("a-zA-Z").
    882     // Should be padded to 12 bytes with 0-characters.
    883     // Currency codes are compared case-insensitively.
    884     uint8_t currency_code[12];
    885   };
    886 
    887 
    888 Images
    889 ^^^^^^
    890 
    891 .. ts:def:: ImageDataUrl
    892 
    893   // The string must be a data URL according to RFC 2397
    894   // with explicit mediatype and base64 parameters.
    895   //
    896   //     ``data:<mediatype>;base64,<data>``
    897   //
    898   // Supported mediatypes are ``image/jpeg`` and ``image/png``.
    899   // Invalid strings will be rejected by the wallet.
    900   type ImageDataUrl = string;
    901 
    902 
    903 --------------
    904 Binary Formats
    905 --------------
    906 
    907 .. note::
    908 
    909    Due to the way of handling "big" numbers by some platforms (such as
    910    JavaScript, for example), wherever the following specification mentions
    911    a 64-bit value, the actual implementations are strongly advised to rely on
    912    arithmetic up to 53 bits.
    913 
    914 .. note::
    915 
    916    Taler uses ``libgnunetutil`` for interfacing itself with the operating system,
    917    doing crypto work, and other "low level" actions, therefore it is strongly
    918    connected with the `GNUnet project <https://gnunet.org>`_.
    919 
    920 This section specifies the binary representation of messages used in Taler's
    921 protocols. The message formats are given in a C-style pseudocode notation.
    922 Padding is always specified explicitly, and numeric values are in network byte
    923 order (big endian).
    924 
    925 
    926 Time
    927 ^^^^
    928 
    929 In signed messages, time is represented using 64-bit big-endian values,
    930 denoting microseconds since the UNIX Epoch.  ``UINT64_MAX`` represents "never".
    931 
    932 .. sourcecode:: c
    933 
    934   struct GNUNET_TIME_Absolute {
    935     uint64_t timestamp_us;
    936   };
    937   struct GNUNET_TIME_AbsoluteNBO {
    938     uint64_t abs_value_us__;       // in network byte order
    939   };
    940 
    941 .. sourcecode:: c
    942 
    943   struct GNUNET_TIME_Relative {
    944     uint64_t timestamp_us;
    945   };
    946   struct GNUNET_TIME_RelativeNBO {
    947     uint64_t rel_value_us__;       // in network byte order
    948   };
    949 
    950 For certain statistics, we need to express relative time
    951 in ways that correspond exactly to the calendar. So while
    952 constants like ``GNUNET_TIME_UNIT_MONTH`` are defined to
    953 mean 30 days, we cannot do this when tracking income for
    954 a merchant over a calendar year. Thus, in this case,
    955 we use the `StatisticBucketRange` when rounding time to
    956 values that cannot be expressed as fixed multiples of
    957 seconds:
    958 
    959   .. ts:def:: StatisticBucketRange
    960 
    961     type MerchantStatisticCounterByBucket =
    962       "decade" | "year" | "quarter" | "month" | "week" | "day" | "hour" | "minute" | "second";
    963 
    964 .. _LegalTrouble:
    965 
    966 451 Responses
    967 ^^^^^^^^^^^^^
    968 
    969 When KYC operations are required, various endpoints may respond with a
    970 ``451 Unavailable for Legal Reasons`` status code and a `LegitimizationNeededResponse`
    971 body.
    972 
    973 .. ts:def:: LegitimizationNeededResponse
    974 
    975   // Implemented in this style since exchange
    976   // protocol **v20**.
    977   interface LegitimizationNeededResponse {
    978 
    979     // Numeric `error code <error-codes>` unique to the condition.
    980     // Should always be ``TALER_EC_EXCHANGE_GENERIC_KYC_REQUIRED``.
    981     code: Integer;
    982 
    983     // Human-readable description of the error, i.e. "missing parameter",
    984     // "commitment violation", ...  Should give a human-readable hint
    985     // about the error's nature. Optional, may change without notice!
    986     hint?: string;
    987 
    988     // Hash of the payto:// account URI for which KYC
    989     // is required.
    990     // The account holder can uses the ``/kyc-check/$H_PAYTO``
    991     // endpoint to check the KYC status or initiate the KYC process.
    992     h_payto: NormalizedPaytoHash;
    993 
    994     // Public key associated with the account. The client must sign
    995     // the initial request for the KYC status using the corresponding
    996     // private key.  Will be either a reserve public key or a merchant
    997     // (instance) public key.
    998     //
    999     // Absent if no public key is currently associated
   1000     // with the account and the client MUST thus first
   1001     // credit the exchange via an inbound wire transfer
   1002     // to associate a public key with the debited account.
   1003     account_pub?: EddsaPublicKey;
   1004 
   1005     // Identifies a set of measures that were triggered and that are
   1006     // now preventing this operation from proceeding.  Gives developers
   1007     // a starting point for understanding why the transaction was
   1008     // blocked and how to lift it.
   1009     // Can be zero (which means there is no requirement row),
   1010     // especially if ``bad_kyc_auth`` is set.
   1011     requirement_row: Integer;
   1012 
   1013     // True if the operation was denied because the
   1014     // KYC auth key does not match the merchant public
   1015     // key.  In this case, a KYC auth wire transfer
   1016     // with the merchant public key must be performed
   1017     // first.
   1018     // Since exchange protocol **v21**.
   1019     bad_kyc_auth?: boolean;
   1020 
   1021   }
   1022 
   1023 
   1024 Cryptographic primitives
   1025 ^^^^^^^^^^^^^^^^^^^^^^^^
   1026 
   1027 All elliptic curve operations are on Curve25519.  Public and private keys are
   1028 thus 32 bytes, and signatures 64 bytes.  For hashing, including HKDFs, Taler
   1029 uses 512-bit hash codes (64 bytes).
   1030 
   1031 .. _HashCode:
   1032 .. sourcecode:: c
   1033 
   1034    struct GNUNET_HashCode {
   1035      uint8_t hash[64];      // usually SHA-512
   1036    };
   1037 
   1038 .. sourcecode:: c
   1039 
   1040    struct TALER_DenominationHash {
   1041      struct GNUNET_HashCode hash;
   1042    };
   1043 
   1044 .. sourcecode:: c
   1045 
   1046    struct TALER_PrivateContractHash {
   1047      struct GNUNET_HashCode hash;
   1048    };
   1049 
   1050 .. sourcecode:: c
   1051 
   1052    struct TALER_ExtensionsPolicyHash {
   1053      struct GNUNET_HashCode hash;
   1054    };
   1055 
   1056 .. sourcecode:: c
   1057 
   1058    struct TALER_MerchantWireHash {
   1059      struct GNUNET_HashCode hash;
   1060    };
   1061 
   1062 .. _FullPaytoHash:
   1063 .. sourcecode:: c
   1064 
   1065    struct TALER_FullPaytoHash {
   1066      // Hash over a full payto://-URI, including receiver-name
   1067      // (and possibly BIC and other optional fields).
   1068      struct GNUNET_ShortHashCode hash;
   1069    };
   1070 
   1071 .. _NormalizedPaytoHash:
   1072 .. sourcecode:: c
   1073 
   1074    struct TALER_NormalizedPaytoHash {
   1075      // Hash over a normalized payto://-URI, including all optional
   1076      // fields and also with account-part canonicalized (so no BIC).
   1077      struct GNUNET_ShortHashCode hash;
   1078    };
   1079 
   1080 .. _BlindedCoinHash:
   1081 .. sourcecode:: c
   1082 
   1083    struct TALER_BlindedCoinHash {
   1084      // Hash over a) the hash of the denomination's public key,
   1085      // b) an enum value identifying the cipher, and
   1086      // c) cipher-dependant blinded information.
   1087      // See implementation of `TALER_coin_ev_hash`
   1088      // in libtalerexchange for details.
   1089      struct GNUNET_HashCode hash;
   1090    };
   1091 
   1092 .. sourcecode:: c
   1093 
   1094    struct TALER_CoinPubHash {
   1095      struct GNUNET_HashCode hash;
   1096    };
   1097 
   1098 .. sourcecode:: c
   1099 
   1100    struct TALER_OutputCommitmentHash {
   1101      struct GNUNET_HashCode hash;
   1102    };
   1103 
   1104 
   1105 .. _TALER_EcdhEphemeralPublicKeyP:
   1106 .. sourcecode:: c
   1107 
   1108    struct TALER_EcdhEphemeralPublicKeyP {
   1109      uint8_t ecdh_pub[32];
   1110    };
   1111 
   1112 .. _reserve-pub:
   1113 .. sourcecode:: c
   1114 
   1115    struct TALER_ReservePublicKeyP {
   1116      uint8_t eddsa_pub[32];
   1117    };
   1118 
   1119 .. _reserve-priv:
   1120 .. sourcecode:: c
   1121 
   1122    struct TALER_ReservePrivateKeyP {
   1123      uint8_t eddsa_priv[32];
   1124    };
   1125 
   1126    struct TALER_ReserveSignatureP {
   1127      uint8_t eddsa_signature[64];
   1128    };
   1129 
   1130 .. _merchant-pub:
   1131 .. sourcecode:: c
   1132 
   1133    struct TALER_MerchantPublicKeyP {
   1134      uint8_t eddsa_pub[32];
   1135    };
   1136 
   1137    struct TALER_MerchantPrivateKeyP {
   1138      uint8_t eddsa_priv[32];
   1139    };
   1140 
   1141    struct TALER_TransferPublicKeyP {
   1142      uint8_t ecdhe_pub[32];
   1143    };
   1144 
   1145    struct TALER_TransferPrivateKeyP {
   1146      uint8_t ecdhe_priv[32];
   1147    };
   1148 
   1149 
   1150 .. _AmlDecisionState:
   1151 .. sourcecode:: c
   1152 
   1153    enum TALER_AmlDecisionState {
   1154      NORMAL, PENDING, FROZEN
   1155    };
   1156 
   1157 .. _AmlOfficerPublicKeyP:
   1158 .. sourcecode:: c
   1159 
   1160    struct TALER_AmlOfficerPublicKeyP {
   1161      uint8_t eddsa_pub[32];
   1162    };
   1163 
   1164 .. _AmlOfficerPrivateKeyP:
   1165 .. sourcecode:: c
   1166 
   1167    struct TALER_AmlOfficerPrivateKeyP {
   1168      uint8_t eddsa_priv[32];
   1169    };
   1170 
   1171 .. _sign-key-pub:
   1172 .. sourcecode:: c
   1173 
   1174    struct TALER_ExchangePublicKeyP {
   1175      uint8_t eddsa_pub[32];
   1176    };
   1177 
   1178 .. _sign-key-priv:
   1179 .. sourcecode:: c
   1180 
   1181    struct TALER_ExchangePrivateKeyP {
   1182      uint8_t eddsa_priv[32];
   1183    };
   1184 
   1185 .. _eddsa-sig:
   1186 .. sourcecode:: c
   1187 
   1188    struct TALER_ExchangeSignatureP {
   1189      uint8_t eddsa_signature[64];
   1190    };
   1191 
   1192    struct TALER_MasterPublicKeyP {
   1193      uint8_t eddsa_pub[32];
   1194    };
   1195 
   1196    struct TALER_MasterPrivateKeyP {
   1197      uint8_t eddsa_priv[32];
   1198    };
   1199 
   1200     struct TALER_MasterSignatureP {
   1201      uint8_t eddsa_signature[64];
   1202    };
   1203 
   1204 .. _WireTransferIdentifierRawP:
   1205 .. sourcecode:: c
   1206 
   1207    struct WireTransferIdentifierRawP {
   1208      uint8_t raw[32];
   1209    };
   1210 
   1211 .. _UUID:
   1212 .. sourcecode:: c
   1213 
   1214    struct UUID {
   1215      uint32_t value[4];
   1216    };
   1217 
   1218 .. _WadId:
   1219 .. sourcecode:: c
   1220 
   1221    struct TALER_WadId wad_id {
   1222      uint32_t value[6];
   1223    };
   1224 
   1225 .. _eddsa-coin-pub:
   1226 .. sourcecode:: c
   1227 
   1228    union TALER_CoinSpendPublicKeyP {
   1229      uint8_t eddsa_pub[32];
   1230      uint8_t ecdhe_pub[32];
   1231    };
   1232 
   1233 .. _coin-priv:
   1234 .. sourcecode:: c
   1235 
   1236    union TALER_CoinSpendPrivateKeyP {
   1237      uint8_t eddsa_priv[32];
   1238      uint8_t ecdhe_priv[32];
   1239    };
   1240 
   1241    struct TALER_CoinSpendSignatureP {
   1242      uint8_t eddsa_signature[64];
   1243    };
   1244 
   1245    struct TALER_TransferSecretP {
   1246      uint8_t key[sizeof (struct GNUNET_HashCode)];
   1247    };
   1248 
   1249    struct TALER_EncryptedLinkSecretP {
   1250      uint8_t enc[sizeof (struct TALER_LinkSecretP)];
   1251    };
   1252 
   1253 .. _eddsa-token-pub:
   1254 .. sourcecode:: c
   1255 
   1256    union TALER_TokenPublicKeyP {
   1257      uint8_t eddsa_pub[32];
   1258      uint8_t ecdhe_pub[32];
   1259    };
   1260 
   1261 .. _Signatures:
   1262 
   1263 Signatures
   1264 ^^^^^^^^^^
   1265 
   1266 Any piece of signed data, complies to the abstract data structure given below.
   1267 
   1268 .. sourcecode:: c
   1269 
   1270   struct Data {
   1271     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1272     type1_t payload1;
   1273     type2_t payload2;
   1274     ...
   1275   };
   1276 
   1277   /*From gnunet_crypto_lib.h*/
   1278   struct GNUNET_CRYPTO_EccSignaturePurpose {
   1279     /**
   1280      * This field equals the number of bytes being signed,
   1281      * namely 'sizeof (struct Data)'.
   1282      */
   1283     uint32_t size;
   1284     /**
   1285      * This field is used to express the context in
   1286      * which the signature is made, ensuring that a
   1287      * signature cannot be lifted from one part of the protocol
   1288      * to another. See `src/include/taler_signatures.h` within the
   1289      * exchange's codebase (git://taler.net/exchange).
   1290      */
   1291     uint32_t purpose;
   1292   };
   1293 
   1294 
   1295 The following list contains all the data structures that can be signed in
   1296 Taler. Their definition is typically found in ``src/include/taler_signatures.h``,
   1297 within the
   1298 `exchange's codebase <https://docs.taler.net/global-licensing.html#exchange-repo>`_.
   1299 
   1300 
   1301 
   1302 .. _TALER_HashPlanchetsP:
   1303 .. sourcecode:: c
   1304 
   1305   /**
   1306    * This is the running SHA512-hash over all
   1307    * `TALER_BlindedCoinHashP` values of an array of coins.
   1308    * Note that each `TALER_BlindedCoinHashP` itself
   1309    * captures the hash of the corresponding denomination's
   1310    * public key.
   1311    */
   1312   struct TALER_HashPlanchetsP {
   1313  	struct GNUNET_HashCode hash;
   1314   };
   1315 
   1316 
   1317 .. _TALER_AgeMask:
   1318 .. sourcecode:: c
   1319 
   1320   /**
   1321    * Binary representation of the age groups.
   1322    * The bits set in the mask mark the edges at the beginning of a next age
   1323    * group.  F.e. for the age groups
   1324    *     0-7, 8-9, 10-11, 12-13, 14-15, 16-17, 18-20, 21-*
   1325    * the following bits are set:
   1326    *
   1327    *   31     24        16        8         0
   1328    *   |      |         |         |         |
   1329    *   oooooooo  oo1oo1o1  o1o1o1o1  ooooooo1
   1330    *
   1331    * A value of 0 means that the exchange does not support the extension for
   1332    * age-restriction.
   1333    */
   1334    struct TALER_AgeMask {
   1335        uint32_t mask;
   1336    };
   1337 
   1338 
   1339 
   1340 .. _TALER_WithdrawRequestPS:
   1341 .. sourcecode:: c
   1342 
   1343   /**
   1344    * Format used for to generate the signature on a request to withdraw
   1345    * coins from a reserve.
   1346    */
   1347   struct TALER_WithdrawRequestPS
   1348   {
   1349     /**
   1350      * Purpose is #TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW
   1351      */
   1352     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1353     /**
   1354      * Amount to withdraw, excluding fees, i.e.
   1355      * the total sum of the denominations of the coins.
   1356      * Note that the reserve must have a value of at least amount+fee.
   1357      */
   1358     struct TALER_Amount amount;
   1359     /**
   1360      * Total fee for the withdrawal.
   1361      * Note that the reserve must have a value of at least amount+fee.
   1362      */
   1363     struct TALER_Amount fee;
   1364     /**
   1365      * This is the running SHA512-hash over all
   1366      * `TALER_BlindedCoinHashP` values of the coins.
   1367      * Note that each `TALER_BlindedCoinHashP` itself
   1368      * captures the hash of the corresponding denomination's
   1369      * public key.
   1370      * If max_age was set in the withdraw request, there will be
   1371      * n*κ many such values. The iteration MUST be first over
   1372      * all coins belonging to κ index=0, then all coins
   1373      * to κ index=1 etc:
   1374      * h[0][0]…h[0][n-1]h[1][0]…h[1][n-1] … h[κ-1][0]…h[κ-1][n-1]
   1375      *
   1376      * Note also that this value is required for /recoup and
   1377      * -- in case of a withdraw request with required age proof --
   1378      * in the subsequent call to /reveal-withdraw
   1379      */
   1380     struct TALER_HashPlanchetsP h_planchets;
   1381     /**
   1382      * The master seed that was used in the call to /blinding-prepare blinding,
   1383      * or all zeros, if no denomination of cipher type Clause-Schnorr is used.
   1384      */
   1385      struct TALER_BlindingMasterSecretP blinding_seed;
   1386     /**
   1387      * If age restriction proof is required, the maximum age _group_
   1388      * to commit to, 0 otherwise. Note that in this case, all
   1389      * denominations for all coins MUST support age restriction.
   1390      * Also note that this is not an age (in years), but the age group
   1391      * (an index) according to list of age groups in the configuration
   1392      * of the exchange.  See TALER_get_max_group() how to calculate
   1393      * the age group to a given age (in years).
   1394      */
   1395     uint32_t max_age_group;
   1396     /**
   1397      * The age groups as configured for the exchange, represented as a mask.
   1398      * If max_age_group is > 0, the mask MUST be non-zero, too.
   1399      */
   1400     struct TALER_AgeMask mask;
   1401   };
   1402 
   1403 .. _TALER_WithdrawConfirmationPS:
   1404 
   1405 .. sourcecode:: c
   1406 
   1407   struct TALER_WithdrawConfirmationPS
   1408   {
   1409     /**
   1410      * Purpose is #TALER_SIGNATURE_EXCHANGE_CONFIRM_WITHDRAW.
   1411      * Signed by a `struct TALER_ExchangePrivateKeyP` using EdDSA.
   1412      */
   1413     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1414 
   1415     /**
   1416      * Commitment made in the /withdraw request.
   1417      * Also needed for the /reveal-withdraw endpoint (in case
   1418      * of required proof of age restriction) and for /recoup
   1419      */
   1420     struct TALER_HashBlindedPlanchetsP h_planchets;
   1421 
   1422     /**
   1423      * If proof of age restriction is not required for to this
   1424      * withdrawal, (i.e. max_age was not set during the request)
   1425      * MUST be 0xFFFFFFFF.
   1426      * Otherwise (i.e. proof of age restriction required):
   1427      * index that the client will not have to reveal, in NBO,
   1428      * MUST be smaller than #TALER_CNC_KAPPA.
   1429      */
   1430     uint32_t noreveal_index;
   1431 
   1432   };
   1433 
   1434 
   1435 .. _TALER_SingleWithdrawRequestPS:
   1436 .. sourcecode:: c
   1437 
   1438   struct TALER_SingleWithdrawRequestPS {
   1439     /**
   1440      * purpose.purpose = TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW
   1441      */
   1442     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1443     struct TALER_AmountNBO amount_with_fee;
   1444     struct TALER_DenominationHash h_denomination_pub;
   1445     struct TALER_BlindedCoinHash h_coin_envelope;
   1446   };
   1447 
   1448 
   1449 .. _taler_depositrequestps:
   1450 
   1451 .. sourcecode:: c
   1452 
   1453   struct TALER_DepositRequestPS {
   1454     /**
   1455      * purpose.purpose = TALER_SIGNATURE_WALLET_COIN_DEPOSIT
   1456      */
   1457     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1458     struct TALER_PrivateContractHash h_contract_terms;
   1459     struct TALER_AgeCommitmentHash h_age_commitment;
   1460     struct TALER_ExtensionsPolicyHash h_policy;
   1461     struct TALER_MerchantWireHash h_wire;
   1462     struct TALER_DenominationHash h_denom_pub;
   1463     struct GNUNET_TIME_AbsoluteNBO timestamp;
   1464     struct GNUNET_TIME_AbsoluteNBO refund_deadline;
   1465     struct TALER_AmountNBO amount_with_fee;
   1466     struct TALER_AmountNBO deposit_fee;
   1467     struct TALER_MerchantPublicKeyP merchant;
   1468     struct GNUNET_HashCode wallet_data_hash;
   1469   };
   1470 
   1471 .. _TALER_DepositConfirmationPS:
   1472 
   1473 .. sourcecode:: c
   1474 
   1475   struct TALER_DepositConfirmationPS {
   1476     /**
   1477      * purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT
   1478      */
   1479     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1480     struct TALER_PrivateContractHash h_contract_terms;
   1481     struct TALER_MerchantWireHash h_wire;
   1482     struct TALER_ExtensionsPolicyHash h_policy;
   1483     struct GNUNET_TIME_AbsoluteNBO timestamp;
   1484     struct GNUNET_TIME_AbsoluteNBO refund_deadline;
   1485     struct TALER_AmountNBO amount_without_fee;
   1486     union TALER_CoinSpendPublicKeyP coin_pub;
   1487     struct TALER_MerchantPublicKeyP merchant;
   1488   };
   1489 
   1490 
   1491 .. _TALER_RefreshCommitmentP:
   1492 .. sourcecode:: c
   1493 
   1494   struct TALER_RefreshCommitmentP {
   1495     /**
   1496      * @since vDOLDPLUS
   1497      * Hash over:
   1498      *   1. master_refresh_seed
   1499      *   2. kappa * n tranfer public keys, depths first: [0..n),...,[0..n)
   1500      *   3. hash over all pairs of R-values (for CS) if present, skipped otherwise
   1501      *   4. n denomination hashes, in order
   1502      *   5. amount with fee
   1503      *   6. kappa*n planchets, depths first: [0..n),...,[0..n)
   1504      *
   1505      * @since v27
   1506      * @deprecated vDOLDPLUS
   1507      * Hash over:
   1508      *   1. refresh_seed
   1509      *   2. hash over all pairs of R-values if present, skipped otherwise
   1510      *   3. n denomination hashes, in order
   1511      *   4. amount with fee
   1512      *   5. kappa * n planchets, depths first: [0..n),...,[0..n)
   1513      */
   1514      struct GNUNET_HashCode session_hash;
   1515  };
   1516 
   1517 .. _TALER_RefreshMeltCoinAffirmationPS:
   1518 .. sourcecode:: c
   1519 
   1520   struct TALER_RefreshMeltCoinAffirmationPS {
   1521     /**
   1522      * purpose.purpose = TALER_SIGNATURE_WALLET_COIN_MELT
   1523      */
   1524     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1525     struct TALER_RefreshCommitmentP session_hash;
   1526     struct TALER_DenominationHash h_denom_pub;
   1527     struct TALER_AgeCommitmentHash h_age_commitment;
   1528     struct TALER_AmountNBO amount_with_fee;
   1529     struct TALER_AmountNBO melt_fee;
   1530   };
   1531 
   1532 .. _TALER_RefreshMeltConfirmationPS:
   1533 .. sourcecode:: c
   1534 
   1535   struct TALER_RefreshMeltConfirmationPS {
   1536     /**
   1537      * purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT
   1538      */
   1539     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1540     struct TALER_RefreshCommitmentP session_hash;
   1541     uint16_t noreveal_index;
   1542   };
   1543 
   1544 .. _TALER_ExchangeSigningKeyValidityPS:
   1545 .. sourcecode:: c
   1546 
   1547   struct TALER_ExchangeSigningKeyValidityPS {
   1548     /**
   1549      * purpose.purpose = TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY
   1550      */
   1551     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1552     struct GNUNET_TIME_AbsoluteNBO start;
   1553     struct GNUNET_TIME_AbsoluteNBO expire;
   1554     struct GNUNET_TIME_AbsoluteNBO end;
   1555     struct TALER_ExchangePublicKeyP signkey_pub;
   1556   };
   1557 
   1558 .. _TALER_ExchangeKeySetPS:
   1559 .. sourcecode:: c
   1560 
   1561   struct TALER_ExchangeKeySetPS {
   1562       /**
   1563        * purpose.purpose = TALER_SIGNATURE_EXCHANGE_KEY_SET
   1564        */
   1565       struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1566       struct GNUNET_TIME_AbsoluteNBO list_issue_date;
   1567       struct GNUNET_HashCode hc;
   1568   };
   1569 
   1570 .. _TALER_DenominationKeyValidityPS:
   1571 .. sourcecode:: c
   1572 
   1573   struct TALER_DenominationKeyValidityPS {
   1574     /**
   1575      * purpose.purpose = TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY
   1576      */
   1577     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1578     struct TALER_MasterPublicKeyP master;
   1579     struct GNUNET_TIME_AbsoluteNBO start;
   1580     struct GNUNET_TIME_AbsoluteNBO expire_withdraw;
   1581     struct GNUNET_TIME_AbsoluteNBO expire_spend;
   1582     struct GNUNET_TIME_AbsoluteNBO expire_legal;
   1583     struct TALER_AmountNBO value;
   1584     struct TALER_AmountNBO fee_withdraw;
   1585     struct TALER_AmountNBO fee_deposit;
   1586     struct TALER_AmountNBO fee_refresh;
   1587     struct TALER_DenominationHash denom_hash;
   1588   };
   1589 
   1590 .. _TALER_MasterWireDetailsPS:
   1591 .. sourcecode:: c
   1592 
   1593   struct TALER_MasterWireDetailsPS {
   1594     /**
   1595      * purpose.purpose = TALER_SIGNATURE_MASTER_WIRE_DETAILS
   1596      */
   1597     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1598     struct TALER_FullPaytoHash h_wire_details;
   1599     struct GNUNET_HashCode h_conversion_url;
   1600     struct GNUNET_HashCode h_credit_restrictions;
   1601     struct GNUNET_HashCode h_debit_restrictions;
   1602   };
   1603 
   1604 .. _TALER_MasterWireFeePS:
   1605 .. sourcecode:: c
   1606 
   1607   struct TALER_MasterWireFeePS {
   1608     /**
   1609      * purpose.purpose = TALER_SIGNATURE_MASTER_WIRE_FEES
   1610      */
   1611     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1612     struct GNUNET_HashCode h_wire_method;
   1613     struct GNUNET_TIME_AbsoluteNBO start_date;
   1614     struct GNUNET_TIME_AbsoluteNBO end_date;
   1615     struct TALER_AmountNBO wire_fee;
   1616     struct TALER_AmountNBO closing_fee;
   1617   };
   1618 
   1619 .. _TALER_GlobalFeesPS:
   1620 .. sourcecode:: c
   1621 
   1622   struct TALER_GlobalFeesPS {
   1623     /**
   1624      * purpose.purpose = TALER_SIGNATURE_MASTER_GLOBAL_FEES
   1625      */
   1626     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1627     struct GNUNET_TIME_AbsoluteNBO start_date;
   1628     struct GNUNET_TIME_AbsoluteNBO end_date;
   1629     struct GNUNET_TIME_RelativeNBO purse_timeout;
   1630     struct GNUNET_TIME_RelativeNBO kyc_timeout;
   1631     struct GNUNET_TIME_RelativeNBO history_expiration;
   1632     struct TALER_AmountNBO history_fee;
   1633     struct TALER_AmountNBO kyc_fee;
   1634     struct TALER_AmountNBO account_fee;
   1635     struct TALER_AmountNBO purse_fee;
   1636     uint32_t purse_account_limit;
   1637   };
   1638 
   1639 .. _TALER_MasterDrainProfitPS:
   1640 .. sourcecode:: c
   1641 
   1642   struct TALER_MasterDrainProfitPS {
   1643     /**
   1644      * purpose.purpose = TALER_SIGNATURE_MASTER_DRAIN_PROFITS
   1645      */
   1646     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1647     struct TALER_WireTransferIdentifierRawP wtid;
   1648     struct GNUNET_TIME_AbsoluteNBO date;
   1649     struct TALER_AmountNBO amount;
   1650     struct GNUNET_HashCode h_section;
   1651     struct TALER_FullPaytoHashP h_payto;
   1652   };
   1653 
   1654 .. _TALER_DepositTrackPS:
   1655 .. sourcecode:: c
   1656 
   1657   struct TALER_DepositTrackPS {
   1658     /**
   1659      * purpose.purpose = TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION
   1660      */
   1661     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1662     struct TALER_PrivateContractHash h_contract_terms;
   1663     struct TALER_MerchantWireHash h_wire;
   1664     union TALER_CoinSpendPublicKeyP coin_pub;
   1665   };
   1666 
   1667 .. _TALER_WireDepositDetailP:
   1668 .. sourcecode:: c
   1669 
   1670   struct TALER_WireDepositDetailP {
   1671     struct TALER_PrivateContractHash h_contract_terms;
   1672     struct GNUNET_TIME_AbsoluteNBO execution_time;
   1673     union TALER_CoinSpendPublicKeyP coin_pub;
   1674     struct TALER_AmountNBO deposit_value;
   1675     struct TALER_AmountNBO deposit_fee;
   1676   };
   1677 
   1678 .. _TALER_WireDepositDataPS:
   1679 .. _TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT:
   1680 .. sourcecode:: c
   1681 
   1682   struct TALER_WireDepositDataPS {
   1683     /**
   1684      * purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT
   1685      */
   1686     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1687     struct TALER_AmountNBO total;
   1688     struct TALER_AmountNBO wire_fee;
   1689     struct TALER_MerchantPublicKeyP merchant_pub;
   1690     struct TALER_MerchantWireHash h_wire;
   1691     struct GNUNET_HashCode h_details;
   1692   };
   1693 
   1694 .. _TALER_ExchangeKeyValidityPS:
   1695 .. sourcecode:: c
   1696 
   1697   struct TALER_ExchangeKeyValidityPS {
   1698     /**
   1699      * purpose.purpose = TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS
   1700      */
   1701     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1702     struct GNUNET_HashCode auditor_url_hash;
   1703     struct TALER_MasterPublicKeyP master;
   1704     struct GNUNET_TIME_AbsoluteNBO start;
   1705     struct GNUNET_TIME_AbsoluteNBO expire_withdraw;
   1706     struct GNUNET_TIME_AbsoluteNBO expire_spend;
   1707     struct GNUNET_TIME_AbsoluteNBO expire_legal;
   1708     struct TALER_AmountNBO value;
   1709     struct TALER_AmountNBO fee_withdraw;
   1710     struct TALER_AmountNBO fee_deposit;
   1711     struct TALER_AmountNBO fee_refresh;
   1712     struct TALER_DenominationHash denom_hash;
   1713   };
   1714 
   1715 .. _TALER_PaymentResponsePS:
   1716 .. sourcecode:: c
   1717 
   1718   struct PaymentResponsePS {
   1719     /**
   1720      * purpose.purpose = TALER_SIGNATURE_MERCHANT_PAYMENT_OK
   1721      */
   1722     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1723     struct TALER_PrivateContractHash h_contract_terms;
   1724   };
   1725 
   1726 .. _TALER_ContractPS:
   1727 .. sourcecode:: c
   1728 
   1729   struct TALER_ContractPS {
   1730     /**
   1731      * purpose.purpose = TALER_SIGNATURE_MERCHANT_CONTRACT
   1732      */
   1733     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1734     struct TALER_PrivateContractHash h_contract_terms;
   1735   };
   1736 
   1737 .. _TALER_ConfirmWirePS:
   1738 .. _TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE:
   1739 .. sourcecode:: c
   1740 
   1741   struct TALER_ConfirmWirePS {
   1742     /**
   1743      * purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE
   1744      */
   1745     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1746     struct TALER_MerchantWireHash h_wire;
   1747     struct TALER_PrivateContractHash h_contract_terms;
   1748     struct TALER_WireTransferIdentifierRawP wtid;
   1749     union TALER_CoinSpendPublicKeyP coin_pub;
   1750     struct GNUNET_TIME_AbsoluteNBO execution_time;
   1751     struct TALER_AmountNBO coin_contribution;
   1752   };
   1753 
   1754 .. _TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND:
   1755 .. sourcecode:: c
   1756 
   1757    struct TALER_RefundConfirmationPS {
   1758      /**
   1759       * purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND.
   1760       */
   1761      struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1762      struct TALER_PrivateContractHash h_contract_terms;
   1763      union TALER_CoinSpendPublicKeyP coin_pub;
   1764      struct TALER_MerchantPublicKeyP merchant;
   1765      uint64_t rtransaction_id;
   1766      struct TALER_AmountNBO refund_amount;
   1767    };
   1768 
   1769 .. _TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION:
   1770 .. sourcecode:: c
   1771 
   1772     struct TALER_DepositTrackPS {
   1773       /**
   1774        * purpose.purpose = TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION.
   1775        */
   1776       struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1777       struct TALER_PrivateContractHash h_contract_terms;
   1778       struct TALER_MerchantWireHash h_wire;
   1779       struct TALER_MerchantPublicKeyP merchant;
   1780       union TALER_CoinSpendPublicKeyP coin_pub;
   1781     };
   1782 
   1783 .. _TALER_RefundRequestPS:
   1784 .. sourcecode:: c
   1785 
   1786   struct TALER_RefundRequestPS {
   1787     /**
   1788      *  purpose.purpose = TALER_SIGNATURE_MERCHANT_REFUND
   1789      */
   1790     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1791     struct TALER_PrivateContractHash h_contract_terms;
   1792     union TALER_CoinSpendPublicKeyP coin_pub;
   1793     uint64_t rtransaction_id;
   1794     struct TALER_AmountNBO refund_amount;
   1795     struct TALER_AmountNBO refund_fee;
   1796   };
   1797 
   1798 .. _TALER_MerchantRefundConfirmationPS:
   1799 .. sourcecode:: c
   1800 
   1801   struct TALER_MerchantRefundConfirmationPS {
   1802     /**
   1803      *  purpose.purpose = TALER_SIGNATURE_MERCHANT_REFUND_OK
   1804      */
   1805     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1806     /**
   1807      * Hash of the order ID (a string), hashed without the 0-termination.
   1808      */
   1809     struct GNUNET_HashCode h_order_id;
   1810   };
   1811 
   1812 
   1813 .. _TALER_RecoupRequestPS:
   1814 .. sourcecode:: c
   1815 
   1816   struct TALER_RecoupRequestPS {
   1817     /**
   1818      *  purpose.purpose = TALER_SIGNATURE_WALLET_COIN_RECOUP
   1819      * or TALER_SIGNATURE_WALLET_COIN_RECOUP_REFRESH
   1820      */
   1821     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1822     struct TALER_DenominationHash h_denom_pub;
   1823     struct TALER_DenominationBlindingKeyP coin_blind;
   1824   };
   1825 
   1826 .. _TALER_RecoupRefreshConfirmationPS:
   1827 .. sourcecode:: c
   1828 
   1829   struct TALER_RecoupRefreshConfirmationPS {
   1830     /**
   1831      * purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH
   1832      */
   1833     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1834     struct GNUNET_TIME_AbsoluteNBO timestamp;
   1835     struct TALER_AmountNBO recoup_amount;
   1836     union TALER_CoinSpendPublicKeyP coin_pub;
   1837     union TALER_CoinSpendPublicKeyP old_coin_pub;
   1838   };
   1839 
   1840 .. _TALER_RecoupConfirmationPS:
   1841 .. sourcecode:: c
   1842 
   1843   struct TALER_RecoupConfirmationPS {
   1844     /**
   1845      * purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP
   1846      */
   1847     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1848     struct GNUNET_TIME_AbsoluteNBO timestamp;
   1849     struct TALER_AmountNBO recoup_amount;
   1850     union TALER_CoinSpendPublicKeyP coin_pub;
   1851     struct TALER_ReservePublicKeyP reserve_pub;
   1852   };
   1853 
   1854 
   1855 .. _TALER_DenominationUnknownAffirmationPS:
   1856 .. sourcecode:: c
   1857 
   1858   struct TALER_DenominationUnknownAffirmationPS {
   1859     /**
   1860      * purpose.purpose = TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_UNKNOWN
   1861      */
   1862     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1863     struct GNUNET_TIME_AbsoluteNBO timestamp;
   1864     struct TALER_DenominationHash h_denom_pub;
   1865   };
   1866 
   1867 
   1868 .. _TALER_DenominationExpiredAffirmationPS:
   1869 .. sourcecode:: c
   1870 
   1871   struct TALER_DenominationExpiredAffirmationPS {
   1872     /**
   1873      * purpose.purpose = TALER_SIGNATURE_EXCHANGE_GENERIC_DENOMINATIN_EXPIRED
   1874      */
   1875     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1876     struct GNUNET_TIME_AbsoluteNBO timestamp;
   1877     char operation[8];
   1878     struct TALER_DenominationHash h_denom_pub;
   1879   };
   1880 
   1881 
   1882 .. _TALER_ReserveCloseConfirmationPS:
   1883 .. sourcecode:: c
   1884 
   1885   struct TALER_ReserveCloseConfirmationPS {
   1886     /**
   1887      * purpose.purpose = TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED
   1888      */
   1889     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1890     struct GNUNET_TIME_AbsoluteNBO timestamp;
   1891     struct TALER_AmountNBO closing_amount;
   1892     struct TALER_ReservePublicKeyP reserve_pub;
   1893     struct TALER_FullPaytoHash h_wire;
   1894   };
   1895 
   1896 .. _TALER_CoinLinkSignaturePS:
   1897 .. sourcecode:: c
   1898 
   1899   struct TALER_CoinLinkSignaturePS {
   1900     /**
   1901      * purpose.purpose = TALER_SIGNATURE_WALLET_COIN_LINK
   1902      */
   1903     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1904     struct TALER_DenominationHash h_denom_pub;
   1905     union TALER_CoinSpendPublicKeyP old_coin_pub;
   1906     struct TALER_TransferPublicKeyP transfer_pub;
   1907     struct TALER_BlindedCoinHash coin_envelope_hash;
   1908   };
   1909 
   1910 .. _TALER_RefreshNonceSignaturePS:
   1911 .. sourcecode:: c
   1912 
   1913   struct TALER_RefreshNonceSignaturePS
   1914   {
   1915     /**
   1916      * purpose.purpose = TALER_SIGNATURE_WALLET_COIN_LINK
   1917      */
   1918     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1919     struct TALER_PublicRefreshCoinNonceP nonce;
   1920   };
   1921 
   1922 
   1923 .. _TALER_ReserveStatusRequestSignaturePS:
   1924 .. sourcecode:: c
   1925 
   1926   struct TALER_ReserveStatusRequestSignaturePS {
   1927     /**
   1928      * purpose.purpose = TALER_SIGNATURE_RESERVE_STATUS_REQUEST
   1929      */
   1930     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1931     struct GNUNET_TIME_AbsoluteNBO request_timestamp;
   1932   };
   1933 
   1934 
   1935 .. _TALER_ReserveHistoryRequestSignaturePS:
   1936 .. sourcecode:: c
   1937 
   1938   struct TALER_ReserveHistoryRequestSignaturePS {
   1939     /**
   1940      * purpose.purpose = TALER_SIGNATURE_RESERVE_HISTORY_REQUEST
   1941      */
   1942     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1943     struct TALER_AmountNBO history_fee;
   1944     struct GNUNET_TIME_AbsoluteNBO request_timestamp;
   1945   };
   1946 
   1947 
   1948 .. _TALER_PurseStatusRequestSignaturePS:
   1949 .. sourcecode:: c
   1950 
   1951   struct TALER_PurseStatusRequestSignaturePS {
   1952     /**
   1953      * purpose.purpose = TALER_SIGNATURE_PURSE_STATUS_REQUEST
   1954      */
   1955     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1956   };
   1957 
   1958 
   1959 .. _TALER_PurseStatusResponseSignaturePS:
   1960 .. sourcecode:: c
   1961 
   1962   struct TALER_PurseStatusResponseSignaturePS {
   1963     /**
   1964      * purpose.purpose = TALER_SIGNATURE_PURSE_STATUS_RESPONSE
   1965      */
   1966     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1967     struct TALER_AmountNBO total_purse_amount;
   1968     struct TALER_AmountNBO total_deposit_amount;
   1969     struct TALER_AmountNBO max_deposit_fees;
   1970     struct GNUNET_TIME_AbsoluteNBO purse_expiration;
   1971     struct GNUNET_TIME_AbsoluteNBO status_timestamp;
   1972     struct TALER_PrivateContractHash h_contract_terms;
   1973   };
   1974 
   1975 
   1976 .. _TALER_ReserveCloseRequestSignaturePS:
   1977 .. sourcecode:: c
   1978 
   1979   struct TALER_ReserveCloseRequestSignaturePS {
   1980     /**
   1981      * purpose.purpose = TALER_SIGNATURE_WALLET_RESERVE_CLOSE
   1982      */
   1983     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1984   };
   1985 
   1986 
   1987 .. _TALER_PurseRequestSignaturePS:
   1988 .. sourcecode:: c
   1989 
   1990   struct TALER_PurseRequestSignaturePS {
   1991     /**
   1992      * purpose.purpose = TALER_SIGNATURE_WALLET_PURSE_CREATE
   1993      */
   1994     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   1995     struct GNUNET_TIME_AbsoluteNBO purse_expiration;
   1996     struct TALER_AmountNBO merge_value_after_fees;
   1997     struct TALER_PrivateContractHashP h_contract_terms;
   1998     uint32_t min_age;
   1999   };
   2000 
   2001 
   2002 .. _TALER_PurseDepositSignaturePS:
   2003 .. sourcecode:: c
   2004 
   2005   struct TALER_PurseDepositSignaturePS {
   2006     /**
   2007      * purpose.purpose = TALER_SIGNATURE_PURSE_DEPOSIT
   2008      */
   2009     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2010     struct TALER_AmountNBO coin_contribution;
   2011     struct TALER_DenominationHash h_denom_pub;
   2012     struct TALER_AgeCommitmentHash h_age_commitment;
   2013     struct TALER_PursePublicKeyP purse_pub;
   2014     struct GNUNET_HashCode h_exchange_base_url;
   2015   };
   2016 
   2017 
   2018 .. _TALER_ReserveOpenDepositSignaturePS:
   2019 .. sourcecode:: c
   2020 
   2021   struct TALER_PurseDepositSignaturePS {
   2022     /**
   2023      * purpose.purpose = TALER_SIGNATURE_WALLET_RESERVE_OPEN_DEPOSIT
   2024      */
   2025     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2026     struct TALER_ReserveSignatureP reserve_sig;
   2027     struct TALER_AmountNBO coin_contribution;
   2028   };
   2029 
   2030 
   2031 .. _TALER_PurseDepositConfirmedSignaturePS:
   2032 .. sourcecode:: c
   2033 
   2034   struct TALER_PurseDepositConfirmedSignaturePS {
   2035     /**
   2036      * purpose.purpose = TALER_SIGNATURE_PURSE_DEPOSIT_CONFIRMED
   2037      */
   2038     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2039     struct TALER_AmountNBO total_purse_amount;
   2040     struct TALER_AmountNBO total_deposit_fees;
   2041     struct TALER_PursePublicKeyP purse_pub;
   2042     struct GNUNET_TIME_AbsoluteNBO purse_expiration;
   2043     struct TALER_PrivateContractHashP h_contract_terms;
   2044   };
   2045 
   2046 .. _TALER_PurseMergeSignaturePS:
   2047 .. sourcecode:: c
   2048 
   2049   struct TALER_PurseMergeSignaturePS {
   2050     /**
   2051      * purpose.purpose = TALER_SIGNATURE_WALLET_PURSE_MERGE
   2052      */
   2053     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2054     struct GNUNET_TIME_AbsoluteNBO merge_timestamp;
   2055     struct TALER_NormalizedPaytoHashP h_wire;
   2056   };
   2057 
   2058 
   2059 .. _TALER_AccountMergeSignaturePS:
   2060 .. sourcecode:: c
   2061 
   2062   struct TALER_AccountMergeSignaturePS {
   2063     /**
   2064      * purpose.purpose = TALER_SIGNATURE_WALLET_ACCOUNT_MERGE
   2065      */
   2066     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2067     struct TALER_ReservePublicKeyP reserve_pub;
   2068     struct TALER_PursePublicKeyP purse_pub;
   2069     struct TALER_AmountNBO merge_amount_after_fees;
   2070     struct GNUNET_TIME_AbsoluteNBO merge_timestamp;
   2071     struct GNUNET_TIME_AbsoluteNBO purse_expiration;
   2072     struct TALER_PrivateContractHashP h_contract_terms;
   2073     uint32_t min_age;
   2074   };
   2075 
   2076 .. _TALER_AccountSetupRequestSignaturePS:
   2077 .. sourcecode:: c
   2078 
   2079   struct TALER_AccountSetupRequestSignaturePS {
   2080     /**
   2081      * purpose.purpose = TALER_SIGNATURE_WALLET_ACCOUNT_SETUP
   2082      */
   2083     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2084     struct TALER_AmountNBO threshold;
   2085   };
   2086 
   2087 .. _TALER_PurseMergeSuccessSignaturePS:
   2088 .. sourcecode:: c
   2089 
   2090   struct TALER_PurseMergeSuccessSignaturePS {
   2091     /**
   2092      * purpose.purpose = TALER_SIGNATURE_PURSE_MERGE_SUCCESS
   2093      */
   2094     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2095     struct TALER_ReservePublicKeyP reserve_pub;
   2096     struct TALER_PursePublicKeyP purse_pub;
   2097     struct TALER_AmountNBO merge_amount_after_fees;
   2098     struct GNUNET_TIME_AbsoluteNBO contract_time;
   2099     struct TALER_PrivateContractHashP h_contract_terms;
   2100     struct TALER_NormalizedPaytoHashP h_wire;
   2101     uint32_t min_age;
   2102   };
   2103 
   2104 
   2105 .. _TALER_WadDataSignaturePS:
   2106 .. sourcecode:: c
   2107 
   2108   struct TALER_WadDataSignaturePS {
   2109     /**
   2110      * purpose.purpose = TALER_SIGNATURE_WAD_DATA
   2111      */
   2112     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2113     struct GNUNET_TIME_AbsoluteNBO wad_execution_time;
   2114     struct TALER_AmountNBO total_amount;
   2115     struct GNUNET_HashCode h_items;
   2116     struct TALER_WadId wad_id;
   2117   };
   2118 
   2119 .. _TALER_WadPartnerSignaturePS:
   2120 .. sourcecode:: c
   2121 
   2122   struct TALER_WadPartnerSignaturePS {
   2123     /**
   2124      * purpose.purpose = TALER_SIGNATURE_MASTER_PARTNER_DETAILS
   2125      */
   2126     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2127     struct GNUNET_HashCode h_partner_base_url;
   2128     struct TALER_MasterPublicKeyP master_public_key;
   2129     struct GNUNET_TIME_AbsoluteNBO start_date;
   2130     struct GNUNET_TIME_AbsoluteNBO end_date;
   2131     struct TALER_AmountNBO wad_fee;
   2132     struct GNUNET_TIME_RelativeNBO wad_frequency;
   2133   };
   2134 
   2135 
   2136 .. _TALER_P2PFeesPS:
   2137 .. sourcecode:: c
   2138 
   2139   struct TALER_P2PFeesPS {
   2140     /**
   2141      * purpose.purpose = TALER_SIGNATURE_P2P_FEES
   2142      */
   2143     struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2144     struct GNUNET_TIME_AbsoluteNBO start_date;
   2145     struct GNUNET_TIME_AbsoluteNBO end_date;
   2146     struct TALER_AmountNBO kyc_fee;
   2147     struct TALER_AmountNBO purse_fee;
   2148     struct TALER_AmountNBO account_history_fee;
   2149     struct TALER_AmountNBO account_annual_fee;
   2150     struct GNUNET_TIME_RelativeNBO account_kyc_timeout;
   2151     struct GNUNET_TIME_RelativeNBO purse_timeout;
   2152     uint32_t purse_account_limit;
   2153   };
   2154 
   2155 
   2156 .. _TALER_SIGNATURE_EXCHANGE_CONFIRM_PURSE_REFUND:
   2157 .. sourcecode:: c
   2158 
   2159    struct TALER_CoinPurseRefundConfirmationPS {
   2160      /**
   2161       * purpose.purpose = TALER_SIGNATURE_EXCHANGE_CONFIRM_PURSE_REFUND.
   2162       */
   2163      struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2164      struct TALER_PursePublicKeyP purse_pub;
   2165      union TALER_CoinSpendPublicKeyP coin_pub;
   2166      struct TALER_AmountNBO refunded_amount;
   2167      struct TALER_AmountNBO refund_fee;
   2168    };
   2169 
   2170 
   2171 .. _TALER_DenominationKeyAnnouncementPS:
   2172 .. sourcecode:: c
   2173 
   2174    struct TALER_DenominationKeyAnnouncementPS {
   2175      /**
   2176       * purpose.purpose = TALER_SIGNATURE_SM_DENOMINATION_KEY
   2177       */
   2178       struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2179       struct TALER_DenominationHash h_denom_pub;
   2180       struct GNUNET_HashCode h_section_name;
   2181       struct GNUNET_TIME_AbsoluteNBO anchor_time;
   2182       struct GNUNET_TIME_RelativeNBO duration_withdraw;
   2183     };
   2184 
   2185 
   2186 .. _TALER_SigningKeyAnnouncementPS:
   2187 .. sourcecode:: c
   2188 
   2189     struct TALER_SigningKeyAnnouncementPS {
   2190       /**
   2191        * purpose.purpose = TALER_SIGNATURE_SM_SIGNING_KEY .
   2192        */
   2193       struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2194       struct TALER_ExchangePublicKeyP exchange_pub;
   2195       struct GNUNET_TIME_AbsoluteNBO anchor_time;
   2196       struct GNUNET_TIME_RelativeNBO duration;
   2197     };
   2198 
   2199 .. _TALER_MasterDenominationKeyRevocationPS:
   2200 .. sourcecode:: c
   2201 
   2202     struct TALER_MasterDenominationKeyRevocationPS {
   2203       /**
   2204        * purpose.purpose = TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED.
   2205        */
   2206       struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2207       struct TALER_DenominationHash h_denom_pub;
   2208     };
   2209 
   2210 
   2211 .. _TALER_MasterSigningKeyRevocationPS:
   2212 .. sourcecode:: c
   2213 
   2214     struct TALER_MasterSigningKeyRevocationPS {
   2215       /**
   2216        * purpose.purpose = TALER_SIGNATURE_MASTER_SIGNING_KEY_REVOKED.
   2217        */
   2218       struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2219       struct TALER_ExchangePublicKeyP exchange_pub;
   2220     };
   2221 
   2222 
   2223 .. _TALER_MasterAddAuditorPS:
   2224 .. sourcecode:: c
   2225 
   2226     struct TALER_MasterAddAuditorPS {
   2227       /**
   2228        * purpose.purpose = TALER_SIGNATURE_MASTER_ADD_AUDITOR
   2229        */
   2230        struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2231        struct GNUNET_TIME_AbsoluteNBO start_date;
   2232        struct TALER_AuditorPublicKeyP auditor_pub;
   2233        struct GNUNET_HashCode h_auditor_url;
   2234      };
   2235 
   2236 .. _TALER_MasterDelAuditorPS:
   2237 .. sourcecode:: c
   2238 
   2239     struct TALER_MasterDelAuditorPS {
   2240       /**
   2241        * purpose.purpose = TALER_SIGNATURE_MASTER_DEL_AUDITOR
   2242        */
   2243       struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2244       struct GNUNET_TIME_AbsoluteNBO end_date;
   2245       struct TALER_AuditorPublicKeyP auditor_pub;
   2246     };
   2247 
   2248 .. _TALER_MasterAddWirePS:
   2249 .. sourcecode:: c
   2250 
   2251     struct TALER_MasterAddWirePS {
   2252       /**
   2253        * purpose.purpose = TALER_SIGNATURE_MASTER_ADD_WIRE.
   2254        */
   2255       struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2256       struct GNUNET_TIME_AbsoluteNBO start_date;
   2257       struct TALER_FullPaytoHash h_wire;
   2258       struct GNUNET_HashCode h_conversion_url;
   2259       struct GNUNET_HashCode h_credit_restrictions;
   2260       struct GNUNET_HashCode h_debit_restrictions;
   2261     };
   2262 
   2263 .. _TALER_MasterDelWirePS:
   2264 .. sourcecode:: c
   2265 
   2266     struct TALER_MasterDelWirePS {
   2267       /**
   2268        * purpose.purpose = TALER_SIGNATURE_MASTER_DEL_WIRE.
   2269        */
   2270       struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2271       struct GNUNET_TIME_AbsoluteNBO end_date;
   2272       struct TALER_FullPaytoHash h_wire;
   2273     };
   2274 
   2275 
   2276 .. _TALER_MasterAmlOfficerStatusPS:
   2277 .. sourcecode:: c
   2278 
   2279     struct TALER_MasterAmlOfficerStatusPS {
   2280       /**
   2281        * purpose.purpose = TALER_SIGNATURE_MASTER_AML_KEY
   2282        */
   2283       struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2284       struct GNUNET_TIME_TimestampNBO change_date;
   2285       struct TALER_AmlOfficerPublicKeyP officer_pub;
   2286       struct GNUNET_HashCode h_officer_name GNUNET_PACKED;
   2287       uint32_t is_active GNUNET_PACKED;
   2288     };
   2289 
   2290 .. _TALER_AmlDecisionPS:
   2291 .. sourcecode:: c
   2292 
   2293     struct TALER_AmlDecisionPS {
   2294       /**
   2295        * purpose.purpose =TALER_SIGNATURE_AML_DECISION.
   2296        */
   2297       struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2298       struct GNUNET_HashCode h_justification GNUNET_PACKED;
   2299       struct GNUNET_TIME_TimestampNBO decision_time;
   2300       struct TALER_AmountNBO new_threshold;
   2301       struct TALER_NormalizedPaytoHashP h_payto GNUNET_PACKED;
   2302       struct GNUNET_HashCode h_kyc_requirements;
   2303       uint32_t new_state GNUNET_PACKED;
   2304     };
   2305 
   2306 .. _TALER_PartnerConfigurationPS:
   2307 .. sourcecode:: c
   2308 
   2309     struct TALER_PartnerConfigurationPS {
   2310       /**
   2311        * purpose.purpose = TALER_SIGNATURE_MASTER_PARNTER_DETAILS
   2312        */
   2313       struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2314       struct TALER_MasterPublicKeyP partner_pub;
   2315       struct GNUNET_TIME_TimestampNBO start_date;
   2316       struct GNUNET_TIME_TimestampNBO end_date;
   2317       struct GNUNET_TIME_RelativeNBO wad_frequency;
   2318       struct TALER_AmountNBO wad_fee;
   2319       struct GNUNET_HashCode h_url;
   2320     };
   2321 
   2322 .. _TALER_ReserveOpenPS:
   2323 .. sourcecode:: c
   2324 
   2325     struct TALER_ReserveOpenPS {
   2326       /**
   2327        * Purpose.purpose = TALER_SIGNATURE_WALLET_RESERVE_OPEN
   2328        */
   2329       struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2330       struct TALER_AmountNBO reserve_payment;
   2331       struct GNUNET_TIME_TimestampNBO request_timestamp;
   2332       struct GNUNET_TIME_TimestampNBO reserve_expiration;
   2333       uint32_t purse_limit;
   2334     };
   2335 
   2336 .. _TALER_ReserveClosePS:
   2337 .. sourcecode:: c
   2338 
   2339     struct TALER_ReserveClosePS {
   2340       /**
   2341        * purpose.purpose = TALER_SIGNATURE_WALLET_RESERVE_CLOSE
   2342        */
   2343       struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2344       struct GNUNET_TIME_TimestampNBO request_timestamp;
   2345       struct TALER_FullPaytoHashP target_account_h_payto;
   2346     };
   2347 
   2348 .. _TALER_WalletReserveAttestRequestSignaturePS:
   2349 .. sourcecode:: c
   2350 
   2351     struct TALER_ReserveAttestRequestPS {
   2352       /**
   2353        * purpose.purpose = TALER_SIGNATURE_WALLET_ATTEST_REQUEST
   2354        */
   2355       struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2356       struct GNUNET_TIME_TimestampNBO request_timestamp;
   2357       struct GNUNET_HashCode h_details;
   2358     };
   2359 
   2360 .. _TALER_ExchangeAttestPS:
   2361 .. sourcecode:: c
   2362 
   2363     struct TALER_ExchangeAttestPS {
   2364       /**
   2365        * purpose.purpose = TALER_SIGNATURE_EXCHANGE_RESERVE_ATTEST_DETAILS
   2366        */
   2367       struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
   2368       struct GNUNET_TIME_TimestampNBO attest_timestamp;
   2369       struct GNUNET_TIME_TimestampNBO expiration_time;
   2370       struct TALER_ReservePublicKeyP reserve_pub;
   2371       struct GNUNET_HashCode h_attributes;
   2372     };