@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.
Files changed (272) hide show
  1. package/CHANGELOG.md +142 -1
  2. package/README.md +127 -37
  3. package/dist/client.d.ts +48 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +199 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/core/account.d.ts +35 -7
  8. package/dist/core/account.d.ts.map +1 -1
  9. package/dist/core/account.js +84 -13
  10. package/dist/core/account.js.map +1 -1
  11. package/dist/core/amount.d.ts +2 -1
  12. package/dist/core/amount.d.ts.map +1 -1
  13. package/dist/core/amount.js +4 -1
  14. package/dist/core/amount.js.map +1 -1
  15. package/dist/core/balance.d.ts +1 -0
  16. package/dist/core/balance.d.ts.map +1 -1
  17. package/dist/core/balance.js +6 -5
  18. package/dist/core/balance.js.map +1 -1
  19. package/dist/core/bank-info.d.ts +1 -1
  20. package/dist/core/bank-info.js +1 -1
  21. package/dist/core/client.d.ts +50 -15
  22. package/dist/core/client.d.ts.map +1 -1
  23. package/dist/core/config.d.ts +28 -16
  24. package/dist/core/config.d.ts.map +1 -1
  25. package/dist/core/config.js +66 -26
  26. package/dist/core/config.js.map +1 -1
  27. package/dist/core/errors.d.ts +85 -23
  28. package/dist/core/errors.d.ts.map +1 -1
  29. package/dist/core/errors.js +112 -47
  30. package/dist/core/errors.js.map +1 -1
  31. package/dist/core/feedback.d.ts +4 -1
  32. package/dist/core/feedback.d.ts.map +1 -1
  33. package/dist/core/feedback.js +4 -1
  34. package/dist/core/feedback.js.map +1 -1
  35. package/dist/core/transaction.d.ts +6 -1
  36. package/dist/core/transaction.d.ts.map +1 -1
  37. package/dist/core/transaction.js +9 -4
  38. package/dist/core/transaction.js.map +1 -1
  39. package/dist/core/transport.d.ts +33 -6
  40. package/dist/core/transport.d.ts.map +1 -1
  41. package/dist/core/transport.js +77 -20
  42. package/dist/core/transport.js.map +1 -1
  43. package/dist/formats/camt.d.ts +24 -4
  44. package/dist/formats/camt.d.ts.map +1 -1
  45. package/dist/formats/camt.js +124 -41
  46. package/dist/formats/camt.js.map +1 -1
  47. package/dist/formats/mt940.d.ts +15 -3
  48. package/dist/formats/mt940.d.ts.map +1 -1
  49. package/dist/formats/mt940.js +161 -82
  50. package/dist/formats/mt940.js.map +1 -1
  51. package/dist/formats/readers.d.ts +6 -2
  52. package/dist/formats/readers.d.ts.map +1 -1
  53. package/dist/formats/readers.js +24 -29
  54. package/dist/formats/readers.js.map +1 -1
  55. package/dist/formats/record-budget.d.ts +7 -0
  56. package/dist/formats/record-budget.d.ts.map +1 -0
  57. package/dist/formats/record-budget.js +17 -0
  58. package/dist/formats/record-budget.js.map +1 -0
  59. package/dist/formats/sepa-purpose.d.ts +6 -0
  60. package/dist/formats/sepa-purpose.d.ts.map +1 -1
  61. package/dist/formats/sepa-purpose.js +23 -2
  62. package/dist/formats/sepa-purpose.js.map +1 -1
  63. package/dist/index.d.ts +3 -3
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +2 -2
  66. package/dist/index.js.map +1 -1
  67. package/dist/session/app-approval.d.ts +11 -5
  68. package/dist/session/app-approval.d.ts.map +1 -1
  69. package/dist/session/app-approval.js +23 -12
  70. package/dist/session/app-approval.js.map +1 -1
  71. package/dist/session/dialog-runner.d.ts +7 -10
  72. package/dist/session/dialog-runner.d.ts.map +1 -1
  73. package/dist/session/dialog-runner.js +15 -16
  74. package/dist/session/dialog-runner.js.map +1 -1
  75. package/dist/session/login-guard.d.ts +54 -49
  76. package/dist/session/login-guard.d.ts.map +1 -1
  77. package/dist/session/login-guard.js +156 -84
  78. package/dist/session/login-guard.js.map +1 -1
  79. package/dist/session/sepa-accounts.d.ts +20 -14
  80. package/dist/session/sepa-accounts.d.ts.map +1 -1
  81. package/dist/session/sepa-accounts.js +62 -46
  82. package/dist/session/sepa-accounts.js.map +1 -1
  83. package/dist/session/session-setup.d.ts +33 -25
  84. package/dist/session/session-setup.d.ts.map +1 -1
  85. package/dist/session/session-setup.js +87 -65
  86. package/dist/session/session-setup.js.map +1 -1
  87. package/dist/session/session-state.d.ts +9 -6
  88. package/dist/session/session-state.d.ts.map +1 -1
  89. package/dist/session/session-state.js +52 -17
  90. package/dist/session/session-state.js.map +1 -1
  91. package/dist/session/signed-dialog.d.ts +77 -0
  92. package/dist/session/signed-dialog.d.ts.map +1 -0
  93. package/dist/session/signed-dialog.js +170 -0
  94. package/dist/session/signed-dialog.js.map +1 -0
  95. package/dist/session/tan-selection.d.ts +26 -18
  96. package/dist/session/tan-selection.d.ts.map +1 -1
  97. package/dist/session/tan-selection.js +44 -33
  98. package/dist/session/tan-selection.js.map +1 -1
  99. package/dist/session/user-prompts.d.ts +8 -4
  100. package/dist/session/user-prompts.d.ts.map +1 -1
  101. package/dist/session/user-prompts.js +34 -14
  102. package/dist/session/user-prompts.js.map +1 -1
  103. package/dist/tan/challenge.d.ts +34 -13
  104. package/dist/tan/challenge.d.ts.map +1 -1
  105. package/dist/tan/challenge.js +25 -26
  106. package/dist/tan/challenge.js.map +1 -1
  107. package/dist/tan/flicker.d.ts +7 -1
  108. package/dist/tan/flicker.d.ts.map +1 -1
  109. package/dist/tan/flicker.js +40 -6
  110. package/dist/tan/flicker.js.map +1 -1
  111. package/dist/tan/tan-image.d.ts +3 -2
  112. package/dist/tan/tan-image.d.ts.map +1 -1
  113. package/dist/tan/tan-image.js +7 -5
  114. package/dist/tan/tan-image.js.map +1 -1
  115. package/dist/tan/tan-models.d.ts +5 -1
  116. package/dist/tan/tan-models.d.ts.map +1 -1
  117. package/dist/tan/tan-models.js +10 -5
  118. package/dist/tan/tan-models.js.map +1 -1
  119. package/dist/util/async.d.ts +0 -2
  120. package/dist/util/async.d.ts.map +1 -1
  121. package/dist/util/async.js +0 -4
  122. package/dist/util/async.js.map +1 -1
  123. package/dist/util/bytes.d.ts +2 -3
  124. package/dist/util/bytes.d.ts.map +1 -1
  125. package/dist/util/bytes.js +12 -20
  126. package/dist/util/bytes.js.map +1 -1
  127. package/dist/util/call-context.d.ts.map +1 -1
  128. package/dist/util/call-context.js +3 -2
  129. package/dist/util/call-context.js.map +1 -1
  130. package/dist/util/dates.d.ts +9 -16
  131. package/dist/util/dates.d.ts.map +1 -1
  132. package/dist/util/dates.js +39 -19
  133. package/dist/util/dates.js.map +1 -1
  134. package/dist/util/errors.d.ts +9 -1
  135. package/dist/util/errors.d.ts.map +1 -1
  136. package/dist/util/errors.js +12 -3
  137. package/dist/util/errors.js.map +1 -1
  138. package/dist/util/json.d.ts +4 -0
  139. package/dist/util/json.d.ts.map +1 -1
  140. package/dist/util/json.js +18 -0
  141. package/dist/util/json.js.map +1 -1
  142. package/dist/util/text.d.ts +21 -4
  143. package/dist/util/text.d.ts.map +1 -1
  144. package/dist/util/text.js +42 -13
  145. package/dist/util/text.js.map +1 -1
  146. package/dist/util/xml.d.ts +4 -3
  147. package/dist/util/xml.d.ts.map +1 -1
  148. package/dist/util/xml.js +37 -26
  149. package/dist/util/xml.js.map +1 -1
  150. package/dist/v3/account-extension.d.ts.map +1 -1
  151. package/dist/v3/account-extension.js +7 -10
  152. package/dist/v3/account-extension.js.map +1 -1
  153. package/dist/v3/bank-connection.d.ts +34 -0
  154. package/dist/v3/bank-connection.d.ts.map +1 -0
  155. package/dist/v3/bank-connection.js +58 -0
  156. package/dist/v3/bank-connection.js.map +1 -0
  157. package/dist/v3/dialog.d.ts +80 -46
  158. package/dist/v3/dialog.d.ts.map +1 -1
  159. package/dist/v3/dialog.js +162 -59
  160. package/dist/v3/dialog.js.map +1 -1
  161. package/dist/v3/message.d.ts +17 -4
  162. package/dist/v3/message.d.ts.map +1 -1
  163. package/dist/v3/message.js +62 -18
  164. package/dist/v3/message.js.map +1 -1
  165. package/dist/v3/parameter-store.d.ts +75 -0
  166. package/dist/v3/parameter-store.d.ts.map +1 -0
  167. package/dist/v3/parameter-store.js +143 -0
  168. package/dist/v3/parameter-store.js.map +1 -0
  169. package/dist/v3/parameters.d.ts +38 -12
  170. package/dist/v3/parameters.d.ts.map +1 -1
  171. package/dist/v3/parameters.js +91 -37
  172. package/dist/v3/parameters.js.map +1 -1
  173. package/dist/v3/protocol.d.ts +43 -50
  174. package/dist/v3/protocol.d.ts.map +1 -1
  175. package/dist/v3/protocol.js +58 -208
  176. package/dist/v3/protocol.js.map +1 -1
  177. package/dist/v3/queries.d.ts +51 -0
  178. package/dist/v3/queries.d.ts.map +1 -0
  179. package/dist/v3/queries.js +120 -0
  180. package/dist/v3/queries.js.map +1 -0
  181. package/dist/v3/segments.d.ts +29 -12
  182. package/dist/v3/segments.d.ts.map +1 -1
  183. package/dist/v3/segments.js +65 -23
  184. package/dist/v3/segments.js.map +1 -1
  185. package/dist/v3/syntax.d.ts +65 -14
  186. package/dist/v3/syntax.d.ts.map +1 -1
  187. package/dist/v3/syntax.js +167 -101
  188. package/dist/v3/syntax.js.map +1 -1
  189. package/package.json +10 -6
  190. package/src/client.ts +252 -0
  191. package/src/core/account.ts +86 -13
  192. package/src/core/amount.ts +3 -1
  193. package/src/core/balance.ts +6 -5
  194. package/src/core/bank-info.ts +1 -1
  195. package/src/core/client.ts +52 -15
  196. package/src/core/config.ts +69 -28
  197. package/src/core/errors.ts +122 -48
  198. package/src/core/feedback.ts +4 -1
  199. package/src/core/transaction.ts +9 -4
  200. package/src/core/transport.ts +98 -23
  201. package/src/formats/camt.ts +136 -39
  202. package/src/formats/mt940.ts +167 -81
  203. package/src/formats/readers.ts +24 -31
  204. package/src/formats/record-budget.ts +18 -0
  205. package/src/formats/sepa-purpose.ts +21 -2
  206. package/src/index.ts +4 -2
  207. package/src/session/app-approval.ts +51 -38
  208. package/src/session/dialog-runner.ts +31 -28
  209. package/src/session/login-guard.ts +174 -88
  210. package/src/session/sepa-accounts.ts +63 -45
  211. package/src/session/session-setup.ts +90 -71
  212. package/src/session/session-state.ts +56 -22
  213. package/src/session/signed-dialog.ts +192 -0
  214. package/src/session/tan-selection.ts +50 -39
  215. package/src/session/user-prompts.ts +35 -16
  216. package/src/tan/challenge.ts +40 -31
  217. package/src/tan/flicker.ts +44 -6
  218. package/src/tan/tan-image.ts +7 -5
  219. package/src/tan/tan-models.ts +10 -5
  220. package/src/util/async.ts +0 -5
  221. package/src/util/bytes.ts +13 -19
  222. package/src/util/call-context.ts +3 -2
  223. package/src/util/dates.ts +41 -24
  224. package/src/util/errors.ts +14 -3
  225. package/src/util/json.ts +16 -0
  226. package/src/util/text.ts +42 -12
  227. package/src/util/xml.ts +37 -26
  228. package/src/v3/account-extension.ts +7 -12
  229. package/src/v3/bank-connection.ts +67 -0
  230. package/src/v3/dialog.ts +175 -91
  231. package/src/v3/message.ts +69 -17
  232. package/src/v3/parameter-store.ts +160 -0
  233. package/src/v3/parameters.ts +110 -37
  234. package/src/v3/protocol.ts +70 -253
  235. package/src/v3/queries.ts +190 -0
  236. package/src/v3/segments.ts +65 -22
  237. package/src/v3/syntax.ts +153 -91
  238. package/dist/session/bank-connection.d.ts +0 -28
  239. package/dist/session/bank-connection.d.ts.map +0 -1
  240. package/dist/session/bank-connection.js +0 -48
  241. package/dist/session/bank-connection.js.map +0 -1
  242. package/dist/session/parameter-data.d.ts +0 -83
  243. package/dist/session/parameter-data.d.ts.map +0 -1
  244. package/dist/session/parameter-data.js +0 -68
  245. package/dist/session/parameter-data.js.map +0 -1
  246. package/dist/session/pin-tan-client.d.ts +0 -54
  247. package/dist/session/pin-tan-client.d.ts.map +0 -1
  248. package/dist/session/pin-tan-client.js +0 -153
  249. package/dist/session/pin-tan-client.js.map +0 -1
  250. package/dist/session/pin-tan-dialog.d.ts +0 -71
  251. package/dist/session/pin-tan-dialog.d.ts.map +0 -1
  252. package/dist/session/pin-tan-dialog.js +0 -124
  253. package/dist/session/pin-tan-dialog.js.map +0 -1
  254. package/dist/session/protocol.d.ts +0 -209
  255. package/dist/session/protocol.d.ts.map +0 -1
  256. package/dist/session/protocol.js +0 -75
  257. package/dist/session/protocol.js.map +0 -1
  258. package/dist/session/response-handler.d.ts +0 -48
  259. package/dist/session/response-handler.d.ts.map +0 -1
  260. package/dist/session/response-handler.js +0 -121
  261. package/dist/session/response-handler.js.map +0 -1
  262. package/dist/v3/client.d.ts +0 -24
  263. package/dist/v3/client.d.ts.map +0 -1
  264. package/dist/v3/client.js +0 -16
  265. package/dist/v3/client.js.map +0 -1
  266. package/src/session/bank-connection.ts +0 -51
  267. package/src/session/parameter-data.ts +0 -137
  268. package/src/session/pin-tan-client.ts +0 -186
  269. package/src/session/pin-tan-dialog.ts +0 -160
  270. package/src/session/protocol.ts +0 -311
  271. package/src/session/response-handler.ts +0 -130
  272. package/src/v3/client.ts +0 -29
