@pagopa/io-react-native-wallet 3.4.2 → 3.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/lib/commonjs/credential/issuance/api/IssuerConfig.js +6 -0
  2. package/lib/commonjs/credential/issuance/api/IssuerConfig.js.map +1 -1
  3. package/lib/commonjs/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js +1 -0
  4. package/lib/commonjs/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js.map +1 -1
  5. package/lib/commonjs/credential/issuance/v1.3.3/02-start-user-authorization.js +8 -1
  6. package/lib/commonjs/credential/issuance/v1.3.3/02-start-user-authorization.js.map +1 -1
  7. package/lib/commonjs/credential/issuance/v1.3.3/mappers.js +14 -6
  8. package/lib/commonjs/credential/issuance/v1.3.3/mappers.js.map +1 -1
  9. package/lib/commonjs/credential/offer/api/03-validate-credential-offer.js +6 -0
  10. package/lib/commonjs/credential/offer/api/03-validate-credential-offer.js.map +1 -0
  11. package/lib/commonjs/credential/offer/api/index.js.map +1 -1
  12. package/lib/commonjs/credential/offer/v1.0.0/index.js +3 -0
  13. package/lib/commonjs/credential/offer/v1.0.0/index.js.map +1 -1
  14. package/lib/commonjs/credential/offer/v1.3.3/01-resolve-credential-offer.js +7 -21
  15. package/lib/commonjs/credential/offer/v1.3.3/01-resolve-credential-offer.js.map +1 -1
  16. package/lib/commonjs/credential/offer/v1.3.3/02-extract-grant-details.js +5 -1
  17. package/lib/commonjs/credential/offer/v1.3.3/02-extract-grant-details.js.map +1 -1
  18. package/lib/commonjs/credential/offer/v1.3.3/03-validate-credential-offer.js +39 -0
  19. package/lib/commonjs/credential/offer/v1.3.3/03-validate-credential-offer.js.map +1 -0
  20. package/lib/commonjs/credential/offer/v1.3.3/index.js +3 -1
  21. package/lib/commonjs/credential/offer/v1.3.3/index.js.map +1 -1
  22. package/lib/commonjs/credentials-catalogue/v1.3.3/types.js +2 -2
  23. package/lib/commonjs/credentials-catalogue/v1.3.3/types.js.map +1 -1
  24. package/lib/commonjs/wallet-instance-attestation/v1.3.3/types.js +2 -1
  25. package/lib/commonjs/wallet-instance-attestation/v1.3.3/types.js.map +1 -1
  26. package/lib/module/credential/issuance/api/IssuerConfig.js +6 -0
  27. package/lib/module/credential/issuance/api/IssuerConfig.js.map +1 -1
  28. package/lib/module/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js +1 -0
  29. package/lib/module/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js.map +1 -1
  30. package/lib/module/credential/issuance/v1.3.3/02-start-user-authorization.js +8 -1
  31. package/lib/module/credential/issuance/v1.3.3/02-start-user-authorization.js.map +1 -1
  32. package/lib/module/credential/issuance/v1.3.3/mappers.js +14 -6
  33. package/lib/module/credential/issuance/v1.3.3/mappers.js.map +1 -1
  34. package/lib/module/credential/offer/api/03-validate-credential-offer.js +2 -0
  35. package/lib/module/credential/offer/api/03-validate-credential-offer.js.map +1 -0
  36. package/lib/module/credential/offer/api/index.js.map +1 -1
  37. package/lib/module/credential/offer/v1.0.0/index.js +3 -0
  38. package/lib/module/credential/offer/v1.0.0/index.js.map +1 -1
  39. package/lib/module/credential/offer/v1.3.3/01-resolve-credential-offer.js +10 -23
  40. package/lib/module/credential/offer/v1.3.3/01-resolve-credential-offer.js.map +1 -1
  41. package/lib/module/credential/offer/v1.3.3/02-extract-grant-details.js +6 -1
  42. package/lib/module/credential/offer/v1.3.3/02-extract-grant-details.js.map +1 -1
  43. package/lib/module/credential/offer/v1.3.3/03-validate-credential-offer.js +33 -0
  44. package/lib/module/credential/offer/v1.3.3/03-validate-credential-offer.js.map +1 -0
  45. package/lib/module/credential/offer/v1.3.3/index.js +3 -1
  46. package/lib/module/credential/offer/v1.3.3/index.js.map +1 -1
  47. package/lib/module/credentials-catalogue/v1.3.3/types.js +2 -2
  48. package/lib/module/credentials-catalogue/v1.3.3/types.js.map +1 -1
  49. package/lib/module/wallet-instance-attestation/v1.3.3/types.js +2 -1
  50. package/lib/module/wallet-instance-attestation/v1.3.3/types.js.map +1 -1
  51. package/lib/typescript/credential/issuance/api/01-evaluate-issuer-trust.d.ts +4 -0
  52. package/lib/typescript/credential/issuance/api/01-evaluate-issuer-trust.d.ts.map +1 -1
  53. package/lib/typescript/credential/issuance/api/02-start-user-authorization.d.ts +4 -0
  54. package/lib/typescript/credential/issuance/api/02-start-user-authorization.d.ts.map +1 -1
  55. package/lib/typescript/credential/issuance/api/IssuerConfig.d.ts +1 -0
  56. package/lib/typescript/credential/issuance/api/IssuerConfig.d.ts.map +1 -1
  57. package/lib/typescript/credential/issuance/v1.0.0/mappers.d.ts +1 -0
  58. package/lib/typescript/credential/issuance/v1.0.0/mappers.d.ts.map +1 -1
  59. package/lib/typescript/credential/issuance/v1.3.3/01-evaluate-issuer-trust.d.ts.map +1 -1
  60. package/lib/typescript/credential/issuance/v1.3.3/02-start-user-authorization.d.ts.map +1 -1
  61. package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts +490 -4
  62. package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts.map +1 -1
  63. package/lib/typescript/credential/offer/api/02-extract-grant-details.d.ts +1 -1
  64. package/lib/typescript/credential/offer/api/03-validate-credential-offer.d.ts +19 -0
  65. package/lib/typescript/credential/offer/api/03-validate-credential-offer.d.ts.map +1 -0
  66. package/lib/typescript/credential/offer/api/index.d.ts +2 -1
  67. package/lib/typescript/credential/offer/api/index.d.ts.map +1 -1
  68. package/lib/typescript/credential/offer/v1.0.0/index.d.ts.map +1 -1
  69. package/lib/typescript/credential/offer/v1.3.3/01-resolve-credential-offer.d.ts +5 -11
  70. package/lib/typescript/credential/offer/v1.3.3/01-resolve-credential-offer.d.ts.map +1 -1
  71. package/lib/typescript/credential/offer/v1.3.3/02-extract-grant-details.d.ts.map +1 -1
  72. package/lib/typescript/credential/offer/v1.3.3/03-validate-credential-offer.d.ts +15 -0
  73. package/lib/typescript/credential/offer/v1.3.3/03-validate-credential-offer.d.ts.map +1 -0
  74. package/lib/typescript/credential/offer/v1.3.3/index.d.ts.map +1 -1
  75. package/lib/typescript/credentials-catalogue/v1.3.3/mappers.d.ts +2 -2
  76. package/lib/typescript/credentials-catalogue/v1.3.3/types.d.ts +4 -4
  77. package/lib/typescript/trust/v1.3.3/types.d.ts +2 -2
  78. package/lib/typescript/wallet-instance-attestation/v1.3.3/mappers.d.ts +1 -0
  79. package/lib/typescript/wallet-instance-attestation/v1.3.3/mappers.d.ts.map +1 -1
  80. package/lib/typescript/wallet-instance-attestation/v1.3.3/types.d.ts +1 -0
  81. package/lib/typescript/wallet-instance-attestation/v1.3.3/types.d.ts.map +1 -1
  82. package/package.json +6 -6
  83. package/src/credential/issuance/api/01-evaluate-issuer-trust.ts +4 -1
  84. package/src/credential/issuance/api/02-start-user-authorization.ts +4 -0
  85. package/src/credential/issuance/api/IssuerConfig.ts +6 -0
  86. package/src/credential/issuance/v1.3.3/01-evaluate-issuer-trust.ts +1 -0
  87. package/src/credential/issuance/v1.3.3/02-start-user-authorization.ts +7 -0
  88. package/src/credential/issuance/v1.3.3/mappers.ts +15 -5
  89. package/src/credential/offer/api/02-extract-grant-details.ts +1 -1
  90. package/src/credential/offer/api/03-validate-credential-offer.ts +19 -0
  91. package/src/credential/offer/api/index.ts +3 -1
  92. package/src/credential/offer/v1.0.0/index.ts +3 -0
  93. package/src/credential/offer/v1.3.3/01-resolve-credential-offer.ts +8 -26
  94. package/src/credential/offer/v1.3.3/02-extract-grant-details.ts +6 -1
  95. package/src/credential/offer/v1.3.3/03-validate-credential-offer.ts +33 -0
  96. package/src/credential/offer/v1.3.3/index.ts +2 -0
  97. package/src/credentials-catalogue/v1.3.3/types.ts +2 -2
  98. package/src/wallet-instance-attestation/v1.3.3/types.ts +1 -0
