diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/taler_bank_service.h | 6 | ||||
| -rw-r--r-- | src/include/taler_crypto_lib.h | 24 | ||||
| -rw-r--r-- | src/include/taler_exchange_service.h | 666 | ||||
| -rw-r--r-- | src/include/taler_exchangedb_plugin.h | 18 | ||||
| -rw-r--r-- | src/include/taler_json_lib.h | 27 | ||||
| -rw-r--r-- | src/include/taler_testing_lib.h | 8 | 
6 files changed, 630 insertions, 119 deletions
| diff --git a/src/include/taler_bank_service.h b/src/include/taler_bank_service.h index b5d4dcce..5ce5e254 100644 --- a/src/include/taler_bank_service.h +++ b/src/include/taler_bank_service.h @@ -111,6 +111,7 @@ struct TALER_BANK_AdminAddIncomingHandle;   * @param timestamp time when the transaction was made.   * @param json detailed response from the HTTPD, or NULL if reply was not in JSON   */ +// FIXME: bad API  typedef void  (*TALER_BANK_AdminAddIncomingCallback) (    void *cls, @@ -199,6 +200,7 @@ struct TALER_BANK_TransferHandle;   * @param row_id unique ID of the wire transfer in the bank's records   * @param timestamp when did the transaction go into effect   */ +// FIXME: bad API  typedef void  (*TALER_BANK_TransferCallback)(    void *cls, @@ -337,7 +339,7 @@ struct TALER_BANK_CreditHistoryResponse         */        unsigned int details_length; -    } success; +    } ok;    } details; @@ -493,7 +495,7 @@ struct TALER_BANK_DebitHistoryResponse         */        unsigned int details_length; -    } success; +    } ok;    } details; diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index 61d92483..16644076 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -5512,6 +5512,9 @@ TALER_exchange_offline_global_fee_verify (   * Create wire account addition signature.   *   * @param payto_uri bank account + * @param conversion_url URL of the conversion service, or NULL if none + * @param debit_restrictions JSON encoding of debit restrictions on the account; see AccountRestriction in the spec + * @param credit_restrictions JSON encoding of credit restrictions on the account; see AccountRestriction in the spec   * @param now timestamp to use for the signature (rounded)   * @param master_priv private key to sign with   * @param[out] master_sig where to write the signature @@ -5519,6 +5522,9 @@ TALER_exchange_offline_global_fee_verify (  void  TALER_exchange_offline_wire_add_sign (    const char *payto_uri, +  const char *conversion_url, +  const json_t *debit_restrictions, +  const json_t *credit_restrictions,    struct GNUNET_TIME_Timestamp now,    const struct TALER_MasterPrivateKeyP *master_priv,    struct TALER_MasterSignatureP *master_sig); @@ -5528,6 +5534,9 @@ TALER_exchange_offline_wire_add_sign (   * Verify wire account addition signature.   *   * @param payto_uri bank account + * @param conversion_url URL of the conversion service, or NULL if none + * @param debit_restrictions JSON encoding of debit restrictions on the account; see AccountRestriction in the spec + * @param credit_restrictions JSON encoding of credit restrictions on the account; see AccountRestriction in the spec   * @param sign_time timestamp when signature was created   * @param master_pub public key to verify against   * @param master_sig the signature the signature @@ -5536,6 +5545,9 @@ TALER_exchange_offline_wire_add_sign (  enum GNUNET_GenericReturnValue  TALER_exchange_offline_wire_add_verify (    const char *payto_uri, +  const char *conversion_url, +  const json_t *debit_restrictions, +  const json_t *credit_restrictions,    struct GNUNET_TIME_Timestamp sign_time,    const struct TALER_MasterPublicKeyP *master_pub,    const struct TALER_MasterSignatureP *master_sig); @@ -5578,6 +5590,9 @@ TALER_exchange_offline_wire_del_verify (   * Check the signature in @a master_sig.   *   * @param payto_uri URI that is signed + * @param conversion_url URL of the conversion service, or NULL if none + * @param debit_restrictions JSON encoding of debit restrictions on the account; see AccountRestriction in the spec + * @param credit_restrictions JSON encoding of credit restrictions on the account; see AccountRestriction in the spec   * @param master_pub master public key of the exchange   * @param master_sig signature of the exchange   * @return #GNUNET_OK if signature is valid @@ -5585,6 +5600,9 @@ TALER_exchange_offline_wire_del_verify (  enum GNUNET_GenericReturnValue  TALER_exchange_wire_signature_check (    const char *payto_uri, +  const char *conversion_url, +  const json_t *debit_restrictions, +  const json_t *credit_restrictions,    const struct TALER_MasterPublicKeyP *master_pub,    const struct TALER_MasterSignatureP *master_sig); @@ -5593,12 +5611,18 @@ TALER_exchange_wire_signature_check (   * Create a signed wire statement for the given account.   *   * @param payto_uri account specification + * @param conversion_url URL of the conversion service, or NULL if none + * @param debit_restrictions JSON encoding of debit restrictions on the account; see AccountRestriction in the spec + * @param credit_restrictions JSON encoding of credit restrictions on the account; see AccountRestriction in the spec   * @param master_priv private key to sign with   * @param[out] master_sig where to write the signature   */  void  TALER_exchange_wire_signature_make (    const char *payto_uri, +  const char *conversion_url, +  const json_t *debit_restrictions, +  const json_t *credit_restrictions,    const struct TALER_MasterPrivateKeyP *master_priv,    struct TALER_MasterSignatureP *master_sig); diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index 4099d6bb..f9330ec5 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -462,21 +462,52 @@ struct TALER_EXCHANGE_HttpResponse  /** + * Response from /keys. + */ +struct TALER_EXCHANGE_KeysResponse +{ +  /** +   * HTTP response data +   */ +  struct TALER_EXCHANGE_HttpResponse hr; + +  /** +   * Details depending on the HTTP status code. +   */ +  union +  { + +    /** +     * Details on #MHD_HTTP_OK. +     */ +    struct +    { +      /** +       * Information about the various keys used by the exchange. +       */ +      const struct TALER_EXCHANGE_Keys *keys; + +      /** +       * Protocol compatibility information +       */ +      enum TALER_EXCHANGE_VersionCompatibility compat; +    } ok; +  } details; + +}; + + +/**   * Function called with information about who is auditing   * a particular exchange and what keys the exchange is using.   *   * @param cls closure - * @param hr HTTP response data - * @param keys information about the various keys used - *        by the exchange, NULL if /keys failed - * @param compat protocol compatibility information + * @param kr response from /keys   */  typedef void  (*TALER_EXCHANGE_CertificationCallback) (    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr, -  const struct TALER_EXCHANGE_Keys *keys, -  enum TALER_EXCHANGE_VersionCompatibility compat); +  const struct TALER_EXCHANGE_KeysResponse *kr);  /** @@ -712,7 +743,7 @@ TALER_EXCHANGE_get_signing_key_info (  /** - * Sorted list of fees to be paid for aggregate wire transfers. + * List sorted by @a start_date with fees to be paid for aggregate wire transfers.   */  struct TALER_EXCHANGE_WireAggregateFees  { @@ -744,6 +775,95 @@ struct TALER_EXCHANGE_WireAggregateFees  /** + * Information about wire fees by wire method. + */ +struct TALER_EXCHANGE_WireFeesByMethod +{ +  /** +   * Wire method with the given @e fees. +   */ +  const char *method; + +  /** +   * Linked list of wire fees the exchange charges for +   * accounts of the wire @e method. +   */ +  struct TALER_EXCHANGE_WireAggregateFees *fees_head; + +}; + + +/** + * Type of an account restriction. + */ +enum TALER_EXCHANGE_AccountRestrictionType +{ +  /** +   * Invalid restriction. +   */ +  TALER_EXCHANGE_AR_INVALID = 0, + +  /** +   * Account must not be used for this operation. +   */ +  TALER_EXCHANGE_AR_DENY = 1, + +  /** +   * Other account must match given regular expression. +   */ +  TALER_EXCHANGE_AR_REGEX = 2 +}; + +/** + * Restrictions that apply to using a given exchange bank account. + */ +struct TALER_EXCHANGE_AccountRestriction +{ + +  /** +   * Type of the account restriction. +   */ +  enum TALER_EXCHANGE_AccountRestrictionType type; + +  /** +   * Restriction details depending on @e type. +   */ +  union +  { +    /** +     * Details if type is #TALER_EXCHANGE_AR_REGEX. +     */ +    struct +    { +      /** +       * Regular expression that the payto://-URI of the partner account must +       * follow.  The regular expression should follow posix-egrep, but +       * without support for character classes, GNU extensions, +       * back-references or intervals. See +       * https://www.gnu.org/software/findutils/manual/html_node/find_html/posix_002degrep-regular-expression-syntax.html +       * for a description of the posix-egrep syntax. Applications may support +       * regexes with additional features, but exchanges must not use such +       * regexes. +       */ +      const char *posix_egrep; + +      /** +       * Hint for a human to understand the restriction. +       */ +      const char *human_hint; + +      /** +       * Internationalizations for the @e human_hint.  Map from IETF BCP 47 +       * language tax to localized human hints. +       */ +      const json_t *human_hint_i18n; +    } regex; +  } details; + +}; + + +/**   * Information about a wire account of the exchange.   */  struct TALER_EXCHANGE_WireAccount @@ -754,37 +874,103 @@ struct TALER_EXCHANGE_WireAccount    const char *payto_uri;    /** +   * URL of a conversion service in case using this account is subject to +   * currency conversion.  NULL for no conversion needed. +   */ +  const char *conversion_url; + +  /** +   * Array of restrictions that apply when crediting +   * this account. +   */ +  struct TALER_EXCHANGE_AccountRestriction *credit_restrictions; + +  /** +   * Array of restrictions that apply when debiting +   * this account. +   */ +  struct TALER_EXCHANGE_AccountRestriction *debit_restrictions; + +  /** +   * Length of the @e credit_restrictions array. +   */ +  unsigned int credit_restrictions_length; + +  /** +   * Length of the @e debit_restrictions array. +   */ +  unsigned int debit_restrictions_length; + +  /**     * Signature of the exchange over the account (was checked by the API).     */    struct TALER_MasterSignatureP master_sig; +}; + + +/** + * Response to a /wire request. + */ +struct TALER_EXCHANGE_WireResponse +{    /** -   * Linked list of wire fees the exchange charges for -   * accounts of the wire method matching @e payto_uri. +   * HTTP response details.     */ -  const struct TALER_EXCHANGE_WireAggregateFees *fees; +  struct TALER_EXCHANGE_HttpResponse hr; + +  /** +   * Response details depending on status. +   */ +  union +  { + +    /** +     * Details for #MHD_HTTP_OK. +     */ +    struct +    { + +      /** +       * Array of accounts of the exchange. +       */ +      const struct TALER_EXCHANGE_WireAccount *accounts; +      /** +       * Array of wire fees by wire method. +       */ +      const struct TALER_EXCHANGE_WireFeesByMethod *fees; + +      /** +       * Length of @e accounts array. +       */ +      unsigned int accounts_len; + +      /** +       * Length of @e fees array. +       */ +      unsigned int fees_len; + +    } ok; + +  } details;  };  /** - * Callbacks of this type are used to serve the result of submitting a - * wire format inquiry request to a exchange. + * Callbacks of this type are used to serve the result of submitting a wire + * format inquiry request to a exchange.   *   * If the request fails to generate a valid response from the - * exchange, @a http_status will also be zero. + * exchange, the http_status will also be zero.   *   * @param cls closure - * @param hr HTTP response data - * @param accounts_len length of the @a accounts array - * @param accounts list of wire accounts of the exchange, NULL on error + * @param wr response data   */  typedef void  (*TALER_EXCHANGE_WireCallback) (    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr, -  unsigned int accounts_len, -  const struct TALER_EXCHANGE_WireAccount *accounts); +  const struct TALER_EXCHANGE_WireResponse *wr);  /** @@ -976,7 +1162,7 @@ struct TALER_EXCHANGE_DepositResult         */        const char *transaction_base_url; -    } success; +    } ok;      /**       * Information returned if the HTTP status is @@ -1110,7 +1296,7 @@ struct TALER_EXCHANGE_BatchDepositResult         */        unsigned int num_signatures; -    } success; +    } ok;      /**       * Information returned if the HTTP status is @@ -1202,23 +1388,51 @@ TALER_EXCHANGE_batch_deposit_cancel (   */  struct TALER_EXCHANGE_RefundHandle; +/** + * Response from the /refund API. + */ +struct TALER_EXCHANGE_RefundResponse +{ +  /** +   * HTTP response data +   */ +  struct TALER_EXCHANGE_HttpResponse hr; + +  /** +   * Response details depending on the HTTP status code. +   */ +  union +  { +    /** +     * Details on #MHD_HTTP_OK. +     */ +    struct +    { +      /** +       * Exchange key used to sign. +       */ +      struct TALER_ExchangePublicKeyP exchange_pub; + +      /** +       * The actual signature +       */ +      struct TALER_ExchangeSignatureP exchange_sig; +    } ok; +  } details; +}; +  /**   * Callbacks of this type are used to serve the result of submitting a   * refund request to an exchange.   *   * @param cls closure - * @param hr HTTP response data - * @param sign_key exchange key used to sign @a obj, or NULL - * @param signature the actual signature, or NULL on error + * @param rr refund response   */  typedef void  (*TALER_EXCHANGE_RefundCallback) (    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr, -  const struct TALER_ExchangePublicKeyP *sign_key, -  const struct TALER_ExchangeSignatureP *signature); - +  const struct TALER_EXCHANGE_RefundResponse *rr);  /**   * Submit a refund request to the exchange and get the exchange's response. @@ -1311,7 +1525,7 @@ struct TALER_EXCHANGE_CsRMeltResponse         * respective coin's withdraw operation.         */        const struct TALER_ExchangeWithdrawValues *alg_values; -    } success; +    } ok;      /**       * Details if the status is #MHD_HTTP_GONE. @@ -1423,7 +1637,7 @@ struct TALER_EXCHANGE_CsRWithdrawResponse         * respective coin's withdraw operation.         */        struct TALER_ExchangeWithdrawValues alg_values; -    } success; +    } ok;      /**       * Details if the status is #MHD_HTTP_GONE. @@ -2209,7 +2423,7 @@ struct TALER_EXCHANGE_WithdrawResponse      /**       * Details if the status is #MHD_HTTP_OK.       */ -    struct TALER_EXCHANGE_PrivateCoinDetails success; +    struct TALER_EXCHANGE_PrivateCoinDetails ok;      /**       * Details if the status is #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS. @@ -2336,7 +2550,7 @@ struct TALER_EXCHANGE_BatchWithdrawResponse         * Length of the @e coins array.         */        unsigned int num_coins; -    } success; +    } ok;      /**       * Details if the status is #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS. @@ -2431,18 +2645,45 @@ TALER_EXCHANGE_batch_withdraw_cancel (  /** + * Response from a withdraw2 request. + */ +struct TALER_EXCHANGE_Withdraw2Response +{ +  /** +   * HTTP response data +   */ +  struct TALER_EXCHANGE_HttpResponse hr; + +  /** +   * Response details depending on the HTTP status. +   */ +  union +  { +    /** +     * Details if HTTP status is #MHD_HTTP_OK. +     */ +    struct +    { +      /** +       * blind signature over the coin +       */ +      struct TALER_BlindedDenominationSignature blind_sig; +    } ok; +  } details; + +}; + +/**   * Callbacks of this type are used to serve the result of submitting a   * withdraw request to a exchange without the (un)blinding factor.   *   * @param cls closure - * @param hr HTTP response data - * @param blind_sig blind signature over the coin, NULL on error + * @param w2r response data   */  typedef void  (*TALER_EXCHANGE_Withdraw2Callback) (    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr, -  const struct TALER_BlindedDenominationSignature *blind_sig); +  const struct TALER_EXCHANGE_Withdraw2Response *w2r);  /** @@ -2493,20 +2734,52 @@ TALER_EXCHANGE_withdraw2_cancel (struct TALER_EXCHANGE_Withdraw2Handle *wh);  /** + * Response from a batch-withdraw request (2nd variant). + */ +struct TALER_EXCHANGE_BatchWithdraw2Response +{ +  /** +   * HTTP response data +   */ +  struct TALER_EXCHANGE_HttpResponse hr; + +  /** +   * Response details depending on the HTTP status. +   */ +  union +  { +    /** +     * Details if HTTP status is #MHD_HTTP_OK. +     */ +    struct +    { +      /** +       * array of blind signatures over the coins. +       */ +      const struct TALER_BlindedDenominationSignature *blind_sigs; + +      /** +       * length of @e blind_sigs +       */ +      unsigned int blind_sigs_length; + +    } ok; +  } details; + +}; + + +/**   * Callbacks of this type are used to serve the result of submitting a batch   * withdraw request to a exchange without the (un)blinding factor.   *   * @param cls closure - * @param hr HTTP response data - * @param blind_sigs array of blind signatures over the coins, NULL on error - * @param blind_sigs_length length of @a blind_sigs + * @param bw2r response data   */  typedef void  (*TALER_EXCHANGE_BatchWithdraw2Callback) (    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr, -  const struct TALER_BlindedDenominationSignature *blind_sigs, -  unsigned int blind_sigs_length); +  const struct TALER_EXCHANGE_BatchWithdraw2Response *bw2r);  /** @@ -2675,7 +2948,7 @@ struct TALER_EXCHANGE_MeltResponse         * Gamma value chosen by the exchange.         */        uint32_t noreveal_index; -    } success; +    } ok;    } details;  }; @@ -2801,7 +3074,7 @@ struct TALER_EXCHANGE_RevealResult         * Number of coins returned.         */        unsigned int num_coins; -    } success; +    } ok;    } details; @@ -2947,7 +3220,7 @@ struct TALER_EXCHANGE_LinkResult         * Number of coins returned.         */        unsigned int num_coins; -    } success; +    } ok;    } details; @@ -3060,18 +3333,43 @@ struct TALER_EXCHANGE_TransferData  /** + * Response for a GET /transfers request. + */ +struct TALER_EXCHANGE_TransfersGetResponse +{ +  /** +   * HTTP response. +   */ +  struct TALER_EXCHANGE_HttpResponse hr; + +  /** +   * Details depending on HTTP status code. +   */ +  union +  { +    /** +     * Details if status code is #MHD_HTTP_OK. +     */ +    struct +    { +      struct TALER_EXCHANGE_TransferData td; +    } ok; + +  } details; +}; + + +/**   * Function called with detailed wire transfer data, including all   * of the coin transactions that were combined into the wire transfer.   *   * @param cls closure - * @param hr HTTP response data - * @param ta transfer data, (set only if @a http_status is #MHD_HTTP_OK, otherwise NULL) + * @param tgr response data   */  typedef void  (*TALER_EXCHANGE_TransfersGetCallback)(    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr, -  const struct TALER_EXCHANGE_TransferData *ta); +  const struct TALER_EXCHANGE_TransfersGetResponse *tgr);  /** @@ -3163,7 +3461,7 @@ struct TALER_EXCHANGE_GetDepositResponse         */        struct TALER_Amount coin_contribution; -    } success; +    } ok;      /**       * Response if the status was #MHD_HTTP_ACCEPTED @@ -3316,20 +3614,49 @@ struct TALER_EXCHANGE_RecoupHandle;  /** + * Response from a recoup request. + */ +struct TALER_EXCHANGE_RecoupResponse +{ +  /** +   * HTTP response data +   */ +  struct TALER_EXCHANGE_HttpResponse hr; + +  /** +   * Response details depending on the HTTP status. +   */ +  union +  { +    /** +     * Details if HTTP status is #MHD_HTTP_OK. +     */ +    struct +    { +      /** +       * public key of the reserve receiving the recoup +       */ +      struct TALER_ReservePublicKeyP reserve_pub; + +    } ok; +  } details; + +}; + + +/**   * Callbacks of this type are used to return the final result of   * submitting a recoup request to a exchange.  If the operation was   * successful, this function returns the @a reserve_pub of the   * reserve that was credited.   *   * @param cls closure - * @param hr HTTP response data - * @param reserve_pub public key of the reserve receiving the recoup + * @param rr response data   */  typedef void  (*TALER_EXCHANGE_RecoupResultCallback) (    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr, -  const struct TALER_ReservePublicKeyP *reserve_pub); +  const struct TALER_EXCHANGE_RecoupResponse *rr);  /** @@ -3378,18 +3705,47 @@ struct TALER_EXCHANGE_RecoupRefreshHandle;  /** + * Response from a /recoup-refresh request. + */ +struct TALER_EXCHANGE_RecoupRefreshResponse +{ +  /** +   * HTTP response data +   */ +  struct TALER_EXCHANGE_HttpResponse hr; + +  /** +   * Response details depending on the HTTP status. +   */ +  union +  { +    /** +     * Details if HTTP status is #MHD_HTTP_OK. +     */ +    struct +    { +      /** +       * public key of the dirty coin that was credited +       */ +      struct TALER_CoinSpendPublicKeyP old_coin_pub; + +    } ok; +  } details; + +}; + + +/**   * Callbacks of this type are used to return the final result of   * submitting a recoup-refresh request to a exchange.   *   * @param cls closure - * @param hr HTTP response data - * @param old_coin_pub public key of the dirty coin that was credited + * @param rrr response data   */  typedef void  (*TALER_EXCHANGE_RecoupRefreshResultCallback) (    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr, -  const struct TALER_CoinSpendPublicKeyP *old_coin_pub); +  const struct TALER_EXCHANGE_RecoupRefreshResponse *rrr);  /** @@ -3495,7 +3851,7 @@ struct TALER_EXCHANGE_KycStatus         */        enum TALER_AmlDecisionState aml_status; -    } success; +    } ok;      /**       * KYC is required. @@ -3899,18 +4255,47 @@ struct TALER_EXCHANGE_FutureKeys  /** + * Response from a /management/keys request. + */ +struct TALER_EXCHANGE_ManagementGetKeysResponse +{ +  /** +   * HTTP response data +   */ +  struct TALER_EXCHANGE_HttpResponse hr; + +  /** +   * Response details depending on the HTTP status. +   */ +  union +  { +    /** +     * Details if HTTP status is #MHD_HTTP_OK. +     */ +    struct +    { +      /** +       * information about the various keys used +       * by the exchange +       */ +      struct TALER_EXCHANGE_FutureKeys keys; + +    } ok; +  } details; + +}; + + +/**   * Function called with information about future keys.   *   * @param cls closure - * @param hr HTTP response data - * @param keys information about the various keys used - *        by the exchange, NULL if /management/keys failed + * @param mgr HTTP response data   */  typedef void  (*TALER_EXCHANGE_ManagementGetKeysCallback) (    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr, -  const struct TALER_EXCHANGE_FutureKeys *keys); +  const struct TALER_EXCHANGE_ManagementGetKeysResponse *mgr);  /** @@ -4013,15 +4398,28 @@ struct TALER_EXCHANGE_ManagementPostKeysData  /** + * Response from a POST /management/keys request. + */ +struct TALER_EXCHANGE_ManagementPostKeysResponse +{ +  /** +   * HTTP response data +   */ +  struct TALER_EXCHANGE_HttpResponse hr; + +}; + + +/**   * Function called with information about the post keys operation result.   *   * @param cls closure - * @param hr HTTP response data + * @param mr response data   */  typedef void  (*TALER_EXCHANGE_ManagementPostKeysCallback) (    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr); +  const struct TALER_EXCHANGE_ManagementPostKeysResponse *mr);  /** @@ -4071,6 +4469,20 @@ struct TALER_EXCHANGE_ManagementPostExtensionsData    struct TALER_MasterSignatureP extensions_sig;  }; + +/** + * Response from a POST /management/extensions request. + */ +struct TALER_EXCHANGE_ManagementPostExtensionsResponse +{ +  /** +   * HTTP response data +   */ +  struct TALER_EXCHANGE_HttpResponse hr; + +}; + +  /**   * Function called with information about the post extensions operation result.   * @@ -4080,7 +4492,7 @@ struct TALER_EXCHANGE_ManagementPostExtensionsData  typedef void  (*TALER_EXCHANGE_ManagementPostExtensionsCallback) (    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr); +  const struct TALER_EXCHANGE_ManagementPostExtensionsResponse *hr);  /**   * @brief Handle for a POST /management/extensions request. @@ -4119,6 +4531,19 @@ TALER_EXCHANGE_management_post_extensions_cancel (  /** + * Response from a POST /management/drain request. + */ +struct TALER_EXCHANGE_ManagementDrainResponse +{ +  /** +   * HTTP response data +   */ +  struct TALER_EXCHANGE_HttpResponse hr; + +}; + + +/**   * Function called with information about the drain profits result.   *   * @param cls closure @@ -4127,7 +4552,7 @@ TALER_EXCHANGE_management_post_extensions_cancel (  typedef void  (*TALER_EXCHANGE_ManagementDrainProfitsCallback) (    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr); +  const struct TALER_EXCHANGE_ManagementDrainResponse *hr);  /** @@ -4176,6 +4601,19 @@ TALER_EXCHANGE_management_drain_profits_cancel (  /** + * Response from a POST /management/denominations/$DENOM/revoke request. + */ +struct TALER_EXCHANGE_ManagementRevokeDenominationResponse +{ +  /** +   * HTTP response data +   */ +  struct TALER_EXCHANGE_HttpResponse hr; + +}; + + +/**   * Function called with information about the post revocation operation result.   *   * @param cls closure @@ -4184,7 +4622,7 @@ TALER_EXCHANGE_management_drain_profits_cancel (  typedef void  (*TALER_EXCHANGE_ManagementRevokeDenominationKeyCallback) (    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr); +  const struct TALER_EXCHANGE_ManagementRevokeDenominationResponse *hr);  /** @@ -4225,6 +4663,18 @@ TALER_EXCHANGE_management_revoke_denomination_key_cancel (  /** + * Response from a POST /management/signkeys/$SK/revoke request. + */ +struct TALER_EXCHANGE_ManagementRevokeSigningKeyResponse +{ +  /** +   * HTTP response data +   */ +  struct TALER_EXCHANGE_HttpResponse hr; + +}; + +/**   * Function called with information about the post revocation operation result.   *   * @param cls closure @@ -4233,7 +4683,7 @@ TALER_EXCHANGE_management_revoke_denomination_key_cancel (  typedef void  (*TALER_EXCHANGE_ManagementRevokeSigningKeyCallback) (    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr); +  const struct TALER_EXCHANGE_ManagementRevokeSigningKeyResponse *hr);  /** @@ -4274,6 +4724,18 @@ TALER_EXCHANGE_management_revoke_signing_key_cancel (  /** + * Response from a POST /management/aml-officers request. + */ +struct TALER_EXCHANGE_ManagementUpdateAmlOfficerResponse +{ +  /** +   * HTTP response data +   */ +  struct TALER_EXCHANGE_HttpResponse hr; + +}; + +/**   * Function called with information about the change to   * an AML officer status.   * @@ -4283,7 +4745,7 @@ TALER_EXCHANGE_management_revoke_signing_key_cancel (  typedef void  (*TALER_EXCHANGE_ManagementUpdateAmlOfficerCallback) (    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr); +  const struct TALER_EXCHANGE_ManagementUpdateAmlOfficerResponse *hr);  /** @@ -4390,7 +4852,7 @@ struct TALER_EXCHANGE_AmlDecisionsResponse         */        unsigned int decisions_length; -    } success; +    } ok;    } details;  }; @@ -4547,7 +5009,7 @@ struct TALER_EXCHANGE_AmlDecisionResponse         */        unsigned int kyc_attributes_length; -    } success; +    } ok;    } details;  }; @@ -4617,6 +5079,7 @@ struct TALER_EXCHANGE_AddAmlDecision;   * @param cls closure   * @param hr HTTP response data   */ +// FIXME: bad API  typedef void  (*TALER_EXCHANGE_AddAmlDecisionCallback) (    void *cls, @@ -4672,6 +5135,7 @@ TALER_EXCHANGE_add_aml_decision_cancel (   * @param cls closure   * @param hr HTTP response data   */ +// FIXME: bad API  typedef void  (*TALER_EXCHANGE_ManagementAddPartnerCallback) (    void *cls, @@ -4732,6 +5196,7 @@ TALER_EXCHANGE_management_add_partner_cancel (   * @param cls closure   * @param hr HTTP response data   */ +// FIXME: bad API  typedef void  (*TALER_EXCHANGE_ManagementAuditorEnableCallback) (    void *cls, @@ -4787,6 +5252,7 @@ TALER_EXCHANGE_management_enable_auditor_cancel (   * @param cls closure   * @param hr HTTP response data   */ +// FIXME: bad API  typedef void  (*TALER_EXCHANGE_ManagementAuditorDisableCallback) (    void *cls, @@ -4833,15 +5299,27 @@ TALER_EXCHANGE_management_disable_auditor_cancel (  /** + * Response from an exchange account/enable operation. + */ +struct TALER_EXCHANGE_ManagementWireEnableResponse +{ +  /** +   * HTTP response data. +   */ +  struct TALER_EXCHANGE_HttpResponse hr; +}; + + +/**   * Function called with information about the wire enable operation result.   *   * @param cls closure - * @param hr HTTP response data + * @param wer HTTP response data   */  typedef void  (*TALER_EXCHANGE_ManagementWireEnableCallback) (    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr); +  const struct TALER_EXCHANGE_ManagementWireEnableResponse *wer);  /** @@ -4856,6 +5334,9 @@ struct TALER_EXCHANGE_ManagementWireEnableHandle;   * @param ctx the context   * @param url HTTP base URL for the exchange   * @param payto_uri RFC 8905 URI of the exchange's bank account + * @param conversion_url URL of the conversion service, or NULL if none + * @param debit_restrictions JSON encoding of debit restrictions on the account; see AccountRestriction in the spec + * @param credit_restrictions JSON encoding of credit restrictions on the account; see AccountRestriction in the spec   * @param validity_start when was this decided?   * @param master_sig1 signature affirming the wire addition   *        of purpose #TALER_SIGNATURE_MASTER_ADD_WIRE @@ -4870,6 +5351,9 @@ TALER_EXCHANGE_management_enable_wire (    struct GNUNET_CURL_Context *ctx,    const char *url,    const char *payto_uri, +  const char *conversion_url, +  const json_t *debit_restrictions, +  const json_t *credit_restrictions,    struct GNUNET_TIME_Timestamp validity_start,    const struct TALER_MasterSignatureP *master_sig1,    const struct TALER_MasterSignatureP *master_sig2, @@ -4888,15 +5372,26 @@ TALER_EXCHANGE_management_enable_wire_cancel (  /** + * Response from an exchange account/disable operation. + */ +struct TALER_EXCHANGE_ManagementWireDisableResponse +{ +  /** +   * HTTP response data. +   */ +  struct TALER_EXCHANGE_HttpResponse hr; +}; + +/**   * Function called with information about the wire disable operation result.   *   * @param cls closure - * @param hr HTTP response data + * @param wdr response data   */  typedef void  (*TALER_EXCHANGE_ManagementWireDisableCallback) (    void *cls, -  const struct TALER_EXCHANGE_HttpResponse *hr); +  const struct TALER_EXCHANGE_ManagementWireDisableResponse *wdr);  /** @@ -4945,6 +5440,7 @@ TALER_EXCHANGE_management_disable_wire_cancel (   * @param cls closure   * @param hr HTTP response data   */ +// FIXME: bad API  typedef void  (*TALER_EXCHANGE_ManagementSetWireFeeCallback) (    void *cls, @@ -5001,6 +5497,7 @@ TALER_EXCHANGE_management_set_wire_fees_cancel (   * @param cls closure   * @param hr HTTP response data   */ +// FIXME: bad API  typedef void  (*TALER_EXCHANGE_ManagementSetGlobalFeeCallback) (    void *cls, @@ -5062,6 +5559,7 @@ TALER_EXCHANGE_management_set_global_fees_cancel (   * @param cls closure   * @param hr HTTP response data   */ +// FIXME: bad API  typedef void  (*TALER_EXCHANGE_AuditorAddDenominationCallback) (    void *cls, @@ -5147,7 +5645,7 @@ struct TALER_EXCHANGE_ContractGetResponse         */        size_t econtract_size; -    } success; +    } ok;    } details; @@ -5243,7 +5741,7 @@ struct TALER_EXCHANGE_PurseGetResponse         */        struct GNUNET_TIME_Timestamp purse_expiration; -    } success; +    } ok;    } details; @@ -5333,7 +5831,7 @@ struct TALER_EXCHANGE_PurseCreateDepositResponse        struct TALER_ExchangeSignatureP exchange_sig; -    } success; +    } ok;    } details; @@ -5532,7 +6030,7 @@ struct TALER_EXCHANGE_AccountMergeResponse         */        struct GNUNET_TIME_Timestamp etime; -    } success; +    } ok;      /**       * Details if the status is #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS. @@ -5640,7 +6138,7 @@ struct TALER_EXCHANGE_PurseCreateMergeResponse      struct      { -    } success; +    } ok;      /**     * Details if the status is #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS. @@ -5760,7 +6258,7 @@ struct TALER_EXCHANGE_PurseDepositResponse         */        struct TALER_PrivateContractHashP h_contract_terms; -    } success; +    } ok;    } details;  }; diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index 7c175764..d025b532 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -2881,6 +2881,9 @@ typedef enum GNUNET_GenericReturnValue   *   * @param cls closure   * @param payto_uri the exchange bank account URI + * @param conversion_url URL of a conversion service, NULL if there is no conversion + * @param debit_restrictions JSON array with debit restrictions on the account + * @param credit_restrictions JSON array with credit restrictions on the account   * @param master_sig master key signature affirming that this is a bank   *                   account of the exchange (of purpose #TALER_SIGNATURE_MASTER_WIRE_DETAILS)   */ @@ -2888,6 +2891,9 @@ typedef void  (*TALER_EXCHANGEDB_WireAccountCallback)(    void *cls,    const char *payto_uri, +  const char *conversion_url, +  const json_t *debit_restrictions, +  const json_t *credit_restrictions,    const struct TALER_MasterSignatureP *master_sig); @@ -5544,6 +5550,9 @@ struct TALER_EXCHANGEDB_Plugin     *     * @param cls closure     * @param payto_uri wire account of the exchange +   * @param conversion_url URL of a conversion service, NULL if there is no conversion +   * @param debit_restrictions JSON array with debit restrictions on the account +   * @param credit_restrictions JSON array with credit restrictions on the account     * @param start_date date when the account was added by the offline system     *                      (only to be used for replay detection)     * @param master_sig public signature affirming the existence of the account, @@ -5553,6 +5562,9 @@ struct TALER_EXCHANGEDB_Plugin    enum GNUNET_DB_QueryStatus    (*insert_wire)(void *cls,                   const char *payto_uri, +                 const char *conversion_url, +                 json_t *debit_restrictions, +                 json_t *credit_restrictions,                   struct GNUNET_TIME_Timestamp start_date,                   const struct TALER_MasterSignatureP *master_sig); @@ -5562,6 +5574,9 @@ struct TALER_EXCHANGEDB_Plugin     *     * @param cls closure     * @param payto_uri account the update is about +   * @param conversion_url URL of a conversion service, NULL if there is no conversion +   * @param debit_restrictions JSON array with debit restrictions on the account; NULL allowed if not @a enabled +   * @param credit_restrictions JSON array with credit restrictions on the account; NULL allowed if not @a enabled     * @param change_date date when the account status was last changed     *                      (only to be used for replay detection)     * @param enabled true to enable, false to disable (the actual change) @@ -5570,6 +5585,9 @@ struct TALER_EXCHANGEDB_Plugin    enum GNUNET_DB_QueryStatus    (*update_wire)(void *cls,                   const char *payto_uri, +                 const char *conversion_url, +                 json_t *debit_restrictions, +                 json_t *credit_restrictions,                   struct GNUNET_TIME_Timestamp change_date,                   bool enabled); diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h index 7f17df03..d0749808 100644 --- a/src/include/taler_json_lib.h +++ b/src/include/taler_json_lib.h @@ -675,33 +675,6 @@ TALER_JSON_merchant_wire_signature_hash (const json_t *wire_s,  /** - * Check the signature in @a wire_s.  Also performs rudimentary - * checks on the account data *if* supported. - * - * @param wire_s signed wire information of an exchange - * @param master_pub master public key of the exchange - * @return #GNUNET_OK if signature is valid - */ -enum GNUNET_GenericReturnValue -TALER_JSON_exchange_wire_signature_check ( -  const json_t *wire_s, -  const struct TALER_MasterPublicKeyP *master_pub); - - -/** - * Create a signed wire statement for the given account. - * - * @param payto_uri account specification - * @param master_priv private key to sign with - * @return NULL if @a payto_uri is malformed - */ -json_t * -TALER_JSON_exchange_wire_signature_make ( -  const char *payto_uri, -  const struct TALER_MasterPrivateKeyP *master_priv); - - -/**   * Extract a string from @a object under the field @a field, but respecting   * the Taler i18n rules and the language preferences expressed in @a   * language_pattern. diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index 5fc930a8..664db6cc 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -147,15 +147,11 @@ TALER_TESTING_prepare_exchange (const char *config_filename,   *   * @param cls closure, typically, the "run" method containing   *        all the commands to be run, and a closure for it. - * @param hr http response details - * @param keys the exchange's keys. - * @param compat protocol compatibility information. + * @param kr response details   */  void  TALER_TESTING_cert_cb (void *cls, -                       const struct TALER_EXCHANGE_HttpResponse *hr, -                       const struct TALER_EXCHANGE_Keys *keys, -                       enum TALER_EXCHANGE_VersionCompatibility compat); +                       const struct TALER_EXCHANGE_KeysResponse *kr);  /** | 
