@coderoftime/fints 0.1.0 → 0.3.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 (289) hide show
  1. package/CHANGELOG.md +519 -1
  2. package/README.md +138 -40
  3. package/dist/client.d.ts +49 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +242 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/core/account.d.ts +46 -7
  8. package/dist/core/account.d.ts.map +1 -1
  9. package/dist/core/account.js +143 -24
  10. package/dist/core/account.js.map +1 -1
  11. package/dist/core/amount.d.ts +15 -4
  12. package/dist/core/amount.d.ts.map +1 -1
  13. package/dist/core/amount.js +46 -9
  14. package/dist/core/amount.js.map +1 -1
  15. package/dist/core/balance.d.ts +4 -0
  16. package/dist/core/balance.d.ts.map +1 -1
  17. package/dist/core/balance.js +11 -5
  18. package/dist/core/balance.js.map +1 -1
  19. package/dist/core/bank-info.d.ts +21 -4
  20. package/dist/core/bank-info.d.ts.map +1 -1
  21. package/dist/core/bank-info.js +26 -5
  22. package/dist/core/bank-info.js.map +1 -1
  23. package/dist/core/client.d.ts +81 -19
  24. package/dist/core/client.d.ts.map +1 -1
  25. package/dist/core/config.d.ts +40 -20
  26. package/dist/core/config.d.ts.map +1 -1
  27. package/dist/core/config.js +85 -30
  28. package/dist/core/config.js.map +1 -1
  29. package/dist/core/errors.d.ts +100 -26
  30. package/dist/core/errors.d.ts.map +1 -1
  31. package/dist/core/errors.js +136 -53
  32. package/dist/core/errors.js.map +1 -1
  33. package/dist/core/feedback.d.ts +11 -1
  34. package/dist/core/feedback.d.ts.map +1 -1
  35. package/dist/core/feedback.js +14 -2
  36. package/dist/core/feedback.js.map +1 -1
  37. package/dist/core/transaction.d.ts +11 -1
  38. package/dist/core/transaction.d.ts.map +1 -1
  39. package/dist/core/transaction.js +21 -4
  40. package/dist/core/transaction.js.map +1 -1
  41. package/dist/core/transport.d.ts +48 -6
  42. package/dist/core/transport.d.ts.map +1 -1
  43. package/dist/core/transport.js +126 -29
  44. package/dist/core/transport.js.map +1 -1
  45. package/dist/formats/camt.d.ts +28 -5
  46. package/dist/formats/camt.d.ts.map +1 -1
  47. package/dist/formats/camt.js +132 -50
  48. package/dist/formats/camt.js.map +1 -1
  49. package/dist/formats/mt940.d.ts +29 -5
  50. package/dist/formats/mt940.d.ts.map +1 -1
  51. package/dist/formats/mt940.js +209 -113
  52. package/dist/formats/mt940.js.map +1 -1
  53. package/dist/formats/readers.d.ts +6 -2
  54. package/dist/formats/readers.d.ts.map +1 -1
  55. package/dist/formats/readers.js +28 -29
  56. package/dist/formats/readers.js.map +1 -1
  57. package/dist/formats/record-budget.d.ts +7 -0
  58. package/dist/formats/record-budget.d.ts.map +1 -0
  59. package/dist/formats/record-budget.js +17 -0
  60. package/dist/formats/record-budget.js.map +1 -0
  61. package/dist/formats/sepa-purpose.d.ts +9 -0
  62. package/dist/formats/sepa-purpose.d.ts.map +1 -1
  63. package/dist/formats/sepa-purpose.js +32 -2
  64. package/dist/formats/sepa-purpose.js.map +1 -1
  65. package/dist/index.d.ts +3 -3
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +2 -2
  68. package/dist/index.js.map +1 -1
  69. package/dist/session/app-approval.d.ts +11 -5
  70. package/dist/session/app-approval.d.ts.map +1 -1
  71. package/dist/session/app-approval.js +23 -12
  72. package/dist/session/app-approval.js.map +1 -1
  73. package/dist/session/dialog-runner.d.ts +11 -11
  74. package/dist/session/dialog-runner.d.ts.map +1 -1
  75. package/dist/session/dialog-runner.js +34 -19
  76. package/dist/session/dialog-runner.js.map +1 -1
  77. package/dist/session/login-guard.d.ts +54 -49
  78. package/dist/session/login-guard.d.ts.map +1 -1
  79. package/dist/session/login-guard.js +170 -83
  80. package/dist/session/login-guard.js.map +1 -1
  81. package/dist/session/sepa-accounts.d.ts +20 -14
  82. package/dist/session/sepa-accounts.d.ts.map +1 -1
  83. package/dist/session/sepa-accounts.js +62 -46
  84. package/dist/session/sepa-accounts.js.map +1 -1
  85. package/dist/session/session-setup.d.ts +41 -24
  86. package/dist/session/session-setup.d.ts.map +1 -1
  87. package/dist/session/session-setup.js +106 -63
  88. package/dist/session/session-setup.js.map +1 -1
  89. package/dist/session/session-state.d.ts +10 -6
  90. package/dist/session/session-state.d.ts.map +1 -1
  91. package/dist/session/session-state.js +72 -18
  92. package/dist/session/session-state.js.map +1 -1
  93. package/dist/session/signed-dialog.d.ts +83 -0
  94. package/dist/session/signed-dialog.d.ts.map +1 -0
  95. package/dist/session/signed-dialog.js +185 -0
  96. package/dist/session/signed-dialog.js.map +1 -0
  97. package/dist/session/tan-selection.d.ts +26 -18
  98. package/dist/session/tan-selection.d.ts.map +1 -1
  99. package/dist/session/tan-selection.js +44 -33
  100. package/dist/session/tan-selection.js.map +1 -1
  101. package/dist/session/user-prompts.d.ts +14 -5
  102. package/dist/session/user-prompts.d.ts.map +1 -1
  103. package/dist/session/user-prompts.js +53 -18
  104. package/dist/session/user-prompts.js.map +1 -1
  105. package/dist/tan/challenge.d.ts +47 -24
  106. package/dist/tan/challenge.d.ts.map +1 -1
  107. package/dist/tan/challenge.js +56 -51
  108. package/dist/tan/challenge.js.map +1 -1
  109. package/dist/tan/flicker.d.ts +11 -1
  110. package/dist/tan/flicker.d.ts.map +1 -1
  111. package/dist/tan/flicker.js +70 -24
  112. package/dist/tan/flicker.js.map +1 -1
  113. package/dist/tan/tan-image.d.ts +6 -2
  114. package/dist/tan/tan-image.d.ts.map +1 -1
  115. package/dist/tan/tan-image.js +14 -6
  116. package/dist/tan/tan-image.js.map +1 -1
  117. package/dist/tan/tan-models.d.ts +14 -2
  118. package/dist/tan/tan-models.d.ts.map +1 -1
  119. package/dist/tan/tan-models.js +24 -7
  120. package/dist/tan/tan-models.js.map +1 -1
  121. package/dist/util/arguments.d.ts +13 -0
  122. package/dist/util/arguments.d.ts.map +1 -0
  123. package/dist/util/arguments.js +40 -0
  124. package/dist/util/arguments.js.map +1 -0
  125. package/dist/util/async.d.ts +4 -3
  126. package/dist/util/async.d.ts.map +1 -1
  127. package/dist/util/async.js +6 -7
  128. package/dist/util/async.js.map +1 -1
  129. package/dist/util/bytes.d.ts +3 -4
  130. package/dist/util/bytes.d.ts.map +1 -1
  131. package/dist/util/bytes.js +13 -21
  132. package/dist/util/bytes.js.map +1 -1
  133. package/dist/util/call-context.d.ts.map +1 -1
  134. package/dist/util/call-context.js +3 -2
  135. package/dist/util/call-context.js.map +1 -1
  136. package/dist/util/dates.d.ts +6 -20
  137. package/dist/util/dates.d.ts.map +1 -1
  138. package/dist/util/dates.js +58 -28
  139. package/dist/util/dates.js.map +1 -1
  140. package/dist/util/errors.d.ts +13 -3
  141. package/dist/util/errors.d.ts.map +1 -1
  142. package/dist/util/errors.js +19 -6
  143. package/dist/util/errors.js.map +1 -1
  144. package/dist/util/immutable-map.d.ts +5 -2
  145. package/dist/util/immutable-map.d.ts.map +1 -1
  146. package/dist/util/immutable-map.js +15 -12
  147. package/dist/util/immutable-map.js.map +1 -1
  148. package/dist/util/inspect.d.ts +11 -0
  149. package/dist/util/inspect.d.ts.map +1 -0
  150. package/dist/util/inspect.js +14 -0
  151. package/dist/util/inspect.js.map +1 -0
  152. package/dist/util/json.d.ts +4 -0
  153. package/dist/util/json.d.ts.map +1 -1
  154. package/dist/util/json.js +18 -0
  155. package/dist/util/json.js.map +1 -1
  156. package/dist/util/text.d.ts +38 -5
  157. package/dist/util/text.d.ts.map +1 -1
  158. package/dist/util/text.js +90 -16
  159. package/dist/util/text.js.map +1 -1
  160. package/dist/util/xml.d.ts +9 -6
  161. package/dist/util/xml.d.ts.map +1 -1
  162. package/dist/util/xml.js +129 -56
  163. package/dist/util/xml.js.map +1 -1
  164. package/dist/v3/account-extension.d.ts.map +1 -1
  165. package/dist/v3/account-extension.js +7 -10
  166. package/dist/v3/account-extension.js.map +1 -1
  167. package/dist/v3/bank-connection.d.ts +54 -0
  168. package/dist/v3/bank-connection.d.ts.map +1 -0
  169. package/dist/v3/bank-connection.js +118 -0
  170. package/dist/v3/bank-connection.js.map +1 -0
  171. package/dist/v3/dialog.d.ts +84 -46
  172. package/dist/v3/dialog.d.ts.map +1 -1
  173. package/dist/v3/dialog.js +174 -60
  174. package/dist/v3/dialog.js.map +1 -1
  175. package/dist/v3/message.d.ts +32 -11
  176. package/dist/v3/message.d.ts.map +1 -1
  177. package/dist/v3/message.js +144 -83
  178. package/dist/v3/message.js.map +1 -1
  179. package/dist/v3/parameter-store.d.ts +111 -0
  180. package/dist/v3/parameter-store.d.ts.map +1 -0
  181. package/dist/v3/parameter-store.js +197 -0
  182. package/dist/v3/parameter-store.js.map +1 -0
  183. package/dist/v3/parameters.d.ts +44 -17
  184. package/dist/v3/parameters.d.ts.map +1 -1
  185. package/dist/v3/parameters.js +136 -60
  186. package/dist/v3/parameters.js.map +1 -1
  187. package/dist/v3/protocol.d.ts +50 -50
  188. package/dist/v3/protocol.d.ts.map +1 -1
  189. package/dist/v3/protocol.js +91 -210
  190. package/dist/v3/protocol.js.map +1 -1
  191. package/dist/v3/queries.d.ts +51 -0
  192. package/dist/v3/queries.d.ts.map +1 -0
  193. package/dist/v3/queries.js +128 -0
  194. package/dist/v3/queries.js.map +1 -0
  195. package/dist/v3/segments.d.ts +43 -19
  196. package/dist/v3/segments.d.ts.map +1 -1
  197. package/dist/v3/segments.js +84 -33
  198. package/dist/v3/segments.js.map +1 -1
  199. package/dist/v3/syntax.d.ts +68 -13
  200. package/dist/v3/syntax.d.ts.map +1 -1
  201. package/dist/v3/syntax.js +183 -102
  202. package/dist/v3/syntax.js.map +1 -1
  203. package/package.json +10 -6
  204. package/src/client.ts +293 -0
  205. package/src/core/account.ts +153 -24
  206. package/src/core/amount.ts +45 -10
  207. package/src/core/balance.ts +12 -5
  208. package/src/core/bank-info.ts +29 -5
  209. package/src/core/client.ts +83 -19
  210. package/src/core/config.ts +95 -35
  211. package/src/core/errors.ts +148 -54
  212. package/src/core/feedback.ts +16 -2
  213. package/src/core/transaction.ts +22 -4
  214. package/src/core/transport.ts +153 -32
  215. package/src/formats/camt.ts +153 -45
  216. package/src/formats/mt940.ts +244 -122
  217. package/src/formats/readers.ts +28 -31
  218. package/src/formats/record-budget.ts +18 -0
  219. package/src/formats/sepa-purpose.ts +29 -2
  220. package/src/index.ts +4 -2
  221. package/src/session/app-approval.ts +51 -38
  222. package/src/session/dialog-runner.ts +61 -31
  223. package/src/session/login-guard.ts +189 -87
  224. package/src/session/sepa-accounts.ts +63 -45
  225. package/src/session/session-setup.ts +105 -68
  226. package/src/session/session-state.ts +74 -23
  227. package/src/session/signed-dialog.ts +222 -0
  228. package/src/session/tan-selection.ts +50 -39
  229. package/src/session/user-prompts.ts +62 -18
  230. package/src/tan/challenge.ts +87 -64
  231. package/src/tan/flicker.ts +72 -23
  232. package/src/tan/tan-image.ts +15 -6
  233. package/src/tan/tan-models.ts +26 -7
  234. package/src/util/arguments.ts +40 -0
  235. package/src/util/async.ts +10 -9
  236. package/src/util/bytes.ts +14 -20
  237. package/src/util/call-context.ts +3 -2
  238. package/src/util/dates.ts +64 -33
  239. package/src/util/errors.ts +22 -6
  240. package/src/util/immutable-map.ts +15 -12
  241. package/src/util/inspect.ts +14 -0
  242. package/src/util/json.ts +16 -0
  243. package/src/util/text.ts +87 -15
  244. package/src/util/xml.ts +130 -52
  245. package/src/v3/account-extension.ts +7 -12
  246. package/src/v3/bank-connection.ts +126 -0
  247. package/src/v3/dialog.ts +186 -92
  248. package/src/v3/message.ts +140 -79
  249. package/src/v3/parameter-store.ts +226 -0
  250. package/src/v3/parameters.ts +166 -66
  251. package/src/v3/protocol.ts +103 -253
  252. package/src/v3/queries.ts +198 -0
  253. package/src/v3/segments.ts +86 -31
  254. package/src/v3/syntax.ts +172 -93
  255. package/dist/session/bank-connection.d.ts +0 -28
  256. package/dist/session/bank-connection.d.ts.map +0 -1
  257. package/dist/session/bank-connection.js +0 -48
  258. package/dist/session/bank-connection.js.map +0 -1
  259. package/dist/session/parameter-data.d.ts +0 -83
  260. package/dist/session/parameter-data.d.ts.map +0 -1
  261. package/dist/session/parameter-data.js +0 -68
  262. package/dist/session/parameter-data.js.map +0 -1
  263. package/dist/session/pin-tan-client.d.ts +0 -54
  264. package/dist/session/pin-tan-client.d.ts.map +0 -1
  265. package/dist/session/pin-tan-client.js +0 -153
  266. package/dist/session/pin-tan-client.js.map +0 -1
  267. package/dist/session/pin-tan-dialog.d.ts +0 -71
  268. package/dist/session/pin-tan-dialog.d.ts.map +0 -1
  269. package/dist/session/pin-tan-dialog.js +0 -124
  270. package/dist/session/pin-tan-dialog.js.map +0 -1
  271. package/dist/session/protocol.d.ts +0 -209
  272. package/dist/session/protocol.d.ts.map +0 -1
  273. package/dist/session/protocol.js +0 -75
  274. package/dist/session/protocol.js.map +0 -1
  275. package/dist/session/response-handler.d.ts +0 -48
  276. package/dist/session/response-handler.d.ts.map +0 -1
  277. package/dist/session/response-handler.js +0 -121
  278. package/dist/session/response-handler.js.map +0 -1
  279. package/dist/v3/client.d.ts +0 -24
  280. package/dist/v3/client.d.ts.map +0 -1
  281. package/dist/v3/client.js +0 -16
  282. package/dist/v3/client.js.map +0 -1
  283. package/src/session/bank-connection.ts +0 -51
  284. package/src/session/parameter-data.ts +0 -137
  285. package/src/session/pin-tan-client.ts +0 -186
  286. package/src/session/pin-tan-dialog.ts +0 -160
  287. package/src/session/protocol.ts +0 -311
  288. package/src/session/response-handler.ts +0 -130
  289. package/src/v3/client.ts +0 -29
