@coderoftime/fints 0.0.0-stage → 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 (249) hide show
  1. package/CHANGELOG.md +152 -0
  2. package/LICENSE +28 -0
  3. package/README.md +246 -2
  4. package/dist/client.d.ts +48 -0
  5. package/dist/client.d.ts.map +1 -0
  6. package/dist/client.js +199 -0
  7. package/dist/client.js.map +1 -0
  8. package/dist/core/account.d.ts +168 -0
  9. package/dist/core/account.d.ts.map +1 -0
  10. package/dist/core/account.js +245 -0
  11. package/dist/core/account.js.map +1 -0
  12. package/dist/core/amount.d.ts +63 -0
  13. package/dist/core/amount.d.ts.map +1 -0
  14. package/dist/core/amount.js +192 -0
  15. package/dist/core/amount.js.map +1 -0
  16. package/dist/core/balance.d.ts +55 -0
  17. package/dist/core/balance.d.ts.map +1 -0
  18. package/dist/core/balance.js +54 -0
  19. package/dist/core/balance.js.map +1 -0
  20. package/dist/core/bank-info.d.ts +49 -0
  21. package/dist/core/bank-info.d.ts.map +1 -0
  22. package/dist/core/bank-info.js +52 -0
  23. package/dist/core/bank-info.js.map +1 -0
  24. package/dist/core/client.d.ts +161 -0
  25. package/dist/core/client.d.ts.map +1 -0
  26. package/dist/core/client.js +2 -0
  27. package/dist/core/client.js.map +1 -0
  28. package/dist/core/config.d.ts +80 -0
  29. package/dist/core/config.d.ts.map +1 -0
  30. package/dist/core/config.js +153 -0
  31. package/dist/core/config.js.map +1 -0
  32. package/dist/core/errors.d.ts +153 -0
  33. package/dist/core/errors.d.ts.map +1 -0
  34. package/dist/core/errors.js +247 -0
  35. package/dist/core/errors.js.map +1 -0
  36. package/dist/core/feedback.d.ts +72 -0
  37. package/dist/core/feedback.d.ts.map +1 -0
  38. package/dist/core/feedback.js +127 -0
  39. package/dist/core/feedback.js.map +1 -0
  40. package/dist/core/transaction.d.ts +103 -0
  41. package/dist/core/transaction.d.ts.map +1 -0
  42. package/dist/core/transaction.js +96 -0
  43. package/dist/core/transaction.js.map +1 -0
  44. package/dist/core/transport.d.ts +64 -0
  45. package/dist/core/transport.d.ts.map +1 -0
  46. package/dist/core/transport.js +149 -0
  47. package/dist/core/transport.js.map +1 -0
  48. package/dist/formats/camt.d.ts +32 -0
  49. package/dist/formats/camt.d.ts.map +1 -0
  50. package/dist/formats/camt.js +242 -0
  51. package/dist/formats/camt.js.map +1 -0
  52. package/dist/formats/mt940.d.ts +54 -0
  53. package/dist/formats/mt940.d.ts.map +1 -0
  54. package/dist/formats/mt940.js +376 -0
  55. package/dist/formats/mt940.js.map +1 -0
  56. package/dist/formats/readers.d.ts +15 -0
  57. package/dist/formats/readers.d.ts.map +1 -0
  58. package/dist/formats/readers.js +42 -0
  59. package/dist/formats/readers.js.map +1 -0
  60. package/dist/formats/record-budget.d.ts +7 -0
  61. package/dist/formats/record-budget.d.ts.map +1 -0
  62. package/dist/formats/record-budget.js +17 -0
  63. package/dist/formats/record-budget.js.map +1 -0
  64. package/dist/formats/sepa-purpose.d.ts +28 -0
  65. package/dist/formats/sepa-purpose.d.ts.map +1 -0
  66. package/dist/formats/sepa-purpose.js +89 -0
  67. package/dist/formats/sepa-purpose.js.map +1 -0
  68. package/dist/index.d.ts +28 -0
  69. package/dist/index.d.ts.map +1 -0
  70. package/dist/index.js +27 -0
  71. package/dist/index.js.map +1 -0
  72. package/dist/session/app-approval.d.ts +66 -0
  73. package/dist/session/app-approval.d.ts.map +1 -0
  74. package/dist/session/app-approval.js +226 -0
  75. package/dist/session/app-approval.js.map +1 -0
  76. package/dist/session/dialog-runner.d.ts +31 -0
  77. package/dist/session/dialog-runner.d.ts.map +1 -0
  78. package/dist/session/dialog-runner.js +111 -0
  79. package/dist/session/dialog-runner.js.map +1 -0
  80. package/dist/session/login-guard.d.ts +78 -0
  81. package/dist/session/login-guard.d.ts.map +1 -0
  82. package/dist/session/login-guard.js +181 -0
  83. package/dist/session/login-guard.js.map +1 -0
  84. package/dist/session/sepa-accounts.d.ts +40 -0
  85. package/dist/session/sepa-accounts.d.ts.map +1 -0
  86. package/dist/session/sepa-accounts.js +112 -0
  87. package/dist/session/sepa-accounts.js.map +1 -0
  88. package/dist/session/session-setup.d.ts +80 -0
  89. package/dist/session/session-setup.d.ts.map +1 -0
  90. package/dist/session/session-setup.js +182 -0
  91. package/dist/session/session-setup.js.map +1 -0
  92. package/dist/session/session-state.d.ts +50 -0
  93. package/dist/session/session-state.d.ts.map +1 -0
  94. package/dist/session/session-state.js +182 -0
  95. package/dist/session/session-state.js.map +1 -0
  96. package/dist/session/signed-dialog.d.ts +77 -0
  97. package/dist/session/signed-dialog.d.ts.map +1 -0
  98. package/dist/session/signed-dialog.js +170 -0
  99. package/dist/session/signed-dialog.js.map +1 -0
  100. package/dist/session/tan-selection.d.ts +96 -0
  101. package/dist/session/tan-selection.d.ts.map +1 -0
  102. package/dist/session/tan-selection.js +189 -0
  103. package/dist/session/tan-selection.js.map +1 -0
  104. package/dist/session/user-prompts.d.ts +65 -0
  105. package/dist/session/user-prompts.d.ts.map +1 -0
  106. package/dist/session/user-prompts.js +184 -0
  107. package/dist/session/user-prompts.js.map +1 -0
  108. package/dist/tan/challenge.d.ts +135 -0
  109. package/dist/tan/challenge.d.ts.map +1 -0
  110. package/dist/tan/challenge.js +184 -0
  111. package/dist/tan/challenge.js.map +1 -0
  112. package/dist/tan/flicker.d.ts +42 -0
  113. package/dist/tan/flicker.d.ts.map +1 -0
  114. package/dist/tan/flicker.js +296 -0
  115. package/dist/tan/flicker.js.map +1 -0
  116. package/dist/tan/tan-image.d.ts +22 -0
  117. package/dist/tan/tan-image.d.ts.map +1 -0
  118. package/dist/tan/tan-image.js +43 -0
  119. package/dist/tan/tan-image.js.map +1 -0
  120. package/dist/tan/tan-models.d.ts +149 -0
  121. package/dist/tan/tan-models.d.ts.map +1 -0
  122. package/dist/tan/tan-models.js +153 -0
  123. package/dist/tan/tan-models.js.map +1 -0
  124. package/dist/util/async.d.ts +22 -0
  125. package/dist/util/async.d.ts.map +1 -0
  126. package/dist/util/async.js +45 -0
  127. package/dist/util/async.js.map +1 -0
  128. package/dist/util/bytes.d.ts +22 -0
  129. package/dist/util/bytes.d.ts.map +1 -0
  130. package/dist/util/bytes.js +128 -0
  131. package/dist/util/bytes.js.map +1 -0
  132. package/dist/util/call-context.d.ts +12 -0
  133. package/dist/util/call-context.d.ts.map +1 -0
  134. package/dist/util/call-context.js +30 -0
  135. package/dist/util/call-context.js.map +1 -0
  136. package/dist/util/dates.d.ts +55 -0
  137. package/dist/util/dates.d.ts.map +1 -0
  138. package/dist/util/dates.js +189 -0
  139. package/dist/util/dates.js.map +1 -0
  140. package/dist/util/errors.d.ts +17 -0
  141. package/dist/util/errors.d.ts.map +1 -0
  142. package/dist/util/errors.js +24 -0
  143. package/dist/util/errors.js.map +1 -0
  144. package/dist/util/immutable-map.d.ts +16 -0
  145. package/dist/util/immutable-map.d.ts.map +1 -0
  146. package/dist/util/immutable-map.js +38 -0
  147. package/dist/util/immutable-map.js.map +1 -0
  148. package/dist/util/json.d.ts +17 -0
  149. package/dist/util/json.d.ts.map +1 -0
  150. package/dist/util/json.js +62 -0
  151. package/dist/util/json.js.map +1 -0
  152. package/dist/util/text.d.ts +37 -0
  153. package/dist/util/text.d.ts.map +1 -0
  154. package/dist/util/text.js +107 -0
  155. package/dist/util/text.js.map +1 -0
  156. package/dist/util/xml.d.ts +36 -0
  157. package/dist/util/xml.d.ts.map +1 -0
  158. package/dist/util/xml.js +194 -0
  159. package/dist/util/xml.js.map +1 -0
  160. package/dist/v3/account-extension.d.ts +25 -0
  161. package/dist/v3/account-extension.d.ts.map +1 -0
  162. package/dist/v3/account-extension.js +173 -0
  163. package/dist/v3/account-extension.js.map +1 -0
  164. package/dist/v3/bank-connection.d.ts +34 -0
  165. package/dist/v3/bank-connection.d.ts.map +1 -0
  166. package/dist/v3/bank-connection.js +58 -0
  167. package/dist/v3/bank-connection.js.map +1 -0
  168. package/dist/v3/dialog.d.ts +112 -0
  169. package/dist/v3/dialog.d.ts.map +1 -0
  170. package/dist/v3/dialog.js +241 -0
  171. package/dist/v3/dialog.js.map +1 -0
  172. package/dist/v3/message.d.ts +85 -0
  173. package/dist/v3/message.d.ts.map +1 -0
  174. package/dist/v3/message.js +303 -0
  175. package/dist/v3/message.js.map +1 -0
  176. package/dist/v3/parameter-store.d.ts +75 -0
  177. package/dist/v3/parameter-store.d.ts.map +1 -0
  178. package/dist/v3/parameter-store.js +143 -0
  179. package/dist/v3/parameter-store.js.map +1 -0
  180. package/dist/v3/parameters.d.ts +105 -0
  181. package/dist/v3/parameters.d.ts.map +1 -0
  182. package/dist/v3/parameters.js +450 -0
  183. package/dist/v3/parameters.js.map +1 -0
  184. package/dist/v3/protocol.d.ts +61 -0
  185. package/dist/v3/protocol.d.ts.map +1 -0
  186. package/dist/v3/protocol.js +113 -0
  187. package/dist/v3/protocol.js.map +1 -0
  188. package/dist/v3/queries.d.ts +51 -0
  189. package/dist/v3/queries.d.ts.map +1 -0
  190. package/dist/v3/queries.js +120 -0
  191. package/dist/v3/queries.js.map +1 -0
  192. package/dist/v3/segments.d.ts +106 -0
  193. package/dist/v3/segments.d.ts.map +1 -0
  194. package/dist/v3/segments.js +325 -0
  195. package/dist/v3/segments.js.map +1 -0
  196. package/dist/v3/syntax.d.ts +127 -0
  197. package/dist/v3/syntax.d.ts.map +1 -0
  198. package/dist/v3/syntax.js +367 -0
  199. package/dist/v3/syntax.js.map +1 -0
  200. package/package.json +67 -4
  201. package/src/client.ts +252 -0
  202. package/src/core/account.ts +323 -0
  203. package/src/core/amount.ts +211 -0
  204. package/src/core/balance.ts +85 -0
  205. package/src/core/bank-info.ts +66 -0
  206. package/src/core/client.ts +186 -0
  207. package/src/core/config.ts +182 -0
  208. package/src/core/errors.ts +277 -0
  209. package/src/core/feedback.ts +140 -0
  210. package/src/core/transaction.ts +161 -0
  211. package/src/core/transport.ts +189 -0
  212. package/src/formats/camt.ts +266 -0
  213. package/src/formats/mt940.ts +419 -0
  214. package/src/formats/readers.ts +49 -0
  215. package/src/formats/record-budget.ts +18 -0
  216. package/src/formats/sepa-purpose.ts +94 -0
  217. package/src/index.ts +70 -0
  218. package/src/session/app-approval.ts +278 -0
  219. package/src/session/dialog-runner.ts +122 -0
  220. package/src/session/login-guard.ts +221 -0
  221. package/src/session/sepa-accounts.ts +115 -0
  222. package/src/session/session-setup.ts +184 -0
  223. package/src/session/session-state.ts +204 -0
  224. package/src/session/signed-dialog.ts +192 -0
  225. package/src/session/tan-selection.ts +203 -0
  226. package/src/session/user-prompts.ts +193 -0
  227. package/src/tan/challenge.ts +261 -0
  228. package/src/tan/flicker.ts +308 -0
  229. package/src/tan/tan-image.ts +38 -0
  230. package/src/tan/tan-models.ts +252 -0
  231. package/src/util/async.ts +48 -0
  232. package/src/util/bytes.ts +129 -0
  233. package/src/util/call-context.ts +41 -0
  234. package/src/util/dates.ts +210 -0
  235. package/src/util/errors.ts +27 -0
  236. package/src/util/immutable-map.ts +47 -0
  237. package/src/util/json.ts +67 -0
  238. package/src/util/text.ts +112 -0
  239. package/src/util/xml.ts +183 -0
  240. package/src/v3/account-extension.ts +185 -0
  241. package/src/v3/bank-connection.ts +67 -0
  242. package/src/v3/dialog.ts +283 -0
  243. package/src/v3/message.ts +373 -0
  244. package/src/v3/parameter-store.ts +160 -0
  245. package/src/v3/parameters.ts +524 -0
  246. package/src/v3/protocol.ts +148 -0
  247. package/src/v3/queries.ts +190 -0
  248. package/src/v3/segments.ts +374 -0
  249. package/src/v3/syntax.ts +369 -0
