taler-docs

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

api-common.rst (69101B)


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