@pagopa/io-react-native-wallet 3.6.1 → 3.6.3

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 (68) hide show
  1. package/lib/commonjs/client/generated/wallet-provider.js +23 -4
  2. package/lib/commonjs/client/generated/wallet-provider.js.map +1 -1
  3. package/lib/commonjs/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js +1 -1
  4. package/lib/commonjs/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js.map +1 -1
  5. package/lib/commonjs/credential/presentation/v1.3.3/04-verify-certificate-chain.js +10 -3
  6. package/lib/commonjs/credential/presentation/v1.3.3/04-verify-certificate-chain.js.map +1 -1
  7. package/lib/commonjs/credential/status/v1.3.3/01-status-list.js +2 -1
  8. package/lib/commonjs/credential/status/v1.3.3/01-status-list.js.map +1 -1
  9. package/lib/commonjs/credential/status/v1.3.3/index.js +2 -1
  10. package/lib/commonjs/credential/status/v1.3.3/index.js.map +1 -1
  11. package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js +0 -1
  12. package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
  13. package/lib/commonjs/credentials-catalogue/v1.3.3/mappers.js +8 -3
  14. package/lib/commonjs/credentials-catalogue/v1.3.3/mappers.js.map +1 -1
  15. package/lib/commonjs/sd-jwt/types.js +1 -1
  16. package/lib/commonjs/sd-jwt/types.js.map +1 -1
  17. package/lib/commonjs/wallet-unit-attestation/v1.3.3/issuing.js +3 -3
  18. package/lib/commonjs/wallet-unit-attestation/v1.3.3/issuing.js.map +1 -1
  19. package/lib/commonjs/wallet-unit-attestation/v1.3.3/types.js +1 -1
  20. package/lib/commonjs/wallet-unit-attestation/v1.3.3/types.js.map +1 -1
  21. package/lib/module/client/generated/wallet-provider.js +17 -1
  22. package/lib/module/client/generated/wallet-provider.js.map +1 -1
  23. package/lib/module/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js +2 -2
  24. package/lib/module/credential/issuance/v1.3.3/01-evaluate-issuer-trust.js.map +1 -1
  25. package/lib/module/credential/presentation/v1.3.3/04-verify-certificate-chain.js +10 -3
  26. package/lib/module/credential/presentation/v1.3.3/04-verify-certificate-chain.js.map +1 -1
  27. package/lib/module/credential/status/v1.3.3/01-status-list.js +1 -1
  28. package/lib/module/credential/status/v1.3.3/01-status-list.js.map +1 -1
  29. package/lib/module/credential/status/v1.3.3/index.js +3 -2
  30. package/lib/module/credential/status/v1.3.3/index.js.map +1 -1
  31. package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js +0 -2
  32. package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
  33. package/lib/module/credentials-catalogue/v1.3.3/mappers.js +8 -3
  34. package/lib/module/credentials-catalogue/v1.3.3/mappers.js.map +1 -1
  35. package/lib/module/sd-jwt/types.js +1 -1
  36. package/lib/module/sd-jwt/types.js.map +1 -1
  37. package/lib/module/wallet-unit-attestation/v1.3.3/issuing.js +3 -3
  38. package/lib/module/wallet-unit-attestation/v1.3.3/issuing.js.map +1 -1
  39. package/lib/module/wallet-unit-attestation/v1.3.3/types.js +1 -1
  40. package/lib/module/wallet-unit-attestation/v1.3.3/types.js.map +1 -1
  41. package/lib/typescript/client/generated/wallet-provider.d.ts +33 -0
  42. package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -1
  43. package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts +481 -2
  44. package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts.map +1 -1
  45. package/lib/typescript/credential/presentation/v1.3.3/04-verify-certificate-chain.d.ts.map +1 -1
  46. package/lib/typescript/credential/status/api/status-list.d.ts +13 -0
  47. package/lib/typescript/credential/status/api/status-list.d.ts.map +1 -1
  48. package/lib/typescript/credential/status/v1.3.3/01-status-list.d.ts +1 -0
  49. package/lib/typescript/credential/status/v1.3.3/01-status-list.d.ts.map +1 -1
  50. package/lib/typescript/credential/status/v1.3.3/index.d.ts.map +1 -1
  51. package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts.map +1 -1
  52. package/lib/typescript/credentials-catalogue/v1.3.3/mappers.d.ts.map +1 -1
  53. package/lib/typescript/sd-jwt/index.d.ts +1 -1
  54. package/lib/typescript/sd-jwt/types.d.ts +1 -1
  55. package/lib/typescript/wallet-unit-attestation/v1.3.3/types.d.ts +1 -1
  56. package/package.json +6 -6
  57. package/src/client/generated/wallet-provider.ts +22 -0
  58. package/src/credential/issuance/v1.3.3/01-evaluate-issuer-trust.ts +4 -4
  59. package/src/credential/issuance/v1.3.3/mappers.ts +3 -3
  60. package/src/credential/presentation/v1.3.3/04-verify-certificate-chain.ts +11 -3
  61. package/src/credential/status/api/status-list.ts +14 -0
  62. package/src/credential/status/v1.3.3/01-status-list.ts +4 -5
  63. package/src/credential/status/v1.3.3/index.ts +6 -1
  64. package/src/credentials-catalogue/api/DigitalCredentialsCatalogue.ts +0 -1
  65. package/src/credentials-catalogue/v1.3.3/mappers.ts +8 -2
  66. package/src/sd-jwt/types.ts +1 -1
  67. package/src/wallet-unit-attestation/v1.3.3/issuing.ts +3 -3
  68. package/src/wallet-unit-attestation/v1.3.3/types.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-react-native-wallet",
