@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
@@ -1,263 +1,6 @@
1
- import { decode, verify } from "./utils";
2
- import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
3
- import { CredentialIssuerEntityConfiguration, EntityConfiguration, EntityStatement, FederationListResponse, RelyingPartyEntityConfiguration, TrustAnchorEntityConfiguration, WalletProviderEntityConfiguration } from "./types";
4
- import { renewTrustChain, validateTrustChain } from "./chain";
5
- import { hasStatusOrThrow } from "../utils/misc";
6
- import { BuildTrustChainError, FederationListParseError, MissingFederationFetchEndpointError, RelyingPartyNotAuthorizedError, TrustAnchorKidMissingError } from "./errors";
7
- /**
8
- * Verify a given trust chain is actually valid.
9
- * It can handle fast chain renewal, which means we try to fetch a fresh version of each statement.
10
- *
11
- * @param trustAnchorEntity The entity configuration of the known trust anchor
12
- * @param chain The chain of statements to be validated
13
- * @param renewOnFail Whether to renew the provided chain if the validation fails at first. Default: true
14
- * @param appFetch Fetch api implementation. Default: the built-in implementation
15
- * @returns The result of the chain validation
16
- * @throws {FederationError} If the chain is not valid
17
- */
18
- export async function verifyTrustChain(trustAnchorEntity, chain) {
19
- let {
20
- appFetch = fetch,
21
- renewOnFail = true
22
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
23
- try {
24
- return validateTrustChain(trustAnchorEntity, chain);
25
- } catch (error) {
26
- if (renewOnFail) {
27
- const renewedChain = await renewTrustChain(chain, appFetch);
28
- return validateTrustChain(trustAnchorEntity, renewedChain);
29
- } else {
30
- throw error;
31
- }
32
- }
33
- }
34
-
35
- /**
36
- * Fetch the signed entity configuration token for an entity
37
- *
38
- * @param entityBaseUrl The url of the entity to fetch
39
- * @param appFetch (optional) fetch api implementation
40
- * @returns The signed Entity Configuration token
41
- */
42
- export async function getSignedEntityConfiguration(entityBaseUrl) {
43
- let {
44
- appFetch = fetch
45
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
46
- const wellKnownUrl = `${entityBaseUrl}/.well-known/openid-federation`;
47
- return await appFetch(wellKnownUrl, {
48
- method: "GET"
49
- }).then(hasStatusOrThrow(200)).then(res => res.text());
50
- }
51
-
52
- /**
53
- * Fetch and parse the entity configuration document for a given federation entity.
54
- * This is an inner method to serve public interfaces.
55
- *
56
- * To add another entity configuration type (example: Foo entity type):
57
- * - create its zod schema and type by inherit from the base type (example: FooEntityConfiguration = BaseEntityConfiguration.and(...))
58
- * - add such type to EntityConfiguration union
59
- * - add an overload to this function
60
- * - create a public function which use such type (example: getFooEntityConfiguration = (url, options) => Promise<FooEntityConfiguration>)
61
- *
62
- * @param entityBaseUrl The base url of the entity.
63
- * @param schema The expected schema of the entity configuration, according to the kind of entity we are fetching from.
64
- * @param options An optional object with additional options.
65
- * @param options.appFetch An optional instance of the http client to be used.
66
- * @returns The parsed entity configuration object
67
- * @throws {IoWalletError} If the http request fails
68
- * @throws Parse error if the document is not in the expected shape.
69
- */
70
-
71
- async function fetchAndParseEntityConfiguration(entityBaseUrl, schema) {
72
- let {
73
- appFetch = fetch
74
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
75
- const responseText = await getSignedEntityConfiguration(entityBaseUrl, {
76
- appFetch
77
- });
78
- const responseJwt = decodeJwt(responseText);
79
- return schema.parse({
80
- header: responseJwt.protectedHeader,
81
- payload: responseJwt.payload
82
- });
83
- }
84
- export const getWalletProviderEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, WalletProviderEntityConfiguration, options);
85
- export const getCredentialIssuerEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, CredentialIssuerEntityConfiguration, options);
86
- export const getTrustAnchorEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, TrustAnchorEntityConfiguration, options);
87
- export const getRelyingPartyEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, RelyingPartyEntityConfiguration, options);
88
- export const getEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, EntityConfiguration, options);
89
-
90
- /**
91
- * Fetch and parse the entity statement document for a given federation entity.
92
- *
93
- * @param accreditationBodyBaseUrl The base url of the accreditation body which holds and signs the required entity statement
94
- * @param subordinatedEntityBaseUrl The url that identifies the subordinate entity
95
- * @param appFetch An optional instance of the http client to be used.
96
- * @returns The parsed entity configuration object
97
- * @throws {IoWalletError} If the http request fails
98
- */
99
- export async function getEntityStatement(accreditationBodyBaseUrl, subordinatedEntityBaseUrl) {
100
- let {
101
- appFetch = fetch
102
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
103
- const responseText = await getSignedEntityStatement(accreditationBodyBaseUrl, subordinatedEntityBaseUrl, {
104
- appFetch
105
- });
106
- const responseJwt = decodeJwt(responseText);
107
- return EntityStatement.parse({
108
- header: responseJwt.protectedHeader,
109
- payload: responseJwt.payload
110
- });
111
- }
112
-
113
- /**
114
- * Fetch the entity statement document for a given federation entity.
115
- *
116
- * @param federationFetchEndpoint The exact endpoint provided by the parent EC's metadata.
117
- * @param subordinatedEntityBaseUrl The url that identifies the subordinate entity.
118
- * @param appFetch An optional instance of the http client to be used.
119
- * @returns The signed entity statement token.
120
- * @throws {IoWalletError} If the http request fails.
121
- */
122
- export async function getSignedEntityStatement(federationFetchEndpoint, subordinatedEntityBaseUrl) {
123
- let {
124
- appFetch = fetch
125
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
126
- const url = new URL(federationFetchEndpoint);
127
- url.searchParams.set("sub", subordinatedEntityBaseUrl);
128
- return await appFetch(url.toString(), {
129
- method: "GET"
130
- }).then(hasStatusOrThrow(200)).then(res => res.text());
131
- }
132
-
133
- /**
134
- * Fetch the federation list document from a given endpoint.
135
- *
136
- * @param federationListEndpoint The URL of the federation list endpoint.
137
- * @param appFetch An optional instance of the http client to be used.
138
- * @returns The federation list as an array of strings.
139
- * @throws {IoWalletError} If the HTTP request fails.
140
- * @throws {FederationError} If the result is not in the expected format.
141
- */
142
- export async function getFederationList(federationListEndpoint) {
143
- let {
144
- appFetch = fetch
145
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
146
- return await appFetch(federationListEndpoint, {
147
- method: "GET"
148
- }).then(hasStatusOrThrow(200)).then(res => res.json()).then(json => {
149
- const result = FederationListResponse.safeParse(json);
150
- if (!result.success) {
151
- throw new FederationListParseError(`Invalid federation list format received from ${federationListEndpoint}. Error: ${result.error.message}`, {
152
- url: federationListEndpoint,
153
- parseError: result.error.toString()
154
- });
155
- }
156
- return result.data;
157
- });
158
- }
159
-
160
- /**
161
- * Build a not-verified trust chain for a given Relying Party (RP) entity.
162
- *
163
- * @param relyingPartyEntityBaseUrl The base URL of the RP entity
164
- * @param trustAnchorKey The public key of the Trust Anchor (TA) entity
165
- * @param appFetch An optional instance of the http client to be used.
166
- * @returns A list of signed tokens that represent the trust chain, in the order of the chain (from the RP to the Trust Anchor)
167
- * @throws {FederationError} When an element of the chain fails to parse or other build steps fail.
168
- */
169
- export async function buildTrustChain(relyingPartyEntityBaseUrl, trustAnchorKey) {
170
- let appFetch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : fetch;
171
- // 1: Recursively gather the trust chain from the RP up to the Trust Anchor
172
- const trustChain = await gatherTrustChain(relyingPartyEntityBaseUrl, appFetch);
173
-
174
- // 2: Trust Anchor signature verification
175
- const trustAnchorJwt = trustChain[trustChain.length - 1];
176
- if (!trustAnchorJwt) {
177
- throw new BuildTrustChainError("Cannot verify trust anchor: missing entity configuration in gathered chain.", {
178
- relyingPartyUrl: relyingPartyEntityBaseUrl
179
- });
180
- }
181
- if (!trustAnchorKey.kid) {
182
- throw new TrustAnchorKidMissingError();
183
- }
184
- await verify(trustAnchorJwt, trustAnchorKey.kid, [trustAnchorKey]);
185
-
186
- // 3: Check the federation list
187
- const trustAnchorConfig = EntityConfiguration.parse(decode(trustAnchorJwt));
188
- const federationListEndpoint = trustAnchorConfig.payload.metadata.federation_entity.federation_list_endpoint;
189
- if (federationListEndpoint) {
190
- const federationList = await getFederationList(federationListEndpoint, {
191
- appFetch
192
- });
193
- if (!federationList.includes(relyingPartyEntityBaseUrl)) {
194
- throw new RelyingPartyNotAuthorizedError("Relying Party entity base URL is not authorized by the Trust Anchor's federation list.", {
195
- relyingPartyUrl: relyingPartyEntityBaseUrl,
196
- federationListEndpoint
197
- });
198
- }
199
- }
200
- return trustChain;
201
- }
202
-
203
- /**
204
- * Recursively gather the trust chain for an entity and all its superiors.
205
- * @param entityBaseUrl The base URL of the entity for which to gather the chain.
206
- * @param appFetch An optional instance of the http client to be used.
207
- * @param isLeaf Whether the current entity is the leaf of the chain.
208
- * @returns A full ordered list of JWTs (ECs and ESs) forming the trust chain.
209
- * @throws {FederationError} If any of the fetched documents fail to parse or other errors occur during the gathering process.
210
- */
211
- async function gatherTrustChain(entityBaseUrl, appFetch) {
212
- let isLeaf = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
213
- const chain = [];
214
-
215
- // Fetch self-signed EC (only needed for the leaf)
216
- const entityECJwt = await getSignedEntityConfiguration(entityBaseUrl, {
217
- appFetch
218
- });
219
- const entityEC = EntityConfiguration.parse(decode(entityECJwt));
220
- if (isLeaf) {
221
- // Only push EC for the leaf
222
- chain.push(entityECJwt);
223
- }
224
-
225
- // Find authority_hints (parent, if any)
226
- const authorityHints = entityEC.payload.authority_hints ?? [];
227
- if (authorityHints.length === 0) {
228
- // This is the Trust Anchor (no parent)
229
- if (!isLeaf) {
230
- chain.push(entityECJwt);
231
- }
232
- return chain;
233
- }
234
- const parentEntityBaseUrl = authorityHints[0];
235
-
236
- // Fetch parent EC
237
- const parentECJwt = await getSignedEntityConfiguration(parentEntityBaseUrl, {
238
- appFetch
239
- });
240
- const parentEC = EntityConfiguration.parse(decode(parentECJwt));
241
-
242
- // Fetch ES
243
- const federationFetchEndpoint = parentEC.payload.metadata.federation_entity.federation_fetch_endpoint;
244
- if (!federationFetchEndpoint) {
245
- throw new MissingFederationFetchEndpointError(`Missing federation_fetch_endpoint in parent's (${parentEntityBaseUrl}) configuration when gathering chain for ${entityBaseUrl}.`, {
246
- entityBaseUrl,
247
- missingInEntityUrl: parentEntityBaseUrl
248
- });
249
- }
250
- const entityStatementJwt = await getSignedEntityStatement(federationFetchEndpoint, entityBaseUrl, {
251
- appFetch
252
- });
253
- // Validate the ES
254
- EntityStatement.parse(decode(entityStatementJwt));
255
-
256
- // Push this ES into the chain
257
- chain.push(entityStatementJwt);
258
-
259
- // Recurse into the parent
260
- const parentChain = await gatherTrustChain(parentEntityBaseUrl, appFetch, false);
261
- return chain.concat(parentChain);
262
- }
1
+ import * as Build from "./build-chain";
2
+ import * as Verify from "./verify-chain";
3
+ import * as Errors from "./errors";
4
+ import * as Types from "./types";
5
+ export { Build, Verify, Errors, Types };
263
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["decode","verify","decodeJwt","CredentialIssuerEntityConfiguration","EntityConfiguration","EntityStatement","FederationListResponse","RelyingPartyEntityConfiguration","TrustAnchorEntityConfiguration","WalletProviderEntityConfiguration","renewTrustChain","validateTrustChain","hasStatusOrThrow","BuildTrustChainError","FederationListParseError","MissingFederationFetchEndpointError","RelyingPartyNotAuthorizedError","TrustAnchorKidMissingError","verifyTrustChain","trustAnchorEntity","chain","appFetch","fetch","renewOnFail","arguments","length","undefined","error","renewedChain","getSignedEntityConfiguration","entityBaseUrl","wellKnownUrl","method","then","res","text","fetchAndParseEntityConfiguration","schema","responseText","responseJwt","parse","header","protectedHeader","payload","getWalletProviderEntityConfiguration","options","getCredentialIssuerEntityConfiguration","getTrustAnchorEntityConfiguration","getRelyingPartyEntityConfiguration","getEntityConfiguration","getEntityStatement","accreditationBodyBaseUrl","subordinatedEntityBaseUrl","getSignedEntityStatement","federationFetchEndpoint","url","URL","searchParams","set","toString","getFederationList","federationListEndpoint","json","result","safeParse","success","message","parseError","data","buildTrustChain","relyingPartyEntityBaseUrl","trustAnchorKey","trustChain","gatherTrustChain","trustAnchorJwt","relyingPartyUrl","kid","trustAnchorConfig","metadata","federation_entity","federation_list_endpoint","federationList","includes","isLeaf","entityECJwt","entityEC","push","authorityHints","authority_hints","parentEntityBaseUrl","parentECJwt","parentEC","federation_fetch_endpoint","missingInEntityUrl","entityStatementJwt","parentChain","concat"],"sourceRoot":"../../../src","sources":["trust/index.ts"],"mappings":"AAAA,SAASA,MAAM,EAAEC,MAAM,QAAQ,SAAS;AACxC,SAASD,MAAM,IAAIE,SAAS,QAAQ,6BAA6B;AACjE,SACEC,mCAAmC,EACnCC,mBAAmB,EACnBC,eAAe,EACfC,sBAAsB,EACtBC,+BAA+B,EAC/BC,8BAA8B,EAC9BC,iCAAiC,QAC5B,SAAS;AAChB,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,SAAS;AAC7D,SAASC,gBAAgB,QAAQ,eAAe;AAEhD,SACEC,oBAAoB,EACpBC,wBAAwB,EACxBC,mCAAmC,EACnCC,8BAA8B,EAC9BC,0BAA0B,QACrB,UAAU;AAWjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,gBAAgBA,CACpCC,iBAAiD,EACjDC,KAAe,EAKiC;EAAA,IAJhD;IACEC,QAAQ,GA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,CAAC4D,mBAAmB,EAAE;IAC1EpE;EACF,CAAC,CAAC;EACF,MAAMsE,QAAQ,GAAGvF,mBAAmB,CAACoC,KAAK,CAACxC,MAAM,CAAC0F,WAAW,CAAC,CAAC;;EAE/D;EACA,MAAMpC,uBAAuB,GAC3BqC,QAAQ,CAAChD,OAAO,CAACmC,QAAQ,CAACC,iBAAiB,CAACa,yBAAyB;EACvE,IAAI,CAACtC,uBAAuB,EAAE;IAC5B,MAAM,IAAIvC,mCAAmC,CAC1C,kDAAiD0E,mBAAoB,4CAA2C3D,aAAc,GAAE,EACjI;MAAEA,aAAa;MAAE+D,kBAAkB,EAAEJ;IAAoB,CAC3D,CAAC;EACH;EAEA,MAAMK,kBAAkB,GAAG,MAAMzC,wBAAwB,CACvDC,uBAAuB,EACvBxB,aAAa,EACb;IAAET;EAAS,CACb,CAAC;EACD;EACAhB,eAAe,CAACmC,KAAK,CAACxC,MAAM,CAAC8F,kBAAkB,CAAC,CAAC;;EAEjD;EACA1E,KAAK,CAACkE,IAAI,CAACQ,kBAAkB,CAAC;;EAE9B;EACA,MAAMC,WAAW,GAAG,MAAMtB,gBAAgB,CACxCgB,mBAAmB,EACnBpE,QAAQ,EACR,KACF,CAAC;EAED,OAAOD,KAAK,CAAC4E,MAAM,CAACD,WAAW,CAAC;AAClC"}
1
+ {"version":3,"names":["Build","Verify","Errors","Types"],"sourceRoot":"../../../src","sources":["trust/index.ts"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,eAAe;AACtC,OAAO,KAAKC,MAAM,MAAM,gBAAgB;AACxC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,OAAO,KAAKC,KAAK,MAAM,SAAS;AAEhC,SAASH,KAAK,EAAEC,MAAM,EAAEC,MAAM,EAAEC,KAAK"}
@@ -1,4 +1,5 @@
1
1
  import { decode as decodeJwt, verify as verifyJwt } from "@pagopa/io-react-native-jwt";
2
+ import { FederationError } from "./errors";
2
3
  // Verify a token signature
3
4
  // The kid is extracted from the token header
4
5
  export const verify = async (token, kid, jwks) => {
@@ -30,4 +31,30 @@ export const decode = token => {
30
31
  payload
31
32
  };
32
33
  };
34
+
35
+ /**
36
+ * Extracts the X.509 Trust Anchor certificate (Base64 encoded) from the
37
+ * Trust Anchor's Entity Configuration.
38
+ *
39
+ * @param trustAnchorEntity The entity configuration of the known trust anchor.
40
+ * @returns The Base64 encoded X.509 certificate string.
41
+ * @throws {FederationError} If the certificate cannot be derived.
42
+ */
43
+ export function getTrustAnchorX509Certificate(trustAnchorEntity) {
44
+ const taHeaderKid = trustAnchorEntity.header.kid;
45
+ const taSigningJwk = trustAnchorEntity.payload.jwks.keys.find(key => key.kid === taHeaderKid);
46
+ if (!taSigningJwk) {
47
+ throw new FederationError(`Cannot derive X.509 Trust Anchor certificate: JWK with kid '${taHeaderKid}' not found in Trust Anchor's JWKS.`, {
48
+ trustAnchorKid: taHeaderKid,
49
+ reason: "JWK not found for header kid"
50
+ });
51
+ }
52
+ if (taSigningJwk.x5c && taSigningJwk.x5c.length > 0 && taSigningJwk.x5c[0]) {
53
+ return taSigningJwk.x5c[0];
54
+ }
55
+ throw new FederationError(`Cannot derive X.509 Trust Anchor certificate: JWK with kid '${taHeaderKid}' does not contain a valid 'x5c' certificate array.`, {
56
+ trustAnchorKid: taHeaderKid,
57
+ reason: "Missing or empty x5c in JWK"
58
+ });
59
+ }
33
60
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["decode","decodeJwt","verify","verifyJwt","token","kid","jwks","jwk","find","k","Error","protectedHeader","header","payload"],"sourceRoot":"../../../src","sources":["trust/utils.ts"],"mappings":"AAAA,SACEA,MAAM,IAAIC,SAAS,EACnBC,MAAM,IAAIC,SAAS,QACd,6BAA6B;AASpC;AACA;AACA,OAAO,MAAMD,MAAM,GAAG,MAAAA,CACpBE,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,MAAMV,SAAS,CAACC,KAAK,EAAEG,GAAG,CAAC;EACxE,OAAO;IAAEK,MAAM;IAAEC;EAAQ,CAAC;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMb,MAAM,GAAII,KAAa,IAAkB;EACpD,MAAM;IAAEO,eAAe,EAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGZ,SAAS,CAACG,KAAK,CAAC;EAC7D,OAAO;IAAEQ,MAAM;IAAEC;EAAQ,CAAC;AAC5B,CAAC"}
1
+ {"version":3,"names":["decode","decodeJwt","verify","verifyJwt","FederationError","token","kid","jwks","jwk","find","k","Error","protectedHeader","header","payload","getTrustAnchorX509Certificate","trustAnchorEntity","taHeaderKid","taSigningJwk","keys","key","trustAnchorKid","reason","x5c","length"],"sourceRoot":"../../../src","sources":["trust/utils.ts"],"mappings":"AAAA,SACEA,MAAM,IAAIC,SAAS,EACnBC,MAAM,IAAIC,SAAS,QACd,6BAA6B;AAGpC,SAASC,eAAe,QAAQ,UAAU;AAQ1C;AACA;AACA,OAAO,MAAMF,MAAM,GAAG,MAAAA,CACpBG,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,MAAMX,SAAS,CAACE,KAAK,EAAEG,GAAG,CAAC;EACxE,OAAO;IAAEK,MAAM;IAAEC;EAAQ,CAAC;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMd,MAAM,GAAIK,KAAa,IAAkB;EACpD,MAAM;IAAEO,eAAe,EAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGb,SAAS,CAACI,KAAK,CAAC;EAC7D,OAAO;IAAEQ,MAAM;IAAEC;EAAQ,CAAC;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,6BAA6BA,CAC3CC,iBAAiD,EACzC;EACR,MAAMC,WAAW,GAAGD,iBAAiB,CAACH,MAAM,CAACP,GAAG;EAChD,MAAMY,YAAY,GAAGF,iBAAiB,CAACF,OAAO,CAACP,IAAI,CAACY,IAAI,CAACV,IAAI,CAC1DW,GAAG,IAAKA,GAAG,CAACd,GAAG,KAAKW,WACvB,CAAC;EAED,IAAI,CAACC,YAAY,EAAE;IACjB,MAAM,IAAId,eAAe,CACtB,+DAA8Da,WAAY,qCAAoC,EAC/G;MAAEI,cAAc,EAAEJ,WAAW;MAAEK,MAAM,EAAE;IAA+B,CACxE,CAAC;EACH;EAEA,IAAIJ,YAAY,CAACK,GAAG,IAAIL,YAAY,CAACK,GAAG,CAACC,MAAM,GAAG,CAAC,IAAIN,YAAY,CAACK,GAAG,CAAC,CAAC,CAAC,EAAE;IAC1E,OAAOL,YAAY,CAACK,GAAG,CAAC,CAAC,CAAC;EAC5B;EAEA,MAAM,IAAInB,eAAe,CACtB,+DAA8Da,WAAY,qDAAoD,EAC/H;IAAEI,cAAc,EAAEJ,WAAW;IAAEK,MAAM,EAAE;EAA8B,CACvE,CAAC;AACH"}
@@ -1,8 +1,9 @@
1
1
  import { EntityConfiguration, EntityStatement, TrustAnchorEntityConfiguration } from "./types";
2
2
  import * as z from "zod";
3
- import { getSignedEntityConfiguration, getSignedEntityStatement } from ".";
4
- import { decode, verify } from "./utils";
5
- import { MissingFederationFetchEndpointError, TrustChainEmptyError, TrustChainRenewalError, TrustChainTokenMissingError } from "./errors";
3
+ import { decode, getTrustAnchorX509Certificate, verify } from "./utils";
4
+ import { FederationError, MissingFederationFetchEndpointError, MissingX509CertsError, TrustChainEmptyError, TrustChainRenewalError, TrustChainTokenMissingError, X509ValidationError } from "./errors";
5
+ import { verifyCertificateChain } from "@pagopa/io-react-native-crypto";
6
+ import { getSignedEntityConfiguration, getSignedEntityStatement } from "./build-chain";
6
7
 
7
8
  // The first element of the chain is supposed to be the Entity Configuration for the document issuer
8
9
  const FirstElementShape = EntityConfiguration;
@@ -13,14 +14,15 @@ const MiddleElementShape = EntityStatement;
13
14
  const LastElementShape = z.union([EntityStatement, TrustAnchorEntityConfiguration]);
14
15
 
15
16
  /**
16
- * Validates a provided trust chain against a known trust
17
+ * Validates a provided trust chain against a known trust anchor, including X.509 certificate checks.
17
18
  *
18
- * @param trustAnchorEntity The entity configuration of the known trust anchor
19
- * @param chain The chain of statements to be validated
20
- * @returns The list of parsed token representing the chain
21
- * @throws {FederationError} If the chain is not valid
19
+ * @param trustAnchorEntity The entity configuration of the known trust anchor (for JWT validation).
20
+ * @param chain The chain of statements to be validated.
21
+ * @param x509Options Options for X.509 certificate validation.
22
+ * @returns The list of parsed tokens representing the chain.
23
+ * @throws {FederationError} If the chain is not valid (JWT or X.509). Specific errors like TrustChainEmptyError, X509ValidationError may be thrown.
22
24
  */
23
- export async function validateTrustChain(trustAnchorEntity, chain) {
25
+ export async function validateTrustChain(trustAnchorEntity, chain, x509Options) {
24
26
  // If the chain is empty, fail
25
27
  if (chain.length === 0) {
26
28
  throw new TrustChainEmptyError("Cannot verify empty trust chain.");
@@ -29,7 +31,7 @@ export async function validateTrustChain(trustAnchorEntity, chain) {
29
31
  // Select the expected token shape
30
32
  const selectTokenShape = elementIndex => elementIndex === 0 ? FirstElementShape : elementIndex === chain.length - 1 ? LastElementShape : MiddleElementShape;
31
33
 
32
- // select the kid from the current index
34
+ // Select the kid from the current index
33
35
  const selectKid = currentIndex => {
34
36
  const token = chain[currentIndex];
35
37
  if (!token) {
@@ -41,8 +43,8 @@ export async function validateTrustChain(trustAnchorEntity, chain) {
41
43
  return shape.parse(decode(token)).header.kid;
42
44
  };
43
45
 
44
- // select keys from the next token
45
- // if the current token is the last, keys from trust anchor will be used
46
+ // Select keys from the next token
47
+ // If the current token is the last, keys from trust anchor will be used
46
48
  const selectKeys = currentIndex => {
47
49
  if (currentIndex === chain.length - 1) {
48
50
  return trustAnchorEntity.payload.jwks.keys;
@@ -57,10 +59,45 @@ export async function validateTrustChain(trustAnchorEntity, chain) {
57
59
  const shape = selectTokenShape(nextIndex);
58
60
  return shape.parse(decode(nextToken)).payload.jwks.keys;
59
61
  };
62
+ const x509TrustAnchorCertBase64 = getTrustAnchorX509Certificate(trustAnchorEntity);
60
63
 
61
64
  // Iterate the chain and validate each element's signature against the public keys of its next
62
65
  // If there is no next, hence it's the end of the chain, and it must be verified by the Trust Anchor
63
- return Promise.all(chain.map((token, i) => [token, selectKid(i), selectKeys(i)]).map(args => verify(...args)));
66
+ const validationPromises = chain.map(async (tokenString, i) => {
67
+ const kidFromTokenHeader = selectKid(i);
68
+ const signerJwks = selectKeys(i);
69
+
70
+ // Step 1: Verify JWT signature
71
+ const parsedToken = await verify(tokenString, kidFromTokenHeader, signerJwks);
72
+
73
+ // Step 2: X.509 Certificate Chain Validation
74
+ const jwkUsedForVerification = signerJwks.find(k => k.kid === kidFromTokenHeader);
75
+ if (!jwkUsedForVerification) {
76
+ throw new FederationError(`JWK with kid '${kidFromTokenHeader}' was not found in signer's JWKS for token at index ${i}, though JWT verification passed.`, {
77
+ tokenIndex: i,
78
+ kid: kidFromTokenHeader
79
+ });
80
+ }
81
+ if (!jwkUsedForVerification.x5c || jwkUsedForVerification.x5c.length === 0) {
82
+ throw new MissingX509CertsError(`JWK with kid '${kidFromTokenHeader}' does not contain an X.509 certificate chain (x5c) for token at index ${i}.`);
83
+ }
84
+
85
+ // If the chain has more than one certificate AND
86
+ // the last certificate in the x5c chain is the same as the trust anchor,
87
+ // remove the anchor from the chain being passed, as it's supplied separately.
88
+ const certChainBase64 = jwkUsedForVerification.x5c.length > 1 && jwkUsedForVerification.x5c.at(-1) === x509TrustAnchorCertBase64 ? jwkUsedForVerification.x5c.slice(0, -1) : jwkUsedForVerification.x5c;
89
+ const x509ValidationResult = await verifyCertificateChain(certChainBase64, x509TrustAnchorCertBase64, x509Options);
90
+ if (!x509ValidationResult.isValid) {
91
+ throw new X509ValidationError(`X.509 certificate chain validation failed for token at index ${i} (kid: ${kidFromTokenHeader}). Status: ${x509ValidationResult.validationStatus}. Error: ${x509ValidationResult.errorMessage}`, {
92
+ tokenIndex: i,
93
+ kid: kidFromTokenHeader,
94
+ x509ValidationStatus: x509ValidationResult.validationStatus,
95
+ x509ErrorMessage: x509ValidationResult.errorMessage
96
+ });
97
+ }
98
+ return parsedToken;
99
+ });
100
+ return Promise.all(validationPromises);
64
101
  }
65
102
 
66
103
  /**
@@ -105,4 +142,38 @@ export async function renewTrustChain(chain) {
105
142
  });
106
143
  }));
107
144
  }
108
- //# sourceMappingURL=chain.js.map
145
+
146
+ /**
147
+ * Verify a given trust chain is actually valid.
148
+ * It can handle fast chain renewal, which means we try to fetch a fresh version of each statement.
149
+ *
150
+ * @param trustAnchorEntity The entity configuration of the known trust anchor
151
+ * @param chain The chain of statements to be validated
152
+ * @param x509Options Options for the verification process
153
+ * @param appFetch (optional) fetch api implementation
154
+ * @param renewOnFail Whether to attempt to renew the trust chain if the initial validation fails
155
+ * @returns The result of the chain validation
156
+ * @throws {FederationError} If the chain is not valid
157
+ */
158
+ export async function verifyTrustChain(trustAnchorEntity, chain) {
159
+ let x509Options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
160
+ connectTimeout: 10000,
161
+ readTimeout: 10000,
162
+ requireCrl: true
163
+ };
164
+ let {
165
+ appFetch = fetch,
166
+ renewOnFail = true
167
+ } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
168
+ try {
169
+ return validateTrustChain(trustAnchorEntity, chain, x509Options);
170
+ } catch (error) {
171
+ if (renewOnFail) {
172
+ const renewedChain = await renewTrustChain(chain, appFetch);
173
+ return validateTrustChain(trustAnchorEntity, renewedChain, x509Options);
174
+ } else {
175
+ throw error;
176
+ }
177
+ }
178
+ }
179
+ //# sourceMappingURL=verify-chain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EntityConfiguration","EntityStatement","TrustAnchorEntityConfiguration","z","decode","getTrustAnchorX509Certificate","verify","FederationError","MissingFederationFetchEndpointError","MissingX509CertsError","TrustChainEmptyError","TrustChainRenewalError","TrustChainTokenMissingError","X509ValidationError","verifyCertificateChain","getSignedEntityConfiguration","getSignedEntityStatement","FirstElementShape","MiddleElementShape","LastElementShape","union","validateTrustChain","trustAnchorEntity","chain","x509Options","length","selectTokenShape","elementIndex","selectKid","currentIndex","token","index","shape","parse","header","kid","selectKeys","payload","jwks","keys","nextIndex","nextToken","x509TrustAnchorCertBase64","validationPromises","map","tokenString","i","kidFromTokenHeader","signerJwks","parsedToken","jwkUsedForVerification","find","k","tokenIndex","x5c","certChainBase64","at","slice","x509ValidationResult","isValid","validationStatus","errorMessage","x509ValidationStatus","x509ErrorMessage","Promise","all","renewTrustChain","appFetch","arguments","undefined","fetch","decoded","entityStatementResult","safeParse","entityConfigurationResult","success","data","iss","entityStatement","parentBaseUrl","parentECJwt","parentEC","federationFetchEndpoint","metadata","federation_entity","federation_fetch_endpoint","sub","entityBaseUrl","missingInEntityUrl","originalChain","verifyTrustChain","connectTimeout","readTimeout","requireCrl","renewOnFail","error","renewedChain"],"sourceRoot":"../../../src","sources":["trust/verify-chain.ts"],"mappings":"AAAA,SACEA,mBAAmB,EACnBC,eAAe,EACfC,8BAA8B,QACzB,SAAS;AAEhB,OAAO,KAAKC,CAAC,MAAM,KAAK;AACxB,SACEC,MAAM,EACNC,6BAA6B,EAE7BC,MAAM,QACD,SAAS;AAChB,SAC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0D,aAAa,EAAElE;IAAM,CACzB,CAAC;EACH,CAAC,CACH,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAemE,gBAAgBA,CACpCpE,iBAAiD,EACjDC,KAAe,EAUiC;EAAA,IAThDC,WAAmC,GAAA4C,SAAA,CAAA3C,MAAA,QAAA2C,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG;IACpCuB,cAAc,EAAE,KAAK;IACrBC,WAAW,EAAE,KAAK;IAClBC,UAAU,EAAE;EACd,CAAC;EAAA,IACD;IACE1B,QAAQ,GAAGG,KAAK;IAChBwB,WAAW,GAAG;EAC4C,CAAC,GAAA1B,SAAA,CAAA3C,MAAA,QAAA2C,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG,CAAC,CAAC;EAElE,IAAI;IACF,OAAO/C,kBAAkB,CAACC,iBAAiB,EAAEC,KAAK,EAAEC,WAAW,CAAC;EAClE,CAAC,CAAC,OAAOuE,KAAK,EAAE;IACd,IAAID,WAAW,EAAE;MACf,MAAME,YAAY,GAAG,MAAM9B,eAAe,CAAC3C,KAAK,EAAE4C,QAAQ,CAAC;MAC3D,OAAO9C,kBAAkB,CAACC,iBAAiB,EAAE0E,YAAY,EAAExE,WAAW,CAAC;IACzE,CAAC,MAAM;MACL,MAAMuE,KAAK;IACb;EACF;AACF"}
@@ -1,4 +1,4 @@
1
- import { IssuerResponseErrorCodes, WalletProviderResponseErrorCodes, RelyingPartyResponseErrorCodes } from "./error-codes";
1
+ import { IssuerResponseErrorCodes, RelyingPartyResponseErrorCodes, WalletProviderResponseErrorCodes } from "./error-codes";
2
2
  export { IssuerResponseErrorCodes, WalletProviderResponseErrorCodes, RelyingPartyResponseErrorCodes };
3
3
 
4
4
  // An error reason that supports both a string and a generic JSON object
@@ -1 +1 @@
1
- {"version":3,"names":["IssuerResponseErrorCodes","WalletProviderResponseErrorCodes","RelyingPartyResponseErrorCodes","serializeAttrs","attrs","Object","entries","filter","_ref","v","undefined","map","_ref2","k","Array","isArray","join","JSON","stringify","_","IoWalletError","Error","code","constructor","message","name","ValidationFailed","_ref3","claim","reason","UnexpectedStatusCodeError","_ref4","statusCode","IssuerResponseError","params","IssuerGenericError","WalletProviderResponseError","WalletProviderGenericError","RelyingPartyResponseError","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,SACEA,wBAAwB,EACxBC,gCAAgC,EAChCC,8BAA8B,QAIzB,eAAe;AAEtB,SACEF,wBAAwB,EACxBC,gCAAgC,EAChCC,8BAA8B;;AAGhC;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,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,CA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AAa;QAAE,GAAGjC;MAAO,CAAC,CAAC;IAC7D;IAEA,OAAOiC,aAAa;EACtB;AACF"}
1
+ {"version":3,"names":["IssuerResponseErrorCodes","RelyingPartyResponseErrorCodes","WalletProviderResponseErrorCodes","serializeAttrs","attrs","Object","entries","filter","_ref","v","undefined","map","_ref2","k","Array","isArray","join","JSON","stringify","_","IoWalletError","Error","code","constructor","message","name","ValidationFailed","_ref3","claim","reason","UnexpectedStatusCodeError","_ref4","statusCode","IssuerResponseError","params","IssuerGenericError","WalletProviderResponseError","WalletProviderGenericError","RelyingPartyResponseError","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,SAEEA,wBAAwB,EAExBC,8BAA8B,EAE9BC,gCAAgC,QAC3B,eAAe;AAGtB,SACEF,wBAAwB,EACxBE,gCAAgC,EAChCD,8BAA8B;;AAGhC;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,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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CAACI,aAAa,CAACnC,UAAU,CAAC,IAAI,IAAI,CAAC+B,UAAU,CAAC,GAAG,CAAC;IAEnE,IAAI7B,MAAM,EAAE;MACV,OAAO,IAAI,IAAI,CAACuB,UAAU,CAAC;QAAE,GAAGU,aAAa;QAAE,GAAGjC;MAAO,CAAC,CAAC;IAC7D;IAEA,OAAOiC,aAAa;EACtB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"02-evaluate-issuer-trust.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/02-evaluate-issuer-trust.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mCAAmC,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,MAAM,mBAAmB,GAAG,CAChC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,EACtC,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC;IACX,UAAU,EAAE,mCAAmC,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;CACxE,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,mBAQjC,CAAC"}
1
+ {"version":3,"file":"02-evaluate-issuer-trust.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/02-evaluate-issuer-trust.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAG5C,MAAM,MAAM,mBAAmB,GAAG,CAChC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,EACtC,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC;IACX,UAAU,EAAE,mCAAmC,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;CACxE,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,mBAQjC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"02-evaluate-rp-trust.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/02-evaluate-rp-trust.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,MAAM,yBAAyB,GAAG,CACtC,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,EAClC,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC;IACX,MAAM,EAAE,+BAA+B,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;IAC/D,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,EAAE,yBAUvC,CAAC"}
1
+ {"version":3,"file":"02-evaluate-rp-trust.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/02-evaluate-rp-trust.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAG5C,MAAM,MAAM,yBAAyB,GAAG,CACtC,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,EAClC,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC;IACX,MAAM,EAAE,+BAA+B,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;IAC/D,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,EAAE,yBAUvC,CAAC"}
@@ -1,5 +1,5 @@
1
- import type { RelyingPartyEntityConfiguration } from "../../trust";
2
1
  import { RequestObject } from "./types";
2
+ import type { RelyingPartyEntityConfiguration } from "../../trust/types";
3
3
  export type VerifyRequestObject = (requestObjectEncodedJwt: string, context: {
4
4
  clientId: string;
5
5
  rpConf: RelyingPartyEntityConfiguration["payload"]["metadata"];
@@ -1 +1 @@
1
- {"version":3,"file":"05-verify-request-object.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/05-verify-request-object.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,MAAM,MAAM,mBAAmB,GAAG,CAChC,uBAAuB,EAAE,MAAM,EAC/B,OAAO,EAAE;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,+BAA+B,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,KACE,OAAO,CAAC;IAAE,aAAa,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;AAE/C;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,mBAsCjC,CAAC"}
1
+ {"version":3,"file":"05-verify-request-object.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/05-verify-request-object.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AAEzE,MAAM,MAAM,mBAAmB,GAAG,CAChC,uBAAuB,EAAE,MAAM,EAC/B,OAAO,EAAE;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,+BAA+B,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,KACE,OAAO,CAAC;IAAE,aAAa,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;AAE/C;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,mBAsCjC,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import { type FetchJwks } from "./04-retrieve-rp-jwks";
2
2
  import type { VerifyRequestObject } from "./05-verify-request-object";
3
3
  import { type Out } from "../../utils/misc";
4
- import { type RemotePresentation, DirectAuthorizationBodyPayload, ErrorResponse, type LegacyRemotePresentation } from "./types";
4
+ import { DirectAuthorizationBodyPayload, ErrorResponse, type LegacyRemotePresentation, type RemotePresentation } from "./types";
5
5
  import * as z from "zod";
6
6
  import type { JWK } from "../../utils/jwk";
7
- import type { RelyingPartyEntityConfiguration } from "../../trust";
7
+ import type { RelyingPartyEntityConfiguration } from "../../trust/types";
8
8
  export type AuthorizationResponse = z.infer<typeof AuthorizationResponse>;
9
9
  export declare const AuthorizationResponse: z.ZodObject<{
10
10
  status: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"08-send-authorization-response.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/08-send-authorization-response.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,C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qBAAqB,CAAC,CAAC;AAEpC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,+BAA+B,EAAE,+BAkD3C,CAAC;AAEJ;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACtC,aAAa,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,eAAe,CAAC,EACxD,mBAAmB,EAAE,kBAAkB,EAAE,EACzC,MAAM,EAAE,+BAA+B,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,EAC9D,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEpC,eAAO,MAAM,yBAAyB,EAAE,yBA6BvC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,CAC3C,aAAa,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,eAAe,CAAC,EACxD,KAAK,EAAE;IAAE,KAAK,EAAE,aAAa,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,EACzD,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEpC;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,EAAE,8BAqB1C,CAAC"}
1
+ {"version":3,"file":"08-send-authorization-response.d.ts","sourceRoot":"","sources":["../../../../src/credential/presentation/08-send-authorization-response.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EACL,8BAA8B,EAC9B,aAAa,EACb,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACxB,MAAM,SAAS,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AG,CAAC,mBAAmB,CAAC,CAAC,eAAe,CAAC,EACxD,mBAAmB,EAAE,kBAAkB,EAAE,EACzC,MAAM,EAAE,+BAA+B,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,EAC9D,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEpC,eAAO,MAAM,yBAAyB,EAAE,yBA6BvC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,CAC3C,aAAa,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,eAAe,CAAC,EACxD,KAAK,EAAE;IAAE,KAAK,EAAE,aAAa,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,EACzD,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEpC;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,EAAE,8BAqB1C,CAAC"}
@@ -226,6 +226,11 @@ export declare const ParsedStatusAttestation: z.ZodObject<{
226
226
  credential_hash: string;
227
227
  }>;
228
228
  }, "strip", z.ZodTypeAny, {
229
+ header: {
230
+ alg: string;
231
+ typ: "status-attestation+jwt";
232
+ kid?: string | undefined;
233
+ };
229
234
  payload: {
230
235
  iat: number;
231
236
  exp: number;
@@ -258,12 +263,12 @@ export declare const ParsedStatusAttestation: z.ZodObject<{
258
263
  };
259
264
  credential_hash: string;
260
265
  };
266
+ }, {
261
267
  header: {
262
268
  alg: string;
263
269
  typ: "status-attestation+jwt";
264
270
  kid?: string | undefined;
265
271
  };
266
- }, {
267
272
  payload: {
268
273
  iat: number;
269
274
  exp: number;
@@ -296,10 +301,5 @@ export declare const ParsedStatusAttestation: z.ZodObject<{
296
301
  };
297
302
  credential_hash: string;
298
303
  };
299
- header: {
300
- alg: string;
301
- typ: "status-attestation+jwt";
302
- kid?: string | undefined;
303
- };
304
304
  }>;
305
305
  //# sourceMappingURL=types.d.ts.map