diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-07-22 14:22:03 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-07-22 14:22:03 +0530 |
commit | e60563fb540c04d9ba751fea69c1fc0f1de598b5 (patch) | |
tree | 45f7c86b66dc150d413f9855efaa6341e4a44624 /src/types/talerTypes.ts | |
parent | f4a8702b3cf93f9edf96d1d1c8cb88baa309e301 (diff) | |
download | wallet-core-e60563fb540c04d9ba751fea69c1fc0f1de598b5.tar.xz |
consistent error handling for HTTP request (and some other things)
Diffstat (limited to 'src/types/talerTypes.ts')
-rw-r--r-- | src/types/talerTypes.ts | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/src/types/talerTypes.ts b/src/types/talerTypes.ts index 232f5f314..ef14684f9 100644 --- a/src/types/talerTypes.ts +++ b/src/types/talerTypes.ts @@ -433,7 +433,6 @@ export class ContractTerms { extra: any; } - /** * Refund permission in the format that the merchant gives it to us. */ @@ -788,6 +787,53 @@ export interface MerchantPayResponse { sig: string; } +export interface ExchangeMeltResponse { + /** + * Which of the kappa indices does the client not have to reveal. + */ + noreveal_index: number; + + /** + * Signature of TALER_RefreshMeltConfirmationPS whereby the exchange + * affirms the successful melt and confirming the noreveal_index + */ + exchange_sig: EddsaSignatureString; + + /* + * public EdDSA key of the exchange that was used to generate the signature. + * Should match one of the exchange's signing keys from /keys. Again given + * explicitly as the client might otherwise be confused by clock skew as to + * which signing key was used. + */ + exchange_pub: EddsaPublicKeyString; + + /* + * Base URL to use for operations on the refresh context + * (so the reveal operation). If not given, + * the base URL is the same as the one used for this request. + * Can be used if the base URL for /refreshes/ differs from that + * for /coins/, i.e. for load balancing. Clients SHOULD + * respect the refresh_base_url if provided. Any HTTP server + * belonging to an exchange MUST generate a 307 or 308 redirection + * to the correct base URL should a client uses the wrong base + * URL, or if the base URL has changed since the melt. + * + * When melting the same coin twice (technically allowed + * as the response might have been lost on the network), + * the exchange may return different values for the refresh_base_url. + */ + refresh_base_url?: string; +} + +export interface ExchangeRevealItem { + ev_sig: string; +} + +export interface ExchangeRevealResponse { + // List of the exchange's blinded RSA signatures on the new coins. + ev_sigs: ExchangeRevealItem[]; +} + export type AmountString = string; export type Base32String = string; export type EddsaSignatureString = string; @@ -1028,3 +1074,23 @@ export const codecForMerchantPayResponse = (): Codec<MerchantPayResponse> => makeCodecForObject<MerchantPayResponse>() .property("sig", codecForString) .build("MerchantPayResponse"); + +export const codecForExchangeMeltResponse = (): Codec<ExchangeMeltResponse> => + makeCodecForObject<ExchangeMeltResponse>() + .property("exchange_pub", codecForString) + .property("exchange_sig", codecForString) + .property("noreveal_index", codecForNumber) + .property("refresh_base_url", makeCodecOptional(codecForString)) + .build("ExchangeMeltResponse"); + +export const codecForExchangeRevealItem = (): Codec<ExchangeRevealItem> => + makeCodecForObject<ExchangeRevealItem>() + .property("ev_sig", codecForString) + .build("ExchangeRevealItem"); + +export const codecForExchangeRevealResponse = (): Codec< + ExchangeRevealResponse +> => + makeCodecForObject<ExchangeRevealResponse>() + .property("ev_sigs", makeCodecForList(codecForExchangeRevealItem())) + .build("ExchangeRevealResponse"); |