From dd14e67c70cd7b5b6891295759cb08aa2f94f180 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 5 Oct 2022 12:52:49 +0200 Subject: wallet-core: improve crypto worker code duplication Also add new testCrypto call for later testing --- packages/taler-util/src/taler-error-codes.ts | 64 +++++++++++++++++++++------- 1 file changed, 48 insertions(+), 16 deletions(-) (limited to 'packages/taler-util/src') diff --git a/packages/taler-util/src/taler-error-codes.ts b/packages/taler-util/src/taler-error-codes.ts index a66ae8dbe..ee6a7a166 100644 --- a/packages/taler-util/src/taler-error-codes.ts +++ b/packages/taler-util/src/taler-error-codes.ts @@ -152,6 +152,14 @@ export enum TalerErrorCode { GENERIC_PARAMETER_MALFORMED = 26, + /** + * The reserve public key given as part of a /reserves/ endpoint was malformed. + * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). + * (A value of 0 indicates that the error is generated client-side). + */ + GENERIC_RESERVE_PUB_MALFORMED = 27, + + /** * The currencies involved in the operation do not match. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -456,14 +464,6 @@ export enum TalerErrorCode { EXCHANGE_GENERIC_NEW_DENOMS_ARRAY_SIZE_EXCESSIVE = 1018, - /** - * The reserve public key was malformed. - * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). - * (A value of 0 indicates that the error is generated client-side). - */ - EXCHANGE_GENERIC_RESERVE_PUB_MALFORMED = 1019, - - /** * The time at the server is too far off from the time specified in the request. Most likely the client system time is wrong. * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). @@ -1288,6 +1288,38 @@ export enum TalerErrorCode { EXCHANGE_RESERVES_RESERVE_MERGE_SIGNATURE_INVALID = 1778, + /** + * The signature by the reserve affirming the open operation is invalid. + * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_RESERVES_OPEN_BAD_SIGNATURE = 1785, + + + /** + * The signature by the reserve affirming the close operation is invalid. + * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_RESERVES_CLOSE_BAD_SIGNATURE = 1786, + + + /** + * The signature by the reserve affirming the attestion request is invalid. + * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_RESERVES_ATTEST_BAD_SIGNATURE = 1787, + + + /** + * The exchange does not know an origin account to which the remaining reserve balance could be wired to, and the wallet failed to provide one. + * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409). + * (A value of 0 indicates that the error is generated client-side). + */ + EXCHANGE_RESERVES_CLOSE_NO_TARGET_ACCOUNT = 1788, + + /** * The auditor that was supposed to be disabled is unknown to this exchange. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -1768,14 +1800,6 @@ export enum TalerErrorCode { MERCHANT_GENERIC_HOLE_IN_WIRE_FEE_STRUCTURE = 2001, - /** - * The reserve key of given to a /reserves/ handler was malformed. - * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400). - * (A value of 0 indicates that the error is generated client-side). - */ - MERCHANT_GENERIC_RESERVE_PUB_MALFORMED = 2002, - - /** * The proposal is not known to the backend. * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404). @@ -3064,6 +3088,14 @@ export enum TalerErrorCode { WALLET_CRYPTO_WORKER_ERROR = 7023, + /** + * The crypto worker received a bad request. + * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0). + * (A value of 0 indicates that the error is generated client-side). + */ + WALLET_CRYPTO_WORKER_BAD_REQUEST = 7024, + + /** * We encountered a timeout with our payment backend. * Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504). -- cgit v1.2.3