@pagopa/io-wallet-oid4vci 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.mjs CHANGED
@@ -201,91 +201,6 @@ async function sendAuthorizationResponseAndExtractCode(options) {
201
201
  }
202
202
  }
203
203
 
204
- // src/credential-offer/APTITUDE/z-credential-offer.ts
205
- import { z as z2 } from "zod";
206
- var zTxCodePreAuthorizedCodeGrantAPTITUDE = z2.object({
207
- /**
208
- * OPTIONAL. String containing guidance for the Holder
209
- * of the Wallet on how to obtain the Transaction Code.
210
- */
211
- description: z2.string().max(300).optional(),
212
- /**
213
- * OPTIONAL. String specifying the input character set.
214
- * Possible values are numeric (only digits) and text (any characters).
215
- * The default is numeric.
216
- */
217
- input_mode: z2.enum(["numeric", "digit"]).optional(),
218
- /**
219
- * OPTIONAL. Integer specifying the length of the Transaction Code.
220
- */
221
- length: z2.number().optional()
222
- });
223
- var zAuthorizationCodeGrantAPTITUDE = z2.object({
224
- /**
225
- * CONDITIONALLY REQUIRED. HTTPS URL of the Authorization Server.
226
- * REQUIRED only when the Credential Issuer uses multiple Authorization Servers.
227
- * If present, MUST match one of the authorization_servers in the Credential Issuer metadata.
228
- */
229
- authorization_server: z2.url().optional(),
230
- /**
231
- * OPTIONAL. String value representing the issuer state.
232
- * Used to correlate the authorization request with the credential offer.
233
- */
234
- issuer_state: z2.string().optional()
235
- });
236
- var zPreAuthorizedCodeGrantAPTITUDE = z2.object({
237
- /**
238
- * CONDITIONALLY REQUIRED. HTTPS URL of the Authorization Server.
239
- * REQUIRED only when the Credential Issuer uses multiple Authorization Servers.
240
- * If present, MUST match one of the authorization_servers in the Credential Issuer metadata.
241
- */
242
- authorization_server: z2.url().optional(),
243
- /**
244
- * REQUIRED. The code representing the Credential Issuer's authorization for
245
- * the Wallet to obtain Credentials of a certain type
246
- */
247
- "pre-authorized_code": z2.string(),
248
- /**
249
- * OPTIONAL. Object indicating that a Transaction Code is required if present, even if empty.
250
- * It describes the requirements for a Transaction Code, which the Authorization Server expects
251
- * the End-User to present along with the Token Request in a Pre-Authorized Code Flow.
252
- * If the Authorization Server does not expect a Transaction Code, this object is absent;
253
- */
254
- tx_code: zTxCodePreAuthorizedCodeGrantAPTITUDE.optional()
255
- });
256
- var zCredentialOfferGrantsAPTITUDE = z2.object({
257
- /**
258
- * OPTIONAL. Authorization Code grant details.
259
- */
260
- authorization_code: zAuthorizationCodeGrantAPTITUDE.optional(),
261
- /**
262
- * OPTIONAL. Pre-Authorized Code grant details.
263
- */
264
- "urn:ietf:params:oauth:grant-type:pre-authorized_code": zPreAuthorizedCodeGrantAPTITUDE.optional()
265
- });
266
- var zCredentialOfferAPTITUDE = z2.object({
267
- /**
268
- * REQUIRED. Array of credential configuration identifiers.
269
- * References the types of credentials offered as defined in the Credential Issuer metadata.
270
- */
271
- credential_configuration_ids: z2.array(z2.string()).min(1),
272
- /**
273
- * REQUIRED. HTTPS URL of the Credential Issuer.
274
- * The Credential Issuer from which the wallet will request credentials.
275
- */
276
- credential_issuer: z2.url(),
277
- /**
278
- * REQUIRED. Grant information for the credential offer.
279
- * IT-Wallet v1.4 requires authorization_code or pre-auhorized code grant.
280
- */
281
- grants: zCredentialOfferGrantsAPTITUDE
282
- });
283
- var CREDENTIAL_OFFER_GRANTS = /* @__PURE__ */ ((CREDENTIAL_OFFER_GRANTS2) => {
284
- CREDENTIAL_OFFER_GRANTS2["AUTHORIZATION_CODE"] = "authorization_code";
285
- CREDENTIAL_OFFER_GRANTS2["PREAUTHORIZED_CODE"] = "urn:ietf:params:oauth:grant-type:pre-authorized_code";
286
- return CREDENTIAL_OFFER_GRANTS2;
287
- })(CREDENTIAL_OFFER_GRANTS || {});
288
-
289
204
  // src/credential-offer/extract-grant-details.ts
290
205
  import {
291
206
  ItWalletSpecsVersion,
@@ -302,70 +217,33 @@ function requireAuthorizationCodeGrant(credentialOffer) {
302
217
  }
303
218
  return authCodeGrant;
304
219
  }
