@pagopa/io-react-native-wallet 2.0.0-next.0 → 2.0.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +2 -2
  2. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +1 -1
  3. package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js +2 -2
  4. package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
  5. package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -1
  6. package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
  7. package/lib/commonjs/trust/README.md +147 -0
  8. package/lib/commonjs/trust/build-chain.js +252 -0
  9. package/lib/commonjs/trust/build-chain.js.map +1 -0
  10. package/lib/commonjs/trust/errors.js +24 -1
  11. package/lib/commonjs/trust/errors.js.map +1 -1
  12. package/lib/commonjs/trust/index.js +11 -276
  13. package/lib/commonjs/trust/index.js.map +1 -1
  14. package/lib/commonjs/trust/utils.js +30 -1
  15. package/lib/commonjs/trust/utils.js.map +1 -1
  16. package/lib/commonjs/trust/{chain.js → verify-chain.js} +87 -15
  17. package/lib/commonjs/trust/verify-chain.js.map +1 -0
  18. package/lib/commonjs/utils/errors.js.map +1 -1
  19. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +1 -1
  20. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -1
  21. package/lib/module/credential/presentation/02-evaluate-rp-trust.js +1 -1
  22. package/lib/module/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
  23. package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -1
  24. package/lib/module/credential/presentation/08-send-authorization-response.js +1 -1
  25. package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
  26. package/lib/module/trust/README.md +147 -0
  27. package/lib/module/trust/build-chain.js +235 -0
  28. package/lib/module/trust/build-chain.js.map +1 -0
  29. package/lib/module/trust/errors.js +23 -2
  30. package/lib/module/trust/errors.js.map +1 -1
  31. package/lib/module/trust/index.js +5 -262
  32. package/lib/module/trust/index.js.map +1 -1
  33. package/lib/module/trust/utils.js +27 -0
  34. package/lib/module/trust/utils.js.map +1 -1
  35. package/lib/module/trust/{chain.js → verify-chain.js} +85 -14
  36. package/lib/module/trust/verify-chain.js.map +1 -0
  37. package/lib/module/utils/errors.js +1 -1
  38. package/lib/module/utils/errors.js.map +1 -1
  39. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +1 -1
  40. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts.map +1 -1
  41. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +1 -1
  42. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -1
  43. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +2 -2
  44. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
  45. package/lib/typescript/credential/status/types.d.ts +6 -6
  46. package/lib/typescript/sd-jwt/index.d.ts +12 -12
  47. package/lib/typescript/sd-jwt/types.d.ts +6 -6
  48. package/lib/typescript/trust/build-chain.d.ts +1284 -0
  49. package/lib/typescript/trust/build-chain.d.ts.map +1 -0
  50. package/lib/typescript/trust/errors.d.ts +22 -0
  51. package/lib/typescript/trust/errors.d.ts.map +1 -1
  52. package/lib/typescript/trust/index.d.ts +5 -1299
  53. package/lib/typescript/trust/index.d.ts.map +1 -1
  54. package/lib/typescript/trust/types.d.ts +54 -54
  55. package/lib/typescript/trust/utils.d.ts +10 -0
  56. package/lib/typescript/trust/utils.d.ts.map +1 -1
  57. package/lib/typescript/trust/verify-chain.d.ts +39 -0
  58. package/lib/typescript/trust/verify-chain.d.ts.map +1 -0
  59. package/lib/typescript/utils/errors.d.ts +2 -2
  60. package/lib/typescript/utils/errors.d.ts.map +1 -1
  61. package/lib/typescript/wallet-instance-attestation/types.d.ts +21 -21
  62. package/package.json +2 -2
  63. package/src/credential/issuance/02-evaluate-issuer-trust.ts +1 -1
  64. package/src/credential/presentation/02-evaluate-rp-trust.ts +1 -1
  65. package/src/credential/presentation/05-verify-request-object.ts +1 -1
  66. package/src/credential/presentation/08-send-authorization-response.ts +4 -4
  67. package/src/trust/README.md +147 -0
  68. package/src/trust/build-chain.ts +395 -0
  69. package/src/trust/errors.ts +32 -1
  70. package/src/trust/index.ts +5 -435
  71. package/src/trust/utils.ts +35 -0
  72. package/src/trust/{chain.ts → verify-chain.ts} +132 -16
  73. package/src/utils/errors.ts +4 -4
  74. package/lib/commonjs/trust/chain.js.map +0 -1
  75. package/lib/module/trust/chain.js.map +0 -1
  76. package/lib/typescript/trust/chain.d.ts +0 -21
  77. package/lib/typescript/trust/chain.d.ts.map +0 -1
