@pagopa/io-react-native-wallet 3.1.0 → 3.1.2

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 (160) hide show
  1. package/lib/commonjs/credential/presentation/api/{06-send-authorization-response.js → 04-verify-certificate-chain.js} +1 -1
  2. package/lib/commonjs/credential/presentation/api/04-verify-certificate-chain.js.map +1 -0
  3. package/lib/commonjs/credential/presentation/api/{04-verify-request-object.js → 05-verify-request-object.js} +1 -1
  4. package/lib/commonjs/credential/presentation/api/05-verify-request-object.js.map +1 -0
  5. package/lib/commonjs/credential/presentation/api/{05-evaluate-dcql-query.js → 06-evaluate-dcql-query.js} +1 -1
  6. package/lib/commonjs/credential/presentation/api/06-evaluate-dcql-query.js.map +1 -0
  7. package/lib/commonjs/credential/presentation/api/07-send-authorization-response.js +6 -0
  8. package/lib/commonjs/credential/presentation/api/07-send-authorization-response.js.map +1 -0
  9. package/lib/commonjs/credential/presentation/api/index.js.map +1 -1
  10. package/lib/commonjs/credential/presentation/v1.0.0/04-verify-certificate-chain.js +12 -0
  11. package/lib/commonjs/credential/presentation/v1.0.0/04-verify-certificate-chain.js.map +1 -0
  12. package/lib/commonjs/credential/presentation/v1.0.0/{04-verify-request-object.js → 05-verify-request-object.js} +1 -1
  13. package/lib/commonjs/credential/presentation/v1.0.0/{04-verify-request-object.js.map → 05-verify-request-object.js.map} +1 -1
  14. package/lib/commonjs/credential/presentation/v1.0.0/{05-evaluate-dcql-query.js → 06-evaluate-dcql-query.js} +1 -1
  15. package/lib/commonjs/credential/presentation/v1.0.0/{05-evaluate-dcql-query.js.map → 06-evaluate-dcql-query.js.map} +1 -1
  16. package/lib/commonjs/credential/presentation/v1.0.0/{06-send-authorization-response.js → 07-send-authorization-response.js} +1 -1
  17. package/lib/commonjs/credential/presentation/v1.0.0/{06-send-authorization-response.js.map → 07-send-authorization-response.js.map} +1 -1
  18. package/lib/commonjs/credential/presentation/v1.0.0/index.js +5 -3
  19. package/lib/commonjs/credential/presentation/v1.0.0/index.js.map +1 -1
  20. package/lib/commonjs/credential/presentation/v1.3.3/04-verify-certificate-chain.js +33 -0
  21. package/lib/commonjs/credential/presentation/v1.3.3/04-verify-certificate-chain.js.map +1 -0
  22. package/lib/commonjs/credential/presentation/v1.3.3/{04-verify-request-object.js → 05-verify-request-object.js} +1 -1
  23. package/lib/commonjs/credential/presentation/v1.3.3/{04-verify-request-object.js.map → 05-verify-request-object.js.map} +1 -1
  24. package/lib/commonjs/credential/presentation/v1.3.3/{05-evaluate-dcql-query.js → 06-evaluate-dcql-query.js} +1 -1
  25. package/lib/commonjs/credential/presentation/v1.3.3/{05-evaluate-dcql-query.js.map → 06-evaluate-dcql-query.js.map} +1 -1
  26. package/lib/commonjs/credential/presentation/v1.3.3/{06-send-authorization-response.js → 07-send-authorization-response.js} +1 -1
  27. package/lib/commonjs/credential/presentation/v1.3.3/{06-send-authorization-response.js.map → 07-send-authorization-response.js.map} +1 -1
  28. package/lib/commonjs/credential/presentation/v1.3.3/index.js +5 -3
  29. package/lib/commonjs/credential/presentation/v1.3.3/index.js.map +1 -1
  30. package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js +16 -2
  31. package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
  32. package/lib/commonjs/credentials-catalogue/v1.3.3/fetch-translations.js +32 -0
  33. package/lib/commonjs/credentials-catalogue/v1.3.3/fetch-translations.js.map +1 -0
  34. package/lib/commonjs/credentials-catalogue/v1.3.3/index.js +3 -1
  35. package/lib/commonjs/credentials-catalogue/v1.3.3/index.js.map +1 -1
  36. package/lib/commonjs/credentials-catalogue/v1.3.3/mappers.js +2 -0
  37. package/lib/commonjs/credentials-catalogue/v1.3.3/mappers.js.map +1 -1
  38. package/lib/commonjs/credentials-catalogue/v1.3.3/types.js +2 -2
  39. package/lib/commonjs/credentials-catalogue/v1.3.3/types.js.map +1 -1
  40. package/lib/commonjs/credentials-catalogue/v1.3.3/utils.js +32 -1
  41. package/lib/commonjs/credentials-catalogue/v1.3.3/utils.js.map +1 -1
  42. package/lib/module/credential/presentation/api/04-verify-certificate-chain.js +2 -0
  43. package/lib/module/credential/presentation/api/04-verify-certificate-chain.js.map +1 -0
  44. package/lib/module/credential/presentation/api/05-verify-request-object.js +2 -0
  45. package/lib/module/credential/presentation/api/05-verify-request-object.js.map +1 -0
  46. package/lib/module/credential/presentation/api/06-evaluate-dcql-query.js +2 -0
  47. package/lib/module/credential/presentation/api/06-evaluate-dcql-query.js.map +1 -0
  48. package/lib/module/credential/presentation/api/07-send-authorization-response.js +2 -0
  49. package/lib/module/credential/presentation/api/07-send-authorization-response.js.map +1 -0
  50. package/lib/module/credential/presentation/api/index.js.map +1 -1
  51. package/lib/module/credential/presentation/v1.0.0/04-verify-certificate-chain.js +5 -0
  52. package/lib/module/credential/presentation/v1.0.0/04-verify-certificate-chain.js.map +1 -0
  53. package/lib/module/credential/presentation/v1.0.0/{04-verify-request-object.js → 05-verify-request-object.js} +1 -1
  54. package/lib/module/credential/presentation/v1.0.0/{04-verify-request-object.js.map → 05-verify-request-object.js.map} +1 -1
  55. package/lib/module/credential/presentation/v1.0.0/{05-evaluate-dcql-query.js → 06-evaluate-dcql-query.js} +1 -1
  56. package/lib/module/credential/presentation/v1.0.0/{05-evaluate-dcql-query.js.map → 06-evaluate-dcql-query.js.map} +1 -1
  57. package/lib/module/credential/presentation/v1.0.0/{06-send-authorization-response.js → 07-send-authorization-response.js} +1 -1
  58. package/lib/module/credential/presentation/v1.0.0/{06-send-authorization-response.js.map → 07-send-authorization-response.js.map} +1 -1
  59. package/lib/module/credential/presentation/v1.0.0/index.js +5 -3
  60. package/lib/module/credential/presentation/v1.0.0/index.js.map +1 -1
  61. package/lib/module/credential/presentation/v1.3.3/04-verify-certificate-chain.js +26 -0
  62. package/lib/module/credential/presentation/v1.3.3/04-verify-certificate-chain.js.map +1 -0
  63. package/lib/module/credential/presentation/v1.3.3/{04-verify-request-object.js → 05-verify-request-object.js} +1 -1
  64. package/lib/module/credential/presentation/v1.3.3/{04-verify-request-object.js.map → 05-verify-request-object.js.map} +1 -1
  65. package/lib/module/credential/presentation/v1.3.3/{05-evaluate-dcql-query.js → 06-evaluate-dcql-query.js} +1 -1
  66. package/lib/module/credential/presentation/v1.3.3/{05-evaluate-dcql-query.js.map → 06-evaluate-dcql-query.js.map} +1 -1
  67. package/lib/module/credential/presentation/v1.3.3/{06-send-authorization-response.js → 07-send-authorization-response.js} +1 -1
  68. package/lib/module/credential/presentation/v1.3.3/{06-send-authorization-response.js.map → 07-send-authorization-response.js.map} +1 -1
  69. package/lib/module/credential/presentation/v1.3.3/index.js +5 -3
  70. package/lib/module/credential/presentation/v1.3.3/index.js.map +1 -1
  71. package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js +15 -1
  72. package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
  73. package/lib/module/credentials-catalogue/v1.3.3/fetch-translations.js +25 -0
  74. package/lib/module/credentials-catalogue/v1.3.3/fetch-translations.js.map +1 -0
  75. package/lib/module/credentials-catalogue/v1.3.3/index.js +3 -1
  76. package/lib/module/credentials-catalogue/v1.3.3/index.js.map +1 -1
  77. package/lib/module/credentials-catalogue/v1.3.3/mappers.js +2 -0
  78. package/lib/module/credentials-catalogue/v1.3.3/mappers.js.map +1 -1
  79. package/lib/module/credentials-catalogue/v1.3.3/types.js +2 -2
  80. package/lib/module/credentials-catalogue/v1.3.3/types.js.map +1 -1
  81. package/lib/module/credentials-catalogue/v1.3.3/utils.js +28 -0
  82. package/lib/module/credentials-catalogue/v1.3.3/utils.js.map +1 -1
  83. package/lib/typescript/credential/presentation/api/04-verify-certificate-chain.d.ts +17 -0
  84. package/lib/typescript/credential/presentation/api/04-verify-certificate-chain.d.ts.map +1 -0
  85. package/lib/typescript/credential/presentation/api/{04-verify-request-object.d.ts → 05-verify-request-object.d.ts} +1 -1
  86. package/lib/typescript/credential/presentation/api/{04-verify-request-object.d.ts.map → 05-verify-request-object.d.ts.map} +1 -1
  87. package/lib/typescript/credential/presentation/api/{05-evaluate-dcql-query.d.ts → 06-evaluate-dcql-query.d.ts} +1 -1
  88. package/lib/typescript/credential/presentation/api/{05-evaluate-dcql-query.d.ts.map → 06-evaluate-dcql-query.d.ts.map} +1 -1
  89. package/lib/typescript/credential/presentation/api/{06-send-authorization-response.d.ts → 07-send-authorization-response.d.ts} +2 -2
  90. package/lib/typescript/credential/presentation/api/{06-send-authorization-response.d.ts.map → 07-send-authorization-response.d.ts.map} +1 -1
  91. package/lib/typescript/credential/presentation/api/index.d.ts +5 -4
  92. package/lib/typescript/credential/presentation/api/index.d.ts.map +1 -1
  93. package/lib/typescript/credential/presentation/v1.0.0/04-verify-certificate-chain.d.ts +3 -0
  94. package/lib/typescript/credential/presentation/v1.0.0/04-verify-certificate-chain.d.ts.map +1 -0
  95. package/lib/typescript/credential/presentation/v1.0.0/{04-verify-request-object.d.ts → 05-verify-request-object.d.ts} +1 -1
  96. package/lib/typescript/credential/presentation/v1.0.0/05-verify-request-object.d.ts.map +1 -0
  97. package/lib/typescript/credential/presentation/v1.0.0/{05-evaluate-dcql-query.d.ts → 06-evaluate-dcql-query.d.ts} +1 -1
  98. package/lib/typescript/credential/presentation/v1.0.0/06-evaluate-dcql-query.d.ts.map +1 -0
  99. package/lib/typescript/credential/presentation/v1.0.0/{06-send-authorization-response.d.ts → 07-send-authorization-response.d.ts} +1 -1
  100. package/lib/typescript/credential/presentation/v1.0.0/{06-send-authorization-response.d.ts.map → 07-send-authorization-response.d.ts.map} +1 -1
  101. package/lib/typescript/credential/presentation/v1.0.0/index.d.ts.map +1 -1
  102. package/lib/typescript/credential/presentation/v1.3.3/04-verify-certificate-chain.d.ts +3 -0
  103. package/lib/typescript/credential/presentation/v1.3.3/04-verify-certificate-chain.d.ts.map +1 -0
  104. package/lib/typescript/credential/presentation/v1.3.3/{04-verify-request-object.d.ts → 05-verify-request-object.d.ts} +1 -1
  105. package/lib/typescript/credential/presentation/v1.3.3/05-verify-request-object.d.ts.map +1 -0
  106. package/lib/typescript/credential/presentation/v1.3.3/{05-evaluate-dcql-query.d.ts → 06-evaluate-dcql-query.d.ts} +1 -1
  107. package/lib/typescript/credential/presentation/v1.3.3/06-evaluate-dcql-query.d.ts.map +1 -0
  108. package/lib/typescript/credential/presentation/v1.3.3/{06-send-authorization-response.d.ts → 07-send-authorization-response.d.ts} +1 -1
  109. package/lib/typescript/credential/presentation/v1.3.3/{06-send-authorization-response.d.ts.map → 07-send-authorization-response.d.ts.map} +1 -1
  110. package/lib/typescript/credential/presentation/v1.3.3/index.d.ts.map +1 -1
  111. package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts +24 -0
  112. package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts.map +1 -1
  113. package/lib/typescript/credentials-catalogue/api/index.d.ts +22 -2
  114. package/lib/typescript/credentials-catalogue/api/index.d.ts.map +1 -1
  115. package/lib/typescript/credentials-catalogue/v1.0.0/mappers.d.ts +12 -0
  116. package/lib/typescript/credentials-catalogue/v1.0.0/mappers.d.ts.map +1 -1
  117. package/lib/typescript/credentials-catalogue/v1.3.3/fetch-translations.d.ts +3 -0
  118. package/lib/typescript/credentials-catalogue/v1.3.3/fetch-translations.d.ts.map +1 -0
  119. package/lib/typescript/credentials-catalogue/v1.3.3/index.d.ts.map +1 -1
  120. package/lib/typescript/credentials-catalogue/v1.3.3/mappers.d.ts +14 -2
  121. package/lib/typescript/credentials-catalogue/v1.3.3/mappers.d.ts.map +1 -1
  122. package/lib/typescript/credentials-catalogue/v1.3.3/types.d.ts +4 -4
  123. package/lib/typescript/credentials-catalogue/v1.3.3/utils.d.ts +11 -0
  124. package/lib/typescript/credentials-catalogue/v1.3.3/utils.d.ts.map +1 -1
  125. package/package.json +2 -1
  126. package/src/credential/presentation/api/04-verify-certificate-chain.ts +20 -0
  127. package/src/credential/presentation/api/{06-send-authorization-response.ts → 07-send-authorization-response.ts} +1 -1
  128. package/src/credential/presentation/api/index.ts +5 -3
  129. package/src/credential/presentation/v1.0.0/04-verify-certificate-chain.ts +10 -0
  130. package/src/credential/presentation/v1.0.0/{05-evaluate-dcql-query.ts → 06-evaluate-dcql-query.ts} +1 -1
  131. package/src/credential/presentation/v1.0.0/index.ts +5 -3
  132. package/src/credential/presentation/v1.3.3/04-verify-certificate-chain.ts +49 -0
  133. package/src/credential/presentation/v1.3.3/{05-evaluate-dcql-query.ts → 06-evaluate-dcql-query.ts} +1 -1
  134. package/src/credential/presentation/v1.3.3/index.ts +5 -3
  135. package/src/credentials-catalogue/api/DigitalCredentialsCatalogue.ts +16 -0
  136. package/src/credentials-catalogue/api/index.ts +36 -2
  137. package/src/credentials-catalogue/v1.3.3/fetch-translations.ts +32 -0
  138. package/src/credentials-catalogue/v1.3.3/index.ts +2 -0
  139. package/src/credentials-catalogue/v1.3.3/mappers.ts +2 -0
  140. package/src/credentials-catalogue/v1.3.3/types.ts +2 -2
  141. package/src/credentials-catalogue/v1.3.3/utils.ts +33 -0
  142. package/lib/commonjs/credential/presentation/api/04-verify-request-object.js.map +0 -1
  143. package/lib/commonjs/credential/presentation/api/05-evaluate-dcql-query.js.map +0 -1
  144. package/lib/commonjs/credential/presentation/api/06-send-authorization-response.js.map +0 -1
  145. package/lib/module/credential/presentation/api/04-verify-request-object.js +0 -2
  146. package/lib/module/credential/presentation/api/04-verify-request-object.js.map +0 -1
  147. package/lib/module/credential/presentation/api/05-evaluate-dcql-query.js +0 -2
  148. package/lib/module/credential/presentation/api/05-evaluate-dcql-query.js.map +0 -1
  149. package/lib/module/credential/presentation/api/06-send-authorization-response.js +0 -2
  150. package/lib/module/credential/presentation/api/06-send-authorization-response.js.map +0 -1
  151. package/lib/typescript/credential/presentation/v1.0.0/04-verify-request-object.d.ts.map +0 -1
  152. package/lib/typescript/credential/presentation/v1.0.0/05-evaluate-dcql-query.d.ts.map +0 -1
  153. package/lib/typescript/credential/presentation/v1.3.3/04-verify-request-object.d.ts.map +0 -1
  154. package/lib/typescript/credential/presentation/v1.3.3/05-evaluate-dcql-query.d.ts.map +0 -1
  155. /package/src/credential/presentation/api/{04-verify-request-object.ts → 05-verify-request-object.ts} +0 -0
  156. /package/src/credential/presentation/api/{05-evaluate-dcql-query.ts → 06-evaluate-dcql-query.ts} +0 -0
  157. /package/src/credential/presentation/v1.0.0/{04-verify-request-object.ts → 05-verify-request-object.ts} +0 -0
  158. /package/src/credential/presentation/v1.0.0/{06-send-authorization-response.ts → 07-send-authorization-response.ts} +0 -0
  159. /package/src/credential/presentation/v1.3.3/{04-verify-request-object.ts → 05-verify-request-object.ts} +0 -0
  160. /package/src/credential/presentation/v1.3.3/{06-send-authorization-response.ts → 07-send-authorization-response.ts} +0 -0