@@ -0,0 +1,170 @@
1
+ import { requireLatin1 } from '../core/config.js';
2
+ import { bankErrorFor, FinTsLoginDataChangedError, FinTsProtocolError, FinTsTanCancelledError, } from '../core/errors.js';
3
+ import { allowedTanMethodsIn, FeedbackCodes, hasCode, hasErrors, userWarnings } from '../core/feedback.js';
4
+ import { invalidArgument } from '../util/errors.js';
5
+ import { IncomingMessage3 } from '../v3/message.js';
6
+ import { appApprovalWait } from './app-approval.js';
7
+ /**
8
+ * A dialog signed with the PIN, which settles each answer before it hands it out: it keeps the parameter data of the
9
+ * dialog's opening, passes the notices on, has the `LoginGuard` judge the answer and throws its errors, and completes
10
+ * the approval the bank asks for. The session sends every message signed with the PIN through it, so that the guard
11
+ * judges every answer, that to the dialog's end included.
12
+ */
13
+ export class SignedDialog {
14
+ dialog;
15
+ session;
16
+ constructor(dialog, session) {
17
+ this.dialog = dialog;
18
+ this.session = session;
19
+ }
20
+ /** Whether the bank knows this dialog and it has not ended. */
21
+ get isActive() {
22
+ return this.dialog.isActive;
23
+ }
24
+ /** Logs in, which opens the dialog; with `synchronize` the bank also assigns a customer system ID. */
25
+ async login(synchronize = false) {
26
+ return this.settle(await this.dialog.start(synchronize), 'login');
27
+ }
28
+ /**
29
+ * Logs in, asking strong authentication for `order`, then sends `order` in a message of its own, as for listing the
30
+ * TAN media while no medium is chosen yet (`FinTs3Dialog.startWith`); returns both answers.
31
+ */
32
+ async loginWith(order) {
33
+ const start = this.dialog.startWith(order);
34
+ const login = await this.settle(await start.login(), 'login');
35
+ return [login, await this.settle(await start.order(), 'order')];
36
+ }
37
+ /** Sends `order`, the first page of a query, and completes the approval the bank asks for. */
38
+ async send(order) {
39
+ return this.settle(await this.dialog.send(order), 'order');
40
+ }
41
+ /**
42
+ * Sends `order` for a further page of a query (Formals B.6.3), whose answer must not ask for an approval: the client
43
+ * completes that of the first page only, so that a bank that asks anew for every page cannot prompt the user once per
44
+ * page. Throws `FinTsProtocolError` if it asks for one.
45
+ */
46
+ async sendFurtherPage(order) {
47
+ const response = await this.dialog.send(order);
48
+ this.receive(response, 'order', false);
49
+ if (this.dialog.approvalAskedIn(response) !== undefined) {
50
+ throw new FinTsProtocolError('The bank asks for an approval of a further page of the same query');
51
+ }
52
+ return response;
53
+ }
54
+ /**
55
+ * Ends the dialog at the bank; does nothing if it is not active. Of the answer only a rejected PIN counts, which the
56
+ * guard judges: the dialog is over either way.
57
+ */
58
+ async end() {
59
+ const response = await this.dialog.end();
60
+ if (response !== undefined && hasErrors(response.feedback)) {
61
+ this.session.guard.judge(bankErrorFor(response.feedback), 'order', this.dialog.method);
62
+ }
63
+ }
64
+ /**
65
+ * Receives `response`, the answer to a request of `kind`: keeps its parameter data where it answers the `opening` of
66
+ * the dialog, the login or its approval, even alongside errors, since the remedy for a refused login may need them;
67
+ * passes its notices on; and has the guard judge it, then throws its errors, as the refusal of the login where they
68
+ * amount to one.
69
+ */
70
+ receive(response, kind, opening) {
71
+ if (opening)
72
+ this.session.parameters.keep(response);
73
+ this.readNotices(response);
74
+ const error = hasErrors(response.feedback) ? bankErrorFor(response.feedback, kind === 'approval') : undefined;
75
+ const refusal = this.session.guard.judge(error, kind, this.dialog.method);
76
+ // Every further message of a refused login's dialog would carry the refused PIN.
77
+ if (refusal !== undefined)
78
+ this.dialog.discard();
79
+ if (error !== undefined)
80
+ throw refusal ?? error;
81
+ }
82
+ /**
83
+ * Where `response` answers a login, a request of `kind` other than `order`, or its approval with new login data: ends
84
+ * the dialog, stops the client from logging in with the old ones, and fails the call with
85
+ * `FinTsLoginDataChangedError` (Rückmeldungscodes C.6). It runs before any approval, which would cost the user a TAN
86
+ * for a session that ends anyway. New login data next to an error are the login's refusal already
87
+ * (`loginRefusalFor`).
88
+ */
89
+ async retireOldLoginData(response, kind) {
90
+ if (kind === 'order' || !hasCode(response.feedback, FeedbackCodes.newLoginData))
91
+ return;
92
+ await this.end();
93
+ const error = new FinTsLoginDataChangedError(response.feedback);
94
+ throw this.session.guard.judge(error, kind, this.dialog.method) ?? error;
95
+ }
96
+ /**
97
+ * Receives `response`, the answer to a request of `kind`, then completes the approval it asks for; returns it joined
98
+ * with the response that completes the approval.
99
+ *
100
+ * Throws `FinTsProtocolError` if that response asks for an approval once more: the bank has not executed the message
101
+ * then either, and read as done it would report an empty result.
102
+ */
103
+ async settle(response, kind) {
104
+ const opening = kind !== 'order';
105
+ this.receive(response, kind, opening);
106
+ await this.retireOldLoginData(response, kind);
107
+ const approval = this.dialog.approvalAskedIn(response);
108
+ if (approval === undefined)
109
+ return response;
110
+ const approved = approval.challenge.isDecoupled
111
+ ? await this.awaitAppApproval(approval, opening)
112
+ : await this.enterTan(approval, opening);
113
+ await this.retireOldLoginData(approved, kind);
114
+ if (this.dialog.approvalAskedIn(approved) !== undefined) {
115
+ throw new FinTsProtocolError('The bank asks for another approval in answer to the approval');
116
+ }
117
+ return IncomingMessage3.combine(response, approved);
118
+ }
119
+ /** Passes on the notices in `response`: the TAN methods the user may use (3920), the bank's messages and warnings. */
120
+ readNotices(response) {
121
+ const allowed = allowedTanMethodsIn(response.feedback);
122
+ if (allowed.length > 0)
123
+ this.session.state.rememberAllowedMethods(allowed);
124
+ for (const message of response.bankMessages)
125
+ this.session.prompts.showBankMessage(message);
126
+ for (const warning of userWarnings(response.feedback))
127
+ this.session.prompts.showWarning(warning);
128
+ }
129
+ /** Asks the user for the TAN `approval` takes and sends it; `opening` tells whether it approves the login. */
130
+ async enterTan(approval, opening) {
131
+ const answer = await this.session.prompts.askTan(approval.challenge);
132
+ if (answer.kind === 'approved') {
133
+ throw invalidArgument('Answered a TAN challenge with an approval in the banking app', 'tanCallback');
134
+ }
135
+ // NFKC, so that digits of another width, such as those of a Japanese input method, go out as the digits they are.
136
+ const tan = answer.kind === 'tan' ? answer.tan.normalize('NFKC').trim() : '';
137
+ if (tan === '')
138
+ throw new FinTsTanCancelledError();
139
+ const response = await approval.submitTan(requireTanOf(approval.challenge.method, tan));
140
+ this.receive(response, 'approval', opening);
141
+ return response;
142
+ }
143
+ /** Waits for the user to approve in the banking app; `opening` tells whether the approval is that of the login. */
144
+ awaitAppApproval(approval, opening) {
145
+ const prompts = this.session.prompts;
146
+ return appApprovalWait(approval, {
147
+ ask: (challenge) => prompts.askTan(challenge),
148
+ pause: (delayMs, interrupt) => prompts.pause(delayMs, interrupt),
149
+ receive: (response) => {
150
+ this.receive(response, 'approval', opening);
151
+ },
152
+ }).run();
153
+ }
154
+ }
155
+ /**
156
+ * Throws `TypeError` for a TAN that `method` rules out, which the bank would count as a failed attempt: one longer than
157
+ * `TanMethod.maxTanLength`, or with other characters than digits for a `TanMethod.numericTan` method; and for one that
158
+ * FinTS 3.0 cannot send. The message leaves out the TAN.
159
+ */
160
+ function requireTanOf(method, tan) {
161
+ const max = method.maxTanLength;
162
+ if (max !== undefined && max > 0 && tan.length > max) {
163
+ throw invalidArgument(`The TAN method ${method.name} takes TANs of at most ${max} characters`, 'tan');
164
+ }
165
+ if (method.numericTan && !/^[0-9]+$/.test(tan)) {
166
+ throw invalidArgument(`The TAN method ${method.name} takes digits only`, 'tan');
167
+ }
168
+ return requireLatin1(tan, 'tan');
169
+ }
170
+ //# sourceMappingURL=signed-dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signed-dialog.js","sourceRoot":"","sources":["../../src/session/signed-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACL,YAAY,EACZ,0BAA0B,EAC1B,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE3G,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAapD;;;;;GAKG;AACH,MAAM,OAAO,YAAY;IAEJ;IACA;IAFnB,YACmB,MAAoB,EACpB,OAAqB;QADrB,WAAM,GAAN,MAAM,CAAc;QACpB,YAAO,GAAP,OAAO,CAAc;IACrC,CAAC;IAEJ,+DAA+D;IAC/D,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;IAC9B,CAAC;IAED,sGAAsG;IACtG,KAAK,CAAC,KAAK,CAAC,WAAW,GAAG,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AO,CAAC;QACrC,OAAO,eAAe,CAAC,QAAQ,EAAE;YAC/B,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;YAC7C,KAAK,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC;YAChE,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE;gBACpB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;YAC9C,CAAC;SACF,CAAC,CAAC,GAAG,EAAE,CAAC;IACX,CAAC;CACF;AAED;;;;GAIG;AACH,SAAS,YAAY,CAAC,MAAiB,EAAE,GAAW;IAClD,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC;IAChC,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;QACrD,MAAM,eAAe,CAAC,kBAAkB,MAAM,CAAC,IAAI,0BAA0B,GAAG,aAAa,EAAE,KAAK,CAAC,CAAC;IACxG,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,MAAM,eAAe,CAAC,kBAAkB,MAAM,CAAC,IAAI,oBAAoB,EAAE,KAAK,CAAC,CAAC;IAClF,CAAC;IACD,OAAO,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,96 @@
1
+ import { TanMethod, type TanMedium } from '../tan/tan-models.js';
2
+ import { FinTs3Dialog } from '../v3/dialog.js';
3
+ import type { FinTs3Protocol } from '../v3/protocol.js';
4
+ import type { SessionState } from './session-state.js';
5
+ import type { UserPrompts } from './user-prompts.js';
6
+ /**
7
+ * The TAN method and medium the session's messages are signed with, chosen by the user among what the bank offers and
8
+ * the user may use, and kept in the session state.
9
+ */
10
+ export declare class TanSelection {
11
+ private readonly protocol;
12
+ private readonly state;
13
+ private readonly prompts;
14
+ /**
15
+ * The lookups of this session that found no medium to choose, by TAN method, with the list each gave; `undefined`
16
+ * where the bank gave none. Such a lookup is not repeated for its method until `select` or `forgetMedium` drops it.
17
+ */
18
+ private readonly lookupsWithoutMedium;
19
+ /** Whether the bank refused a login signed with the one-step method in this session. */
20
+ private oneStepRefused;
21
+ constructor(protocol: FinTs3Protocol, state: SessionState, prompts: UserPrompts);
22
+ /** The TAN method in use; the one-step method until one is chosen. */
23
+ get method(): TanMethod;
24
+ /** Switches to `securityFunction` and `tanMedium` for the dialogs to come. */
25
+ select(securityFunction: string, tanMedium: string | undefined): void;
26
+ /**
27
+ * Forgets the medium in use and the lookups of this session, so that the next login looks the media up anew where the
28
+ * method needs one: the bank may have refused the medium, such as that of a phone the user has replaced.
29
+ */
30
+ forgetMedium(): void;
31
+ /**
32
+ * A dialog signed with the TAN method in use and its medium.
33
+ *
34
+ * Throws `FinTsTanSetupError` if the method needs a medium the user has not chosen: the bank would refuse the
35
+ * login, and the client would not send the PIN again.
36
+ */
37
+ newDialog(): FinTs3Dialog;
38
+ /**
39
+ * The dialog that looks up the TAN media, signed with the TAN method in use.
40
+ *
41
+ * It runs before the medium is known, so it names a placeholder where the method needs one; the bank ignores the
42
+ * medium in this dialog (PIN/TAN B.4.3.1.3).
43
+ */
44
+ lookupDialog(): FinTs3Dialog;
45
+ /**
46
+ * The synchronization dialog. It runs before the TAN media are looked up, so its method must do without a medium the
47
+ * user has not chosen: the placeholder for one is meant for the lookup only (PIN/TAN B.4.3.1.3). The first method
48
+ * that does signs it:
49
+ * 1. the TAN method in use;
50
+ * 2. the one-step method, as for a user whose methods are not known yet (PIN/TAN B.4.3.1), unless the bank has refused
51
+ * a one-step login;
52
+ * 3. another two-step method the user may use.
53
+ *
54
+ * Throws `FinTsTanSetupError` if none does, before the bank could refuse the login.
55
+ */
56
+ synchronizationDialog(): FinTs3Dialog;
57
+ /** Whether `method` needs a medium the user has not chosen. */
58
+ private lacksMedium;
59
+ /**
60
+ * The two-step TAN methods the bank offers, the user may use and this client can run; the one-step method if there
61
+ * are none.
62
+ *
63
+ * Throws `FinTsTanSetupError` if the bank offers the user nothing but methods the client cannot run.
64
+ */
65
+ available(): TanMethod[];
66
+ /**
67
+ * Stops using `rejected`, the method of a login the bank refused; returns whether another available method is left.
68
+ *
69
+ * The user chooses that method, unless the one in use is still available: a refused one-step synchronization does
70
+ * not rule out the method the user chose before.
71
+ */
72
+ replace(rejected: TanMethod): Promise<boolean>;
73
+ /** Keeps the chosen TAN method if it is still available, otherwise lets the user choose. */
74
+ ensureMethodChosen(): Promise<void>;
75
+ /**
76
+ * Whether the media of the method in use have to be looked up: it needs a medium the user has not chosen, and they
77
+ * were not looked up in vain for it in this session.
78
+ */
79
+ get mediumToLookUp(): boolean;
80
+ /**
81
+ * Lets the user choose the medium of the method in use among the active ones in `media`, the result of a lookup;
82
+ * none where the lookup gave no list or no active medium.
83
+ */
84
+ chooseMedium(media: TanMedium[] | undefined): Promise<void>;
85
+ /**
86
+ * The list of the lookup that found no medium for the method in use; `undefined` where there was none, or the bank
87
+ * gave no list.
88
+ *
89
+ * It outlasts the call that failed for want of the medium, so that `getTanMedia` can show the user the list that tells
90
+ * why: the client neither looks the media up again for the method nor can list them in a dialog without a medium.
91
+ */
92
+ get lookedUpMedia(): TanMedium[] | undefined;
93
+ /** The name of the medium the user chooses among the active ones in `media`; `undefined` if none is active. */
94
+ private chooseMediumOf;
95
+ }
96
+ //# sourceMappingURL=tan-selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tan-selection.d.ts","sourceRoot":"","sources":["../../src/session/tan-selection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAA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AI,SAAS,EAAE,GAAG,SAAS,CAE3C;IAED,+GAA+G;YACjG,cAAc;CAQ7B"}
@@ -0,0 +1,189 @@
1
+ import { FinTsTanSetupError } from '../core/errors.js';
2
+ import { TanMethod } from '../tan/tan-models.js';
3
+ import { FinTs3Dialog } from '../v3/dialog.js';
4
+ import { noReference } from '../v3/segments.js';
5
+ /**
6
+ * The TAN method and medium the session's messages are signed with, chosen by the user among what the bank offers and
7
+ * the user may use, and kept in the session state.
8
+ */
9
+ export class TanSelection {
10
+ protocol;
11
+ state;
12
+ prompts;
13
+ /**
14
+ * The lookups of this session that found no medium to choose, by TAN method, with the list each gave; `undefined`
15
+ * where the bank gave none. Such a lookup is not repeated for its method until `select` or `forgetMedium` drops it.
16
+ */
17
+ lookupsWithoutMedium = new Map();
18
+ /** Whether the bank refused a login signed with the one-step method in this session. */
19
+ oneStepRefused = false;
20
+ constructor(protocol, state, prompts) {
21
+ this.protocol = protocol;
22
+ this.state = state;
23
+ this.prompts = prompts;
24
+ }
25
+ /** The TAN method in use; the one-step method until one is chosen. */
26
+ get method() {
27
+ const code = this.state.tanMethod;
28
+ if (code === undefined || code === TanMethod.oneStep.securityFunction)
29
+ return TanMethod.oneStep;
30
+ const methods = this.protocol.parameters.bankParameters?.tanMethods ?? [];
31
+ return methods.find((m) => m.securityFunction === code) ?? TanMethod.oneStep;
32
+ }
33
+ /** Switches to `securityFunction` and `tanMedium` for the dialogs to come. */
34
+ select(securityFunction, tanMedium) {
35
+ this.state.useTanMethod(securityFunction, tanMedium);
36
+ this.lookupsWithoutMedium.delete(securityFunction);
37
+ }
38
+ /**
39
+ * Forgets the medium in use and the lookups of this session, so that the next login looks the media up anew where the
40
+ * method needs one: the bank may have refused the medium, such as that of a phone the user has replaced.
41
+ */
42
+ forgetMedium() {
43
+ this.state.useTanMedium(undefined);
44
+ this.lookupsWithoutMedium.clear();
45
+ }
46
+ /**
47
+ * A dialog signed with the TAN method in use and its medium.
48
+ *
49
+ * Throws `FinTsTanSetupError` if the method needs a medium the user has not chosen: the bank would refuse the
50
+ * login, and the client would not send the PIN again.
51
+ */
52
+ newDialog() {
53
+ const method = this.method;
54
+ if (this.lacksMedium(method)) {
55
+ throw new FinTsTanSetupError(`The TAN method ${method.name} needs a TAN medium, and the client could not learn one: the bank lists no ` +
56
+ 'active medium for it, or does not offer or permit the list of TAN media, or rejected it. Pass a medium to ' +
57
+ 'selectTanMethod, or choose another method');
58
+ }
59
+ return FinTs3Dialog.signed(this.protocol, method, this.state.tanMedium);
60
+ }
61
+ /**
62
+ * The dialog that looks up the TAN media, signed with the TAN method in use.
63
+ *
64
+ * It runs before the medium is known, so it names a placeholder where the method needs one; the bank ignores the
65
+ * medium in this dialog (PIN/TAN B.4.3.1.3).
66
+ */
67
+ lookupDialog() {
68
+ const method = this.method;
69
+ return FinTs3Dialog.signed(this.protocol, method, this.lacksMedium(method) ? noReference : this.state.tanMedium);
70
+ }
71
+ /**
72
+ * The synchronization dialog. It runs before the TAN media are looked up, so its method must do without a medium the
73
+ * user has not chosen: the placeholder for one is meant for the lookup only (PIN/TAN B.4.3.1.3). The first method
74
+ * that does signs it:
75
+ * 1. the TAN method in use;
76
+ * 2. the one-step method, as for a user whose methods are not known yet (PIN/TAN B.4.3.1), unless the bank has refused
77
+ * a one-step login;
78
+ * 3. another two-step method the user may use.
79
+ *
80
+ * Throws `FinTsTanSetupError` if none does, before the bank could refuse the login.
81
+ */
82
+ synchronizationDialog() {
83
+ const method = this.method;
84
+ if (!this.lacksMedium(method))
85
+ return FinTs3Dialog.signed(this.protocol, method, this.state.tanMedium);
86
+ if (!this.oneStepRefused)
87
+ return FinTs3Dialog.signed(this.protocol, TanMethod.oneStep);
88
+ const other = this.available().find((m) => !m.isOneStep && !this.lacksMedium(m));
89
+ if (other !== undefined)
90
+ return FinTs3Dialog.signed(this.protocol, other);
91
+ throw new FinTsTanSetupError(`The bank refuses the one-step method, and the TAN method ${method.name} needs a TAN medium, which the client ` +
92
+ 'can look up only after the synchronization. Pass the medium to selectTanMethod, or choose another method');
93
+ }
94
+ /** Whether `method` needs a medium the user has not chosen. */
95
+ lacksMedium(method) {
96
+ return this.state.tanMedium === undefined && needsMediumChoice(method);
97
+ }
98
+ /**
99
+ * The two-step TAN methods the bank offers, the user may use and this client can run; the one-step method if there
100
+ * are none.
101
+ *
102
+ * Throws `FinTsTanSetupError` if the bank offers the user nothing but methods the client cannot run.
103
+ */
104
+ available() {
105
+ const bpd = this.protocol.parameters.bankParameters;
106
+ if (bpd === undefined)
107
+ return [TanMethod.oneStep];
108
+ const allowed = this.state.allowedMethods;
109
+ const isAllowed = (securityFunction) => allowed === undefined || allowed.length === 0 || allowed.includes(securityFunction);
110
+ const runnable = bpd.tanMethods.filter((m) => isAllowed(m.securityFunction));
111
+ if (runnable.length === 0 && bpd.unsupportedTanMethods.some(isAllowed)) {
112
+ throw new FinTsTanSetupError('The bank offers only TAN methods this client cannot run: process variant 1, or methods that need an SMS ' +
113
+ 'charge account or an HHD_UC answer');
114
+ }
115
+ return runnable.length === 0 ? [TanMethod.oneStep] : runnable;
116
+ }
117
+ /**
118
+ * Stops using `rejected`, the method of a login the bank refused; returns whether another available method is left.
119
+ *
120
+ * The user chooses that method, unless the one in use is still available: a refused one-step synchronization does
121
+ * not rule out the method the user chose before.
122
+ */
123
+ async replace(rejected) {
124
+ if (rejected.isOneStep)
125
+ this.oneStepRefused = true;
126
+ const others = this.available().filter((m) => m.securityFunction !== rejected.securityFunction);
127
+ if (others.some((m) => m.securityFunction === this.state.tanMethod))
128
+ return true;
129
+ if (others.length === 0)
130
+ return false;
131
+ this.state.useTanMethod((await this.prompts.chooseMethod(others)).securityFunction);
132
+ return true;
133
+ }
134
+ /** Keeps the chosen TAN method if it is still available, otherwise lets the user choose. */
135
+ async ensureMethodChosen() {
136
+ const candidates = this.available();
137
+ const method = candidates.find((m) => m.securityFunction === this.state.tanMethod) ??
138
+ (await this.prompts.chooseMethod(candidates));
139
+ if (method.securityFunction !== this.state.tanMethod)
140
+ this.state.useTanMethod(method.securityFunction);
141
+ }
142
+ /**
143
+ * Whether the media of the method in use have to be looked up: it needs a medium the user has not chosen, and they
144
+ * were not looked up in vain for it in this session.
145
+ */
146
+ get mediumToLookUp() {
147
+ const method = this.method;
148
+ return this.lacksMedium(method) && !this.lookupsWithoutMedium.has(method.securityFunction);
149
+ }
150
+ /**
151
+ * Lets the user choose the medium of the method in use among the active ones in `media`, the result of a lookup;
152
+ * none where the lookup gave no list or no active medium.
153
+ */
154
+ async chooseMedium(media) {
155
+ const method = this.method;
156
+ const medium = media === undefined ? undefined : await this.chooseMediumOf(method, media);
157
+ this.state.useTanMedium(medium);
158
+ if (medium === undefined)
159
+ this.lookupsWithoutMedium.set(method.securityFunction, media);
160
+ }
161
+ /**
162
+ * The list of the lookup that found no medium for the method in use; `undefined` where there was none, or the bank
163
+ * gave no list.
164
+ *
165
+ * It outlasts the call that failed for want of the medium, so that `getTanMedia` can show the user the list that tells
166
+ * why: the client neither looks the media up again for the method nor can list them in a dialog without a medium.
167
+ */
168
+ get lookedUpMedia() {
169
+ return this.lookupsWithoutMedium.get(this.method.securityFunction);
170
+ }
171
+ /** The name of the medium the user chooses among the active ones in `media`; `undefined` if none is active. */
172
+ async chooseMediumOf(method, media) {
173
+ const active = media.filter((m) => m.isActive && m.name !== undefined);
174
+ // HITAB version 5 names the method each medium belongs to; a medium of another method would not do.
175
+ const ofMethod = active.filter((m) => m.securityFunction === method.securityFunction);
176
+ const candidates = ofMethod.length === 0 ? active : ofMethod;
177
+ if (candidates.length === 0)
178
+ return undefined;
179
+ return (await this.prompts.chooseMedium(candidates)).name;
180
+ }
181
+ }
182
+ /**
183
+ * Whether messages signed with `method` must name the TAN medium: the method requires the name, and the user may have
184
+ * several media (PIN/TAN, HKTAN "Bezeichnung des TAN-Mediums").
185
+ */
186
+ function needsMediumChoice(method) {
187
+ return method.needsMediumName && (method.activeMediaCount ?? 0) > 1;
188
+ }
189
+ //# sourceMappingURL=tan-selection.js.map
@@ -0,0 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,gBAAgB,CAAC,CAAC;QACtF,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC7D,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QAC9C,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5D,CAAC;CACF;AAED;;;GAGG;AACH,SAAS,iBAAiB,CAAC,MAAiB;IAC1C,OAAO,MAAM,CAAC,eAAe,IAAI,CAAC,MAAM,CAAC,gBAAgB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;AACtE,CAAC"}
@@ -0,0 +1,65 @@
1
+ import type { BankMessage } from '../core/bank-info.js';
2
+ import type { FinTsClientOptions, MessageLogger } from '../core/client.js';
3
+ import type { FinTsFeedback } from '../core/feedback.js';
4
+ import { TanAnswer, type TanChallenge } from '../tan/challenge.js';
5
+ import type { TanMedium, TanMethod } from '../tan/tan-models.js';
6
+ /**
7
+ * Everything a session tells the app, asks of it or waits for: the bank's messages, warnings and log, the TAN callback,
8
+ * the selectors and the pauses between status requests.
9
+ *
10
+ * Once the client is closed nothing is told or asked, and every wait ends with `FinTsStateError`. Errors of the
11
+ * callbacks that only inform the app wait for `reportingCallbackErrors`, as `FinTsClientOptions` promises.
12
+ */
13
+ export declare class UserPrompts {
14
+ private readonly options;
15
+ private closed;
16
+ /** The first error an informing callback threw during the running call. */
17
+ private callbackError;
18
+ /** Aborts the waits under way; each wait removes its abort when it is over, or when nothing waits for it any more. */
19
+ private readonly aborts;
20
+ constructor(options: FinTsClientOptions);
21
+ /** Ends every wait; the client calls it once. */
22
+ close(): void;
23
+ /** Throws `FinTsStateError` once `close` was called. */
24
+ checkOpen(): void;
25
+ /**
26
+ * Runs `call` and then fails it with the first error an informing callback threw meanwhile; an error of `call` itself
27
+ * takes precedence.
28
+ */
29
+ reportingCallbackErrors<T>(call: () => Promise<T>): Promise<T>;
30
+ /** The app's logger, whose errors are kept for `reportingCallbackErrors`; `undefined` without one. */
31
+ get logger(): MessageLogger | undefined;
32
+ /** Passes the bank's `message` to the app, unless the client is closed. */
33
+ showBankMessage(message: BankMessage): void;
34
+ /** Passes the bank's `warning` to the app, unless the client is closed. */
35
+ showWarning(warning: FinTsFeedback): void;
36
+ private inform;
37
+ /**
38
+ * Shows `challenge` through the TAN callback and returns its answer; rejects with `TypeError` for anything but a
39
+ * `TanAnswer`. Once `TanChallenge.resolved` settles, nothing waits for the answer any more.
40
+ */
41
+ askTan(challenge: TanChallenge): Promise<TanAnswer>;
42
+ /** Waits for `delayMs` milliseconds, or until `interrupt` settles. */
43
+ pause(delayMs: number, interrupt?: Promise<unknown>): Promise<void>;
44
+ /**
45
+ * The TAN method to use among `candidates`: the app's choice, or the first without a selector or an answer.
46
+ *
47
+ * Throws `TypeError` if the selector returns a method that is not among `candidates`.
48
+ */
49
+ chooseMethod(candidates: readonly TanMethod[]): Promise<TanMethod>;
50
+ /**
51
+ * The TAN medium to use among the active `media`: the app's choice, or the first without a selector or an answer.
52
+ *
53
+ * Throws `TypeError` if the selector returns a medium that is not among `media`.
54
+ */
55
+ chooseMedium(media: readonly TanMedium[]): Promise<TanMedium>;
56
+ /**
57
+ * Starts `wait` and ends it with `FinTsStateError` if `close` is called before it is over. Once `unwanted` settles,
58
+ * nothing waits for it any more: it is forgotten then, rather than kept until a callback that never answers does.
59
+ *
60
+ * Once the client is closed, the returned promise rejects rather than this function throwing: a caller that starts
61
+ * several waits at once would otherwise leave the failure of those started first unheard.
62
+ */
63
+ private unlessClosed;
64
+ }
65
+ //# sourceMappingURL=user-prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-prompts.d.ts","sourceRoot":"","sources":["../../src/session/user-prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC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