@coderoftime/fints 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +142 -1
- package/README.md +127 -37
- package/dist/client.d.ts +48 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +199 -0
- package/dist/client.js.map +1 -0
- package/dist/core/account.d.ts +35 -7
- package/dist/core/account.d.ts.map +1 -1
- package/dist/core/account.js +84 -13
- package/dist/core/account.js.map +1 -1
- package/dist/core/amount.d.ts +2 -1
- package/dist/core/amount.d.ts.map +1 -1
- package/dist/core/amount.js +4 -1
- package/dist/core/amount.js.map +1 -1
- package/dist/core/balance.d.ts +1 -0
- package/dist/core/balance.d.ts.map +1 -1
- package/dist/core/balance.js +6 -5
- package/dist/core/balance.js.map +1 -1
- package/dist/core/bank-info.d.ts +1 -1
- package/dist/core/bank-info.js +1 -1
- package/dist/core/client.d.ts +50 -15
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/config.d.ts +28 -16
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +66 -26
- package/dist/core/config.js.map +1 -1
- package/dist/core/errors.d.ts +85 -23
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +112 -47
- package/dist/core/errors.js.map +1 -1
- package/dist/core/feedback.d.ts +4 -1
- package/dist/core/feedback.d.ts.map +1 -1
- package/dist/core/feedback.js +4 -1
- package/dist/core/feedback.js.map +1 -1
- package/dist/core/transaction.d.ts +6 -1
- package/dist/core/transaction.d.ts.map +1 -1
- package/dist/core/transaction.js +9 -4
- package/dist/core/transaction.js.map +1 -1
- package/dist/core/transport.d.ts +33 -6
- package/dist/core/transport.d.ts.map +1 -1
- package/dist/core/transport.js +77 -20
- package/dist/core/transport.js.map +1 -1
- package/dist/formats/camt.d.ts +24 -4
- package/dist/formats/camt.d.ts.map +1 -1
- package/dist/formats/camt.js +124 -41
- package/dist/formats/camt.js.map +1 -1
- package/dist/formats/mt940.d.ts +15 -3
- package/dist/formats/mt940.d.ts.map +1 -1
- package/dist/formats/mt940.js +161 -82
- package/dist/formats/mt940.js.map +1 -1
- package/dist/formats/readers.d.ts +6 -2
- package/dist/formats/readers.d.ts.map +1 -1
- package/dist/formats/readers.js +24 -29
- package/dist/formats/readers.js.map +1 -1
- package/dist/formats/record-budget.d.ts +7 -0
- package/dist/formats/record-budget.d.ts.map +1 -0
- package/dist/formats/record-budget.js +17 -0
- package/dist/formats/record-budget.js.map +1 -0
- package/dist/formats/sepa-purpose.d.ts +6 -0
- package/dist/formats/sepa-purpose.d.ts.map +1 -1
- package/dist/formats/sepa-purpose.js +23 -2
- package/dist/formats/sepa-purpose.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/session/app-approval.d.ts +11 -5
- package/dist/session/app-approval.d.ts.map +1 -1
- package/dist/session/app-approval.js +23 -12
- package/dist/session/app-approval.js.map +1 -1
- package/dist/session/dialog-runner.d.ts +7 -10
- package/dist/session/dialog-runner.d.ts.map +1 -1
- package/dist/session/dialog-runner.js +15 -16
- package/dist/session/dialog-runner.js.map +1 -1
- package/dist/session/login-guard.d.ts +54 -49
- package/dist/session/login-guard.d.ts.map +1 -1
- package/dist/session/login-guard.js +156 -84
- package/dist/session/login-guard.js.map +1 -1
- package/dist/session/sepa-accounts.d.ts +20 -14
- package/dist/session/sepa-accounts.d.ts.map +1 -1
- package/dist/session/sepa-accounts.js +62 -46
- package/dist/session/sepa-accounts.js.map +1 -1
- package/dist/session/session-setup.d.ts +33 -25
- package/dist/session/session-setup.d.ts.map +1 -1
- package/dist/session/session-setup.js +87 -65
- package/dist/session/session-setup.js.map +1 -1
- package/dist/session/session-state.d.ts +9 -6
- package/dist/session/session-state.d.ts.map +1 -1
- package/dist/session/session-state.js +52 -17
- package/dist/session/session-state.js.map +1 -1
- package/dist/session/signed-dialog.d.ts +77 -0
- package/dist/session/signed-dialog.d.ts.map +1 -0
- package/dist/session/signed-dialog.js +170 -0
- package/dist/session/signed-dialog.js.map +1 -0
- package/dist/session/tan-selection.d.ts +26 -18
- package/dist/session/tan-selection.d.ts.map +1 -1
- package/dist/session/tan-selection.js +44 -33
- package/dist/session/tan-selection.js.map +1 -1
- package/dist/session/user-prompts.d.ts +8 -4
- package/dist/session/user-prompts.d.ts.map +1 -1
- package/dist/session/user-prompts.js +34 -14
- package/dist/session/user-prompts.js.map +1 -1
- package/dist/tan/challenge.d.ts +34 -13
- package/dist/tan/challenge.d.ts.map +1 -1
- package/dist/tan/challenge.js +25 -26
- package/dist/tan/challenge.js.map +1 -1
- package/dist/tan/flicker.d.ts +7 -1
- package/dist/tan/flicker.d.ts.map +1 -1
- package/dist/tan/flicker.js +40 -6
- package/dist/tan/flicker.js.map +1 -1
- package/dist/tan/tan-image.d.ts +3 -2
- package/dist/tan/tan-image.d.ts.map +1 -1
- package/dist/tan/tan-image.js +7 -5
- package/dist/tan/tan-image.js.map +1 -1
- package/dist/tan/tan-models.d.ts +5 -1
- package/dist/tan/tan-models.d.ts.map +1 -1
- package/dist/tan/tan-models.js +10 -5
- package/dist/tan/tan-models.js.map +1 -1
- package/dist/util/async.d.ts +0 -2
- package/dist/util/async.d.ts.map +1 -1
- package/dist/util/async.js +0 -4
- package/dist/util/async.js.map +1 -1
- package/dist/util/bytes.d.ts +2 -3
- package/dist/util/bytes.d.ts.map +1 -1
- package/dist/util/bytes.js +12 -20
- package/dist/util/bytes.js.map +1 -1
- package/dist/util/call-context.d.ts.map +1 -1
- package/dist/util/call-context.js +3 -2
- package/dist/util/call-context.js.map +1 -1
- package/dist/util/dates.d.ts +9 -16
- package/dist/util/dates.d.ts.map +1 -1
- package/dist/util/dates.js +39 -19
- package/dist/util/dates.js.map +1 -1
- package/dist/util/errors.d.ts +9 -1
- package/dist/util/errors.d.ts.map +1 -1
- package/dist/util/errors.js +12 -3
- package/dist/util/errors.js.map +1 -1
- package/dist/util/json.d.ts +4 -0
- package/dist/util/json.d.ts.map +1 -1
- package/dist/util/json.js +18 -0
- package/dist/util/json.js.map +1 -1
- package/dist/util/text.d.ts +21 -4
- package/dist/util/text.d.ts.map +1 -1
- package/dist/util/text.js +42 -13
- package/dist/util/text.js.map +1 -1
- package/dist/util/xml.d.ts +4 -3
- package/dist/util/xml.d.ts.map +1 -1
- package/dist/util/xml.js +37 -26
- package/dist/util/xml.js.map +1 -1
- package/dist/v3/account-extension.d.ts.map +1 -1
- package/dist/v3/account-extension.js +7 -10
- package/dist/v3/account-extension.js.map +1 -1
- package/dist/v3/bank-connection.d.ts +34 -0
- package/dist/v3/bank-connection.d.ts.map +1 -0
- package/dist/v3/bank-connection.js +58 -0
- package/dist/v3/bank-connection.js.map +1 -0
- package/dist/v3/dialog.d.ts +80 -46
- package/dist/v3/dialog.d.ts.map +1 -1
- package/dist/v3/dialog.js +162 -59
- package/dist/v3/dialog.js.map +1 -1
- package/dist/v3/message.d.ts +17 -4
- package/dist/v3/message.d.ts.map +1 -1
- package/dist/v3/message.js +62 -18
- package/dist/v3/message.js.map +1 -1
- package/dist/v3/parameter-store.d.ts +75 -0
- package/dist/v3/parameter-store.d.ts.map +1 -0
- package/dist/v3/parameter-store.js +143 -0
- package/dist/v3/parameter-store.js.map +1 -0
- package/dist/v3/parameters.d.ts +38 -12
- package/dist/v3/parameters.d.ts.map +1 -1
- package/dist/v3/parameters.js +91 -37
- package/dist/v3/parameters.js.map +1 -1
- package/dist/v3/protocol.d.ts +43 -50
- package/dist/v3/protocol.d.ts.map +1 -1
- package/dist/v3/protocol.js +58 -208
- package/dist/v3/protocol.js.map +1 -1
- package/dist/v3/queries.d.ts +51 -0
- package/dist/v3/queries.d.ts.map +1 -0
- package/dist/v3/queries.js +120 -0
- package/dist/v3/queries.js.map +1 -0
- package/dist/v3/segments.d.ts +29 -12
- package/dist/v3/segments.d.ts.map +1 -1
- package/dist/v3/segments.js +65 -23
- package/dist/v3/segments.js.map +1 -1
- package/dist/v3/syntax.d.ts +65 -14
- package/dist/v3/syntax.d.ts.map +1 -1
- package/dist/v3/syntax.js +167 -101
- package/dist/v3/syntax.js.map +1 -1
- package/package.json +10 -6
- package/src/client.ts +252 -0
- package/src/core/account.ts +86 -13
- package/src/core/amount.ts +3 -1
- package/src/core/balance.ts +6 -5
- package/src/core/bank-info.ts +1 -1
- package/src/core/client.ts +52 -15
- package/src/core/config.ts +69 -28
- package/src/core/errors.ts +122 -48
- package/src/core/feedback.ts +4 -1
- package/src/core/transaction.ts +9 -4
- package/src/core/transport.ts +98 -23
- package/src/formats/camt.ts +136 -39
- package/src/formats/mt940.ts +167 -81
- package/src/formats/readers.ts +24 -31
- package/src/formats/record-budget.ts +18 -0
- package/src/formats/sepa-purpose.ts +21 -2
- package/src/index.ts +4 -2
- package/src/session/app-approval.ts +51 -38
- package/src/session/dialog-runner.ts +31 -28
- package/src/session/login-guard.ts +174 -88
- package/src/session/sepa-accounts.ts +63 -45
- package/src/session/session-setup.ts +90 -71
- package/src/session/session-state.ts +56 -22
- package/src/session/signed-dialog.ts +192 -0
- package/src/session/tan-selection.ts +50 -39
- package/src/session/user-prompts.ts +35 -16
- package/src/tan/challenge.ts +40 -31
- package/src/tan/flicker.ts +44 -6
- package/src/tan/tan-image.ts +7 -5
- package/src/tan/tan-models.ts +10 -5
- package/src/util/async.ts +0 -5
- package/src/util/bytes.ts +13 -19
- package/src/util/call-context.ts +3 -2
- package/src/util/dates.ts +41 -24
- package/src/util/errors.ts +14 -3
- package/src/util/json.ts +16 -0
- package/src/util/text.ts +42 -12
- package/src/util/xml.ts +37 -26
- package/src/v3/account-extension.ts +7 -12
- package/src/v3/bank-connection.ts +67 -0
- package/src/v3/dialog.ts +175 -91
- package/src/v3/message.ts +69 -17
- package/src/v3/parameter-store.ts +160 -0
- package/src/v3/parameters.ts +110 -37
- package/src/v3/protocol.ts +70 -253
- package/src/v3/queries.ts +190 -0
- package/src/v3/segments.ts +65 -22
- package/src/v3/syntax.ts +153 -91
- package/dist/session/bank-connection.d.ts +0 -28
- package/dist/session/bank-connection.d.ts.map +0 -1
- package/dist/session/bank-connection.js +0 -48
- package/dist/session/bank-connection.js.map +0 -1
- package/dist/session/parameter-data.d.ts +0 -83
- package/dist/session/parameter-data.d.ts.map +0 -1
- package/dist/session/parameter-data.js +0 -68
- package/dist/session/parameter-data.js.map +0 -1
- package/dist/session/pin-tan-client.d.ts +0 -54
- package/dist/session/pin-tan-client.d.ts.map +0 -1
- package/dist/session/pin-tan-client.js +0 -153
- package/dist/session/pin-tan-client.js.map +0 -1
- package/dist/session/pin-tan-dialog.d.ts +0 -71
- package/dist/session/pin-tan-dialog.d.ts.map +0 -1
- package/dist/session/pin-tan-dialog.js +0 -124
- package/dist/session/pin-tan-dialog.js.map +0 -1
- package/dist/session/protocol.d.ts +0 -209
- package/dist/session/protocol.d.ts.map +0 -1
- package/dist/session/protocol.js +0 -75
- package/dist/session/protocol.js.map +0 -1
- package/dist/session/response-handler.d.ts +0 -48
- package/dist/session/response-handler.d.ts.map +0 -1
- package/dist/session/response-handler.js +0 -121
- package/dist/session/response-handler.js.map +0 -1
- package/dist/v3/client.d.ts +0 -24
- package/dist/v3/client.d.ts.map +0 -1
- package/dist/v3/client.js +0 -16
- package/dist/v3/client.js.map +0 -1
- package/src/session/bank-connection.ts +0 -51
- package/src/session/parameter-data.ts +0 -137
- package/src/session/pin-tan-client.ts +0 -186
- package/src/session/pin-tan-dialog.ts +0 -160
- package/src/session/protocol.ts +0 -311
- package/src/session/response-handler.ts +0 -130
- package/src/v3/client.ts +0 -29
package/dist/v3/dialog.d.ts
CHANGED
|
@@ -1,59 +1,69 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Approval, StartWithOrder } from '../session/protocol.js';
|
|
1
|
+
import { TanChallenge } from '../tan/challenge.js';
|
|
3
2
|
import { TanMethod } from '../tan/tan-models.js';
|
|
4
3
|
import { IncomingMessage3 } from './message.js';
|
|
5
|
-
import type {
|
|
4
|
+
import type { FinTs3Protocol } from './protocol.js';
|
|
6
5
|
import type { SegmentSpec } from './syntax.js';
|
|
7
|
-
/**
|
|
8
|
-
export interface
|
|
9
|
-
|
|
10
|
-
readonly
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*/
|
|
16
|
-
export interface FinTs3DialogHost {
|
|
17
|
-
/** The bank parameter data received so far, if any. */
|
|
18
|
-
readonly bankParameters: Bpd3 | undefined;
|
|
19
|
-
/** The customer system ID the bank assigned; `undefined` before the synchronization. */
|
|
20
|
-
readonly systemId: string | undefined;
|
|
21
|
-
/** Identification (HKIDN) and processing preparation (HKVVB), which open every dialog. */
|
|
22
|
-
initSegments(systemId: string, anonymous?: boolean): SegmentSpec[];
|
|
6
|
+
/** The bank's request to approve a message with a TAN or in a banking app; `R` is the bank's answer. */
|
|
7
|
+
export interface Approval<R> {
|
|
8
|
+
/** What the user is asked. */
|
|
9
|
+
readonly challenge: TanChallenge;
|
|
10
|
+
/** Sends the TAN the user entered. */
|
|
11
|
+
readonly submitTan: (tan: string) => Promise<R>;
|
|
12
|
+
/** Asks the bank whether the user has approved in the banking app. */
|
|
13
|
+
readonly checkStatus: () => Promise<R>;
|
|
23
14
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* With `signing` the message is signed with the PIN and the `tan`, after `LoginGuard.check`; without, it goes out
|
|
27
|
-
* unsigned, as in an anonymous dialog.
|
|
15
|
+
* Whether the bank announces a push message for once the user has approved (return code 3957), before which the
|
|
16
|
+
* status must not be asked. The client has no push channel, so the user reports the approval instead.
|
|
28
17
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
segments: readonly SegmentSpec[];
|
|
33
|
-
signing: Signing3 | undefined;
|
|
34
|
-
tan: string | undefined;
|
|
35
|
-
}): Promise<Uint8Array>;
|
|
18
|
+
readonly waitForPush: boolean;
|
|
19
|
+
/** The new instructions a status answer gives the user (return code 3956); `undefined` where it gives none. */
|
|
20
|
+
readonly instructionsIn: (response: R) => string | undefined;
|
|
36
21
|
}
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
22
|
+
/**
|
|
23
|
+
* One FinTS 3.0 dialog: numbered messages under the dialog ID the bank assigns in its first answer, signed with a TAN
|
|
24
|
+
* method and medium, and the approvals the bank asks for. The `FinTs3Protocol` builds the messages and signs them.
|
|
25
|
+
*/
|
|
26
|
+
export declare class FinTs3Dialog {
|
|
27
|
+
private readonly protocol;
|
|
28
|
+
readonly method: TanMethod;
|
|
29
|
+
/** The TAN medium the messages name, where the method takes one. */
|
|
30
|
+
readonly tanMedium: string | undefined;
|
|
40
31
|
private readonly anonymous;
|
|
41
32
|
private systemId;
|
|
42
33
|
private id;
|
|
34
|
+
private messageNumber;
|
|
35
|
+
private ended;
|
|
36
|
+
/** When the bank last answered without rejecting the whole message, which shows it still knows the dialog. */
|
|
37
|
+
private lastAnswer;
|
|
43
38
|
private constructor();
|
|
44
|
-
static signed(
|
|
39
|
+
static signed(protocol: FinTs3Protocol, method: TanMethod, tanMedium?: string): FinTs3Dialog;
|
|
45
40
|
/** A dialog without login, which only delivers the bank parameter data. */
|
|
46
|
-
static anonymous(
|
|
47
|
-
|
|
41
|
+
static anonymous(protocol: FinTs3Protocol): FinTs3Dialog;
|
|
42
|
+
/** Whether the bank knows this dialog and it has not ended. */
|
|
48
43
|
get isActive(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the dialog has ended, on either side.
|
|
46
|
+
*
|
|
47
|
+
* The bank ends a dialog idle for longer than its maximum timeout (HIBPA, Formals C.9), or five minutes where it
|
|
48
|
+
* states none. Such a dialog is neither used nor ended again: the bank would refuse any message in it.
|
|
49
|
+
*/
|
|
50
|
+
private get hasEnded();
|
|
51
|
+
private get idleTooLong();
|
|
52
|
+
/** Whether the messages are signed with a two-step TAN method, so that the bank may ask for approvals. */
|
|
53
|
+
private get isTwoStep();
|
|
49
54
|
/** The version of the HKTAN segments: that of the HITANS segment the bank describes the method in. */
|
|
50
55
|
private get tanVersion();
|
|
56
|
+
/** Opens the dialog; with `synchronize` the bank also assigns a customer system ID. */
|
|
51
57
|
start(synchronize?: boolean): Promise<IncomingMessage3>;
|
|
52
58
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
59
|
+
* The messages that open the dialog and send `order` while no TAN medium is chosen yet, as for listing the media:
|
|
60
|
+
* `login` opens the dialog, asking strong authentication for `order` with a two-step method, and `order` sends the
|
|
61
|
+
* order in a message of its own.
|
|
55
62
|
*/
|
|
56
|
-
startWith(order: SegmentSpec):
|
|
63
|
+
startWith(order: SegmentSpec): {
|
|
64
|
+
readonly login: () => Promise<IncomingMessage3>;
|
|
65
|
+
readonly order: () => Promise<IncomingMessage3>;
|
|
66
|
+
};
|
|
57
67
|
/**
|
|
58
68
|
* Opens the anonymous dialog; the answer carries the bank parameter data.
|
|
59
69
|
*
|
|
@@ -61,18 +71,42 @@ export declare class FinTs3Dialog extends PinTanDialog<IncomingMessage3, Segment
|
|
|
61
71
|
* tells the bank so, whereupon the bank may send parameter data suited to it (PIN/TAN, B.4.3.1).
|
|
62
72
|
*/
|
|
63
73
|
requestBankParameters(announceSca?: boolean): Promise<IncomingMessage3>;
|
|
74
|
+
/** Sends `order`, asking for strong customer authentication where the bank requires it. */
|
|
64
75
|
send(order: SegmentSpec): Promise<IncomingMessage3>;
|
|
65
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Ends the dialog at the bank and returns the answer; `undefined` if the dialog is not active or the end failed.
|
|
78
|
+
*
|
|
79
|
+
* Bank and connection errors are ignored, since the bank may have ended the dialog on its side already.
|
|
80
|
+
*/
|
|
81
|
+
end(): Promise<IncomingMessage3 | undefined>;
|
|
82
|
+
/** Forgets the dialog without contacting the bank, for example after the bank rejected the PIN. */
|
|
83
|
+
discard(): void;
|
|
84
|
+
/**
|
|
85
|
+
* The approval `response`, the dialog's latest answer, asks for with return code 0030 (TAN) or 3955 (banking app):
|
|
86
|
+
* HITAN of process 4, answered with HKTAN process 2 (TAN) or S (status); `undefined` if it asks for none, or carries
|
|
87
|
+
* only the dummy challenge of a message the bank exempts from strong authentication.
|
|
88
|
+
*
|
|
89
|
+
* The bank has not executed the message then, so a request without a challenge is a `FinTsProtocolError`: read as
|
|
90
|
+
* done, it would report an empty result. So is an app approval with a method of HITANS #6: the status request
|
|
91
|
+
* (process S) came with version 7, along with app approvals (PIN/TAN B.5.2).
|
|
92
|
+
*/
|
|
93
|
+
approvalAskedIn(response: IncomingMessage3): Approval<IncomingMessage3> | undefined;
|
|
66
94
|
private tanRequest;
|
|
67
95
|
/**
|
|
68
|
-
*
|
|
96
|
+
* Sends `segments`, with `tan` where they complete an approval, as the next message, and reads the bank's answer. The
|
|
97
|
+
* message counts once the bank has answered, whatever it answered.
|
|
98
|
+
*
|
|
99
|
+
* The bank assigns the dialog ID in its answer to the first message, so the answer to another user's first message
|
|
100
|
+
* passes for it (`ParameterStore.reportedUpdVersion`). Any other answer to another message fails with
|
|
101
|
+
* `FinTsProtocolError` before anything of it is kept: a relay or proxy that mixes up answers would hand the client
|
|
102
|
+
* another user's data, or a page of another query.
|
|
103
|
+
*
|
|
104
|
+
* The dialog ends on the client's side, without a dialog end, where it is over for the bank: after a return code that
|
|
105
|
+
* ends it, such as 9800, and after a rejected opening message (Formals C.1.2), or a broken connection (C.6).
|
|
69
106
|
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
107
|
+
* Only an answer that does not reject the whole message starts the idle time anew (`hasEnded`): a rejection may come
|
|
108
|
+
* from a bank that has ended the dialog without saying so.
|
|
72
109
|
*/
|
|
73
|
-
protected approvalIn(response: IncomingMessage3): Approval<IncomingMessage3> | undefined;
|
|
74
110
|
private sendSegments;
|
|
75
|
-
/** The bank assigns the dialog ID in its answer to the first message. */
|
|
76
|
-
protected readDialogData(response: IncomingMessage3): void;
|
|
77
111
|
}
|
|
78
112
|
//# sourceMappingURL=dialog.d.ts.map
|
package/dist/v3/dialog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/v3/dialog.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/v3/dialog.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAiB/C,wGAAwG;AACxG,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,8BAA8B;IAC9B,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IAEjC,sCAAsC;IACtC,QAAQ,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAEhD,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IAEvC;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAE9B,+GAA+G;IAC/G,QAAQ,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,CAAC;CAC9D;AAED;;;GAGG;AACH,qBAAa,YAAY;IAUrB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,QAAQ,CAAC,MAAM,EAAE,SAAS;IAC1B,oEAAoE;IACpE,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAb5B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,EAAE,CAAc;IACxB,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CA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|
package/dist/v3/dialog.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Internal to the package, and named after the FinTS specification. Documentation is where the meaning is not evident.
|
|
2
|
-
import { FinTsProtocolError } from '../core/errors.js';
|
|
3
|
-
import { FeedbackCodes, hasCode } from '../core/feedback.js';
|
|
4
|
-
import {
|
|
5
|
-
import { PinTanDialog } from '../session/pin-tan-dialog.js';
|
|
2
|
+
import { FinTsError, FinTsProtocolError, FinTsTransportError, parseBankData } from '../core/errors.js';
|
|
3
|
+
import { endsDialog, FeedbackCodes, hasCode, hasErrors } from '../core/feedback.js';
|
|
4
|
+
import { challengeText, TanChallenge } from '../tan/challenge.js';
|
|
6
5
|
import { TanMethod } from '../tan/tan-models.js';
|
|
7
6
|
import { IncomingMessage3 } from './message.js';
|
|
7
|
+
import { requireBankParameters } from './parameters.js';
|
|
8
8
|
import { Segments, TanResponse } from './segments.js';
|
|
9
9
|
/** Dialog ID of a dialog the bank has not answered yet, and customer system ID before synchronization. */
|
|
10
10
|
const unassigned = '0';
|
|
@@ -12,52 +12,89 @@ const unassigned = '0';
|
|
|
12
12
|
const firstScaVersion = 6;
|
|
13
13
|
/** The first version of HKTAN that supports app approvals, with the status request (process S). */
|
|
14
14
|
const firstDecoupledVersion = 7;
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
/**
|
|
16
|
+
* How long a dialog may stay idle where the bank states no timeout: on the safe side, since a dialog given up too early
|
|
17
|
+
* only costs a new login, while one kept too long fails the next call.
|
|
18
|
+
*/
|
|
19
|
+
const defaultIdleLimitMs = 5 * 60_000;
|
|
20
|
+
/**
|
|
21
|
+
* One FinTS 3.0 dialog: numbered messages under the dialog ID the bank assigns in its first answer, signed with a TAN
|
|
22
|
+
* method and medium, and the approvals the bank asks for. The `FinTs3Protocol` builds the messages and signs them.
|
|
23
|
+
*/
|
|
24
|
+
export class FinTs3Dialog {
|
|
25
|
+
protocol;
|
|
26
|
+
method;
|
|
27
|
+
tanMedium;
|
|
18
28
|
anonymous;
|
|
19
29
|
systemId;
|
|
20
30
|
id = unassigned;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
messageNumber = 1;
|
|
32
|
+
ended = false;
|
|
33
|
+
/** When the bank last answered without rejecting the whole message, which shows it still knows the dialog. */
|
|
34
|
+
lastAnswer;
|
|
35
|
+
constructor(protocol, method,
|
|
36
|
+
/** The TAN medium the messages name, where the method takes one. */
|
|
37
|
+
tanMedium, anonymous) {
|
|
38
|
+
this.protocol = protocol;
|
|
39
|
+
this.method = method;
|
|
40
|
+
this.tanMedium = tanMedium;
|
|
24
41
|
this.anonymous = anonymous;
|
|
25
|
-
this.systemId = anonymous ? unassigned : (
|
|
42
|
+
this.systemId = anonymous ? unassigned : (protocol.parameters.systemId ?? unassigned);
|
|
26
43
|
}
|
|
27
|
-
static signed(
|
|
28
|
-
return new FinTs3Dialog(
|
|
44
|
+
static signed(protocol, method, tanMedium) {
|
|
45
|
+
return new FinTs3Dialog(protocol, method, tanMedium, false);
|
|
29
46
|
}
|
|
30
47
|
/** A dialog without login, which only delivers the bank parameter data. */
|
|
31
|
-
static anonymous(
|
|
32
|
-
return new FinTs3Dialog(
|
|
33
|
-
}
|
|
34
|
-
get bankParameters() {
|
|
35
|
-
return this.host.bankParameters;
|
|
48
|
+
static anonymous(protocol) {
|
|
49
|
+
return new FinTs3Dialog(protocol, TanMethod.oneStep, undefined, true);
|
|
36
50
|
}
|
|
51
|
+
/** Whether the bank knows this dialog and it has not ended. */
|
|
37
52
|
get isActive() {
|
|
38
53
|
return this.id !== unassigned && !this.hasEnded;
|
|
39
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Whether the dialog has ended, on either side.
|
|
57
|
+
*
|
|
58
|
+
* The bank ends a dialog idle for longer than its maximum timeout (HIBPA, Formals C.9), or five minutes where it
|
|
59
|
+
* states none. Such a dialog is neither used nor ended again: the bank would refuse any message in it.
|
|
60
|
+
*/
|
|
61
|
+
get hasEnded() {
|
|
62
|
+
return this.ended || this.idleTooLong;
|
|
63
|
+
}
|
|
64
|
+
get idleTooLong() {
|
|
65
|
+
const last = this.lastAnswer;
|
|
66
|
+
const timeout = this.protocol.parameters.bankParameters?.bankInfo.maxTimeout;
|
|
67
|
+
// A timeout of 0 or below: the bank keeps idle dialogs without limit.
|
|
68
|
+
const limit = timeout === undefined ? defaultIdleLimitMs : timeout <= 0 ? undefined : timeout * 1000;
|
|
69
|
+
return last !== undefined && limit !== undefined && Date.now() - last > limit;
|
|
70
|
+
}
|
|
71
|
+
/** Whether the messages are signed with a two-step TAN method, so that the bank may ask for approvals. */
|
|
72
|
+
get isTwoStep() {
|
|
73
|
+
return !this.method.isOneStep;
|
|
74
|
+
}
|
|
40
75
|
/** The version of the HKTAN segments: that of the HITANS segment the bank describes the method in. */
|
|
41
76
|
get tanVersion() {
|
|
42
|
-
return this.bankParameters?.tanVersion(this.method) ?? firstScaVersion;
|
|
77
|
+
return this.protocol.parameters.bankParameters?.tanVersion(this.method) ?? firstScaVersion;
|
|
43
78
|
}
|
|
79
|
+
/** Opens the dialog; with `synchronize` the bank also assigns a customer system ID. */
|
|
44
80
|
start(synchronize = false) {
|
|
45
81
|
if (synchronize)
|
|
46
82
|
this.systemId = unassigned;
|
|
47
83
|
return this.sendSegments([
|
|
48
|
-
...this.
|
|
84
|
+
...this.protocol.initSegments(this.systemId),
|
|
49
85
|
...(this.isTwoStep ? [this.tanRequest('HKIDN')] : []),
|
|
50
86
|
...(synchronize ? [Segments.synchronization()] : []),
|
|
51
87
|
]);
|
|
52
88
|
}
|
|
53
89
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
90
|
+
* The messages that open the dialog and send `order` while no TAN medium is chosen yet, as for listing the media:
|
|
91
|
+
* `login` opens the dialog, asking strong authentication for `order` with a two-step method, and `order` sends the
|
|
92
|
+
* order in a message of its own.
|
|
56
93
|
*/
|
|
57
94
|
startWith(order) {
|
|
58
95
|
return {
|
|
59
96
|
login: () => this.sendSegments([
|
|
60
|
-
...this.
|
|
97
|
+
...this.protocol.initSegments(this.systemId),
|
|
61
98
|
...(this.isTwoStep ? [this.tanRequest(order.type)] : []),
|
|
62
99
|
]),
|
|
63
100
|
order: () => this.sendSegments([order]),
|
|
@@ -71,61 +108,127 @@ export class FinTs3Dialog extends PinTanDialog {
|
|
|
71
108
|
*/
|
|
72
109
|
requestBankParameters(announceSca = false) {
|
|
73
110
|
return this.sendSegments([
|
|
74
|
-
...this.
|
|
111
|
+
...this.protocol.initSegments(unassigned, true),
|
|
75
112
|
...(announceSca ? [Segments.tanProcess4(firstScaVersion, 'HKIDN')] : []),
|
|
76
113
|
]);
|
|
77
114
|
}
|
|
115
|
+
/** Sends `order`, asking for strong customer authentication where the bank requires it. */
|
|
78
116
|
send(order) {
|
|
79
|
-
const needsTan = this.isTwoStep && requireBankParameters(this.bankParameters).pinTan.requiresTan(order.type);
|
|
117
|
+
const needsTan = this.isTwoStep && requireBankParameters(this.protocol.parameters.bankParameters).pinTan.requiresTan(order.type);
|
|
80
118
|
return this.sendSegments([order, ...(needsTan ? [this.tanRequest(order.type)] : [])]);
|
|
81
119
|
}
|
|
82
|
-
|
|
83
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Ends the dialog at the bank and returns the answer; `undefined` if the dialog is not active or the end failed.
|
|
122
|
+
*
|
|
123
|
+
* Bank and connection errors are ignored, since the bank may have ended the dialog on its side already.
|
|
124
|
+
*/
|
|
125
|
+
async end() {
|
|
126
|
+
if (!this.isActive)
|
|
127
|
+
return undefined;
|
|
128
|
+
this.ended = true;
|
|
129
|
+
try {
|
|
130
|
+
return await this.sendSegments([Segments.dialogEnd(this.id)]);
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
if (!(error instanceof FinTsError))
|
|
134
|
+
throw error;
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
84
137
|
}
|
|
85
|
-
|
|
86
|
-
|
|
138
|
+
/** Forgets the dialog without contacting the bank, for example after the bank rejected the PIN. */
|
|
139
|
+
discard() {
|
|
140
|
+
this.ended = true;
|
|
87
141
|
}
|
|
88
142
|
/**
|
|
89
|
-
* The approval
|
|
143
|
+
* The approval `response`, the dialog's latest answer, asks for with return code 0030 (TAN) or 3955 (banking app):
|
|
144
|
+
* HITAN of process 4, answered with HKTAN process 2 (TAN) or S (status); `undefined` if it asks for none, or carries
|
|
145
|
+
* only the dummy challenge of a message the bank exempts from strong authentication.
|
|
90
146
|
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
147
|
+
* The bank has not executed the message then, so a request without a challenge is a `FinTsProtocolError`: read as
|
|
148
|
+
* done, it would report an empty result. So is an app approval with a method of HITANS #6: the status request
|
|
149
|
+
* (process S) came with version 7, along with app approvals (PIN/TAN B.5.2).
|
|
93
150
|
*/
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
151
|
+
approvalAskedIn(response) {
|
|
152
|
+
const feedback = response.feedback;
|
|
153
|
+
const decoupled = hasCode(feedback, FeedbackCodes.decoupledPending);
|
|
154
|
+
if (hasErrors(feedback) || !(hasCode(feedback, FeedbackCodes.tanRequired) || decoupled))
|
|
97
155
|
return undefined;
|
|
98
|
-
|
|
156
|
+
const tan = tanResponseOf(response, '4');
|
|
157
|
+
if (tan === undefined || tan.isDummy) {
|
|
158
|
+
throw new FinTsProtocolError('The bank asks for an approval, but sends no challenge');
|
|
159
|
+
}
|
|
160
|
+
if (decoupled && this.tanVersion < firstDecoupledVersion) {
|
|
99
161
|
throw new FinTsProtocolError('The bank asks for an app approval, which needs HKTAN version 7');
|
|
100
162
|
}
|
|
101
163
|
const reference = tan.reference;
|
|
102
|
-
return
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
164
|
+
return {
|
|
165
|
+
challenge: TanChallenge.create({
|
|
166
|
+
method: this.method,
|
|
167
|
+
reference,
|
|
168
|
+
message: tan.challenge,
|
|
169
|
+
hhdUc: tan.hhdUc,
|
|
170
|
+
isDecoupled: decoupled || this.method.decoupled,
|
|
171
|
+
validUntil: tan.validUntil,
|
|
172
|
+
tanMediumName: tan.mediumName ?? this.tanMedium,
|
|
173
|
+
}),
|
|
108
174
|
submitTan: (value) => this.sendSegments([Segments.tanProcess2(this.tanVersion, reference)], value),
|
|
109
175
|
checkStatus: () => this.sendSegments([Segments.tanProcessStatus(this.tanVersion, reference)]),
|
|
176
|
+
waitForPush: hasCode(feedback, FeedbackCodes.decoupledWaitForPush),
|
|
110
177
|
// A status answer that the approval is still pending may carry new instructions (PIN/TAN B.4.2.2.1, step 2b).
|
|
111
|
-
instructionsIn: (status) => tanResponseOf(status, 'S')?.challenge,
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
178
|
+
instructionsIn: (status) => challengeText(tanResponseOf(status, 'S')?.challenge),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
tanRequest(segmentType) {
|
|
182
|
+
const medium = this.method.mediumRequirement === 'notAllowed' ? undefined : this.tanMedium;
|
|
183
|
+
return Segments.tanProcess4(this.tanVersion, segmentType, medium === undefined ? undefined : this.protocol.parameters.tanMediumAsSent(medium));
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Sends `segments`, with `tan` where they complete an approval, as the next message, and reads the bank's answer. The
|
|
187
|
+
* message counts once the bank has answered, whatever it answered.
|
|
188
|
+
*
|
|
189
|
+
* The bank assigns the dialog ID in its answer to the first message, so the answer to another user's first message
|
|
190
|
+
* passes for it (`ParameterStore.reportedUpdVersion`). Any other answer to another message fails with
|
|
191
|
+
* `FinTsProtocolError` before anything of it is kept: a relay or proxy that mixes up answers would hand the client
|
|
192
|
+
* another user's data, or a page of another query.
|
|
193
|
+
*
|
|
194
|
+
* The dialog ends on the client's side, without a dialog end, where it is over for the bank: after a return code that
|
|
195
|
+
* ends it, such as 9800, and after a rejected opening message (Formals C.1.2), or a broken connection (C.6).
|
|
196
|
+
*
|
|
197
|
+
* Only an answer that does not reject the whole message starts the idle time anew (`hasEnded`): a rejection may come
|
|
198
|
+
* from a bank that has ended the dialog without saying so.
|
|
199
|
+
*/
|
|
200
|
+
async sendSegments(segments, tan) {
|
|
201
|
+
const number = this.messageNumber;
|
|
202
|
+
let answer;
|
|
203
|
+
try {
|
|
204
|
+
answer = await this.protocol.post({
|
|
205
|
+
dialogId: this.id,
|
|
206
|
+
number,
|
|
207
|
+
segments,
|
|
208
|
+
signing: this.anonymous
|
|
209
|
+
? undefined
|
|
210
|
+
: { securityFunction: this.method.securityFunction, systemId: this.systemId },
|
|
211
|
+
tan,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
if (error instanceof FinTsTransportError)
|
|
216
|
+
this.discard();
|
|
217
|
+
throw error;
|
|
218
|
+
}
|
|
219
|
+
this.messageNumber++;
|
|
220
|
+
const response = parseBankData(() => IncomingMessage3.parse(answer));
|
|
221
|
+
const assigned = this.id === unassigned ? undefined : this.id;
|
|
222
|
+
if (!response.answers(number, assigned)) {
|
|
223
|
+
throw new FinTsProtocolError('The answer belongs to another message than the one sent');
|
|
224
|
+
}
|
|
225
|
+
if (assigned === undefined)
|
|
128
226
|
this.id = response.dialogId ?? unassigned;
|
|
227
|
+
if (!response.messageRejected)
|
|
228
|
+
this.lastAnswer = Date.now();
|
|
229
|
+
if (endsDialog(response.feedback) || (number === 1 && response.messageRejected))
|
|
230
|
+
this.discard();
|
|
231
|
+
return response;
|
|
129
232
|
}
|
|
130
233
|
}
|
|
131
234
|
/** The TAN part of `response` that answers TAN `process`. */
|
package/dist/v3/dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/v3/dialog.ts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,CAAC"}
|
package/dist/v3/message.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BankMessage } from '../core/bank-info.js';
|
|
2
2
|
import { FinTsFeedback } from '../core/feedback.js';
|
|
3
|
-
import type { BankResponse } from '../session/protocol.js';
|
|
4
3
|
import { type Segment, SegmentSpec } from './syntax.js';
|
|
5
4
|
/** Signature data of a PIN/TAN message. */
|
|
6
5
|
export interface PinTanCredentials {
|
|
@@ -39,8 +38,9 @@ export declare function buildMessage(parts: {
|
|
|
39
38
|
now?: Date;
|
|
40
39
|
}): OutgoingMessage;
|
|
41
40
|
/** A received message, with the segments of the encryption envelope unpacked. */
|
|
42
|
-
export declare class IncomingMessage3
|
|
41
|
+
export declare class IncomingMessage3 {
|
|
43
42
|
readonly segments: readonly Segment[];
|
|
43
|
+
/** The memory the message holds, in bytes: its length, and what its parts take beyond that. */
|
|
44
44
|
readonly size: number;
|
|
45
45
|
/**
|
|
46
46
|
* Return codes for the whole message (HIRMG), then for single request segments (HIRMS).
|
|
@@ -49,16 +49,29 @@ export declare class IncomingMessage3 implements BankResponse {
|
|
|
49
49
|
* approval reports on the order of an earlier message (PIN/TAN B.4.2.1).
|
|
50
50
|
*/
|
|
51
51
|
readonly feedback: readonly FinTsFeedback[];
|
|
52
|
+
/** Whether the bank rejected the message as a whole (an error in HIRMG), rather than single orders in it. */
|
|
52
53
|
readonly messageRejected: boolean;
|
|
53
54
|
private constructor();
|
|
54
55
|
/**
|
|
55
|
-
* Parses a message; throws `FormatError` if `data` is not
|
|
56
|
-
* maintenance notice
|
|
56
|
+
* Parses a message; throws `FormatError` if `data` is not one complete FinTS message, such as the HTML page of a
|
|
57
|
+
* proxy, a maintenance notice, a message cut short, which lacks the message trailer (HNHBS) at its end, or two
|
|
58
|
+
* messages run together, whose second would pass for part of the first.
|
|
59
|
+
*
|
|
60
|
+
* Its `size` counts the memory of its data elements along with its bytes, since a message of many short elements
|
|
61
|
+
* takes far more memory than bytes.
|
|
57
62
|
*/
|
|
58
63
|
static parse(data: Uint8Array): IncomingMessage3;
|
|
59
64
|
static combine(first: IncomingMessage3, second: IncomingMessage3): IncomingMessage3;
|
|
65
|
+
/** Free-text messages the bank addresses to the user. */
|
|
60
66
|
get bankMessages(): BankMessage[];
|
|
67
|
+
/** The dialog ID the bank assigned, as `Segment.verbatim` reads it, to send back byte for byte. */
|
|
61
68
|
get dialogId(): string | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Whether the message answers message `number` of the dialog `dialogId`: header and trailer carry that number, and the
|
|
71
|
+
* header names that message where it names the message it refers to (Bezugsnachricht). The dialog ID counts only once
|
|
72
|
+
* the bank has assigned one; before, `dialogId` is `undefined`, since every first message goes out under the same.
|
|
73
|
+
*/
|
|
74
|
+
answers(number: number, dialogId: string | undefined): boolean;
|
|
62
75
|
find(type: string): Segment | undefined;
|
|
63
76
|
findAll(type: string): Segment[];
|
|
64
77
|
}
|
package/dist/v3/message.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/v3/message.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/v3/message.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMpD,OAAO,EAKL,KAAK,OAAO,EACZ,WAAW,EAGZ,MAAM,aAAa,CAAC;AAErB,2CAA2C;AAC3C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QA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