@@ -0,0 +1,20 @@
1
+ import type { CertificateValidationResult } from "@pagopa/io-react-native-crypto";
2
+
3
+ export interface VerifyAuthRequestCertificateChainApi {
4
+ /**
5
+ * Verify the X.509 certificate chain in the Request Object `x5c` header claim.
6
+ * @since 1.0.0
7
+ *
8
+ * @param requestObjectJwt The Request Object in JWT format
9
+ * @param params.caRootCert The CA root certificate used to validate the chain
10
+ * @returns The certificate validation result
11
+ * @throws {MissingX509CertsError} if the Request Object does not contain x5c
12
+ * @throws {X509ValidationError} if the certificate chain validation fails
13
+ */
14
+ verifyAuthRequestCertificateChain(
15
+ requestObjectJwt: string,
16
+ params: {
17
+ caRootCert: string;
18
+ }
19
+ ): Promise<CertificateValidationResult>;
20
+ }
@@ -5,7 +5,7 @@ import type {
5
5
  RequestObject,
6
6
  } from "./types";
7
7
  import type { RelyingPartyConfig } from "./RelyingPartyConfig";
8
- import type { EvaluateDcqlQueryApi } from "./05-evaluate-dcql-query";
8
+ import type { EvaluateDcqlQueryApi } from "./06-evaluate-dcql-query";
9
9
  import type { Out } from "../../../../src/utils/misc";
