frosix

Multiparty signature service (experimental)
Log | Files | Refs | README | LICENSE

frosix_service.h (25071B)


      1 /*
      2   This file is part of Frosix
      3   Copyright (C) 2019-2022 Anastasis SARL
      4 
      5   Frosix is free software; you can redistribute it and/or modify it under the
      6   terms of the GNU General Public License as published by the Free Software
      7   Foundation; either version 3, or (at your option) any later version.
      8 
      9   Frosix 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 General Public License for more details.
     12 
     13   You should have received a copy of the GNU General Public License along with
     14   Frosix; see the file COPYING.LIB.  If not, see <http://www.gnu.org/licenses/>
     15 */
     16 /**
     17  * @file include/frosix_service.h
     18  * @brief C interface of libanastasisrest, a C library to use merchant's HTTP API
     19  * @author Christian Grothoff
     20  * @author Dennis Neufeld
     21  * @author Dominik Meister
     22  */
     23 #ifndef FROSIX_SERVICE_H
     24 #define FROSIX_SERVICE_H
     25 
     26 #include "keygen.h"
     27 #include "frosix_util_lib.h"
     28 #include "frosix_crypto.h"
     29 #include <gnunet/gnunet_curl_lib.h>
     30 #include <jansson.h>
     31 #include <taler/taler_util.h>
     32 
     33 #define FROSIX_SEED_SIZE 64
     34 
     35 /**
     36  * Frosix authorization method configuration
     37  */
     38 struct FROSIX_AuthorizationMethodConfig
     39 {
     40   /**
     41    * Type of the method, i.e. "question".
     42    */
     43   const char *type;
     44 
     45   /**
     46    * Fee charged for accessing key share using this method.
     47    */
     48   struct TALER_Amount usage_fee;
     49 };
     50 
     51 
     52 /**
     53  * @brief Frosix configuration data.
     54  */
     55 struct FROSIX_Config
     56 {
     57   /**
     58    * FIXME
     59   */
     60   uint8_t provider_index;
     61 
     62   /**
     63    * Protocol version supported by the server.
     64    */
     65   const char *version;
     66 
     67   /**
     68    * Business name of the frosix provider.
     69    */
     70   const char *business_name;
     71 
     72   /**
     73    * Array of authorization methods supported by the server.
     74    */
     75   const struct FROSIX_AuthorizationMethodConfig *methods;
     76 
     77   /**
     78    * Length of the @e methods array.
     79    */
     80   unsigned int methods_length;
     81 
     82   /**
     83    * Annual fee for an account / policy upload.
     84    */
     85   struct TALER_Amount annual_fee;
     86 
     87   /**
     88    * Fee for a truth upload.
     89    */
     90   struct TALER_Amount signature_creation_fee;
     91 
     92   /**
     93    * Maximum legal liability for data loss covered by the
     94    * provider.
     95    */
     96   struct TALER_Amount liability_limit;
     97 
     98   /**
     99    * Provider salt.
    100    */
    101   struct FROSIX_ProviderSaltP provider_salt;
    102 
    103   /**
    104    * Public key of the provider (to verify signatures and encrypt against)
    105   */
    106   struct GNUNET_CRYPTO_EddsaPublicKey public_key;
    107 
    108 };
    109 
    110 
    111 /**
    112  * Function called with the result of a /config request.
    113  * Note that an HTTP status of #MHD_HTTP_OK is no guarantee
    114  * that @a fcfg is non-NULL. @a fcfg is non-NULL only if
    115  * the server provided an acceptable response.
    116  *
    117  * @param cls closure
    118  * @param http_status the HTTP status
    119  * @param fcfg configuration obtained, NULL if we could not parse it
    120  */
    121 typedef void
    122 (*FROSIX_ConfigCallback)(void *cls,
    123                          unsigned int http_status,
    124                          const struct FROSIX_Config *fcfg);
    125 
    126 
    127 /**
    128  * @brief A Config Operation Handle
    129  */
    130 struct FROSIX_ConfigOperation
    131 {
    132   /**
    133    * The url for this request.
    134    */
    135   char *url;
    136 
    137   /**
    138    * Must not be 0!
    139   */
    140   uint8_t provider_index;
    141 
    142   /**
    143    * Handle for the request.
    144    */
    145   struct GNUNET_CURL_Job *job;
    146 
    147   /**
    148    * Reference to the execution context.
    149    */
    150   struct GNUNET_CURL_Context *ctx;
    151 
    152   /**
    153   * The callback to pass the backend response to
    154   */
    155   FROSIX_ConfigCallback cb;
    156 
    157   /**
    158    * Closure for @a cb.
    159    */
    160   void *cb_cls;
    161 
    162 };
    163 
    164 
    165 /**
    166  * Run a GET /config request against the Frosix backend.
    167  *
    168  * @param ctx CURL context to use
    169  * @param base_url base URL fo the Frosix backend
    170  * @param cb function to call with the results
    171  * @param cb_cls closure for @a cb
    172  * @return handle to cancel the operation
    173  */
    174 struct FROSIX_ConfigOperation *
    175 FROSIX_get_config (struct GNUNET_CURL_Context *ctx,
    176                    const char *base_url,
    177                    uint8_t provider_index,
    178                    FROSIX_ConfigCallback cb,
    179                    void *cb_cls);
    180 
    181 
    182 /**
    183  * Cancel ongoing #FROSIX_get_config() request.
    184  *
    185  * @param co configuration request to cancel.
    186  */
    187 void
    188 FROSIX_config_cancel (struct FROSIX_ConfigOperation *co);
    189 
    190 /* SEED API */
    191 
    192 /**
    193  *
    194 */
    195 struct FROSIX_Seed
    196 {
    197   uint8_t bytes[FROSIX_SEED_SIZE];
    198 };
    199 
    200 
    201 /**
    202  *
    203 */
    204 struct FROSIX_ProviderSeed
    205 {
    206   /**
    207    *
    208   */
    209   uint8_t provider_index;
    210 
    211   /**
    212    *
    213   */
    214   const struct FROSIX_Seed *seed;
    215 };
    216 
    217 /**
    218  *
    219 */
    220 typedef void
    221 (*FROSIX_SeedGetCallback) (void *cls,
    222                            unsigned int http_status,
    223                            const struct FROSIX_ProviderSeed *ps);
    224 
    225 /**
    226  * @brief A Contract Operation Handle
    227  */
    228 struct FROSIX_SeedGetOperation
    229 {
    230   /**
    231    * The url for this request, including parameters.
    232    */
    233   char *url;
    234 
    235   /**
    236    * Must not be 0!
    237   */
    238   uint8_t provider_index;
    239 
    240   /**
    241    * Handle for the request.
    242    */
    243   struct GNUNET_CURL_Job *job;
    244 
    245   /**
    246    * Function to call with the result.
    247    */
    248   FROSIX_SeedGetCallback cb;
    249 
    250   /**
    251    * Closure for @a cb.
    252    */
    253   void *cb_cls;
    254 
    255   /**
    256    * Reference to the execution context.
    257    */
    258   struct GNUNET_CURL_Context *ctx;
    259 
    260 };
    261 
    262 
    263 
    264 /**
    265  *
    266 */
    267 struct FROSIX_SeedGetOperation *
    268 FROSIX_seed_get (
    269   struct GNUNET_CURL_Context *ctx,
    270   const char *backend_url,
    271   uint8_t provider_index,
    272   FROSIX_SeedGetCallback cb,
    273   void *cb_cls);
    274 
    275 /**
    276  *
    277 */
    278 void
    279 FROSIX_seed_get_cancel (
    280   struct FROSIX_SeedGetOperation *sgo);
    281 
    282 
    283 /* CONFIG API */
    284 /* FIXME? */
    285 
    286 
    287 /*** DKG-COMMITMENT API ***/
    288 
    289 /**
    290  * High level ways how an dkg-commitment request may conclude.
    291 */
    292 enum FROSIX_DkgCommitmentStatus
    293 {
    294   /**
    295    * Commitment was successfully computed and returned.
    296   */
    297   FROSIX_DCS_SUCCESS = 0,
    298 
    299   /**
    300    * HTTP interaction failed, see HTTP status.
    301   */
    302   FROSIX_DCS_HTTP_ERROR,
    303 
    304   /**
    305    * We had an HTTP 400 error, see details in response body.
    306   */
    307   FROSIX_DCS_CLIENT_ERROR,
    308 
    309   /**
    310    * Server had an internal error.
    311   */
    312   FROSIX_DCS_SERVER_ERROR
    313 };
    314 
    315 
    316 /**
    317  *
    318 */
    319 struct FROSIX_DkgCommitmentRequestDetails
    320 {
    321   /**
    322    * High level status of the upload operation. Determines @e details.
    323   */
    324   enum FROSIX_DkgCommitmentStatus dcs;
    325 
    326   /**
    327    * HTTP status code.
    328    */
    329   unsigned int http_status;
    330 
    331   /**
    332    * Taler error code.
    333    */
    334   enum TALER_ErrorCode ec;
    335 
    336   /**
    337    * FIXME
    338   */
    339   uint8_t provider_index;
    340 
    341   /**
    342    * The returned DKG commitment, must be initialized before use!
    343   */
    344   struct FROST_DkgCommitment dkg_commitment;
    345 
    346   /**
    347    * Public key of the provider
    348   */
    349   struct GNUNET_CRYPTO_EddsaPublicKey public_key;
    350 };
    351 
    352 
    353 /**
    354  * Handle for a POST /dkg-commitment operation
    355 */
    356 struct FROSIX_DkgCommitmentRequestOperation;
    357 
    358 
    359 /**
    360  * Callback to process a POST /dkg-commitment request
    361  *
    362  * @param cls closure
    363  * @param dcd the response body
    364 */
    365 typedef void
    366 (*FROSIX_DkgCommitmentRequestCallback) (
    367   void *cls,
    368   const struct FROSIX_DkgCommitmentRequestDetails *dcd);
    369 
    370 
    371 /**
    372  * Ask for a DKG commitment, does a POST /dkg-commitment/$UUID
    373  *
    374  * @param ctx the CURL context used to connect to the backend
    375  * @param backend_url backend's base URL, including final "/"
    376  * @param uuid unique identification of the dkg-commitment request
    377  * @param identifier unique identifier of the provider in the group
    378  * @param threshold number of participants needed to create a valid signature
    379  * @param num_of_participants total number of participants in the group
    380  * @param context_string main source of entropy for the provider to create a commitment
    381  * @param challenge_hash salted hash of challenge method and data
    382  * @param providers_public_keys sorted list of public keys of all involved providers.
    383  * @param cb callback function of the request
    384  * @param cb_cls closure for the callback function
    385  * @return handle for the operation
    386 */
    387 struct FROSIX_DkgCommitmentRequestOperation *
    388 FROSIX_dkg_commitment_request (
    389   struct GNUNET_CURL_Context *ctx,
    390   const char *backend_url,
    391   const struct FROSIX_DkgRequestIdP *uuid,
    392   uint8_t identifier,
    393   uint8_t threshold,
    394   uint8_t num_of_participants,
    395   const struct FROSIX_DkgContextStringP *context_string,
    396   const struct FROSIX_ChallengeHashP *challenge_hash,
    397   const struct GNUNET_CRYPTO_EddsaPublicKey providers_public_keys[],
    398   FROSIX_DkgCommitmentRequestCallback cb,
    399   void *cb_cls);
    400 
    401 
    402 /**
    403  * Cancel a POST /dkg-commitment request
    404  *
    405  * @param dco the dkg-commitment request operation
    406 */
    407 void
    408 FROSIX_dkg_commitment_request_cancel (
    409   struct FROSIX_DkgCommitmentRequestOperation *dco);
    410 
    411 
    412 /*** DKG-SHARE API ***/
    413 
    414 /**
    415  * High level ways how an dkg-commitment request may conclude.
    416 */
    417 enum FROSIX_DkgShareStatus
    418 {
    419   /**
    420    * Commitment was successfully computed and returned.
    421   */
    422   FROSIX_DSS_SUCCESS = 0,
    423 
    424   /**
    425    * HTTP interaction failed, see HTTP status.
    426   */
    427   FROSIX_DSS_HTTP_ERROR,
    428 
    429   /**
    430    * We had an HTTP 400 error, see details in response body.
    431   */
    432   FROSIX_DSS_CLIENT_ERROR,
    433 
    434   /**
    435    * Server had an internal error.
    436   */
    437   FROSIX_DSS_SERVER_ERROR
    438 };
    439 
    440 
    441 /**
    442  * FIXME
    443 */
    444 struct FROSIX_DkgSecretShare
    445 {
    446   /**
    447     * Identifier of the target of this share
    448    */
    449   uint8_t target;
    450 
    451   /**
    452    * Identifier of the issuer. This information is intended for the target provider
    453   */
    454   uint8_t issuer;
    455 
    456   /**
    457    * The encrypted secret share
    458   */
    459   struct FROSIX_EncryptedShareP encrypted_share;
    460 
    461   /**
    462    * An ephemeral public key, which is needed to decrypt the share
    463   */
    464   struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
    465 };
    466 
    467 
    468 /**
    469  *
    470 */
    471 struct FROSIX_DkgShareRequestDetails
    472 {
    473   /**
    474    * High level status of the upload operation. Determines @e shares.
    475   */
    476   enum FROSIX_DkgShareStatus dss;
    477 
    478   /**
    479    * HTTP status code.
    480    */
    481   unsigned int http_status;
    482 
    483   /**
    484    * Taler error code.
    485    */
    486   enum TALER_ErrorCode ec;
    487 
    488   /**
    489    * Identifier of the provider
    490   */
    491   uint8_t provider_index;
    492 
    493   /**
    494    * Pointer to an array of secret shares
    495   */
    496   struct FROSIX_DkgSecretShare *shares;
    497 
    498   /**
    499    * Number of shares we got
    500   */
    501   size_t shares_len;
    502 };
    503 
    504 /**
    505  * FIXME
    506 */
    507 struct FROSIX_DkgCommitment
    508 {
    509   /**
    510    * FIXME
    511   */
    512   struct FROST_DkgCommitment commitment;
    513 
    514   /**
    515    * FIXME
    516   */
    517   struct GNUNET_CRYPTO_EcdhePublicKey encryption_public_key;
    518 };
    519 
    520 
    521 /**
    522  * Handle for a POST /dkg-share operation
    523 */
    524 struct FROSIX_DkgShareRequestOperation;
    525 
    526 
    527 /**
    528  * Callback to process a POST /dkg-share request
    529  *
    530  * @param cls closure
    531  * @param dsd the response body
    532 */
    533 typedef void
    534 (*FROSIX_DkgShareRequestCallback) (
    535   void *cls,
    536   const struct FROSIX_DkgShareRequestDetails *dcs);
    537 
    538 
    539 /**
    540  * Ask for encrypted shares in a distributed key generation. Does a POST /dkg-share/$UUID
    541  *
    542  * @param ctx the CURL context used to connect to the backend
    543  * @param backend_url backend's base URL, including final "/"
    544  * @param uuid unique identification of the dkg-commitment request
    545  * @param identifier unique identifier of the provider in the group
    546  * @param threshold number of participants needed to create a valid signature
    547  * @param num_of_participants total number of participants in the group
    548  * @param context_string main source of entropy for the provider to create a commitment
    549  * @param challenge_hash salted hash of challenge method and data
    550  * @param dkg_commitments all the commitments we have to send
    551  * @param len length of @a dkg_commitments array
    552  * @param providers_public_keys sorted list of public keys of all involved providers.
    553  * @param cb callback function of the request
    554  * @param cb_cls closure for the callback function
    555  * @return handle for the operation
    556 */
    557 struct FROSIX_DkgShareRequestOperation *
    558 FROSIX_dkg_share_request (
    559   struct GNUNET_CURL_Context *ctx,
    560   const char *backend_url,
    561   const struct FROSIX_DkgRequestIdP *uuid,
    562   uint8_t identifier,
    563   uint8_t threshold,
    564   uint8_t num_of_participants,
    565   const struct FROSIX_DkgContextStringP *context_string,
    566   const struct FROSIX_ChallengeHashP *challenge_hash,
    567   const struct FROSIX_DkgCommitment dkg_commitments[],
    568   size_t len,
    569   const struct GNUNET_CRYPTO_EddsaPublicKey providers_public_keys[],
    570   FROSIX_DkgShareRequestCallback cb,
    571   void *cb_cls);
    572 
    573 
    574 /**
    575  * Cancel a POST /dkg-share request
    576  *
    577  * @param dso the dkg-share request operation
    578 */
    579 void
    580 FROSIX_dkg_share_request_cancel (
    581   struct FROSIX_DkgShareRequestOperation *dso);
    582 
    583 
    584 /*** DKG-KEY API ***/
    585 
    586 /**
    587  * High level ways how an dkg-commitment request may conclude.
    588 */
    589 enum FROSIX_DkgKeyStatus
    590 {
    591   /**
    592    * Commitment was successfully computed and returned.
    593   */
    594   FROSIX_DKS_SUCCESS = 0,
    595 
    596   /**
    597    * HTTP interaction failed, see HTTP status.
    598   */
    599   FROSIX_DKS_HTTP_ERROR,
    600 
    601   /**
    602    * We had an HTTP 400 error, see details in response body.
    603   */
    604   FROSIX_DKS_CLIENT_ERROR,
    605 
    606   /**
    607    * Server had an internal error.
    608   */
    609   FROSIX_DKS_SERVER_ERROR
    610 };
    611 
    612 
    613 /**
    614  *
    615 */
    616 struct FROSIX_DkgKeyStoreDetails
    617 {
    618   /**
    619    * High level status of the upload operation. Determines @e details.
    620   */
    621   enum FROSIX_DkgKeyStatus dks;
    622 
    623   /**
    624    * HTTP status code.
    625    */
    626   unsigned int http_status;
    627 
    628   /**
    629    * Taler error code.
    630    */
    631   enum TALER_ErrorCode ec;
    632 
    633   /**
    634    * Identifier of the provider
    635   */
    636   uint8_t provider_index;
    637 
    638   /**
    639    * The returned data
    640   */
    641   struct
    642   {
    643     /**
    644      * Our final public key
    645     */
    646     struct FROST_PublicKey public_key;
    647 
    648     /**
    649      * A signature over the public key and the salted hashes of the challenge
    650     */
    651     struct GNUNET_CRYPTO_EddsaSignature signature;
    652   } details;
    653 };
    654 
    655 
    656 /**
    657  * A share for a request to /dkg-key
    658 */
    659 struct FROSIX_DkgKeyStoreShare
    660 {
    661   /**
    662    * Identifier of the issuer of the share
    663   */
    664   uint8_t identifier;
    665 
    666   /**
    667    * Encrypted secret share
    668   */
    669   struct FROSIX_EncryptedShareP secret_share;
    670 
    671   /**
    672    * Ephemeral public key to derive the encryption key
    673   */
    674   struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
    675 };
    676 
    677 
    678 /**
    679  * Handle for a POST /dkg-key operation
    680 */
    681 struct FROSIX_DkgKeyStoreOperation;
    682 
    683 
    684 /**
    685  * Callback to process a POST /dkg-key request
    686  *
    687  * @param cls closure
    688  * @param dkd the response body
    689 */
    690 typedef void
    691 (*FROSIX_DkgKeyStoreCallback) (
    692   void *cls,
    693   const struct FROSIX_DkgKeyStoreDetails *dks);
    694 
    695 
    696 /**
    697  * Ask to generate and store key material in a distributed key generation. Does a POST /dkg-key/$UUID
    698  *
    699  * @param ctx the CURL context used to connect to the backend
    700  * @param backend_url backend's base URL, including final "/"
    701  * @param uuid unique identification of the dkg-commitment request
    702  * @param identifier unique identifier of the provider in the group
    703  * @param threshold number of participants needed to create a valid signature
    704  * @param num_of_participants total number of participants in the group
    705  * @param context_string main source of entropy for the provider to create a commitment
    706  * @param challenge_hash salted hash of challenge method and data
    707  * @param providers_public_keys sorted list of public keys of all involved providers.
    708  * @param pre_encryption_key the master key to derive the encryption key, used for the data at the provider
    709  * @param expiration how many years the provider should store the key data
    710  * @param secret_shares array of secret shares
    711  * @param len length of @a dkg_commitments and @a provider_public_keys array
    712  * @param cb callback function of the request
    713  * @param cb_cls closure for the callback function
    714  * @return handle for the operation
    715 */
    716 struct FROSIX_DkgKeyStoreOperation *
    717 FROSIX_dkg_key_store (
    718   struct GNUNET_CURL_Context *ctx,
    719   const char *backend_url,
    720   const struct FROSIX_DkgRequestIdP *uuid,
    721   uint8_t identifier,
    722   uint8_t threshold,
    723   uint8_t num_of_participants,
    724   const struct FROSIX_DkgContextStringP *context_string,
    725   const struct FROSIX_ChallengeHashP *challenge_hash,
    726   const struct GNUNET_CRYPTO_EddsaPublicKey providers_public_keys[],
    727   const struct FROSIX_EncryptionKey *pre_encryption_key,
    728   unsigned int expiration,
    729   const struct FROSIX_DkgKeyStoreShare secret_shares[],
    730   size_t len,
    731   FROSIX_DkgKeyStoreCallback cb,
    732   void *cb_cls);
    733 
    734 
    735 /**
    736  * Cancel a POST /dkg-key request
    737  *
    738  * @param dso the dkg-key request operation
    739 */
    740 void
    741 FROSIX_dkg_key_store_cancel (
    742   struct FROSIX_DkgKeyStoreOperation *dko);
    743 
    744 
    745 /*** AUTH-CHALLENGE API ***/
    746 
    747 /**
    748  * High level ways how an sig-commitment request may conclude.
    749 */
    750 enum FROSIX_ChallengeRequestStatus
    751 {
    752   /**
    753    * Commitment was successfully computed and returned.
    754   */
    755   FROSIX_CRS_SUCCESS = 0,
    756 
    757   /**
    758    * HTTP interaction failed, see HTTP status.
    759   */
    760   FROSIX_CRS_HTTP_ERROR,
    761 
    762   /**
    763    * We had an HTTP 400 error, see details in response body.
    764   */
    765   FROSIX_CRS_CLIENT_ERROR,
    766 
    767   /**
    768    * Server had an internal error.
    769   */
    770   FROSIX_CRS_SERVER_ERROR
    771 };
    772 
    773 
    774 /**
    775  *
    776 */
    777 struct FROSIX_ChallengeRequestDetails
    778 {
    779   /**
    780    * High level status of the upload operation. Determines @e details.
    781   */
    782   enum FROSIX_ChallengeRequestStatus crs;
    783 
    784   /**
    785    * HTTP status code.
    786    */
    787   unsigned int http_status;
    788 
    789   /**
    790    * Taler error code.
    791    */
    792   enum TALER_ErrorCode ec;
    793 
    794   /**
    795    * Response as JSON
    796   */
    797   json_t *response;
    798 };
    799 
    800 
    801 /**
    802  * Handle for a POST /auth-challenge operation
    803 */
    804 struct FROSIX_ChallengeRequestOperation;
    805 
    806 
    807 /**
    808  * Callback to process a POST /auth-challenge request
    809  *
    810  * @param cls closure
    811  * @param acd the response body
    812 */
    813 typedef void
    814 (*FROSIX_ChallengeRequestCallback) (
    815   void *cls,
    816   const struct FROSIX_ChallengeRequestDetails *acd);
    817 
    818 
    819 /**
    820  * FIXME
    821 */
    822 struct FROSIX_ChallengeRequestOperation *
    823 FROSIX_auth_challenge_post (
    824   struct GNUNET_CURL_Context *ctx,
    825   const char *backend_url,
    826   const struct FROSIX_ChallengeRequestIdP *uuid,
    827   const struct FROSIX_EncryptionKey *encryption_key,
    828   const char *auth_method,
    829   const char *auth_data,
    830   const struct GNUNET_HashCode *auth_nonce,
    831   const struct FROST_MessageHash *message_hash,
    832   FROSIX_ChallengeRequestCallback cb,
    833   void *cb_cls);
    834 
    835 /**
    836  * Cancel a POST /auth-challenge request
    837  *
    838  * @param aco the auth-challenge request operation
    839 */
    840 void
    841 FROSIX_challenge_request_cancel (
    842   struct FROSIX_ChallengeRequestOperation *aco);
    843 
    844 
    845 /*** SIG-COMMITMENT API ***/
    846 
    847 /**
    848  * High level ways how an sig-commitment request may conclude.
    849 */
    850 enum FROSIX_SigCommitmentStatus
    851 {
    852   /**
    853    * Commitment was successfully computed and returned.
    854   */
    855   FROSIX_SCS_SUCCESS = 0,
    856 
    857   /**
    858    * HTTP interaction failed, see HTTP status.
    859   */
    860   FROSIX_SCS_HTTP_ERROR,
    861 
    862   /**
    863    * We had an HTTP 400 error, see details in response body.
    864   */
    865   FROSIX_SCS_CLIENT_ERROR,
    866 
    867   /**
    868    * Server had an internal error.
    869   */
    870   FROSIX_SCS_SERVER_ERROR
    871 };
    872 
    873 
    874 /**
    875  *
    876 */
    877 struct FROSIX_SigCommitmentRequestDetails
    878 {
    879   /**
    880    * High level status of the upload operation. Determines @e details.
    881   */
    882   enum FROSIX_SigCommitmentStatus scs;
    883 
    884   /**
    885    * HTTP status code.
    886    */
    887   unsigned int http_status;
    888 
    889   /**
    890    * Taler error code.
    891    */
    892   enum TALER_ErrorCode ec;
    893 
    894   /**
    895    * Position of our provider in the array of providers.
    896   */
    897   uint8_t array_index;
    898 
    899   /**
    900    * The returned data, a commitment for all other participants
    901   */
    902   struct FROST_Commitment sig_commitment;
    903 };
    904 
    905 
    906 /**
    907  * Handle for a POST /sig-commitment operation
    908 */
    909 struct FROSIX_SigCommitmentRequestOperation;
    910 
    911 
    912 /**
    913  * Callback to process a POST /sig-commitment request
    914  *
    915  * @param cls closure
    916  * @param scd the response body
    917 */
    918 typedef void
    919 (*FROSIX_SigCommitmentRequestCallback) (
    920   void *cls,
    921   const struct FROSIX_SigCommitmentRequestDetails *scd);
    922 
    923 
    924 /**
    925  * Ask for a commitment to sign a message. Does a POST /sig-commitment/$UUID
    926  *
    927  * @param ctx the CURL context used to connect to the backend
    928  * @param backend_url backend's base URL, including final "/"
    929  * @param uuid unique identification of the dkg-commitment request
    930  * @param identifier identifier of the provider
    931  * @param encryption_key key to decrypt the data stored at the provider
    932  * @param auth_method
    933  * @param auth_data
    934  * @param auth_nonce salt used to hash challenge data
    935  * @param message_hash our data we want to sign
    936  * @param cb callback function of the request
    937  * @param cb_cls closure for the callback function
    938  * @return handle for the operation
    939 */
    940 struct FROSIX_SigCommitmentRequestOperation *
    941 FROSIX_sig_commitment_request (
    942   struct GNUNET_CURL_Context *ctx,
    943   const char *backend_url,
    944   const struct FROSIX_SigRequestIdP *uuid,
    945   uint8_t identifier,
    946   uint8_t index_in_array,
    947   const struct FROST_HashCode *encryption_key_hash,
    948   const struct GNUNET_HashCode *auth_data,
    949   const struct GNUNET_CRYPTO_Edx25519PublicKey *auth_pub,
    950   const struct GNUNET_CRYPTO_Edx25519Signature *auth_sig,
    951   const char *auth_method,
    952   const struct FROST_MessageHash *message_hash,
    953   FROSIX_SigCommitmentRequestCallback cb,
    954   void *cb_cls);
    955 
    956 
    957 /**
    958  * Cancel a POST /sig-commitment request
    959  *
    960  * @param sco the sig-commitment request operation
    961 */
    962 void
    963 FROSIX_sig_commitment_request_cancel (
    964   struct FROSIX_SigCommitmentRequestOperation *sco);
    965 
    966 
    967 
    968 /*** SIG-SHARE API ***/
    969 
    970 /**
    971  * High level ways how an sig-share request may conclude.
    972 */
    973 enum FROSIX_SigShareStatus
    974 {
    975   /**
    976    * Signature share was successfully computed and returned.
    977   */
    978   FROSIX_SSS_SUCCESS = 0,
    979 
    980   /**
    981    * HTTP interaction failed, see HTTP status.
    982   */
    983   FROSIX_SSS_HTTP_ERROR,
    984 
    985   /**
    986    * We had an HTTP 400 error, see details in response body.
    987   */
    988   FROSIX_SSS_CLIENT_ERROR,
    989 
    990   /**
    991    * Server had an internal error.
    992   */
    993   FROSIX_SSS_SERVER_ERROR
    994 };
    995 
    996 
    997 /**
    998  *
    999 */
   1000 struct FROSIX_SigShareRequestDetails
   1001 {
   1002   /**
   1003    * High level status of the upload operation. Determines @e details.
   1004   */
   1005   enum FROSIX_SigShareStatus sss;
   1006 
   1007   /**
   1008    * HTTP status code.
   1009    */
   1010   unsigned int http_status;
   1011 
   1012   /**
   1013    * Taler error code.
   1014    */
   1015   enum TALER_ErrorCode ec;
   1016 
   1017   /**
   1018    * Position in the array.
   1019   */
   1020   uint8_t array_index;
   1021 
   1022   /**
   1023    * The returned data, a share of the final signature
   1024   */
   1025   struct FROST_SignatureShare sig_share;
   1026 };
   1027 
   1028 
   1029 /**
   1030  * Handle for a POST /sig-share operation
   1031 */
   1032 struct FROSIX_SigShareRequestOperation;
   1033 
   1034 
   1035 /**
   1036  * Callback to process a POST /sig-share request
   1037  *
   1038  * @param cls closure
   1039  * @param ssd the response body
   1040 */
   1041 typedef void
   1042 (*FROSIX_SigShareRequestCallback) (
   1043   void *cls,
   1044   const struct FROSIX_SigShareRequestDetails *ssd);
   1045 
   1046 
   1047 /**
   1048  * Ask for a share of a signature. Does a POST /sig-share/$UUID
   1049  *
   1050  * @param ctx the CURL context used to connect to the backend
   1051  * @param backend_url backend's base URL, including final "/"
   1052  * @param uuid unique identification of the dkg-commitment request
   1053  * @param identifier identifier of the provider
   1054  * @param encryption_key key to decrypt the data stored at the provider
   1055  * @param challenge_solution solution of the authentication challenge
   1056  * @param message_hash our data we want to sign
   1057  * @param commitments a sorted list of commitments of all participants
   1058  * @param len how many commitments do we have? (should be equal to the threshold value)
   1059  * @param cb callback function of the request
   1060  * @param cb_cls closure for the callback function
   1061  * @return handle for the operation
   1062 */
   1063 struct FROSIX_SigShareRequestOperation *
   1064 FROSIX_sig_share_request (
   1065   struct GNUNET_CURL_Context *ctx,
   1066   const char *backend_url,
   1067   const struct FROSIX_SigRequestIdP *uuid,
   1068   uint8_t provider_index,
   1069   uint8_t array_index,
   1070   const struct FROSIX_EncryptionKey *encryption_key,
   1071   const struct FROST_MessageHash *message_hash,
   1072   const struct FROST_Commitment commitments[],
   1073   size_t len,
   1074   FROSIX_SigShareRequestCallback cb,
   1075   void *cb_cls);
   1076 
   1077 
   1078 /**
   1079  * Cancel a POST /sig-share request
   1080  *
   1081  * @param sso the sig-share request operation
   1082 */
   1083 void
   1084 FROSIX_sig_share_request_cancel (
   1085   struct FROSIX_SigShareRequestOperation *sso);
   1086 
   1087 
   1088 /*** DELETE DKG-KEY API ***/
   1089 
   1090 /**
   1091  * High level ways how an dkg-key delete request may conclude.
   1092 */
   1093 enum FROSIX_KeyDeleteStatus
   1094 {
   1095   /**
   1096    * Commitment was successfully computed and returned.
   1097   */
   1098   FROSIX_KDS_SUCCESS = 0,
   1099 
   1100   /**
   1101    * HTTP interaction failed, see HTTP status.
   1102   */
   1103   FROSIX_KDS_HTTP_ERROR,
   1104 
   1105   /**
   1106    * We had an HTTP 400 error, see details in response body.
   1107   */
   1108   FROSIX_KDS_CLIENT_ERROR,
   1109 
   1110   /**
   1111    * Server had an internal error.
   1112   */
   1113   FROSIX_KDS_SERVER_ERROR
   1114 };
   1115 
   1116 
   1117 /**
   1118  *
   1119 */
   1120 struct FROSIX_KeyDeleteDetails
   1121 {
   1122   /**
   1123    * High level status of the upload operation. Determines @e details.
   1124   */
   1125   enum FROSIX_KeyDeleteStatus kds;
   1126 
   1127   /**
   1128    * HTTP status code.
   1129    */
   1130   unsigned int http_status;
   1131 
   1132   /**
   1133    * Taler error code.
   1134    */
   1135   enum TALER_ErrorCode ec;
   1136 };
   1137 
   1138 
   1139 /**
   1140  * Handle for a DELETE /dkg-key operation
   1141 */
   1142 struct FROSIX_KeyDeleteOperation;
   1143 
   1144 
   1145 /**
   1146  * Callback to process a DELETE /dkg-key request
   1147  *
   1148  * @param cls closure
   1149  * @param kdd the response body
   1150 */
   1151 typedef void
   1152 (*FROSIX_KeyDeleteCallback) (
   1153   void *cls,
   1154   const struct FROSIX_KeyDeleteDetails *kdd);
   1155 
   1156 
   1157 /**
   1158  * Ask to generate and store key material in a distributed key generation. Does a POST /dkg-key/$UUID
   1159  *
   1160  * @param ctx the CURL context used to connect to the backend
   1161  * @param backend_url backend's base URL, including final "/"
   1162  * @param uuid unique identification of the dkg-key request
   1163  * @param cb callback function of the request
   1164  * @param cb_cls closure for the callback function
   1165  * @return handle for the operation
   1166 */
   1167 struct FROSIX_KeyDeleteOperation *
   1168 FROSIX_key_delete (
   1169   struct GNUNET_CURL_Context *ctx,
   1170   const char *backend_url,
   1171   const struct FROSIX_DkgRequestIdP *uuid,
   1172   FROSIX_KeyDeleteCallback cb,
   1173   void *cb_cls);
   1174 
   1175 
   1176 /**
   1177  * Cancel a DELETE /dkg-key request
   1178  *
   1179  * @param kdo the dkg-key request operation
   1180 */
   1181 void
   1182 FROSIX_key_delete_cancel (
   1183   struct FROSIX_KeyDeleteOperation *kdo);
   1184 
   1185 
   1186 
   1187 #endif