@pagopa/io-react-native-wallet 2.0.0 → 2.1.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 +42 -128
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/types.test.js +40 -0
- package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/types.js +2 -1
- package/lib/commonjs/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/trust/build-chain.js +22 -19
- package/lib/commonjs/trust/build-chain.js.map +1 -1
- package/lib/commonjs/utils/nestedProperty.js +142 -0
- package/lib/commonjs/utils/nestedProperty.js.map +1 -0
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js +41 -127
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/module/sd-jwt/__test__/types.test.js +41 -1
- package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/module/sd-jwt/types.js +2 -1
- package/lib/module/sd-jwt/types.js.map +1 -1
- package/lib/module/trust/build-chain.js +22 -19
- package/lib/module/trust/build-chain.js.map +1 -1
- package/lib/module/utils/nestedProperty.js +136 -0
- package/lib/module/utils/nestedProperty.js.map +1 -0
- package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/types.d.ts +5 -5
- package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/trust/build-chain.d.ts +2 -3
- package/lib/typescript/trust/build-chain.d.ts.map +1 -1
- package/lib/typescript/utils/nestedProperty.d.ts +23 -0
- package/lib/typescript/utils/nestedProperty.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/credential/issuance/07-verify-and-parse-credential.ts +2 -113
- package/src/sd-jwt/__test__/types.test.ts +49 -1
- package/src/sd-jwt/types.ts +2 -1
- package/src/trust/build-chain.ts +28 -25
- package/src/utils/nestedProperty.ts +198 -0
@@ -133,30 +133,20 @@ export async function getFederationList(federationListEndpoint) {
|
|
133
133
|
* Build a not-verified trust chain for a given Relying Party (RP) entity.
|
134
134
|
*
|
135
135
|
* @param relyingPartyEntityBaseUrl The base URL of the RP entity
|
136
|
-
* @param
|
136
|
+
* @param trustAnchorConfig The entity configuration of the known trust anchor.
|
137
137
|
* @param appFetch An optional instance of the http client to be used.
|
138
138
|
* @returns A list of signed tokens that represent the trust chain, in the order of the chain (from the RP to the Trust Anchor)
|
139
139
|
* @throws {FederationError} When an element of the chain fails to parse or other build steps fail.
|
140
140
|
*/
|
141
|
-
export async function buildTrustChain(relyingPartyEntityBaseUrl,
|
141
|
+
export async function buildTrustChain(relyingPartyEntityBaseUrl, trustAnchorConfig) {
|
142
142
|
let appFetch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : fetch;
|
143
|
-
// 1:
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
throw new BuildTrustChainError("Cannot verify trust anchor: missing entity configuration in gathered chain.", {
|
150
|
-
relyingPartyUrl: relyingPartyEntityBaseUrl
|
151
|
-
});
|
152
|
-
}
|
153
|
-
if (!trustAnchorKey.kid) {
|
154
|
-
throw new TrustAnchorKidMissingError();
|
143
|
+
// 1: Verify if the RP is authorized by the Trust Anchor's federation list
|
144
|
+
// Extract the Trust Anchor's signing key and federation_list_endpoint
|
145
|
+
// (we assume the TA has only one key, as per spec)
|
146
|
+
const trustAnchorKey = trustAnchorConfig.payload.jwks.keys[0];
|
147
|
+
if (!trustAnchorKey) {
|
148
|
+
throw new BuildTrustChainError("Cannot verify trust anchor: missing signing key in entity configuration.");
|
155
149
|
}
|
156
|
-
await verify(trustAnchorJwt, trustAnchorKey.kid, [trustAnchorKey]);
|
157
|
-
|
158
|
-
// 3: Check the federation list
|
159
|
-
const trustAnchorConfig = EntityConfiguration.parse(decode(trustAnchorJwt));
|
160
150
|
const federationListEndpoint = trustAnchorConfig.payload.metadata.federation_entity.federation_list_endpoint;
|
161
151
|
if (federationListEndpoint) {
|
162
152
|
const federationList = await getFederationList(federationListEndpoint, {
|
@@ -169,6 +159,20 @@ export async function buildTrustChain(relyingPartyEntityBaseUrl, trustAnchorKey)
|
|
169
159
|
});
|
170
160
|
}
|
171
161
|
}
|
162
|
+
|
163
|
+
// 1: Recursively gather the trust chain from the RP up to the Trust Anchor
|
164
|
+
const trustChain = await gatherTrustChain(relyingPartyEntityBaseUrl, appFetch);
|
165
|
+
// 2: Trust Anchor signature verification
|
166
|
+
const chainTrustAnchorJwt = trustChain[trustChain.length - 1];
|
167
|
+
if (!chainTrustAnchorJwt) {
|
168
|
+
throw new BuildTrustChainError("Cannot verify trust anchor: missing entity configuration in gathered chain.", {
|
169
|
+
relyingPartyUrl: relyingPartyEntityBaseUrl
|
170
|
+
});
|
171
|
+
}
|
172
|
+
if (!trustAnchorKey.kid) {
|
173
|
+
throw new TrustAnchorKidMissingError();
|
174
|
+
}
|
175
|
+
await verify(chainTrustAnchorJwt, trustAnchorKey.kid, [trustAnchorKey]);
|
172
176
|
return trustChain;
|
173
177
|
}
|
174
178
|
|
@@ -210,7 +214,6 @@ async function gatherTrustChain(entityBaseUrl, appFetch) {
|
|
210
214
|
appFetch
|
211
215
|
});
|
212
216
|
const parentEC = EntityConfiguration.parse(decode(parentECJwt));
|
213
|
-
|
214
217
|
// Fetch ES
|
215
218
|
const federationFetchEndpoint = parentEC.payload.metadata.federation_entity.federation_fetch_endpoint;
|
216
219
|
if (!federationFetchEndpoint) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["BuildTrustChainError","FederationListParseError","MissingFederationFetchEndpointError","RelyingPartyNotAuthorizedError","TrustAnchorKidMissingError","decode","verify","CredentialIssuerEntityConfiguration","EntityConfiguration","EntityStatement","FederationListResponse","RelyingPartyEntityConfiguration","TrustAnchorEntityConfiguration","WalletProviderEntityConfiguration","hasStatusOrThrow","decodeJwt","fetchAndParseEntityConfiguration","entityBaseUrl","schema","appFetch","fetch","arguments","length","undefined","responseText","getSignedEntityConfiguration","responseJwt","parse","header","protectedHeader","payload","getWalletProviderEntityConfiguration","options","getCredentialIssuerEntityConfiguration","getTrustAnchorEntityConfiguration","getRelyingPartyEntityConfiguration","getEntityConfiguration","getEntityStatement","accreditationBodyBaseUrl","subordinatedEntityBaseUrl","getSignedEntityStatement","wellKnownUrl","method","then","res","text","federationFetchEndpoint","url","URL","searchParams","set","toString","getFederationList","federationListEndpoint","json","result","safeParse","success","error","message","parseError","data","buildTrustChain","relyingPartyEntityBaseUrl","trustAnchorKey","
|
1
|
+
{"version":3,"names":["BuildTrustChainError","FederationListParseError","MissingFederationFetchEndpointError","RelyingPartyNotAuthorizedError","TrustAnchorKidMissingError","decode","verify","CredentialIssuerEntityConfiguration","EntityConfiguration","EntityStatement","FederationListResponse","RelyingPartyEntityConfiguration","TrustAnchorEntityConfiguration","WalletProviderEntityConfiguration","hasStatusOrThrow","decodeJwt","fetchAndParseEntityConfiguration","entityBaseUrl","schema","appFetch","fetch","arguments","length","undefined","responseText","getSignedEntityConfiguration","responseJwt","parse","header","protectedHeader","payload","getWalletProviderEntityConfiguration","options","getCredentialIssuerEntityConfiguration","getTrustAnchorEntityConfiguration","getRelyingPartyEntityConfiguration","getEntityConfiguration","getEntityStatement","accreditationBodyBaseUrl","subordinatedEntityBaseUrl","getSignedEntityStatement","wellKnownUrl","method","then","res","text","federationFetchEndpoint","url","URL","searchParams","set","toString","getFederationList","federationListEndpoint","json","result","safeParse","success","error","message","parseError","data","buildTrustChain","relyingPartyEntityBaseUrl","trustAnchorConfig","trustAnchorKey","jwks","keys","metadata","federation_entity","federation_list_endpoint","federationList","includes","relyingPartyUrl","trustChain","gatherTrustChain","chainTrustAnchorJwt","kid","isLeaf","chain","entityECJwt","entityEC","push","authorityHints","authority_hints","parentEntityBaseUrl","parentECJwt","parentEC","federation_fetch_endpoint","missingInEntityUrl","entityStatementJwt","parentChain","concat"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AE9C;EACA,MAAMG,WAAW,GAAG,MAAM7D,4BAA4B,CAAC4D,mBAAmB,EAAE;IAC1ElE;EACF,CAAC,CAAC;EACF,MAAMoE,QAAQ,GAAG/E,mBAAmB,CAACmB,KAAK,CAACtB,MAAM,CAACiF,WAAW,CAAC,CAAC;EAC/D;EACA,MAAMxC,uBAAuB,GAC3ByC,QAAQ,CAACzD,OAAO,CAACsC,QAAQ,CAACC,iBAAiB,CAACmB,yBAAyB;EACvE,IAAI,CAAC1C,uBAAuB,EAAE;IAC5B,MAAM,IAAI5C,mCAAmC,CAC1C,kDAAiDmF,mBAAoB,4CAA2CpE,aAAc,GAAE,EACjI;MAAEA,aAAa;MAAEwE,kBAAkB,EAAEJ;IAAoB,CAC3D,CAAC;EACH;EACA,MAAMK,kBAAkB,GAAG,MAAMlD,wBAAwB,CACvDM,uBAAuB,EACvB7B,aAAa,EACb;IAAEE;EAAS,CACb,CAAC;EACD;EACAV,eAAe,CAACkB,KAAK,CAACtB,MAAM,CAACqF,kBAAkB,CAAC,CAAC;;EAEjD;EACAX,KAAK,CAACG,IAAI,CAACQ,kBAAkB,CAAC;;EAE9B;EACA,MAAMC,WAAW,GAAG,MAAMhB,gBAAgB,CACxCU,mBAAmB,EACnBlE,QAAQ,EACR,KACF,CAAC;EAED,OAAO4D,KAAK,CAACa,MAAM,CAACD,WAAW,CAAC;AAClC"}
|
@@ -0,0 +1,136 @@
|
|
1
|
+
import { isObject } from "./misc";
|
2
|
+
|
3
|
+
// The data used to create localized names
|
4
|
+
|
5
|
+
// The resulting object of localized names { en: "Name", it: "Nome" }
|
6
|
+
|
7
|
+
// The core structure being built: a node containing the actual value and its localized names
|
8
|
+
|
9
|
+
// A path can consist of object keys, array indices, or null for mapping
|
10
|
+
|
11
|
+
// A union of all possible shapes. It can be a custom PropertyNode or a standard object/array structure
|
12
|
+
|
13
|
+
// Helper to build localized names from the display data.
|
14
|
+
const buildName = display => display.reduce((names, _ref) => {
|
15
|
+
let {
|
16
|
+
locale,
|
17
|
+
name
|
18
|
+
} = _ref;
|
19
|
+
return {
|
20
|
+
...names,
|
21
|
+
[locale]: name
|
22
|
+
};
|
23
|
+
}, {});
|
24
|
+
|
25
|
+
// Handles the case where the path key is `null`
|
26
|
+
const handleNullKeyCase = (currentObject, rest, sourceValue, displayData) => {
|
27
|
+
if (!Array.isArray(sourceValue)) return currentObject;
|
28
|
+
|
29
|
+
// We assert the type here because we know this branch handles PropertyNodes
|
30
|
+
const node = currentObject;
|
31
|
+
const existingValue = Array.isArray(node.value) ? node.value : [];
|
32
|
+
const mappedArray = sourceValue.map((item, idx) => createNestedProperty(existingValue[idx] || {}, rest, item, displayData));
|
33
|
+
return {
|
34
|
+
...node,
|
35
|
+
value: mappedArray,
|
36
|
+
name: node.name ?? buildName(displayData)
|
37
|
+
};
|
38
|
+
};
|
39
|
+
|
40
|
+
// Handles the case where the path key is a string
|
41
|
+
const handleStringKeyCase = (currentObject, key, rest, sourceValue, displayData) => {
|
42
|
+
let nextSourceValue = sourceValue;
|
43
|
+
const isLeaf = rest.length === 0;
|
44
|
+
if (isObject(sourceValue)) {
|
45
|
+
// Check if any remaining string keys in the path exist in current sourceValue
|
46
|
+
// This handles nested object paths (unlike arrays which use null in the path)
|
47
|
+
const hasRestKey = rest.some(r => typeof r === "string" && r in sourceValue);
|
48
|
+
if (hasRestKey) {
|
49
|
+
return handleRestKey(currentObject, key, rest, sourceValue, displayData);
|
50
|
+
}
|
51
|
+
|
52
|
+
// Skip processing when the key is not found within the claim object
|
53
|
+
if (!(key in sourceValue)) {
|
54
|
+
// Leaf node: create a node with an empty value and display name
|
55
|
+
if (isLeaf) {
|
56
|
+
return {
|
57
|
+
...currentObject,
|
58
|
+
[key]: {
|
59
|
+
value: {},
|
60
|
+
name: buildName(displayData)
|
61
|
+
}
|
62
|
+
};
|
63
|
+
}
|
64
|
+
// Skip processing when the key is not found within the claim object
|
65
|
+
return currentObject;
|
66
|
+
}
|
67
|
+
nextSourceValue = sourceValue[key];
|
68
|
+
}
|
69
|
+
|
70
|
+
// base case
|
71
|
+
if (isLeaf) {
|
72
|
+
return {
|
73
|
+
...currentObject,
|
74
|
+
[key]: {
|
75
|
+
value: nextSourceValue,
|
76
|
+
name: buildName(displayData)
|
77
|
+
}
|
78
|
+
};
|
79
|
+
}
|
80
|
+
|
81
|
+
// recursive step
|
82
|
+
const nextObject = currentObject[key] || {};
|
83
|
+
return {
|
84
|
+
...currentObject,
|
85
|
+
[key]: createNestedProperty(nextObject, rest, nextSourceValue, displayData)
|
86
|
+
};
|
87
|
+
};
|
88
|
+
|
89
|
+
// Handles the case where the path key is a number
|
90
|
+
const handleNumberKeyCase = (currentObject, key, rest, sourceValue, displayData) => {
|
91
|
+
const newArray = Array.isArray(currentObject) ? [...currentObject] : [];
|
92
|
+
const nextValue = Array.isArray(sourceValue) ? sourceValue[key] : undefined;
|
93
|
+
newArray[key] = createNestedProperty(newArray[key] || {}, rest, nextValue, displayData);
|
94
|
+
return newArray;
|
95
|
+
};
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Recursively constructs a nested object with descriptive properties from a path.
|
99
|
+
*
|
100
|
+
* @param currentObject - The object or array being built upon.
|
101
|
+
* @param path - The path segments to follow.
|
102
|
+
* @param sourceValue - The raw value to place at the end of the path.
|
103
|
+
* @param displayData - The data for generating localized names.
|
104
|
+
* @returns The new object or array structure.
|
105
|
+
*/
|
106
|
+
export const createNestedProperty = (currentObject, path, sourceValue, displayData) => {
|
107
|
+
const [key, ...rest] = path;
|
108
|
+
switch (true) {
|
109
|
+
case key === null:
|
110
|
+
return handleNullKeyCase(currentObject, rest, sourceValue, displayData);
|
111
|
+
case typeof key === "string":
|
112
|
+
return handleStringKeyCase(currentObject, key, rest, sourceValue, displayData);
|
113
|
+
case typeof key === "number":
|
114
|
+
return handleNumberKeyCase(currentObject, key, rest, sourceValue, displayData);
|
115
|
+
default:
|
116
|
+
return currentObject;
|
117
|
+
}
|
118
|
+
};
|
119
|
+
|
120
|
+
// Handles the case where the next key in the path exists in the source object
|
121
|
+
const handleRestKey = (currentObject, key, rest, sourceValue, displayData) => {
|
122
|
+
const currentNode = currentObject[key] ?? {};
|
123
|
+
// Take the first key in the remaining path
|
124
|
+
const restKey = rest[0];
|
125
|
+
const nextSourceValue = sourceValue[restKey];
|
126
|
+
|
127
|
+
// Merge the current node with the updated nested property for the remaining path.
|
128
|
+
return {
|
129
|
+
...currentObject,
|
130
|
+
[key]: {
|
131
|
+
...currentNode,
|
132
|
+
value: createNestedProperty(currentNode.value ?? {}, rest, nextSourceValue, displayData)
|
133
|
+
}
|
134
|
+
};
|
135
|
+
};
|
136
|
+
//# sourceMappingURL=nestedProperty.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["isObject","buildName","display","reduce","names","_ref","locale","name","handleNullKeyCase","currentObject","rest","sourceValue","displayData","Array","isArray","node","existingValue","value","mappedArray","map","item","idx","createNestedProperty","handleStringKeyCase","key","nextSourceValue","isLeaf","length","hasRestKey","some","r","handleRestKey","nextObject","handleNumberKeyCase","newArray","nextValue","undefined","path","currentNode","restKey"],"sourceRoot":"../../../src","sources":["utils/nestedProperty.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,QAAQ;;AAEjC;;AAGA;;AAGA;;AAMA;;AAGA;;AAGA;AACA,MAAMC,SAAS,GAAIC,OAAoB,IACrCA,OAAO,CAACC,MAAM,CACZ,CAACC,KAAK,EAAAC,IAAA;EAAA,IAAE;IAAEC,MAAM;IAAEC;EAAK,CAAC,GAAAF,IAAA;EAAA,OAAM;IAAE,GAAGD,KAAK;IAAE,CAACE,MAAM,GAAGC;EAAK,CAAC;AAAA,CAAC,EAC3D,CAAC,CACH,CAAC;;AAEH;AACA,MAAMC,iBAAiB,GAAGA,CACxBC,aAA8B,EAC9BC,IAAU,EACVC,WAAoB,EACpBC,WAAwB,KACJ;EACpB,IAAI,CAACC,KAAK,CAACC,OAAO,CAACH,WAAW,CAAC,EAAE,OAAOF,aAAa;;EAErD;EACA,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,OAAOhB,iBAAiB,CAACC,aAAa,EAAEC,IAAI,EAAEC,WAAW,EAAEC,WAAW,CAAC;IAEzE,KAAK,OAAOY,GAAG,KAAK,QAAQ;MAC1B,OAAOD,mBAAmB,CACxBd,aAAa,EACbe,GAAG,EACHd,IAAI,EACJC,WAAW,EACXC,WACF,CAAC;IAEH,KAAK,OAAOY,GAAG,KAAK,QAAQ;MAC1B,OAAOS,mBAAmB,CACxBxB,aAAa,EACbe,GAAG,EACHd,IAAI,EACJC,WAAW,EACXC,WACF,CAAC;IAEH;MACE,OAAOH,aAAa;EACxB;AACF,CAAC;;AAED;AACA,MAAMsB,aAAa,GAAGA,CACpBtB,aAAkC,EAClCe,GAAW,EACXd,IAAU,EACVC,WAAoC,EACpCC,WAAwB,KACJ;EACpB,MAAM0B,WAAW,GAAG7B,aAAa,CAACe,GAAG,CAAC,IAAI,CAAC,CAAC;EAC5C;EACA,MAAMe,OAAO,GAAG7B,IAAI,CAAC,CAAC,CAAW;EACjC,MAAMe,eAAe,GAAGd,WAAW,CAAC4B,OAAO,CAAC;;EAE5C;EACA,OAAO;IACL,GAAG9B,aAAa;IAChB,CAACe,GAAG,GAAG;MACL,GAAGc,WAAW;MACdrB,KAAK,EAAEK,oBAAoB,CACzBgB,WAAW,CAACrB,KAAK,IAAI,CAAC,CAAC,EACvBP,IAAI,EACJe,eAAe,EACfb,WACF;IACF;EACF,CAAC;AACH,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"07-verify-and-parse-credential.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/07-verify-and-parse-credential.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,
|
1
|
+
{"version":3,"file":"07-verify-and-parse-credential.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/07-verify-and-parse-credential.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAKtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAU/D,KAAK,UAAU,GAAG,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,CAAC;AAQzD,MAAM,MAAM,wBAAwB,GAAG,CACrC,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC,YAAY,CAAC,EAC/C,yBAAyB,EAAE,MAAM,EACjC,OAAO,EAAE;IACP,uBAAuB,EAAE,aAAa,CAAC;IACvC;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;OAEG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,EACD,YAAY,CAAC,EAAE,MAAM,KAClB,OAAO,CAAC;IACX,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,UAAU,EAAE,IAAI,CAAC;IACjB,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;CAC5B,CAAC,CAAC;AAGH,KAAK,gBAAgB,GAAG;IACtB,oBAAoB;IACpB,CAAC,KAAK,EAAE,MAAM,GAAG;QACf,IAAI,EACA,yBAAyB,CAAC,MAAM,CAC9B,MAAM,EACN,MAAM,CACP,GACD,4BAA4B,CAAC,MAAM,GACnC,SAAS,CAAC;QACd,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC;CACH,CAAC;AA6XF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB,EAAE,wBAuCtC,CAAC"}
|
@@ -450,7 +450,7 @@ export declare const Verification: z.ZodObject<{
|
|
450
450
|
assurance_level: z.ZodString;
|
451
451
|
evidence: z.ZodArray<z.ZodObject<{
|
452
452
|
type: z.ZodLiteral<"vouch">;
|
453
|
-
time: z.ZodString
|
453
|
+
time: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
454
454
|
attestation: z.ZodObject<{
|
455
455
|
type: z.ZodLiteral<"digital_attestation">;
|
456
456
|
reference_number: z.ZodString;
|
@@ -479,7 +479,7 @@ export declare const Verification: z.ZodObject<{
|
|
479
479
|
}>;
|
480
480
|
}, "strip", z.ZodTypeAny, {
|
481
481
|
type: "vouch";
|
482
|
-
time: string;
|
482
|
+
time: string | number;
|
483
483
|
attestation: {
|
484
484
|
type: "digital_attestation";
|
485
485
|
reference_number: string;
|
@@ -490,7 +490,7 @@ export declare const Verification: z.ZodObject<{
|
|
490
490
|
};
|
491
491
|
}, {
|
492
492
|
type: "vouch";
|
493
|
-
time: string;
|
493
|
+
time: string | number;
|
494
494
|
attestation: {
|
495
495
|
type: "digital_attestation";
|
496
496
|
reference_number: string;
|
@@ -505,7 +505,7 @@ export declare const Verification: z.ZodObject<{
|
|
505
505
|
assurance_level: string;
|
506
506
|
evidence: {
|
507
507
|
type: "vouch";
|
508
|
-
time: string;
|
508
|
+
time: string | number;
|
509
509
|
attestation: {
|
510
510
|
type: "digital_attestation";
|
511
511
|
reference_number: string;
|
@@ -520,7 +520,7 @@ export declare const Verification: z.ZodObject<{
|
|
520
520
|
assurance_level: string;
|
521
521
|
evidence: {
|
522
522
|
type: "vouch";
|
523
|
-
time: string;
|
523
|
+
time: string | number;
|
524
524
|
attestation: {
|
525
525
|
type: "digital_attestation";
|
526
526
|
reference_number: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/sd-jwt/types.ts"],"names":[],"mappings":"AACA,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,qB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCnB,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACxD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBvB,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACxD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcvB,CAAC"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import type { JWK } from "../utils/jwk";
|
2
1
|
import { CredentialIssuerEntityConfiguration, EntityConfiguration, RelyingPartyEntityConfiguration, TrustAnchorEntityConfiguration, WalletProviderEntityConfiguration } from "./types";
|
3
2
|
/**
|
4
3
|
* Fetch and parse the entity configuration document for a given federation entity.
|
@@ -1290,11 +1289,11 @@ export declare function getFederationList(federationListEndpoint: string, { appF
|
|
1290
1289
|
* Build a not-verified trust chain for a given Relying Party (RP) entity.
|
1291
1290
|
*
|
1292
1291
|
* @param relyingPartyEntityBaseUrl The base URL of the RP entity
|
1293
|
-
* @param
|
1292
|
+
* @param trustAnchorConfig The entity configuration of the known trust anchor.
|
1294
1293
|
* @param appFetch An optional instance of the http client to be used.
|
1295
1294
|
* @returns A list of signed tokens that represent the trust chain, in the order of the chain (from the RP to the Trust Anchor)
|
1296
1295
|
* @throws {FederationError} When an element of the chain fails to parse or other build steps fail.
|
1297
1296
|
*/
|
1298
|
-
export declare function buildTrustChain(relyingPartyEntityBaseUrl: string,
|
1297
|
+
export declare function buildTrustChain(relyingPartyEntityBaseUrl: string, trustAnchorConfig: TrustAnchorEntityConfiguration, appFetch?: GlobalFetch["fetch"]): Promise<string[]>;
|
1299
1298
|
export {};
|
1300
1299
|
//# sourceMappingURL=build-chain.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"build-chain.d.ts","sourceRoot":"","sources":["../../../src/trust/build-chain.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"build-chain.d.ts","sourceRoot":"","sources":["../../../src/trust/build-chain.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,mCAAmC,EACnC,mBAAmB,EAGnB,+BAA+B,EAC/B,8BAA8B,EAC9B,iCAAiC,EAClC,MAAM,SAAS,CAAC;AAIjB;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAe,gCAAgC,CAC7C,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,OAAO,iCAAiC,EAChD,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,GACA,OAAO,CAAC,iCAAiC,CAAC,CAAC;AAC9C,iBAAe,gCAAgC,CAC7C,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,OAAO,+BAA+B,EAC9C,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,GACA,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAC5C,iBAAe,gCAAgC,CAC7C,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,OAAO,8BAA8B,EAC7C,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,GACA,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAC3C,iBAAe,gCAAgC,CAC7C,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,OAAO,mCAAmC,EAClD,OAAO,CAAC,EAAE;IACR,QAAQ,C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;IACD,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAeP;AAED;;;;;;GAMG;AACH,wBAAsB,4BAA4B,CAChD,aAAa,EAAE,MAAM,EACrB,EACE,QAAgB,GACjB,GAAE;IACD,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAC5B,GACL,OAAO,CAAC,MAAM,CAAC,CAQjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAC5C,uBAAuB,EAAE,MAAM,EAC/B,yBAAyB,EAAE,MAAM,EACjC,EACE,QAAgB,GACjB,GAAE;IACD,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAC5B,mBAUP;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,sBAAsB,EAAE,MAAM,EAC9B,EACE,QAAgB,GACjB,GAAE;IACD,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAC5B,GACL,OAAO,CAAC,MAAM,EAAE,CAAC,CAgBnB;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,yBAAyB,EAAE,MAAM,EACjC,iBAAiB,EAAE,8BAA8B,EACjD,QAAQ,GAAE,WAAW,CAAC,OAAO,CAAS,GACrC,OAAO,CAAC,MAAM,EAAE,CAAC,CAkDnB"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
type DisplayData = {
|
2
|
+
locale: string;
|
3
|
+
name: string;
|
4
|
+
}[];
|
5
|
+
type LocalizedNames = Record<string, string>;
|
6
|
+
type PropertyNode<T> = {
|
7
|
+
value: T;
|
8
|
+
name: LocalizedNames;
|
9
|
+
};
|
10
|
+
type Path = (string | number | null)[];
|
11
|
+
type NodeOrStructure = Partial<PropertyNode<any>> | Record<string, any> | any[];
|
12
|
+
/**
|
13
|
+
* Recursively constructs a nested object with descriptive properties from a path.
|
14
|
+
*
|
15
|
+
* @param currentObject - The object or array being built upon.
|
16
|
+
* @param path - The path segments to follow.
|
17
|
+
* @param sourceValue - The raw value to place at the end of the path.
|
18
|
+
* @param displayData - The data for generating localized names.
|
19
|
+
* @returns The new object or array structure.
|
20
|
+
*/
|
21
|
+
export declare const createNestedProperty: (currentObject: NodeOrStructure, path: Path, sourceValue: unknown, displayData: DisplayData) => NodeOrStructure;
|
22
|
+
export {};
|
23
|
+
//# sourceMappingURL=nestedProperty.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nestedProperty.d.ts","sourceRoot":"","sources":["../../../src/utils/nestedProperty.ts"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC;AAGtD,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAG7C,KAAK,YAAY,CAAC,CAAC,IAAI;IACrB,KAAK,EAAE,CAAC,CAAC;IACT,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC;AAGF,KAAK,IAAI,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;AAGvC,KAAK,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC;AA6GhF;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,kBAChB,eAAe,2BAEjB,OAAO,+BAEnB,eA4BF,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pagopa/io-react-native-wallet",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.1.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",
|
@@ -57,7 +57,7 @@
|
|
57
57
|
"@pagopa/io-react-native-iso18013": "^0.3.0",
|
58
58
|
"@pagopa/io-react-native-jwt": "^2.1.0",
|
59
59
|
"@react-native/babel-preset": "0.78.3",
|
60
|
-
"@react-native/eslint-config": "
|
60
|
+
"@react-native/eslint-config": "0.78.3",
|
61
61
|
"@rushstack/eslint-patch": "^1.3.2",
|
62
62
|
"@types/jest": "^29.5.13",
|
63
63
|
"@types/jsrsasign": "^10.5.15",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { CryptoContext } from "@pagopa/io-react-native-jwt";
|
2
|
-
import {
|
2
|
+
import { type Out } from "../../utils/misc";
|
3
3
|
import type { EvaluateIssuerTrust } from "./02-evaluate-issuer-trust";
|
4
4
|
import { IoWalletError } from "../../utils/errors";
|
5
5
|
import { SdJwt4VC, verify as verifySdJwt } from "../../sd-jwt";
|
@@ -13,6 +13,7 @@ import { LogLevel, Logger } from "../../utils/logging";
|
|
13
13
|
import { extractElementValueAsDate } from "../../mdoc/converter";
|
14
14
|
import type { CBOR } from "@pagopa/io-react-native-iso18013";
|
15
15
|
import type { PublicKey } from "@pagopa/io-react-native-crypto";
|
16
|
+
import { createNestedProperty } from "../../utils/nestedProperty";
|
16
17
|
|
17
18
|
type IssuerConf = Out<EvaluateIssuerTrust>["issuerConf"];
|
18
19
|
type CredentialConf =
|
@@ -64,118 +65,6 @@ type DecodedSdJwtCredential = Out<typeof verifySdJwt> & {
|
|
64
65
|
sdJwt: SdJwt4VC;
|
65
66
|
};
|
66
67
|
|
67
|
-
// The data used to create localized names
|
68
|
-
type DisplayData = { locale: string; name: string }[];
|
69
|
-
|
70
|
-
// The resulting object of localized names { en: "Name", it: "Nome" }
|
71
|
-
type LocalizedNames = Record<string, string>;
|
72
|
-
|
73
|
-
// The core structure being built: a node containing the actual value and its localized names
|
74
|
-
type PropertyNode<T> = {
|
75
|
-
value: T;
|
76
|
-
name: LocalizedNames;
|
77
|
-
};
|
78
|
-
|
79
|
-
// A path can consist of object keys, array indices, or null for mapping
|
80
|
-
type Path = (string | number | null)[];
|
81
|
-
|
82
|
-
// A union of all possible shapes. It can be a custom PropertyNode or a standard object/array structure
|
83
|
-
type NodeOrStructure = Partial<PropertyNode<any>> | Record<string, any> | any[];
|
84
|
-
|
85
|
-
// Helper to build localized names from the display data.
|
86
|
-
const buildName = (display: DisplayData): LocalizedNames =>
|
87
|
-
display.reduce(
|
88
|
-
(names, { locale, name }) => ({ ...names, [locale]: name }),
|
89
|
-
{}
|
90
|
-
);
|
91
|
-
|
92
|
-
/**
|
93
|
-
* Recursively constructs a nested object with descriptive properties from a path.
|
94
|
-
*
|
95
|
-
* @param currentObject - The object or array being built upon.
|
96
|
-
* @param path - The path segments to follow.
|
97
|
-
* @param sourceValue - The raw value to place at the end of the path.
|
98
|
-
* @param displayData - The data for generating localized names.
|
99
|
-
* @returns The new object or array structure.
|
100
|
-
*/
|
101
|
-
const createNestedProperty = (
|
102
|
-
currentObject: NodeOrStructure,
|
103
|
-
path: Path,
|
104
|
-
sourceValue: unknown, // Use `unknown` for type-safe input
|
105
|
-
displayData: DisplayData
|
106
|
-
): NodeOrStructure => {
|
107
|
-
const [key, ...rest] = path;
|
108
|
-
|
109
|
-
// Case 1: Map over an array (key is null)
|
110
|
-
if (key === null) {
|
111
|
-
if (!Array.isArray(sourceValue)) return currentObject;
|
112
|
-
|
113
|
-
// We assert the type here because we know this branch handles PropertyNodes
|
114
|
-
const node = currentObject as Partial<PropertyNode<unknown[]>>;
|
115
|
-
const existingValue = Array.isArray(node.value) ? node.value : [];
|
116
|
-
|
117
|
-
const mappedArray = sourceValue.map((item, idx) =>
|
118
|
-
createNestedProperty(existingValue[idx] || {}, rest, item, displayData)
|
119
|
-
);
|
120
|
-
|
121
|
-
return {
|
122
|
-
...node,
|
123
|
-
value: mappedArray,
|
124
|
-
name: node.name ?? buildName(displayData),
|
125
|
-
};
|
126
|
-
}
|
127
|
-
|
128
|
-
// Case 2: Handle an object key (key is a string)
|
129
|
-
if (typeof key === "string") {
|
130
|
-
let nextSourceValue = sourceValue;
|
131
|
-
|
132
|
-
if (isObject(sourceValue)) {
|
133
|
-
// Skip processing when the key is not found within the claim object
|
134
|
-
if (!(key in sourceValue)) return currentObject;
|
135
|
-
|
136
|
-
nextSourceValue = sourceValue[key];
|
137
|
-
}
|
138
|
-
|
139
|
-
// base case
|
140
|
-
if (rest.length === 0) {
|
141
|
-
return {
|
142
|
-
...currentObject,
|
143
|
-
[key]: { value: nextSourceValue, name: buildName(displayData) },
|
144
|
-
};
|
145
|
-
}
|
146
|
-
|
147
|
-
// recursive step
|
148
|
-
const nextObject =
|
149
|
-
(currentObject as Record<string, NodeOrStructure>)[key] || {};
|
150
|
-
|
151
|
-
return {
|
152
|
-
...currentObject,
|
153
|
-
[key]: createNestedProperty(
|
154
|
-
nextObject,
|
155
|
-
rest,
|
156
|
-
nextSourceValue,
|
157
|
-
displayData
|
158
|
-
),
|
159
|
-
};
|
160
|
-
}
|
161
|
-
|
162
|
-
// Case 3: Handle a specific array index (key is a number)
|
163
|
-
if (typeof key === "number") {
|
164
|
-
const newArray = Array.isArray(currentObject) ? [...currentObject] : [];
|
165
|
-
const nextValue = Array.isArray(sourceValue) ? sourceValue[key] : undefined;
|
166
|
-
|
167
|
-
newArray[key] = createNestedProperty(
|
168
|
-
newArray[key] || {},
|
169
|
-
rest,
|
170
|
-
nextValue,
|
171
|
-
displayData
|
172
|
-
);
|
173
|
-
return newArray;
|
174
|
-
}
|
175
|
-
|
176
|
-
return currentObject;
|
177
|
-
};
|
178
|
-
|
179
68
|
const parseCredentialSdJwt = (
|
180
69
|
// The credential configuration to use to parse the provided credential
|
181
70
|
credentialConfig: CredentialConf,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Disclosure, SdJwt4VC } from "../types";
|
1
|
+
import { Disclosure, SdJwt4VC, Verification } from "../types";
|
2
2
|
|
3
3
|
describe("SdJwt4VC", () => {
|
4
4
|
it("should accept a valid token", () => {
|
@@ -75,3 +75,51 @@ describe("Disclosure", () => {
|
|
75
75
|
expect(success).toBe(true);
|
76
76
|
});
|
77
77
|
});
|
78
|
+
|
79
|
+
describe("Verification.time", () => {
|
80
|
+
test.each([
|
81
|
+
["ISO string", "2025-09-09T10:00:00Z"],
|
82
|
+
["unix seconds", 1752122400],
|
83
|
+
["unix milliseconds", 1752122400000],
|
84
|
+
])("accepts %s", (_label, time) => {
|
85
|
+
const value = {
|
86
|
+
trust_framework: "eidas",
|
87
|
+
assurance_level: "high",
|
88
|
+
evidence: [
|
89
|
+
{
|
90
|
+
type: "vouch",
|
91
|
+
time,
|
92
|
+
attestation: {
|
93
|
+
type: "digital_attestation",
|
94
|
+
reference_number: "abc",
|
95
|
+
date_of_issuance: "2025-09-02",
|
96
|
+
voucher: { organization: "IPZS" },
|
97
|
+
},
|
98
|
+
},
|
99
|
+
],
|
100
|
+
};
|
101
|
+
|
102
|
+
expect(Verification.safeParse(value).success).toBe(true);
|
103
|
+
});
|
104
|
+
|
105
|
+
it("rejects invalid type", () => {
|
106
|
+
const value = {
|
107
|
+
trust_framework: "eidas",
|
108
|
+
assurance_level: "high",
|
109
|
+
evidence: [
|
110
|
+
{
|
111
|
+
type: "vouch",
|
112
|
+
time: null,
|
113
|
+
attestation: {
|
114
|
+
type: "digital_attestation",
|
115
|
+
reference_number: "abc",
|
116
|
+
date_of_issuance: "2025-09-02",
|
117
|
+
voucher: { organization: "IPZS" },
|
118
|
+
},
|
119
|
+
},
|
120
|
+
],
|
121
|
+
};
|
122
|
+
|
123
|
+
expect(Verification.safeParse(value).success).toBe(false);
|
124
|
+
});
|
125
|
+
});
|
package/src/sd-jwt/types.ts
CHANGED
@@ -96,7 +96,8 @@ export const Verification = z.object({
|
|
96
96
|
evidence: z.array(
|
97
97
|
z.object({
|
98
98
|
type: z.literal("vouch"),
|
99
|
-
|
99
|
+
// Support both string and UNIX timestamp for backward compatibility
|
100
|
+
time: z.union([z.string(), z.number()]),
|
100
101
|
attestation: z.object({
|
101
102
|
type: z.literal("digital_attestation"),
|
102
103
|
reference_number: z.string(),
|