10
10
  type FetchContext = { appFetch?: GlobalFetch["fetch"] };
11
11
 
@@ -1,15 +1,17 @@
1
1
  import type { StartFlowApi } from "./01-start-flow";
2
2
  import type { EvaluateRelyingPartyTrustApi } from "./02-evaluate-rp-trust";
3
3
  import type { GetRequestObjectApi } from "./03-get-request-object";
4
- import type { VerifyRequestObjectApi } from "./04-verify-request-object";
5
- import type { EvaluateDcqlQueryApi } from "./05-evaluate-dcql-query";
6
- import type { SendAuthorizationResponseApi } from "./06-send-authorization-response";
4
+ import type { VerifyAuthRequestCertificateChainApi } from "./04-verify-certificate-chain";
5
+ import type { VerifyRequestObjectApi } from "./05-verify-request-object";
6
+ import type { EvaluateDcqlQueryApi } from "./06-evaluate-dcql-query";
7
+ import type { SendAuthorizationResponseApi } from "./07-send-authorization-response";
7
8
  import type { RelyingPartyConfig } from "./RelyingPartyConfig";
8
9
 
9
10
  export interface RemotePresentationApi
10
11
  extends StartFlowApi,
11
12
  EvaluateRelyingPartyTrustApi,
12
13
  GetRequestObjectApi,
