@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.
- package/lib/commonjs/credential/presentation/api/{06-send-authorization-response.js → 04-verify-certificate-chain.js} +1 -1
- package/lib/commonjs/credential/presentation/api/04-verify-certificate-chain.js.map +1 -0
- package/lib/commonjs/credential/presentation/api/{04-verify-request-object.js → 05-verify-request-object.js} +1 -1
- package/lib/commonjs/credential/presentation/api/05-verify-request-object.js.map +1 -0
- package/lib/commonjs/credential/presentation/api/{05-evaluate-dcql-query.js → 06-evaluate-dcql-query.js} +1 -1
- package/lib/commonjs/credential/presentation/api/06-evaluate-dcql-query.js.map +1 -0
- package/lib/commonjs/credential/presentation/api/07-send-authorization-response.js +6 -0
- package/lib/commonjs/credential/presentation/api/07-send-authorization-response.js.map +1 -0
- package/lib/commonjs/credential/presentation/api/index.js.map +1 -1
- package/lib/commonjs/credential/presentation/v1.0.0/04-verify-certificate-chain.js +12 -0
- package/lib/commonjs/credential/presentation/v1.0.0/04-verify-certificate-chain.js.map +1 -0
- package/lib/commonjs/credential/presentation/v1.0.0/{04-verify-request-object.js → 05-verify-request-object.js} +1 -1
- package/lib/commonjs/credential/presentation/v1.0.0/{04-verify-request-object.js.map → 05-verify-request-object.js.map} +1 -1
- package/lib/commonjs/credential/presentation/v1.0.0/{05-evaluate-dcql-query.js → 06-evaluate-dcql-query.js} +1 -1
- package/lib/commonjs/credential/presentation/v1.0.0/{05-evaluate-dcql-query.js.map → 06-evaluate-dcql-query.js.map} +1 -1
- package/lib/commonjs/credential/presentation/v1.0.0/{06-send-authorization-response.js → 07-send-authorization-response.js} +1 -1
- package/lib/commonjs/credential/presentation/v1.0.0/{06-send-authorization-response.js.map → 07-send-authorization-response.js.map} +1 -1
- package/lib/commonjs/credential/presentation/v1.0.0/index.js +5 -3
- package/lib/commonjs/credential/presentation/v1.0.0/index.js.map +1 -1
- package/lib/commonjs/credential/presentation/v1.3.3/04-verify-certificate-chain.js +33 -0
- package/lib/commonjs/credential/presentation/v1.3.3/04-verify-certificate-chain.js.map +1 -0
- package/lib/commonjs/credential/presentation/v1.3.3/{04-verify-request-object.js → 05-verify-request-object.js} +1 -1
- package/lib/commonjs/credential/presentation/v1.3.3/{04-verify-request-object.js.map → 05-verify-request-object.js.map} +1 -1
- package/lib/commonjs/credential/presentation/v1.3.3/{05-evaluate-dcql-query.js → 06-evaluate-dcql-query.js} +1 -1
- package/lib/commonjs/credential/presentation/v1.3.3/{05-evaluate-dcql-query.js.map → 06-evaluate-dcql-query.js.map} +1 -1
- package/lib/commonjs/credential/presentation/v1.3.3/{06-send-authorization-response.js → 07-send-authorization-response.js} +1 -1
- package/lib/commonjs/credential/presentation/v1.3.3/{06-send-authorization-response.js.map → 07-send-authorization-response.js.map} +1 -1
- package/lib/commonjs/credential/presentation/v1.3.3/index.js +5 -3
- package/lib/commonjs/credential/presentation/v1.3.3/index.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js +16 -2
- package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/fetch-translations.js +32 -0
- package/lib/commonjs/credentials-catalogue/v1.3.3/fetch-translations.js.map +1 -0
- package/lib/commonjs/credentials-catalogue/v1.3.3/index.js +3 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/index.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/mappers.js +2 -0
- package/lib/commonjs/credentials-catalogue/v1.3.3/mappers.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/types.js +2 -2
- package/lib/commonjs/credentials-catalogue/v1.3.3/types.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/utils.js +32 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/utils.js.map +1 -1
- package/lib/module/credential/presentation/api/04-verify-certificate-chain.js +2 -0
- package/lib/module/credential/presentation/api/04-verify-certificate-chain.js.map +1 -0
- package/lib/module/credential/presentation/api/05-verify-request-object.js +2 -0
- package/lib/module/credential/presentation/api/05-verify-request-object.js.map +1 -0
- package/lib/module/credential/presentation/api/06-evaluate-dcql-query.js +2 -0
- package/lib/module/credential/presentation/api/06-evaluate-dcql-query.js.map +1 -0
- package/lib/module/credential/presentation/api/07-send-authorization-response.js +2 -0
- package/lib/module/credential/presentation/api/07-send-authorization-response.js.map +1 -0
- package/lib/module/credential/presentation/api/index.js.map +1 -1
- package/lib/module/credential/presentation/v1.0.0/04-verify-certificate-chain.js +5 -0
- package/lib/module/credential/presentation/v1.0.0/04-verify-certificate-chain.js.map +1 -0
- package/lib/module/credential/presentation/v1.0.0/{04-verify-request-object.js → 05-verify-request-object.js} +1 -1
- package/lib/module/credential/presentation/v1.0.0/{04-verify-request-object.js.map → 05-verify-request-object.js.map} +1 -1
- package/lib/module/credential/presentation/v1.0.0/{05-evaluate-dcql-query.js → 06-evaluate-dcql-query.js} +1 -1
- package/lib/module/credential/presentation/v1.0.0/{05-evaluate-dcql-query.js.map → 06-evaluate-dcql-query.js.map} +1 -1
- package/lib/module/credential/presentation/v1.0.0/{06-send-authorization-response.js → 07-send-authorization-response.js} +1 -1
- package/lib/module/credential/presentation/v1.0.0/{06-send-authorization-response.js.map → 07-send-authorization-response.js.map} +1 -1
- package/lib/module/credential/presentation/v1.0.0/index.js +5 -3
- package/lib/module/credential/presentation/v1.0.0/index.js.map +1 -1
- package/lib/module/credential/presentation/v1.3.3/04-verify-certificate-chain.js +26 -0
- package/lib/module/credential/presentation/v1.3.3/04-verify-certificate-chain.js.map +1 -0
- package/lib/module/credential/presentation/v1.3.3/{04-verify-request-object.js → 05-verify-request-object.js} +1 -1
- package/lib/module/credential/presentation/v1.3.3/{04-verify-request-object.js.map → 05-verify-request-object.js.map} +1 -1
- package/lib/module/credential/presentation/v1.3.3/{05-evaluate-dcql-query.js → 06-evaluate-dcql-query.js} +1 -1
- package/lib/module/credential/presentation/v1.3.3/{05-evaluate-dcql-query.js.map → 06-evaluate-dcql-query.js.map} +1 -1
- package/lib/module/credential/presentation/v1.3.3/{06-send-authorization-response.js → 07-send-authorization-response.js} +1 -1
- package/lib/module/credential/presentation/v1.3.3/{06-send-authorization-response.js.map → 07-send-authorization-response.js.map} +1 -1
- package/lib/module/credential/presentation/v1.3.3/index.js +5 -3
- package/lib/module/credential/presentation/v1.3.3/index.js.map +1 -1
- package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js +15 -1
- package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
- package/lib/module/credentials-catalogue/v1.3.3/fetch-translations.js +25 -0
- package/lib/module/credentials-catalogue/v1.3.3/fetch-translations.js.map +1 -0
- package/lib/module/credentials-catalogue/v1.3.3/index.js +3 -1
- package/lib/module/credentials-catalogue/v1.3.3/index.js.map +1 -1
- package/lib/module/credentials-catalogue/v1.3.3/mappers.js +2 -0
- package/lib/module/credentials-catalogue/v1.3.3/mappers.js.map +1 -1
- package/lib/module/credentials-catalogue/v1.3.3/types.js +2 -2
- package/lib/module/credentials-catalogue/v1.3.3/types.js.map +1 -1
- package/lib/module/credentials-catalogue/v1.3.3/utils.js +28 -0
- package/lib/module/credentials-catalogue/v1.3.3/utils.js.map +1 -1
- package/lib/typescript/credential/presentation/api/04-verify-certificate-chain.d.ts +17 -0
- package/lib/typescript/credential/presentation/api/04-verify-certificate-chain.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/api/{04-verify-request-object.d.ts → 05-verify-request-object.d.ts} +1 -1
- package/lib/typescript/credential/presentation/api/{04-verify-request-object.d.ts.map → 05-verify-request-object.d.ts.map} +1 -1
- package/lib/typescript/credential/presentation/api/{05-evaluate-dcql-query.d.ts → 06-evaluate-dcql-query.d.ts} +1 -1
- package/lib/typescript/credential/presentation/api/{05-evaluate-dcql-query.d.ts.map → 06-evaluate-dcql-query.d.ts.map} +1 -1
- package/lib/typescript/credential/presentation/api/{06-send-authorization-response.d.ts → 07-send-authorization-response.d.ts} +2 -2
- package/lib/typescript/credential/presentation/api/{06-send-authorization-response.d.ts.map → 07-send-authorization-response.d.ts.map} +1 -1
- package/lib/typescript/credential/presentation/api/index.d.ts +5 -4
- package/lib/typescript/credential/presentation/api/index.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.0.0/04-verify-certificate-chain.d.ts +3 -0
- package/lib/typescript/credential/presentation/v1.0.0/04-verify-certificate-chain.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/v1.0.0/{04-verify-request-object.d.ts → 05-verify-request-object.d.ts} +1 -1
- package/lib/typescript/credential/presentation/v1.0.0/05-verify-request-object.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/v1.0.0/{05-evaluate-dcql-query.d.ts → 06-evaluate-dcql-query.d.ts} +1 -1
- package/lib/typescript/credential/presentation/v1.0.0/06-evaluate-dcql-query.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/v1.0.0/{06-send-authorization-response.d.ts → 07-send-authorization-response.d.ts} +1 -1
- package/lib/typescript/credential/presentation/v1.0.0/{06-send-authorization-response.d.ts.map → 07-send-authorization-response.d.ts.map} +1 -1
- package/lib/typescript/credential/presentation/v1.0.0/index.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/v1.3.3/04-verify-certificate-chain.d.ts +3 -0
- package/lib/typescript/credential/presentation/v1.3.3/04-verify-certificate-chain.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/v1.3.3/{04-verify-request-object.d.ts → 05-verify-request-object.d.ts} +1 -1
- package/lib/typescript/credential/presentation/v1.3.3/05-verify-request-object.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/v1.3.3/{05-evaluate-dcql-query.d.ts → 06-evaluate-dcql-query.d.ts} +1 -1
- package/lib/typescript/credential/presentation/v1.3.3/06-evaluate-dcql-query.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/v1.3.3/{06-send-authorization-response.d.ts → 07-send-authorization-response.d.ts} +1 -1
- package/lib/typescript/credential/presentation/v1.3.3/{06-send-authorization-response.d.ts.map → 07-send-authorization-response.d.ts.map} +1 -1
- package/lib/typescript/credential/presentation/v1.3.3/index.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts +24 -0
- package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/api/index.d.ts +22 -2
- package/lib/typescript/credentials-catalogue/api/index.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/v1.0.0/mappers.d.ts +12 -0
- package/lib/typescript/credentials-catalogue/v1.0.0/mappers.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/v1.3.3/fetch-translations.d.ts +3 -0
- package/lib/typescript/credentials-catalogue/v1.3.3/fetch-translations.d.ts.map +1 -0
- package/lib/typescript/credentials-catalogue/v1.3.3/index.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/v1.3.3/mappers.d.ts +14 -2
- package/lib/typescript/credentials-catalogue/v1.3.3/mappers.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/v1.3.3/types.d.ts +4 -4
- package/lib/typescript/credentials-catalogue/v1.3.3/utils.d.ts +11 -0
- package/lib/typescript/credentials-catalogue/v1.3.3/utils.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/credential/presentation/api/04-verify-certificate-chain.ts +20 -0
- package/src/credential/presentation/api/{06-send-authorization-response.ts → 07-send-authorization-response.ts} +1 -1
- package/src/credential/presentation/api/index.ts +5 -3
- package/src/credential/presentation/v1.0.0/04-verify-certificate-chain.ts +10 -0
- package/src/credential/presentation/v1.0.0/{05-evaluate-dcql-query.ts → 06-evaluate-dcql-query.ts} +1 -1
- package/src/credential/presentation/v1.0.0/index.ts +5 -3
- package/src/credential/presentation/v1.3.3/04-verify-certificate-chain.ts +49 -0
- package/src/credential/presentation/v1.3.3/{05-evaluate-dcql-query.ts → 06-evaluate-dcql-query.ts} +1 -1
- package/src/credential/presentation/v1.3.3/index.ts +5 -3
- package/src/credentials-catalogue/api/DigitalCredentialsCatalogue.ts +16 -0
- package/src/credentials-catalogue/api/index.ts +36 -2
- package/src/credentials-catalogue/v1.3.3/fetch-translations.ts +32 -0
- package/src/credentials-catalogue/v1.3.3/index.ts +2 -0
- package/src/credentials-catalogue/v1.3.3/mappers.ts +2 -0
- package/src/credentials-catalogue/v1.3.3/types.ts +2 -2
- package/src/credentials-catalogue/v1.3.3/utils.ts +33 -0
- package/lib/commonjs/credential/presentation/api/04-verify-request-object.js.map +0 -1
- package/lib/commonjs/credential/presentation/api/05-evaluate-dcql-query.js.map +0 -1
- package/lib/commonjs/credential/presentation/api/06-send-authorization-response.js.map +0 -1
- package/lib/module/credential/presentation/api/04-verify-request-object.js +0 -2
- package/lib/module/credential/presentation/api/04-verify-request-object.js.map +0 -1
- package/lib/module/credential/presentation/api/05-evaluate-dcql-query.js +0 -2
- package/lib/module/credential/presentation/api/05-evaluate-dcql-query.js.map +0 -1
- package/lib/module/credential/presentation/api/06-send-authorization-response.js +0 -2
- package/lib/module/credential/presentation/api/06-send-authorization-response.js.map +0 -1
- package/lib/typescript/credential/presentation/v1.0.0/04-verify-request-object.d.ts.map +0 -1
- package/lib/typescript/credential/presentation/v1.0.0/05-evaluate-dcql-query.d.ts.map +0 -1
- package/lib/typescript/credential/presentation/v1.3.3/04-verify-request-object.d.ts.map +0 -1
- package/lib/typescript/credential/presentation/v1.3.3/05-evaluate-dcql-query.d.ts.map +0 -1
- /package/src/credential/presentation/api/{04-verify-request-object.ts → 05-verify-request-object.ts} +0 -0
- /package/src/credential/presentation/api/{05-evaluate-dcql-query.ts → 06-evaluate-dcql-query.ts} +0 -0
- /package/src/credential/presentation/v1.0.0/{04-verify-request-object.ts → 05-verify-request-object.ts} +0 -0
- /package/src/credential/presentation/v1.0.0/{06-send-authorization-response.ts → 07-send-authorization-response.ts} +0 -0
- /package/src/credential/presentation/v1.3.3/{04-verify-request-object.ts → 05-verify-request-object.ts} +0 -0
- /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 "./
|
|
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 {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
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
|
+
};
|
package/src/credential/presentation/v1.0.0/{05-evaluate-dcql-query.ts → 06-evaluate-dcql-query.ts}
RENAMED
|
@@ -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/
|
|
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 {
|
|
6
|
-
import {
|
|
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 "./
|
|
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
|
+
};
|
package/src/credential/presentation/v1.3.3/{05-evaluate-dcql-query.ts → 06-evaluate-dcql-query.ts}
RENAMED
|
@@ -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/
|
|
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 {
|
|
6
|
-
import {
|
|
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 "./
|
|
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 {
|
|
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 {
|
|
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 +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 +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"}
|
/package/src/credential/presentation/api/{04-verify-request-object.ts → 05-verify-request-object.ts}
RENAMED
|
File without changes
|
/package/src/credential/presentation/api/{05-evaluate-dcql-query.ts → 06-evaluate-dcql-query.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|