3
- "version": "3.6.1",
3
+ "version": "3.6.3",
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.5.3",
144
- "@pagopa/io-wallet-oid-federation": "1.5.3",
145
- "@pagopa/io-wallet-oid4vci": "1.5.3",
146
- "@pagopa/io-wallet-oid4vp": "1.5.3",
147
- "@pagopa/io-wallet-utils": "1.5.3",
143
+ "@pagopa/io-wallet-oauth2": "1.5.4-alpha-20260717125503",
144
+ "@pagopa/io-wallet-oid-federation": "1.5.4-alpha-20260717125503",
145
+ "@pagopa/io-wallet-oid4vci": "1.5.4-alpha-20260717125503",
146
+ "@pagopa/io-wallet-oid4vp": "1.5.4-alpha-20260717125503",
147
+ "@pagopa/io-wallet-utils": "1.5.4-alpha-20260717125503",
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",
@@ -64,6 +64,14 @@ export const CreateWalletInstanceAttestationBody = z.string();
64
64
  export type CreateWalletUnitAttestationBody = z.infer<typeof CreateWalletUnitAttestationBody>;
65
65
  export const CreateWalletUnitAttestationBody = z.string();
66
66
 
67
+ export type CreateKeyAttestationBody = z.infer<typeof CreateKeyAttestationBody>;
68
+ export const CreateKeyAttestationBody = z.string();
69
+
70
+ export type KeyAttestation = z.infer<typeof KeyAttestation>;
71
+ export const KeyAttestation = z.object({
72
+ key_attestation: z.string(),
73
+ });
74
+
67
75
  export type ProblemJson = z.infer<typeof ProblemJson>;