14
+ VerifyAuthRequestCertificateChainApi,
13
15
  VerifyRequestObjectApi,
14
16
  EvaluateDcqlQueryApi,
15
17
  SendAuthorizationResponseApi {}
@@ -0,0 +1,10 @@
1
+ import { UnimplementedFeatureError } from "../../../utils/errors";
2
+ import { type RemotePresentationApi } from "../api";
3
+
4
+ export const verifyAuthRequestCertificateChain: RemotePresentationApi["verifyAuthRequestCertificateChain"] =
5
+ async () => {
6
+ throw new UnimplementedFeatureError(
7
+ "verifyAuthRequestCertificateChain",
8
+ "1.0.0"
9
+ );
10
+ };
@@ -2,7 +2,7 @@ import { DcqlQuery, DcqlError } from "dcql";
2
2
  import { isValiError } from "valibot";
3
3
  import { CredentialsNotFoundError } from "../common/errors";
4
4
  import type { Credential4Dcql, RemotePresentationApi } from "../api";
5
- import type { CredentialPurpose } from "../api/05-evaluate-dcql-query";
5
+ import type { CredentialPurpose } from "../api/06-evaluate-dcql-query";
6
6
  import * as sdJwtUtils from "../common/utils/sd-jwt";
7
7
  import {
8
8
  extractFailedCredentialsDetails,
@@ -2,18 +2,20 @@ import type { RemotePresentationApi } from "../api";
2
2
  import { startFlowFromQR } from "./01-start-flow";
3
3
  import { evaluateRelyingPartyTrust } from "./02-evaluate-rp-trust";
4
4
  import { getRequestObject } from "./03-get-request-object";
5
- import { verifyRequestObject } from "./04-verify-request-object";
6
- import { evaluateDcqlQuery } from "./05-evaluate-dcql-query";
5
+ import { verifyAuthRequestCertificateChain } from "./04-verify-certificate-chain";
6
+ import { verifyRequestObject } from "./05-verify-request-object";
7
+ import { evaluateDcqlQuery } from "./06-evaluate-dcql-query";
7
8
  import {
8
9
  prepareRemotePresentations,
9
10
  sendAuthorizationResponse,
10
11
  sendAuthorizationErrorResponse,
11
- } from "./06-send-authorization-response";
12
+ } from "./07-send-authorization-response";
12
13
 