@@ -1 +0,0 @@
1
- {"version":3,"file":"pin-tan-dialog.js","sourceRoot":"","sources":["../../src/session/pin-tan-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvG,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAq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0 @@
1
- import type { Account } from '../core/account.js';
2
- import type { Balance } from '../core/balance.js';
3
- import type { BankMessage } from '../core/bank-info.js';
4
- import { type FinTsConfig } from '../core/config.js';
5
- import type { FinTsFeedback } from '../core/feedback.js';
6
- import type { Transaction, TransactionFormat } from '../core/transaction.js';
7
- import type { TanChallenge } from '../tan/challenge.js';
8
- import type { TanMedium, TanMethod } from '../tan/tan-models.js';
9
- import type { LoginGuard } from './login-guard.js';
10
- import { type BankParameters, type UserParameters } from './parameter-data.js';
11
- /**
12
- * The filler the specification names for a reference that does not exist.
13
- *
14
- * The bank puts it into a dummy answer when no approval is needed. The client sends it as the TAN medium name in the
15
- * dialog that looks up the TAN media, before it knows a medium; the bank ignores it there (PIN/TAN B.4.3.1.3).
16
- */
17
- export declare const noReference = "noref";
18
- /**
19
- * A business transaction by its name, such as `HKCAZ`, and the version to send; `undefined` where the bank does not
20
- * offer it or the parameter data do not permit it.
21
- */
22
- export interface OfferedTransaction {
23
- readonly name: string;
24
- readonly version: number | undefined;
25
- }
26
- /**
27
- * What to request for transactions: camt.052 (`camt`) or MT940, the `version` to send, the `camtFormats` to name, and
28
- * the `currency` of statements that state none.
29
- */
30
- export interface TransactionsRequest {
31
- readonly camt: boolean;
32
- readonly version: number;
33
- readonly camtFormats: readonly string[];
34
- readonly currency: string | undefined;
35
- }
36
- /**
37
- * What to request for the transactions of `account` in `format`.
38
- *
39
- * The client reads camt.052 only, so camt counts as offered only if `camtFormats` include it. With `auto` the client
40
- * takes camt where the bank offers it, unless the user parameter data `upd` list only MT940 transactions for the
41
- * account.
42
- *
43
- * Throws `FinTsUnsupportedError` if the bank does not offer the chosen format for the account.
44
- */
45
- export declare function chooseTransactions(format: TransactionFormat, account: Account, upd: UserParameters | undefined, offered: {
46
- camt: OfferedTransaction;
47
- camtFormats: readonly string[];
48
- mt940: OfferedTransaction;
49
- }): TransactionsRequest;
50
- /**
51
- * The query for the balance of `account`.
52
- *
53
- * `order` builds the request for each page. Once all pages are in, `records` collects the balance records of all pages,
54
- * `balanceRecord` picks the one for `account` with the help of `accountOf`, and `read` turns it into the `Balance`.
55
- */
56
- export declare function balanceQuery<R extends BankResponse, O, T>(account: Account, parts: {
57
- order: (continuation: string | undefined) => O;
58
- records: (pages: readonly R[]) => T[];
59
- accountOf: (record: T) => Account;
60
- read: (record: T, account: Account) => Balance;
61
- }): Query<R, O, Balance>;
62
- /**
63
- * Checks that a message signed with `pin` may go out.
64
- *
65
- * It may not if the bank refused a login before (`LoginGuard.check`), or if the bank parameters `bpd` rule out the
66
- * PIN's length: the bank would count such a PIN as a failed attempt.
67
- */
68
- export declare function checkBeforeSigning(guard: LoginGuard, pin: string, bpd: BankParameters | undefined): void;
69
- /**
70
- * The balance record of `account` in `records`: the one whose account matches. A single record is taken as it is,
71
- * since the query asked for this one account only.
72
- *
73
- * Throws `FinTsBankError` with the bank's `feedback` if there is none, and `FinTsProtocolError` if there are several
74
- * and none matches.
75
- */
76
- export declare function balanceRecord<T>(records: readonly T[], account: Account, accountOf: (record: T) => Account, feedback: readonly FinTsFeedback[]): T;
77
- /** A bank response, reduced to what the protocol-independent session logic needs. */
78
- export interface BankResponse {
79
- /** Return codes of the whole message and of its parts. */
80
- readonly feedback: readonly FinTsFeedback[];
81
- /** Whether the bank rejected the message as a whole (an error in HIRMG), rather than single orders in it. */
82
- readonly messageRejected: boolean;
83
- /** Free-text messages the bank addresses to the user. */
84
- readonly bankMessages: readonly BankMessage[];
85
- /** The length of the message in bytes, a measure of the memory it holds. */
86
- readonly size: number;
87
- }
88
- /** The bank's request to approve a message with a TAN or in a banking app. */
89
- export interface Approval<R> {
90
- /** What the user is asked. */
91
- readonly challenge: TanChallenge;
92
- /** Sends the TAN the user entered. */
93
- readonly submitTan: (tan: string) => Promise<R>;
94
- /** Asks the bank whether the user has approved in the banking app. */
95
- readonly checkStatus: () => Promise<R>;
96
- /**
97
- * Whether the bank announces a push message for once the user has approved (return code 3957), before which the
98
- * status must not be asked. The client has no push channel, so the user reports the approval instead.
99
- */
100
- readonly waitForPush: boolean;
101
- /** The new instructions a status answer gives the user (return code 3956); `undefined` where it gives none. */
102
- readonly instructionsIn: (response: R) => string | undefined;
103
- }
104
- /** One message exchange of a dialog, sent when called. */
105
- export type Exchange<R> = () => Promise<R>;
106
- /**
107
- * The messages that open a dialog and send an order: `login` opens the dialog, and `order` sends the order in a message
108
- * of its own.
109
- */
110
- export interface StartWithOrder<R> {
111
- readonly login: Exchange<R>;
112
- readonly order: Exchange<R> | undefined;
113
- }
114
- /** What the handling of responses needs of a dialog, whatever its protocol. */
115
- export interface DialogHandle<R extends BankResponse> {
116
- /** The TAN method the dialog's messages are signed with. */
117
- readonly method: TanMethod;
118
- /** Whether the bank knows this dialog and it has not ended. */
119
- readonly isActive: boolean;
120
- /**
121
- * The approval `response`, the dialog's latest answer, asks for with return code 0030 (TAN) or 3955 (banking app);
122
- * `undefined` if it asks for none.
123
- *
124
- * The bank has not executed the message then, so a request without a challenge is a `FinTsProtocolError`: read as
125
- * done, it would report an empty result.
126
- */
127
- approvalAskedIn(response: R): Approval<R> | undefined;
128
- /** Forgets the dialog without contacting the bank, for example after the bank rejected the PIN. */
129
- discard(): void;
130
- /**
131
- * Ends the dialog at the bank; does nothing if it is not active.
132
- *
133
- * Bank and connection errors are ignored, since the bank may have ended the dialog on its side already.
134
- */
135
- end(): Promise<void>;
136
- }
137
- /** One dialog with the bank: a numbered sequence of messages under one dialog ID. */
138
- export interface ProtocolDialog<R extends BankResponse, O> extends DialogHandle<R> {
139
- /** Opens the dialog; with `synchronize` the bank also assigns a customer system ID. */
140
- start(synchronize?: boolean): Promise<R>;
141
- /** The messages that open the dialog and send `order` while no TAN medium is chosen yet, as for listing the media. */
142
- startWith(order: O): StartWithOrder<R>;
143
- /** Sends `order`, asking for strong customer authentication where the bank requires it. */
144
- send(order: O): Promise<R>;
145
- }
146
- /** A business transaction: the order to send for each page, and how to read all pages the bank sent. */
147
- export interface Query<R, O, T> {
148
- /** The order for the page at `continuation`; `undefined` for the first page. */
149
- readonly order: (continuation: string | undefined) => O;
150
- /** Reads the result; throws `FormatError` for malformed data. */
151
- readonly read: (pages: readonly R[]) => T;
152
- }
153
- /**
154
- * What the regular dialogs still need from a synchronization, a login in a dialog of its own, before the TAN method and
155
- * medium are settled (`TanSelection.synchronizationDialog` tells which method signs it):
156
- * - `none`: nothing, so no synchronization runs;
157
- * - `helpful`: nothing they cannot get themselves, but it tells the TAN methods the user may use before the user
158
- * chooses one, so it runs once per client;
159
- * - `required`: the customer system ID, without which no regular dialog starts (FinTS 3.0).
160
- */
161
- export type Synchronization = 'none' | 'helpful' | 'required';
162
- /** What the handling of responses needs of a protocol, whatever the orders it builds. */
163
- export interface ResponseProtocol<R extends BankResponse> {
164
- /** Keeps the parameter data and IDs in `response`, the answer to a message of a logged-in dialog. */
165
- keepParameterData(response: R): void;
166
- /** Joins a response with the one completing its approval. */
167
- combine(first: R, second: R): R;
168
- }
169
- /**
170
- * The protocol-specific half of a PIN/TAN client: builds and reads the messages.
171
- *
172
- * `PinTanClient` holds the other half, the session logic.
173
- */
174
- export interface PinTanProtocol<R extends BankResponse, O> extends ResponseProtocol<R> {
175
- /** Where and as whom the client talks to the bank. */
176
- readonly config: FinTsConfig;
177
- /** The bank parameter data received so far, if any. */
178
- readonly bankParameters: BankParameters | undefined;
179
- /** The user parameter data received so far, if any. */
180
- readonly userParameters: UserParameters | undefined;
181
- /** What regular dialogs still need from a synchronization dialog. */
182
- readonly synchronization: Synchronization;
183
- /**
184
- * Drops the customer system ID the bank no longer accepts, so that a synchronization is required again; returns
185
- * whether there was one.
186
- */
187
- forgetSystemId(): boolean;
188
- /** Keeps the PIN from going out after a refused login: the protocol checks it before every message it signs. */
189
- readonly loginGuard: LoginGuard;
190
- /** Requests the bank parameter data without logging in, and keeps them. */
191
- fetchBankParametersAnonymously(): Promise<R>;
192
- /** A new dialog signed with `method` and, where the method needs one, `tanMedium`. */
193
- newDialog(method: TanMethod, tanMedium?: string): ProtocolDialog<R, O>;
194
- /** Lists the TAN media; `undefined` if the bank does not offer it. */
195
- tanMedia(): Query<R, O, TanMedium[]> | undefined;
196
- /** Lists IBAN and BIC of the accounts; `undefined` if the bank does not offer it. */
197
- sepaAccounts(): Query<R, O, Account[]> | undefined;
198
- /** The balance of `account`; throws `FinTsUnsupportedError` if the bank does not report balances. */
199
- balance(account: Account): Query<R, O, Balance>;
200
- /** The transactions of `account`; throws `FinTsUnsupportedError` if the bank does not offer `format`. */
201
- transactions(account: Account, format: TransactionFormat, from: Date | undefined, to: Date | undefined): Query<R, O, Transaction[]>;
202
- /** The parameter data and IDs the protocol keeps, as JSON data, for the client's saved state. */
203
- saveState(): Record<string, unknown>;
204
- /** Restores what `saveState` saved; throws if `saved` is damaged, leaving the protocol unchanged. */
205
- restoreState(saved: Record<string, unknown>): void;
206
- /** Releases the connection. */
207
- close(): void;
208
- }
209
- //# sourceMappingURL=protocol.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/session/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAuB,KAAK,cAAc,EAAE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,CAAC,GAAG,SAAS,CAAC;IAEnD,qGAAqG;IACrG,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;IAEhD,yGAAyG;IACzG,YAAY,CACV,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAE,IAAI,GAAG,SAAS,EACtB,EAAE,EAAE,IAAI,GAAG,SAAS,GACnB,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;IAE9B,iGAAiG;IACjG,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAErC,qGAAqG;IACrG,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAEnD,+BAA+B;IAC/B,KAAK,IAAI,IAAI,CAAC;CACf"}
@@ -1,75 +0,0 @@
1
- import { requirePinLength } from '../core/config.js';
2
- import { FinTsBankError, FinTsProtocolError, FinTsUnsupportedError } from '../core/errors.js';
3
- import { knownAccount, lists } from './parameter-data.js';
4
- /**
5
- * The filler the specification names for a reference that does not exist.
6
- *
7
- * The bank puts it into a dummy answer when no approval is needed. The client sends it as the TAN medium name in the
8
- * dialog that looks up the TAN media, before it knows a medium; the bank ignores it there (PIN/TAN B.4.3.1.3).
9
- */
10
- export const noReference = 'noref';
11
- /**
12
- * What to request for the transactions of `account` in `format`.
13
- *
14
- * The client reads camt.052 only, so camt counts as offered only if `camtFormats` include it. With `auto` the client
15
- * takes camt where the bank offers it, unless the user parameter data `upd` list only MT940 transactions for the
16
- * account.
17
- *
18
- * Throws `FinTsUnsupportedError` if the bank does not offer the chosen format for the account.
19
- */
20
- export function chooseTransactions(format, account, upd, offered) {
21
- const readable = offered.camtFormats.filter((f) => f.includes('camt.052'));
22
- const camtVersion = readable.length === 0 ? undefined : offered.camt.version;
23
- const known = knownAccount(upd, account);
24
- const useCamt = format === 'camt' ||
25
- (format === 'auto' &&
26
- camtVersion !== undefined &&
27
- (lists(known, offered.camt.name) || !lists(known, offered.mt940.name)));
28
- const version = useCamt ? camtVersion : offered.mt940.version;
29
- if (version === undefined) {
30
- const name = useCamt ? offered.camt.name : offered.mt940.name;
31
- throw new FinTsUnsupportedError(`The bank offers no ${useCamt ? 'camt ' : ''}transactions (${name}) for this account`);
32
- }
33
- return { camt: useCamt, version, camtFormats: readable, currency: known.currency ?? account.currency };
34
- }
35
- /**
36
- * The query for the balance of `account`.
37
- *
38
- * `order` builds the request for each page. Once all pages are in, `records` collects the balance records of all pages,
39
- * `balanceRecord` picks the one for `account` with the help of `accountOf`, and `read` turns it into the `Balance`.
40
- */
41
- export function balanceQuery(account, parts) {
42
- return {
43
- order: parts.order,
44
- read: (pages) => parts.read(balanceRecord(parts.records(pages), account, parts.accountOf, pages.flatMap((p) => p.feedback)), account),
45
- };
46
- }
47
- /**
48
- * Checks that a message signed with `pin` may go out.
49
- *
50
- * It may not if the bank refused a login before (`LoginGuard.check`), or if the bank parameters `bpd` rule out the
51
- * PIN's length: the bank would count such a PIN as a failed attempt.
52
- */
53
- export function checkBeforeSigning(guard, pin, bpd) {
54
- guard.check();
55
- requirePinLength(pin, bpd?.pinLength.min, bpd?.pinLength.max);
56
- }
57
- /**
58
- * The balance record of `account` in `records`: the one whose account matches. A single record is taken as it is,
59
- * since the query asked for this one account only.
60
- *
61
- * Throws `FinTsBankError` with the bank's `feedback` if there is none, and `FinTsProtocolError` if there are several
62
- * and none matches.
63
- */
64
- export function balanceRecord(records, account, accountOf, feedback) {
65
- if (records.length === 0)
66
- throw new FinTsBankError(feedback, 'No balance returned');
67
- if (records.length === 1)
68
- return records[0];
69
- const match = records.find((record) => accountOf(record).matches(account));
70
- if (match === undefined) {
71
- throw new FinTsProtocolError('The bank returned balances, but none for the requested account');
72
- }
73
- return match;
74
- }
75
- //# sourceMappingURL=protocol.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file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C,MAAM,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,CAAC,CAAE,CAAC;IAC7C,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,kBAAkB,CAAC,gEAAgE,CAAC,CAAC;IACjG,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,48 +0,0 @@
1
- import type { LoginGuard, RequestKind } from './login-guard.js';
2
- import type { BankResponse, DialogHandle, Exchange, ResponseProtocol, StartWithOrder } from './protocol.js';
3
- import type { SessionState } from './session-state.js';
4
- import type { UserPrompts } from './user-prompts.js';
5
- /** Checks what the bank answers and completes the approvals it asks for. The `LoginGuard` judges what errors mean. */
6
- export declare class ResponseHandler<R extends BankResponse> {
7
- private readonly protocol;
8
- private readonly state;
9
- private readonly prompts;
10
- private readonly guard;
11
- constructor(protocol: ResponseProtocol<R>, state: SessionState, prompts: UserPrompts, guard: LoginGuard);
12
- /** Sends `login`, the exchange that opens `dialog`, and completes the approval the bank asks for. */
13
- startDialog(dialog: DialogHandle<R>, login: Exchange<R>): Promise<R>;
14
- /**
15
- * Opens `dialog` with `start`, which also sends an order, and returns the answers: the login's, then the order's where
16
- * the order has a message of its own. Completes the approval of each before the next.
17
- */
18
- startDialogWith(dialog: DialogHandle<R>, start: StartWithOrder<R>): Promise<R[]>;
19
- /** Receives `response`, the answer to an order in `dialog`, and completes the approval the bank asks for. */
20
- complete(dialog: DialogHandle<R>, response: R): Promise<R>;
21
- /**
22
- * Receives `response`, the answer to a request of `kind` in `dialog`: keeps its parameter data, even alongside errors,
23
- * since the remedy for a refused login may need them; passes its notices on; and throws its errors once the guard has
24
- * judged them (`LoginGuard.judge`).
25
- */
26
- receive(dialog: DialogHandle<R>, response: R, kind: RequestKind): void;
27
- /**
28
- * Passes the bank's messages in `response` to the user: all an anonymous dialog tells, since the TAN methods it lists
29
- * are not those of a user.
30
- */
31
- showBankMessages(response: R): void;
32
- private start;
33
- /**
34
- * Ends `dialog`, whose login brought new login data, and stops the client from logging in with the old ones
35
- * (Rückmeldungscodes C.6).
36
- */
37
- private retireLoginData;
38
- /**
39
- * Receives `response`, the answer to a request of `kind`, then completes the approval it asks for; returns it joined
40
- * with the response that completes the approval.
41
- */
42
- private settle;
43
- /** Passes on the notices in `response`: the TAN methods the user may use (3920), the bank's messages and warnings. */
44
- private readNotices;
45
- private enterTan;
46
- private awaitAppApproval;
47
- }
48
- //# sourceMappingURL=response-handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"response-handler.d.ts","sourceRoot":"","sources":["../../src/session/response-handler.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,KAAK,EAAY,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACtH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,sHAAsH;AACtH,qBAAa,eAAe,CAAC,CAAC,SAAS,YAAY;IAE/C,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAHL,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAC7B,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,UAAU;IAGpC,qGAAqG;IACrG,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAIpE;;;OAGG;IACG,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAOtF,6GAA6G;IAC7G,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAI1D;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI;IAUtE;;;OAGG;IACH,gBAAgB,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI;YAIrB,KAAK;IAMnB;;;OAGG;YACW,eAAe;IAO7B;;;OAGG;YACW,MAAM;IAUpB,sHAAsH;IACtH,OAAO,CAAC,WAAW;YAOL,QAAQ;IAYtB,OAAO,CAAC,gBAAgB;CASzB"}
@@ -1,121 +0,0 @@
1
- import { bankErrorFor, FinTsLoginDataChangedError, FinTsTanCancelledError } from '../core/errors.js';
2
- import { allowedTanMethodsIn, FeedbackCodes, hasCode, hasErrors, userWarnings, } from '../core/feedback.js';
3
- import { invalidArgument } from '../util/errors.js';
4
- import { appApprovalWait } from './app-approval.js';
5
- /** Checks what the bank answers and completes the approvals it asks for. The `LoginGuard` judges what errors mean. */
6
- export class ResponseHandler {
7
- protocol;
8
- state;
9
- prompts;
10
- guard;
11
- constructor(protocol, state, prompts, guard) {
12
- this.protocol = protocol;
13
- this.state = state;
14
- this.prompts = prompts;
15
- this.guard = guard;
16
- }
17
- /** Sends `login`, the exchange that opens `dialog`, and completes the approval the bank asks for. */
18
- startDialog(dialog, login) {
19
- return this.start(dialog, login, 'login');
20
- }
21
- /**
22
- * Opens `dialog` with `start`, which also sends an order, and returns the answers: the login's, then the order's where
23
- * the order has a message of its own. Completes the approval of each before the next.
24
- */
25
- async startDialogWith(dialog, start) {
26
- const order = start.order;
27
- if (order === undefined)
28
- return [await this.start(dialog, start.login, 'loginWithOrder')];
29
- const login = await this.startDialog(dialog, start.login);
30
- return [login, await this.complete(dialog, await order())];
31
- }
32
- /** Receives `response`, the answer to an order in `dialog`, and completes the approval the bank asks for. */
33
- complete(dialog, response) {
34
- return this.settle(dialog, response, 'order');
35
- }
36
- /**
37
- * Receives `response`, the answer to a request of `kind` in `dialog`: keeps its parameter data, even alongside errors,
38
- * since the remedy for a refused login may need them; passes its notices on; and throws its errors once the guard has
39
- * judged them (`LoginGuard.judge`).
40
- */
41
- receive(dialog, response, kind) {
42
- this.protocol.keepParameterData(response);
43
- this.readNotices(response);
44
- if (!hasErrors(response.feedback))
45
- return;
46
- const error = bankErrorFor(response.feedback, kind === 'approval');
47
- // Every further message of a refused login's dialog would carry the refused PIN.
48
- if (this.guard.judge(error, kind, dialog.isActive, dialog.method))
49
- dialog.discard();
50
- throw error;
51
- }
52
- /**
53
- * Passes the bank's messages in `response` to the user: all an anonymous dialog tells, since the TAN methods it lists
54
- * are not those of a user.
55
- */
56
- showBankMessages(response) {
57
- for (const message of response.bankMessages)
58
- this.prompts.showBankMessage(message);
59
- }
60
- async start(dialog, login, kind) {
61
- const response = await this.settle(dialog, await login(), kind);
62
- if (hasCode(response.feedback, FeedbackCodes.newLoginData))
63
- await this.retireLoginData(dialog, response.feedback);
64
- return response;
65
- }
66
- /**
67
- * Ends `dialog`, whose login brought new login data, and stops the client from logging in with the old ones
68
- * (Rückmeldungscodes C.6).
69
- */
70
- async retireLoginData(dialog, feedback) {
71
- await dialog.end();
72
- const error = new FinTsLoginDataChangedError(feedback);
73
- this.guard.refuse(error);
74
- throw error;
75
- }
76
- /**
77
- * Receives `response`, the answer to a request of `kind`, then completes the approval it asks for; returns it joined
78
- * with the response that completes the approval.
79
- */
80
- async settle(dialog, response, kind) {
81
- this.receive(dialog, response, kind);
82
- const approval = dialog.approvalAskedIn(response);
83
- if (approval === undefined)
84
- return response;
85
- const approved = approval.challenge.isDecoupled
86
- ? await this.awaitAppApproval(dialog, approval)
87
- : await this.enterTan(dialog, approval);
88
- return this.protocol.combine(response, approved);
89
- }
90
- /** Passes on the notices in `response`: the TAN methods the user may use (3920), the bank's messages and warnings. */
91
- readNotices(response) {
92
- const allowed = allowedTanMethodsIn(response.feedback);
93
- if (allowed.length > 0)
94
- this.state.rememberAllowedMethods(allowed);
95
- this.showBankMessages(response);
96
- for (const warning of userWarnings(response.feedback))
97
- this.prompts.showWarning(warning);
98
- }
99
- async enterTan(dialog, approval) {
100
- const answer = await this.prompts.askTan(approval.challenge);
101
- if (answer.kind === 'approved') {
102
- throw invalidArgument('Answered a TAN challenge with an approval in the banking app', 'tanCallback');
103
- }
104
- const tan = answer.kind === 'tan' ? answer.tan.trim() : '';
105
- if (tan === '')
106
- throw new FinTsTanCancelledError();
107
- const response = await approval.submitTan(tan);
108
- this.receive(dialog, response, 'approval');
109
- return response;
110
- }
111
- awaitAppApproval(dialog, approval) {
112
- return appApprovalWait(approval, {
113
- ask: (challenge) => this.prompts.askTan(challenge),
114
- pause: (delayMs, interrupt) => this.prompts.pause(delayMs, interrupt),
115
- receive: (response) => {
116
- this.receive(dialog, response, 'approval');
117
- },
118
- }).run();
119
- }
120
- }
121
- //# sourceMappingURL=response-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"response-handler.js","sourceRoot":"","sources":["../../src/session/response-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AACrG,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,OAAO,EACP,SAAS,EACT,YAAY,GAEb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAMpD,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AC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,IAAI,GAAG,KAAK,EAAE;YAAE,MAAM,IAAI,sBAAsB,EAAE,CAAC;QACnD,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;QAC3C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEO,gBAAgB,CAAC,MAAuB,EAAE,QAAqB;QACrE,OAAO,eAAe,CAAC,QAAQ,EAAE;YAC/B,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;YAClD,KAAK,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC;YACrE,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE;gBACpB,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;YAC7C,CAAC;SACF,CAAC,CAAC,GAAG,EAAE,CAAC;IACX,CAAC;CACF"}
@@ -1,24 +0,0 @@
1
- import type { FinTsClientOptions } from '../core/client.js';
2
- import { FinTsConfig, type FinTsConfigInit } from '../core/config.js';
3
- import { PinTanClient } from '../session/pin-tan-client.js';
4
- import type { IncomingMessage3 } from './message.js';
5
- import type { SegmentSpec } from './syntax.js';
6
- /** What `FinTs3Client` takes. */
7
- export interface FinTs3ClientInit {
8
- /** Where and as whom to log in: a `FinTsConfig`, or what its constructor takes. */
9
- config: FinTsConfig | FinTsConfigInit;
10
- /** The user's PIN; the client keeps it in memory only and never logs it. */
11
- pin: string;
12
- /** How the client reaches the user and the bank. */
13
- options: FinTsClientOptions;
14
- }
15
- /** FinTS 3.0 PIN/TAN client, the version German banks use. */
16
- export declare class FinTs3Client extends PinTanClient<IncomingMessage3, SegmentSpec> {
17
- /**
18
- * Throws `TypeError` if the configuration is invalid, if the PIN is empty, or if the PIN or login data contain
19
- * characters FinTS 3.0 cannot send: it uses ISO 8859-1, so `€` and most non-Latin letters are not possible. Throws as
20
- * well for a product ID longer than 25 or a product version longer than 5 characters.
21
- */
22
- constructor(init: FinTs3ClientInit);
23
- }
24
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/v3/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,iCAAiC;AACjC,MAAM,WAAW,gBAAgB;IAC/B,mFAAmF;IACnF,MAAM,EAAE,WAAW,GAAG,eAAe,CAAC;IACtC,4EAA4E;IAC5E,GAAG,EAAE,MAAM,CAAC;IACZ,oDAAoD;IACpD,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED,8DAA8D;AAC9D,qBAAa,YAAa,SAAQ,YAAY,CAAC,gBAAgB,EAAE,WAAW,CAAC;IAC3E;;;;OAIG;gBACS,IAAI,EAAE,gBAAgB;CAInC"}
package/dist/v3/client.js DELETED
@@ -1,16 +0,0 @@
1
- import { FinTsConfig } from '../core/config.js';
2
- import { PinTanClient } from '../session/pin-tan-client.js';
3
- import { FinTs3Protocol } from './protocol.js';
4
- /** FinTS 3.0 PIN/TAN client, the version German banks use. */
5
- export class FinTs3Client extends PinTanClient {
6
- /**
7
- * Throws `TypeError` if the configuration is invalid, if the PIN is empty, or if the PIN or login data contain
8
- * characters FinTS 3.0 cannot send: it uses ISO 8859-1, so `€` and most non-Latin letters are not possible. Throws as
9
- * well for a product ID longer than 25 or a product version longer than 5 characters.
10
- */
11
- constructor(init) {
12
- const config = init.config instanceof FinTsConfig ? init.config : new FinTsConfig(init.config);
13
- super(init.options, (logger) => new FinTs3Protocol(config, init.pin, init.options.transport, logger));
14
- }
15
- }
16
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/v3/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAa/C,8DAA8D;AAC9D,MAAM,OAAO,YAAa,SAAQ,YAA2C;IAC3E;;;;OAIG;IACH,YAAY,IAAsB;QAChC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,YAAY,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/F,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IACxG,CAAC;CACF"}
@@ -1,51 +0,0 @@
1
- import type { MessageDirection, MessageLogger } from '../core/client.js';
2
- import { FinTsError, FinTsProtocolError, FinTsTransportError } from '../core/errors.js';
3
- import { HttpTransport, type FinTsTransport } from '../core/transport.js';
4
-
5
- /**
6
- * Throws `FinTsProtocolError` if a message of `size` bytes exceeds the bank's `limit` in kilobytes (1024 bytes): the
7
- * specification does not allow to send such a message.
8
- */
9
- export function checkMessageSize(size: number, limit: number | undefined): void {
10
- if (limit !== undefined && limit > 0 && size > limit * 1024) {
11
- throw new FinTsProtocolError(`A message of ${size} bytes exceeds the bank's maximum message size of ${limit} KB`);
12
- }
13
- }
14
-
15
- /** The bank's FinTS endpoint: posts messages there and reports them to the logger. */
16
- export class BankConnection {
17
- private readonly transport: FinTsTransport;
18
-
19
- /** A connection to `url` through `transport`, an `HttpTransport` by default. */
20
- constructor(
21
- /** Where the messages go. */
22
- readonly url: URL,
23
- transport: FinTsTransport | undefined,
24
- private readonly logger: MessageLogger | undefined,
25
- ) {
26
- this.transport = transport ?? new HttpTransport();
27
- }
28
-
29
- /**
30
- * Posts `body`; reports any failure of the transport as `FinTsError`, with the original as its `cause`: a custom
31
- * transport that calls `fetch` fails with a `TypeError` where the network does.
32
- */
33
- async post(body: Uint8Array, contentType: string): Promise<Uint8Array> {
34
- try {
35
- return await this.transport.post(this.url, body, contentType);
36
- } catch (error) {
37
- if (error instanceof FinTsError) throw error;
38
- throw new FinTsTransportError(error instanceof Error ? error.message : String(error), { cause: error });
39
- }
40
- }
41
-
42
- /** Reports a message to the logger; `message` is only built when a logger is set. */
43
- log(direction: MessageDirection, message: () => string): void {
44
- this.logger?.(direction, message());
45
- }
46
-
47
- /** Closes the transport. */
48
- close(): void {
49
- this.transport.close();
50
- }
51
- }