68
76
  export const ProblemJson = z.object({
69
77
  type: z.string().optional(),
@@ -185,6 +193,19 @@ export const post_CreateWalletUnitAttestation = {
185
193
  response: WalletUnitAttestation,
186
194
  };
187
195
 
196
+ export type post_CreateKeyAttestation = typeof post_CreateKeyAttestation;
197
+ export const post_CreateKeyAttestation = {
198
+ method: z.literal("POST"),
199
+ path: z.literal("/key-attestations"),
200
+ parameters: z.object({
201
+ header: z.object({
202
+ "Content-Type": z.string().optional(),
203
+ }),
204
+ body: CreateKeyAttestationBody,
205
+ }),
206
+ response: KeyAttestation,
207
+ };
208
+
188
209
  // <EndpointByMethod>
189
210
  export const EndpointByMethod = {
190
211
  get: {
@@ -199,6 +220,7 @@ export const EndpointByMethod = {
199
220
  "/wallet-attestations": post_CreateWalletAttestation,
200
221
  "/wallet-instance-attestations": post_CreateWalletInstanceAttestation,
201
222
  "/wallet-unit-attestations": post_CreateWalletUnitAttestation,
223
+ "/key-attestations": post_CreateKeyAttestation,
202
224
  },
203
225
  put: {
204
226
  "/wallet-instances/{id}/status": put_SetWalletInstanceStatus,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  fetchMetadata,
3
- type MetadataResponseV1_3,
3
+ type MetadataResponseV1_4,
4
4
  } from "@pagopa/io-wallet-oid4vci";
5
- import { sdkConfigV1_3 } from "../../../utils/config";
5
+ import { sdkConfigV1_4 } from "../../../utils/config";
6
6
  import type { IssuanceApi } from "../api";
7
7
  import { mapToIssuerConfig } from "./mappers";
8
8
 
@@ -11,13 +11,13 @@ export const evaluateIssuerTrust: IssuanceApi["evaluateIssuerTrust"] = async (
11
11
  context = {}
12
12
  ) => {
13
13
  const issuerMetadata = (await fetchMetadata({
14
- config: sdkConfigV1_3,
14
+ config: sdkConfigV1_4,
15
15
  credentialIssuerUrl: issuerUrl,
16
16
  authorizationServer: context.authorizationServer,
17
17
  callbacks: {
18
18
  fetch: context.appFetch,
19
19
  },
20
- })) as MetadataResponseV1_3;
20
+ })) as MetadataResponseV1_4;
21
21
 
22
22
  return { issuerConf: mapToIssuerConfig(issuerMetadata) };
23
23
  };
@@ -1,4 +1,4 @@
1
- import type { MetadataResponseV1_3 } from "@pagopa/io-wallet-oid4vci";
1
+ import type { MetadataResponseV1_4 } from "@pagopa/io-wallet-oid4vci";
2
2
  import type { ParsedAuthorizeRequestResult } from "@pagopa/io-wallet-oid4vp";
3
3
  import { assert } from "../../../utils/misc";
4
4
  import { createMapper } from "../../../utils/mappers";
@@ -9,7 +9,7 @@ import { IssuerConfig } from "../api/IssuerConfig";
9
9
  type CredentialConfigurations =
10
10
  IssuerConfig["credential_configurations_supported"];
11
11
  type OpenIdCredentialIssuer =
12
- MetadataResponseV1_3["metadata"]["openid_credential_issuer"];
12
+ MetadataResponseV1_4["metadata"]["openid_credential_issuer"];
13
13
 
14
14
  const mapCredentialConfigurationsSupported = (
15
15
  oidIssuer: NonNullable<OpenIdCredentialIssuer>
@@ -34,7 +34,7 @@ const mapCredentialConfigurationsSupported = (
34
34
  );
35
35
 
36
36
  export const mapToIssuerConfig = createMapper<
37
- MetadataResponseV1_3,
37
+ MetadataResponseV1_4,
38
38
  IssuerConfig
39
39
  >(
40
40
  (x) => {
@@ -20,14 +20,22 @@ export const verifyAuthRequestCertificateChain: RemotePresentationApi["verifyAut
20
20
 
21
21
  const requestObject = decode(requestObjectJwt);
22
22
 
23
- const certChain = requestObject.protectedHeader.x5c;
23
+ const x5c = requestObject.protectedHeader.x5c;
24
24
 
25
- if (!certChain) {
25
+ if (!x5c) {
26
26
  throw new MissingX509CertsError(
27
27
  "No certificate chain (x5c) found in the Request Object"
28
28
  );
29
29
  }
30
30
 
31
+ // The native validator expects the chain to include the leaf and any
32
+ // intermediates, excluding the trust anchor (supplied separately as
33
+ // `caRootCert`). Some RPs include the anchor as the last entry of x5c,
34
+ // which must be stripped or the native validator (notably on iOS) treats
35
+ // it as an extraneous/unexpected trailing certificate and fails.
36
+ const certChain =
37
+ x5c.length > 1 && x5c.at(-1) === caRootCert ? x5c.slice(0, -1) : x5c;
38
+
31
39
  const validationResult = await verifyCertificateChain(
32
40
  certChain,
33
41
  caRootCert,
@@ -41,7 +49,7 @@ export const verifyAuthRequestCertificateChain: RemotePresentationApi["verifyAut
41
49
  );
42
50
 
43
51
  throw new X509ValidationError(
44
- "X.509 certificate chain validation failed"
52
+ `X.509 certificate chain validation failed. Status: ${validationResult.validationStatus}. Error: ${validationResult.errorMessage}`
45
53
  );
46
54
  }
47
55
 
@@ -73,4 +73,18 @@ export interface StatusListApi {
73
73
  rawStatus: string;
74
74
  status: string;
75
75
  };
76
+
77
+ /**
78
+ * Extracts the status list entry from a raw credential, i.e. the object containing `uri` and `ìdx`.
79
+ *
80
+ * This method **does not perform any HTTP request** to fetch the list. Use {@link get} or {@link getByUri} instead to fetch it.
81
+ * @since 1.3.3
82
+ * @param credential The raw credential
83
+ * @param format The credential format
84
+ * @returns The status list entry extracted from the credential
85
+ */
86
+ getStatusListEntry(
87
+ credential: string,
88
+ format: CredentialFormat
89
+ ): Promise<{ idx: number; uri: string }>;
76
90
  }
@@ -6,13 +6,12 @@ import {
6
6
  } from "@sd-jwt/jwt-status-list";
7
7
  import { IoWalletError } from "../../../utils/errors";
8
8
  import { hasStatusOrThrow } from "../../../utils/misc";
9
- import type { CredentialFormat } from "../../../credential/issuance/api";
10
9
  import type { StatusListApi } from "../api/status-list";
11
10
 
12
- const getStatusListEntry = async (
13
- credential: string,
14
- format: CredentialFormat
15
- ): Promise<StatusListEntry> => {
11
+ export const getStatusListEntry: StatusListApi["getStatusListEntry"] = async (
12
+ credential,
13
+ format
14
+ ) => {
16
15
  let statusListEntry: StatusListEntry | undefined;
17
16
 
18
17
  if (format === "mso_mdoc") {
@@ -1,5 +1,9 @@
1
1
  import type { CredentialStatusApi } from "../api";
2
- import { getStatusList, getStatusListByUri } from "./01-status-list";
2
+ import {
3
+ getStatusList,
4
+ getStatusListByUri,
5
+ getStatusListEntry,
6
+ } from "./01-status-list";
3
7
  import { verifyAndParseStatusList } from "./02-verify-and-parse-status-list";
4
8
  import { getStatus } from "./03-get-status";
5
9
 
@@ -13,5 +17,6 @@ export const CredentialStatus: CredentialStatusApi = {
13
17
  getByUri: getStatusListByUri,
14
18
  verifyAndParse: verifyAndParseStatusList,
15
19
  getStatus,
20
+ getStatusListEntry,
16
21
  },
17
22
  };
@@ -118,7 +118,6 @@ export const DigitalCredential = z.object({
118
118
  authentic_sources: z.array(AuthenticSource),
119
119
  parent_credentials: z.array(z.string()).optional(),
120
120
  formats: z.array(CredentialFormat).optional(),
121
- // claims: z.array(Claim), // TODO: [SIW-3978] Should we keep claims?
122
121
  });
123
122
  export type DigitalCredential = z.infer<typeof DigitalCredential>;
124
123
 
@@ -70,8 +70,14 @@ export const mapToCredentialsCatalogue = createMapper<
70
70
  `Schemas for ${credentialType} must be present in the Schema Registry`
71
71
  );
72
72
  return schemas.map((schema) => ({
73
- configuration_id: schema.id, // TODO: [SIW-3978] Fix this, the schema ID does not correspond to configuration_id
74
- ...schema,
73
+ // Since the schema registry does not contain the actual configuration ID, it is composed according
74
+ // to the IT-Wallet Credential Issuer's convention. Note that this might not be true for every Issuer.
75
+ configuration_id: `${schema.format.replace(/[+-]/g, "_")}_${schema.credential_type}`,
76
+ format: schema.format,
77
+ vct: schema.vct,
78
+ docType: schema.docType,
79
+ schema_uri: schema.schema_uri,
80
+ "schema_uri#integrity": schema["schema_uri#integrity"],
75
81
  }));
76
82
  };
77
83
 
@@ -14,7 +14,7 @@ const StatusAssertion = z.object({
14
14
  });
15
15
 
16
16
  const StatusList = z.object({
17
- idx: z.string(),
17
+ idx: z.number(),
18
18
  uri: z.string(),
19
19
  });
20
20
 
@@ -127,7 +127,7 @@ export const getAttestation: WalletUnitAttestationSupportedApi["getAttestation"]
127
127
  );
128
128
 
129
129
  const response = await api
130
- .post("/wallet-unit-attestations", {
130
+ .post("/key-attestations", {
131
131
  header: {
132
132
  "Content-Type": "text/plain",
133
133
  },
@@ -137,11 +137,11 @@ export const getAttestation: WalletUnitAttestationSupportedApi["getAttestation"]
137
137
 
138
138
  Logger.log(
139
139
  LogLevel.DEBUG,
140
- `Obtained Wallet Unit Attestation: ${response.wallet_unit_attestation}`
140
+ `Obtained Wallet Unit Attestation: ${response.key_attestation}`
141
141
  );
142
142
 
143
143
  return {
144
144
  format: "jwt",
145
- attestation: response.wallet_unit_attestation,
145
+ attestation: response.key_attestation,
146
146
  };
147
147
  };
@@ -17,5 +17,5 @@ export type WalletUnitAttestationResponse = z.infer<
17
17
  typeof WalletUnitAttestationResponse
18
18
  >;
19
19
  export const WalletUnitAttestationResponse = z.object({
20
- wallet_unit_attestation: z.string(),
20
+ key_attestation: z.string(),
21
21
  });