13
14
  export const RemotePresentation: RemotePresentationApi = {
14
15
  startFlowFromQR,
15
16
  evaluateRelyingPartyTrust,
16
17
  getRequestObject,
18
+ verifyAuthRequestCertificateChain,
17
19
  verifyRequestObject,
18
20
  evaluateDcqlQuery,
19
21
  prepareRemotePresentations,
@@ -0,0 +1,49 @@
1
+ import type { RemotePresentationApi } from "../api";
2
+ import { decode } from "@pagopa/io-react-native-jwt";
3
+ import {
4
+ verifyCertificateChain,
5
+ type X509CertificateOptions,
6
+ } from "@pagopa/io-react-native-crypto";
7
+ import {
8
+ MissingX509CertsError,
9
+ X509ValidationError,
10
+ } from "../../../trust/common/errors";
11
+ import { Logger, LogLevel } from "../../../utils/logging";
12
+
13
+ export const verifyAuthRequestCertificateChain: RemotePresentationApi["verifyAuthRequestCertificateChain"] =
14
+ async (requestObjectJwt, { caRootCert }) => {
15
+ const x509Options: X509CertificateOptions = {
16
+ requireCrl: false,
17
+ connectTimeout: 10_000,
18
+ readTimeout: 10_000,
19
+ };
20
+
21
+ const requestObject = decode(requestObjectJwt);
22
+
23
+ const certChain = requestObject.protectedHeader.x5c;
24
+
25
+ if (!certChain) {
26
+ throw new MissingX509CertsError(
27
+ "No certificate chain (x5c) found in the Request Object"
28
+ );
29
+ }
30
+
31
+ const validationResult = await verifyCertificateChain(
32
+ certChain,
33
+ caRootCert,
34
+ x509Options
35
+ );
36
+
37
+ if (!validationResult.isValid) {
38
+ Logger.log(
39
+ LogLevel.ERROR,
40
+ `Certificate chain failure: ${validationResult.validationStatus} - ${validationResult.errorMessage}`
41
+ );
42
+
43
+ throw new X509ValidationError(
44
+ "X.509 certificate chain validation failed"
45
+ );
46
+ }
47
+
48
+ return validationResult;
49
+ };
@@ -1,7 +1,7 @@
1
1
  import { DcqlQuery, DcqlError } from "dcql";
2
2
  import { isValiError } from "valibot";
3
3
  import { CredentialsNotFoundError } from "../common/errors";
4
- import type { CredentialPurpose } from "../api/05-evaluate-dcql-query";
4
+ import type { CredentialPurpose } from "../api/06-evaluate-dcql-query";
5
5
  import * as mdocUtils from "./utils.mdoc";
6
6
  import type { Credential4Dcql, RemotePresentationApi } from "../api";
7
7
  import * as sdJwtUtils from "../common/utils/sd-jwt";
@@ -2,18 +2,20 @@ import type { RemotePresentationApi } from "../api";
2
2
  import { startFlowFromQR } from "./01-start-flow";
3
3
  import { evaluateRelyingPartyTrust } from "./02-evaluate-rp-trust";
4
4
  import { getRequestObject } from "./03-get-request-object";
5
- import { verifyRequestObject } from "./04-verify-request-object";
6
- import { evaluateDcqlQuery } from "./05-evaluate-dcql-query";
5
+ import { verifyAuthRequestCertificateChain } from "./04-verify-certificate-chain";
6
+ import { verifyRequestObject } from "./05-verify-request-object";
7
+ import { evaluateDcqlQuery } from "./06-evaluate-dcql-query";
7
8
  import {
8
9
  prepareRemotePresentations,
9
10
  sendAuthorizationResponse,
10
11
  sendAuthorizationErrorResponse,
11
- } from "./06-send-authorization-response";
12
+ } from "./07-send-authorization-response";
12
13
 
