@mft/moneyhub-api-client 6.99.0 → 6.101.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +237 -3
- package/dist/exchange-code-for-token.d.ts +12 -4
- package/dist/exchange-code-for-token.d.ts.map +1 -1
- package/dist/exchange-code-for-token.js +77 -58
- package/dist/exchange-code-for-token.js.map +1 -1
- package/dist/get-auth-urls.d.ts +20 -14
- package/dist/get-auth-urls.d.ts.map +1 -1
- package/dist/get-auth-urls.js +33 -5
- package/dist/get-auth-urls.js.map +1 -1
- package/dist/index.d.ts +19 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pkce.d.ts +31 -0
- package/dist/pkce.d.ts.map +1 -0
- package/dist/pkce.js +3 -0
- package/dist/pkce.js.map +1 -0
- package/dist/requests/caas/types/regular-transactions.d.ts +5 -6
- package/dist/requests/caas/types/regular-transactions.d.ts.map +1 -1
- package/dist/requests/caas/types/response-meta.d.ts +8 -0
- package/dist/requests/caas/types/response-meta.d.ts.map +1 -0
- package/dist/requests/caas/types/response-meta.js +3 -0
- package/dist/requests/caas/types/response-meta.js.map +1 -0
- package/dist/requests/caas/types/transactions.d.ts +3 -5
- package/dist/requests/caas/types/transactions.d.ts.map +1 -1
- package/dist/requests/index.d.ts +11 -0
- package/dist/requests/index.d.ts.map +1 -1
- package/dist/requests/index.js +2 -0
- package/dist/requests/index.js.map +1 -1
- package/dist/requests/standard-financial-statements.d.ts +5 -0
- package/dist/requests/standard-financial-statements.d.ts.map +1 -0
- package/dist/requests/standard-financial-statements.js +23 -0
- package/dist/requests/standard-financial-statements.js.map +1 -0
- package/dist/requests/types/standard-financial-statements.d.ts +19 -0
- package/dist/requests/types/standard-financial-statements.d.ts.map +1 -0
- package/dist/requests/types/standard-financial-statements.js +3 -0
- package/dist/requests/types/standard-financial-statements.js.map +1 -0
- package/dist/requests/types/unauthenticated.d.ts +4 -0
- package/dist/requests/types/unauthenticated.d.ts.map +1 -1
- package/dist/requests/unauthenticated.d.ts.map +1 -1
- package/dist/requests/unauthenticated.js +1 -0
- package/dist/requests/unauthenticated.js.map +1 -1
- package/dist/schema/standard-financial-statement.d.ts +21 -0
- package/dist/schema/standard-financial-statement.d.ts.map +1 -0
- package/dist/schema/standard-financial-statement.js +3 -0
- package/dist/schema/standard-financial-statement.js.map +1 -0
- package/dist/tokens.d.ts +2 -4
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +13 -2
- package/dist/tokens.js.map +1 -1
- package/package.json +6 -5
- package/readme.md +130 -30
- package/scripts/assert-github-actions-publish.js +11 -1
- package/scripts/check-secrets.js +66 -0
- package/.idea/codeStyles/Project.xml +0 -21
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/dbnavigator.xml +0 -450
- package/.idea/git_toolbox_blame.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/jsLinters/eslint.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/moneyhub-api-client.iml +0 -12
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -338
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,71 @@
|
|
|
1
|
-
|
|
1
|
+
Unreleased
|
|
2
|
+
==========
|
|
3
|
+
|
|
4
|
+
**Bug Fixes**
|
|
5
|
+
|
|
6
|
+
* `caasPatchTransaction`: add `past-and-future` to `CaasRecategorisationType`.
|
|
7
|
+
|
|
8
|
+
6.101.0 / 2026-09-11
|
|
9
|
+
==========
|
|
10
|
+
|
|
11
|
+
**Features**
|
|
12
|
+
|
|
13
|
+
* **`getAuthorizeUrl` PKCE hooks**: optional `pkce.generate` + `pkce.storeVerifier` for server-side PKCE generation and persistence (defaults unchanged when omitted).
|
|
14
|
+
* **`exchangeCodeForTokens` PKCE hooks**: optional `pkce.consumeVerifier` to retrieve and apply a stored `code_verifier` at token exchange.
|
|
15
|
+
|
|
16
|
+
6.100.1 / 2026-08-18
|
|
17
|
+
==========
|
|
18
|
+
|
|
19
|
+
**Bug Fixes**
|
|
20
|
+
|
|
21
|
+
* Correct documentation and packaging hygiene ahead of 7.x: publish readme wording, endpoint coverage method names and test scripts, readme API examples, prerequisites URL, missing method docs (`accVerification`, `getPayee`, `getConsentHistory`, `confirmFundsForRecurringPayment`), CHANGELOG 6.99.0 phantom entry, package author typo, and `.npmignore` exclusions for `dist/__tests__` and env files.
|
|
22
|
+
|
|
23
|
+
6.100.0 / 2026-08-14
|
|
24
|
+
==========
|
|
25
|
+
|
|
26
|
+
**Features**
|
|
27
|
+
|
|
28
|
+
* **Standard financial statements**: `getStandardFinancialStatements` / `getStandardFinancialStatement` (scope `standard_financial_statement:read`).
|
|
29
|
+
* **Legacy connections**: `listLegacyConnections` (Identity `.well-known/legacy-connections`).
|
|
30
|
+
* `getAuthorizeUrl` with `accVerification: true` now adds `mh:account_verification` independently of `enableAsync` (previously nested under the async claim block).
|
|
31
|
+
* **ENDPOINT_COVERAGE.md** added to map API definitions to client methods.
|
|
32
|
+
* CHANGELOG backfill for undocumented 5.5.0–6.99.0 releases so history is complete ahead of the 7.x major line.
|
|
33
|
+
|
|
34
|
+
**Bug Fixes**
|
|
35
|
+
|
|
36
|
+
* Align `engines.node` with the 6.0.0 support policy: `>= 18.0.0` (Node 12, 14, and 16 were already unsupported from 6.0.0; `package.json` had incorrectly still declared `>= 12.0.0`).
|
|
37
|
+
|
|
38
|
+
6.99.0 / 2026-06-10
|
|
39
|
+
==========
|
|
40
|
+
|
|
41
|
+
**Features**
|
|
42
|
+
|
|
43
|
+
* Add CaaS custom category methods: `caasGetCustomCategories`, `caasCreateCustomCategory`, `caasDeleteCustomCategory`.
|
|
44
|
+
|
|
45
|
+
6.98.0 / 2026-06-09
|
|
46
|
+
==========
|
|
47
|
+
|
|
48
|
+
**Features**
|
|
49
|
+
|
|
50
|
+
* `caasGetTransactions` includes transaction `splits` when the client has the `caas:transaction_splits:read` scope (in addition to `caas:transactions:read`).
|
|
51
|
+
|
|
52
|
+
6.97.0 / 2026-06-04
|
|
53
|
+
==========
|
|
54
|
+
|
|
55
|
+
**Features**
|
|
56
|
+
|
|
57
|
+
* Add CaaS transaction split methods: `caasPutTransactionSplits`, `caasDeleteTransactionSplits`.
|
|
58
|
+
* Update CaaS transaction types.
|
|
59
|
+
|
|
60
|
+
6.96.0 / 2026-06-04
|
|
2
61
|
==========
|
|
3
62
|
|
|
4
63
|
**Features**
|
|
5
64
|
|
|
6
65
|
* Add `caasGetRegularTransactions` for CaaS `GET /accounts/{accountId}/regular-transactions`.
|
|
66
|
+
* Add `caasGetEnhancedTransaction` for CaaS enhanced transaction retrieval.
|
|
67
|
+
* Update counterparty types; gateway rewrite handling for versioned URL segments.
|
|
68
|
+
* Publishing: GitHub Actions npm publish with provenance and CI guards.
|
|
7
69
|
|
|
8
70
|
6.95.0 / 2026-02-23
|
|
9
71
|
==========
|
|
@@ -14,6 +76,39 @@
|
|
|
14
76
|
* `getOpenIdConfig()` uses a TTL cache backed by `@isaacs/ttlcache` (configurable via `options.openIdConfigCacheTtlMs`) and returns discovery with endpoint URLs rewritten to `gatewayIdentityServiceUrl` only when that option is set.
|
|
15
77
|
* Identity URLs are detected for versioning via the effective identity base (no hardcoded path prefix list); when provided, any request URL under that base does not have an API version segment added.
|
|
16
78
|
* See the readme section **Using the client behind a gateway** for configuration, verification, and security notes.
|
|
79
|
+
* Add CaaS methods (categories, counterparties, geotags, transactions, users), including `caasPatchTransaction` and `caasEnrichTransactions`.
|
|
80
|
+
* Add consent history methods.
|
|
81
|
+
* Add confirmation-of-funds support for recurring payments / VRP.
|
|
82
|
+
* Update SCIM user create payload shape; optional amount for VRP confirmation of funds.
|
|
83
|
+
* Add `l1CategoryGroupId` / `l1CategoryGroupName` to CaaS category types.
|
|
84
|
+
|
|
85
|
+
6.94.0 / 2025-09-10
|
|
86
|
+
==========
|
|
87
|
+
|
|
88
|
+
**Features**
|
|
89
|
+
|
|
90
|
+
* Add unenriched transaction methods: `getUnenrichedTransactions`, `getUnenrichedTransaction`.
|
|
91
|
+
|
|
92
|
+
6.93.1 / 2025-07-18
|
|
93
|
+
==========
|
|
94
|
+
|
|
95
|
+
**Features**
|
|
96
|
+
|
|
97
|
+
* Add `providerAccountId` to the Account schema.
|
|
98
|
+
|
|
99
|
+
6.93.0 / 2025-07-15
|
|
100
|
+
==========
|
|
101
|
+
|
|
102
|
+
**Features**
|
|
103
|
+
|
|
104
|
+
* Add `providerParentAccountId` to the Account type (e.g. Monzo pots support).
|
|
105
|
+
|
|
106
|
+
6.92.0 / 2025-05-19
|
|
107
|
+
==========
|
|
108
|
+
|
|
109
|
+
**Features**
|
|
110
|
+
|
|
111
|
+
* Add `categoriseTransactions` method and related types/examples.
|
|
17
112
|
|
|
18
113
|
6.91.0 / 2025-05-01
|
|
19
114
|
==================
|
|
@@ -23,30 +118,162 @@
|
|
|
23
118
|
* Add options for proxy agents
|
|
24
119
|
* Add createResellerCheckRequest method
|
|
25
120
|
|
|
121
|
+
6.9.0 / 2025-03-20
|
|
122
|
+
==========
|
|
123
|
+
|
|
124
|
+
**Features**
|
|
125
|
+
|
|
126
|
+
* Add `env` to create auth request params.
|
|
127
|
+
|
|
26
128
|
6.8.0 / 2025-03-12
|
|
27
129
|
==================
|
|
28
130
|
|
|
29
131
|
* Update User Connection Types
|
|
30
132
|
|
|
133
|
+
6.7.0 / 2025-02-25
|
|
134
|
+
==========
|
|
135
|
+
|
|
136
|
+
**Breaking Changes**
|
|
137
|
+
|
|
138
|
+
* Remove `getSCIMUsers` method.
|
|
139
|
+
|
|
140
|
+
**Bug Fixes**
|
|
141
|
+
|
|
142
|
+
* Fix `registerSCIMUser` TypeScript definitions.
|
|
143
|
+
|
|
144
|
+
6.6.0 / 2025-02-04
|
|
145
|
+
==========
|
|
146
|
+
|
|
147
|
+
**Features**
|
|
148
|
+
|
|
149
|
+
* Add configurable request retry options.
|
|
150
|
+
* Export connections types from the package index.
|
|
31
151
|
|
|
32
|
-
6.
|
|
152
|
+
6.5.2 / 2025-01-21
|
|
153
|
+
==========
|
|
154
|
+
|
|
155
|
+
**Bug Fixes**
|
|
156
|
+
|
|
157
|
+
* Patch release published to npm (exact commit not retained in the current repository history).
|
|
158
|
+
|
|
159
|
+
6.5.1 / 2025-01-15
|
|
160
|
+
==========
|
|
161
|
+
|
|
162
|
+
**Bug Fixes**
|
|
163
|
+
|
|
164
|
+
* Patch / version bump release.
|
|
165
|
+
|
|
166
|
+
6.5.0 / 2025-01-14
|
|
167
|
+
==========
|
|
168
|
+
|
|
169
|
+
**Features**
|
|
170
|
+
|
|
171
|
+
* Add mTLS options to client configuration.
|
|
172
|
+
* Add `accVerification` / account verification support on auth requests and authorisation URLs.
|
|
173
|
+
* Add `targetDate` support on savings goals; adjust update savings goal behaviour.
|
|
174
|
+
* Add `revokedAt` to VRP response type.
|
|
175
|
+
* Make `sub` and client secret optional where not required by the auth method.
|
|
176
|
+
* Add max retry-after option for requests.
|
|
177
|
+
|
|
178
|
+
6.4.0 / 2024-08-27
|
|
179
|
+
==========
|
|
180
|
+
|
|
181
|
+
**Features**
|
|
182
|
+
|
|
183
|
+
* Add `getSCIMUser` method.
|
|
184
|
+
|
|
185
|
+
6.3.0 / 2024-08-06
|
|
186
|
+
==========
|
|
187
|
+
|
|
188
|
+
**Features**
|
|
189
|
+
|
|
190
|
+
* Add `registerSCIMUser` method.
|
|
191
|
+
|
|
192
|
+
6.2.0 / 2024-08-05
|
|
193
|
+
==========
|
|
194
|
+
|
|
195
|
+
**Features**
|
|
196
|
+
|
|
197
|
+
* Add `accountTypes` and `accountIdentification` to auth requests.
|
|
198
|
+
* Update recurring payment types.
|
|
199
|
+
|
|
200
|
+
6.1.2 / 2024-06-19
|
|
201
|
+
==========
|
|
202
|
+
|
|
203
|
+
**Features**
|
|
204
|
+
|
|
205
|
+
* Update pay-link types with additional parameters.
|
|
206
|
+
|
|
207
|
+
6.1.1 / 2024-05-21
|
|
208
|
+
==========
|
|
209
|
+
|
|
210
|
+
**Features**
|
|
211
|
+
|
|
212
|
+
* Add `payerType: api-payer` and payer to payment claims.
|
|
213
|
+
|
|
214
|
+
6.1.0 / 2024-04-23
|
|
215
|
+
==========
|
|
216
|
+
|
|
217
|
+
**Features**
|
|
218
|
+
|
|
219
|
+
* Add account statements methods.
|
|
220
|
+
* Support API v3 URL handling and related refactoring.
|
|
221
|
+
|
|
222
|
+
6.0.0 / 2024-04-08
|
|
33
223
|
==================
|
|
34
224
|
|
|
35
225
|
**Breaking Changes**
|
|
36
226
|
|
|
37
|
-
* End-Of-Life versions of Node.js as of October 2023 are no longer supported.
|
|
227
|
+
* End-Of-Life versions of Node.js as of October 2023 are no longer supported. Requires Node.js >= 18.0.0 (supports Node.js 18, 20, and future releases). Node 12, 14, and 16 are unsupported from this release.
|
|
38
228
|
|
|
39
229
|
**Features**
|
|
40
230
|
|
|
41
231
|
* Add permissionsAction to authorisation URL generation methods.
|
|
42
232
|
* Add customerIpAddress and customerLastLoggedTime to createAuthRequest
|
|
43
233
|
|
|
234
|
+
5.91.2 / 2023-12-05
|
|
235
|
+
==========
|
|
236
|
+
|
|
237
|
+
**Bug Fixes**
|
|
238
|
+
|
|
239
|
+
* Patch release published to npm (exact commit not retained in the current repository history).
|
|
240
|
+
|
|
241
|
+
5.91.1 / 2023-11-15
|
|
242
|
+
==========
|
|
243
|
+
|
|
244
|
+
**Bug Fixes**
|
|
245
|
+
|
|
246
|
+
* Patch / version bump release.
|
|
247
|
+
|
|
248
|
+
5.91.0 / 2023-11-15
|
|
249
|
+
==========
|
|
250
|
+
|
|
251
|
+
**Features**
|
|
252
|
+
|
|
253
|
+
* Add pay-link methods.
|
|
254
|
+
|
|
255
|
+
5.9.0 / 2023-11-14
|
|
256
|
+
==========
|
|
257
|
+
|
|
258
|
+
**Features**
|
|
259
|
+
|
|
260
|
+
* Maintenance / packaging release.
|
|
261
|
+
|
|
262
|
+
5.8.0 / 2023-09-11
|
|
263
|
+
==========
|
|
264
|
+
|
|
265
|
+
**Features**
|
|
266
|
+
|
|
267
|
+
* Add automatic versioning of API URLs with customisation.
|
|
268
|
+
* Add `enableAsync` option for syncs.
|
|
269
|
+
|
|
44
270
|
5.7.0 / 2023-09-11
|
|
45
271
|
==================
|
|
46
272
|
|
|
47
273
|
**Features**
|
|
48
274
|
|
|
49
275
|
* Add OSIP methods
|
|
276
|
+
* Add balance notification threshold methods
|
|
50
277
|
|
|
51
278
|
5.6.1 / 2023-09-06
|
|
52
279
|
==================
|
|
@@ -62,6 +289,13 @@
|
|
|
62
289
|
|
|
63
290
|
* Add detectRegularTransactions
|
|
64
291
|
|
|
292
|
+
5.5.0 / 2023-07-25
|
|
293
|
+
==========
|
|
294
|
+
|
|
295
|
+
**Features**
|
|
296
|
+
|
|
297
|
+
* Intermediate release published the same day as 5.6.0 (see 5.6.0 for `detectRegularTransactions`).
|
|
298
|
+
|
|
65
299
|
5.4.0 / 2023-06-19
|
|
66
300
|
==================
|
|
67
301
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TokenSet } from "openid-client";
|
|
2
2
|
import type { Client } from "openid-client";
|
|
3
|
+
import type { PkceExchangeOptions } from "./pkce";
|
|
3
4
|
declare const ALLOWED_PARAMS: readonly ["access_token", "code", "error", "error_description", "error_uri", "expires_in", "id_token", "state", "token_type", "session_state"];
|
|
4
5
|
export declare type ParamsFromCallback = {
|
|
5
6
|
[K in typeof ALLOWED_PARAMS[number]]?: any;
|
|
@@ -12,12 +13,19 @@ export interface LocalParams {
|
|
|
12
13
|
code_verifier?: any;
|
|
13
14
|
sub?: any;
|
|
14
15
|
}
|
|
16
|
+
export interface ExchangeCodeForTokensOptions {
|
|
17
|
+
paramsFromCallback: ParamsFromCallback;
|
|
18
|
+
localParams: LocalParams;
|
|
19
|
+
}
|
|
20
|
+
export interface ExchangeCodeForTokensUsingPKCEOptions extends ExchangeCodeForTokensOptions {
|
|
21
|
+
pkce?: PkceExchangeOptions;
|
|
22
|
+
}
|
|
15
23
|
declare const _default: ({ client, redirectUri, }: {
|
|
16
24
|
client: Client;
|
|
17
25
|
redirectUri: string;
|
|
18
|
-
}) =>
|
|
19
|
-
paramsFromCallback:
|
|
20
|
-
localParams:
|
|
21
|
-
}
|
|
26
|
+
}) => {
|
|
27
|
+
exchangeCodeForTokens: ({ paramsFromCallback, localParams, }: ExchangeCodeForTokensOptions) => Promise<TokenSet>;
|
|
28
|
+
exchangeCodeForTokensUsingPKCE: ({ paramsFromCallback, localParams, pkce, }: ExchangeCodeForTokensUsingPKCEOptions) => Promise<TokenSet>;
|
|
29
|
+
};
|
|
22
30
|
export default _default;
|
|
23
31
|
//# sourceMappingURL=exchange-code-for-token.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exchange-code-for-token.d.ts","sourceRoot":"","sources":["../src/exchange-code-for-token.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAA;AACtC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAA;AAGzC,QAAA,MAAM,cAAc,gJAWV,CAAA;AAEV,oBAAY,kBAAkB,GAAG;KAC9B,CAAC,IAAI,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG;CAC3C,CAAA;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,GAAG,CAAA;IACb,KAAK,EAAE,GAAG,CAAA;IACV,aAAa,CAAC,EAAE,GAAG,CAAA;IACnB,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,aAAa,CAAC,EAAE,GAAG,CAAA;IACnB,GAAG,CAAC,EAAE,GAAG,CAAA;CACV;;YAiBS,MAAM;iBACD,MAAM;;
|
|
1
|
+
{"version":3,"file":"exchange-code-for-token.d.ts","sourceRoot":"","sources":["../src/exchange-code-for-token.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAA;AACtC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAA;AAGzC,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,QAAQ,CAAA;AAE/C,QAAA,MAAM,cAAc,gJAWV,CAAA;AAEV,oBAAY,kBAAkB,GAAG;KAC9B,CAAC,IAAI,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG;CAC3C,CAAA;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,GAAG,CAAA;IACb,KAAK,EAAE,GAAG,CAAA;IACV,aAAa,CAAC,EAAE,GAAG,CAAA;IACnB,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,aAAa,CAAC,EAAE,GAAG,CAAA;IACnB,GAAG,CAAC,EAAE,GAAG,CAAA;CACV;AAED,MAAM,WAAW,4BAA4B;IAC3C,kBAAkB,EAAE,kBAAkB,CAAA;IACtC,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,MAAM,WAAW,qCAAsC,SAAQ,4BAA4B;IACzF,IAAI,CAAC,EAAE,mBAAmB,CAAA;CAC3B;;YAiBS,MAAM;iBACD,MAAM;;kEAKhB,4BAA4B,KAAG,QAAQ,QAAQ,CAAC;iFA8FhD,qCAAqC,KAAG,QAAQ,QAAQ,CAAC;;AAxG9D,wBA8HC"}
|
|
@@ -45,70 +45,89 @@ const RESPONSE_TYPE_REQUIRED_PARAMS = {
|
|
|
45
45
|
id_token: ["id_token"],
|
|
46
46
|
token: ["access_token", "token_type"],
|
|
47
47
|
};
|
|
48
|
-
exports.default = ({ client, redirectUri, }) =>
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
|
|
48
|
+
exports.default = ({ client, redirectUri, }) => {
|
|
49
|
+
const exchangeCodeForTokens = ({ paramsFromCallback, localParams, }) => {
|
|
50
|
+
const params = R.pick(ALLOWED_PARAMS, paramsFromCallback);
|
|
51
|
+
const checks = localParams;
|
|
52
|
+
if (client.default_max_age && !checks.max_age)
|
|
53
|
+
checks.max_age = client.default_max_age;
|
|
54
|
+
if (!params.state && checks.state) {
|
|
55
|
+
return Promise.reject(new Error("paramsFromCallback.state is missing"));
|
|
56
|
+
}
|
|
57
|
+
if (params.state && !checks.state) {
|
|
58
|
+
return Promise.reject(new Error("localParams.state argument is missing"));
|
|
59
|
+
}
|
|
60
|
+
if (checks.state !== params.state) {
|
|
61
|
+
return Promise.reject(new Error("state mismatch"));
|
|
62
|
+
}
|
|
63
|
+
if (params.error) {
|
|
64
|
+
return Promise.reject(new Error(params.error));
|
|
65
|
+
}
|
|
66
|
+
if (!params.code) {
|
|
67
|
+
return Promise.reject(new Error("paramsFromCallback.code is missing"));
|
|
68
|
+
}
|
|
69
|
+
if (checks.response_type) {
|
|
70
|
+
for (const type of checks.response_type.split(" ")) {
|
|
71
|
+
if (type === "none") {
|
|
72
|
+
if (params.code || params.id_token || params.access_token) {
|
|
73
|
+
return Promise.reject(new Error("unexpected params encountered for 'none' response"));
|
|
74
|
+
}
|
|
73
75
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
else {
|
|
77
|
+
for (const param of RESPONSE_TYPE_REQUIRED_PARAMS[type]) {
|
|
78
|
+
if (!params[param]) {
|
|
79
|
+
return Promise.reject(new Error(`${param} missing from response`));
|
|
80
|
+
}
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
tokenset
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
85
|
+
let promise;
|
|
86
|
+
if (params.id_token) {
|
|
87
|
+
promise = Promise.resolve(new openid_client_1.TokenSet(params))
|
|
88
|
+
.then((tokenset) => client.decryptIdToken(tokenset))
|
|
89
|
+
.then((tokenset) => client.validateIdToken(tokenset, checks.nonce, "authorization", checks.max_age, checks.state));
|
|
90
|
+
}
|
|
91
|
+
if (params.code) {
|
|
92
|
+
const grantCall = () => client.grant({
|
|
93
|
+
grant_type: "authorization_code",
|
|
94
|
+
code: params.code,
|
|
95
|
+
redirect_uri: redirectUri,
|
|
96
|
+
code_verifier: checks.code_verifier,
|
|
97
|
+
sub: localParams.sub,
|
|
98
|
+
})
|
|
99
|
+
.then((tokenset) => client.decryptIdToken(tokenset))
|
|
100
|
+
.then((tokenset) => client.validateIdToken(tokenset, checks.nonce, "token", checks.max_age))
|
|
101
|
+
.then((tokenset) => {
|
|
102
|
+
if (params.session_state)
|
|
103
|
+
tokenset.session_state = params.session_state;
|
|
104
|
+
return tokenset;
|
|
105
|
+
});
|
|
106
|
+
if (promise) {
|
|
107
|
+
promise = promise.then(grantCall);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
return grantCall();
|
|
111
|
+
}
|
|
107
112
|
}
|
|
108
|
-
|
|
109
|
-
|
|
113
|
+
return promise || Promise.resolve(new openid_client_1.TokenSet(params));
|
|
114
|
+
};
|
|
115
|
+
const exchangeCodeForTokensUsingPKCE = async ({ paramsFromCallback, localParams, pkce, }) => {
|
|
116
|
+
if ((pkce === null || pkce === void 0 ? void 0 : pkce.consumeVerifier) && localParams.code_verifier) {
|
|
117
|
+
return Promise.reject(new Error("Provide code_verifier via pkce.consumeVerifier or localParams.code_verifier, not both"));
|
|
110
118
|
}
|
|
111
|
-
|
|
112
|
-
|
|
119
|
+
if (pkce === null || pkce === void 0 ? void 0 : pkce.consumeVerifier) {
|
|
120
|
+
const code_verifier = await pkce.consumeVerifier({ state: localParams.state });
|
|
121
|
+
return exchangeCodeForTokens({
|
|
122
|
+
paramsFromCallback,
|
|
123
|
+
localParams: { ...localParams, code_verifier },
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return exchangeCodeForTokens({ paramsFromCallback, localParams });
|
|
127
|
+
};
|
|
128
|
+
return {
|
|
129
|
+
exchangeCodeForTokens,
|
|
130
|
+
exchangeCodeForTokensUsingPKCE,
|
|
131
|
+
};
|
|
113
132
|
};
|
|
114
133
|
//# sourceMappingURL=exchange-code-for-token.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exchange-code-for-token.js","sourceRoot":"","sources":["../src/exchange-code-for-token.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA+B;AAC/B,mCAAmC;AACnC,iDAAsC;AAEtC,yCAA0B;
|
|
1
|
+
{"version":3,"file":"exchange-code-for-token.js","sourceRoot":"","sources":["../src/exchange-code-for-token.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA+B;AAC/B,mCAAmC;AACnC,iDAAsC;AAEtC,yCAA0B;AAI1B,MAAM,cAAc,GAAG;IACrB,cAAc;IACd,MAAM;IACN,OAAO;IACP,mBAAmB;IACnB,WAAW;IACX,YAAY;IACZ,UAAU;IACV,OAAO;IACP,YAAY;IACZ,eAAe;CACP,CAAA;AA0BV,MAAM,6BAA6B,GAE/B;IACF,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,KAAK,EAAE,CAAC,cAAc,EAAE,YAAY,CAAC;CACtC,CAAA;AAED,kBAAe,CAAC,EACd,MAAM,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ACrB,8BAA8B;KAC/B,CAAA;AACH,CAAC,CAAA"}
|
package/dist/get-auth-urls.d.ts
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
/// <reference types="mocha" />
|
|
2
2
|
import type { Client } from "openid-client";
|
|
3
3
|
import type { ApiClientConfig } from "./schema/config";
|
|
4
|
-
import {
|
|
4
|
+
import type { PkceAuthoriseOptions } from "./pkce";
|
|
5
|
+
import type { PayerType, PaymentActorType } from "./schema/payment";
|
|
5
6
|
import { StandingOrderFrequency } from "./schema/standing-order";
|
|
6
7
|
import { RequestPayee, RequestPayer } from "./schema/payee";
|
|
7
8
|
import { PermissionsAction } from "./requests/types/auth-requests";
|
|
9
|
+
export interface GetAuthorizeUrlOptions {
|
|
10
|
+
state?: string;
|
|
11
|
+
scope: string;
|
|
12
|
+
nonce?: string;
|
|
13
|
+
claims?: any;
|
|
14
|
+
permissions?: string[];
|
|
15
|
+
permissionsAction?: PermissionsAction;
|
|
16
|
+
enableAsync?: boolean;
|
|
17
|
+
accVerification?: boolean;
|
|
18
|
+
expirationDateTime?: string;
|
|
19
|
+
transactionFromDateTime?: string;
|
|
20
|
+
codeChallenge?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface GetAuthorizeUrlUsingPKCEOptions extends GetAuthorizeUrlOptions {
|
|
23
|
+
pkce?: PkceAuthoriseOptions;
|
|
24
|
+
}
|
|
8
25
|
declare type PkceParams = {
|
|
9
26
|
code_challenge: string;
|
|
10
27
|
code_challenge_method: string;
|
|
@@ -13,19 +30,8 @@ declare const _default: ({ client, config, }: {
|
|
|
13
30
|
client: Client;
|
|
14
31
|
config: ApiClientConfig;
|
|
15
32
|
}) => {
|
|
16
|
-
getAuthorizeUrl: ({ state, scope, nonce, claims, permissions, permissionsAction, enableAsync, accVerification, expirationDateTime, transactionFromDateTime, codeChallenge, }:
|
|
17
|
-
|
|
18
|
-
scope: string;
|
|
19
|
-
nonce?: string | undefined;
|
|
20
|
-
claims?: any;
|
|
21
|
-
permissions?: string[] | undefined;
|
|
22
|
-
permissionsAction?: PermissionsAction | undefined;
|
|
23
|
-
enableAsync?: boolean | undefined;
|
|
24
|
-
accVerification?: boolean | undefined;
|
|
25
|
-
expirationDateTime?: string | undefined;
|
|
26
|
-
transactionFromDateTime?: string | undefined;
|
|
27
|
-
codeChallenge?: string | undefined;
|
|
28
|
-
}) => Promise<string>;
|
|
33
|
+
getAuthorizeUrl: ({ state, scope, nonce, claims, permissions, permissionsAction, enableAsync, accVerification, expirationDateTime, transactionFromDateTime, codeChallenge, }: GetAuthorizeUrlOptions) => Promise<string>;
|
|
34
|
+
getAuthorizeUrlUsingPKCE: ({ pkce, ...options }: GetAuthorizeUrlUsingPKCEOptions) => Promise<string>;
|
|
29
35
|
getAuthorizeUrlLegacy: ({ state, scope, nonce, claims, permissions, permissionsAction, enableAsync, expirationDateTime, transactionFromDateTime, codeChallenge, }: {
|
|
30
36
|
state?: string | undefined;
|
|
31
37
|
scope: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-auth-urls.d.ts","sourceRoot":"","sources":["../src/get-auth-urls.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"get-auth-urls.d.ts","sourceRoot":"","sources":["../src/get-auth-urls.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAA;AAIzC,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,QAAQ,CAAA;AAChD,OAAO,KAAK,EAAC,SAAS,EAAE,gBAAgB,EAAC,MAAM,kBAAkB,CAAA;AACjE,OAAO,EAAC,sBAAsB,EAAC,MAAM,yBAAyB,CAAA;AAC9D,OAAO,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAC,iBAAiB,EAA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AG;;;;;;;gBAsEJ,MAAM;;;;;;;;;;;yBAWG,GAAG;;;;;gBAKZ,MAAM;iBACL,GAAG;;;;gBA+EJ,MAAM;;;;;;mBAMH,MAAM;mBACN,sBAAsB;;4BAEb,MAAM;gCACF,MAAM;4BACV,MAAM;;0BAER,MAAM;8BACF,MAAM;0BACV,MAAM;;;iBAGf,MAAM;iBACN,GAAG;;;;gBAmEJ,MAAM;;;;;iBAKL,GAAG;;;;;;;;;AAxzBlB,wBAg2BC"}
|
package/dist/get-auth-urls.js
CHANGED
|
@@ -27,8 +27,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const got_1 = __importDefault(require("got"));
|
|
30
|
+
const openid_client_1 = require("openid-client");
|
|
30
31
|
const R = __importStar(require("ramda"));
|
|
31
32
|
const filterUndefined = R.reject(R.isNil);
|
|
33
|
+
const resolveAuthoriseCodeChallenge = async ({ state, codeChallenge, pkce, }) => {
|
|
34
|
+
if (!(pkce === null || pkce === void 0 ? void 0 : pkce.generate)) {
|
|
35
|
+
return codeChallenge;
|
|
36
|
+
}
|
|
37
|
+
if (codeChallenge) {
|
|
38
|
+
throw new Error("Provide either pkce.generate or codeChallenge, not both");
|
|
39
|
+
}
|
|
40
|
+
if (!pkce.storeVerifier) {
|
|
41
|
+
throw new Error("pkce.storeVerifier is required when pkce.generate is true");
|
|
42
|
+
}
|
|
43
|
+
if (!state) {
|
|
44
|
+
throw new Error("state is required when pkce.generate is true");
|
|
45
|
+
}
|
|
46
|
+
const codeVerifier = openid_client_1.generators.codeVerifier();
|
|
47
|
+
const resolvedCodeChallenge = openid_client_1.generators.codeChallenge(codeVerifier);
|
|
48
|
+
await pkce.storeVerifier({ state, codeVerifier });
|
|
49
|
+
return resolvedCodeChallenge;
|
|
50
|
+
};
|
|
32
51
|
exports.default = ({ client, config, }) => {
|
|
33
52
|
const { identityServiceUrl, client: { client_id, redirect_uri, response_type, }, } = config;
|
|
34
53
|
const setPermissionsToClaims = (permissions, permissionsAction) => (claims) => {
|
|
@@ -100,11 +119,11 @@ exports.default = ({ client, config, }) => {
|
|
|
100
119
|
"essential": true,
|
|
101
120
|
"value": { "enableAsync": true },
|
|
102
121
|
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
},
|
|
122
|
+
},
|
|
123
|
+
...accVerification && {
|
|
124
|
+
"mh:account_verification": {
|
|
125
|
+
"essential": true,
|
|
126
|
+
"value": { "accVerification": true },
|
|
108
127
|
},
|
|
109
128
|
},
|
|
110
129
|
},
|
|
@@ -118,6 +137,14 @@ exports.default = ({ client, config, }) => {
|
|
|
118
137
|
pkceParams,
|
|
119
138
|
});
|
|
120
139
|
};
|
|
140
|
+
const getAuthorizeUrlUsingPKCE = async ({ pkce, ...options }) => {
|
|
141
|
+
const codeChallenge = await resolveAuthoriseCodeChallenge({
|
|
142
|
+
state: options.state,
|
|
143
|
+
codeChallenge: options.codeChallenge,
|
|
144
|
+
pkce,
|
|
145
|
+
});
|
|
146
|
+
return getAuthorizeUrl({ ...options, codeChallenge });
|
|
147
|
+
};
|
|
121
148
|
const getAuthorizeUrlLegacy = ({ state, scope, nonce, claims = {}, permissions, permissionsAction, enableAsync, expirationDateTime, transactionFromDateTime, codeChallenge, }) => {
|
|
122
149
|
const pkceParams = codeChallenge ? {
|
|
123
150
|
code_challenge: codeChallenge,
|
|
@@ -177,6 +204,7 @@ exports.default = ({ client, config, }) => {
|
|
|
177
204
|
};
|
|
178
205
|
return {
|
|
179
206
|
getAuthorizeUrl,
|
|
207
|
+
getAuthorizeUrlUsingPKCE,
|
|
180
208
|
getAuthorizeUrlLegacy,
|
|
181
209
|
getAuthorizeUrlFromRequestUri,
|
|
182
210
|
requestObject: getRequestObject,
|