@pagopa/io-react-native-wallet 1.6.2 → 1.7.1
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/issuance/07-verify-and-parse-credential.js +69 -35
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js +181 -0
- package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -0
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +3 -67
- package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js +98 -2
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/commonjs/credential/presentation/index.js +14 -1
- package/lib/commonjs/credential/presentation/index.js.map +1 -1
- package/lib/commonjs/credential/presentation/types.js +9 -2
- package/lib/commonjs/credential/presentation/types.js.map +1 -1
- package/lib/commonjs/mdoc/index.js +1 -1
- package/lib/commonjs/mdoc/index.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/index.test.js +24 -21
- package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/types.test.js +3 -0
- package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/types.js +4 -1
- package/lib/commonjs/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +469 -0
- package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +1 -0
- package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +90 -0
- package/lib/commonjs/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +1 -0
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js +67 -35
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js +175 -0
- package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -0
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +3 -66
- package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -1
- package/lib/module/credential/presentation/08-send-authorization-response.js +97 -2
- package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/module/credential/presentation/index.js +4 -3
- package/lib/module/credential/presentation/index.js.map +1 -1
- package/lib/module/credential/presentation/types.js +9 -2
- package/lib/module/credential/presentation/types.js.map +1 -1
- package/lib/module/mdoc/index.js +1 -1
- package/lib/module/mdoc/index.js.map +1 -1
- package/lib/module/sd-jwt/__test__/index.test.js +24 -21
- package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
- package/lib/module/sd-jwt/__test__/types.test.js +3 -0
- package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/module/sd-jwt/types.js +4 -1
- package/lib/module/sd-jwt/types.js.map +1 -1
- package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js +462 -0
- package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-inputs.js.map +1 -0
- package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js +83 -0
- package/lib/module/utils/credential/issuance/07-verify-and-parse-credentials-utils.js.map +1 -0
- package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts +12 -0
- package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts +27 -0
- package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +2 -28
- package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +23 -1
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/index.d.ts +6 -4
- package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/types.d.ts +26 -7
- package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/index.d.ts +12 -0
- package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/types.d.ts +15 -0
- package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts +3 -0
- package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts.map +1 -0
- package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts +42 -0
- package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts.map +1 -0
- package/package.json +3 -2
- package/src/credential/issuance/07-verify-and-parse-credential.ts +35 -3
- package/src/credential/presentation/07-evaluate-dcql-query.ts +228 -0
- package/src/credential/presentation/07-evaluate-input-descriptor.ts +6 -103
- package/src/credential/presentation/08-send-authorization-response.ts +137 -2
- package/src/credential/presentation/index.ts +12 -2
- package/src/credential/presentation/types.ts +33 -3
- package/src/mdoc/index.ts +1 -1
- package/src/sd-jwt/__test__/index.test.ts +45 -36
- package/src/sd-jwt/__test__/types.test.ts +3 -0
- package/src/sd-jwt/types.ts +3 -0
- package/src/utils/credential/issuance/07-verify-and-parse-credentials-inputs.ts +615 -0
- package/src/utils/credential/issuance/07-verify-and-parse-credentials-utils.ts +171 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"07-evaluate-input-descriptor.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/07-evaluate-input-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,
|
1
|
+
{"version":3,"file":"07-evaluate-input-descriptor.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/07-evaluate-input-descriptor.ts"],"names":[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AAM,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC;IAChB,WAAW,EAAE,qBAAqB,EAAE,CAAC;CACtC,CAAC;AA2HF;;;;;;;;;GASG;AACH,eAAO,MAAM,8BAA8B,EAAE,2BAkE5C,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kCAAkC,EAAE,+BA6E9C,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,oBACb,eAAe,2BACP,sBAAsB,EAAE,KAChD;IACD,iBAAiB,EAAE,oBAAoB,CAAC;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;CA6B3B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,oBACZ,eAAe,0BACR,qBAAqB,EAAE,KAC9C;IACD,iBAAiB,EAAE,oBAAoB,CAAC;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;CAuB3B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,wBAAwB,EAAE,wBAuEtC,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { FetchJwks } from "./04-retrieve-rp-jwks";
|
2
2
|
import type { VerifyRequestObjectSignature } from "./05-verify-request-object";
|
3
3
|
import { type Out } from "../../utils/misc";
|
4
|
-
import { DirectAuthorizationBodyPayload, ErrorResponse, type RemotePresentation } from "./types";
|
4
|
+
import { DirectAuthorizationBodyPayload, ErrorResponse, type RemotePresentation, type PrepareRemotePresentations } from "./types";
|
5
5
|
import * as z from "zod";
|
6
6
|
import type { JWK } from "../../utils/jwk";
|
7
7
|
export type AuthorizationResponse = z.infer<typeof AuthorizationResponse>;
|
@@ -56,6 +56,13 @@ export declare const buildDirectPostJwtBody: (jwkKeys: Out<FetchJwks>["keys"], r
|
|
56
56
|
export type SendAuthorizationResponse = (requestObject: Out<VerifyRequestObjectSignature>["requestObject"], presentationDefinitionId: string, jwkKeys: Out<FetchJwks>["keys"], remotePresentation: RemotePresentation, context?: {
|
57
57
|
appFetch?: GlobalFetch["fetch"];
|
58
58
|
}) => Promise<AuthorizationResponse>;
|
59
|
+
/**
|
60
|
+
* Type definition for the function that sends the authorization response
|
61
|
+
* to the Relying Party, completing the presentation flow.
|
62
|
+
*/
|
63
|
+
export type SendAuthorizationResponseDcql = (requestObject: Out<VerifyRequestObjectSignature>["requestObject"], jwkKeys: Out<FetchJwks>["keys"], remotePresentation: RemotePresentation, context?: {
|
64
|
+
appFetch?: GlobalFetch["fetch"];
|
65
|
+
}) => Promise<AuthorizationResponse>;
|
59
66
|
/**
|
60
67
|
* Sends the authorization response to the Relying Party (RP) using the specified `response_mode`.
|
61
68
|
* This function completes the presentation flow in an OpenID 4 Verifiable Presentations scenario.
|
@@ -86,4 +93,19 @@ export type SendAuthorizationErrorResponse = (requestObject: Out<VerifyRequestOb
|
|
86
93
|
* @returns Parsed and validated authorization response from the Relying Party.
|
87
94
|
*/
|
88
95
|
export declare const sendAuthorizationErrorResponse: SendAuthorizationErrorResponse;
|
96
|
+
export declare const sendAuthorizationResponseDcql: SendAuthorizationResponseDcql;
|
97
|
+
/**
|
98
|
+
* Prepares remote presentations for a set of credentials.
|
99
|
+
*
|
100
|
+
* For each credential, this function:
|
101
|
+
* - Validates the credential format (currently supports 'mso_mdoc' and 'vc+sd-jwt').
|
102
|
+
* - Generates a verifiable presentation token (vpToken) using the appropriate method.
|
103
|
+
* - For ISO 18013-7, generates a special nonce with minimum entropy of 16.
|
104
|
+
*
|
105
|
+
* @param credentials - An array of credential items containing format, credential data, requested claims, and key information.
|
106
|
+
* @param authRequestObject - The authentication request object containing nonce, clientId, and responseUri.
|
107
|
+
* @returns A promise that resolves to an object containing an array of presentations and the generated nonce.
|
108
|
+
* @throws {CredentialNotFoundError} When the credential format is unsupported.
|
109
|
+
*/
|
110
|
+
export declare const prepareRemotePresentations: PrepareRemotePresentations;
|
89
111
|
//# sourceMappingURL=08-send-authorization-response.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"08-send-authorization-response.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/08-send-authorization-response.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;
|
1
|
+
{"version":3,"file":"08-send-authorization-response.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/08-send-authorization-response.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAK/E,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EACL,8BAA8B,EAC9B,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAChC,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAQ3C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC1E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAUhC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,cACxB,IAAI,SAAS,CAAC,CAAC,MAAM,CAAC,KAChC,GAsBF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,kBACf,IAAI,4BAA4B,CAAC,CAAC,eAAe,CAAC,WACxD,8BAA8B,KACtC,QAAQ,MAAM,CAgBhB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,YACxB,IAAI,SAAS,CAAC,CAAC,MAAM,CAAC,iBAChB,IAAI,4BAA4B,CAAC,CA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AE,6BAmCzC,CAAC;AAEJ;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B,EAAE,0BA6DxC,CAAC"}
|
@@ -4,9 +4,11 @@ import { getRequestObject, type GetRequestObject } from "./03-get-request-object
|
|
4
4
|
import { fetchJwksFromRequestObject, fetchJwksFromConfig, type FetchJwks } from "./04-retrieve-rp-jwks";
|
5
5
|
import { verifyRequestObjectSignature, type VerifyRequestObjectSignature } from "./05-verify-request-object";
|
6
6
|
import { fetchPresentDefinition, type FetchPresentationDefinition } from "./06-fetch-presentation-definition";
|
7
|
-
import { evaluateInputDescriptors,
|
8
|
-
import {
|
7
|
+
import { evaluateInputDescriptors, type EvaluateInputDescriptors } from "./07-evaluate-input-descriptor";
|
8
|
+
import { evaluateDcqlQuery, type EvaluateDcqlQuery } from "./07-evaluate-dcql-query";
|
9
|
+
import { prepareRemotePresentations, sendAuthorizationResponse, type SendAuthorizationResponse, sendAuthorizationErrorResponse, type SendAuthorizationErrorResponse, sendAuthorizationResponseDcql, type SendAuthorizationResponseDcql } from "./08-send-authorization-response";
|
9
10
|
import * as Errors from "./errors";
|
10
|
-
|
11
|
-
export
|
11
|
+
import type { PrepareRemotePresentations } from "./types";
|
12
|
+
export { startFlowFromQR, evaluateRelyingPartyTrust, getRequestObject, fetchJwksFromRequestObject, fetchJwksFromConfig, verifyRequestObjectSignature, fetchPresentDefinition, evaluateInputDescriptors, evaluateDcqlQuery, sendAuthorizationResponse, sendAuthorizationErrorResponse, sendAuthorizationResponseDcql, prepareRemotePresentations, Errors, };
|
13
|
+
export type { StartFlow, EvaluateRelyingPartyTrust, GetRequestObject, FetchJwks, VerifyRequestObjectSignature, FetchPresentationDefinition, EvaluateInputDescriptors, PrepareRemotePresentations, SendAuthorizationResponse, SendAuthorizationResponseDcql, SendAuthorizationErrorResponse, EvaluateDcqlQuery, };
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EACL,yBAAyB,EACzB,KAAK,yBAAyB,EAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,gBAAgB,EAChB,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,4BAA4B,EAC5B,KAAK,4BAA4B,EAClC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,KAAK,2BAA2B,EACjC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,wBAAwB,EACxB,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EACL,yBAAyB,EACzB,KAAK,yBAAyB,EAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,gBAAgB,EAChB,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,4BAA4B,EAC5B,KAAK,4BAA4B,EAClC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,KAAK,2BAA2B,EACjC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,wBAAwB,EACxB,KAAK,wBAAwB,EAC9B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,iBAAiB,EACjB,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,KAAK,yBAAyB,EAC9B,8BAA8B,EAC9B,KAAK,8BAA8B,EACnC,6BAA6B,EAC7B,KAAK,6BAA6B,EACnC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAE1D,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,gBAAgB,EAChB,0BAA0B,EAC1B,mBAAmB,EACnB,4BAA4B,EAC5B,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,yBAAyB,EACzB,8BAA8B,EAC9B,6BAA6B,EAC7B,0BAA0B,EAC1B,MAAM,GACP,CAAC;AACF,YAAY,EACV,SAAS,EACT,yBAAyB,EACzB,gBAAgB,EAChB,SAAS,EACT,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,0BAA0B,EAC1B,yBAAyB,EACzB,6BAA6B,EAC7B,8BAA8B,EAC9B,iBAAiB,GAClB,CAAC"}
|
@@ -5,6 +5,12 @@ export type EvaluatedDisclosure = {
|
|
5
5
|
name: string;
|
6
6
|
value: unknown;
|
7
7
|
};
|
8
|
+
export type CredentialFormat = {
|
9
|
+
format: "vc+sd-jwt";
|
10
|
+
} | {
|
11
|
+
format: "mso_mdoc";
|
12
|
+
doctype: string;
|
13
|
+
};
|
8
14
|
/**
|
9
15
|
* A pair that associate a tokenized Verified Credential with the claims presented or requested to present.
|
10
16
|
*/
|
@@ -19,12 +25,22 @@ export type Presentation = [
|
|
19
25
|
export type RemotePresentation = {
|
20
26
|
presentations: {
|
21
27
|
requestedClaims: string[];
|
22
|
-
|
28
|
+
credentialId: string;
|
23
29
|
format: string;
|
24
30
|
vpToken: string;
|
25
31
|
}[];
|
26
32
|
generatedNonce?: string;
|
27
33
|
};
|
34
|
+
export type PrepareRemotePresentations = (credentials: ({
|
35
|
+
requestedClaims: EvaluatedDisclosure[];
|
36
|
+
credentialInputId: string;
|
37
|
+
credential: string;
|
38
|
+
keyTag: string;
|
39
|
+
} & CredentialFormat)[], authRequestObject: {
|
40
|
+
nonce: string;
|
41
|
+
clientId: string;
|
42
|
+
responseUri: string;
|
43
|
+
}) => Promise<RemotePresentation>;
|
28
44
|
export type InputDescriptor = z.infer<typeof InputDescriptor>;
|
29
45
|
export declare const InputDescriptor: z.ZodObject<{
|
30
46
|
id: z.ZodString;
|
@@ -536,6 +552,7 @@ export declare const RequestObject: z.ZodObject<{
|
|
536
552
|
}[];
|
537
553
|
} | undefined;
|
538
554
|
}>>;
|
555
|
+
dcql_query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
539
556
|
scope: z.ZodOptional<z.ZodString>;
|
540
557
|
presentation_definition: z.ZodOptional<z.ZodObject<{
|
541
558
|
id: z.ZodString;
|
@@ -796,6 +813,7 @@ export declare const RequestObject: z.ZodObject<{
|
|
796
813
|
}[];
|
797
814
|
} | undefined;
|
798
815
|
} | undefined;
|
816
|
+
dcql_query?: Record<string, any> | undefined;
|
799
817
|
scope?: string | undefined;
|
800
818
|
presentation_definition?: {
|
801
819
|
id: string;
|
@@ -876,6 +894,7 @@ export declare const RequestObject: z.ZodObject<{
|
|
876
894
|
}[];
|
877
895
|
} | undefined;
|
878
896
|
} | undefined;
|
897
|
+
dcql_query?: Record<string, any> | undefined;
|
879
898
|
scope?: string | undefined;
|
880
899
|
presentation_definition?: {
|
881
900
|
id: string;
|
@@ -926,14 +945,14 @@ export declare const ErrorResponse: z.ZodEnum<["invalid_scope", "invalid_request
|
|
926
945
|
*/
|
927
946
|
export type DirectAuthorizationBodyPayload = z.infer<typeof DirectAuthorizationBodyPayload>;
|
928
947
|
export declare const DirectAuthorizationBodyPayload: z.ZodUnion<[z.ZodObject<{
|
929
|
-
vp_token: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
930
|
-
presentation_submission: z.ZodRecord<z.ZodString, z.ZodUnknown
|
948
|
+
vp_token: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
949
|
+
presentation_submission: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
931
950
|
}, "strip", z.ZodTypeAny, {
|
932
|
-
|
933
|
-
|
951
|
+
vp_token?: string | string[] | Record<string, string> | undefined;
|
952
|
+
presentation_submission?: Record<string, unknown> | undefined;
|
934
953
|
}, {
|
935
|
-
|
936
|
-
|
954
|
+
vp_token?: string | string[] | Record<string, string> | undefined;
|
955
|
+
presentation_submission?: Record<string, unknown> | undefined;
|
937
956
|
}>, z.ZodObject<{
|
938
957
|
error: z.ZodEnum<["invalid_scope", "invalid_request", "invalid_client", "access_denied"]>;
|
939
958
|
}, "strip", z.ZodTypeAny, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACO,MAAM;IACzB,mBAAmB,EAAE;IACyB,aAAa;CACzE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,aAAa,EAAE;QACb,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,KAAK,CAAC,M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GAGG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,eAAO,MAAM,aAAa,oFAKxB,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,8BAA8B,CACtC,CAAC;AACF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;IAYzC,CAAC"}
|
@@ -62,6 +62,9 @@ export declare const decode: <S extends z.ZodType<{
|
|
62
62
|
};
|
63
63
|
sub: string;
|
64
64
|
_sd_alg: "sha-256";
|
65
|
+
expiry_date: string;
|
66
|
+
issuing_authority: string;
|
67
|
+
issuing_country: string;
|
65
68
|
iat?: number | undefined;
|
66
69
|
"vct#integrity"?: string | undefined;
|
67
70
|
verification?: {
|
@@ -119,6 +122,9 @@ export declare const decode: <S extends z.ZodType<{
|
|
119
122
|
};
|
120
123
|
sub: string;
|
121
124
|
_sd_alg: "sha-256";
|
125
|
+
expiry_date: string;
|
126
|
+
issuing_authority: string;
|
127
|
+
issuing_country: string;
|
122
128
|
iat?: number | undefined;
|
123
129
|
"vct#integrity"?: string | undefined;
|
124
130
|
verification?: {
|
@@ -216,6 +222,9 @@ export declare const verify: <S extends z.ZodType<{
|
|
216
222
|
};
|
217
223
|
sub: string;
|
218
224
|
_sd_alg: "sha-256";
|
225
|
+
expiry_date: string;
|
226
|
+
issuing_authority: string;
|
227
|
+
issuing_country: string;
|
219
228
|
iat?: number | undefined;
|
220
229
|
"vct#integrity"?: string | undefined;
|
221
230
|
verification?: {
|
@@ -273,6 +282,9 @@ export declare const verify: <S extends z.ZodType<{
|
|
273
282
|
};
|
274
283
|
sub: string;
|
275
284
|
_sd_alg: "sha-256";
|
285
|
+
expiry_date: string;
|
286
|
+
issuing_authority: string;
|
287
|
+
issuing_country: string;
|
276
288
|
iat?: number | undefined;
|
277
289
|
"vct#integrity"?: string | undefined;
|
278
290
|
verification?: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sd-jwt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE3E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAQrE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sd-jwt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE3E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAQrE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WACV,MAAM;;iBAIA,qBAAqB,EAAE;CA0BrC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ,UACZ,MAAM,UACL,MAAM,EAAE;WACE,MAAM;WAAS;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE;EAwCnE,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WACV,MAAM,aACF,GAAG,GAAG,GAAG,EAAE;;iBAEqB,UAAU,EAAE;EAqBxD,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,UAClB,MAAM,aACF,MAAM;cAGP,MAAM;EA6BjB,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC"}
|
@@ -244,6 +244,9 @@ export declare const SdJwt4VC: z.ZodObject<{
|
|
244
244
|
method: string;
|
245
245
|
};
|
246
246
|
}>>;
|
247
|
+
expiry_date: z.ZodEffects<z.ZodString, string, string>;
|
248
|
+
issuing_authority: z.ZodString;
|
249
|
+
issuing_country: z.ZodString;
|
247
250
|
}, "strip", z.ZodTypeAny, {
|
248
251
|
iss: string;
|
249
252
|
status: {
|
@@ -281,6 +284,9 @@ export declare const SdJwt4VC: z.ZodObject<{
|
|
281
284
|
};
|
282
285
|
sub: string;
|
283
286
|
_sd_alg: "sha-256";
|
287
|
+
expiry_date: string;
|
288
|
+
issuing_authority: string;
|
289
|
+
issuing_country: string;
|
284
290
|
iat?: number | undefined;
|
285
291
|
"vct#integrity"?: string | undefined;
|
286
292
|
verification?: {
|
@@ -327,6 +333,9 @@ export declare const SdJwt4VC: z.ZodObject<{
|
|
327
333
|
};
|
328
334
|
sub: string;
|
329
335
|
_sd_alg: "sha-256";
|
336
|
+
expiry_date: string;
|
337
|
+
issuing_authority: string;
|
338
|
+
issuing_country: string;
|
330
339
|
iat?: number | undefined;
|
331
340
|
"vct#integrity"?: string | undefined;
|
332
341
|
verification?: {
|
@@ -388,6 +397,9 @@ export declare const SdJwt4VC: z.ZodObject<{
|
|
388
397
|
};
|
389
398
|
sub: string;
|
390
399
|
_sd_alg: "sha-256";
|
400
|
+
expiry_date: string;
|
401
|
+
issuing_authority: string;
|
402
|
+
issuing_country: string;
|
391
403
|
iat?: number | undefined;
|
392
404
|
"vct#integrity"?: string | undefined;
|
393
405
|
verification?: {
|
@@ -445,6 +457,9 @@ export declare const SdJwt4VC: z.ZodObject<{
|
|
445
457
|
};
|
446
458
|
sub: string;
|
447
459
|
_sd_alg: "sha-256";
|
460
|
+
expiry_date: string;
|
461
|
+
issuing_authority: string;
|
462
|
+
issuing_country: string;
|
448
463
|
iat?: number | undefined;
|
449
464
|
"vct#integrity"?: string | undefined;
|
450
465
|
verification?: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/sd-jwt/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,QAAQ,aAAuC,CAAC;AAC7D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC1E,eAAO,MAAM,qBAAqB;;;;;;EAAyC,CAAC;AAE5E;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AACpD,eAAO,MAAM,UAAU,4DAIrB,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,UAAU,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACxD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;EAMvB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCnB,CAAC"}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { type TestScenario, type ParseCredentialArg, type ParseCredentialReturn } from "./07-verify-and-parse-credentials-utils";
|
2
|
+
export declare const inputs: TestScenario<ParseCredentialArg, ParseCredentialReturn, Error>[];
|
3
|
+
//# sourceMappingURL=07-verify-and-parse-credentials-inputs.d.ts.map
|
package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-inputs.d.ts.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"07-verify-and-parse-credentials-inputs.d.ts","sourceRoot":"","sources":["../../../../../src/utils/credential/issuance/07-verify-and-parse-credentials-inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAG3B,MAAM,yCAAyC,CAAC;AAGjD,eAAO,MAAM,MAAM,EAAE,YAAY,CAC/B,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,CACN,EAylBA,CAAC"}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import type { parseCredentialMDoc, parseCredentialSdJwt } from "src/credential/issuance/07-verify-and-parse-credential";
|
2
|
+
export type TestScenario<T extends object, R extends object, E extends Error> = {
|
3
|
+
name: string;
|
4
|
+
input: T;
|
5
|
+
expected?: R;
|
6
|
+
throws?: E;
|
7
|
+
};
|
8
|
+
export type ParseCredentialArg = {
|
9
|
+
format: "vc+sd-jwt";
|
10
|
+
parameters: Parameters<typeof parseCredentialSdJwt>;
|
11
|
+
} | {
|
12
|
+
format: "mso_mdoc";
|
13
|
+
parameters: Parameters<typeof parseCredentialMDoc>;
|
14
|
+
};
|
15
|
+
export type ClaimsSdJwt = Record<string, {
|
16
|
+
display: {
|
17
|
+
name: string;
|
18
|
+
locale: string;
|
19
|
+
}[];
|
20
|
+
mandatory: boolean;
|
21
|
+
}> | Record<string, Record<string, {
|
22
|
+
display: {
|
23
|
+
name: string;
|
24
|
+
locale: string;
|
25
|
+
}[];
|
26
|
+
mandatory: boolean;
|
27
|
+
}>>;
|
28
|
+
export type ClaimsMDOC = Record<string, {
|
29
|
+
display: {
|
30
|
+
name: string;
|
31
|
+
locale: string;
|
32
|
+
}[];
|
33
|
+
mandatory: boolean;
|
34
|
+
}>;
|
35
|
+
export type ParseCredentialReturn = Record<string, {
|
36
|
+
name?: string | Record<string, string>;
|
37
|
+
value: unknown;
|
38
|
+
mandatory?: boolean;
|
39
|
+
}>;
|
40
|
+
export declare function buildMockMDOCTestScenario(claims: ClaimsMDOC, nameSpaces: [string, any][]): Parameters<typeof parseCredentialMDoc>;
|
41
|
+
export declare function buildMockSDJWTTestScenario(claims: ClaimsSdJwt, disclosures: [string, string, unknown][]): Parameters<typeof parseCredentialSdJwt>;
|
42
|
+
//# sourceMappingURL=07-verify-and-parse-credentials-utils.d.ts.map
|
package/lib/typescript/utils/credential/issuance/07-verify-and-parse-credentials-utils.d.ts.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"07-verify-and-parse-credentials-utils.d.ts","sourceRoot":"","sources":["../../../../../src/utils/credential/issuance/07-verify-and-parse-credentials-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,wDAAwD,CAAC;AAEhE,MAAM,MAAM,YAAY,CACtB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,KAAK,IACb;IACF,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,CAAC,EAAE,CAAC,CAAC;IACb,MAAM,CAAC,EAAE,CAAC,C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B,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GACvC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CA4CzC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pagopa/io-react-native-wallet",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.7.1",
|
4
4
|
"description": "Provide data structures, helpers and API for IO Wallet",
|
5
5
|
"main": "lib/commonjs/index",
|
6
6
|
"module": "lib/module/index",
|
@@ -55,7 +55,7 @@
|
|
55
55
|
"devDependencies": {
|
56
56
|
"@pagopa/io-react-native-crypto": "^0.2.3",
|
57
57
|
"@pagopa/io-react-native-jwt": "^2.1.0",
|
58
|
-
"@pagopa/io-react-native-cbor": "^1.
|
58
|
+
"@pagopa/io-react-native-cbor": "^1.4.0",
|
59
59
|
"@react-native/eslint-config": "^0.75.5",
|
60
60
|
"@rushstack/eslint-patch": "^1.3.2",
|
61
61
|
"@types/jest": "^28.1.2",
|
@@ -115,6 +115,7 @@
|
|
115
115
|
"dependencies": {
|
116
116
|
"@types/jsrsasign": "^10.5.15",
|
117
117
|
"ajv": "^8.17.1",
|
118
|
+
"dcql": "^0.2.22",
|
118
119
|
"js-base64": "^3.7.7",
|
119
120
|
"js-sha256": "^0.9.0",
|
120
121
|
"jsonpath-plus": "^10.3.0",
|
@@ -64,7 +64,8 @@ type DecodedMDocCredential = Out<typeof verifyMdoc> & {
|
|
64
64
|
issuerSigned: CBOR.IssuerSigned;
|
65
65
|
};
|
66
66
|
|
67
|
-
|
67
|
+
//Exported for testing purposes
|
68
|
+
export const parseCredentialSdJwt = (
|
68
69
|
// the list of supported credentials, as defined in the issuer configuration
|
69
70
|
credentials_supported: Out<GetIssuerConfig>["issuerConf"]["credential_configurations_supported"],
|
70
71
|
{ sdJwt, disclosures }: DecodedSdJwtCredential,
|
@@ -92,7 +93,8 @@ const parseCredentialSdJwt = (
|
|
92
93
|
|
93
94
|
// the key of the attribute defintion must match the disclosure's name
|
94
95
|
const attrsNotInDisclosures = attrDefinitions.filter(
|
95
|
-
([attrKey
|
96
|
+
([attrKey, definition]) =>
|
97
|
+
!disclosures.some(([, name]) => name === attrKey) && definition.mandatory
|
96
98
|
);
|
97
99
|
if (attrsNotInDisclosures.length > 0) {
|
98
100
|
const missing = attrsNotInDisclosures.map((_) => _[0 /* key */]).join(", ");
|
@@ -121,6 +123,8 @@ const parseCredentialSdJwt = (
|
|
121
123
|
},
|
122
124
|
] as const
|
123
125
|
)
|
126
|
+
//filter the not found elements
|
127
|
+
.filter(([_, definition]) => definition.value !== undefined)
|
124
128
|
// add a human readable attribute name, with i18n, in the form { locale: name }
|
125
129
|
// example: { "it-IT": "Nome", "en-EN": "Name", "es-ES": "Nombre" }
|
126
130
|
.map(
|
@@ -155,11 +159,13 @@ const parseCredentialSdJwt = (
|
|
155
159
|
return definedValues;
|
156
160
|
};
|
157
161
|
|
158
|
-
|
162
|
+
//Exported for testing purposes
|
163
|
+
export const parseCredentialMDoc = (
|
159
164
|
// the list of supported credentials, as defined in the issuer configuration
|
160
165
|
credentials_supported: Out<GetIssuerConfig>["issuerConf"]["credential_configurations_supported"],
|
161
166
|
credential_type: string,
|
162
167
|
{ issuerSigned }: DecodedMDocCredential,
|
168
|
+
ignoreMissingAttributes: boolean = false,
|
163
169
|
includeUndefinedAttributes: boolean = false
|
164
170
|
): ParsedCredential => {
|
165
171
|
const credentialSubject = credentials_supported[credential_type];
|
@@ -208,6 +214,29 @@ const parseCredentialMDoc = (
|
|
208
214
|
)
|
209
215
|
);
|
210
216
|
|
217
|
+
// Check that all mandatory attributes defined in the issuer configuration are present in the disclosure set
|
218
|
+
// and filter the non present ones
|
219
|
+
const attrsNotInDisclosures = attrDefinitions.filter(
|
220
|
+
([attrDefNamespace, attrKey, definition]) => {
|
221
|
+
const isClaimPresent = flatNamespaces.find(
|
222
|
+
([namespace, name]) =>
|
223
|
+
attrDefNamespace === namespace && name === attrKey
|
224
|
+
);
|
225
|
+
return isClaimPresent === undefined && definition.mandatory;
|
226
|
+
}
|
227
|
+
);
|
228
|
+
if (attrsNotInDisclosures.length > 0) {
|
229
|
+
const missing = attrsNotInDisclosures
|
230
|
+
.map((_) => _[1 /* claim key */])
|
231
|
+
.join(", ");
|
232
|
+
const received = flatNamespaces.map((_) => _[1 /*name*/]);
|
233
|
+
if (!ignoreMissingAttributes) {
|
234
|
+
throw new IoWalletError(
|
235
|
+
`Some attributes are missing in the credential. Missing: [${missing}], received: [${received}]`
|
236
|
+
);
|
237
|
+
}
|
238
|
+
}
|
239
|
+
|
211
240
|
// Attributes defined in the issuer configuration and present in the disclosure set
|
212
241
|
const definedValues = Object.fromEntries(
|
213
242
|
attrDefinitions
|
@@ -225,6 +254,8 @@ const parseCredentialMDoc = (
|
|
225
254
|
},
|
226
255
|
] as const
|
227
256
|
)
|
257
|
+
//filter the not found elements
|
258
|
+
.filter(([_, definition]) => definition.value !== undefined)
|
228
259
|
// Add a human-readable attribute name, with i18n, in the form { locale: name }
|
229
260
|
// Example: { "it-IT": "Nome", "en-EN": "Name", "es-ES": "Nombre" }
|
230
261
|
.map(
|
@@ -410,6 +441,7 @@ const verifyAndParseCredentialMDoc: WithFormat<"mso_mdoc"> = async (
|
|
410
441
|
issuerConf.credential_configurations_supported,
|
411
442
|
credentialType,
|
412
443
|
decoded,
|
444
|
+
undefined,
|
413
445
|
ignoreMissingAttributes
|
414
446
|
);
|
415
447
|
|