@pagopa/io-react-native-wallet 3.5.1 → 3.6.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/api/IssuerConfig.js +1 -1
- package/lib/commonjs/credential/issuance/api/IssuerConfig.js.map +1 -1
- package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.mdoc.js +8 -3
- package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.mdoc.js.map +1 -1
- package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js +6 -4
- package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js.map +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/mappers.js +1 -1
- package/lib/commonjs/credential/issuance/v1.3.3/mappers.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js +3 -1
- package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/mappers.js +6 -3
- package/lib/commonjs/credentials-catalogue/v1.3.3/mappers.js.map +1 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/types.js +2 -1
- package/lib/commonjs/credentials-catalogue/v1.3.3/types.js.map +1 -1
- package/lib/commonjs/mdoc/const.js +3 -1
- package/lib/commonjs/mdoc/const.js.map +1 -1
- package/lib/commonjs/mdoc/utils.js +5 -5
- package/lib/commonjs/mdoc/utils.js.map +1 -1
- package/lib/module/credential/issuance/api/IssuerConfig.js +1 -1
- package/lib/module/credential/issuance/api/IssuerConfig.js.map +1 -1
- package/lib/module/credential/issuance/common/06-verify-and-parse-credential.mdoc.js +8 -3
- package/lib/module/credential/issuance/common/06-verify-and-parse-credential.mdoc.js.map +1 -1
- package/lib/module/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js +6 -4
- package/lib/module/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js.map +1 -1
- package/lib/module/credential/issuance/v1.3.3/mappers.js +1 -1
- package/lib/module/credential/issuance/v1.3.3/mappers.js.map +1 -1
- package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js +3 -1
- package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
- package/lib/module/credentials-catalogue/v1.3.3/mappers.js +6 -3
- package/lib/module/credentials-catalogue/v1.3.3/mappers.js.map +1 -1
- package/lib/module/credentials-catalogue/v1.3.3/types.js +2 -1
- package/lib/module/credentials-catalogue/v1.3.3/types.js.map +1 -1
- package/lib/module/mdoc/const.js +1 -0
- package/lib/module/mdoc/const.js.map +1 -1
- package/lib/module/mdoc/utils.js +6 -6
- package/lib/module/mdoc/utils.js.map +1 -1
- package/lib/typescript/credential/issuance/api/IssuerConfig.d.ts +2 -2
- package/lib/typescript/credential/issuance/common/06-verify-and-parse-credential.mdoc.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/common/06-verify-and-parse-credential.sdjwt.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/v1.0.0/mappers.d.ts +2 -2
- package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts +2 -2
- package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts +5 -0
- package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/v1.0.0/mappers.d.ts +2 -0
- package/lib/typescript/credentials-catalogue/v1.0.0/mappers.d.ts.map +1 -1
- package/lib/typescript/credentials-catalogue/v1.3.3/mappers.d.ts +7 -4
- 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 +6 -4
- package/lib/typescript/credentials-catalogue/v1.3.3/types.d.ts.map +1 -1
- package/lib/typescript/mdoc/const.d.ts +1 -0
- package/lib/typescript/mdoc/const.d.ts.map +1 -1
- package/lib/typescript/mdoc/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/credential/issuance/api/IssuerConfig.ts +1 -1
- package/src/credential/issuance/common/06-verify-and-parse-credential.mdoc.ts +19 -3
- package/src/credential/issuance/common/06-verify-and-parse-credential.sdjwt.ts +14 -4
- package/src/credential/issuance/v1.3.3/mappers.ts +1 -1
- package/src/credentials-catalogue/api/DigitalCredentialsCatalogue.ts +2 -0
- package/src/credentials-catalogue/v1.3.3/mappers.ts +9 -2
- package/src/credentials-catalogue/v1.3.3/types.ts +4 -6
- package/src/mdoc/const.ts +1 -0
- package/src/mdoc/utils.ts +11 -8
|
@@ -72,10 +72,6 @@ export declare const mapToCredentialsCatalogue: (input: [{
|
|
|
72
72
|
deferred_flow: boolean;
|
|
73
73
|
} | undefined;
|
|
74
74
|
}[];
|
|
75
|
-
authentic_sources: {
|
|
76
|
-
id: string;
|
|
77
|
-
dataset_id: string;
|
|
78
|
-
}[];
|
|
79
75
|
restriction_policy?: {
|
|
80
76
|
presentation_flows: {
|
|
81
77
|
remote: boolean;
|
|
@@ -90,6 +86,11 @@ export declare const mapToCredentialsCatalogue: (input: [{
|
|
|
90
86
|
} | undefined;
|
|
91
87
|
domains?: string[] | undefined;
|
|
92
88
|
classes?: string[] | undefined;
|
|
89
|
+
authentic_sources?: {
|
|
90
|
+
id: string;
|
|
91
|
+
dataset_id: string;
|
|
92
|
+
}[] | undefined;
|
|
93
|
+
parent_credentials?: string[] | undefined;
|
|
93
94
|
}[];
|
|
94
95
|
iat: number;
|
|
95
96
|
exp: number;
|
|
@@ -248,6 +249,7 @@ export declare const mapToCredentialsCatalogue: (input: [{
|
|
|
248
249
|
homepage_uri?: string | undefined;
|
|
249
250
|
logo_uri?: string | undefined;
|
|
250
251
|
user_information?: string | undefined;
|
|
252
|
+
user_information_l10n_id?: string | undefined;
|
|
251
253
|
}[];
|
|
252
254
|
name?: string | undefined;
|
|
253
255
|
name_l10n_id?: string | undefined;
|
|
@@ -264,6 +266,7 @@ export declare const mapToCredentialsCatalogue: (input: [{
|
|
|
264
266
|
} | undefined;
|
|
265
267
|
domains?: string[] | undefined;
|
|
266
268
|
classes?: string[] | undefined;
|
|
269
|
+
parent_credentials?: string[] | undefined;
|
|
267
270
|
formats?: {
|
|
268
271
|
configuration_id: string;
|
|
269
272
|
format: "dc+sd-jwt" | "mso_mdoc";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../../../../src/credentials-catalogue/v1.3.3/mappers.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../../../../src/credentials-catalogue/v1.3.3/mappers.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyFrC,CAAC"}
|
|
@@ -112,10 +112,11 @@ export declare const DigitalCredential: z.ZodObject<{
|
|
|
112
112
|
deferred_flow: z.ZodBoolean;
|
|
113
113
|
}, z.core.$strip>>;
|
|
114
114
|
}, z.core.$strip>>;
|
|
115
|
-
authentic_sources: z.ZodArray<z.ZodObject<{
|
|
115
|
+
authentic_sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
116
116
|
id: z.ZodString;
|
|
117
117
|
dataset_id: z.ZodString;
|
|
118
|
-
}, z.core.$strip
|
|
118
|
+
}, z.core.$strip>>>;
|
|
119
|
+
parent_credentials: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
119
120
|
}, z.core.$strip>;
|
|
120
121
|
/**
|
|
121
122
|
* Schema registry, available at a dedicated endpoint.
|
|
@@ -276,10 +277,11 @@ export declare const DigitalCredentialsCatalogueJwt: z.ZodObject<{
|
|
|
276
277
|
deferred_flow: z.ZodBoolean;
|
|
277
278
|
}, z.core.$strip>>;
|
|
278
279
|
}, z.core.$strip>>;
|
|
279
|
-
authentic_sources: z.ZodArray<z.ZodObject<{
|
|
280
|
+
authentic_sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
280
281
|
id: z.ZodString;
|
|
281
282
|
dataset_id: z.ZodString;
|
|
282
|
-
}, z.core.$strip
|
|
283
|
+
}, z.core.$strip>>>;
|
|
284
|
+
parent_credentials: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
283
285
|
}, z.core.$strip>>;
|
|
284
286
|
iat: z.ZodNumber;
|
|
285
287
|
exp: z.ZodNumber;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/credentials-catalogue/v1.3.3/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAmCzB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuB1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,eAAO,MAAM,MAAM;;;;;;;;;;;;;iBAUjB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AA6B5C,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/credentials-catalogue/v1.3.3/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAmCzB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuB1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,eAAO,MAAM,MAAM;;;;;;;;;;;;;iBAUjB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AA6B5C,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqC5B,CAAC;AASH;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;iBAKzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAalC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE9E;;;GAGG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmBzC,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,8BAA8B,CACtC,CAAC;AAmBF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;iBAO/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AA6BxE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgB3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../../src/mdoc/const.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../../src/mdoc/const.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAC1D,eAAO,MAAM,4BAA4B,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/mdoc/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,GAAI,WAAW,MAAM,EAAE,KAAK,MAAM,WACnD,CAAC;AAExB;;;;;;;GAOG;AACH,eAAO,MAAM,mCAAmC,GAC9C,kBAAkB,GAAG,CACnB,WAAW,CAAC,0BAA0B,CAAC,CACxC,CAAC,kBAAkB,CAAC;;;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/mdoc/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,GAAI,WAAW,MAAM,EAAE,KAAK,MAAM,WACnD,CAAC;AAExB;;;;;;;GAOG;AACH,eAAO,MAAM,mCAAmC,GAC9C,kBAAkB,GAAG,CACnB,WAAW,CAAC,0BAA0B,CAAC,CACxC,CAAC,kBAAkB,CAAC;;;aAStB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAU,OAAO,MAAM;;;cAUlD,CAAC"}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ const DisplayConfig = z.object({
|
|
|
9
9
|
|
|
10
10
|
const ClaimConfig = z.object({
|
|
11
11
|
path: z.array(z.union([z.string(), z.number(), z.null()])),
|
|
12
|
-
display: z.array(DisplayConfig),
|
|
12
|
+
display: z.array(DisplayConfig).optional(),
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
const IssuanceErrorSupported = z.object({
|
|
@@ -13,6 +13,12 @@ import type { IssuanceApi, IssuerConfig, ParsedCredential } from "../api";
|
|
|
13
13
|
type CredentialConf =
|
|
14
14
|
IssuerConfig["credential_configurations_supported"][string];
|
|
15
15
|
|
|
16
|
+
type ClaimConfig = CredentialConf["claims"][number];
|
|
17
|
+
|
|
18
|
+
type DisplayableClaim = Omit<ClaimConfig, "display"> & {
|
|
19
|
+
display: NonNullable<ClaimConfig["display"]>;
|
|
20
|
+
};
|
|
21
|
+
|
|
16
22
|
type DecodedMDocCredential = Out<typeof verifyMdoc> & {
|
|
17
23
|
issuerSigned: CBOR.IssuerSigned;
|
|
18
24
|
};
|
|
@@ -75,7 +81,13 @@ const parseCredentialMDoc = (
|
|
|
75
81
|
throw new IoWalletError("Missing claims in the credential subject");
|
|
76
82
|
}
|
|
77
83
|
|
|
78
|
-
|
|
84
|
+
// Claims without display property (such as `iat`, `exp`, `iss`, etc.)
|
|
85
|
+
// must be ignored as they are not meant to be displayed to the user.
|
|
86
|
+
const displayableClaims = credentialConfig.claims.filter(
|
|
87
|
+
(c) => c.display !== undefined
|
|
88
|
+
) as DisplayableClaim[];
|
|
89
|
+
|
|
90
|
+
const attrDefinitions = displayableClaims.map<
|
|
79
91
|
[string, string, { name: string; locale: string }[]]
|
|
80
92
|
>(({ path: [namespace, attribute], display }) => [
|
|
81
93
|
namespace as string,
|
|
@@ -183,7 +195,11 @@ export const verifyAndParseCredentialMDoc: IssuanceApi["verifyAndParseCredential
|
|
|
183
195
|
issuerConf,
|
|
184
196
|
credential,
|
|
185
197
|
credentialConfigurationId,
|
|
186
|
-
{
|
|
198
|
+
{
|
|
199
|
+
credentialCryptoContext,
|
|
200
|
+
ignoreMissingAttributes,
|
|
201
|
+
includeUndefinedAttributes,
|
|
202
|
+
},
|
|
187
203
|
x509CertRoot
|
|
188
204
|
) => {
|
|
189
205
|
if (!x509CertRoot) {
|
|
@@ -204,7 +220,7 @@ export const verifyAndParseCredentialMDoc: IssuanceApi["verifyAndParseCredential
|
|
|
204
220
|
credentialConfig,
|
|
205
221
|
decoded,
|
|
206
222
|
ignoreMissingAttributes,
|
|
207
|
-
|
|
223
|
+
includeUndefinedAttributes
|
|
208
224
|
);
|
|
209
225
|
|
|
210
226
|
const { signed, validUntil } =
|
|
@@ -18,6 +18,12 @@ import type { IssuanceApi, IssuerConfig, ParsedCredential } from "../api";
|
|
|
18
18
|
type CredentialConf =
|
|
19
19
|
IssuerConfig["credential_configurations_supported"][string];
|
|
20
20
|
|
|
21
|
+
type ClaimConfig = CredentialConf["claims"][number];
|
|
22
|
+
|
|
23
|
+
type DisplayableClaim = Omit<ClaimConfig, "display"> & {
|
|
24
|
+
display: NonNullable<ClaimConfig["display"]>;
|
|
25
|
+
};
|
|
26
|
+
|
|
21
27
|
/**
|
|
22
28
|
* Parse a Sd-Jwt credential according to the issuer configuration
|
|
23
29
|
* @param credentialConfig - the list of supported credentials, as defined in the issuer configuration with their claims metadata
|
|
@@ -32,13 +38,17 @@ const parseCredentialSdJwt = (
|
|
|
32
38
|
ignoreMissingAttributes: boolean = false,
|
|
33
39
|
includeUndefinedAttributes: boolean = false
|
|
34
40
|
): ParsedCredential => {
|
|
35
|
-
|
|
41
|
+
// Claims without display property (such as `iat`, `exp`, `iss`, etc.)
|
|
42
|
+
// must be ignored as they are not meant to be displayed to the user.
|
|
43
|
+
const displayableClaims = (credentialConfig.claims || []).filter(
|
|
44
|
+
(c) => c.display !== undefined
|
|
45
|
+
) as DisplayableClaim[];
|
|
36
46
|
|
|
37
47
|
// Check that all mandatory attributes defined in the issuer configuration are present in the credential
|
|
38
48
|
if (!ignoreMissingAttributes) {
|
|
39
49
|
const missingPaths: string[] = [];
|
|
40
50
|
const rootKeysToVerify = new Set(
|
|
41
|
-
|
|
51
|
+
displayableClaims
|
|
42
52
|
.map((c) => c.path[0])
|
|
43
53
|
.filter((p): p is string => typeof p === "string")
|
|
44
54
|
);
|
|
@@ -64,7 +74,7 @@ const parseCredentialSdJwt = (
|
|
|
64
74
|
const getDisplayNames = (
|
|
65
75
|
path: (string | number | null)[]
|
|
66
76
|
): Record<string, string> | undefined => {
|
|
67
|
-
const match =
|
|
77
|
+
const match = displayableClaims.find((c) => isPathEqual(c.path, path));
|
|
68
78
|
if (!match) return undefined;
|
|
69
79
|
|
|
70
80
|
const nameMap: Record<string, string> = {};
|
|
@@ -99,7 +109,7 @@ const parseCredentialSdJwt = (
|
|
|
99
109
|
|
|
100
110
|
// Identify unique keys in config at this level
|
|
101
111
|
const configKeysAtThisLevel: (string | number)[] = [];
|
|
102
|
-
for (const claim of
|
|
112
|
+
for (const claim of displayableClaims) {
|
|
103
113
|
// Check if the claim path starts with the current path
|
|
104
114
|
if (isPrefixOf(currentPath, claim.path)) {
|
|
105
115
|
const nextPart = claim.path[currentPath.length];
|
|
@@ -63,6 +63,7 @@ const AuthenticSource = z.object({
|
|
|
63
63
|
homepage_uri: z.string().optional(),
|
|
64
64
|
logo_uri: z.string().optional(),
|
|
65
65
|
user_information: z.string().optional(),
|
|
66
|
+
user_information_l10n_id: z.string().optional(),
|
|
66
67
|
});
|
|
67
68
|
export type AuthenticSource = z.infer<typeof AuthenticSource>;
|
|
68
69
|
|
|
@@ -115,6 +116,7 @@ export const DigitalCredential = z.object({
|
|
|
115
116
|
purposes: z.array(z.union([z.string(), CredentialPurpose])),
|
|
116
117
|
issuers: z.array(CredentialIssuer),
|
|
117
118
|
authentic_sources: z.array(AuthenticSource),
|
|
119
|
+
parent_credentials: z.array(z.string()).optional(),
|
|
118
120
|
formats: z.array(CredentialFormat).optional(),
|
|
119
121
|
// claims: z.array(Claim), // TODO: [SIW-3978] Should we keep claims?
|
|
120
122
|
});
|
|
@@ -42,6 +42,7 @@ export const mapToCredentialsCatalogue = createMapper<
|
|
|
42
42
|
|
|
43
43
|
const resolveAuthSource = ({
|
|
44
44
|
id,
|
|
45
|
+
dataset_id,
|
|
45
46
|
}: {
|
|
46
47
|
id: string;
|
|
47
48
|
dataset_id: string;
|
|
@@ -50,10 +51,14 @@ export const mapToCredentialsCatalogue = createMapper<
|
|
|
50
51
|
assert(as, `AS ${id} must be present in the Authentic Source Registry`);
|
|
51
52
|
const { ipa_code, organization_name_l10n_id, ...rest } =
|
|
52
53
|
as.organization_info;
|
|
54
|
+
const dataCapability = as.data_capabilities.find(
|
|
55
|
+
(dc) => dc.dataset_id === dataset_id
|
|
56
|
+
);
|
|
53
57
|
return {
|
|
54
58
|
id,
|
|
55
59
|
organization_name_l10n_id,
|
|
56
60
|
organization_code: ipa_code,
|
|
61
|
+
user_information_l10n_id: dataCapability?.user_information_l10n_id,
|
|
57
62
|
...rest,
|
|
58
63
|
};
|
|
59
64
|
};
|
|
@@ -65,7 +70,7 @@ export const mapToCredentialsCatalogue = createMapper<
|
|
|
65
70
|
`Schemas for ${credentialType} must be present in the Schema Registry`
|
|
66
71
|
);
|
|
67
72
|
return schemas.map((schema) => ({
|
|
68
|
-
configuration_id: schema.id, // TODO: [SIW-3978]
|
|
73
|
+
configuration_id: schema.id, // TODO: [SIW-3978] Fix this, the schema ID does not correspond to configuration_id
|
|
69
74
|
...schema,
|
|
70
75
|
}));
|
|
71
76
|
};
|
|
@@ -87,7 +92,9 @@ export const mapToCredentialsCatalogue = createMapper<
|
|
|
87
92
|
({ authentic_sources, credential_name_l10n_id, ...credential }) => ({
|
|
88
93
|
name_l10n_id: credential_name_l10n_id,
|
|
89
94
|
formats: resolveFormats(credential.credential_type),
|
|
90
|
-
authentic_sources: authentic_sources
|
|
95
|
+
authentic_sources: authentic_sources
|
|
96
|
+
? authentic_sources.map(resolveAuthSource)
|
|
97
|
+
: [],
|
|
91
98
|
...credential,
|
|
92
99
|
})
|
|
93
100
|
),
|
|
@@ -132,12 +132,10 @@ export const DigitalCredential = z.object({
|
|
|
132
132
|
classes: z.array(z.string()).optional(),
|
|
133
133
|
purposes: z.array(z.string()),
|
|
134
134
|
issuers: z.array(CredentialIssuer),
|
|
135
|
-
authentic_sources: z
|
|
136
|
-
z.object({
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
})
|
|
140
|
-
),
|
|
135
|
+
authentic_sources: z
|
|
136
|
+
.array(z.object({ id: z.string(), dataset_id: z.string() }))
|
|
137
|
+
.optional(),
|
|
138
|
+
parent_credentials: z.array(z.string()).optional(),
|
|
141
139
|
});
|
|
142
140
|
|
|
143
141
|
const JwtHeader = z.object({
|
package/src/mdoc/const.ts
CHANGED
package/src/mdoc/utils.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { CBOR } from "@pagopa/io-react-native-iso18013";
|
|
|
2
2
|
import { Verification } from "../sd-jwt/types";
|
|
3
3
|
import type { IssuanceApi } from "../credential/issuance";
|
|
4
4
|
import type { Out } from "../utils/misc";
|
|
5
|
-
import {
|
|
5
|
+
import { MDOC_VERIFICATION_IDENTIFIER } from "./const";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @param namespace The mdoc credential `namespace`
|
|
@@ -25,11 +25,12 @@ export const getVerificationFromParsedCredential = (
|
|
|
25
25
|
IssuanceApi["verifyAndParseCredential"]
|
|
26
26
|
>["parsedCredential"]
|
|
27
27
|
) => {
|
|
28
|
-
const verificationKey =
|
|
29
|
-
|
|
30
|
-
"verification"
|
|
28
|
+
const verificationKey = Object.keys(parsedCredential).find((key) =>
|
|
29
|
+
key.endsWith(MDOC_VERIFICATION_IDENTIFIER)
|
|
31
30
|
);
|
|
32
|
-
const verification =
|
|
31
|
+
const verification = verificationKey
|
|
32
|
+
? parsedCredential[verificationKey]?.value
|
|
33
|
+
: undefined;
|
|
33
34
|
return verification ? Verification.parse(verification) : undefined;
|
|
34
35
|
};
|
|
35
36
|
|
|
@@ -43,9 +44,11 @@ export const getVerificationFromParsedCredential = (
|
|
|
43
44
|
*/
|
|
44
45
|
export const getVerification = async (token: string) => {
|
|
45
46
|
const issuerSigned = await CBOR.decodeIssuerSigned(token);
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
47
|
+
|
|
48
|
+
const flattenedClaims = Object.values(issuerSigned.nameSpaces).flat();
|
|
49
|
+
|
|
50
|
+
const verification = flattenedClaims?.find(
|
|
51
|
+
(x) => x.elementIdentifier === MDOC_VERIFICATION_IDENTIFIER
|
|
49
52
|
)?.elementValue;
|
|
50
53
|
|
|
51
54
|
return verification ? Verification.parse(verification) : undefined;
|