@@ -3,280 +3,15 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.buildTrustChain = buildTrustChain;
7
- exports.getEntityConfiguration = exports.getCredentialIssuerEntityConfiguration = void 0;
8
- exports.getEntityStatement = getEntityStatement;
9
- exports.getFederationList = getFederationList;
10
- exports.getRelyingPartyEntityConfiguration = void 0;
11
- exports.getSignedEntityConfiguration = getSignedEntityConfiguration;
12
- exports.getSignedEntityStatement = getSignedEntityStatement;
13
- exports.getWalletProviderEntityConfiguration = exports.getTrustAnchorEntityConfiguration = void 0;
14
- exports.verifyTrustChain = verifyTrustChain;
15
- var _utils = require("./utils");
16
- var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
17
- var _types = require("./types");
18
- var _chain = require("./chain");
19
- var _misc = require("../utils/misc");
20
- var _errors = require("./errors");
21
- /**
22
- * Verify a given trust chain is actually valid.
23
- * It can handle fast chain renewal, which means we try to fetch a fresh version of each statement.
24
- *
25
- * @param trustAnchorEntity The entity configuration of the known trust anchor
26
- * @param chain The chain of statements to be validated
27
- * @param renewOnFail Whether to renew the provided chain if the validation fails at first. Default: true
28
- * @param appFetch Fetch api implementation. Default: the built-in implementation
29
- * @returns The result of the chain validation
30
- * @throws {FederationError} If the chain is not valid
31
- */
32
- async function verifyTrustChain(trustAnchorEntity, chain) {
33
- let {
34
- appFetch = fetch,
35
- renewOnFail = true
36
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
37
- try {
38
- return (0, _chain.validateTrustChain)(trustAnchorEntity, chain);
39
- } catch (error) {
40
- if (renewOnFail) {
41
- const renewedChain = await (0, _chain.renewTrustChain)(chain, appFetch);
42
- return (0, _chain.validateTrustChain)(trustAnchorEntity, renewedChain);
43
- } else {
44
- throw error;
45
- }
46
- }
47
- }
48
-
49
- /**
50
- * Fetch the signed entity configuration token for an entity
51
- *
52
- * @param entityBaseUrl The url of the entity to fetch
53
- * @param appFetch (optional) fetch api implementation
54
- * @returns The signed Entity Configuration token
55
- */
56
- async function getSignedEntityConfiguration(entityBaseUrl) {
57
- let {
58
- appFetch = fetch
59
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
60
- const wellKnownUrl = `${entityBaseUrl}/.well-known/openid-federation`;
61
- return await appFetch(wellKnownUrl, {
62
- method: "GET"
63
- }).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.text());
64
- }
65
-
66
- /**
67
- * Fetch and parse the entity configuration document for a given federation entity.
68
- * This is an inner method to serve public interfaces.
69
- *
70
- * To add another entity configuration type (example: Foo entity type):
71
- * - create its zod schema and type by inherit from the base type (example: FooEntityConfiguration = BaseEntityConfiguration.and(...))
72
- * - add such type to EntityConfiguration union
73
- * - add an overload to this function
74
- * - create a public function which use such type (example: getFooEntityConfiguration = (url, options) => Promise<FooEntityConfiguration>)
75
- *
76
- * @param entityBaseUrl The base url of the entity.
77
- * @param schema The expected schema of the entity configuration, according to the kind of entity we are fetching from.
78
- * @param options An optional object with additional options.
79
- * @param options.appFetch An optional instance of the http client to be used.
80
- * @returns The parsed entity configuration object
81
- * @throws {IoWalletError} If the http request fails
82
- * @throws Parse error if the document is not in the expected shape.
83
- */
84
-
85
- async function fetchAndParseEntityConfiguration(entityBaseUrl, schema) {
86
- let {
87
- appFetch = fetch
88
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
89
- const responseText = await getSignedEntityConfiguration(entityBaseUrl, {
90
- appFetch
91
- });
92
- const responseJwt = (0, _ioReactNativeJwt.decode)(responseText);
93
- return schema.parse({
94
- header: responseJwt.protectedHeader,
95
- payload: responseJwt.payload
96
- });
97
- }
98
- const getWalletProviderEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.WalletProviderEntityConfiguration, options);
99
- exports.getWalletProviderEntityConfiguration = getWalletProviderEntityConfiguration;
100
- const getCredentialIssuerEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.CredentialIssuerEntityConfiguration, options);
101
- exports.getCredentialIssuerEntityConfiguration = getCredentialIssuerEntityConfiguration;
102
- const getTrustAnchorEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.TrustAnchorEntityConfiguration, options);
103
- exports.getTrustAnchorEntityConfiguration = getTrustAnchorEntityConfiguration;
104
- const getRelyingPartyEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.RelyingPartyEntityConfiguration, options);
105
- exports.getRelyingPartyEntityConfiguration = getRelyingPartyEntityConfiguration;
106
- const getEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.EntityConfiguration, options);
107
-
108
- /**
109
- * Fetch and parse the entity statement document for a given federation entity.
110
- *
111
- * @param accreditationBodyBaseUrl The base url of the accreditation body which holds and signs the required entity statement
112
- * @param subordinatedEntityBaseUrl The url that identifies the subordinate entity
113
- * @param appFetch An optional instance of the http client to be used.
114
- * @returns The parsed entity configuration object
115
- * @throws {IoWalletError} If the http request fails
116
- */
117
- exports.getEntityConfiguration = getEntityConfiguration;
118
- async function getEntityStatement(accreditationBodyBaseUrl, subordinatedEntityBaseUrl) {
119
- let {
120
- appFetch = fetch
121
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
122
- const responseText = await getSignedEntityStatement(accreditationBodyBaseUrl, subordinatedEntityBaseUrl, {
123
- appFetch
124
- });
125
- const responseJwt = (0, _ioReactNativeJwt.decode)(responseText);
126
- return _types.EntityStatement.parse({
127
- header: responseJwt.protectedHeader,
128
- payload: responseJwt.payload
129
- });
130
- }
131
-
132
- /**
133
- * Fetch the entity statement document for a given federation entity.
134
- *
135
- * @param federationFetchEndpoint The exact endpoint provided by the parent EC's metadata.
136
- * @param subordinatedEntityBaseUrl The url that identifies the subordinate entity.
137
- * @param appFetch An optional instance of the http client to be used.
138
- * @returns The signed entity statement token.
139
- * @throws {IoWalletError} If the http request fails.
140
- */
141
- async function getSignedEntityStatement(federationFetchEndpoint, subordinatedEntityBaseUrl) {
142
- let {
143
- appFetch = fetch
144
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
145
- const url = new URL(federationFetchEndpoint);
146
- url.searchParams.set("sub", subordinatedEntityBaseUrl);
147
- return await appFetch(url.toString(), {
148
- method: "GET"
149
- }).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.text());
150
- }
151
-
152
- /**
153
- * Fetch the federation list document from a given endpoint.
154
- *
155
- * @param federationListEndpoint The URL of the federation list endpoint.
156
- * @param appFetch An optional instance of the http client to be used.
157
- * @returns The federation list as an array of strings.
158
- * @throws {IoWalletError} If the HTTP request fails.
159
- * @throws {FederationError} If the result is not in the expected format.
160
- */
161
- async function getFederationList(federationListEndpoint) {
162
- let {
163
- appFetch = fetch
164
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
165
- return await appFetch(federationListEndpoint, {
166
- method: "GET"
167
- }).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(json => {
168
- const result = _types.FederationListResponse.safeParse(json);
169
- if (!result.success) {
170
- throw new _errors.FederationListParseError(`Invalid federation list format received from ${federationListEndpoint}. Error: ${result.error.message}`, {
171
- url: federationListEndpoint,
172
- parseError: result.error.toString()
173
- });
174
- }
175
- return result.data;
176
- });
177
- }
178
-
179
- /**
180
- * Build a not-verified trust chain for a given Relying Party (RP) entity.
181
- *
182
- * @param relyingPartyEntityBaseUrl The base URL of the RP entity
183
- * @param trustAnchorKey The public key of the Trust Anchor (TA) entity
184
- * @param appFetch An optional instance of the http client to be used.
185
- * @returns A list of signed tokens that represent the trust chain, in the order of the chain (from the RP to the Trust Anchor)
186
- * @throws {FederationError} When an element of the chain fails to parse or other build steps fail.
187
- */
188
- async function buildTrustChain(relyingPartyEntityBaseUrl, trustAnchorKey) {
189
- let appFetch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : fetch;
190
- // 1: Recursively gather the trust chain from the RP up to the Trust Anchor
191
- const trustChain = await gatherTrustChain(relyingPartyEntityBaseUrl, appFetch);
192
-
193
- // 2: Trust Anchor signature verification
194
- const trustAnchorJwt = trustChain[trustChain.length - 1];
195
- if (!trustAnchorJwt) {
196
- throw new _errors.BuildTrustChainError("Cannot verify trust anchor: missing entity configuration in gathered chain.", {
197
- relyingPartyUrl: relyingPartyEntityBaseUrl
198
- });
199
- }
200
- if (!trustAnchorKey.kid) {
201
- throw new _errors.TrustAnchorKidMissingError();
202
- }
203
- await (0, _utils.verify)(trustAnchorJwt, trustAnchorKey.kid, [trustAnchorKey]);
204
-
205
- // 3: Check the federation list
206
- const trustAnchorConfig = _types.EntityConfiguration.parse((0, _utils.decode)(trustAnchorJwt));
207
- const federationListEndpoint = trustAnchorConfig.payload.metadata.federation_entity.federation_list_endpoint;
208
- if (federationListEndpoint) {
209
- const federationList = await getFederationList(federationListEndpoint, {
210
- appFetch
211
- });
212
- if (!federationList.includes(relyingPartyEntityBaseUrl)) {
213
- throw new _errors.RelyingPartyNotAuthorizedError("Relying Party entity base URL is not authorized by the Trust Anchor's federation list.", {
214
- relyingPartyUrl: relyingPartyEntityBaseUrl,
215
- federationListEndpoint
216
- });
217
- }
218
- }
219
- return trustChain;
220
- }
221
-
222
- /**
223
- * Recursively gather the trust chain for an entity and all its superiors.
224
- * @param entityBaseUrl The base URL of the entity for which to gather the chain.
225
- * @param appFetch An optional instance of the http client to be used.
226
- * @param isLeaf Whether the current entity is the leaf of the chain.
227
- * @returns A full ordered list of JWTs (ECs and ESs) forming the trust chain.
228
- * @throws {FederationError} If any of the fetched documents fail to parse or other errors occur during the gathering process.
229
- */
230
- async function gatherTrustChain(entityBaseUrl, appFetch) {
231
- let isLeaf = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
232
- const chain = [];
233
-
234
- // Fetch self-signed EC (only needed for the leaf)
235
- const entityECJwt = await getSignedEntityConfiguration(entityBaseUrl, {
236
- appFetch
237
- });
238
- const entityEC = _types.EntityConfiguration.parse((0, _utils.decode)(entityECJwt));
239
- if (isLeaf) {
240
- // Only push EC for the leaf
241
- chain.push(entityECJwt);
242
- }
243
-
244
- // Find authority_hints (parent, if any)
245
- const authorityHints = entityEC.payload.authority_hints ?? [];
246
- if (authorityHints.length === 0) {
247
- // This is the Trust Anchor (no parent)
248
- if (!isLeaf) {
249
- chain.push(entityECJwt);
250
- }
251
- return chain;
252
- }
253
- const parentEntityBaseUrl = authorityHints[0];
254
-
255
- // Fetch parent EC
256
- const parentECJwt = await getSignedEntityConfiguration(parentEntityBaseUrl, {
257
- appFetch
258
- });
259
- const parentEC = _types.EntityConfiguration.parse((0, _utils.decode)(parentECJwt));
260
-
261
- // Fetch ES
262
- const federationFetchEndpoint = parentEC.payload.metadata.federation_entity.federation_fetch_endpoint;
263
- if (!federationFetchEndpoint) {
264
- throw new _errors.MissingFederationFetchEndpointError(`Missing federation_fetch_endpoint in parent's (${parentEntityBaseUrl}) configuration when gathering chain for ${entityBaseUrl}.`, {
265
- entityBaseUrl,
266
- missingInEntityUrl: parentEntityBaseUrl
267
- });
268
- }
269
- const entityStatementJwt = await getSignedEntityStatement(federationFetchEndpoint, entityBaseUrl, {
270
- appFetch
271
- });
272
- // Validate the ES
273
- _types.EntityStatement.parse((0, _utils.decode)(entityStatementJwt));
274
-
275
- // Push this ES into the chain
276
- chain.push(entityStatementJwt);
277
-
278
- // Recurse into the parent
279
- const parentChain = await gatherTrustChain(parentEntityBaseUrl, appFetch, false);
280
- return chain.concat(parentChain);
281
- }
6
+ exports.Verify = exports.Types = exports.Errors = exports.Build = void 0;
7
+ var Build = _interopRequireWildcard(require("./build-chain"));
8
+ exports.Build = Build;
9
+ var Verify = _interopRequireWildcard(require("./verify-chain"));
10
+ exports.Verify = Verify;
11
+ var Errors = _interopRequireWildcard(require("./errors"));
12
+ exports.Errors = Errors;
13
+ var Types = _interopRequireWildcard(require("./types"));
14
+ exports.Types = Types;
15
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
282
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_utils","require","_ioReactNativeJwt","_types","_chain","_misc","_errors","verifyTrustChain","trustAnchorEntity","chain","appFetch","fetch","renewOnFail","arguments","length","undefined","validateTrustChain","error","renewedChain","renewTrustChain","getSignedEntityConfiguration","entityBaseUrl","wellKnownUrl","method","then","hasStatusOrThrow","res","text","fetchAndParseEntityConfiguration","schema","responseText","responseJwt","decodeJwt","parse","header","protectedHeader","payload","getWalletProviderEntityConfiguration","options","WalletProviderEntityConfiguration","exports","getCredentialIssuerEntityConfiguration","CredentialIssuerEntityConfiguration","getTrustAnchorEntityConfiguration","TrustAnchorEntityConfiguration","getRelyingPartyEntityConfiguration","RelyingPartyEntityConfiguration","getEntityConfiguration","EntityConfiguration","getEntityStatement","accreditationBodyBaseUrl","subordinatedEntityBaseUrl","getSignedEntityStatement","EntityStatement","federationFetchEndpoint","url","URL","searchParams","set","toString","getFederationList","federationListEndpoint","json","result","FederationListResponse","safeParse","success","FederationListParseError","message","parseError","data","buildTrustChain","relyingPartyEntityBaseUrl","trustAnchorKey","trustChain","gatherTrustChain","trustAnchorJwt","BuildTrustChainError","relyingPartyUrl","kid","TrustAnchorKidMissingError","verify","trustAnchorConfig","decode","metadata","federation_entity","federation_list_endpoint","federationList","includes","RelyingPartyNotAuthorizedError","isLeaf","entityECJwt","entityEC","push","authorityHints","authority_hints","parentEntityBaseUrl","parentECJwt","parentEC","federation_fetch_endpoint","MissingFederationFetchEndpointError","missingInEntityUrl","entityStatementJwt","parentChain","concat"],"sourceRoot":"../../../src","sources":["trust/index.ts"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AASA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeM,gBAAgBA,CACpCC,iBAAiD,EACjDC,KAAe,EAKiC;EAAA,IAJhD;IACEC,QAAQ,GAAGC,KAAK;IAChBC,WAAW,GAAG;EAC4C,CAAC,GAAAC,SAAA,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AAI,CAACF,WAAW,CAAC;IACzB;IACA,OAAOlF,KAAK;EACd;EAEA,MAAMuF,mBAAmB,GAAGF,cAAc,CAAC,CAAC,CAAE;;EAE9C;EACA,MAAMG,WAAW,GAAG,MAAM7E,4BAA4B,CAAC4E,mBAAmB,EAAE;IAC1EtF;EACF,CAAC,CAAC;EACF,MAAMwF,QAAQ,GAAGlD,0BAAmB,CAACf,KAAK,CAAC,IAAAkD,aAAM,EAACc,WAAW,CAAC,CAAC;;EAE/D;EACA,MAAM3C,uBAAuB,GAC3B4C,QAAQ,CAAC9D,OAAO,CAACgD,QAAQ,CAACC,iBAAiB,CAACc,yBAAyB;EACvE,IAAI,CAAC7C,uBAAuB,EAAE;IAC5B,MAAM,IAAI8C,2CAAmC,CAC1C,kDAAiDJ,mBAAoB,4CAA2C3E,aAAc,GAAE,EACjI;MAAEA,aAAa;MAAEgF,kBAAkB,EAAEL;IAAoB,CAC3D,CAAC;EACH;EAEA,MAAMM,kBAAkB,GAAG,MAAMlD,wBAAwB,CACvDE,uBAAuB,EACvBjC,aAAa,EACb;IAAEX;EAAS,CACb,CAAC;EACD;EACA2C,sBAAe,CAACpB,KAAK,CAAC,IAAAkD,aAAM,EAACmB,kBAAkB,CAAC,CAAC;;EAEjD;EACA7F,KAAK,CAACoF,IAAI,CAACS,kBAAkB,CAAC;;EAE9B;EACA,MAAMC,WAAW,GAAG,MAAM5B,gBAAgB,CACxCqB,mBAAmB,EACnBtF,QAAQ,EACR,KACF,CAAC;EAED,OAAOD,KAAK,CAAC+F,MAAM,CAACD,WAAW,CAAC;AAClC"}
1
+ {"version":3,"names":["Build","_interopRequireWildcard","require","exports","Verify","Errors","Types","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../../src","sources":["trust/index.ts"],"mappings":";;;;;;A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AH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA"}
@@ -3,8 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.verify = exports.decode = void 0;
6
+ exports.decode = void 0;
7
+ exports.getTrustAnchorX509Certificate = getTrustAnchorX509Certificate;
8
+ exports.verify = void 0;
7
9
  var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
10
+ var _errors = require("./errors");
8
11
  // Verify a token signature
9
12
  // The kid is extracted from the token header
10
13
  const verify = async (token, kid, jwks) => {
@@ -37,5 +40,31 @@ const decode = token => {
37
40
  payload
38
41
  };
39
42
  };
43
+
44
+ /**
45
+ * Extracts the X.509 Trust Anchor certificate (Base64 encoded) from the
46
+ * Trust Anchor's Entity Configuration.
47
+ *
48
+ * @param trustAnchorEntity The entity configuration of the known trust anchor.
49
+ * @returns The Base64 encoded X.509 certificate string.
50
+ * @throws {FederationError} If the certificate cannot be derived.
51
+ */
40
52
  exports.decode = decode;
53
+ function getTrustAnchorX509Certificate(trustAnchorEntity) {
54
+ const taHeaderKid = trustAnchorEntity.header.kid;
55
+ const taSigningJwk = trustAnchorEntity.payload.jwks.keys.find(key => key.kid === taHeaderKid);
56
+ if (!taSigningJwk) {
57
+ throw new _errors.FederationError(`Cannot derive X.509 Trust Anchor certificate: JWK with kid '${taHeaderKid}' not found in Trust Anchor's JWKS.`, {
58
+ trustAnchorKid: taHeaderKid,
59
+ reason: "JWK not found for header kid"
60
+ });
61
+ }
62
+ if (taSigningJwk.x5c && taSigningJwk.x5c.length > 0 && taSigningJwk.x5c[0]) {
63
+ return taSigningJwk.x5c[0];
64
+ }
65
+ throw new _errors.FederationError(`Cannot derive X.509 Trust Anchor certificate: JWK with kid '${taHeaderKid}' does not contain a valid 'x5c' certificate array.`, {
66
+ trustAnchorKid: taHeaderKid,
67
+ reason: "Missing or empty x5c in JWK"
68
+ });
69
+ }
41
70
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_ioReactNativeJwt","require","verify","token","kid","jwks","jwk","find","k","Error","protectedHeader","header","payload","verifyJwt","exports","decode","decodeJwt"],"sourceRoot":"../../../src","sources":["trust/utils.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAYA;AACA;AACO,MAAMC,MAAM,GAAG,MAAAA,CACpBC,KAAa,EACbC,GAAW,EACXC,IAAW,KACc;EACzB,MAAMC,GAAG,GAAGD,IAAI,CAACE,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACJ,GAAG,KAAKA,GAAG,CAAC;EAC3C,IAAI,CAACE,GAAG,EAAE;IACR,MAAM,IAAIG,KAAK,CAAE,gBAAeL,GAAI,YAAWD,KAAM,EAAC,CAAC;EACzD;EACA,MAAM;IAAEO,eAAe,EAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAG,MAAM,IAAAC,wBAAS,EAACV,KAAK,EAAEG,GAAG,CAAC;EACxE,OAAO;IAAEK,MAAM;IAAEC;EAAQ,CAAC;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AAHAE,OAAA,CAAAZ,MAAA,GAAAA,MAAA;AAIO,MAAMa,MAAM,GAAIZ,KAAa,IAAkB;EACpD,MAAM;IAAEO,eAAe,EAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAG,IAAAI,wBAAS,EAACb,KAAK,CAAC;EAC7D,OAAO;IAAEQ,MAAM;IAAEC;EAAQ,CAAC;AAC5B,CAAC;AAACE,OAAA,CAAAC,MAAA,GAAAA,MAAA"}
1
+ {"version":3,"names":["_ioReactNativeJwt","require","_errors","verify","token","kid","jwks","jwk","find","k","Error","protectedHeader","header","payload","verifyJwt","exports","decode","decodeJwt","getTrustAnchorX509Certificate","trustAnchorEntity","taHeaderKid","taSigningJwk","keys","key","FederationError","trustAnchorKid","reason","x5c","length"],"sourceRoot":"../../../src","sources":["trust/utils.ts"],"mappings":";;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAMA,IAAAC,OAAA,GAAAD,OAAA;AAQA;AACA;AACO,MAAME,MAAM,GAAG,MAAAA,CACpBC,KAAa,EACbC,GAAW,EACXC,IAAW,KACc;EACzB,MAAMC,GAAG,GAAGD,IAAI,CAACE,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACJ,GAAG,KAAKA,GAAG,CAAC;EAC3C,IAAI,CAACE,GAAG,EAAE;IACR,MAAM,IAAIG,KAAK,CAAE,gBAAeL,GAAI,YAAWD,KAAM,EAAC,CAAC;EACzD;EACA,MAAM;IAAEO,eAAe,EAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAG,MAAM,IAAAC,wBAAS,EAACV,KAAK,EAAEG,GAAG,CAAC;EACxE,OAAO;IAAEK,MAAM;IAAEC;EAAQ,CAAC;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AAHAE,OAAA,CAAAZ,MAAA,GAAAA,MAAA;AAIO,MAAMa,MAAM,GAAIZ,KAAa,IAAkB;EACpD,MAAM;IAAEO,eAAe,EAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAG,IAAAI,wBAAS,EAACb,KAAK,CAAC;EAC7D,OAAO;IAAEQ,MAAM;IAAEC;EAAQ,CAAC;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPAE,OAAA,CAAAC,MAAA,GAAAA,MAAA;AAQO,SAASE,6BAA6BA,CAC3CC,iBAAiD,EACzC;EACR,MAAMC,WAAW,GAAGD,iBAAiB,CAACP,MAAM,CAACP,GAAG;EAChD,MAAMgB,YAAY,GAAGF,iBAAiB,CAACN,OAAO,CAACP,IAAI,CAACgB,IAAI,CAACd,IAAI,CAC1De,GAAG,IAAKA,GAAG,CAAClB,GAAG,KAAKe,WACvB,CAAC;EAED,IAAI,CAACC,YAAY,EAAE;IACjB,MAAM,IAAIG,uBAAe,CACtB,+DAA8DJ,WAAY,qCAAoC,EAC/G;MAAEK,cAAc,EAAEL,WAAW;MAAEM,MAAM,EAAE;IAA+B,CACxE,CAAC;EACH;EAEA,IAAIL,YAAY,CAACM,GAAG,IAAIN,YAAY,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,IAAIP,YAAY,CAACM,GAAG,CAAC,CAAC,CAAC,EAAE;IAC1E,OAAON,YAAY,CAACM,GAAG,CAAC,CAAC,CAAC;EAC5B;EAEA,MAAM,IAAIH,uBAAe,CACtB,+DAA8DJ,WAAY,qDAAoD,EAC/H;IAAEK,cAAc,EAAEL,WAAW;IAAEM,MAAM,EAAE;EAA8B,CACvE,CAAC;AACH"}
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.renewTrustChain = renewTrustChain;
7
7
  exports.validateTrustChain = validateTrustChain;
8
+ exports.verifyTrustChain = verifyTrustChain;
8
9
  var _types = require("./types");
9
10
  var z = _interopRequireWildcard(require("zod"));
10
- var _ = require(".");
11
11
  var _utils = require("./utils");
12
12
  var _errors = require("./errors");
13
+ var _ioReactNativeCrypto = require("@pagopa/io-react-native-crypto");
14
+ var _buildChain = require("./build-chain");
13
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
17
  // The first element of the chain is supposed to be the Entity Configuration for the document issuer
@@ -21,14 +23,15 @@ const MiddleElementShape = _types.EntityStatement;
21
23
  const LastElementShape = z.union([_types.EntityStatement, _types.TrustAnchorEntityConfiguration]);
22
24
 
23
25
  /**
24
- * Validates a provided trust chain against a known trust
26
+ * Validates a provided trust chain against a known trust anchor, including X.509 certificate checks.
25
27
  *
26
- * @param trustAnchorEntity The entity configuration of the known trust anchor
27
- * @param chain The chain of statements to be validated
28
- * @returns The list of parsed token representing the chain
29
- * @throws {FederationError} If the chain is not valid
28
+ * @param trustAnchorEntity The entity configuration of the known trust anchor (for JWT validation).
29
+ * @param chain The chain of statements to be validated.
30
+ * @param x509Options Options for X.509 certificate validation.
31
+ * @returns The list of parsed tokens representing the chain.
32
+ * @throws {FederationError} If the chain is not valid (JWT or X.509). Specific errors like TrustChainEmptyError, X509ValidationError may be thrown.
30
33
  */
31
- async function validateTrustChain(trustAnchorEntity, chain) {
34
+ async function validateTrustChain(trustAnchorEntity, chain, x509Options) {
32
35
  // If the chain is empty, fail
33
36
  if (chain.length === 0) {
34
37
  throw new _errors.TrustChainEmptyError("Cannot verify empty trust chain.");
@@ -37,7 +40,7 @@ async function validateTrustChain(trustAnchorEntity, chain) {
37
40
  // Select the expected token shape
38
41
  const selectTokenShape = elementIndex => elementIndex === 0 ? FirstElementShape : elementIndex === chain.length - 1 ? LastElementShape : MiddleElementShape;
39
42
 
40
- // select the kid from the current index
43
+ // Select the kid from the current index
41
44
  const selectKid = currentIndex => {
42
45
  const token = chain[currentIndex];
43
46
  if (!token) {
@@ -49,8 +52,8 @@ async function validateTrustChain(trustAnchorEntity, chain) {
49
52
  return shape.parse((0, _utils.decode)(token)).header.kid;
50
53
  };
51
54
 
52
- // select keys from the next token
53
- // if the current token is the last, keys from trust anchor will be used
55
+ // Select keys from the next token
56
+ // If the current token is the last, keys from trust anchor will be used
54
57
  const selectKeys = currentIndex => {
55
58
  if (currentIndex === chain.length - 1) {
56
59
  return trustAnchorEntity.payload.jwks.keys;
@@ -65,10 +68,45 @@ async function validateTrustChain(trustAnchorEntity, chain) {
65
68
  const shape = selectTokenShape(nextIndex);
66
69
  return shape.parse((0, _utils.decode)(nextToken)).payload.jwks.keys;
67
70
  };
71
+ const x509TrustAnchorCertBase64 = (0, _utils.getTrustAnchorX509Certificate)(trustAnchorEntity);
68
72
 
69
73
  // Iterate the chain and validate each element's signature against the public keys of its next
70
74
  // If there is no next, hence it's the end of the chain, and it must be verified by the Trust Anchor
71
- return Promise.all(chain.map((token, i) => [token, selectKid(i), selectKeys(i)]).map(args => (0, _utils.verify)(...args)));
75
+ const validationPromises = chain.map(async (tokenString, i) => {
76
+ const kidFromTokenHeader = selectKid(i);
77
+ const signerJwks = selectKeys(i);
78
+
79
+ // Step 1: Verify JWT signature
80
+ const parsedToken = await (0, _utils.verify)(tokenString, kidFromTokenHeader, signerJwks);
81
+
82
+ // Step 2: X.509 Certificate Chain Validation
83
+ const jwkUsedForVerification = signerJwks.find(k => k.kid === kidFromTokenHeader);
84
+ if (!jwkUsedForVerification) {
85
+ throw new _errors.FederationError(`JWK with kid '${kidFromTokenHeader}' was not found in signer's JWKS for token at index ${i}, though JWT verification passed.`, {
86
+ tokenIndex: i,
87
+ kid: kidFromTokenHeader
88
+ });
89
+ }
90
+ if (!jwkUsedForVerification.x5c || jwkUsedForVerification.x5c.length === 0) {
91
+ throw new _errors.MissingX509CertsError(`JWK with kid '${kidFromTokenHeader}' does not contain an X.509 certificate chain (x5c) for token at index ${i}.`);
92
+ }
93
+
94
+ // If the chain has more than one certificate AND
95
+ // the last certificate in the x5c chain is the same as the trust anchor,
96
+ // remove the anchor from the chain being passed, as it's supplied separately.
97
+ const certChainBase64 = jwkUsedForVerification.x5c.length > 1 && jwkUsedForVerification.x5c.at(-1) === x509TrustAnchorCertBase64 ? jwkUsedForVerification.x5c.slice(0, -1) : jwkUsedForVerification.x5c;
98
+ const x509ValidationResult = await (0, _ioReactNativeCrypto.verifyCertificateChain)(certChainBase64, x509TrustAnchorCertBase64, x509Options);
99
+ if (!x509ValidationResult.isValid) {
100
+ throw new _errors.X509ValidationError(`X.509 certificate chain validation failed for token at index ${i} (kid: ${kidFromTokenHeader}). Status: ${x509ValidationResult.validationStatus}. Error: ${x509ValidationResult.errorMessage}`, {
101
+ tokenIndex: i,
102
+ kid: kidFromTokenHeader,
103
+ x509ValidationStatus: x509ValidationResult.validationStatus,
104
+ x509ErrorMessage: x509ValidationResult.errorMessage
105
+ });
106
+ }
107
+ return parsedToken;
108
+ });
109
+ return Promise.all(validationPromises);
72
110
  }
73
111
 
74
112
  /**
@@ -86,14 +124,14 @@ async function renewTrustChain(chain) {
86
124
  const entityStatementResult = _types.EntityStatement.safeParse(decoded);
87
125
  const entityConfigurationResult = _types.EntityConfiguration.safeParse(decoded);
88
126
  if (entityConfigurationResult.success) {
89
- return (0, _.getSignedEntityConfiguration)(entityConfigurationResult.data.payload.iss, {
127
+ return (0, _buildChain.getSignedEntityConfiguration)(entityConfigurationResult.data.payload.iss, {
90
128
  appFetch
91
129
  });
92
130
  }
93
131
  if (entityStatementResult.success) {
94
132
  const entityStatement = entityStatementResult.data;
95
133
  const parentBaseUrl = entityStatement.payload.iss;
96
- const parentECJwt = await (0, _.getSignedEntityConfiguration)(parentBaseUrl, {
134
+ const parentECJwt = await (0, _buildChain.getSignedEntityConfiguration)(parentBaseUrl, {
97
135
  appFetch
98
136
  });
99
137
  const parentEC = _types.EntityConfiguration.parse((0, _utils.decode)(parentECJwt));
@@ -104,7 +142,7 @@ async function renewTrustChain(chain) {
104
142
  missingInEntityUrl: parentBaseUrl
105
143
  });
106
144
  }
107
- return (0, _.getSignedEntityStatement)(federationFetchEndpoint, entityStatement.payload.sub, {
145
+ return (0, _buildChain.getSignedEntityStatement)(federationFetchEndpoint, entityStatement.payload.sub, {
108
146
  appFetch
109
147
  });
110
148
  }
@@ -113,4 +151,38 @@ async function renewTrustChain(chain) {
113
151
  });
114
152
  }));
115
153
  }
116
- //# sourceMappingURL=chain.js.map
154
+
155
+ /**
156
+ * Verify a given trust chain is actually valid.
157
+ * It can handle fast chain renewal, which means we try to fetch a fresh version of each statement.
158
+ *
159
+ * @param trustAnchorEntity The entity configuration of the known trust anchor
160
+ * @param chain The chain of statements to be validated
161
+ * @param x509Options Options for the verification process
162
+ * @param appFetch (optional) fetch api implementation
163
+ * @param renewOnFail Whether to attempt to renew the trust chain if the initial validation fails
164
+ * @returns The result of the chain validation
165
+ * @throws {FederationError} If the chain is not valid
166
+ */
167
+ async function verifyTrustChain(trustAnchorEntity, chain) {
168
+ let x509Options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
169
+ connectTimeout: 10000,
170
+ readTimeout: 10000,
171
+ requireCrl: true
172
+ };
173
+ let {
174
+ appFetch = fetch,
175
+ renewOnFail = true
176
+ } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
177
+ try {
178
+ return validateTrustChain(trustAnchorEntity, chain, x509Options);
179
+ } catch (error) {
180
+ if (renewOnFail) {
181
+ const renewedChain = await renewTrustChain(chain, appFetch);
182
+ return validateTrustChain(trustAnchorEntity, renewedChain, x509Options);
183
+ } else {
184
+ throw error;
185
+ }
186
+ }
187
+ }
188
+ //# sourceMappingURL=verify-chain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_types","require","z","_interopRequireWildcard","_utils","_errors","_ioReactNativeCrypto","_buildChain","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","FirstElementShape","EntityConfiguration","MiddleElementShape","EntityStatement","LastElementShape","union","TrustAnchorEntityConfiguration","validateTrustChain","trustAnchorEntity","chain","x509Options","length","TrustChainEmptyError","selectTokenShape","elementIndex","selectKid","currentIndex","token","TrustChainTokenMissingError","index","shape","parse","decode","header","kid","selectKeys","payload","jwks","keys","nextIndex","nextToken","x509TrustAnchorCertBase64","getTrustAnchorX509Certificate","validationPromises","map","tokenString","i","kidFromTokenHeader","signerJwks","parsedToken","verify","jwkUsedForVerification","find","k","FederationError","tokenIndex","x5c","MissingX509CertsError","certChainBase64","at","slice","x509ValidationResult","verifyCertificateChain","isValid","X509ValidationError","validationStatus","errorMessage","x509ValidationStatus","x509ErrorMessage","Promise","all","renewTrustChain","appFetch","arguments","undefined","fetch","decoded","entityStatementResult","safeParse","entityConfigurationResult","success","getSignedEntityConfiguration","data","iss","entityStatement","parentBaseUrl","parentECJwt","parentEC","federationFetchEndpoint","metadata","federation_entity","federation_fetch_endpoint","MissingFederationFetchEndpointError","sub","entityBaseUrl","missingInEntityUrl","getSignedEntityStatement","TrustChainRenewalError","originalChain","verifyTrustChain","connectTimeout","readTimeout","requireCrl","renewOnFail","error","renewedChain"],"sourceRoot":"../../../src","sources":["trust/verify-chain.ts"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,CAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAMA,IAAAI,OAAA,GAAAJ,OAAA;AASA,IAAAK,oBAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AAGuB,SAAAO,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAN,wBAAAU,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GA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AAEC,WAAW,CAAC;EAClE,CAAC,CAAC,OAAOoF,KAAK,EAAE;IACd,IAAID,WAAW,EAAE;MACf,MAAME,YAAY,GAAG,MAAMlC,eAAe,CAACpD,KAAK,EAAEqD,QAAQ,CAAC;MAC3D,OAAOvD,kBAAkB,CAACC,iBAAiB,EAAEuF,YAAY,EAAErF,WAAW,CAAC;IACzE,CAAC,MAAM;MACL,MAAMoF,KAAK;IACb;EACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"names":["_errorCodes","require","serializeAttrs","attrs","Object","entries","filter","_ref","v","undefined","map","_ref2","k","Array","isArray","join","JSON","stringify","_","exports","IoWalletError","Error","code","constructor","message","name","ValidationFailed","_ref3","claim","reason","UnexpectedStatusCodeError","_ref4","statusCode","IssuerResponseError","params","IssuerResponseErrorCodes","IssuerGenericError","WalletProviderResponseError","WalletProviderResponseErrorCodes","WalletProviderGenericError","RelyingPartyResponseError","RelyingPartyResponseErrorCodes","RelyingPartyGenericError","extractErrorMessageFromIssuerConf","errorCode","_ref5","issuerConf","credentialType","credentialConfiguration","openid_credential_issuer","credential_configurations_supported","issuance_errors_supported","localesList","display","reduce","acc","_ref6","locale","rest","makeErrorTypeGuard","ErrorClass","error","isIssuerResponseError","isWalletProviderResponseError","isRelyingPartyResponseError","ResponseErrorBuilder","errorCases","handle","status","buildFrom","originalError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAAA,WAAA,GAAAC,OAAA;AAeA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,cAAc,GACzBC,KAA8E,IAE9EC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAClBG,MAAM,CAACC,IAAA;EAAA,IAAC,GAAGC,CAAC,CAAC,GAAAD,IAAA;EAAA,OAAKC,CAAC,KAAKC,SAAS;AAAA,EAAC,CAClCC,GAAG,CAACC,KAAA,IAAY;EAAA,IAAX,C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A;AACK,MAAMC,2BAA2B,GAAGL,kBAAkB,CAC3DnB,yBACF,CAAC;;AAED;AAAArB,OAAA,CAAA6C,2BAAA,GAAAA,2BAAA;AAuBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,oBAAoB,CAA6C;EACpEC,UAAU,GAEd,CAAC,CAAC;EAEN3C,WAAWA,CAASqC,UAAa,EAAE;IAAA,KAAfA,UAAa,GAAbA,UAAa;EAAG;EAEpCO,MAAMA,CAACC,MAAoB,EAAElC,MAAoB,EAAE;IACjD,IAAI,CAACgC,UAAU,CAACE,MAAM,CAAC,GAAGlC,MAAM;IAChC,OAAO,IAAI;EACb;EAEAmC,SAASA,CAACC,aAAwC,EAAE;IAClD,MAAMpC,MAAM,GACV,IAAI,CAACgC,UAAU,CAACI,aAAa,CAACtC,UAAU,CAAC,IAAI,IAAI,CAACkC,UAAU,CAAC,GAAG,CAAC;IAEnE,IAAIhC,MAAM,EAAE;MACV,OAAO,IAAI,IAAI,CAAC0B,UAAU,CAAC;QAAE,GAAGU,aAAa;QAAE,GAAGpC;MAAO,CAAC,CAAC;IAC7D;IAEA,OAAOoC,aAAa;EACtB;AACF;AAACnD,OAAA,CAAA8C,oBAAA,GAAAA,oBAAA"}
1
+ {"version":3,"names":["_errorCodes","require","serializeAttrs","attrs","Object","entries","filter","_ref","v","undefined","map","_ref2","k","Array","isArray","join","JSON","stringify","_","exports","IoWalletError","Error","code","constructor","message","name","ValidationFailed","_ref3","claim","reason","UnexpectedStatusCodeError","_ref4","statusCode","IssuerResponseError","params","IssuerResponseErrorCodes","IssuerGenericError","WalletProviderResponseError","WalletProviderResponseErrorCodes","WalletProviderGenericError","RelyingPartyResponseError","RelyingPartyResponseErrorCodes","RelyingPartyGenericError","extractErrorMessageFromIssuerConf","errorCode","_ref5","issuerConf","credentialType","credentialConfiguration","openid_credential_issuer","credential_configurations_supported","issuance_errors_supported","localesList","display","reduce","acc","_ref6","locale","rest","makeErrorTypeGuard","ErrorClass","error","isIssuerResponseError","isWalletProviderResponseError","isRelyingPartyResponseError","ResponseErrorBuilder","errorCases","handle","status","buildFrom","originalError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAgBA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,cAAc,GACzBC,KAA8E,IAE9EC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAClBG,MAAM,CAACC,IAAA;EAAA,IAAC,GAAGC,CAAC,CAAC,GAAAD,IAAA;EAAA,OAAKC,CAAC,KAAKC,SAAS;AAAA,EAAC,CAClCC,GAAG,CAACC,KAAA,IAAY;EAAA,IAAX,CAACC,CAAC,EAAEJ,CAAC,CAAC,GAAAG,KAAA;EACV,IAAIE,KAAK,CAACC,OAAO,CAACN,CAAC,CAAC,EAAE,OAAO,CAACI,CAAC,EAAG,IAAGJ,CAAC,CAACO,IAAI,CAAC,IAAI,CAAE,GAAE,CAAC;EACrD,IAAI,OAAOP,CAAC,KAAK,QAAQ,EAAE,OAAO,CAACI,CAAC,EAAEI,IAAI,CAACC,SAAS,CAACT,CAAC,CAAC,CAAC;EACxD,OAAO,CAACI,CAAC,EAAEJ,CAAC,CAAC;AACf,CAAC,CAAC,CACDE,GAAG,CAAEQ,CAAC,IAAKA,CAAC,CAACH,IAAI,CAAC,GAAG,CAAC,CAAC,CACvBA,IAAI,CAAC,GAAG,CAAC;;AAEd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVAI,OAAA,CAAAjB,cAAA,GAAAA,cAAA;AAWO,MAAMkB,aAAa,SAASC,KAAK,CAAC;EACvC;EACAC,IAAI,GAAW,uBAAuB;EAEtCC,WAAWA,CAACC,OAAgB,EAAE;IAC5B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,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D;IAEA,OAAOoC,aAAa;EACtB;AACF;AAACnD,OAAA,CAAA8C,oBAAA,GAAAA,oBAAA"}
@@ -1,4 +1,4 @@
1
- import { getCredentialIssuerEntityConfiguration } from "../../trust";
1
+ import { getCredentialIssuerEntityConfiguration } from "../../trust/build-chain";
2
2
  /**
3
3
  * WARNING: This function must be called after {@link startFlow}. The next function to be called is {@link startUserAuthorization}.
4
4
  * The Issuer trust evaluation phase.
@@ -1 +1 @@
1
- {"version":3,"names":["getCredentialIssuerEntityConfiguration","evaluateIssuerTrust","issuerUrl","context","arguments","length","undefined","issuerConf","appFetch","then","_","payload","metadata"],"sourceRoot":"../../../../src","sources":["credential/issuance/02-evaluate-issuer-trust.ts"],"mappings":"AAAA,SAASA,sCAAsC,QAAQ,aAAa;AAcpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAwC,GAAG,eAAAA,CACtDC,SAAS,EAEN;EAAA,IADHC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEZ,MAAMG,UAAU,GAAG,MAAMP,sCAAsC,CAACE,SAAS,EAAE;IACzEM,QAAQ,EAAEL,OAAO,CAACK;EACpB,CAAC,CAAC,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,OAAO,CAACC,QAAQ,CAAC;EAClC,OAAO;IAAEL;EAAW,CAAC;AACvB,CAAC"}
1
+ {"version":3,"names":["getCredentialIssuerEntityConfiguration","evaluateIssuerTrust","issuerUrl","context","arguments","length","undefined","issuerConf","appFetch","then","_","payload","metadata"],"sourceRoot":"../../../../src","sources":["credential/issuance/02-evaluate-issuer-trust.ts"],"mappings":"AAGA,SAASA,sCAAsC,QAAQ,yBAAyB;AAWhF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAwC,GAAG,eAAAA,CACtDC,SAAS,EAEN;EAAA,IADHC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEZ,MAAMG,UAAU,GAAG,MAAMP,sCAAsC,CAACE,SAAS,EAAE;IACzEM,QAAQ,EAAEL,OAAO,CAACK;EACpB,CAAC,CAAC,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,OAAO,CAACC,QAAQ,CAAC;EAClC,OAAO;IAAEL;EAAW,CAAC;AACvB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { getRelyingPartyEntityConfiguration } from "../../trust";
1
+ import { getRelyingPartyEntityConfiguration } from "../../trust/build-chain";
2
2
  /**
3
3
  * The Relying Party trust evaluation phase.
4
4
  * Fetch the Relying Party's configuration and verify trust.
@@ -1 +1 @@
1
- {"version":3,"names":["getRelyingPartyEntityConfiguration","evaluateRelyingPartyTrust","rpUrl","appFetch","fetch","arguments","length","undefined","payload","metadata","rpConf","sub","subject"],"sourceRoot":"../../../../src","sources":["credential/presentation/02-evaluate-rp-trust.ts"],"mappings":"AAAA,SAASA,kCAAkC,QAAQ,aAAa;AAehE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,yBAAoD,GAAG,eAAAA,CAClEC,KAAK,EAEF;EAAA,IADH;IAAEC,QAAQ,GAAGC;EAAM,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEzB,MAAM;IACJG,OAAO,EAAE;MAAEC,QAAQ,EAAEC,MAAM;MAAEC;IAAI;EACnC,CAAC,GAAG,MAAMX,kCAAkC,CAACE,KAAK,EAAE;IAClDC;EACF,CAAC,CAAC;EACF,OAAO;IAAEO,MAAM;IAAEE,OAAO,EAAED;EAAI,CAAC;AACjC,CAAC"}
1
+ {"version":3,"names":["getRelyingPartyEntityConfiguration","evaluateRelyingPartyTrust","rpUrl","appFetch","fetch","arguments","length","undefined","payload","metadata","rpConf","sub","subject"],"sourceRoot":"../../../../src","sources":["credential/presentation/02-evaluate-rp-trust.ts"],"mappings":"AAGA,SAASA,kCAAkC,QAAQ,yBAAyB;AAY5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,yBAAoD,GAAG,eAAAA,CAClEC,KAAK,EAEF;EAAA,IADH;IAAEC,QAAQ,GAAGC;EAAM,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEzB,MAAM;IACJG,OAAO,EAAE;MAAEC,QAAQ,EAAEC,MAAM;MAAEC;IAAI;EACnC,CAAC,GAAG,MAAMX,kCAAkC,CAACE,KAAK,EAAE;IAClDC;EACF,CAAC,CAAC;EACF,OAAO;IAAEO,MAAM;IAAEE,OAAO,EAAED;EAAI,CAAC;AACjC,CAAC"}