@pagopa/io-wallet-oauth2 2.0.0-launchpad → 2.0.2-apt
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/dist/index.d.mts +368 -205
- package/dist/index.d.ts +368 -205
- package/dist/index.js +592 -340
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +401 -145
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -51,6 +51,8 @@ __export(index_exports, {
|
|
|
51
51
|
createPushedAuthorizationRequest: () => createPushedAuthorizationRequest,
|
|
52
52
|
createTokenDPoP: () => createTokenDPoP,
|
|
53
53
|
createTokenRequest: () => createTokenRequest,
|
|
54
|
+
createTokenRequestAPTITUDE: () => createTokenRequestAPTITUDE,
|
|
55
|
+
createTokenRequestV1_4: () => createTokenRequestV1_4,
|
|
54
56
|
createWalletAttestationJwtV1_0: () => createWalletAttestationJwt,
|
|
55
57
|
createWalletAttestationJwtV1_3: () => createWalletAttestationJwt2,
|
|
56
58
|
createWalletAttestationJwtV1_4: () => createWalletAttestationJwt3,
|
|
@@ -73,6 +75,7 @@ __export(index_exports, {
|
|
|
73
75
|
parseJarRequest: () => parseJarRequest,
|
|
74
76
|
parseMrtdChallenge: () => parseMrtdChallenge,
|
|
75
77
|
parsePushedAuthorizationRequest: () => parsePushedAuthorizationRequest,
|
|
78
|
+
preAuthorizedCodeGrantIdentifier: () => preAuthorizedCodeGrantIdentifier,
|
|
76
79
|
refreshTokenGrantIdentifier: () => refreshTokenGrantIdentifier,
|
|
77
80
|
signedAuthorizationRequestJwtHeaderTyp: () => signedAuthorizationRequestJwtHeaderTyp,
|
|
78
81
|
toURLSearchParams: () => toURLSearchParams,
|
|
@@ -93,8 +96,10 @@ __export(index_exports, {
|
|
|
93
96
|
zAccessTokenProfileJwtHeader: () => zAccessTokenProfileJwtHeader,
|
|
94
97
|
zAccessTokenProfileJwtPayload: () => zAccessTokenProfileJwtPayload,
|
|
95
98
|
zAccessTokenRequest: () => zAccessTokenRequest,
|
|
99
|
+
zAccessTokenRequestAPTITUDE: () => zAccessTokenRequestAPTITUDE,
|
|
96
100
|
zAccessTokenResponse: () => zAccessTokenResponse,
|
|
97
101
|
zAuthorizationCodeGrantIdentifier: () => zAuthorizationCodeGrantIdentifier,
|
|
102
|
+
zAuthorizationCodeTokenRequest: () => zAuthorizationCodeTokenRequest,
|
|
98
103
|
zAuthorizationRequestV1_0: () => zAuthorizationRequestV1_0,
|
|
99
104
|
zAuthorizationRequestV1_3: () => zAuthorizationRequestV1_3,
|
|
100
105
|
zDpopJwtHeader: () => zDpopJwtHeader,
|
|
@@ -113,6 +118,8 @@ __export(index_exports, {
|
|
|
113
118
|
zMrtdPopVerifyResponse: () => zMrtdPopVerifyResponse,
|
|
114
119
|
zMrtdValidationJwtHeader: () => zMrtdValidationJwtHeader,
|
|
115
120
|
zMrtdValidationJwtPayload: () => zMrtdValidationJwtPayload,
|
|
121
|
+
zPreAuthorizedCodeGrantIdentifier: () => zPreAuthorizedCodeGrantIdentifier,
|
|
122
|
+
zPreAuthorizedCodeTokenRequest: () => zPreAuthorizedCodeTokenRequest,
|
|
116
123
|
zPushedAuthorizationRequestSigned: () => zPushedAuthorizationRequestSigned,
|
|
117
124
|
zPushedAuthorizationRequestUnsignedV1_0: () => zPushedAuthorizationRequestUnsignedV1_0,
|
|
118
125
|
zPushedAuthorizationRequestUnsignedV1_3: () => zPushedAuthorizationRequestUnsignedV1_3,
|
|
@@ -120,6 +127,7 @@ __export(index_exports, {
|
|
|
120
127
|
zRefreshTokenGrantIdentifier: () => zRefreshTokenGrantIdentifier,
|
|
121
128
|
zRefreshTokenProfileJwtHeader: () => zRefreshTokenProfileJwtHeader,
|
|
122
129
|
zRefreshTokenProfileJwtPayload: () => zRefreshTokenProfileJwtPayload,
|
|
130
|
+
zRefreshTokenTokenRequest: () => zRefreshTokenTokenRequest,
|
|
123
131
|
zSignedAuthorizationRequestJwtHeaderTyp: () => zSignedAuthorizationRequestJwtHeaderTyp,
|
|
124
132
|
zWalletAttestationJwtHeaderV1_0: () => zWalletAttestationJwtHeaderV1_0,
|
|
125
133
|
zWalletAttestationJwtHeaderV1_3: () => zWalletAttestationJwtHeaderV1_3,
|
|
@@ -134,16 +142,60 @@ __export(index_exports, {
|
|
|
134
142
|
module.exports = __toCommonJS(index_exports);
|
|
135
143
|
|
|
136
144
|
// src/access-token/create-token-request.ts
|
|
137
|
-
var
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
145
|
+
var import_io_wallet_utils = require("@pagopa/io-wallet-utils");
|
|
146
|
+
|
|
147
|
+
// src/access-token/z-grant-type.ts
|
|
148
|
+
var import_zod = require("zod");
|
|
149
|
+
var zAuthorizationCodeGrantIdentifier = import_zod.z.literal("authorization_code");
|
|
150
|
+
var authorizationCodeGrantIdentifier = zAuthorizationCodeGrantIdentifier.value;
|
|
151
|
+
var zPreAuthorizedCodeGrantIdentifier = import_zod.z.literal(
|
|
152
|
+
"urn:ietf:params:oauth:grant-type:pre-authorized_code"
|
|
153
|
+
);
|
|
154
|
+
var preAuthorizedCodeGrantIdentifier = zPreAuthorizedCodeGrantIdentifier.value;
|
|
155
|
+
var zRefreshTokenGrantIdentifier = import_zod.z.literal("refresh_token");
|
|
156
|
+
var refreshTokenGrantIdentifier = zRefreshTokenGrantIdentifier.value;
|
|
157
|
+
|
|
158
|
+
// src/access-token/create-token-request.ts
|
|
159
|
+
var createTokenRequestV1_4 = (options) => {
|
|
160
|
+
if (options.grantType === refreshTokenGrantIdentifier) {
|
|
161
|
+
return {
|
|
162
|
+
...options.additionalRequestPayload,
|
|
163
|
+
grant_type: refreshTokenGrantIdentifier,
|
|
164
|
+
refresh_token: options.refreshToken,
|
|
165
|
+
scope: options.scope
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
...options.additionalRequestPayload,
|
|
170
|
+
code: options.authorizationCode,
|
|
171
|
+
code_verifier: options.pkceCodeVerifier,
|
|
172
|
+
grant_type: authorizationCodeGrantIdentifier,
|
|
173
|
+
redirect_uri: options.redirectUri
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
function createTokenRequestAPTITUDE(options) {
|
|
177
|
+
if (options.grantType === preAuthorizedCodeGrantIdentifier) {
|
|
178
|
+
return {
|
|
179
|
+
...options.additionalRequestPayload,
|
|
180
|
+
grant_type: preAuthorizedCodeGrantIdentifier,
|
|
181
|
+
"pre-authorized_code": options.preAuthorizedCode,
|
|
182
|
+
tx_code: options.txCode
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
return createTokenRequestV1_4(options);
|
|
186
|
+
}
|
|
187
|
+
var dispatchCreateTokenRequest = (0, import_io_wallet_utils.createVersionDispatcher)({
|
|
188
|
+
[import_io_wallet_utils.ItWalletSpecsVersion.APTITUDE]: (o) => createTokenRequestAPTITUDE(o),
|
|
189
|
+
[import_io_wallet_utils.ItWalletSpecsVersion.V1_0]: (o) => createTokenRequestV1_4(o),
|
|
190
|
+
[import_io_wallet_utils.ItWalletSpecsVersion.V1_3]: (o) => createTokenRequestV1_4(o),
|
|
191
|
+
[import_io_wallet_utils.ItWalletSpecsVersion.V1_4]: (o) => createTokenRequestV1_4(o)
|
|
143
192
|
});
|
|
193
|
+
function createTokenRequest(options) {
|
|
194
|
+
return dispatchCreateTokenRequest(options);
|
|
195
|
+
}
|
|
144
196
|
|
|
145
197
|
// src/access-token/create-token-response.ts
|
|
146
|
-
var
|
|
198
|
+
var import_io_wallet_utils3 = require("@pagopa/io-wallet-utils");
|
|
147
199
|
|
|
148
200
|
// src/errors.ts
|
|
149
201
|
var Oauth2Error = class extends Error {
|
|
@@ -202,71 +254,83 @@ var ClientAttestationError = class extends Oauth2Error {
|
|
|
202
254
|
};
|
|
203
255
|
|
|
204
256
|
// src/access-token/z-token.ts
|
|
205
|
-
var
|
|
206
|
-
var
|
|
207
|
-
var
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
257
|
+
var import_io_wallet_utils2 = require("@pagopa/io-wallet-utils");
|
|
258
|
+
var import_zod2 = require("zod");
|
|
259
|
+
var zPreAuthorizedCodeTokenRequest = import_zod2.z.object({
|
|
260
|
+
grant_type: zPreAuthorizedCodeGrantIdentifier,
|
|
261
|
+
"pre-authorized_code": import_zod2.z.string().nonempty(),
|
|
262
|
+
tx_code: import_zod2.z.string().optional()
|
|
263
|
+
});
|
|
264
|
+
var zAuthorizationCodeTokenRequest = import_zod2.z.object({
|
|
265
|
+
code: import_zod2.z.string().nonempty(),
|
|
266
|
+
code_verifier: import_zod2.z.string().nonempty(),
|
|
267
|
+
grant_type: zAuthorizationCodeGrantIdentifier,
|
|
268
|
+
redirect_uri: import_zod2.z.string().nonempty()
|
|
269
|
+
});
|
|
270
|
+
var zRefreshTokenTokenRequest = import_zod2.z.object({
|
|
271
|
+
grant_type: zRefreshTokenGrantIdentifier,
|
|
272
|
+
refresh_token: import_zod2.z.string().nonempty(),
|
|
273
|
+
scope: import_zod2.z.string().optional()
|
|
274
|
+
});
|
|
275
|
+
var zAccessTokenRequest = import_zod2.z.discriminatedUnion("grant_type", [
|
|
276
|
+
zAuthorizationCodeTokenRequest,
|
|
277
|
+
zRefreshTokenTokenRequest
|
|
219
278
|
]);
|
|
220
|
-
var
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
279
|
+
var zAccessTokenRequestAPTITUDE = import_zod2.z.discriminatedUnion("grant_type", [
|
|
280
|
+
zAuthorizationCodeTokenRequest,
|
|
281
|
+
zRefreshTokenTokenRequest,
|
|
282
|
+
zPreAuthorizedCodeTokenRequest
|
|
283
|
+
]);
|
|
284
|
+
var zAccessTokenResponse = import_zod2.z.looseObject({
|
|
285
|
+
access_token: import_zod2.z.string(),
|
|
286
|
+
authorization_details: import_zod2.z.array(
|
|
287
|
+
import_zod2.z.looseObject({
|
|
288
|
+
credential_configuration_id: import_zod2.z.optional(import_zod2.z.string()),
|
|
289
|
+
credential_identifiers: import_zod2.z.optional(import_zod2.z.array(import_zod2.z.string())),
|
|
290
|
+
type: import_zod2.z.literal("openid_credential")
|
|
227
291
|
})
|
|
228
292
|
).optional(),
|
|
229
|
-
expires_in:
|
|
230
|
-
refresh_token:
|
|
231
|
-
token_type:
|
|
293
|
+
expires_in: import_zod2.z.optional(import_zod2.z.number().int()),
|
|
294
|
+
refresh_token: import_zod2.z.optional(import_zod2.z.string()),
|
|
295
|
+
token_type: import_zod2.z.union([import_zod2.z.literal("Bearer"), import_zod2.z.literal("DPoP")])
|
|
232
296
|
});
|
|
233
|
-
var zAccessTokenProfileJwtHeader =
|
|
234
|
-
...
|
|
235
|
-
typ:
|
|
297
|
+
var zAccessTokenProfileJwtHeader = import_zod2.z.looseObject({
|
|
298
|
+
...import_io_wallet_utils2.zJwtHeader.shape,
|
|
299
|
+
typ: import_zod2.z.enum(["application/at+jwt", "at+jwt"])
|
|
236
300
|
});
|
|
237
|
-
var zAccessTokenProfileJwtPayload =
|
|
238
|
-
...
|
|
239
|
-
aud:
|
|
240
|
-
client_id:
|
|
241
|
-
cnf:
|
|
242
|
-
jkt:
|
|
301
|
+
var zAccessTokenProfileJwtPayload = import_zod2.z.looseObject({
|
|
302
|
+
...import_io_wallet_utils2.zJwtPayload.shape,
|
|
303
|
+
aud: import_zod2.z.string(),
|
|
304
|
+
client_id: import_zod2.z.string(),
|
|
305
|
+
cnf: import_zod2.z.object({
|
|
306
|
+
jkt: import_zod2.z.string()
|
|
243
307
|
}).optional(),
|
|
244
|
-
exp:
|
|
245
|
-
iat:
|
|
246
|
-
iss:
|
|
247
|
-
jti:
|
|
248
|
-
nbf:
|
|
249
|
-
scope:
|
|
250
|
-
sub:
|
|
308
|
+
exp: import_zod2.z.number(),
|
|
309
|
+
iat: import_zod2.z.number(),
|
|
310
|
+
iss: import_zod2.z.string(),
|
|
311
|
+
jti: import_zod2.z.string().max(import_io_wallet_utils2.MAX_JTI_LENGTH),
|
|
312
|
+
nbf: import_zod2.z.number().optional(),
|
|
313
|
+
scope: import_zod2.z.string().optional(),
|
|
314
|
+
sub: import_zod2.z.string()
|
|
251
315
|
});
|
|
252
|
-
var zRefreshTokenProfileJwtHeader =
|
|
253
|
-
...
|
|
254
|
-
kid:
|
|
255
|
-
typ:
|
|
316
|
+
var zRefreshTokenProfileJwtHeader = import_zod2.z.looseObject({
|
|
317
|
+
...import_io_wallet_utils2.zJwtHeader.shape,
|
|
318
|
+
kid: import_zod2.z.string(),
|
|
319
|
+
typ: import_zod2.z.literal("rt+jwt")
|
|
256
320
|
});
|
|
257
|
-
var zRefreshTokenProfileJwtPayload =
|
|
258
|
-
...
|
|
259
|
-
aud:
|
|
260
|
-
client_id:
|
|
261
|
-
cnf:
|
|
262
|
-
jkt:
|
|
321
|
+
var zRefreshTokenProfileJwtPayload = import_zod2.z.looseObject({
|
|
322
|
+
...import_io_wallet_utils2.zJwtPayload.shape,
|
|
323
|
+
aud: import_zod2.z.string(),
|
|
324
|
+
client_id: import_zod2.z.string(),
|
|
325
|
+
cnf: import_zod2.z.object({
|
|
326
|
+
jkt: import_zod2.z.string()
|
|
263
327
|
}),
|
|
264
|
-
exp:
|
|
265
|
-
iat:
|
|
266
|
-
iss:
|
|
267
|
-
jti:
|
|
268
|
-
nbf:
|
|
269
|
-
sub:
|
|
328
|
+
exp: import_zod2.z.number().int(),
|
|
329
|
+
iat: import_zod2.z.number().int(),
|
|
330
|
+
iss: import_zod2.z.string(),
|
|
331
|
+
jti: import_zod2.z.string().max(import_io_wallet_utils2.MAX_JTI_LENGTH),
|
|
332
|
+
nbf: import_zod2.z.number().int(),
|
|
333
|
+
sub: import_zod2.z.string()
|
|
270
334
|
});
|
|
271
335
|
|
|
272
336
|
// src/access-token/create-token-response.ts
|
|
@@ -295,7 +359,7 @@ function resolveRefreshTokenKid(signer) {
|
|
|
295
359
|
}
|
|
296
360
|
return void 0;
|
|
297
361
|
}
|
|
298
|
-
async function
|
|
362
|
+
async function createAccessTokenResponseV1_4(options) {
|
|
299
363
|
try {
|
|
300
364
|
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
301
365
|
if (options.tokenType === "DPoP" && !options.dpop) {
|
|
@@ -313,26 +377,26 @@ async function createAccessTokenResponse(options) {
|
|
|
313
377
|
`refreshTokenExpiresInSeconds (${options.refreshTokenExpiresInSeconds}) must be greater than expiresInSeconds (${options.expiresInSeconds}) so the Refresh Token remains usable after the Access Token expires.`
|
|
314
378
|
);
|
|
315
379
|
}
|
|
316
|
-
const dpopJkt = options.dpop ? await (0,
|
|
317
|
-
hashAlgorithm:
|
|
380
|
+
const dpopJkt = options.dpop ? await (0, import_io_wallet_utils3.calculateJwkThumbprint)({
|
|
381
|
+
hashAlgorithm: import_io_wallet_utils3.HashAlgorithm.Sha256,
|
|
318
382
|
hashCallback: options.callbacks.hash,
|
|
319
383
|
jwk: options.dpop.jwk
|
|
320
384
|
}) : void 0;
|
|
321
|
-
const accessTokenExpiresAt = (0,
|
|
385
|
+
const accessTokenExpiresAt = (0, import_io_wallet_utils3.addSecondsToDate)(
|
|
322
386
|
now,
|
|
323
387
|
options.expiresInSeconds
|
|
324
388
|
);
|
|
325
|
-
const header = (0,
|
|
326
|
-
...(0,
|
|
389
|
+
const header = (0, import_io_wallet_utils3.parseWithErrorHandling)(zAccessTokenProfileJwtHeader, {
|
|
390
|
+
...(0, import_io_wallet_utils3.jwtHeaderFromJwtSigner)(options.signer),
|
|
327
391
|
typ: "at+jwt"
|
|
328
392
|
});
|
|
329
|
-
const payload = (0,
|
|
393
|
+
const payload = (0, import_io_wallet_utils3.parseWithErrorHandling)(zAccessTokenProfileJwtPayload, {
|
|
330
394
|
...options.additionalPayload,
|
|
331
395
|
aud: options.audience,
|
|
332
396
|
client_id: options.clientId,
|
|
333
397
|
cnf: dpopJkt ? { jkt: dpopJkt } : void 0,
|
|
334
|
-
exp: (0,
|
|
335
|
-
iat: (0,
|
|
398
|
+
exp: (0, import_io_wallet_utils3.dateToSeconds)(accessTokenExpiresAt),
|
|
399
|
+
iat: (0, import_io_wallet_utils3.dateToSeconds)(now),
|
|
336
400
|
iss: options.authorizationServer,
|
|
337
401
|
jti: await generateUuidV4(options.callbacks.generateRandom),
|
|
338
402
|
nbf: options.nbf,
|
|
@@ -351,7 +415,7 @@ async function createAccessTokenResponse(options) {
|
|
|
351
415
|
"Unable to resolve a kid for the Refresh Token JOSE header. Provide signer.kid or a publicJwk.kid."
|
|
352
416
|
);
|
|
353
417
|
}
|
|
354
|
-
const refreshTokenHeader = (0,
|
|
418
|
+
const refreshTokenHeader = (0, import_io_wallet_utils3.parseWithErrorHandling)(
|
|
355
419
|
zRefreshTokenProfileJwtHeader,
|
|
356
420
|
{
|
|
357
421
|
alg: options.signer.alg,
|
|
@@ -359,19 +423,19 @@ async function createAccessTokenResponse(options) {
|
|
|
359
423
|
typ: "rt+jwt"
|
|
360
424
|
}
|
|
361
425
|
);
|
|
362
|
-
const refreshTokenPayload = (0,
|
|
426
|
+
const refreshTokenPayload = (0, import_io_wallet_utils3.parseWithErrorHandling)(
|
|
363
427
|
zRefreshTokenProfileJwtPayload,
|
|
364
428
|
{
|
|
365
429
|
aud: options.authorizationServer,
|
|
366
430
|
client_id: options.clientId,
|
|
367
431
|
cnf: { jkt: dpopJkt },
|
|
368
|
-
exp: (0,
|
|
369
|
-
(0,
|
|
432
|
+
exp: (0, import_io_wallet_utils3.dateToSeconds)(
|
|
433
|
+
(0, import_io_wallet_utils3.addSecondsToDate)(now, options.refreshTokenExpiresInSeconds)
|
|
370
434
|
),
|
|
371
|
-
iat: (0,
|
|
435
|
+
iat: (0, import_io_wallet_utils3.dateToSeconds)(now),
|
|
372
436
|
iss: options.authorizationServer,
|
|
373
437
|
jti: await generateUuidV4(options.callbacks.generateRandom),
|
|
374
|
-
nbf: (0,
|
|
438
|
+
nbf: (0, import_io_wallet_utils3.dateToSeconds)(accessTokenExpiresAt),
|
|
375
439
|
sub: options.subject
|
|
376
440
|
}
|
|
377
441
|
);
|
|
@@ -384,7 +448,7 @@ async function createAccessTokenResponse(options) {
|
|
|
384
448
|
);
|
|
385
449
|
refreshToken = refreshTokenSignResult.jwt;
|
|
386
450
|
}
|
|
387
|
-
const accessTokenResponse = (0,
|
|
451
|
+
const accessTokenResponse = (0, import_io_wallet_utils3.parseWithErrorHandling)(zAccessTokenResponse, {
|
|
388
452
|
...options.additionalPayload,
|
|
389
453
|
access_token: jwt,
|
|
390
454
|
expires_in: options.expiresInSeconds,
|
|
@@ -401,30 +465,39 @@ async function createAccessTokenResponse(options) {
|
|
|
401
465
|
);
|
|
402
466
|
}
|
|
403
467
|
}
|
|
468
|
+
var dispatchCreateAccessTokenResponse = (0, import_io_wallet_utils3.createVersionDispatcher)({
|
|
469
|
+
[import_io_wallet_utils3.ItWalletSpecsVersion.APTITUDE]: (o) => createAccessTokenResponseV1_4(o),
|
|
470
|
+
[import_io_wallet_utils3.ItWalletSpecsVersion.V1_0]: (o) => createAccessTokenResponseV1_4(o),
|
|
471
|
+
[import_io_wallet_utils3.ItWalletSpecsVersion.V1_3]: (o) => createAccessTokenResponseV1_4(o),
|
|
472
|
+
[import_io_wallet_utils3.ItWalletSpecsVersion.V1_4]: (o) => createAccessTokenResponseV1_4(o)
|
|
473
|
+
});
|
|
474
|
+
function createAccessTokenResponse(options) {
|
|
475
|
+
return dispatchCreateAccessTokenResponse(options);
|
|
476
|
+
}
|
|
404
477
|
|
|
405
478
|
// src/access-token/fetch-token-response.ts
|
|
406
|
-
var
|
|
407
|
-
async function
|
|
479
|
+
var import_io_wallet_utils4 = require("@pagopa/io-wallet-utils");
|
|
480
|
+
async function fetchTokenResponseV1_4(options) {
|
|
408
481
|
try {
|
|
409
|
-
const fetch = (0,
|
|
482
|
+
const fetch = (0, import_io_wallet_utils4.createFetcher)(options.callbacks.fetch);
|
|
410
483
|
const tokenResponse = await fetch(options.accessTokenEndpoint, {
|
|
411
484
|
body: toURLSearchParams(options.accessTokenRequest),
|
|
412
485
|
headers: {
|
|
413
|
-
[
|
|
414
|
-
[
|
|
415
|
-
[
|
|
416
|
-
[
|
|
486
|
+
[import_io_wallet_utils4.HEADERS.CONTENT_TYPE]: import_io_wallet_utils4.CONTENT_TYPES.FORM_URLENCODED,
|
|
487
|
+
[import_io_wallet_utils4.HEADERS.DPOP]: options.dPoP,
|
|
488
|
+
[import_io_wallet_utils4.HEADERS.OAUTH_CLIENT_ATTESTATION]: options.walletAttestation,
|
|
489
|
+
[import_io_wallet_utils4.HEADERS.OAUTH_CLIENT_ATTESTATION_POP]: options.clientAttestationDPoP
|
|
417
490
|
},
|
|
418
491
|
method: "POST"
|
|
419
492
|
});
|
|
420
|
-
await (0,
|
|
421
|
-
return (0,
|
|
493
|
+
await (0, import_io_wallet_utils4.hasStatusOrThrow)(200, import_io_wallet_utils4.UnexpectedStatusCodeError)(tokenResponse);
|
|
494
|
+
return (0, import_io_wallet_utils4.parseWithErrorHandling)(
|
|
422
495
|
zAccessTokenResponse,
|
|
423
496
|
await tokenResponse.json(),
|
|
424
497
|
"Failed to parse token response"
|
|
425
498
|
);
|
|
426
499
|
} catch (error) {
|
|
427
|
-
if (error instanceof
|
|
500
|
+
if (error instanceof import_io_wallet_utils4.UnexpectedStatusCodeError || error instanceof import_io_wallet_utils4.ValidationError) {
|
|
428
501
|
throw error;
|
|
429
502
|
}
|
|
430
503
|
throw new FetchTokenResponseError(
|
|
@@ -443,68 +516,83 @@ function toURLSearchParams(data) {
|
|
|
443
516
|
});
|
|
444
517
|
return params;
|
|
445
518
|
}
|
|
519
|
+
var dispatchFetchTokenResponse = (0, import_io_wallet_utils4.createVersionDispatcher)({
|
|
520
|
+
[import_io_wallet_utils4.ItWalletSpecsVersion.APTITUDE]: (o) => fetchTokenResponseV1_4(o),
|
|
521
|
+
[import_io_wallet_utils4.ItWalletSpecsVersion.V1_0]: (o) => fetchTokenResponseV1_4(
|
|
522
|
+
o
|
|
523
|
+
),
|
|
524
|
+
[import_io_wallet_utils4.ItWalletSpecsVersion.V1_3]: (o) => fetchTokenResponseV1_4(
|
|
525
|
+
o
|
|
526
|
+
),
|
|
527
|
+
[import_io_wallet_utils4.ItWalletSpecsVersion.V1_4]: (o) => fetchTokenResponseV1_4(
|
|
528
|
+
o
|
|
529
|
+
)
|
|
530
|
+
});
|
|
531
|
+
function fetchTokenResponse(options) {
|
|
532
|
+
return dispatchFetchTokenResponse(options);
|
|
533
|
+
}
|
|
446
534
|
|
|
447
535
|
// src/access-token/parse-token-request.ts
|
|
448
|
-
var
|
|
536
|
+
var import_io_wallet_utils12 = require("@pagopa/io-wallet-utils");
|
|
449
537
|
|
|
450
538
|
// src/client-attestation/wallet-attestation.ts
|
|
451
|
-
var
|
|
539
|
+
var import_io_wallet_utils9 = require("@pagopa/io-wallet-utils");
|
|
452
540
|
|
|
453
541
|
// src/client-attestation/types.ts
|
|
454
|
-
var
|
|
455
|
-
var zOauthClientAttestationHeader =
|
|
542
|
+
var import_zod3 = __toESM(require("zod"));
|
|
543
|
+
var zOauthClientAttestationHeader = import_zod3.default.literal(
|
|
456
544
|
"OAuth-Client-Attestation"
|
|
457
545
|
);
|
|
458
546
|
var oauthClientAttestationHeader = zOauthClientAttestationHeader.value;
|
|
459
|
-
var zOauthClientAttestationPopHeader =
|
|
547
|
+
var zOauthClientAttestationPopHeader = import_zod3.default.literal(
|
|
460
548
|
"OAuth-Client-Attestation-PoP"
|
|
461
549
|
);
|
|
462
550
|
var oauthClientAttestationPopHeader = zOauthClientAttestationPopHeader.value;
|
|
463
551
|
|
|
464
552
|
// src/client-attestation/verify-wallet-attestation-jwt-base.ts
|
|
465
|
-
var
|
|
553
|
+
var import_io_wallet_utils5 = require("@pagopa/io-wallet-utils");
|
|
466
554
|
async function verifyWalletAttestationBase(options, headerSchema, payloadSchema) {
|
|
467
|
-
const { header, payload } = (0,
|
|
555
|
+
const { header, payload } = (0, import_io_wallet_utils5.decodeJwt)({
|
|
468
556
|
errorMessagePrefix: "Error decoding wallet attestation JWT:",
|
|
469
557
|
headerSchema,
|
|
470
558
|
jwt: options.walletAttestationJwt,
|
|
471
559
|
payloadSchema
|
|
472
560
|
});
|
|
473
|
-
const { signer } = await (0,
|
|
561
|
+
const { signer } = await (0, import_io_wallet_utils5.verifyJwt)({
|
|
474
562
|
compact: options.walletAttestationJwt,
|
|
475
563
|
errorMessage: "wallet attestation verification failed.",
|
|
476
564
|
header,
|
|
477
565
|
now: options.now,
|
|
478
566
|
payload,
|
|
479
|
-
signer: (0,
|
|
567
|
+
signer: (0, import_io_wallet_utils5.jwtSignerFromJwt)({ header, payload }),
|
|
480
568
|
verifyJwtCallback: options.callbacks.verifyJwt
|
|
481
569
|
});
|
|
482
570
|
return { header, payload, signer };
|
|
483
571
|
}
|
|
484
572
|
|
|
485
573
|
// src/client-attestation/v1.0/z-wallet-attestation.ts
|
|
486
|
-
var
|
|
487
|
-
var
|
|
488
|
-
var zWalletAttestationJwtHeaderV1_0 =
|
|
489
|
-
...
|
|
490
|
-
trust_chain:
|
|
574
|
+
var import_io_wallet_utils6 = require("@pagopa/io-wallet-utils");
|
|
575
|
+
var import_zod4 = require("zod");
|
|
576
|
+
var zWalletAttestationJwtHeaderV1_0 = import_zod4.z.looseObject({
|
|
577
|
+
...import_io_wallet_utils6.zJwtHeader.shape,
|
|
578
|
+
trust_chain: import_io_wallet_utils6.zTrustChain,
|
|
491
579
|
// REQUIRED in v1.0
|
|
492
|
-
typ:
|
|
580
|
+
typ: import_zod4.z.literal("oauth-client-attestation+jwt")
|
|
493
581
|
});
|
|
494
|
-
var zWalletAttestationJwtPayloadV1_0 =
|
|
495
|
-
...
|
|
496
|
-
aal:
|
|
497
|
-
cnf:
|
|
498
|
-
jwk:
|
|
582
|
+
var zWalletAttestationJwtPayloadV1_0 = import_zod4.z.looseObject({
|
|
583
|
+
...import_io_wallet_utils6.zJwtPayload.shape,
|
|
584
|
+
aal: import_zod4.z.string(),
|
|
585
|
+
cnf: import_zod4.z.object({
|
|
586
|
+
jwk: import_io_wallet_utils6.zJwk
|
|
499
587
|
}),
|
|
500
|
-
exp:
|
|
501
|
-
iat:
|
|
502
|
-
iss:
|
|
503
|
-
sub:
|
|
504
|
-
wallet_link:
|
|
505
|
-
wallet_name:
|
|
588
|
+
exp: import_zod4.z.number(),
|
|
589
|
+
iat: import_zod4.z.number(),
|
|
590
|
+
iss: import_zod4.z.string(),
|
|
591
|
+
sub: import_zod4.z.string(),
|
|
592
|
+
wallet_link: import_zod4.z.url().optional(),
|
|
593
|
+
wallet_name: import_zod4.z.string().optional()
|
|
506
594
|
});
|
|
507
|
-
var zWalletAttestationJwtV1_0 =
|
|
595
|
+
var zWalletAttestationJwtV1_0 = import_zod4.z.string().min(1);
|
|
508
596
|
|
|
509
597
|
// src/client-attestation/v1.0/verify-wallet-attestation-jwt.ts
|
|
510
598
|
async function verifyWalletAttestationJwt(options) {
|
|
@@ -516,38 +604,38 @@ async function verifyWalletAttestationJwt(options) {
|
|
|
516
604
|
}
|
|
517
605
|
|
|
518
606
|
// src/client-attestation/v1.3/z-wallet-attestation.ts
|
|
519
|
-
var
|
|
520
|
-
var
|
|
521
|
-
var zWalletAttestationJwtHeaderV1_3 =
|
|
522
|
-
...
|
|
523
|
-
trust_chain:
|
|
607
|
+
var import_io_wallet_utils7 = require("@pagopa/io-wallet-utils");
|
|
608
|
+
var import_zod5 = require("zod");
|
|
609
|
+
var zWalletAttestationJwtHeaderV1_3 = import_zod5.z.looseObject({
|
|
610
|
+
...import_io_wallet_utils7.zJwtHeader.shape,
|
|
611
|
+
trust_chain: import_io_wallet_utils7.zTrustChain.optional(),
|
|
524
612
|
// OPTIONAL in v1.3
|
|
525
|
-
typ:
|
|
526
|
-
x5c:
|
|
613
|
+
typ: import_zod5.z.literal("oauth-client-attestation+jwt"),
|
|
614
|
+
x5c: import_io_wallet_utils7.zCertificateChain
|
|
527
615
|
// REQUIRED in v1.3
|
|
528
616
|
});
|
|
529
|
-
var zWalletAttestationJwtPayloadV1_3 =
|
|
530
|
-
...
|
|
531
|
-
cnf:
|
|
532
|
-
jwk:
|
|
617
|
+
var zWalletAttestationJwtPayloadV1_3 = import_zod5.z.looseObject({
|
|
618
|
+
...import_io_wallet_utils7.zJwtPayload.shape,
|
|
619
|
+
cnf: import_zod5.z.object({
|
|
620
|
+
jwk: import_io_wallet_utils7.zJwk
|
|
533
621
|
}),
|
|
534
|
-
exp:
|
|
535
|
-
iat:
|
|
536
|
-
iss:
|
|
537
|
-
nbf:
|
|
622
|
+
exp: import_zod5.z.number(),
|
|
623
|
+
iat: import_zod5.z.number(),
|
|
624
|
+
iss: import_zod5.z.string(),
|
|
625
|
+
nbf: import_zod5.z.number().optional(),
|
|
538
626
|
// NEW in v1.3
|
|
539
|
-
status:
|
|
540
|
-
status_list:
|
|
541
|
-
idx:
|
|
542
|
-
uri:
|
|
627
|
+
status: import_zod5.z.object({
|
|
628
|
+
status_list: import_zod5.z.object({
|
|
629
|
+
idx: import_zod5.z.number().int(),
|
|
630
|
+
uri: import_zod5.z.string()
|
|
543
631
|
})
|
|
544
632
|
}).optional(),
|
|
545
633
|
// NEW in v1.3 - status object for revocation
|
|
546
|
-
sub:
|
|
547
|
-
wallet_link:
|
|
548
|
-
wallet_name:
|
|
634
|
+
sub: import_zod5.z.string(),
|
|
635
|
+
wallet_link: import_zod5.z.url().optional(),
|
|
636
|
+
wallet_name: import_zod5.z.string().optional()
|
|
549
637
|
});
|
|
550
|
-
var zWalletAttestationJwtV1_3 =
|
|
638
|
+
var zWalletAttestationJwtV1_3 = import_zod5.z.string().min(1);
|
|
551
639
|
|
|
552
640
|
// src/client-attestation/v1.3/verify-wallet-attestation-jwt.ts
|
|
553
641
|
async function verifyWalletAttestationJwt2(options) {
|
|
@@ -559,29 +647,29 @@ async function verifyWalletAttestationJwt2(options) {
|
|
|
559
647
|
}
|
|
560
648
|
|
|
561
649
|
// src/client-attestation/v1.4/z-wallet-attestation.ts
|
|
562
|
-
var
|
|
563
|
-
var
|
|
564
|
-
var zWalletAttestationJwtHeaderV1_4 =
|
|
565
|
-
...
|
|
566
|
-
kid:
|
|
567
|
-
trust_chain:
|
|
568
|
-
typ:
|
|
569
|
-
x5c:
|
|
650
|
+
var import_io_wallet_utils8 = require("@pagopa/io-wallet-utils");
|
|
651
|
+
var import_zod6 = require("zod");
|
|
652
|
+
var zWalletAttestationJwtHeaderV1_4 = import_zod6.z.looseObject({
|
|
653
|
+
...import_io_wallet_utils8.zJwtHeader.shape,
|
|
654
|
+
kid: import_zod6.z.string(),
|
|
655
|
+
trust_chain: import_io_wallet_utils8.zTrustChain.optional(),
|
|
656
|
+
typ: import_zod6.z.literal("oauth-client-attestation+jwt"),
|
|
657
|
+
x5c: import_io_wallet_utils8.zCertificateChain
|
|
570
658
|
});
|
|
571
|
-
var zWalletAttestationJwtPayloadV1_4 =
|
|
572
|
-
...
|
|
573
|
-
cnf:
|
|
574
|
-
jwk:
|
|
659
|
+
var zWalletAttestationJwtPayloadV1_4 = import_zod6.z.looseObject({
|
|
660
|
+
...import_io_wallet_utils8.zJwtPayload.shape,
|
|
661
|
+
cnf: import_zod6.z.object({
|
|
662
|
+
jwk: import_io_wallet_utils8.zJwk
|
|
575
663
|
}),
|
|
576
|
-
exp:
|
|
577
|
-
iat:
|
|
578
|
-
iss:
|
|
579
|
-
nbf:
|
|
580
|
-
sub:
|
|
581
|
-
wallet_link:
|
|
582
|
-
wallet_name:
|
|
664
|
+
exp: import_zod6.z.number().int(),
|
|
665
|
+
iat: import_zod6.z.number().int(),
|
|
666
|
+
iss: import_zod6.z.string(),
|
|
667
|
+
nbf: import_zod6.z.number().optional(),
|
|
668
|
+
sub: import_zod6.z.string(),
|
|
669
|
+
wallet_link: import_zod6.z.url(),
|
|
670
|
+
wallet_name: import_zod6.z.string()
|
|
583
671
|
});
|
|
584
|
-
var zWalletAttestationJwtV1_4 =
|
|
672
|
+
var zWalletAttestationJwtV1_4 = import_zod6.z.string().min(1);
|
|
585
673
|
|
|
586
674
|
// src/client-attestation/v1.4/verify-wallet-attestation-jwt.ts
|
|
587
675
|
async function verifyWalletAttestationJwt3(options) {
|
|
@@ -593,10 +681,11 @@ async function verifyWalletAttestationJwt3(options) {
|
|
|
593
681
|
}
|
|
594
682
|
|
|
595
683
|
// src/client-attestation/wallet-attestation.ts
|
|
596
|
-
var dispatchVerifyWalletAttestationJwt = (0,
|
|
597
|
-
[
|
|
598
|
-
[
|
|
599
|
-
[
|
|
684
|
+
var dispatchVerifyWalletAttestationJwt = (0, import_io_wallet_utils9.createVersionDispatcher)({
|
|
685
|
+
[import_io_wallet_utils9.ItWalletSpecsVersion.APTITUDE]: (o) => verifyWalletAttestationJwt3(o),
|
|
686
|
+
[import_io_wallet_utils9.ItWalletSpecsVersion.V1_0]: (o) => verifyWalletAttestationJwt(o),
|
|
687
|
+
[import_io_wallet_utils9.ItWalletSpecsVersion.V1_3]: (o) => verifyWalletAttestationJwt2(o),
|
|
688
|
+
[import_io_wallet_utils9.ItWalletSpecsVersion.V1_4]: (o) => verifyWalletAttestationJwt3(o)
|
|
600
689
|
});
|
|
601
690
|
async function verifyWalletAttestationJwt4(options) {
|
|
602
691
|
return dispatchVerifyWalletAttestationJwt(options);
|
|
@@ -612,7 +701,7 @@ function extractClientAttestationJwtsFromHeaders(headers) {
|
|
|
612
701
|
if (!walletAttestationHeader || !clientAttestationPopHeader) {
|
|
613
702
|
return { valid: false };
|
|
614
703
|
}
|
|
615
|
-
if (!
|
|
704
|
+
if (!import_io_wallet_utils9.zCompactJwt.safeParse(walletAttestationHeader).success || !import_io_wallet_utils9.zCompactJwt.safeParse(clientAttestationPopHeader).success) {
|
|
616
705
|
return { valid: false };
|
|
617
706
|
}
|
|
618
707
|
return {
|
|
@@ -623,7 +712,7 @@ function extractClientAttestationJwtsFromHeaders(headers) {
|
|
|
623
712
|
}
|
|
624
713
|
|
|
625
714
|
// src/token-dpop/create-token-dpop.ts
|
|
626
|
-
var
|
|
715
|
+
var import_io_wallet_utils11 = require("@pagopa/io-wallet-utils");
|
|
627
716
|
var import_js_base64 = require("js-base64");
|
|
628
717
|
|
|
629
718
|
// src/token-dpop/dpop-utils.ts
|
|
@@ -635,29 +724,29 @@ var htuFromRequestUrl = (requestUrl) => {
|
|
|
635
724
|
};
|
|
636
725
|
|
|
637
726
|
// src/token-dpop/z-dpop.ts
|
|
638
|
-
var
|
|
639
|
-
var
|
|
640
|
-
var zDpopJwtPayload =
|
|
641
|
-
...
|
|
642
|
-
ath:
|
|
643
|
-
htm:
|
|
644
|
-
htu:
|
|
645
|
-
iat:
|
|
646
|
-
jti:
|
|
727
|
+
var import_io_wallet_utils10 = require("@pagopa/io-wallet-utils");
|
|
728
|
+
var import_zod7 = __toESM(require("zod"));
|
|
729
|
+
var zDpopJwtPayload = import_zod7.default.looseObject({
|
|
730
|
+
...import_io_wallet_utils10.zJwtPayload.shape,
|
|
731
|
+
ath: import_zod7.default.optional(import_zod7.default.string()),
|
|
732
|
+
htm: import_io_wallet_utils10.zHttpMethod,
|
|
733
|
+
htu: import_zod7.default.url(),
|
|
734
|
+
iat: import_zod7.default.number().int().nonnegative(),
|
|
735
|
+
jti: import_zod7.default.string().max(import_io_wallet_utils10.MAX_JTI_LENGTH)
|
|
647
736
|
});
|
|
648
|
-
var zDpopJwtHeader =
|
|
649
|
-
...
|
|
650
|
-
jwk:
|
|
651
|
-
typ:
|
|
737
|
+
var zDpopJwtHeader = import_zod7.default.looseObject({
|
|
738
|
+
...import_io_wallet_utils10.zJwtHeader.shape,
|
|
739
|
+
jwk: import_io_wallet_utils10.zJwk,
|
|
740
|
+
typ: import_zod7.default.literal("dpop+jwt")
|
|
652
741
|
});
|
|
653
742
|
|
|
654
743
|
// src/token-dpop/create-token-dpop.ts
|
|
655
744
|
async function createTokenDPoP(options) {
|
|
656
745
|
try {
|
|
657
|
-
const ath = options.accessToken ? (0,
|
|
746
|
+
const ath = options.accessToken ? (0, import_io_wallet_utils11.encodeToBase64Url)(
|
|
658
747
|
await options.callbacks.hash(
|
|
659
|
-
(0,
|
|
660
|
-
|
|
748
|
+
(0, import_io_wallet_utils11.decodeUtf8String)(options.accessToken),
|
|
749
|
+
import_io_wallet_utils11.HashAlgorithm.Sha256
|
|
661
750
|
)
|
|
662
751
|
) : void 0;
|
|
663
752
|
const jti = options.jti ?? (options.callbacks.generateRandom ? import_js_base64.Base64.fromUint8Array(
|
|
@@ -669,16 +758,16 @@ async function createTokenDPoP(options) {
|
|
|
669
758
|
"Error: neither a default jti nor a generateRandom callback have been provided"
|
|
670
759
|
);
|
|
671
760
|
}
|
|
672
|
-
const header = (0,
|
|
761
|
+
const header = (0, import_io_wallet_utils11.parseWithErrorHandling)(zDpopJwtHeader, {
|
|
673
762
|
alg: options.signer.alg,
|
|
674
763
|
jwk: options.signer.publicJwk,
|
|
675
764
|
typ: "dpop+jwt"
|
|
676
765
|
});
|
|
677
|
-
const payload = (0,
|
|
766
|
+
const payload = (0, import_io_wallet_utils11.parseWithErrorHandling)(zDpopJwtPayload, {
|
|
678
767
|
ath,
|
|
679
768
|
htm: options.tokenRequest.method,
|
|
680
769
|
htu: htuFromRequestUrl(options.tokenRequest.url),
|
|
681
|
-
iat: (0,
|
|
770
|
+
iat: (0, import_io_wallet_utils11.dateToSeconds)(options.issuedAt),
|
|
682
771
|
jti
|
|
683
772
|
});
|
|
684
773
|
return options.callbacks.signJwt(options.signer, {
|
|
@@ -686,7 +775,7 @@ async function createTokenDPoP(options) {
|
|
|
686
775
|
payload
|
|
687
776
|
});
|
|
688
777
|
} catch (error) {
|
|
689
|
-
if (error instanceof CreateTokenDPoPError || error instanceof
|
|
778
|
+
if (error instanceof CreateTokenDPoPError || error instanceof import_io_wallet_utils11.ValidationError) {
|
|
690
779
|
throw error;
|
|
691
780
|
}
|
|
692
781
|
throw new CreateTokenDPoPError(
|
|
@@ -699,28 +788,21 @@ function extractDpopJwtFromHeaders(headers) {
|
|
|
699
788
|
if (!dpopJwt) {
|
|
700
789
|
return { valid: true };
|
|
701
790
|
}
|
|
702
|
-
if (!
|
|
791
|
+
if (!import_io_wallet_utils11.zCompactJwt.safeParse(dpopJwt).success) {
|
|
703
792
|
return { valid: false };
|
|
704
793
|
}
|
|
705
794
|
return { dpopJwt, valid: true };
|
|
706
795
|
}
|
|
707
796
|
|
|
708
|
-
// src/access-token/z-grant-type.ts
|
|
709
|
-
var import_zod7 = require("zod");
|
|
710
|
-
var zAuthorizationCodeGrantIdentifier = import_zod7.z.literal("authorization_code");
|
|
711
|
-
var authorizationCodeGrantIdentifier = zAuthorizationCodeGrantIdentifier.value;
|
|
712
|
-
var zRefreshTokenGrantIdentifier = import_zod7.z.literal("refresh_token");
|
|
713
|
-
var refreshTokenGrantIdentifier = zRefreshTokenGrantIdentifier.value;
|
|
714
|
-
|
|
715
797
|
// src/access-token/parse-token-request.ts
|
|
716
|
-
function
|
|
798
|
+
function parseAccessTokenRequestV1_4(options) {
|
|
717
799
|
const validationResult = zAccessTokenRequest.safeParse(
|
|
718
800
|
options.accessTokenRequest
|
|
719
801
|
);
|
|
720
802
|
if (!validationResult.success) {
|
|
721
803
|
throw new Oauth2Error(
|
|
722
804
|
`Access token request validation failed:
|
|
723
|
-
${(0,
|
|
805
|
+
${(0, import_io_wallet_utils12.formatZodError)(validationResult.error)}`
|
|
724
806
|
);
|
|
725
807
|
}
|
|
726
808
|
const accessTokenRequest = validationResult.data;
|
|
@@ -734,6 +816,25 @@ ${(0, import_io_wallet_utils11.formatZodError)(validationResult.error)}`
|
|
|
734
816
|
...securityHeaders
|
|
735
817
|
};
|
|
736
818
|
}
|
|
819
|
+
function parseAccessTokenRequestAPTITUDE(options) {
|
|
820
|
+
const validationResult = zAccessTokenRequestAPTITUDE.safeParse(
|
|
821
|
+
options.accessTokenRequest
|
|
822
|
+
);
|
|
823
|
+
if (!validationResult.success) {
|
|
824
|
+
throw new Oauth2Error(
|
|
825
|
+
`Access token request validation failed:
|
|
826
|
+
${(0, import_io_wallet_utils12.formatZodError)(validationResult.error)}`
|
|
827
|
+
);
|
|
828
|
+
}
|
|
829
|
+
const accessTokenRequest = validationResult.data;
|
|
830
|
+
const grant = parseGrantParametersAPTITUDE(accessTokenRequest);
|
|
831
|
+
const securityHeaders = parseSecurityHeaders(options.request.headers);
|
|
832
|
+
return {
|
|
833
|
+
accessTokenRequest,
|
|
834
|
+
grant,
|
|
835
|
+
...securityHeaders
|
|
836
|
+
};
|
|
837
|
+
}
|
|
737
838
|
function parseGrantParameters(accessTokenRequest) {
|
|
738
839
|
if (accessTokenRequest.grant_type === authorizationCodeGrantIdentifier) {
|
|
739
840
|
return {
|
|
@@ -751,6 +852,30 @@ function parseGrantParameters(accessTokenRequest) {
|
|
|
751
852
|
`Unsupported grant type. Supported types are: '${authorizationCodeGrantIdentifier}', '${refreshTokenGrantIdentifier}'`
|
|
752
853
|
);
|
|
753
854
|
}
|
|
855
|
+
function parseGrantParametersAPTITUDE(accessTokenRequest) {
|
|
856
|
+
if (accessTokenRequest.grant_type === authorizationCodeGrantIdentifier) {
|
|
857
|
+
return {
|
|
858
|
+
code: accessTokenRequest.code,
|
|
859
|
+
grantType: authorizationCodeGrantIdentifier
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
if (accessTokenRequest.grant_type === refreshTokenGrantIdentifier) {
|
|
863
|
+
return {
|
|
864
|
+
grantType: refreshTokenGrantIdentifier,
|
|
865
|
+
refreshToken: accessTokenRequest.refresh_token
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
if (accessTokenRequest.grant_type === preAuthorizedCodeGrantIdentifier) {
|
|
869
|
+
return {
|
|
870
|
+
grantType: preAuthorizedCodeGrantIdentifier,
|
|
871
|
+
preAuthorizedCode: accessTokenRequest["pre-authorized_code"],
|
|
872
|
+
txCode: accessTokenRequest.tx_code
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
throw new Oauth2Error(
|
|
876
|
+
`Unsupported grant type. Supported types are: '${authorizationCodeGrantIdentifier}', '${refreshTokenGrantIdentifier}', '${preAuthorizedCodeGrantIdentifier}'`
|
|
877
|
+
);
|
|
878
|
+
}
|
|
754
879
|
function parseSecurityHeaders(headers) {
|
|
755
880
|
const extractedDpopJwt = extractDpopJwtFromHeaders(headers);
|
|
756
881
|
if (!extractedDpopJwt.valid) {
|
|
@@ -785,15 +910,35 @@ function parseSecurityHeaders(headers) {
|
|
|
785
910
|
dpop: { jwt: extractedDpopJwt.dpopJwt }
|
|
786
911
|
};
|
|
787
912
|
}
|
|
913
|
+
var dispatchParseTokenRequest = (0, import_io_wallet_utils12.createVersionDispatcher)({
|
|
914
|
+
[import_io_wallet_utils12.ItWalletSpecsVersion.APTITUDE]: (o) => parseAccessTokenRequestAPTITUDE(
|
|
915
|
+
o
|
|
916
|
+
),
|
|
917
|
+
[import_io_wallet_utils12.ItWalletSpecsVersion.V1_0]: (o) => parseAccessTokenRequestV1_4(
|
|
918
|
+
o
|
|
919
|
+
),
|
|
920
|
+
[import_io_wallet_utils12.ItWalletSpecsVersion.V1_3]: (o) => parseAccessTokenRequestV1_4(
|
|
921
|
+
o
|
|
922
|
+
),
|
|
923
|
+
[import_io_wallet_utils12.ItWalletSpecsVersion.V1_4]: (o) => parseAccessTokenRequestV1_4(
|
|
924
|
+
o
|
|
925
|
+
)
|
|
926
|
+
});
|
|
927
|
+
function parseAccessTokenRequest(options) {
|
|
928
|
+
return dispatchParseTokenRequest(options);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
// src/access-token/verify-access-token-request.ts
|
|
932
|
+
var import_io_wallet_utils18 = require("@pagopa/io-wallet-utils");
|
|
788
933
|
|
|
789
934
|
// src/client-attestation/verify-client-attestation.ts
|
|
790
|
-
var
|
|
935
|
+
var import_io_wallet_utils15 = require("@pagopa/io-wallet-utils");
|
|
791
936
|
|
|
792
937
|
// src/client-attestation/client-attestation-pop.ts
|
|
793
|
-
var
|
|
938
|
+
var import_io_wallet_utils14 = require("@pagopa/io-wallet-utils");
|
|
794
939
|
|
|
795
940
|
// src/client-attestation/z-client-attestation-pop.ts
|
|
796
|
-
var
|
|
941
|
+
var import_io_wallet_utils13 = require("@pagopa/io-wallet-utils");
|
|
797
942
|
var import_zod8 = __toESM(require("zod"));
|
|
798
943
|
var IT_WALLET_CLIENT_ATTESTATION_POP_ALLOWED_ALG_VALUES = [
|
|
799
944
|
"ES256",
|
|
@@ -804,19 +949,19 @@ var zItWalletClientAttestationPopJwtAlg = import_zod8.default.enum(
|
|
|
804
949
|
IT_WALLET_CLIENT_ATTESTATION_POP_ALLOWED_ALG_VALUES
|
|
805
950
|
);
|
|
806
951
|
var zItWalletClientAttestationPopJwtPayload = import_zod8.default.looseObject({
|
|
807
|
-
...
|
|
952
|
+
...import_io_wallet_utils13.zJwtPayload.shape,
|
|
808
953
|
aud: import_zod8.default.string(),
|
|
809
954
|
exp: import_zod8.default.number().int().optional(),
|
|
810
955
|
iat: import_zod8.default.number().int(),
|
|
811
956
|
iss: import_zod8.default.string(),
|
|
812
|
-
jti: import_zod8.default.string().max(
|
|
957
|
+
jti: import_zod8.default.string().max(import_io_wallet_utils13.MAX_JTI_LENGTH),
|
|
813
958
|
nonce: import_zod8.default.string().optional()
|
|
814
959
|
});
|
|
815
960
|
var zItWalletClientAttestationPopJwtTyp = import_zod8.default.literal(
|
|
816
961
|
"oauth-client-attestation-pop+jwt"
|
|
817
962
|
);
|
|
818
963
|
var zItWalletClientAttestationPopJwtHeader = import_zod8.default.looseObject({
|
|
819
|
-
...
|
|
964
|
+
...import_io_wallet_utils13.zJwtHeader.shape,
|
|
820
965
|
typ: zItWalletClientAttestationPopJwtTyp
|
|
821
966
|
});
|
|
822
967
|
|
|
@@ -830,14 +975,14 @@ function assertSupportedClientAttestationPopAlg(alg) {
|
|
|
830
975
|
}
|
|
831
976
|
async function verifyClientAttestationPopJwt(options) {
|
|
832
977
|
try {
|
|
833
|
-
const { header, payload } = (0,
|
|
978
|
+
const { header, payload } = (0, import_io_wallet_utils14.decodeJwt)({
|
|
834
979
|
errorMessagePrefix: "Error decoding client attestation PoP JWT:",
|
|
835
980
|
headerSchema: zItWalletClientAttestationPopJwtHeader,
|
|
836
981
|
jwt: options.clientAttestationPopJwt,
|
|
837
982
|
payloadSchema: zItWalletClientAttestationPopJwtPayload
|
|
838
983
|
});
|
|
839
984
|
assertSupportedClientAttestationPopAlg(header.alg);
|
|
840
|
-
const { signer } = await (0,
|
|
985
|
+
const { signer } = await (0, import_io_wallet_utils14.verifyJwt)({
|
|
841
986
|
compact: options.clientAttestationPopJwt,
|
|
842
987
|
errorMessage: "client attestation pop jwt verification failed",
|
|
843
988
|
expectedAudience: options.authorizationServer,
|
|
@@ -866,7 +1011,7 @@ async function verifyClientAttestationPopJwt(options) {
|
|
|
866
1011
|
}
|
|
867
1012
|
async function createClientAttestationPopJwt(options) {
|
|
868
1013
|
try {
|
|
869
|
-
const clientAttestation = (0,
|
|
1014
|
+
const clientAttestation = (0, import_io_wallet_utils14.decodeJwt)({
|
|
870
1015
|
errorMessagePrefix: "Error decoding client attestation JWT:",
|
|
871
1016
|
jwt: options.clientAttestation
|
|
872
1017
|
});
|
|
@@ -893,22 +1038,22 @@ async function createClientAttestationPopJwt(options) {
|
|
|
893
1038
|
typ: zItWalletClientAttestationPopJwtTyp.value
|
|
894
1039
|
};
|
|
895
1040
|
const issuedAt = options.issuedAt ?? /* @__PURE__ */ new Date();
|
|
896
|
-
const jti = options.jti ?? (options.callbacks.generateRandom ? (0,
|
|
1041
|
+
const jti = options.jti ?? (options.callbacks.generateRandom ? (0, import_io_wallet_utils14.encodeToBase64Url)(await options.callbacks.generateRandom(32)) : void 0);
|
|
897
1042
|
if (!jti) {
|
|
898
1043
|
throw new Oauth2Error(
|
|
899
1044
|
"Error: neither a default jti nor a generateRandom callback have been provided"
|
|
900
1045
|
);
|
|
901
1046
|
}
|
|
902
|
-
const payload = (0,
|
|
1047
|
+
const payload = (0, import_io_wallet_utils14.parseWithErrorHandling)(
|
|
903
1048
|
zItWalletClientAttestationPopJwtPayload,
|
|
904
1049
|
{
|
|
905
1050
|
aud: options.authorizationServer,
|
|
906
|
-
iat: (0,
|
|
1051
|
+
iat: (0, import_io_wallet_utils14.dateToSeconds)(issuedAt),
|
|
907
1052
|
iss: sub,
|
|
908
1053
|
jti,
|
|
909
|
-
...options.config.itWalletSpecsVersion ===
|
|
910
|
-
exp: (0,
|
|
911
|
-
"expiresAt" in options && options.expiresAt ? options.expiresAt : (0,
|
|
1054
|
+
...options.config.itWalletSpecsVersion === import_io_wallet_utils14.ItWalletSpecsVersion.V1_0 ? {
|
|
1055
|
+
exp: (0, import_io_wallet_utils14.dateToSeconds)(
|
|
1056
|
+
"expiresAt" in options && options.expiresAt ? options.expiresAt : (0, import_io_wallet_utils14.addSecondsToDate)(issuedAt, 1 * 60)
|
|
912
1057
|
)
|
|
913
1058
|
} : {}
|
|
914
1059
|
}
|
|
@@ -953,8 +1098,8 @@ async function verifyClientAttestation(options) {
|
|
|
953
1098
|
);
|
|
954
1099
|
}
|
|
955
1100
|
if (options.clientAttestation.ensureConfirmationKeyMatchesDpopKey && options.dpopJwkThumbprint) {
|
|
956
|
-
const clientAttestationJkt = await (0,
|
|
957
|
-
hashAlgorithm:
|
|
1101
|
+
const clientAttestationJkt = await (0, import_io_wallet_utils15.calculateJwkThumbprint)({
|
|
1102
|
+
hashAlgorithm: import_io_wallet_utils15.HashAlgorithm.Sha256,
|
|
958
1103
|
hashCallback: options.callbacks.hash,
|
|
959
1104
|
jwk: clientAttestation.payload.cnf.jwk
|
|
960
1105
|
});
|
|
@@ -971,7 +1116,7 @@ async function verifyClientAttestation(options) {
|
|
|
971
1116
|
}
|
|
972
1117
|
|
|
973
1118
|
// src/pkce.ts
|
|
974
|
-
var
|
|
1119
|
+
var import_io_wallet_utils16 = require("@pagopa/io-wallet-utils");
|
|
975
1120
|
var PkceCodeChallengeMethod = {
|
|
976
1121
|
Plain: "plain",
|
|
977
1122
|
S256: "S256"
|
|
@@ -989,7 +1134,7 @@ async function createPkce(options) {
|
|
|
989
1134
|
const codeChallengeMethod = allowedCodeChallengeMethods.includes(
|
|
990
1135
|
PkceCodeChallengeMethod.S256
|
|
991
1136
|
) ? PkceCodeChallengeMethod.S256 : PkceCodeChallengeMethod.Plain;
|
|
992
|
-
const codeVerifier = options.codeVerifier ?? (0,
|
|
1137
|
+
const codeVerifier = options.codeVerifier ?? (0, import_io_wallet_utils16.encodeToBase64Url)(await options.callbacks.generateRandom(64));
|
|
993
1138
|
return {
|
|
994
1139
|
codeChallenge: await calculateCodeChallenge({
|
|
995
1140
|
codeChallengeMethod,
|
|
@@ -1017,10 +1162,10 @@ async function calculateCodeChallenge(options) {
|
|
|
1017
1162
|
return options.codeVerifier;
|
|
1018
1163
|
}
|
|
1019
1164
|
if (options.codeChallengeMethod === PkceCodeChallengeMethod.S256) {
|
|
1020
|
-
return (0,
|
|
1165
|
+
return (0, import_io_wallet_utils16.encodeToBase64Url)(
|
|
1021
1166
|
await options.hashCallback(
|
|
1022
|
-
(0,
|
|
1023
|
-
|
|
1167
|
+
(0, import_io_wallet_utils16.decodeUtf8String)(options.codeVerifier),
|
|
1168
|
+
import_io_wallet_utils16.HashAlgorithm.Sha256
|
|
1024
1169
|
)
|
|
1025
1170
|
);
|
|
1026
1171
|
}
|
|
@@ -1030,9 +1175,9 @@ async function calculateCodeChallenge(options) {
|
|
|
1030
1175
|
}
|
|
1031
1176
|
|
|
1032
1177
|
// src/token-dpop/verify-token-dpop.ts
|
|
1033
|
-
var
|
|
1178
|
+
var import_io_wallet_utils17 = require("@pagopa/io-wallet-utils");
|
|
1034
1179
|
async function verifyTokenDPoP(options) {
|
|
1035
|
-
const { header, payload } = (0,
|
|
1180
|
+
const { header, payload } = (0, import_io_wallet_utils17.decodeJwt)({
|
|
1036
1181
|
errorMessagePrefix: "Error decoding access token DPoP JWT:",
|
|
1037
1182
|
headerSchema: zDpopJwtHeader,
|
|
1038
1183
|
jwt: options.dpopJwt,
|
|
@@ -1070,10 +1215,10 @@ async function verifyTokenDPoP(options) {
|
|
|
1070
1215
|
);
|
|
1071
1216
|
}
|
|
1072
1217
|
if (options.accessToken) {
|
|
1073
|
-
const expectedAth = (0,
|
|
1218
|
+
const expectedAth = (0, import_io_wallet_utils17.encodeToBase64Url)(
|
|
1074
1219
|
await options.callbacks.hash(
|
|
1075
|
-
(0,
|
|
1076
|
-
|
|
1220
|
+
(0, import_io_wallet_utils17.decodeUtf8String)(options.accessToken),
|
|
1221
|
+
import_io_wallet_utils17.HashAlgorithm.Sha256
|
|
1077
1222
|
)
|
|
1078
1223
|
);
|
|
1079
1224
|
if (!payload.ath) {
|
|
@@ -1087,8 +1232,8 @@ async function verifyTokenDPoP(options) {
|
|
|
1087
1232
|
);
|
|
1088
1233
|
}
|
|
1089
1234
|
}
|
|
1090
|
-
const jwkThumbprint = await (0,
|
|
1091
|
-
hashAlgorithm:
|
|
1235
|
+
const jwkThumbprint = await (0, import_io_wallet_utils17.calculateJwkThumbprint)({
|
|
1236
|
+
hashAlgorithm: import_io_wallet_utils17.HashAlgorithm.Sha256,
|
|
1092
1237
|
hashCallback: options.callbacks.hash,
|
|
1093
1238
|
jwk: header.jwk
|
|
1094
1239
|
});
|
|
@@ -1098,7 +1243,7 @@ async function verifyTokenDPoP(options) {
|
|
|
1098
1243
|
);
|
|
1099
1244
|
}
|
|
1100
1245
|
try {
|
|
1101
|
-
(0,
|
|
1246
|
+
(0, import_io_wallet_utils17.verifyJwtIatOrThrow)({
|
|
1102
1247
|
iat: payload.iat,
|
|
1103
1248
|
now: options.now
|
|
1104
1249
|
});
|
|
@@ -1107,7 +1252,7 @@ async function verifyTokenDPoP(options) {
|
|
|
1107
1252
|
throw new Oauth2Error(`Invalid iat claim in dpop JWT: ${error.message}`);
|
|
1108
1253
|
}
|
|
1109
1254
|
}
|
|
1110
|
-
await (0,
|
|
1255
|
+
await (0, import_io_wallet_utils17.verifyJwt)({
|
|
1111
1256
|
compact: options.dpopJwt,
|
|
1112
1257
|
errorMessage: "dpop jwt verification failed",
|
|
1113
1258
|
header,
|
|
@@ -1128,7 +1273,7 @@ async function verifyTokenDPoP(options) {
|
|
|
1128
1273
|
}
|
|
1129
1274
|
|
|
1130
1275
|
// src/access-token/verify-access-token-request.ts
|
|
1131
|
-
async function
|
|
1276
|
+
async function verifyAccessTokenRequestV1_4(options) {
|
|
1132
1277
|
if (options.dpop.expectedNonce === "") {
|
|
1133
1278
|
throw new Oauth2Error(`Invalid 'dpop.expectedNonce' provided`);
|
|
1134
1279
|
}
|
|
@@ -1157,12 +1302,44 @@ async function verifyAccessTokenRequest(options) {
|
|
|
1157
1302
|
if (options.grant.code !== options.expectedCode) {
|
|
1158
1303
|
throw new Oauth2Error(`Invalid 'code' provided`);
|
|
1159
1304
|
}
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
throw new Oauth2Error(`Expired 'code' provided`);
|
|
1164
|
-
}
|
|
1305
|
+
verifyCodeExpiration(options.codeExpiresAt, options.now, "code");
|
|
1306
|
+
if (!header.jwk) {
|
|
1307
|
+
throw new Oauth2Error("DPoP header does not contain a JWK");
|
|
1165
1308
|
}
|
|
1309
|
+
return {
|
|
1310
|
+
clientAttestation: clientAttestationResult,
|
|
1311
|
+
dpop: { jwk: header.jwk, jwkThumbprint }
|
|
1312
|
+
};
|
|
1313
|
+
}
|
|
1314
|
+
async function verifyAccessTokenRequestAPTITUDE(options) {
|
|
1315
|
+
if (options.dpop.expectedNonce === "") {
|
|
1316
|
+
throw new Oauth2Error(`Invalid 'dpop.expectedNonce' provided`);
|
|
1317
|
+
}
|
|
1318
|
+
if (!isPreAuthorizedCodeVerification(options)) {
|
|
1319
|
+
await verifyPkce({
|
|
1320
|
+
callbacks: options.callbacks,
|
|
1321
|
+
codeChallenge: options.pkce.codeChallenge,
|
|
1322
|
+
codeChallengeMethod: options.pkce.codeChallengeMethod,
|
|
1323
|
+
codeVerifier: options.pkce.codeVerifier
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
const { header, jwkThumbprint } = await verifyTokenDPoP({
|
|
1327
|
+
allowedSigningAlgs: options.dpop.allowedSigningAlgs,
|
|
1328
|
+
callbacks: options.callbacks,
|
|
1329
|
+
dpopJwt: options.dpop.jwt,
|
|
1330
|
+
expectedNonce: options.dpop.expectedNonce,
|
|
1331
|
+
now: options.now,
|
|
1332
|
+
request: options.request
|
|
1333
|
+
});
|
|
1334
|
+
const clientAttestationResult = await verifyClientAttestation({
|
|
1335
|
+
authorizationServerMetadata: options.authorizationServerMetadata,
|
|
1336
|
+
callbacks: options.callbacks,
|
|
1337
|
+
clientAttestation: options.clientAttestation,
|
|
1338
|
+
config: options.config,
|
|
1339
|
+
dpopJwkThumbprint: jwkThumbprint,
|
|
1340
|
+
now: options.now
|
|
1341
|
+
});
|
|
1342
|
+
verifyGrantParameters(options);
|
|
1166
1343
|
if (!header.jwk) {
|
|
1167
1344
|
throw new Oauth2Error("DPoP header does not contain a JWK");
|
|
1168
1345
|
}
|
|
@@ -1171,12 +1348,75 @@ async function verifyAccessTokenRequest(options) {
|
|
|
1171
1348
|
dpop: { jwk: header.jwk, jwkThumbprint }
|
|
1172
1349
|
};
|
|
1173
1350
|
}
|
|
1351
|
+
function isPreAuthorizedCodeVerification(options) {
|
|
1352
|
+
return options.grant.grantType === preAuthorizedCodeGrantIdentifier;
|
|
1353
|
+
}
|
|
1354
|
+
function verifyGrantParameters(options) {
|
|
1355
|
+
if (isPreAuthorizedCodeVerification(options)) {
|
|
1356
|
+
if (options.grant.preAuthorizedCode !== options.expectedPreAuthorizedCode) {
|
|
1357
|
+
throw new Oauth2Error(`Invalid 'pre-authorized_code' provided`);
|
|
1358
|
+
}
|
|
1359
|
+
verifyTransactionCode(options.grant.txCode, options.expectedTxCode);
|
|
1360
|
+
verifyCodeExpiration(
|
|
1361
|
+
options.preAuthorizedCodeExpiresAt,
|
|
1362
|
+
options.now,
|
|
1363
|
+
"pre-authorized_code"
|
|
1364
|
+
);
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1367
|
+
if (options.grant.grantType !== authorizationCodeGrantIdentifier) {
|
|
1368
|
+
throw new Oauth2Error(
|
|
1369
|
+
"Only authorization_code and pre-authorized_code grants can be verified"
|
|
1370
|
+
);
|
|
1371
|
+
}
|
|
1372
|
+
if (options.grant.code !== options.expectedCode) {
|
|
1373
|
+
throw new Oauth2Error(`Invalid 'code' provided`);
|
|
1374
|
+
}
|
|
1375
|
+
verifyCodeExpiration(options.codeExpiresAt, options.now, "code");
|
|
1376
|
+
}
|
|
1377
|
+
function verifyTransactionCode(txCode, expectedTxCode) {
|
|
1378
|
+
if (txCode === expectedTxCode) return;
|
|
1379
|
+
if (expectedTxCode === void 0) {
|
|
1380
|
+
throw new Oauth2Error("Request contains 'tx_code' that was not expected");
|
|
1381
|
+
}
|
|
1382
|
+
if (txCode === void 0) {
|
|
1383
|
+
throw new Oauth2Error("Missing required 'tx_code' in request");
|
|
1384
|
+
}
|
|
1385
|
+
throw new Oauth2Error("Invalid 'tx_code' provided");
|
|
1386
|
+
}
|
|
1387
|
+
function verifyCodeExpiration(expiresAt, date, codeParameter) {
|
|
1388
|
+
if (!expiresAt) return;
|
|
1389
|
+
if (Number.isNaN(expiresAt.getTime())) {
|
|
1390
|
+
throw new Oauth2Error(`Invalid expiration date for '${codeParameter}'`);
|
|
1391
|
+
}
|
|
1392
|
+
const now = date ?? /* @__PURE__ */ new Date();
|
|
1393
|
+
if (now.getTime() > expiresAt.getTime()) {
|
|
1394
|
+
throw new Oauth2Error(`Expired '${codeParameter}' provided`);
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
var dispatchVerifyAccessTokenRequest = (0, import_io_wallet_utils18.createVersionDispatcher)({
|
|
1398
|
+
[import_io_wallet_utils18.ItWalletSpecsVersion.APTITUDE]: (o) => verifyAccessTokenRequestAPTITUDE(
|
|
1399
|
+
o
|
|
1400
|
+
),
|
|
1401
|
+
[import_io_wallet_utils18.ItWalletSpecsVersion.V1_0]: (o) => verifyAccessTokenRequestV1_4(
|
|
1402
|
+
o
|
|
1403
|
+
),
|
|
1404
|
+
[import_io_wallet_utils18.ItWalletSpecsVersion.V1_3]: (o) => verifyAccessTokenRequestV1_4(
|
|
1405
|
+
o
|
|
1406
|
+
),
|
|
1407
|
+
[import_io_wallet_utils18.ItWalletSpecsVersion.V1_4]: (o) => verifyAccessTokenRequestV1_4(
|
|
1408
|
+
o
|
|
1409
|
+
)
|
|
1410
|
+
});
|
|
1411
|
+
function verifyAccessTokenRequest(options) {
|
|
1412
|
+
return dispatchVerifyAccessTokenRequest(options);
|
|
1413
|
+
}
|
|
1174
1414
|
|
|
1175
1415
|
// src/authorization-request/create-authorization-request.ts
|
|
1176
|
-
var
|
|
1416
|
+
var import_io_wallet_utils20 = require("@pagopa/io-wallet-utils");
|
|
1177
1417
|
|
|
1178
1418
|
// src/authorization-request/z-authorization-request.ts
|
|
1179
|
-
var
|
|
1419
|
+
var import_io_wallet_utils19 = require("@pagopa/io-wallet-utils");
|
|
1180
1420
|
var import_zod9 = __toESM(require("zod"));
|
|
1181
1421
|
var zOpenidCredentialAuthorizationDetails = import_zod9.default.object({
|
|
1182
1422
|
credential_configuration_id: import_zod9.default.string(),
|
|
@@ -1199,7 +1439,7 @@ var zAuthorizationRequestBaseObject = import_zod9.default.looseObject({
|
|
|
1199
1439
|
code_challenge: import_zod9.default.string(),
|
|
1200
1440
|
code_challenge_method: import_zod9.default.string(),
|
|
1201
1441
|
issuer_state: import_zod9.default.optional(import_zod9.default.string()),
|
|
1202
|
-
jti: import_zod9.default.string().max(
|
|
1442
|
+
jti: import_zod9.default.string().max(import_io_wallet_utils19.MAX_JTI_LENGTH),
|
|
1203
1443
|
redirect_uri: import_zod9.default.url(),
|
|
1204
1444
|
response_type: import_zod9.default.string(),
|
|
1205
1445
|
scope: import_zod9.default.string().optional(),
|
|
@@ -1272,13 +1512,13 @@ async function createPushedAuthorizationRequest(options) {
|
|
|
1272
1512
|
code_challenge: pkce.codeChallenge,
|
|
1273
1513
|
code_challenge_method: pkce.codeChallengeMethod,
|
|
1274
1514
|
...options.issuerState !== void 0 ? { issuer_state: options.issuerState } : {},
|
|
1275
|
-
jti: options.jti ?? (0,
|
|
1515
|
+
jti: options.jti ?? (0, import_io_wallet_utils20.encodeToBase64Url)(
|
|
1276
1516
|
await options.callbacks.generateRandom(RANDOM_BYTES_SIZE)
|
|
1277
1517
|
),
|
|
1278
1518
|
redirect_uri: options.redirectUri,
|
|
1279
1519
|
response_type: "code",
|
|
1280
1520
|
scope: options.scope,
|
|
1281
|
-
state: options.state ?? (0,
|
|
1521
|
+
state: options.state ?? (0, import_io_wallet_utils20.encodeToBase64Url)(
|
|
1282
1522
|
await options.callbacks.generateRandom(RANDOM_BYTES_SIZE)
|
|
1283
1523
|
)
|
|
1284
1524
|
};
|
|
@@ -1295,7 +1535,7 @@ async function createPushedAuthorizationRequest(options) {
|
|
|
1295
1535
|
);
|
|
1296
1536
|
}
|
|
1297
1537
|
const iat = options.issuedAt ?? /* @__PURE__ */ new Date();
|
|
1298
|
-
const exp = options.expiresAt ?? (0,
|
|
1538
|
+
const exp = options.expiresAt ?? (0, import_io_wallet_utils20.addSecondsToDate)(iat, JWT_EXPIRY_SECONDS);
|
|
1299
1539
|
const requestJwt = await options.callbacks.signJwt(dpop.signer, {
|
|
1300
1540
|
header: {
|
|
1301
1541
|
alg: dpop.signer.alg,
|
|
@@ -1304,8 +1544,8 @@ async function createPushedAuthorizationRequest(options) {
|
|
|
1304
1544
|
},
|
|
1305
1545
|
payload: {
|
|
1306
1546
|
aud: options.audience,
|
|
1307
|
-
exp: (0,
|
|
1308
|
-
iat: (0,
|
|
1547
|
+
exp: (0, import_io_wallet_utils20.dateToSeconds)(exp),
|
|
1548
|
+
iat: (0, import_io_wallet_utils20.dateToSeconds)(iat),
|
|
1309
1549
|
iss: dpop.signer.publicJwk.kid,
|
|
1310
1550
|
...authorizationRequest
|
|
1311
1551
|
}
|
|
@@ -1323,27 +1563,30 @@ async function createPushedAuthorizationRequest(options) {
|
|
|
1323
1563
|
};
|
|
1324
1564
|
}
|
|
1325
1565
|
function parseAuthorizationRequestByVersion(options, baseAuthorizationRequest) {
|
|
1326
|
-
return (0,
|
|
1327
|
-
[
|
|
1566
|
+
return (0, import_io_wallet_utils20.dispatchByVersion)(options.config.itWalletSpecsVersion, {
|
|
1567
|
+
[import_io_wallet_utils20.ItWalletSpecsVersion.APTITUDE]: () => zAuthorizationRequestV1_3.parse(
|
|
1568
|
+
baseAuthorizationRequest
|
|
1569
|
+
),
|
|
1570
|
+
[import_io_wallet_utils20.ItWalletSpecsVersion.V1_0]: () => zAuthorizationRequestV1_0.parse({
|
|
1328
1571
|
...baseAuthorizationRequest,
|
|
1329
1572
|
response_mode: options.responseMode
|
|
1330
1573
|
}),
|
|
1331
|
-
|
|
1574
|
+
// V1_4 reuses V1_3 authorization request schema — no breaking changes between versions.
|
|
1575
|
+
[import_io_wallet_utils20.ItWalletSpecsVersion.V1_3]: () => zAuthorizationRequestV1_3.parse(
|
|
1332
1576
|
baseAuthorizationRequest
|
|
1333
1577
|
),
|
|
1334
|
-
// V1_4 reuses V1_3 authorization request schema — no breaking changes between versions.
|
|
1335
1578
|
// Verified against compare/1.3.3...1.4.1: authorization request parameters identical.
|
|
1336
|
-
[
|
|
1579
|
+
[import_io_wallet_utils20.ItWalletSpecsVersion.V1_4]: () => zAuthorizationRequestV1_3.parse(
|
|
1337
1580
|
baseAuthorizationRequest
|
|
1338
1581
|
)
|
|
1339
1582
|
});
|
|
1340
1583
|
}
|
|
1341
1584
|
|
|
1342
1585
|
// src/authorization-request/fetch-authorization-response.ts
|
|
1343
|
-
var
|
|
1586
|
+
var import_io_wallet_utils21 = require("@pagopa/io-wallet-utils");
|
|
1344
1587
|
async function fetchPushedAuthorizationResponse(options) {
|
|
1345
1588
|
try {
|
|
1346
|
-
const fetch = (0,
|
|
1589
|
+
const fetch = (0, import_io_wallet_utils21.createFetcher)(options.callbacks.fetch);
|
|
1347
1590
|
const body = isPushedAuthorizationRequestSigned(
|
|
1348
1591
|
options.pushedAuthorizationRequest
|
|
1349
1592
|
) ? new URLSearchParams({
|
|
@@ -1357,25 +1600,25 @@ async function fetchPushedAuthorizationResponse(options) {
|
|
|
1357
1600
|
{
|
|
1358
1601
|
body,
|
|
1359
1602
|
headers: {
|
|
1360
|
-
[
|
|
1361
|
-
[
|
|
1362
|
-
[
|
|
1603
|
+
[import_io_wallet_utils21.HEADERS.CONTENT_TYPE]: import_io_wallet_utils21.CONTENT_TYPES.FORM_URLENCODED,
|
|
1604
|
+
[import_io_wallet_utils21.HEADERS.OAUTH_CLIENT_ATTESTATION]: options.walletAttestation,
|
|
1605
|
+
[import_io_wallet_utils21.HEADERS.OAUTH_CLIENT_ATTESTATION_POP]: options.clientAttestationDPoP
|
|
1363
1606
|
},
|
|
1364
1607
|
method: "POST"
|
|
1365
1608
|
}
|
|
1366
1609
|
);
|
|
1367
|
-
await (0,
|
|
1610
|
+
await (0, import_io_wallet_utils21.hasStatusOrThrow)(201, import_io_wallet_utils21.UnexpectedStatusCodeError)(parResponse);
|
|
1368
1611
|
const parResponseJson = await parResponse.json();
|
|
1369
1612
|
const parsedParResponse = zPushedAuthorizationResponse.safeParse(parResponseJson);
|
|
1370
1613
|
if (!parsedParResponse.success) {
|
|
1371
|
-
throw new
|
|
1614
|
+
throw new import_io_wallet_utils21.ValidationError(
|
|
1372
1615
|
`Failed to parse pushed authorization response`,
|
|
1373
1616
|
parsedParResponse.error
|
|
1374
1617
|
);
|
|
1375
1618
|
}
|
|
1376
1619
|
return parsedParResponse.data;
|
|
1377
1620
|
} catch (error) {
|
|
1378
|
-
if (error instanceof
|
|
1621
|
+
if (error instanceof import_io_wallet_utils21.UnexpectedStatusCodeError || error instanceof import_io_wallet_utils21.ValidationError) {
|
|
1379
1622
|
throw error;
|
|
1380
1623
|
}
|
|
1381
1624
|
throw new PushedAuthorizationRequestError(
|
|
@@ -1421,22 +1664,22 @@ function parseAuthorizationRequest(options) {
|
|
|
1421
1664
|
}
|
|
1422
1665
|
|
|
1423
1666
|
// src/authorization-request/parse-pushed-authorization-request.ts
|
|
1424
|
-
var
|
|
1667
|
+
var import_io_wallet_utils24 = require("@pagopa/io-wallet-utils");
|
|
1425
1668
|
var import_zod11 = __toESM(require("zod"));
|
|
1426
1669
|
|
|
1427
1670
|
// src/jar/fetch-jar-request-object.ts
|
|
1428
|
-
var
|
|
1671
|
+
var import_io_wallet_utils22 = require("@pagopa/io-wallet-utils");
|
|
1429
1672
|
async function fetchJarRequestObject(options) {
|
|
1430
1673
|
const { fetch, requestUri } = options;
|
|
1431
1674
|
const JAR_ACCEPT_HEADER = [
|
|
1432
|
-
|
|
1675
|
+
import_io_wallet_utils22.ContentType.OAuthAuthorizationRequestJwt,
|
|
1433
1676
|
// Preferred: application/oauth-authz-req+jwt
|
|
1434
|
-
`${
|
|
1677
|
+
`${import_io_wallet_utils22.ContentType.Jwt};q=0.9`,
|
|
1435
1678
|
// Fallback: application/jwt
|
|
1436
1679
|
"text/plain"
|
|
1437
1680
|
// Final fallback: text/plain
|
|
1438
1681
|
].join(", ");
|
|
1439
|
-
const response = await (0,
|
|
1682
|
+
const response = await (0, import_io_wallet_utils22.createFetcher)(fetch)(requestUri, {
|
|
1440
1683
|
headers: {
|
|
1441
1684
|
Accept: JAR_ACCEPT_HEADER
|
|
1442
1685
|
},
|
|
@@ -1446,7 +1689,7 @@ async function fetchJarRequestObject(options) {
|
|
|
1446
1689
|
`Fetching request_object from request_uri '${requestUri}' failed`
|
|
1447
1690
|
);
|
|
1448
1691
|
});
|
|
1449
|
-
await (0,
|
|
1692
|
+
await (0, import_io_wallet_utils22.hasStatusOrThrow)(200, import_io_wallet_utils22.UnexpectedStatusCodeError)(response);
|
|
1450
1693
|
return await response.text();
|
|
1451
1694
|
}
|
|
1452
1695
|
|
|
@@ -1483,7 +1726,7 @@ async function parseJarRequest(options) {
|
|
|
1483
1726
|
}
|
|
1484
1727
|
|
|
1485
1728
|
// src/jar/z-jar.ts
|
|
1486
|
-
var
|
|
1729
|
+
var import_io_wallet_utils23 = require("@pagopa/io-wallet-utils");
|
|
1487
1730
|
var import_zod10 = __toESM(require("zod"));
|
|
1488
1731
|
var zJarAuthorizationRequest = import_zod10.default.looseObject({
|
|
1489
1732
|
client_id: import_zod10.default.optional(import_zod10.default.string()),
|
|
@@ -1491,14 +1734,14 @@ var zJarAuthorizationRequest = import_zod10.default.looseObject({
|
|
|
1491
1734
|
request_uri: import_zod10.default.url().optional()
|
|
1492
1735
|
});
|
|
1493
1736
|
var zJarRequestObjectPayload = import_zod10.default.looseObject({
|
|
1494
|
-
...
|
|
1737
|
+
...import_io_wallet_utils23.zJwtPayload.shape,
|
|
1495
1738
|
client_id: import_zod10.default.string()
|
|
1496
1739
|
});
|
|
1497
1740
|
var zSignedAuthorizationRequestJwtHeaderTyp = import_zod10.default.literal(
|
|
1498
1741
|
"oauth-authz-req+jwt"
|
|
1499
1742
|
);
|
|
1500
1743
|
var zJarRequestObjectHeader = import_zod10.default.looseObject({
|
|
1501
|
-
...
|
|
1744
|
+
...import_io_wallet_utils23.zJwtHeader.shape,
|
|
1502
1745
|
typ: zSignedAuthorizationRequestJwtHeaderTyp
|
|
1503
1746
|
});
|
|
1504
1747
|
var signedAuthorizationRequestJwtHeaderTyp = zSignedAuthorizationRequestJwtHeaderTyp.value;
|
|
@@ -1510,7 +1753,7 @@ async function parsePushedAuthorizationRequest(options) {
|
|
|
1510
1753
|
const authorizationRequestSchema = getAuthorizationRequestSchema(
|
|
1511
1754
|
options.config
|
|
1512
1755
|
);
|
|
1513
|
-
const parsed = (0,
|
|
1756
|
+
const parsed = (0, import_io_wallet_utils24.parseWithErrorHandling)(
|
|
1514
1757
|
import_zod11.default.union([authorizationRequestSchema, zJarAuthorizationRequest]),
|
|
1515
1758
|
options.authorizationRequest,
|
|
1516
1759
|
"Invalid authorization request. Could not parse authorization request or jar."
|
|
@@ -1522,7 +1765,7 @@ async function parsePushedAuthorizationRequest(options) {
|
|
|
1522
1765
|
callbacks: options.callbacks,
|
|
1523
1766
|
jarRequestParams: parsed
|
|
1524
1767
|
});
|
|
1525
|
-
const jwt = (0,
|
|
1768
|
+
const jwt = (0, import_io_wallet_utils24.decodeJwt)({
|
|
1526
1769
|
errorMessagePrefix: "Error decoding pushed authorization request JWT:",
|
|
1527
1770
|
jwt: parsedJar.authorizationRequestJwt
|
|
1528
1771
|
});
|
|
@@ -1532,7 +1775,7 @@ async function parsePushedAuthorizationRequest(options) {
|
|
|
1532
1775
|
if (!parsedAuthorizationRequest.success) {
|
|
1533
1776
|
throw new Oauth2Error(
|
|
1534
1777
|
`Invalid authorization request. Could not parse jar request payload.
|
|
1535
|
-
${(0,
|
|
1778
|
+
${(0, import_io_wallet_utils24.formatZodError)(parsedAuthorizationRequest.error)}`
|
|
1536
1779
|
);
|
|
1537
1780
|
}
|
|
1538
1781
|
authorizationRequestJwt = parsedJar.authorizationRequestJwt;
|
|
@@ -1543,7 +1786,7 @@ ${(0, import_io_wallet_utils22.formatZodError)(parsedAuthorizationRequest.error)
|
|
|
1543
1786
|
if (!parsedAuthorizationRequest.success) {
|
|
1544
1787
|
throw new Oauth2Error(
|
|
1545
1788
|
`Error occurred during validation of pushed authorization request.
|
|
1546
|
-
${(0,
|
|
1789
|
+
${(0, import_io_wallet_utils24.formatZodError)(parsedAuthorizationRequest.error)}`
|
|
1547
1790
|
);
|
|
1548
1791
|
}
|
|
1549
1792
|
}
|
|
@@ -1559,12 +1802,13 @@ ${(0, import_io_wallet_utils22.formatZodError)(parsedAuthorizationRequest.error)
|
|
|
1559
1802
|
};
|
|
1560
1803
|
}
|
|
1561
1804
|
function getAuthorizationRequestSchema(config) {
|
|
1562
|
-
return (0,
|
|
1563
|
-
[
|
|
1564
|
-
[
|
|
1805
|
+
return (0, import_io_wallet_utils24.dispatchByVersion)(config.itWalletSpecsVersion, {
|
|
1806
|
+
[import_io_wallet_utils24.ItWalletSpecsVersion.APTITUDE]: () => zAuthorizationRequestV1_3,
|
|
1807
|
+
[import_io_wallet_utils24.ItWalletSpecsVersion.V1_0]: () => zAuthorizationRequestV1_0,
|
|
1565
1808
|
// V1_4 reuses V1_3 PAR schema — no breaking changes between versions.
|
|
1809
|
+
[import_io_wallet_utils24.ItWalletSpecsVersion.V1_3]: () => zAuthorizationRequestV1_3,
|
|
1566
1810
|
// Verified against compare/1.3.3...1.4.1: authorization request parameters identical.
|
|
1567
|
-
[
|
|
1811
|
+
[import_io_wallet_utils24.ItWalletSpecsVersion.V1_4]: () => zAuthorizationRequestV1_3
|
|
1568
1812
|
});
|
|
1569
1813
|
}
|
|
1570
1814
|
|
|
@@ -1613,19 +1857,19 @@ async function verifyAuthorizationRequestDpop(options, request, callbacks, now)
|
|
|
1613
1857
|
}
|
|
1614
1858
|
|
|
1615
1859
|
// src/authorization-request/verify-pushed-authorization-request.ts
|
|
1616
|
-
var
|
|
1860
|
+
var import_io_wallet_utils26 = require("@pagopa/io-wallet-utils");
|
|
1617
1861
|
|
|
1618
1862
|
// src/jar/verify-jar-request.ts
|
|
1619
|
-
var
|
|
1863
|
+
var import_io_wallet_utils25 = require("@pagopa/io-wallet-utils");
|
|
1620
1864
|
async function verifyJarRequest(options) {
|
|
1621
1865
|
const { authorizationRequestJwt, callbacks, jarRequestParams, jwtSigner } = options;
|
|
1622
|
-
const requestObjectIsEncrypted =
|
|
1866
|
+
const requestObjectIsEncrypted = import_io_wallet_utils25.zCompactJwe.safeParse(
|
|
1623
1867
|
authorizationRequestJwt
|
|
1624
1868
|
).success;
|
|
1625
1869
|
if (requestObjectIsEncrypted) {
|
|
1626
1870
|
throw new Oauth2Error("Encrypted JWE request objects are not supported.");
|
|
1627
1871
|
}
|
|
1628
|
-
const requestIsSigned =
|
|
1872
|
+
const requestIsSigned = import_io_wallet_utils25.zCompactJwt.safeParse(
|
|
1629
1873
|
authorizationRequestJwt
|
|
1630
1874
|
).success;
|
|
1631
1875
|
if (!requestIsSigned) {
|
|
@@ -1678,15 +1922,15 @@ async function verifyJarRequest(options) {
|
|
|
1678
1922
|
}
|
|
1679
1923
|
async function verifyJarRequestObject(options) {
|
|
1680
1924
|
const { authorizationRequestJwt, callbacks, jwtSigner } = options;
|
|
1681
|
-
const jwt = (0,
|
|
1925
|
+
const jwt = (0, import_io_wallet_utils25.decodeJwt)({
|
|
1682
1926
|
errorMessagePrefix: "Error decoding JAR authorization request JWT:",
|
|
1683
1927
|
jwt: authorizationRequestJwt
|
|
1684
1928
|
});
|
|
1685
|
-
const authorizationRequestPayload = (0,
|
|
1929
|
+
const authorizationRequestPayload = (0, import_io_wallet_utils25.parseWithErrorHandling)(
|
|
1686
1930
|
zJarRequestObjectPayload,
|
|
1687
1931
|
jwt.payload
|
|
1688
1932
|
);
|
|
1689
|
-
const { signer } = await (0,
|
|
1933
|
+
const { signer } = await (0, import_io_wallet_utils25.verifyJwt)({
|
|
1690
1934
|
compact: authorizationRequestJwt,
|
|
1691
1935
|
header: jwt.header,
|
|
1692
1936
|
payload: authorizationRequestPayload,
|
|
@@ -1719,7 +1963,7 @@ async function verifyPushedAuthorizationRequest(options) {
|
|
|
1719
1963
|
let jar;
|
|
1720
1964
|
if (options.authorizationRequestJwt) {
|
|
1721
1965
|
if (requireSigned) {
|
|
1722
|
-
const decoded = (0,
|
|
1966
|
+
const decoded = (0, import_io_wallet_utils26.decodeJwt)({
|
|
1723
1967
|
errorMessagePrefix: "Error decoding pushed authorization request JWT:",
|
|
1724
1968
|
jwt: options.authorizationRequestJwt.jwt
|
|
1725
1969
|
});
|
|
@@ -1808,10 +2052,10 @@ function clientAuthenticationWalletAttestationJwt(options) {
|
|
|
1808
2052
|
}
|
|
1809
2053
|
|
|
1810
2054
|
// src/client-attestation/v1.0/create-wallet-attestation-jwt.ts
|
|
1811
|
-
var
|
|
2055
|
+
var import_io_wallet_utils28 = require("@pagopa/io-wallet-utils");
|
|
1812
2056
|
|
|
1813
2057
|
// src/client-attestation/jwk-thumbprint.ts
|
|
1814
|
-
var
|
|
2058
|
+
var import_io_wallet_utils27 = require("@pagopa/io-wallet-utils");
|
|
1815
2059
|
var SUPPORTED_KTY = ["RSA", "EC"];
|
|
1816
2060
|
var calculateDpopJwkThumbprint = (options) => {
|
|
1817
2061
|
if (!SUPPORTED_KTY.includes(
|
|
@@ -1821,8 +2065,8 @@ var calculateDpopJwkThumbprint = (options) => {
|
|
|
1821
2065
|
`Unsupported JWK key type "${options.dpopJwkPublic.kty}" for thumbprint computation. Supported types: ${SUPPORTED_KTY.join(", ")}.`
|
|
1822
2066
|
);
|
|
1823
2067
|
}
|
|
1824
|
-
return (0,
|
|
1825
|
-
hashAlgorithm:
|
|
2068
|
+
return (0, import_io_wallet_utils27.calculateJwkThumbprint)({
|
|
2069
|
+
hashAlgorithm: import_io_wallet_utils27.HashAlgorithm.Sha256,
|
|
1826
2070
|
hashCallback: options.callbacks.hash,
|
|
1827
2071
|
jwk: options.dpopJwkPublic
|
|
1828
2072
|
});
|
|
@@ -1833,12 +2077,12 @@ var createWalletAttestationJwt = async (options) => {
|
|
|
1833
2077
|
try {
|
|
1834
2078
|
const { signJwt } = options.callbacks;
|
|
1835
2079
|
const iat = /* @__PURE__ */ new Date();
|
|
1836
|
-
const exp = options.expiresAt ?? (0,
|
|
2080
|
+
const exp = options.expiresAt ?? (0, import_io_wallet_utils28.addSecondsToDate)(iat, 3600);
|
|
1837
2081
|
const dpopJwkThumbprint = await calculateDpopJwkThumbprint(options);
|
|
1838
2082
|
const payload = {
|
|
1839
2083
|
cnf: { jwk: options.dpopJwkPublic },
|
|
1840
|
-
exp: (0,
|
|
1841
|
-
iat: (0,
|
|
2084
|
+
exp: (0, import_io_wallet_utils28.dateToSeconds)(exp),
|
|
2085
|
+
iat: (0, import_io_wallet_utils28.dateToSeconds)(iat),
|
|
1842
2086
|
iss: options.issuer,
|
|
1843
2087
|
sub: dpopJwkThumbprint,
|
|
1844
2088
|
...options.walletLink && { wallet_link: options.walletLink },
|
|
@@ -1855,7 +2099,7 @@ var createWalletAttestationJwt = async (options) => {
|
|
|
1855
2099
|
header,
|
|
1856
2100
|
payload
|
|
1857
2101
|
});
|
|
1858
|
-
(0,
|
|
2102
|
+
(0, import_io_wallet_utils28.decodeJwt)({
|
|
1859
2103
|
errorMessagePrefix: "Error decoding wallet attestation JWT:",
|
|
1860
2104
|
headerSchema: zWalletAttestationJwtHeaderV1_0,
|
|
1861
2105
|
jwt: result.jwt,
|
|
@@ -1863,7 +2107,7 @@ var createWalletAttestationJwt = async (options) => {
|
|
|
1863
2107
|
});
|
|
1864
2108
|
return result.jwt;
|
|
1865
2109
|
} catch (error) {
|
|
1866
|
-
if (error instanceof
|
|
2110
|
+
if (error instanceof import_io_wallet_utils28.ValidationError) {
|
|
1867
2111
|
throw error;
|
|
1868
2112
|
}
|
|
1869
2113
|
throw new ClientAttestationError(
|
|
@@ -1873,23 +2117,23 @@ var createWalletAttestationJwt = async (options) => {
|
|
|
1873
2117
|
};
|
|
1874
2118
|
|
|
1875
2119
|
// src/client-attestation/v1.3/create-wallet-attestation-jwt.ts
|
|
1876
|
-
var
|
|
2120
|
+
var import_io_wallet_utils29 = require("@pagopa/io-wallet-utils");
|
|
1877
2121
|
var createWalletAttestationJwt2 = async (options) => {
|
|
1878
2122
|
try {
|
|
1879
2123
|
const { signJwt } = options.callbacks;
|
|
1880
2124
|
const iat = /* @__PURE__ */ new Date();
|
|
1881
|
-
const exp = options.expiresAt ?? (0,
|
|
2125
|
+
const exp = options.expiresAt ?? (0, import_io_wallet_utils29.addSecondsToDate)(iat, 3600);
|
|
1882
2126
|
if (options.nbf && options.nbf >= exp) {
|
|
1883
|
-
throw new
|
|
2127
|
+
throw new import_io_wallet_utils29.ValidationError("nbf must be before exp");
|
|
1884
2128
|
}
|
|
1885
2129
|
const dpopJwkThumbprint = await calculateDpopJwkThumbprint(options);
|
|
1886
2130
|
const payload = {
|
|
1887
2131
|
cnf: { jwk: options.dpopJwkPublic },
|
|
1888
|
-
exp: (0,
|
|
1889
|
-
iat: (0,
|
|
2132
|
+
exp: (0, import_io_wallet_utils29.dateToSeconds)(exp),
|
|
2133
|
+
iat: (0, import_io_wallet_utils29.dateToSeconds)(iat),
|
|
1890
2134
|
iss: options.issuer,
|
|
1891
2135
|
sub: dpopJwkThumbprint,
|
|
1892
|
-
...options.nbf && { nbf: (0,
|
|
2136
|
+
...options.nbf && { nbf: (0, import_io_wallet_utils29.dateToSeconds)(options.nbf) },
|
|
1893
2137
|
...options.status && { status: options.status },
|
|
1894
2138
|
...options.walletLink && { wallet_link: options.walletLink },
|
|
1895
2139
|
...options.walletName && { wallet_name: options.walletName }
|
|
@@ -1908,7 +2152,7 @@ var createWalletAttestationJwt2 = async (options) => {
|
|
|
1908
2152
|
header,
|
|
1909
2153
|
payload
|
|
1910
2154
|
});
|
|
1911
|
-
(0,
|
|
2155
|
+
(0, import_io_wallet_utils29.decodeJwt)({
|
|
1912
2156
|
errorMessagePrefix: "Error decoding wallet attestation JWT:",
|
|
1913
2157
|
headerSchema: zWalletAttestationJwtHeaderV1_3,
|
|
1914
2158
|
jwt: result.jwt,
|
|
@@ -1916,7 +2160,7 @@ var createWalletAttestationJwt2 = async (options) => {
|
|
|
1916
2160
|
});
|
|
1917
2161
|
return result.jwt;
|
|
1918
2162
|
} catch (error) {
|
|
1919
|
-
if (error instanceof
|
|
2163
|
+
if (error instanceof import_io_wallet_utils29.ValidationError) {
|
|
1920
2164
|
throw error;
|
|
1921
2165
|
}
|
|
1922
2166
|
throw new ClientAttestationError(
|
|
@@ -1926,33 +2170,33 @@ var createWalletAttestationJwt2 = async (options) => {
|
|
|
1926
2170
|
};
|
|
1927
2171
|
|
|
1928
2172
|
// src/client-attestation/v1.4/create-wallet-attestation-jwt.ts
|
|
1929
|
-
var
|
|
2173
|
+
var import_io_wallet_utils30 = require("@pagopa/io-wallet-utils");
|
|
1930
2174
|
var DEFAULT_EXPIRATION_SECONDS = 3600;
|
|
1931
2175
|
var MAX_EXPIRATION_SECONDS = 86400;
|
|
1932
2176
|
var createWalletAttestationJwt3 = async (options) => {
|
|
1933
2177
|
try {
|
|
1934
2178
|
const { signJwt } = options.callbacks;
|
|
1935
2179
|
const iat = /* @__PURE__ */ new Date();
|
|
1936
|
-
const exp = options.expiresAt ?? (0,
|
|
2180
|
+
const exp = options.expiresAt ?? (0, import_io_wallet_utils30.addSecondsToDate)(iat, DEFAULT_EXPIRATION_SECONDS);
|
|
1937
2181
|
if (exp <= iat) {
|
|
1938
|
-
throw new
|
|
2182
|
+
throw new import_io_wallet_utils30.ValidationError("exp must be after iat");
|
|
1939
2183
|
}
|
|
1940
|
-
if (exp > (0,
|
|
1941
|
-
throw new
|
|
2184
|
+
if (exp > (0, import_io_wallet_utils30.addSecondsToDate)(iat, MAX_EXPIRATION_SECONDS)) {
|
|
2185
|
+
throw new import_io_wallet_utils30.ValidationError("exp must not be more than 24 hours after iat");
|
|
1942
2186
|
}
|
|
1943
2187
|
if (options.nbf && options.nbf >= exp) {
|
|
1944
|
-
throw new
|
|
2188
|
+
throw new import_io_wallet_utils30.ValidationError("nbf must be before exp");
|
|
1945
2189
|
}
|
|
1946
2190
|
const dpopJwkThumbprint = await calculateDpopJwkThumbprint(options);
|
|
1947
2191
|
const payload = {
|
|
1948
2192
|
cnf: { jwk: options.dpopJwkPublic },
|
|
1949
|
-
exp: (0,
|
|
1950
|
-
iat: (0,
|
|
2193
|
+
exp: (0, import_io_wallet_utils30.dateToSeconds)(exp),
|
|
2194
|
+
iat: (0, import_io_wallet_utils30.dateToSeconds)(iat),
|
|
1951
2195
|
iss: options.issuer,
|
|
1952
2196
|
sub: dpopJwkThumbprint,
|
|
1953
2197
|
wallet_link: options.walletLink,
|
|
1954
2198
|
wallet_name: options.walletName,
|
|
1955
|
-
...options.nbf && { nbf: (0,
|
|
2199
|
+
...options.nbf && { nbf: (0, import_io_wallet_utils30.dateToSeconds)(options.nbf) }
|
|
1956
2200
|
};
|
|
1957
2201
|
const header = {
|
|
1958
2202
|
alg: options.signer.alg,
|
|
@@ -1967,7 +2211,7 @@ var createWalletAttestationJwt3 = async (options) => {
|
|
|
1967
2211
|
header,
|
|
1968
2212
|
payload
|
|
1969
2213
|
});
|
|
1970
|
-
(0,
|
|
2214
|
+
(0, import_io_wallet_utils30.decodeJwt)({
|
|
1971
2215
|
errorMessagePrefix: "Error decoding wallet attestation JWT:",
|
|
1972
2216
|
headerSchema: zWalletAttestationJwtHeaderV1_4,
|
|
1973
2217
|
jwt: result.jwt,
|
|
@@ -1975,7 +2219,7 @@ var createWalletAttestationJwt3 = async (options) => {
|
|
|
1975
2219
|
});
|
|
1976
2220
|
return result.jwt;
|
|
1977
2221
|
} catch (error) {
|
|
1978
|
-
if (error instanceof
|
|
2222
|
+
if (error instanceof import_io_wallet_utils30.ValidationError) {
|
|
1979
2223
|
throw error;
|
|
1980
2224
|
}
|
|
1981
2225
|
throw new ClientAttestationError(
|
|
@@ -1985,7 +2229,7 @@ var createWalletAttestationJwt3 = async (options) => {
|
|
|
1985
2229
|
};
|
|
1986
2230
|
|
|
1987
2231
|
// src/jar/create-jar-request.ts
|
|
1988
|
-
var
|
|
2232
|
+
var import_io_wallet_utils31 = require("@pagopa/io-wallet-utils");
|
|
1989
2233
|
async function createJarRequest(options) {
|
|
1990
2234
|
const {
|
|
1991
2235
|
authorizationRequestHeader,
|
|
@@ -2003,8 +2247,8 @@ async function createJarRequest(options) {
|
|
|
2003
2247
|
payload: {
|
|
2004
2248
|
...options.additionalJwtPayload,
|
|
2005
2249
|
...authorizationRequestPayload,
|
|
2006
|
-
exp: (0,
|
|
2007
|
-
iat: (0,
|
|
2250
|
+
exp: (0, import_io_wallet_utils31.dateToSeconds)((0, import_io_wallet_utils31.addSecondsToDate)(now, options.expiresInSeconds)),
|
|
2251
|
+
iat: (0, import_io_wallet_utils31.dateToSeconds)(now)
|
|
2008
2252
|
}
|
|
2009
2253
|
});
|
|
2010
2254
|
authorizationRequestJwt = jwt;
|
|
@@ -2032,7 +2276,7 @@ async function createJarRequest(options) {
|
|
|
2032
2276
|
}
|
|
2033
2277
|
|
|
2034
2278
|
// src/jarm-form-post-jwt.ts
|
|
2035
|
-
var
|
|
2279
|
+
var import_io_wallet_utils32 = require("@pagopa/io-wallet-utils");
|
|
2036
2280
|
var getJwtFromFormPost = async (options) => {
|
|
2037
2281
|
const inputRegex = /<input[^<>]*>/gi;
|
|
2038
2282
|
const nameRegex = /name="response"/gi;
|
|
@@ -2047,7 +2291,7 @@ var getJwtFromFormPost = async (options) => {
|
|
|
2047
2291
|
const responseJwt = matchValue[1];
|
|
2048
2292
|
if (responseJwt) {
|
|
2049
2293
|
const jwt = responseJwt.replace(lineExpressionRegex, "");
|
|
2050
|
-
const decodedJwt = (0,
|
|
2294
|
+
const decodedJwt = (0, import_io_wallet_utils32.decodeJwt)({
|
|
2051
2295
|
errorMessagePrefix: "Error decoding JARM form post JWT:",
|
|
2052
2296
|
jwt,
|
|
2053
2297
|
payloadSchema: options.schema
|
|
@@ -2069,7 +2313,7 @@ var getJwtFromFormPost = async (options) => {
|
|
|
2069
2313
|
};
|
|
2070
2314
|
|
|
2071
2315
|
// src/mrtd-pop/create-mrtd-validation-jwt.ts
|
|
2072
|
-
var
|
|
2316
|
+
var import_io_wallet_utils33 = require("@pagopa/io-wallet-utils");
|
|
2073
2317
|
|
|
2074
2318
|
// src/mrtd-pop/z-mrtd-pop.ts
|
|
2075
2319
|
var import_zod12 = __toESM(require("zod"));
|
|
@@ -2146,13 +2390,13 @@ async function createMrtdValidationJwt(options) {
|
|
|
2146
2390
|
if (!kid) {
|
|
2147
2391
|
throw new MrtdPopError("Signer must have a publicJwk.kid property");
|
|
2148
2392
|
}
|
|
2149
|
-
const iat = (0,
|
|
2150
|
-
const header = (0,
|
|
2393
|
+
const iat = (0, import_io_wallet_utils33.dateToSeconds)(options.issuedAt);
|
|
2394
|
+
const header = (0, import_io_wallet_utils33.parseWithErrorHandling)(zMrtdValidationJwtHeader, {
|
|
2151
2395
|
alg: options.signer.alg,
|
|
2152
2396
|
kid,
|
|
2153
2397
|
typ: "mrtd-ias+jwt"
|
|
2154
2398
|
});
|
|
2155
|
-
const payload = (0,
|
|
2399
|
+
const payload = (0, import_io_wallet_utils33.parseWithErrorHandling)(zMrtdValidationJwtPayload, {
|
|
2156
2400
|
aud: options.audience,
|
|
2157
2401
|
document_type: "cie",
|
|
2158
2402
|
exp: iat + JWT_EXPIRY_SECONDS2,
|
|
@@ -2185,36 +2429,36 @@ async function createMrtdValidationJwt(options) {
|
|
|
2185
2429
|
}
|
|
2186
2430
|
|
|
2187
2431
|
// src/mrtd-pop/fetch-mrtd-pop-init.ts
|
|
2188
|
-
var
|
|
2432
|
+
var import_io_wallet_utils34 = require("@pagopa/io-wallet-utils");
|
|
2189
2433
|
async function fetchMrtdPopInit(options) {
|
|
2190
2434
|
try {
|
|
2191
|
-
const fetch = (0,
|
|
2435
|
+
const fetch = (0, import_io_wallet_utils34.createFetcher)(options.callbacks.fetch);
|
|
2192
2436
|
const response = await fetch(options.popInitEndpoint, {
|
|
2193
2437
|
body: JSON.stringify({
|
|
2194
2438
|
mrtd_auth_session: options.mrtdAuthSession,
|
|
2195
2439
|
mrtd_pop_jwt_nonce: options.mrtdPopJwtNonce
|
|
2196
2440
|
}),
|
|
2197
2441
|
headers: {
|
|
2198
|
-
[
|
|
2199
|
-
[
|
|
2200
|
-
[
|
|
2442
|
+
[import_io_wallet_utils34.HEADERS.CONTENT_TYPE]: import_io_wallet_utils34.CONTENT_TYPES.JSON,
|
|
2443
|
+
[import_io_wallet_utils34.HEADERS.OAUTH_CLIENT_ATTESTATION]: options.walletAttestation,
|
|
2444
|
+
[import_io_wallet_utils34.HEADERS.OAUTH_CLIENT_ATTESTATION_POP]: options.clientAttestationDPoP
|
|
2201
2445
|
},
|
|
2202
2446
|
method: "POST"
|
|
2203
2447
|
});
|
|
2204
|
-
await (0,
|
|
2448
|
+
await (0, import_io_wallet_utils34.hasStatusOrThrow)(202, import_io_wallet_utils34.UnexpectedStatusCodeError)(response);
|
|
2205
2449
|
const responseJwt = await response.text();
|
|
2206
|
-
const jwt = (0,
|
|
2450
|
+
const jwt = (0, import_io_wallet_utils34.decodeJwt)({
|
|
2207
2451
|
errorMessagePrefix: "Error decoding MRTD PoP init response JWT:",
|
|
2208
2452
|
headerSchema: zMrtdPopInitResponseJwtHeader,
|
|
2209
2453
|
jwt: responseJwt,
|
|
2210
2454
|
payloadSchema: zMrtdPopInitResponseJwtPayload
|
|
2211
2455
|
});
|
|
2212
|
-
const { signer } = await (0,
|
|
2456
|
+
const { signer } = await (0, import_io_wallet_utils34.verifyJwt)({
|
|
2213
2457
|
compact: responseJwt,
|
|
2214
2458
|
errorMessage: "Error verifying MRTD PoP init response JWT",
|
|
2215
2459
|
header: jwt.header,
|
|
2216
2460
|
payload: jwt.payload,
|
|
2217
|
-
signer: options.signer ?? (0,
|
|
2461
|
+
signer: options.signer ?? (0, import_io_wallet_utils34.jwtSignerFromJwt)({ header: jwt.header, payload: jwt.payload }),
|
|
2218
2462
|
verifyJwtCallback: options.callbacks.verifyJwt
|
|
2219
2463
|
});
|
|
2220
2464
|
return {
|
|
@@ -2225,7 +2469,7 @@ async function fetchMrtdPopInit(options) {
|
|
|
2225
2469
|
signer
|
|
2226
2470
|
};
|
|
2227
2471
|
} catch (error) {
|
|
2228
|
-
if (error instanceof
|
|
2472
|
+
if (error instanceof import_io_wallet_utils34.UnexpectedStatusCodeError || error instanceof import_io_wallet_utils34.ValidationError) {
|
|
2229
2473
|
throw error;
|
|
2230
2474
|
}
|
|
2231
2475
|
throw new MrtdPopError(
|
|
@@ -2235,10 +2479,10 @@ async function fetchMrtdPopInit(options) {
|
|
|
2235
2479
|
}
|
|
2236
2480
|
|
|
2237
2481
|
// src/mrtd-pop/fetch-mrtd-pop-verify.ts
|
|
2238
|
-
var
|
|
2482
|
+
var import_io_wallet_utils35 = require("@pagopa/io-wallet-utils");
|
|
2239
2483
|
async function fetchMrtdPopVerify(options) {
|
|
2240
2484
|
try {
|
|
2241
|
-
const fetch = (0,
|
|
2485
|
+
const fetch = (0, import_io_wallet_utils35.createFetcher)(options.callbacks.fetch);
|
|
2242
2486
|
const response = await fetch(options.popVerifyEndpoint, {
|
|
2243
2487
|
body: JSON.stringify({
|
|
2244
2488
|
mrtd_auth_session: options.mrtdAuthSession,
|
|
@@ -2246,14 +2490,14 @@ async function fetchMrtdPopVerify(options) {
|
|
|
2246
2490
|
mrtd_validation_jwt: options.mrtdValidationJwt
|
|
2247
2491
|
}),
|
|
2248
2492
|
headers: {
|
|
2249
|
-
[
|
|
2250
|
-
[
|
|
2251
|
-
[
|
|
2493
|
+
[import_io_wallet_utils35.HEADERS.CONTENT_TYPE]: import_io_wallet_utils35.CONTENT_TYPES.JSON,
|
|
2494
|
+
[import_io_wallet_utils35.HEADERS.OAUTH_CLIENT_ATTESTATION]: options.walletAttestation,
|
|
2495
|
+
[import_io_wallet_utils35.HEADERS.OAUTH_CLIENT_ATTESTATION_POP]: options.clientAttestationDPoP
|
|
2252
2496
|
},
|
|
2253
2497
|
method: "POST"
|
|
2254
2498
|
});
|
|
2255
|
-
await (0,
|
|
2256
|
-
const parsed = (0,
|
|
2499
|
+
await (0, import_io_wallet_utils35.hasStatusOrThrow)(202, import_io_wallet_utils35.UnexpectedStatusCodeError)(response);
|
|
2500
|
+
const parsed = (0, import_io_wallet_utils35.parseWithErrorHandling)(
|
|
2257
2501
|
zMrtdPopVerifyResponse,
|
|
2258
2502
|
await response.json(),
|
|
2259
2503
|
"Failed to parse MRTD PoP verify response"
|
|
@@ -2263,7 +2507,7 @@ async function fetchMrtdPopVerify(options) {
|
|
|
2263
2507
|
redirectUri: parsed.redirect_uri
|
|
2264
2508
|
};
|
|
2265
2509
|
} catch (error) {
|
|
2266
|
-
if (error instanceof
|
|
2510
|
+
if (error instanceof import_io_wallet_utils35.UnexpectedStatusCodeError || error instanceof import_io_wallet_utils35.ValidationError) {
|
|
2267
2511
|
throw error;
|
|
2268
2512
|
}
|
|
2269
2513
|
throw new MrtdPopError(
|
|
@@ -2273,7 +2517,7 @@ async function fetchMrtdPopVerify(options) {
|
|
|
2273
2517
|
}
|
|
2274
2518
|
|
|
2275
2519
|
// src/mrtd-pop/parse-mrtd-challenge.ts
|
|
2276
|
-
var
|
|
2520
|
+
var import_io_wallet_utils36 = require("@pagopa/io-wallet-utils");
|
|
2277
2521
|
function parseMrtdChallenge(options) {
|
|
2278
2522
|
const url = new URL(options.redirectUrl);
|
|
2279
2523
|
const challengeJwt = url.searchParams.get("challenge_info");
|
|
@@ -2282,12 +2526,12 @@ function parseMrtdChallenge(options) {
|
|
|
2282
2526
|
"Missing 'challenge_info' query parameter in redirect URL"
|
|
2283
2527
|
);
|
|
2284
2528
|
}
|
|
2285
|
-
if (!
|
|
2529
|
+
if (!import_io_wallet_utils36.zCompactJwt.safeParse(challengeJwt).success) {
|
|
2286
2530
|
throw new MrtdPopError(
|
|
2287
2531
|
"Invalid JWT format in 'challenge_info' query parameter"
|
|
2288
2532
|
);
|
|
2289
2533
|
}
|
|
2290
|
-
const { header, payload } = (0,
|
|
2534
|
+
const { header, payload } = (0, import_io_wallet_utils36.decodeJwt)({
|
|
2291
2535
|
errorMessagePrefix: "Error decoding MRTD challenge JWT:",
|
|
2292
2536
|
headerSchema: zMrtdChallengeJwtHeader,
|
|
2293
2537
|
jwt: challengeJwt,
|
|
@@ -2297,10 +2541,10 @@ function parseMrtdChallenge(options) {
|
|
|
2297
2541
|
}
|
|
2298
2542
|
|
|
2299
2543
|
// src/mrtd-pop/verify-mrtd-challenge.ts
|
|
2300
|
-
var
|
|
2544
|
+
var import_io_wallet_utils37 = require("@pagopa/io-wallet-utils");
|
|
2301
2545
|
async function verifyMrtdChallenge(options) {
|
|
2302
2546
|
const { callbacks, challengeJwt, clientId } = options;
|
|
2303
|
-
const jwt = (0,
|
|
2547
|
+
const jwt = (0, import_io_wallet_utils37.decodeJwt)({
|
|
2304
2548
|
errorMessagePrefix: "Error decoding MRTD challenge JWT:",
|
|
2305
2549
|
headerSchema: zMrtdChallengeJwtHeader,
|
|
2306
2550
|
jwt: challengeJwt,
|
|
@@ -2312,12 +2556,12 @@ async function verifyMrtdChallenge(options) {
|
|
|
2312
2556
|
);
|
|
2313
2557
|
}
|
|
2314
2558
|
const payload = jwt.payload;
|
|
2315
|
-
const { signer } = await (0,
|
|
2559
|
+
const { signer } = await (0, import_io_wallet_utils37.verifyJwt)({
|
|
2316
2560
|
compact: challengeJwt,
|
|
2317
2561
|
errorMessage: "Error verifying MRTD challenge JWT",
|
|
2318
2562
|
header: jwt.header,
|
|
2319
2563
|
payload,
|
|
2320
|
-
signer: options.signer ?? (0,
|
|
2564
|
+
signer: options.signer ?? (0, import_io_wallet_utils37.jwtSignerFromJwt)({ header: jwt.header, payload }),
|
|
2321
2565
|
verifyJwtCallback: callbacks.verifyJwt
|
|
2322
2566
|
});
|
|
2323
2567
|
return { header: jwt.header, payload: jwt.payload, signer };
|
|
@@ -2345,6 +2589,8 @@ async function verifyMrtdChallenge(options) {
|
|
|
2345
2589
|
createPushedAuthorizationRequest,
|
|
2346
2590
|
createTokenDPoP,
|
|
2347
2591
|
createTokenRequest,
|
|
2592
|
+
createTokenRequestAPTITUDE,
|
|
2593
|
+
createTokenRequestV1_4,
|
|
2348
2594
|
createWalletAttestationJwtV1_0,
|
|
2349
2595
|
createWalletAttestationJwtV1_3,
|
|
2350
2596
|
createWalletAttestationJwtV1_4,
|
|
@@ -2367,6 +2613,7 @@ async function verifyMrtdChallenge(options) {
|
|
|
2367
2613
|
parseJarRequest,
|
|
2368
2614
|
parseMrtdChallenge,
|
|
2369
2615
|
parsePushedAuthorizationRequest,
|
|
2616
|
+
preAuthorizedCodeGrantIdentifier,
|
|
2370
2617
|
refreshTokenGrantIdentifier,
|
|
2371
2618
|
signedAuthorizationRequestJwtHeaderTyp,
|
|
2372
2619
|
toURLSearchParams,
|
|
@@ -2387,8 +2634,10 @@ async function verifyMrtdChallenge(options) {
|
|
|
2387
2634
|
zAccessTokenProfileJwtHeader,
|
|
2388
2635
|
zAccessTokenProfileJwtPayload,
|
|
2389
2636
|
zAccessTokenRequest,
|
|
2637
|
+
zAccessTokenRequestAPTITUDE,
|
|
2390
2638
|
zAccessTokenResponse,
|
|
2391
2639
|
zAuthorizationCodeGrantIdentifier,
|
|
2640
|
+
zAuthorizationCodeTokenRequest,
|
|
2392
2641
|
zAuthorizationRequestV1_0,
|
|
2393
2642
|
zAuthorizationRequestV1_3,
|
|
2394
2643
|
zDpopJwtHeader,
|
|
@@ -2407,6 +2656,8 @@ async function verifyMrtdChallenge(options) {
|
|
|
2407
2656
|
zMrtdPopVerifyResponse,
|
|
2408
2657
|
zMrtdValidationJwtHeader,
|
|
2409
2658
|
zMrtdValidationJwtPayload,
|
|
2659
|
+
zPreAuthorizedCodeGrantIdentifier,
|
|
2660
|
+
zPreAuthorizedCodeTokenRequest,
|
|
2410
2661
|
zPushedAuthorizationRequestSigned,
|
|
2411
2662
|
zPushedAuthorizationRequestUnsignedV1_0,
|
|
2412
2663
|
zPushedAuthorizationRequestUnsignedV1_3,
|
|
@@ -2414,6 +2665,7 @@ async function verifyMrtdChallenge(options) {
|
|
|
2414
2665
|
zRefreshTokenGrantIdentifier,
|
|
2415
2666
|
zRefreshTokenProfileJwtHeader,
|
|
2416
2667
|
zRefreshTokenProfileJwtPayload,
|
|
2668
|
+
zRefreshTokenTokenRequest,
|
|
2417
2669
|
zSignedAuthorizationRequestJwtHeaderTyp,
|
|
2418
2670
|
zWalletAttestationJwtHeaderV1_0,
|
|
2419
2671
|
zWalletAttestationJwtHeaderV1_3,
|