@@ -1,59 +1,69 @@
1
- import { PinTanDialog } from '../session/pin-tan-dialog.js';
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 { Bpd3 } from './parameters.js';
4
+ import type { FinTs3Protocol } from './protocol.js';
6
5
  import type { SegmentSpec } from './syntax.js';
7
- /** How a message is signed: the security function of the TAN method and the customer system ID. */
8
- export interface Signing3 {
9
- readonly securityFunction: string;
10
- readonly systemId: string;
11
- }
12
- /**
13
- * What a dialog needs from the session: the parameter data received so far, the segments that open a dialog, and the
14
- * way to the bank. The `FinTs3Protocol` provides it, and keeps the login data and the PIN to itself.
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
- * Sends `segments` as message `number` of the dialog `dialogId` and returns the bank's answer, not yet parsed.
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
- post(message: {
30
- dialogId: string;
31
- number: number;
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
- /** One FinTS 3.0 dialog: numbered messages under the dialog ID the bank assigns in its first answer. */
38
- export declare class FinTs3Dialog extends PinTanDialog<IncomingMessage3, SegmentSpec> {
39
- private readonly host;
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(host: FinTs3DialogHost, method: TanMethod, tanMedium?: string): FinTs3Dialog;
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(host: FinTs3DialogHost): FinTs3Dialog;
47
- protected get bankParameters(): Bpd3 | undefined;
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
- * Opens the dialog, asking strong authentication for `order` with a two-step method, then sends `order` in the next
54
- * message.
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): StartWithOrder<IncomingMessage3>;
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
- protected sendEnd(): Promise<void>;
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
- * The approval a HITAN segment of process 4 asks for, answered with HKTAN process 2 (TAN) or S (status).
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
- * Throws `FinTsProtocolError` for an app approval with a method of HITANS #6: the status request (process S) came with
71
- * version 7, along with app approvals (PIN/TAN B.5.2).
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
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/v3/dialog.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAW/C,mGAAmG;AACnG,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,QAAQ,CAAC,cAAc,EAAE,IAAI,GAAG,SAAS,CAAC;IAE1C,wFAAwF;IACxF,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAEtC,0FAA0F;IAC1F,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,WAAW,EAAE,CAAC;IAEnE;;;;;OAKG;IACH,IAAI,CAAC,OAAO,EAAE;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;QACjC,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC;QAC9B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;KACzB,GAAG,OAAO,CAAC,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AE,SAAS,CAAC,EAAE,MAAM,GAAG,YAAY;IAI5F,2EAA2E;IAC3E,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,cAAc,GAAG,YAAY;IAIxD,+DAA+D;IAC/D,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;;;;OAKG;IACH,OAAO,KAAK,QAAQ,GAEnB;IAED,OAAO,KAAK,WAAW,GAMtB;IAED,0GAA0G;IAC1G,OAAO,KAAK,SAAS,GAEpB;IAED,sGAAsG;IACtG,OAAO,KAAK,UAAU,GAErB;IAED,uFAAuF;IACvF,KAAK,CAAC,WAAW,UAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC;IASrD;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG;QAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;KACjD;IAWD;;;;;OAKG;IACH,qBAAqB,CAAC,WAAW,UAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAOrE,2FAA2F;IAC3F,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAMnD;;;;OAIG;IACG,GAAG,IAAI,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAWlD,mGAAmG;IACnG,OAAO,IAAI,IAAI;IAIf;;;;;;;;OAQG;IACH,eAAe,CAAC,QAAQ,EAAE,gBAAgB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,GAAG,SAAS;IA8BnF,OAAO,CAAC,UAAU;IASlB;;;;;;;;;;;;;;OAcG;YACW,YAAY;CA4B3B"}
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 { requireBankParameters } from '../session/parameter-data.js';
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
- /** One FinTS 3.0 dialog: numbered messages under the dialog ID the bank assigns in its first answer. */
16
- export class FinTs3Dialog extends PinTanDialog {
17
- host;
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
- constructor(host, method, tanMedium, anonymous) {
22
- super(method, tanMedium);
23
- this.host = host;
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 : (host.systemId ?? unassigned);
42
+ this.systemId = anonymous ? unassigned : (protocol.parameters.systemId ?? unassigned);
26
43
  }
27
- static signed(host, method, tanMedium) {
28
- return new FinTs3Dialog(host, method, tanMedium, false);
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(host) {
32
- return new FinTs3Dialog(host, TanMethod.oneStep, undefined, true);
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.host.initSegments(this.systemId),
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
- * Opens the dialog, asking strong authentication for `order` with a two-step method, then sends `order` in the next
55
- * message.
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.host.initSegments(this.systemId),
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.host.initSegments(unassigned, true),
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
- async sendEnd() {
83
- await this.sendSegments([Segments.dialogEnd(this.id)]);
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
- tanRequest(segmentType) {
86
- return Segments.tanProcess4(this.tanVersion, segmentType, this.mediumName);
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 a HITAN segment of process 4 asks for, answered with HKTAN process 2 (TAN) or S (status).
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
- * Throws `FinTsProtocolError` for an app approval with a method of HITANS #6: the status request (process S) came with
92
- * version 7, along with app approvals (PIN/TAN B.5.2).
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
- approvalIn(response) {
95
- const tan = tanResponseOf(response, '4');
96
- if (tan === undefined || tan.isDummy)
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
- if (hasCode(response.feedback, FeedbackCodes.decoupledPending) && this.tanVersion < firstDecoupledVersion) {
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 this.approvalOf(response, {
103
- reference,
104
- message: tan.challenge,
105
- hhdUc: tan.hhdUc,
106
- validUntil: tan.validUntil,
107
- tanMediumName: tan.mediumName,
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
- sendSegments(segments, tan) {
115
- return this.transmit((number) => this.host.post({
116
- dialogId: this.id,
117
- number,
118
- segments,
119
- signing: this.anonymous
120
- ? undefined
121
- : { securityFunction: this.method.securityFunction, systemId: this.systemId },
122
- tan,
123
- }), (answer) => IncomingMessage3.parse(answer));
124
- }
125
- /** The bank assigns the dialog ID in its answer to the first message. */
126
- readDialogData(response) {
127
- if (this.id === unassigned)
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`. */
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/v3/dialog.ts"],"names":[],"mappings":"AAAA,uHAAuH;AAEvH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO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AC,GAAG,EAAE,CAAC;QAC5D,IAAI,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,eAAe,CAAC;YAAE,IAAI,CAAC,OAAO,EAAE,CAAC;QAChG,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAED,6DAA6D;AAC7D,SAAS,aAAa,CAAC,QAA0B,EAAE,OAAe;IAChE,OAAO,QAAQ;SACZ,OAAO,CAAC,OAAO,CAAC;SAChB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAChC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC;AACxC,CAAC"}
@@ -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 implements BankResponse {
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 a FinTS message, such as the HTML page of a proxy or a
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
  }
@@ -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;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAM3D,OAAO,EAAyB,KAAK,OAAO,EAAE,WAAW,EAAqB,MAAM,aAAa,CAAC;AAElG,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,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