@@ -0,0 +1,15 @@
1
+ import type { OfferApi } from "../api";
2
+ /**
3
+ * v1.3.3 implementation — validates a resolved Credential Offer against the
4
+ * Credential Issuer metadata (IT-Wallet spec, Section 12.1.2).
5
+ *
6
+ * Performs the IT-Wallet v1.3 structural checks on the offer and, when the
7
+ * Credential Issuer relies on multiple Authorization Servers, ensures the
8
+ * `authorization_server` selected by the offer matches one of the advertised
9
+ * `authorization_servers`.
10
+ *
11
+ * Delegates to the SDK's {@link sdkValidateCredentialOffer}; validation errors
12
+ * are mapped to {@link InvalidCredentialOfferError}.
13
+ */
14
+ export declare const validateCredentialOffer: OfferApi["validateCredentialOffer"];
15
+ //# sourceMappingURL=03-validate-credential-offer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"03-validate-credential-offer.d.ts","sourceRoot":"","sources":["../../../../../src/credential/offer/v1.3.3/03-validate-credential-offer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGvC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,yBAAyB,CAYrE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/credential/offer/v1.3.3/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAIvC,eAAO,MAAM,KAAK,EAAE,QAGnB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/credential/offer/v1.3.3/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAKvC,eAAO,MAAM,KAAK,EAAE,QAInB,CAAC"}
@@ -130,10 +130,10 @@ export declare const mapToCredentialsCatalogue: (input: [{
130
130
  mandatory: boolean;
131
131
  }[];
132
132
  data_origin_l10n_id: string;
133
- integration_endpoint: string;
134
133
  integration_method: string;
135
- user_information_l10n_id: string;
136
134
  domains?: string[] | undefined;
135
+ integration_endpoint?: string | undefined;
136
+ user_information_l10n_id?: string | undefined;
137
137
  api_specification?: string | undefined;
138
138
  background_color?: string | undefined;
139
139
  contacts?: string[] | undefined;
@@ -27,9 +27,9 @@ export declare const AuthenticSource: z.ZodObject<{
27
27
  }, z.core.$strip>>;
28
28
  domains: z.ZodOptional<z.ZodArray<z.ZodString>>;
29
29
  data_origin_l10n_id: z.ZodString;
30
- integration_endpoint: z.ZodString;
30
+ integration_endpoint: z.ZodOptional<z.ZodString>;
31
31
  integration_method: z.ZodString;
32
- user_information_l10n_id: z.ZodString;
32
+ user_information_l10n_id: z.ZodOptional<z.ZodString>;
33
33
  api_specification: z.ZodOptional<z.ZodString>;
34
34
  background_color: z.ZodOptional<z.ZodString>;
35
35
  contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -183,9 +183,9 @@ export declare const AuthenticSourceRegistry: z.ZodObject<{
183
183
  }, z.core.$strip>>;
184
184
  domains: z.ZodOptional<z.ZodArray<z.ZodString>>;
185
185
  data_origin_l10n_id: z.ZodString;
186
- integration_endpoint: z.ZodString;
186
+ integration_endpoint: z.ZodOptional<z.ZodString>;
187
187
  integration_method: z.ZodString;
188
- user_information_l10n_id: z.ZodString;
188
+ user_information_l10n_id: z.ZodOptional<z.ZodString>;
189
189
  api_specification: z.ZodOptional<z.ZodString>;
190
190
  background_color: z.ZodOptional<z.ZodString>;
191
191
  contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -92,7 +92,7 @@ export declare const CredentialIssuerEntityConfiguration: z.ZodIntersection<z.Zo
92
92
  }, z.core.$strip>;
93
93
  metadata: z.ZodObject<{
94
94
  openid_credential_issuer: z.ZodObject<{
95
- authorization_servers: z.ZodOptional<z.ZodArray<z.ZodURL>>;
95
+ authorization_servers: z.ZodOptional<z.ZodTuple<[z.ZodURL], z.ZodURL>>;
96
96
  batch_credential_issuance: z.ZodOptional<z.ZodObject<{
97
97
  batch_size: z.ZodNumber;
98
98
  }, z.core.$strip>>;
@@ -657,7 +657,7 @@ export declare const EntityConfiguration: z.ZodUnion<readonly [z.ZodIntersection
657
657
  }, z.core.$strip>;
658
658
  metadata: z.ZodObject<{
659
659
  openid_credential_issuer: z.ZodObject<{
660
- authorization_servers: z.ZodOptional<z.ZodArray<z.ZodURL>>;
660
+ authorization_servers: z.ZodOptional<z.ZodTuple<[z.ZodURL], z.ZodURL>>;
661
661
  batch_credential_issuance: z.ZodOptional<z.ZodObject<{
662
662
  batch_size: z.ZodNumber;
663
663
  }, z.core.$strip>>;
@@ -7,6 +7,7 @@ export declare const mapToDecodedWalletInstanceAttestation: (input: {
7
7
  trust_chain?: string[] | undefined;
8
8
  } & {
9
9
  typ: "oauth-client-attestation+jwt";
10
+ x5c: string[];
10
11
  };
11
12
  payload: {
12
13
  iss: string;
@@ -1 +1 @@
1
- {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../../../../src/wallet-instance-attestation/v1.3.3/mappers.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKhD,CAAC"}
1
+ {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../../../../src/wallet-instance-attestation/v1.3.3/mappers.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKhD,CAAC"}
@@ -9,6 +9,7 @@ export declare const WalletInstanceAttestationJwt: z.ZodObject<{
9
9
  trust_chain: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
10
  }, z.core.$strip>, z.ZodObject<{
11
11
  typ: z.ZodLiteral<"oauth-client-attestation+jwt">;
12
+ x5c: z.ZodArray<z.ZodString>;
12
13
  }, z.core.$strip>>;
13
14
  payload: z.ZodIntersection<z.ZodObject<{
14
15
  iss: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/wallet-instance-attestation/v1.3.3/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,4BAA4B,CACpC,CAAC;AACF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAevC,CAAC;AAEH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,iCAAiC,CACzC,CAAC;AACF,eAAO,MAAM,iCAAiC;;iBAE5C,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/wallet-instance-attestation/v1.3.3/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,4BAA4B,CACpC,CAAC;AACF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgBvC,CAAC;AAEH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,iCAAiC,CACzC,CAAC;AACF,eAAO,MAAM,iCAAiC;;iBAE5C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-react-native-wallet",
3
- "version": "3.4.2",
3
+ "version": "3.4.4",
4
4
  "description": "Provide data structures, helpers and API for IO Wallet",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -140,11 +140,11 @@
140
140
  ]
141
141
  },
142
142
  "dependencies": {
143
- "@pagopa/io-wallet-oauth2": "1.4.2",
144
- "@pagopa/io-wallet-oid-federation": "1.4.2",
145
- "@pagopa/io-wallet-oid4vci": "1.4.2",
146
- "@pagopa/io-wallet-oid4vp": "1.4.2",
147
- "@pagopa/io-wallet-utils": "1.4.2",
143
+ "@pagopa/io-wallet-oauth2": "1.5.2",
144
+ "@pagopa/io-wallet-oid-federation": "1.5.2",
145
+ "@pagopa/io-wallet-oid4vci": "1.5.2",
146
+ "@pagopa/io-wallet-oid4vp": "1.5.2",
147
+ "@pagopa/io-wallet-utils": "1.5.2",
148
148
  "@sd-jwt/core": "^0.19.0",
149
149
  "@sd-jwt/crypto-nodejs": "^0.19.0",
150
150
  "@sd-jwt/jwt-status-list": "^0.19.0",
@@ -8,10 +8,13 @@ export interface EvaluateIssuerTrustApi {
8
8
  *
9
9
  * @param issuerUrl The base url of the Issuer
10
10
  * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
11
+ * @param context.authorizationServer (optional) Authorization Server URL selected
12
+ * from a credential offer. When provided it must match one of the Credential
13
+ * Issuer metadata `authorization_servers`. Only honored from v1.3.3 onwards.
11
14
  * @returns The Issuer's configuration
12
15
  */
13
16
  evaluateIssuerTrust(
14
17
  issuerUrl: string,
15
- ctx?: { appFetch?: GlobalFetch["fetch"] }
18
+ ctx?: { appFetch?: GlobalFetch["fetch"]; authorizationServer?: string }
16
19
  ): Promise<{ issuerConf: IssuerConfig }>;
17
20
  }
@@ -27,6 +27,8 @@ export interface StartUserAuthorizationApi {
27
27
  * @param context.walletInstanceAttestation: the Wallet Instance's attestation
28
28
  * @param context.redirectUri: the redirect URI
29
29
  * @param context.appFetch: (optional) the fetch implementation
30
+ * @param context.scope: (optional) the OAuth 2.0 scope, forwarded to the PAR. When the issuance is started from a Credential Offer, it comes from the `authorization_code` grant.
31
+ * @param context.issuerState: (optional) the issuer state, forwarded to the PAR to correlate the authorization request with the Credential Offer.
30
32
  * @returns The URI to which the end user should be redirected to start the authentication flow, along with additional authentication parameters
31
33
  */
32
34
  startUserAuthorization(
@@ -40,6 +42,8 @@ export interface StartUserAuthorizationApi {
40
42
  walletInstanceAttestation: string;
41
43
  redirectUri: string;
42
44
  appFetch?: GlobalFetch["fetch"];
45
+ scope?: string;
46
+ issuerState?: string;
43
47
  }
44
48
  ): Promise<{
45
49
  issuerRequestUri: string;
@@ -50,6 +50,12 @@ const CredentialConfig = z.intersection(
50
50
  export type IssuerConfig = z.infer<typeof IssuerConfig>;
51
51
  export const IssuerConfig = z.object({
52
52
  credential_issuer: z.string(),
53
+ /**
54
+ * Authorization Servers advertised by the Credential Issuer. Present when the
55
+ * Issuer relies on one or more external Authorization Servers; used to validate
56
+ * the `authorization_server` selected by a credential offer.
57
+ */
58
+ authorization_servers: z.tuple([z.string()], z.string()).optional(),
53
59
  pushed_authorization_request_endpoint: z.string(),
54
60
  authorization_endpoint: z.string(),
55
61
  token_endpoint: z.string(),
@@ -13,6 +13,7 @@ export const evaluateIssuerTrust: IssuanceApi["evaluateIssuerTrust"] = async (
13
13
  const issuerMetadata = (await fetchMetadata({
14
14
  config: sdkConfigV1_3,
15
15
  credentialIssuerUrl: issuerUrl,
16
+ authorizationServer: context.authorizationServer,
16
17
  callbacks: {
17
18
  fetch: context.appFetch,
18
19
  },
@@ -22,6 +22,8 @@ export const startUserAuthorization: IssuanceApi["startUserAuthorization"] =
22
22
  walletInstanceAttestation,
23
23
  redirectUri,
24
24
  appFetch = fetch,
25
+ scope,
26
+ issuerState,
25
27
  } = ctx;
26
28
 
27
29
  const clientId = await wiaCryptoContext.getPublicKey().then((_) => _.kid);
@@ -76,6 +78,11 @@ export const startUserAuthorization: IssuanceApi["startUserAuthorization"] =
76
78
  authorization_details: credentialDefinition,
77
79
  codeChallengeMethodsSupported: ["S256"],
78
80
  redirectUri,
81
+ // When the issuance is started from a Credential Offer, the `scope` and
82
+ // `issuer_state` carried by the authorization_code grant are forwarded to
83
+ // the PAR. They are `undefined` (and thus omitted) for the regular flow.
84
+ scope,
85
+ issuerState,
79
86
  dpop: {
80
87
  signer: wiaSigner,
81
88
  },
@@ -45,8 +45,17 @@ export const mapToIssuerConfig = createMapper<
45
45
  federation_entity,
46
46
  } = x.metadata;
47
47
 
48
+ // The Issuer's own `oauth_authorization_server` always describes the Issuer
49
+ // itself. When a credential offer selected a *different* Authorization
50
+ // Server, its metadata is surfaced separately through that server's
51
+ // federation claims, and the Authorization Server endpoints must be taken
52
+ // from there. Fall back to the Issuer's own server otherwise.
53
+ const oauthAuthorizationServer =
54
+ x.authorization_server_federation_claims?.metadata
55
+ ?.oauth_authorization_server ?? oauth_authorization_server;
56
+
48
57
  assert(
49
- oauth_authorization_server,
58
+ oauthAuthorizationServer,
50
59
  "oauth_authorization_server is required in Issuer metadata"
51
60
  );
52
61
  assert(
@@ -55,19 +64,20 @@ export const mapToIssuerConfig = createMapper<
55
64
  );
56
65
 
57
66
  return {
58
- authorization_endpoint: oauth_authorization_server.authorization_endpoint,
67
+ authorization_endpoint: oauthAuthorizationServer.authorization_endpoint,
59
68
  credential_endpoint: openid_credential_issuer.credential_endpoint,
60
69
  credential_issuer: openid_credential_issuer.credential_issuer,
70
+ authorization_servers: openid_credential_issuer.authorization_servers,
61
71
  credential_configurations_supported: mapCredentialConfigurationsSupported(
62
72
  openid_credential_issuer
63
73
  ),
64
74
  keys: [
65
75
  ...openid_credential_issuer.jwks.keys,
66
- ...oauth_authorization_server.jwks.keys,
76
+ ...oauthAuthorizationServer.jwks.keys,
67
77
  ] as JWK[],
68
78
  pushed_authorization_request_endpoint:
69
- oauth_authorization_server.pushed_authorization_request_endpoint,
70
- token_endpoint: oauth_authorization_server.token_endpoint,
79
+ oauthAuthorizationServer.pushed_authorization_request_endpoint,
80
+ token_endpoint: oauthAuthorizationServer.token_endpoint,
71
81
  nonce_endpoint: openid_credential_issuer.nonce_endpoint ?? "",
72
82
  federation_entity: federation_entity ?? {},
73
83
  credential_issuance_batch_size:
@@ -4,7 +4,7 @@ export interface ExtractGrantDetailsApi {
4
4
  /**
5
5
  * Extract grant details from a resolved Credential Offer.
6
6
  *
7
- * @param offer - A previously resolved {@link CredentialOffer}.
7
+ * @param offer - A previously resolved Credential Offer.
8
8
  * @returns The extracted {@link ExtractGrantDetailsResult} containing
9
9
  * the grant type and its parameters.
10
10
  * @throws {InvalidCredentialOfferError} If no supported grant type is found.
@@ -0,0 +1,19 @@
1
+ import type { ValidateCredentialOfferOptions } from "@pagopa/io-wallet-oid4vci";
2
+ import type { CredentialOffer } from "./types";
3
+
4
+ export interface ValidateCredentialOfferApi {
5
+ /**
6
+ * Validate a resolved Credential Offer against the Credential Issuer metadata.
7
+ *
8
+ * @param options.offer - A previously resolved Credential Offer.
9
+ * @param options.credentialIssuerMetadata - The Credential Issuer metadata used
10
+ * to cross-check the offer (e.g. the `authorization_server` selected by the
11
+ * offer against the advertised `authorization_servers`).
12
+ * @returns A promise that resolves when the Credential Offer is valid.
13
+ * @throws {InvalidCredentialOfferError} If the Credential Offer fails validation.
14
+ */
15
+ validateCredentialOffer(options: {
16
+ offer: CredentialOffer;
17
+ credentialIssuerMetadata: ValidateCredentialOfferOptions["credentialIssuerMetadata"];
18
+ }): Promise<void>;
19
+ }
@@ -1,8 +1,10 @@
1
1
  import type { ResolveCredentialOfferApi } from "./01-resolve-credential-offer";
2
2
  import type { ExtractGrantDetailsApi } from "./02-extract-grant-details";
3
+ import type { ValidateCredentialOfferApi } from "./03-validate-credential-offer";
3
4
 
4
5
  export interface OfferApi
5
6
  extends ResolveCredentialOfferApi,
6
- ExtractGrantDetailsApi {}
7
+ ExtractGrantDetailsApi,
8
+ ValidateCredentialOfferApi {}
7
9
 
8
10
  export * from "./types";
@@ -8,4 +8,7 @@ export const Offer: OfferApi = {
8
8
  extractGrantDetails() {
9
9
  throw new UnimplementedFeatureError("extractGrantDetails", "1.0.0");
10
10
  },
11
+ validateCredentialOffer() {
12
+ throw new UnimplementedFeatureError("validateCredentialOffer", "1.0.0");
13
+ },
11
14
  };
@@ -1,35 +1,26 @@
1
1
  import {
2
2
  resolveCredentialOffer as sdkResolveCredentialOffer,
3
- validateCredentialOffer,
4
3
  CredentialOfferError,
5
4
  } from "@pagopa/io-wallet-oid4vci";
6
- import {
7
- InvalidQRCodeError,
8
- InvalidCredentialOfferError,
9
- } from "../common/errors";
5
+ import { InvalidQRCodeError } from "../common/errors";
10
6
  import type { OfferApi } from "../api";
7
+ import { sdkConfigV1_3 } from "../../../utils/config";
11
8
 
12
9
  /**
13
10
  * v1.3.3 implementation — first step of the User Request Flow
14
11
  * (IT-Wallet spec, Section 12.1.2).
15
12
  *
16
13
  * Delegates to the SDK's {@link sdkResolveCredentialOffer} for URI parsing
17
- * and by-reference fetching, then to {@link validateCredentialOffer} for
18
- * IT-Wallet v1.3 structural checks:
19
- * - `credential_issuer` must be an HTTPS URL
20
- * - `grants` object is required
21
- * - `authorization_code` grant is required
22
- * - `scope` is required within `authorization_code`
14
+ * and by-reference fetching of the Credential Offer.
23
15
  *
24
16
  * Supported URI schemes: `openid-credential-offer://`, `haip-vci://`, `https://`.
25
17
  *
26
- * Cross-validation against Credential Issuer metadata (e.g. matching
27
- * `credential_configuration_ids` or `authorization_server`) is **not** performed
28
- * here; per the spec it belongs to the Issuance Flow.
18
+ * Structural validation and cross-validation against the Credential Issuer
19
+ * metadata are **not** performed here; they belong to the dedicated
20
+ * validate-credential-offer step of the flow.
29
21
  *
30
22
  * Resolution errors (bad scheme, missing params, network failure) are mapped
31
- * to {@link InvalidQRCodeError}; validation errors are mapped to
32
- * {@link InvalidCredentialOfferError}.
23
+ * to {@link InvalidQRCodeError}.
33
24
  */
34
25
  export const resolveCredentialOffer: OfferApi["resolveCredentialOffer"] =
35
26
  async (credentialOffer, callbacks = {}) => {
@@ -37,6 +28,7 @@ export const resolveCredentialOffer: OfferApi["resolveCredentialOffer"] =
37
28
 
38
29
  // Parse the URI and fetch the offer when transmitted by reference
39
30
  const resolved = await sdkResolveCredentialOffer({
31
+ config: sdkConfigV1_3,
40
32
  credentialOffer,
41
33
  callbacks: { fetch: fetchFn },
42
34
  }).catch((e: unknown) => {
@@ -46,15 +38,5 @@ export const resolveCredentialOffer: OfferApi["resolveCredentialOffer"] =
46
38
  throw e;
47
39
  });
48
40
 
49
- // Structural validation (no metadata cross-checks at this stage)
50
- await validateCredentialOffer({
51
- credentialOffer: resolved,
52
- }).catch((e: unknown) => {
53
- if (e instanceof CredentialOfferError) {
54
- throw new InvalidCredentialOfferError(e.message);
55
- }
56
- throw e;
57
- });
58
-
59
41
  return resolved;
60
42
  };
@@ -5,6 +5,7 @@ import {
5
5
  import { InvalidCredentialOfferError } from "../common/errors";
6
6
  import { withMappedErrors } from "../../../utils/errors";
7
7
  import type { OfferApi } from "../api";
8
+ import { sdkConfigV1_3 } from "../../../utils/config";
8
9
 
9
10
  /**
10
11
  * v1.3.3 implementation — second and final step of the User Request Flow
@@ -21,7 +22,11 @@ import type { OfferApi } from "../api";
21
22
  */
22
23
  export const extractGrantDetails: OfferApi["extractGrantDetails"] = (offer) =>
23
24
  withMappedErrors(
24
- () => sdkExtractGrantDetails(offer),
25
+ () =>
26
+ sdkExtractGrantDetails({
27
+ config: sdkConfigV1_3,
28
+ credentialOffer: offer,
29
+ }),
25
30
  CredentialOfferError,
26
31
  (e) => new InvalidCredentialOfferError(e.message)
27
32
  );
@@ -0,0 +1,33 @@
1
+ import {
2
+ validateCredentialOffer as sdkValidateCredentialOffer,
3
+ CredentialOfferError,
4
+ } from "@pagopa/io-wallet-oid4vci";
5
+ import { InvalidCredentialOfferError } from "../common/errors";
6
+ import type { OfferApi } from "../api";
7
+ import { sdkConfigV1_3 } from "../../../utils/config";
8
+
9
+ /**
10
+ * v1.3.3 implementation — validates a resolved Credential Offer against the
11
+ * Credential Issuer metadata (IT-Wallet spec, Section 12.1.2).
12
+ *
13
+ * Performs the IT-Wallet v1.3 structural checks on the offer and, when the
14
+ * Credential Issuer relies on multiple Authorization Servers, ensures the
15
+ * `authorization_server` selected by the offer matches one of the advertised
16
+ * `authorization_servers`.
17
+ *
18
+ * Delegates to the SDK's {@link sdkValidateCredentialOffer}; validation errors
19
+ * are mapped to {@link InvalidCredentialOfferError}.
20
+ */
21
+ export const validateCredentialOffer: OfferApi["validateCredentialOffer"] =
22
+ async ({ offer, credentialIssuerMetadata }) => {
23
+ await sdkValidateCredentialOffer({
24
+ config: sdkConfigV1_3,
25
+ credentialOffer: offer,
26
+ credentialIssuerMetadata,
27
+ }).catch((e: unknown) => {
28
+ if (e instanceof CredentialOfferError) {
29
+ throw new InvalidCredentialOfferError(e.message);
30
+ }
31
+ throw e;
32
+ });
33
+ };
@@ -1,8 +1,10 @@
1
1
  import type { OfferApi } from "../api";
2
2
  import { resolveCredentialOffer } from "./01-resolve-credential-offer";
3
3
  import { extractGrantDetails } from "./02-extract-grant-details";
4
+ import { validateCredentialOffer } from "./03-validate-credential-offer";
4
5
 
5
6
  export const Offer: OfferApi = {
6
7
  resolveCredentialOffer,
7
8
  extractGrantDetails,
9
+ validateCredentialOffer,
8
10
  };
@@ -14,9 +14,9 @@ const ASDataCapability = z.object({
14
14
  ),
15
15
  domains: z.array(z.string()).optional(),
16
16
  data_origin_l10n_id: z.string(),
17
- integration_endpoint: z.string(),
17
+ integration_endpoint: z.string().optional(),
18
18
  integration_method: z.string(),
19
- user_information_l10n_id: z.string(),
19
+ user_information_l10n_id: z.string().optional(),
20
20
  // optional per spec (api_specification required in spec but absent in actual responses)
21
21
  api_specification: z.string().optional(),
22
22
  background_color: z.string().optional(),
@@ -9,6 +9,7 @@ export const WalletInstanceAttestationJwt = z.object({
9
9
  Jwt.shape.header,
10
10
  z.object({
11
11
  typ: z.literal("oauth-client-attestation+jwt"),
12
+ x5c: z.array(z.string()),
12
13
  })
13
14
  ),
14
15
  payload: z.intersection(