305
- function requireAuthorizationCodeOrPreAuthorizedCodeGrant(credentialOffer) {
306
- if (!credentialOffer.grants) {
307
- throw new CredentialOfferError("No grants found in credential offer");
308
- }
309
- const grants = credentialOffer.grants;
310
- if (!grants["authorization_code" /* AUTHORIZATION_CODE */] && !grants["urn:ietf:params:oauth:grant-type:pre-authorized_code" /* PREAUTHORIZED_CODE */]) {
311
- throw new CredentialOfferError(
312
- "either one of authorization_code or pre-authorized code grant is required"
313
- );
314
- }
315
- return grants;
316
- }
317
220
  function extractGrantDetailsV1_3(options) {
318
221
  const authCodeGrant = requireAuthorizationCodeGrant(options.credentialOffer);
319
222
  return {
320
- ["authorization_code" /* AUTHORIZATION_CODE */]: {
223
+ authorizationCodeGrant: {
321
224
  authorizationServer: authCodeGrant.authorization_server,
322
225
  issuerState: authCodeGrant.issuer_state,
323
226
  scope: authCodeGrant.scope
324
- }
227
+ },
228
+ grantType: "authorization_code"
325
229
  };
326
230
  }
327
231
  function extractGrantDetailsV1_4(options) {
328
232
  const authCodeGrant = requireAuthorizationCodeGrant(options.credentialOffer);
329
233
  return {
330
- ["authorization_code" /* AUTHORIZATION_CODE */]: {
234
+ authorizationCodeGrant: {
331
235
  authorizationServer: authCodeGrant.authorization_server,
332
236
  issuerState: authCodeGrant.issuer_state
333
- }
334
- };
335
- }
336
- function extractGrantDetailsAPTITUDE(options) {
337
- const grants = requireAuthorizationCodeOrPreAuthorizedCodeGrant(
338
- options.credentialOffer
339
- );
340
- const authorizationCodeGrant = grants["authorization_code" /* AUTHORIZATION_CODE */];
341
- const preAuthorizedCodeGrant = grants["urn:ietf:params:oauth:grant-type:pre-authorized_code" /* PREAUTHORIZED_CODE */];
342
- return {
343
- ...authorizationCodeGrant && {
344
- ["authorization_code" /* AUTHORIZATION_CODE */]: {
345
- authorizationServer: authorizationCodeGrant.authorization_server,
346
- issuerState: authorizationCodeGrant.issuer_state
347
- }
348
237
  },
349
- ...preAuthorizedCodeGrant && {
350
- ["urn:ietf:params:oauth:grant-type:pre-authorized_code" /* PREAUTHORIZED_CODE */]: {
351
- authorizationServer: preAuthorizedCodeGrant.authorization_server,
352
- preAuthorizedCode: preAuthorizedCodeGrant["pre-authorized_code"],
353
- txCode: preAuthorizedCodeGrant.tx_code
354
- }
355
- }
238
+ grantType: "authorization_code"
356
239
  };
357
240
  }
358
241
  var dispatchExtractGrantDetails = createVersionDispatcher({
359
- [ItWalletSpecsVersion.APTITUDE]: (o) => extractGrantDetailsAPTITUDE(o),
360
242
  [ItWalletSpecsVersion.V1_0]: () => {
361
243
  throw new ItWalletSpecsVersionError(
362
244
  "extractGrantDetails",
363
245
  ItWalletSpecsVersion.V1_0,
364
- [
365
- ItWalletSpecsVersion.V1_3,
366
- ItWalletSpecsVersion.V1_4,
367
- ItWalletSpecsVersion.APTITUDE
368
- ]
246
+ [ItWalletSpecsVersion.V1_3, ItWalletSpecsVersion.V1_4]
369
247
  );
370
248
  },
371
249
  [ItWalletSpecsVersion.V1_3]: (o) => extractGrantDetailsV1_3(o),
@@ -376,46 +254,46 @@ function extractGrantDetails(options) {
376
254
  }
377
255
 
378
256
  // src/credential-offer/z-credential-offer.ts
379
- import { z as z5 } from "zod";
257
+ import { z as z4 } from "zod";
380
258
 
381
259
  // src/credential-offer/v1.3/z-credential-offer.ts
382
- import { z as z3 } from "zod";
383
- var zAuthorizationCodeGrantV1_3 = z3.object({
260
+ import { z as z2 } from "zod";
261
+ var zAuthorizationCodeGrantV1_3 = z2.object({
384
262
  /**
385
263
  * CONDITIONALLY REQUIRED. HTTPS URL of the Authorization Server.
386
264
  * REQUIRED only when the Credential Issuer uses multiple Authorization Servers.
387
265
  * If present, MUST match one of the authorization_servers in the Credential Issuer metadata.
388
266
  */
389
- authorization_server: z3.url().optional(),
267
+ authorization_server: z2.url().optional(),
390
268
  /**
391
269
  * OPTIONAL. String value representing the issuer state.
392
270
  * Used to correlate the authorization request with the credential offer.
393
271
  */
394
- issuer_state: z3.string().optional(),
272
+ issuer_state: z2.string().optional(),
395
273
  /**
396
274
  * REQUIRED. OAuth 2.0 scope value.
397
275
  * Defines the scope of access requested by the credential offer.
398
276
  */
399
- scope: z3.string()
277
+ scope: z2.string()
400
278
  });
401
- var zCredentialOfferGrantsV1_3 = z3.object({
279
+ var zCredentialOfferGrantsV1_3 = z2.object({
402
280
  /**
403
281
  * REQUIRED. Authorization Code grant details.
404
282
  * IT-Wallet v1.3 only supports authorization_code grant.
405
283
  */
406
284
  authorization_code: zAuthorizationCodeGrantV1_3
407
285
  });
408
- var zCredentialOfferV1_3 = z3.object({
286
+ var zCredentialOfferV1_3 = z2.object({
409
287
  /**
410
288
  * REQUIRED. Array of credential configuration identifiers.
411
289
  * References the types of credentials offered as defined in the Credential Issuer metadata.
412
290
  */
413
- credential_configuration_ids: z3.array(z3.string()).min(1),
291
+ credential_configuration_ids: z2.array(z2.string()).min(1),
414
292
  /**
415
293
  * REQUIRED. HTTPS URL of the Credential Issuer.
416
294
  * The Credential Issuer from which the wallet will request credentials.
417
295
  */
418
- credential_issuer: z3.url(),
296
+ credential_issuer: z2.url(),
419
297
  /**
420
298
  * REQUIRED. Grant information for the credential offer.
421
299
  * IT-Wallet v1.3 requires authorization_code grant.
@@ -424,38 +302,38 @@ var zCredentialOfferV1_3 = z3.object({
424
302
  });
425
303
 
426
304
  // src/credential-offer/v1.4/z-credential-offer.ts
427
- import { z as z4 } from "zod";
428
- var zAuthorizationCodeGrantV1_4 = z4.object({
305
+ import { z as z3 } from "zod";
306
+ var zAuthorizationCodeGrantV1_4 = z3.object({
429
307
  /**
430
308
  * CONDITIONALLY REQUIRED. HTTPS URL of the Authorization Server.
431
309
  * REQUIRED only when the Credential Issuer uses multiple Authorization Servers.
432
310
  * If present, MUST match one of the authorization_servers in the Credential Issuer metadata.
433
311
  */
434
- authorization_server: z4.url().optional(),
312
+ authorization_server: z3.url().optional(),
435
313
  /**
436
314
  * OPTIONAL. String value representing the issuer state.
437
315
  * Used to correlate the authorization request with the credential offer.
438
316
  */
439
- issuer_state: z4.string().optional()
317
+ issuer_state: z3.string().optional()
440
318
  });
441
- var zCredentialOfferGrantsV1_4 = z4.object({
319
+ var zCredentialOfferGrantsV1_4 = z3.object({
442
320
  /**
443
321
  * REQUIRED. Authorization Code grant details.
444
322
  * IT-Wallet v1.4 only supports authorization_code grant.
445
323
  */
446
324
  authorization_code: zAuthorizationCodeGrantV1_4
447
325
  });
448
- var zCredentialOfferV1_4 = z4.object({
326
+ var zCredentialOfferV1_4 = z3.object({
449
327
  /**
450
328
  * REQUIRED. Array of credential configuration identifiers.
451
329
  * References the types of credentials offered as defined in the Credential Issuer metadata.
452
330
  */
453
- credential_configuration_ids: z4.array(z4.string()).min(1),
331
+ credential_configuration_ids: z3.array(z3.string()).min(1),
454
332
  /**
455
333
  * REQUIRED. HTTPS URL of the Credential Issuer.
456
334
  * The Credential Issuer from which the wallet will request credentials.
457
335
  */
458
- credential_issuer: z4.url(),
336
+ credential_issuer: z3.url(),
459
337
  /**
460
338
  * REQUIRED. Grant information for the credential offer.
461
339
  * IT-Wallet v1.4 requires authorization_code grant.
@@ -464,22 +342,22 @@ var zCredentialOfferV1_4 = z4.object({
464
342
  });
465
343
 
466
344
  // src/credential-offer/z-credential-offer.ts
467
- var zCredentialOfferUri = z5.object({
345
+ var zCredentialOfferUri = z4.object({
468
346
  /**
469
347
  * OPTIONAL. Inline credential offer JSON (by value).
470
348
  * URL-encoded JSON string containing the credential offer.
471
349
  */
472
- credential_offer: z5.string().optional(),
350
+ credential_offer: z4.string().optional(),
473
351
  /**
474
352
  * OPTIONAL. URL pointing to the credential offer JSON (by reference).
475
353
  * HTTPS URL where the credential offer can be fetched.
476
354
  */
477
- credential_offer_uri: z5.url().optional(),
355
+ credential_offer_uri: z4.url().optional(),
478
356
  /**
479
357
  * URL scheme used for the credential offer.
480
358
  * Determines the invocation method.
481
359
  */
482
- scheme: z5.enum(["openid-credential-offer", "haip-vci", "https"])
360
+ scheme: z4.enum(["openid-credential-offer", "haip-vci", "https"])
483
361
  }).refine((data) => data.credential_offer || data.credential_offer_uri, {
484
362
  message: "Either credential_offer or credential_offer_uri must be present"
485
363
  });
@@ -530,17 +408,11 @@ function parseCredentialOfferForVersion(config, data) {
530
408
  return zCredentialOfferV1_3.parse(data);
531
409
  case ItWalletSpecsVersion2.V1_4:
532
410
  return zCredentialOfferV1_4.parse(data);
533
- case ItWalletSpecsVersion2.APTITUDE:
534
- return zCredentialOfferAPTITUDE.parse(data);
535
411
  default:
536
412
  throw new ItWalletSpecsVersionError2(
537
413
  "resolveCredentialOffer",
538
414
  config.itWalletSpecsVersion,
539
- [
540
- ItWalletSpecsVersion2.V1_3,
541
- ItWalletSpecsVersion2.V1_4,
542
- ItWalletSpecsVersion2.APTITUDE
543
- ]
415
+ [ItWalletSpecsVersion2.V1_3, ItWalletSpecsVersion2.V1_4]
544
416
  );
545
417
  }
546
418
  }
@@ -611,7 +483,7 @@ function assertAuthorizationServerAllowed(authorizationServer, authorizationServ
611
483
  }
612
484
  }
613
485
  function validateBaseCredentialOffer(options) {
614
- const { credentialOffer, versionLabel } = options;
486
+ const { credentialIssuerMetadata, credentialOffer, versionLabel } = options;
615
487
  if (!credentialOffer.credential_issuer.startsWith("https://")) {
616
488
  throw new CredentialOfferError("credential_issuer must be an HTTPS URL");
617
489
  }
@@ -625,11 +497,6 @@ function validateBaseCredentialOffer(options) {
625
497
  `grants is REQUIRED for IT-Wallet ${versionLabel}`
626
498
  );
627
499
  }
628
- }
629
- async function validateCredentialOfferV1_3(options) {
630
- const versionLabel = "v1.3";
631
- const { credentialIssuerMetadata, credentialOffer } = options;
632
- validateBaseCredentialOffer({ credentialOffer, versionLabel });
633
500
  const authCodeGrant = credentialOffer.grants.authorization_code;
634
501
  if (!authCodeGrant) {
635
502
  throw new CredentialOfferError(
@@ -640,57 +507,30 @@ async function validateCredentialOfferV1_3(options) {
640
507
  authCodeGrant.authorization_server,
641
508
  credentialIssuerMetadata?.authorization_servers
642
509
  );
510
+ }
511
+ async function validateCredentialOfferV1_3(options) {
512
+ validateBaseCredentialOffer({
513
+ credentialIssuerMetadata: options.credentialIssuerMetadata,
514
+ credentialOffer: options.credentialOffer,
515
+ versionLabel: "v1.3"
516
+ });
643
517
  if (!options.credentialOffer.grants.authorization_code.scope) {
644
518
  throw new CredentialOfferError("authorization_code.scope is REQUIRED");
645
519
  }
646
520
  }
647
521
  async function validateCredentialOfferV1_4(options) {
648
- const versionLabel = "v1.4";
649
- const { credentialIssuerMetadata, credentialOffer } = options;
650
- validateBaseCredentialOffer({ credentialOffer, versionLabel });
651
- const authCodeGrant = credentialOffer.grants.authorization_code;
652
- if (!authCodeGrant) {
653
- throw new CredentialOfferError(
654
- `authorization_code grant is REQUIRED for IT-Wallet ${versionLabel}`
655
- );
656
- }
657
- assertAuthorizationServerAllowed(
658
- authCodeGrant.authorization_server,
659
- credentialIssuerMetadata?.authorization_servers
660
- );
661
- }
662
- async function validateCredentialOfferAPTITUDE(options) {
663
- const versionLabel = "APTITUDE";
664
- const {
665
- credentialIssuerMetadata,
666
- credentialOffer,
667
- grantType = "authorization_code" /* AUTHORIZATION_CODE */
668
- } = options;
669
- validateBaseCredentialOffer({ credentialOffer, versionLabel });
670
- const grant = credentialOffer.grants[grantType];
671
- if (!grant) {
672
- throw new CredentialOfferError(
673
- `${grantType} grant as specified is REQUIRED for IT-Wallet ${versionLabel}`
674
- );
675
- }
676
- assertAuthorizationServerAllowed(
677
- grant.authorization_server,
678
- credentialIssuerMetadata?.authorization_servers
679
- );
522
+ validateBaseCredentialOffer({
523
+ credentialIssuerMetadata: options.credentialIssuerMetadata,
524
+ credentialOffer: options.credentialOffer,
525
+ versionLabel: "v1.4"
526
+ });
680
527
  }
681
528
  var dispatchValidateCredentialOffer = createVersionDispatcher2({
682
- [ItWalletSpecsVersion3.APTITUDE]: (o) => validateCredentialOfferAPTITUDE(
683
- o
684
- ),
685
529
  [ItWalletSpecsVersion3.V1_0]: () => {
686
530
  throw new ItWalletSpecsVersionError3(
687
531
  "validateCredentialOffer",
688
532
  ItWalletSpecsVersion3.V1_0,
689
- [
690
- ItWalletSpecsVersion3.V1_3,
691
- ItWalletSpecsVersion3.V1_4,
692
- ItWalletSpecsVersion3.APTITUDE
693
- ]
533
+ [ItWalletSpecsVersion3.V1_3, ItWalletSpecsVersion3.V1_4]
694
534
  );
695
535
  },
696
536
  [ItWalletSpecsVersion3.V1_3]: (o) => validateCredentialOfferV1_3(o),
@@ -714,18 +554,18 @@ import {
714
554
  } from "@pagopa/io-wallet-utils";
715
555
 
716
556
  // src/credential-request/v1.0/z-credential.ts
717
- import { z as z7 } from "zod";
557
+ import { z as z6 } from "zod";
718
558
 
719
559
  // src/credential-request/z-base-credential-request.ts
720
- import { z as z6 } from "zod";
721
- var zBaseCredentialRequest = z6.object({
722
- credential_configuration_id: z6.string().optional().describe(
560
+ import { z as z5 } from "zod";
561
+ var zBaseCredentialRequest = z5.object({
562
+ credential_configuration_id: z5.string().optional().describe(
723
563
  "REQUIRED if credential_identifier param is absent. MUST NOT be used otherwise."
724
564
  ),
725
- credential_identifier: z6.string().optional().describe(
565
+ credential_identifier: z5.string().optional().describe(
726
566
  "REQUIRED when Authorization Details of type openid_credential was returned. MUST NOT be used if credential_configuration_id is present."
727
567
  ),
728
- transaction_id: z6.string().optional().describe(
568
+ transaction_id: z5.string().optional().describe(
729
569
  "REQUIRED only in case of deferred flow. MUST NOT be present in immediate flow."
730
570
  )
731
571
  });
@@ -747,9 +587,9 @@ function credentialRequestRefiner(data, ctx) {
747
587
  }
748
588
 
749
589
  // src/credential-request/v1.0/z-credential.ts
750
- var zCredentialRequestProof = z7.object({
751
- jwt: z7.string().min(1, "JWT must not be empty"),
752
- proof_type: z7.literal("jwt")
590
+ var zCredentialRequestProof = z6.object({
591
+ jwt: z6.string().min(1, "JWT must not be empty"),
592
+ proof_type: z6.literal("jwt")
753
593
  // MUST be "jwt"
754
594
  });
755
595
  var zCredentialRequestV1_0 = zBaseCredentialRequest.extend({
@@ -804,10 +644,10 @@ import {
804
644
  } from "@pagopa/io-wallet-utils";
805
645
 
806
646
  // src/credential-request/v1.3/z-credential.ts
807
- import { z as z8 } from "zod";
808
- var zCredentialRequestProofJwt = z8.string().min(1, "JWT must not be empty in credential request proofs array");
809
- var zCredentialRequestProofs = z8.object({
810
- jwt: z8.tuple([zCredentialRequestProofJwt], zCredentialRequestProofJwt)
647
+ import { z as z7 } from "zod";
648
+ var zCredentialRequestProofJwt = z7.string().min(1, "JWT must not be empty in credential request proofs array");
649
+ var zCredentialRequestProofs = z7.object({
650
+ jwt: z7.tuple([zCredentialRequestProofJwt], zCredentialRequestProofJwt)
811
651
  });
812
652
  var zCredentialRequestV1_3 = zBaseCredentialRequest.extend({
813
653
  proofs: zCredentialRequestProofs.describe(
@@ -891,7 +731,6 @@ var createCredentialRequest2 = async (options) => {
891
731
 
892
732
  // src/credential-request/create-credential-request.ts
893
733
  var dispatchCreateCredentialRequest = createVersionDispatcher3({
894
- [ItWalletSpecsVersion6.APTITUDE]: (o) => createCredentialRequest2(o),
895
734
  [ItWalletSpecsVersion6.V1_0]: (o) => createCredentialRequest(o),
896
735
  [ItWalletSpecsVersion6.V1_3]: (o) => createCredentialRequest2(o),
897
736
  [ItWalletSpecsVersion6.V1_4]: (o) => (
@@ -921,21 +760,21 @@ import {
921
760
 
922
761
  // src/credential-request/z-proof-jwt.ts
923
762
  import { zJwk } from "@pagopa/io-wallet-utils";
924
- import { z as z9 } from "zod";
925
- var zBaseProofJwtHeader = z9.object({
926
- alg: z9.string().min(1),
763
+ import { z as z8 } from "zod";
764
+ var zBaseProofJwtHeader = z8.object({
765
+ alg: z8.string().min(1),
927
766
  jwk: zJwk,
928
- typ: z9.literal("openid4vci-proof+jwt")
767
+ typ: z8.literal("openid4vci-proof+jwt")
929
768
  });
930
769
  var zProofJwtHeaderV1_0 = zBaseProofJwtHeader.loose();
931
770
  var zProofJwtHeaderV1_3 = zBaseProofJwtHeader.extend({
932
- key_attestation: z9.string().min(1)
771
+ key_attestation: z8.string().min(1)
933
772
  }).loose();
934
- var zProofJwtPayload = z9.looseObject({
935
- aud: z9.string().min(1),
936
- iat: z9.number(),
937
- iss: z9.string().min(1).optional(),
938
- nonce: z9.string().min(1)
773
+ var zProofJwtPayload = z8.looseObject({
774
+ aud: z8.string().min(1),
775
+ iat: z8.number(),
776
+ iss: z8.string().min(1).optional(),
777
+ nonce: z8.string().min(1)
939
778
  });
940
779
 
941
780
  // src/credential-request/parse-credential-request.ts
@@ -1178,25 +1017,7 @@ function parseCredentialRequestV1_4(options) {
1178
1017
  // V1_4 reuses V1_3 proof schema
1179
1018
  });
1180
1019
  }
1181
- function parseCredentialRequestAPTITUDE(options) {
1182
- const credentialRequest = parseWithErrorHandling3(
1183
- zCredentialRequestV1_3,
1184
- options.credentialRequest,
1185
- "Invalid credential request format for ItWalletSpecsVersion APTITUDE"
1186
- );
1187
- return toResult({
1188
- accessToken: options.accessToken,
1189
- callbacks: options.callbacks,
1190
- credentialRequest,
1191
- dpopProof: options.dpopProof,
1192
- expected: options.expected,
1193
- grantType: options.grantType,
1194
- isDeferredFlow: options.isDeferredFlow,
1195
- itWalletSpecsVersion: ItWalletSpecsVersion7.APTITUDE
1196
- });
1197
- }
1198
1020
  var dispatchParseCredentialRequest = createVersionDispatcher4({
1199
- [ItWalletSpecsVersion7.APTITUDE]: parseCredentialRequestAPTITUDE,
1200
1021
  [ItWalletSpecsVersion7.V1_0]: parseCredentialRequestV1_0,
1201
1022
  [ItWalletSpecsVersion7.V1_3]: parseCredentialRequestV1_3,
1202
1023
  [ItWalletSpecsVersion7.V1_4]: parseCredentialRequestV1_4
@@ -1257,33 +1078,33 @@ import {
1257
1078
  zJwk as zJwk2,
1258
1079
  zTrustChain
1259
1080
  } from "@pagopa/io-wallet-utils";
1260
- import { z as z10 } from "zod";
1261
- var zStatusList = z10.object({
1262
- idx: z10.number(),
1263
- uri: z10.url()
1081
+ import { z as z9 } from "zod";
1082
+ var zStatusList = z9.object({
1083
+ idx: z9.number(),
1084
+ uri: z9.url()
1264
1085
  });
1265
- var zKeyAttestationStatus = z10.object({
1086
+ var zKeyAttestationStatus = z9.object({
1266
1087
  status_list: zStatusList
1267
1088
  });
1268
1089
  var zKeyAttestationAlg = zItwSupportedSignatureAlg;
1269
- var zKeyAttestationHeader = z10.object({
1090
+ var zKeyAttestationHeader = z9.object({
1270
1091
  alg: zKeyAttestationAlg,
1271
- kid: z10.string(),
1092
+ kid: z9.string(),
1272
1093
  trust_chain: zTrustChain.optional(),
1273
- typ: z10.literal("key-attestation+jwt"),
1094
+ typ: z9.literal("key-attestation+jwt"),
1274
1095
  x5c: zCertificateChain
1275
1096
  });
1276
- var zKeyAttestationPayload = z10.object({
1277
- attested_keys: z10.array(zJwk2).nonempty(),
1278
- certification: z10.string().optional(),
1279
- exp: z10.number(),
1280
- iat: z10.number(),
1281
- iss: z10.string(),
1282
- key_storage: z10.array(zKeyStorageLevelV1_3).nonempty(),
1097
+ var zKeyAttestationPayload = z9.object({
1098
+ attested_keys: z9.array(zJwk2).nonempty(),
1099
+ certification: z9.string().optional(),
1100
+ exp: z9.number(),
1101
+ iat: z9.number(),
1102
+ iss: z9.string(),
1103
+ key_storage: z9.array(zKeyStorageLevelV1_3).nonempty(),
1283
1104
  status: zKeyAttestationStatus,
1284
- user_authentication: z10.array(zKeyStorageLevelV1_3).nonempty()
1105
+ user_authentication: z9.array(zKeyStorageLevelV1_3).nonempty()
1285
1106
  });
1286
- var zKeyAttestationTypeHeader = z10.literal("key-attestation+jwt");
1107
+ var zKeyAttestationTypeHeader = z9.literal("key-attestation+jwt");
1287
1108
  var keyAttestationTypeHeader = zKeyAttestationTypeHeader.value;
1288
1109
 
1289
1110
  // src/credential-request/verify-key-attestation-jwt.ts
@@ -1434,7 +1255,6 @@ async function verifyProofV1_3(options) {
1434
1255
  return { header, keyAttestation: keyAttestationResult, payload, signer };
1435
1256
  }
1436
1257
  var dispatchVerifyProof = createVersionDispatcher5({
1437
- [ItWalletSpecsVersion8.APTITUDE]: (o) => verifyProofV1_3(o),
1438
1258
  [ItWalletSpecsVersion8.V1_0]: (o) => verifyProofV1_0(o),
1439
1259
  [ItWalletSpecsVersion8.V1_3]: (o) => verifyProofV1_3(o),
1440
1260
  [ItWalletSpecsVersion8.V1_4]: (o) => verifyProofV1_3(o)
@@ -1470,30 +1290,30 @@ import {
1470
1290
  import { parseWithErrorHandling as parseWithErrorHandling4 } from "@pagopa/io-wallet-utils";
1471
1291
 
1472
1292
  // src/credential-response/v1.0/z-credential-response.ts
1473
- import { z as z12 } from "zod";
1293
+ import { z as z11 } from "zod";
1474
1294
 
1475
1295
  // src/credential-response/z-immediate-credential-response.ts
1476
- import { z as z11 } from "zod";
1477
- var zCredentialObject = z11.object({
1478
- credential: z11.string()
1296
+ import { z as z10 } from "zod";
1297
+ var zCredentialObject = z10.object({
1298
+ credential: z10.string()
1479
1299
  });
1480
- var zImmediateCredentialResponse = z11.strictObject({
1481
- credentials: z11.array(zCredentialObject).nonempty().describe(
1300
+ var zImmediateCredentialResponse = z10.strictObject({
1301
+ credentials: z10.array(zCredentialObject).nonempty().describe(
1482
1302
  "Conditional. Array of issued Digital Credentials as JSON objects with `credential` member containing encoded credential string. Present for immediate issuance (HTTP 200)."
1483
1303
  ),
1484
- notification_id: z11.string().optional().describe(
1304
+ notification_id: z10.string().optional().describe(
1485
1305
  "OPTIONAL. Identifier for notification requests. Only present with credentials parameter."
1486
1306
  )
1487
1307
  });
1488
1308
 
1489
1309
  // src/credential-response/v1.0/z-credential-response.ts
1490
- var zDeferredCredentialResponseV1_0 = z12.strictObject({
1491
- lead_time: z12.number().int().positive().describe(
1310
+ var zDeferredCredentialResponseV1_0 = z11.strictObject({
1311
+ lead_time: z11.number().int().positive().describe(
1492
1312
  "REQUIRED if credentials is not present, otherwise it MUST NOT be present. The amount of time (in seconds) required before making a Deferred Credential Request."
1493
1313
  ),
1494
- transaction_id: z12.string().nonempty()
1314
+ transaction_id: z11.string().nonempty()
1495
1315
  });
1496
- var zCredentialResponseV1_0 = z12.union([
1316
+ var zCredentialResponseV1_0 = z11.union([
1497
1317
  zImmediateCredentialResponse,
1498
1318
  zDeferredCredentialResponseV1_0
1499
1319
  ]);
@@ -1526,14 +1346,14 @@ function createCredentialResponseV1_0(flow) {
1526
1346
  import { parseWithErrorHandling as parseWithErrorHandling5 } from "@pagopa/io-wallet-utils";
1527
1347
 
1528
1348
  // src/credential-response/v1.3/z-credential-response.ts
1529
- import { z as z13 } from "zod";
1530
- var zDeferredCredentialResponseV1_3 = z13.strictObject({
1531
- interval: z13.number().int().positive().describe(
1349
+ import { z as z12 } from "zod";
1350
+ var zDeferredCredentialResponseV1_3 = z12.strictObject({
1351
+ interval: z12.number().int().positive().describe(
1532
1352
  "REQUIRED if transaction_id is present, otherwise it MUST NOT be present. The amount of time (in seconds) required before making a Deferred Credential Request"
1533
1353
  ),
1534
- transaction_id: z13.string().nonempty()
1354
+ transaction_id: z12.string().nonempty()
1535
1355
  });
1536
- var zCredentialResponseV1_3 = z13.union([
1356
+ var zCredentialResponseV1_3 = z12.union([
1537
1357
  zImmediateCredentialResponse,
1538
1358
  zDeferredCredentialResponseV1_3
1539
1359
  ]);
@@ -1564,9 +1384,6 @@ function createCredentialResponseV1_3(flow) {
1564
1384
 
1565
1385
  // src/credential-response/create-credential-response.ts
1566
1386
  var dispatchBuildVersionedResponse = createVersionDispatcher6({
1567
- [ItWalletSpecsVersion9.APTITUDE]: (o) => createCredentialResponseV1_3(
1568
- o.flow
1569
- ),
1570
1387
  [ItWalletSpecsVersion9.V1_0]: (o) => createCredentialResponseV1_0(
1571
1388
  o.flow
1572
1389
  ),
@@ -1634,10 +1451,10 @@ import {
1634
1451
 
1635
1452
  // src/credential-response/z-credential-response.ts
1636
1453
  import { zAlgValueNotNone, zJwk as zJwk3 } from "@pagopa/io-wallet-utils";
1637
- import { z as z14 } from "zod";
1638
- var zCredentialResponseEncryption = z14.looseObject({
1454
+ import { z as z13 } from "zod";
1455
+ var zCredentialResponseEncryption = z13.looseObject({
1639
1456
  alg: zAlgValueNotNone,
1640
- enc: z14.string(),
1457
+ enc: z13.string(),
1641
1458
  jwk: zJwk3
1642
1459
  });
1643
1460
 
@@ -1694,7 +1511,7 @@ import {
1694
1511
  hasStatusOrThrow as hasStatusOrThrow4,
1695
1512
  parseWithErrorHandling as parseWithErrorHandling7
1696
1513
  } from "@pagopa/io-wallet-utils";
1697
- import z16 from "zod";
1514
+ import z15 from "zod";
1698
1515
 
1699
1516
  // src/metadata/z-metadata-response.ts
1700
1517
  import {
@@ -1703,33 +1520,33 @@ import {
1703
1520
  itWalletMetadataV1_3,
1704
1521
  itWalletMetadataV1_4
1705
1522
  } from "@pagopa/io-wallet-oid-federation";
1706
- import { z as z15 } from "zod";
1707
- var zMetadataResponseV1_0 = z15.object({
1708
- discoveredVia: z15.enum(["federation"]),
1523
+ import { z as z14 } from "zod";
1524
+ var zMetadataResponseV1_0 = z14.object({
1525
+ discoveredVia: z14.enum(["federation"]),
1709
1526
  metadata: itWalletMetadataV1_0,
1710
1527
  openid_federation_claims: itWalletEntityStatementClaimsSchema
1711
1528
  });
1712
- var zMetadataResponseV1_3 = z15.object({
1529
+ var zMetadataResponseV1_3 = z14.object({
1713
1530
  /**
1714
1531
  * Entity statement claims of the Authorization Server, present only when the
1715
1532
  * selected authorization server was resolved through a federation entity
1716
1533
  * distinct from the Credential Issuer.
1717
1534
  */
1718
1535
  authorization_server_federation_claims: itWalletEntityStatementClaimsSchema.optional(),
1719
- discoveredVia: z15.enum(["federation", "oid4vci"]),
1536
+ discoveredVia: z14.enum(["federation", "oid4vci"]),
1720
1537
  metadata: itWalletMetadataV1_3,
1721
1538
  openid_federation_claims: itWalletEntityStatementClaimsSchema.optional()
1722
1539
  });
1723
1540
  var zMetadataResponseV1_4 = zMetadataResponseV1_3.extend({
1724
1541
  metadata: itWalletMetadataV1_4
1725
1542
  });
1726
- var zMetadataResponse = z15.union([
1543
+ var zMetadataResponse = z14.union([
1727
1544
  zMetadataResponseV1_0,
1728
1545
  zMetadataResponseV1_3,
1729
1546
  zMetadataResponseV1_4
1730
1547
  ]);
1731
- var zPartialIssuerMetadata = z15.looseObject({
1732
- authorization_servers: z15.tuple([z15.url()], z15.url()).optional()
1548
+ var zPartialIssuerMetadata = z14.looseObject({
1549
+ authorization_servers: z14.tuple([z14.url()], z14.url()).optional()
1733
1550
  });
1734
1551
 
1735
1552
  // src/metadata/fetch-metadata.ts
@@ -1796,7 +1613,7 @@ async function applyFederationAuthorizationServerSelection(fetch, federationResu
1796
1613
  if (!selectedAuthorizationServer || selectedAuthorizationServer === credentialIssuer) {
1797
1614
  return federationResult;
1798
1615
  }
1799
- const parsedSelectedAuthorizationServer = z16.url().safeParse(selectedAuthorizationServer);
1616
+ const parsedSelectedAuthorizationServer = z15.url().safeParse(selectedAuthorizationServer);
1800
1617
  if (!parsedSelectedAuthorizationServer.success || !parsedSelectedAuthorizationServer.data.startsWith("https://")) {
1801
1618
  throw new ValidationError9(
1802
1619
  "selected authorization server is not a valid HTTPS URL"
@@ -1834,7 +1651,7 @@ async function fallbackDiscovery(fetch, baseUrl, authorizationServer) {
1834
1651
  let oauthAuthorizationServer;
1835
1652
  if (authorizationServers && authorizationServers.length > 0) {
1836
1653
  const selectedAuthorizationServer = authorizationServer ?? authorizationServers[0];
1837
- const parsedUrl = z16.url().safeParse(selectedAuthorizationServer);
1654
+ const parsedUrl = z15.url().safeParse(selectedAuthorizationServer);
1838
1655
  if (!parsedUrl.success || !parsedUrl.data.startsWith("https://")) {
1839
1656
  throw new ValidationError9(
1840
1657
  "selected authorization server is not a valid HTTPS URL"
@@ -1912,14 +1729,13 @@ async function fetchMetadataV1_4(options) {
1912
1729
  );
1913
1730
  }
1914
1731
  var dispatchFetchMetadata = createVersionDispatcher7({
1915
- [ItWalletSpecsVersion10.APTITUDE]: (o) => fetchMetadataV1_4(o),
1916
1732
  [ItWalletSpecsVersion10.V1_0]: (o) => fetchMetadataV1_0(o),
1917
1733
  [ItWalletSpecsVersion10.V1_3]: (o) => fetchMetadataV1_3(o),
1918
1734
  [ItWalletSpecsVersion10.V1_4]: (o) => fetchMetadataV1_4(o)
1919
1735
  });
1920
1736
  async function fetchMetadata(options) {
1921
1737
  try {
1922
- const urlValidation = z16.url().safeParse(options.credentialIssuerUrl);
1738
+ const urlValidation = z15.url().safeParse(options.credentialIssuerUrl);
1923
1739
  if (!urlValidation.success || !urlValidation.data.startsWith("https://")) {
1924
1740
  throw new ValidationError9(
1925
1741
  "credentialIssuerUrl must be a valid HTTPS URL"
@@ -2080,7 +1896,7 @@ var WalletProvider = class {
2080
1896
  * status: { status_list: { idx: 2, uri: "https://status.example.com" } } // Optional
2081
1897
  * });
2082
1898
  *
2083
- * @example v1.4, APTITUDE - Wallet attestation with required wallet_link and wallet_name
1899
+ * @example v1.4 - Wallet attestation with required wallet_link and wallet_name
2084
1900
  * const jwt = await provider.createItWalletAttestationJwt({
2085
1901
  * callbacks: { hash: myHashCallback, signJwt: mySignJwtCallback },
2086
1902
  * dpopJwkPublic: myJwk,
@@ -2099,18 +1915,6 @@ var WalletProvider = class {
2099
1915
  */
2100
1916
  async createItWalletAttestationJwt(options) {
2101
1917
  return dispatchByVersion(this.specVersion, {
2102
- [ItWalletSpecsVersion11.APTITUDE]: () => {
2103
- assertV1_4Options(options);
2104
- return createWalletAttestationJwtV1_4({
2105
- callbacks: options.callbacks,
2106
- dpopJwkPublic: options.dpopJwkPublic,
2107
- expiresAt: options.expiresAt,
2108
- issuer: options.issuer,
2109
- signer: options.signer,
2110
- walletLink: options.walletLink,
2111
- walletName: options.walletName
2112
- });
2113
- },
2114
1918
  [ItWalletSpecsVersion11.V1_0]: () => {
2115
1919
  assertV1_0Options(options);
2116
1920
  return createWalletAttestationJwtV1_0({
@@ -2154,7 +1958,6 @@ var WalletProvider = class {
2154
1958
  }
2155
1959
  };
2156
1960
  export {
2157
- CREDENTIAL_OFFER_GRANTS,
2158
1961
  CreateCredentialResponseError,
2159
1962
  CredentialAuthorizationHeaderError,
2160
1963
  CredentialOfferError,