aboutsummaryrefslogtreecommitdiff
path: root/packages/anastasis-core/src/challenge-feedback-types.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-04-13 21:40:56 +0200
committerFlorian Dold <florian@dold.me>2022-04-13 23:46:34 +0200
commit4e1fe5eb10a5db44c86becbcef66daacc408239d (patch)
tree66c619c46a2228dc00ed78b200db6d1be395125b /packages/anastasis-core/src/challenge-feedback-types.ts
parentbd76b5d76f0e03d2d511b6cc0aae4636a2ec52c9 (diff)
downloadwallet-core-4e1fe5eb10a5db44c86becbcef66daacc408239d.tar.xz
anastasis-webui: updated challenge feedback
Diffstat (limited to 'packages/anastasis-core/src/challenge-feedback-types.ts')
-rw-r--r--packages/anastasis-core/src/challenge-feedback-types.ts109
1 files changed, 50 insertions, 59 deletions
diff --git a/packages/anastasis-core/src/challenge-feedback-types.ts b/packages/anastasis-core/src/challenge-feedback-types.ts
index 0770d9296..30f42288f 100644
--- a/packages/anastasis-core/src/challenge-feedback-types.ts
+++ b/packages/anastasis-core/src/challenge-feedback-types.ts
@@ -1,29 +1,48 @@
+/*
+ This file is part of GNU Anastasis
+ (C) 2021-2022 Anastasis SARL
+
+ GNU Anastasis is free software; you can redistribute it and/or modify it under the
+ terms of the GNU Affero General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with
+ GNU Anastasis; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+
+/**
+ * Imports.
+ */
import { AmountString, HttpStatusCode } from "@gnu-taler/taler-util";
export enum ChallengeFeedbackStatus {
Solved = "solved",
+ CodeInFile = "code-in-file",
+ CodeSent = "code-sent",
ServerFailure = "server-failure",
TruthUnknown = "truth-unknown",
- Redirect = "redirect",
- Payment = "payment",
- Pending = "pending",
- Message = "message",
+ TalerPayment = "taler-payment",
Unsupported = "unsupported",
RateLimitExceeded = "rate-limit-exceeded",
AuthIban = "auth-iban",
+ IncorrectAnswer = "incorrect-answer",
}
export type ChallengeFeedback =
| ChallengeFeedbackSolved
- | ChallengeFeedbackPending
- | ChallengeFeedbackPayment
+ | ChallengeFeedbackCodeInFile
+ | ChallengeFeedbackCodeSent
+ | ChallengeFeedbackIncorrectAnswer
+ | ChallengeFeedbackTalerPaymentRequired
| ChallengeFeedbackServerFailure
| ChallengeFeedbackRateLimitExceeded
| ChallengeFeedbackTruthUnknown
- | ChallengeFeedbackRedirect
- | ChallengeFeedbackMessage
| ChallengeFeedbackUnsupported
- | ChallengeFeedbackAuthIban;
+ | ChallengeFeedbackBankTransferRequired;
/**
* Challenge has been solved and the key share has
@@ -33,13 +52,29 @@ export interface ChallengeFeedbackSolved {
state: ChallengeFeedbackStatus.Solved;
}
+export interface ChallengeFeedbackIncorrectAnswer {
+ state: ChallengeFeedbackStatus.IncorrectAnswer;
+}
+
+export interface ChallengeFeedbackCodeInFile {
+ state: ChallengeFeedbackStatus.CodeInFile;
+ filename: string;
+ display_hint: string;
+}
+
+export interface ChallengeFeedbackCodeSent {
+ state: ChallengeFeedbackStatus.CodeSent;
+ display_hint: string;
+ address_hint: string;
+}
+
/**
* The challenge given by the server is unsupported
* by the current anastasis client.
*/
export interface ChallengeFeedbackUnsupported {
state: ChallengeFeedbackStatus.Unsupported;
- http_status: HttpStatusCode;
+
/**
* Human-readable identifier of the unsupported method.
*/
@@ -57,7 +92,7 @@ export interface ChallengeFeedbackRateLimitExceeded {
* Instructions for performing authentication via an
* IBAN bank transfer.
*/
-export interface ChallengeFeedbackAuthIban {
+export interface ChallengeFeedbackBankTransferRequired {
state: ChallengeFeedbackStatus.AuthIban;
/**
@@ -68,12 +103,12 @@ export interface ChallengeFeedbackAuthIban {
/**
* Account that should be credited.
*/
- credit_iban: string;
+ target_iban: string;
/**
* Creditor name.
*/
- business_name: string;
+ target_business_name: string;
/**
* Unstructured remittance information that should
@@ -81,41 +116,7 @@ export interface ChallengeFeedbackAuthIban {
*/
wire_transfer_subject: string;
- /**
- * FIXME: This field is only present for compatibility with
- * the C reducer test suite.
- */
- method: "iban";
-
answer_code: number;
-
- /**
- * FIXME: This field is only present for compatibility with
- * the C reducer test suite.
- */
- details: {
- challenge_amount: AmountString;
- credit_iban: string;
- business_name: string;
- wire_transfer_subject: string;
- };
-}
-
-/**
- * Challenge still needs to be solved.
- */
-export interface ChallengeFeedbackPending {
- state: ChallengeFeedbackStatus.Pending;
-}
-
-/**
- * Human-readable response from the provider
- * after the user failed to solve the challenge
- * correctly.
- */
-export interface ChallengeFeedbackMessage {
- state: ChallengeFeedbackStatus.Message;
- message: string;
}
/**
@@ -141,21 +142,11 @@ export interface ChallengeFeedbackTruthUnknown {
}
/**
- * The user should be asked to go to a URL
- * to complete the authentication there.
- */
-export interface ChallengeFeedbackRedirect {
- state: ChallengeFeedbackStatus.Redirect;
- http_status: number;
- redirect_url: string;
-}
-
-/**
* A payment is required before the user can
* even attempt to solve the challenge.
*/
-export interface ChallengeFeedbackPayment {
- state: ChallengeFeedbackStatus.Payment;
+export interface ChallengeFeedbackTalerPaymentRequired {
+ state: ChallengeFeedbackStatus.TalerPayment;
taler_pay_uri: string;