13
14
  export const RemotePresentation: RemotePresentationApi = {
14
15
  startFlowFromQR,
15
16
  evaluateRelyingPartyTrust,
16
17
  getRequestObject,
18
+ verifyAuthRequestCertificateChain,
17
19
  verifyRequestObject,
18
20
  evaluateDcqlQuery,
19
21
  prepareRemotePresentations,
@@ -1,6 +1,20 @@
1
1
  import * as z from "zod";
2
2
  import { UnixTime } from "../../utils/zod";
3
3
 
4
+ export const LocalizationInfo = z.object({
5
+ available_locales: z.array(z.string()),
6
+ base_uri: z.string(),
7
+ default_locale: z.string(),
8
+ version: z.string(),
9
+ });
10
+ export type LocalizationInfo = z.infer<typeof LocalizationInfo>;
11
+
12
+ /**
13
+ * Merged translations for one or more locales, keyed by locale code.
14
+ * Each locale maps l10n_id keys to their translated string values.
15
+ */
16
+ export type CatalogueTranslations = Record<string, Record<string, string>>;
17
+
4
18
  const AdministrativeExpirationUserInfo = z.object({
5
19
  title_l10n_id: z.string(),
6
20
  description_l10n_id: z.string(),
@@ -108,6 +122,8 @@ export const DigitalCredentialsCatalogue = z.object({
108
122
  credentials: z.array(DigitalCredential),
109
123
  iat: UnixTime,
110
124
  exp: UnixTime,
125
+ localization: LocalizationInfo.optional(),
126
+ as_localization: LocalizationInfo.optional(),
111
127
  });
112
128
  export type DigitalCredentialsCatalogue = z.infer<
113
129
  typeof DigitalCredentialsCatalogue
@@ -1,7 +1,16 @@
1
- import { type DigitalCredentialsCatalogue } from "./DigitalCredentialsCatalogue";
1
+ import {
2
+ type CatalogueTranslations,
3
+ type DigitalCredentialsCatalogue,
4
+ type LocalizationInfo,
5
+ } from "./DigitalCredentialsCatalogue";
2
6
 
3
7
  type FetchContext = { appFetch?: GlobalFetch["fetch"] };
4
8
 
9
+ type FetchTranslationsLocalizations = {
10
+ catalogue?: LocalizationInfo;
11
+ authenticSources?: LocalizationInfo;
12
+ };
13
+
5
14
  export interface CredentialsCatalogueApi {
6
15
  /**
7
16
  * Fetch and parse the Digital Credential Catalogue from the Trust Anchor.
@@ -16,6 +25,31 @@ export interface CredentialsCatalogueApi {
16
25
  trustAnchorBaseUrl: string,
17
26
  ctx?: FetchContext
18
27
  ): Promise<DigitalCredentialsCatalogue>;
28
+
29
+ /**
30
+ * Fetch locale bundle files for the credential catalogue and authentic sources.
31
+ * For each requested locale, fetches translations from both registries (if the locale
32
+ * is listed in their respective `available_locales`) and merges the keys.
33
+ * Locales not present in a registry's `available_locales` are silently skipped for that source.
34
+ * On key conflicts, authentic-sources translations take precedence.
35
+ *
36
+ * Optional: not supported by all versions. Check for existence before calling.
37
+ *
38
+ * @since 1.3.3
39
+ * @param localizations Localization metadata from a previously fetched catalogue
40
+ * @param locales Array of locale codes to fetch (e.g. ["it", "en"])
41
+ * @param ctx.appFetch (optional) fetch API implementation. Default: built-in fetch
42
+ * @returns Record keyed by locale, each containing merged translation key→value pairs
43
+ */
44
+ fetchTranslations?(
45
+ localizations: FetchTranslationsLocalizations,
46
+ locales: string[],
47
+ ctx?: FetchContext
48
+ ): Promise<CatalogueTranslations>;
19
49
  }
20
50
 
21
- export { type DigitalCredentialsCatalogue };
51
+ export {
52
+ type CatalogueTranslations,
53
+ type DigitalCredentialsCatalogue,
54
+ type LocalizationInfo,
55
+ };
@@ -0,0 +1,32 @@
1
+ import type { CredentialsCatalogueApi as Api } from "../api";
2
+ import { fetchLocaleBundle } from "./utils";
3
+
4
+ export const fetchTranslations: NonNullable<Api["fetchTranslations"]> = async (
5
+ { catalogue, authenticSources },
6
+ locales,
7
+ { appFetch = fetch } = {}
8
+ ) => {
9
+ const result: Record<string, Record<string, string>> = {};
10
+
11
+ await Promise.all(
12
+ locales.map(async (locale) => {
13
+ const [catalogueBundle, asBundle] = await Promise.all([
14
+ catalogue?.available_locales.includes(locale)
15
+ ? fetchLocaleBundle(catalogue.base_uri, locale, appFetch)
16
+ : Promise.resolve({}),
17
+ authenticSources?.available_locales.includes(locale)
18
+ ? fetchLocaleBundle(authenticSources.base_uri, locale, appFetch)
19
+ : Promise.resolve({}),
20
+ ]);
21
+
22
+ const merged = { ...catalogueBundle, ...asBundle };
23
+
24
+ // Only include the locale in the result if at least one source provided translations
25
+ if (Object.keys(merged).length > 0) {
26
+ result[locale] = merged;
27
+ }
28
+ })
29
+ );
30
+
31
+ return result;
32
+ };
@@ -1,6 +1,8 @@
1
1
  import type { CredentialsCatalogueApi } from "../api";
2
2
  import { fetchAndParseCatalogue } from "./fetch-and-parse-catalogue";
3
+ import { fetchTranslations } from "./fetch-translations";
3
4
 
4
5
  export const CredentialsCatalogue: CredentialsCatalogueApi = {
5
6
  fetchAndParseCatalogue,
7
+ fetchTranslations,
6
8
  };
@@ -65,6 +65,8 @@ export const mapToCredentialsCatalogue = createMapper<
65
65
  return {
66
66
  ...catalogueJwt.payload,
67
67
  taxonomy_uri: discoveryJwt.payload.endpoints.taxonomy,
68
+ localization: catalogueJwt.payload.localization,
69
+ as_localization: authSourceRegistry.localization,
68
70
  credentials: catalogueJwt.payload.credentials.map(
69
71
  ({ authentic_sources, credential_name_l10n_id, ...credential }) => ({
70
72
  name_l10n_id: credential_name_l10n_id,
@@ -106,8 +106,8 @@ export const DigitalCredential = z.object({
106
106
  legal_type: z.string(),
107
107
  restriction_policy: z
108
108
  .object({
109
- allowed_wallet_ids: z.array(z.string()),
110
- allowed_issuer_ids: z.array(z.string()),
109
+ allowed_wallet_ids: z.array(z.string()).optional(),
110
+ allowed_issuer_ids: z.array(z.string()).optional(),
111
111
  presentation_flows: z.object({
112
112
  remote: z.boolean(),
113
113
  proximity: z.boolean(),
@@ -67,3 +67,36 @@ export const fetchRegistry = async <T>(
67
67
  `Unsupported content-type for ${url}: ${contentType}`
68
68
  );
69
69
  };
70
+
71
+ /**
72
+ * Fetch a locale bundle file from the Registry Infrastructure.
73
+ * Bundle files are flat JSON objects mapping l10n_id keys to translated strings.
74
+ * @see https://italia.github.io/eid-wallet-it-docs/releases/1.3.3/en/registry.html
75
+ *
76
+ * @param baseUri The base URI from a registry's localization object
77
+ * @param locale The locale code (e.g. "it", "en")
78
+ * @param appFetch Custom fetch implementation
79
+ * @returns Flat key→value translation map
80
+ */
81
+ export const fetchLocaleBundle = async (
82
+ baseUri: string,
83
+ locale: string,
84
+ appFetch: GlobalFetch["fetch"] = fetch
85
+ ): Promise<Record<string, string>> => {
86
+ const url = `${baseUri.replace(/\/$/, "")}/${locale}.json`;
87
+
88
+ const response = await appFetch(url, {
89
+ method: "GET",
90
+ headers: { Accept: "application/json" },
91
+ }).then(hasStatusOrThrow(200));
92
+
93
+ const contentType = response.headers.get("Content-Type");
94
+ if (!contentType?.includes("application/json")) {
95
+ throw new IoWalletError(
96
+ `Locale bundle at ${url} returned unexpected Content-Type: ${contentType}`
97
+ );
98
+ }
99
+
100
+ const responseJson = await response.json();
101
+ return z.record(z.string(), z.string()).parse(responseJson);
102
+ };
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["credential/presentation/api/04-verify-request-object.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["credential/presentation/api/05-evaluate-dcql-query.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["credential/presentation/api/06-send-authorization-response.ts"],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=04-verify-request-object.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["credential/presentation/api/04-verify-request-object.ts"],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=05-evaluate-dcql-query.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["credential/presentation/api/05-evaluate-dcql-query.ts"],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=06-send-authorization-response.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["credential/presentation/api/06-send-authorization-response.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"04-verify-request-object.d.ts","sourceRoot":"","sources":["../../../../../src/credential/presentation/v1.0.0/04-verify-request-object.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAsB,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAMxE,eAAO,MAAM,mBAAmB,EAAE,qBAAqB,CAAC,qBAAqB,CAsC1E,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"05-evaluate-dcql-query.d.ts","sourceRoot":"","sources":["../../../../../src/credential/presentation/v1.0.0/05-evaluate-dcql-query.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAmB,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAWrE,eAAO,MAAM,iBAAiB,EAAE,qBAAqB,CAAC,mBAAmB,CAkFtE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"04-verify-request-object.d.ts","sourceRoot":"","sources":["../../../../../src/credential/presentation/v1.3.3/04-verify-request-object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAQpD,eAAO,MAAM,mBAAmB,EAAE,qBAAqB,CAAC,qBAAqB,CAwB1E,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"05-evaluate-dcql-query.d.ts","sourceRoot":"","sources":["../../../../../src/credential/presentation/v1.3.3/05-evaluate-dcql-query.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAmB,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AASrE,eAAO,MAAM,iBAAiB,EAAE,qBAAqB,CAAC,mBAAmB,CAwGtE,CAAC"}