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