diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_exchange_service.h | 79 | ||||
-rw-r--r-- | src/include/taler_json_lib.h | 12 |
2 files changed, 91 insertions, 0 deletions
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index caa61c5f1..2dd220293 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -1033,6 +1033,85 @@ void TALER_EXCHANGE_refund_cancel (struct TALER_EXCHANGE_RefundHandle *refund); +/* ********************* POST /csr *********************** */ + + +/** + * @brief A /csr Handle + */ +struct TALER_EXCHANGE_CsRHandle; + + +/** + * Details about a response for a CS R request. + */ +struct TALER_EXCHANGE_CsRResponse +{ + /** + * HTTP response data. + */ + struct TALER_EXCHANGE_HttpResponse hr; + + /** + * Details about the response. + */ + union + { + /** + * Details if the status is #MHD_HTTP_OK. + */ + struct + { + /** + * Signature over the coin. + */ + struct TALER_DenominationCsPublicR r_pubs; + } success; + + /** + * Details if the status is #MHD_HTTP_GONE. + */ + struct + { + /* TODO: returning full details is not implemented */ + } gone; + + } details; +}; + + +/** + * Callbacks of this type are used to serve the result of submitting a + * CS R request to a exchange. + * + * @param cls closure + * @param csrr response details + */ +typedef void +(*TALER_EXCHANGE_CsRCallback) (void *cls, + const struct TALER_EXCHANGE_CsRResponse *csrr); + + +/** + * Get a CS R using a /csr request. + * + * @param exchange the exchange handle; the exchange must be ready to operate + * @param pk denomination of coin the R's will be used for + * @param nonce public nonce for CS R request + * @param res_cb the callback to call when the final result for this request is available + * @param res_cb_cls closure for the above callback + * @return handle for the operation on success, NULL on error, i.e. + * if the inputs are invalid (i.e. denomination key not with this exchange). + * In this case, the callback is not called. + */ +struct TALER_EXCHANGE_CsRHandle * +TALER_EXCHANGE_csr (struct TALER_EXCHANGE_Handle *exchange, + const struct TALER_EXCHANGE_DenomPublicKey *pk, + const struct TALER_WithdrawNonce *nonce, + TALER_EXCHANGE_CsRCallback res_cb, + void *res_cb_cls); + + /* ********************* GET /reserves/$RESERVE_PUB *********************** */ diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h index 51ebe6d90..d243dd723 100644 --- a/src/include/taler_json_lib.h +++ b/src/include/taler_json_lib.h @@ -300,6 +300,18 @@ TALER_JSON_spec_i18n_str (const char *name, /** + * Generate line in parser specification for a CS R. + * + * @param field name of the field + * @param r_pub where the r_pub has to be written + * @return corresponding field spec + */ +struct GNUNET_JSON_Specification +TALER_JSON_spec_csr (const char *field, + struct GNUNET_CRYPTO_CsRPublic *r_pub); + + +/** * Hash a JSON for binary signing. * * See https://tools.ietf.org/html/draft-rundgren-json-canonicalization-scheme-15 |