@pagopa/io-react-native-wallet 2.0.0-next.1 → 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.
- package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +2 -2
- package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +1 -1
- package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js +2 -2
- package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
- package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -1
- package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/commonjs/trust/build-chain.js +252 -0
- package/lib/commonjs/trust/build-chain.js.map +1 -0
- package/lib/commonjs/trust/index.js +11 -282
- package/lib/commonjs/trust/index.js.map +1 -1
- package/lib/commonjs/trust/{chain.js → verify-chain.js} +40 -5
- package/lib/commonjs/trust/verify-chain.js.map +1 -0
- package/lib/commonjs/utils/errors.js.map +1 -1
- package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +1 -1
- package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -1
- package/lib/module/credential/presentation/02-evaluate-rp-trust.js +1 -1
- package/lib/module/credential/presentation/02-evaluate-rp-trust.js.map +1 -1
- package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -1
- package/lib/module/credential/presentation/08-send-authorization-response.js +1 -1
- package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -1
- package/lib/module/trust/build-chain.js +235 -0
- package/lib/module/trust/build-chain.js.map +1 -0
- package/lib/module/trust/index.js +5 -268
- package/lib/module/trust/index.js.map +1 -1
- package/lib/module/trust/{chain.js → verify-chain.js} +36 -2
- package/lib/module/trust/verify-chain.js.map +1 -0
- package/lib/module/utils/errors.js +1 -1
- package/lib/module/utils/errors.js.map +1 -1
- package/lib/typescript/client/generated/wallet-provider.d.ts +12 -12
- package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +1 -1
- package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +2 -2
- package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -1
- package/lib/typescript/credential/presentation/types.d.ts +4 -4
- package/lib/typescript/trust/build-chain.d.ts +1284 -0
- package/lib/typescript/trust/build-chain.d.ts.map +1 -0
- package/lib/typescript/trust/index.d.ts +5 -1301
- package/lib/typescript/trust/index.d.ts.map +1 -1
- package/lib/typescript/trust/types.d.ts +506 -506
- package/lib/typescript/trust/{chain.d.ts → verify-chain.d.ts} +17 -1
- package/lib/typescript/trust/verify-chain.d.ts.map +1 -0
- package/lib/typescript/utils/errors.d.ts +2 -2
- package/lib/typescript/utils/errors.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/types.d.ts +4 -4
- package/package.json +1 -1
- package/src/credential/issuance/02-evaluate-issuer-trust.ts +1 -1
- package/src/credential/presentation/02-evaluate-rp-trust.ts +1 -1
- package/src/credential/presentation/05-verify-request-object.ts +1 -1
- package/src/credential/presentation/08-send-authorization-response.ts +4 -4
- package/src/trust/build-chain.ts +395 -0
- package/src/trust/index.ts +5 -442
- package/src/trust/{chain.ts → verify-chain.ts} +41 -1
- package/src/utils/errors.ts +4 -4
- package/lib/commonjs/trust/chain.js.map +0 -1
- package/lib/module/trust/chain.js.map +0 -1
- package/lib/typescript/trust/chain.d.ts.map +0 -1
@@ -3,286 +3,15 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
7
|
-
|
8
|
-
exports.
|
9
|
-
|
10
|
-
exports.
|
11
|
-
|
12
|
-
exports.
|
13
|
-
|
14
|
-
exports.
|
15
|
-
|
16
|
-
var
|
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 x509Options Options for the verification process
|
28
|
-
* @param appFetch (optional) fetch api implementation
|
29
|
-
* @param renewOnFail Whether to attempt to renew the trust chain if the initial validation fails
|
30
|
-
* @returns The result of the chain validation
|
31
|
-
* @throws {FederationError} If the chain is not valid
|
32
|
-
*/
|
33
|
-
async function verifyTrustChain(trustAnchorEntity, chain) {
|
34
|
-
let x509Options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
35
|
-
connectTimeout: 10000,
|
36
|
-
readTimeout: 10000,
|
37
|
-
requireCrl: true
|
38
|
-
};
|
39
|
-
let {
|
40
|
-
appFetch = fetch,
|
41
|
-
renewOnFail = true
|
42
|
-
} = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
43
|
-
try {
|
44
|
-
return (0, _chain.validateTrustChain)(trustAnchorEntity, chain, x509Options);
|
45
|
-
} catch (error) {
|
46
|
-
if (renewOnFail) {
|
47
|
-
const renewedChain = await (0, _chain.renewTrustChain)(chain, appFetch);
|
48
|
-
return (0, _chain.validateTrustChain)(trustAnchorEntity, renewedChain, x509Options);
|
49
|
-
} else {
|
50
|
-
throw error;
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
/**
|
56
|
-
* Fetch the signed entity configuration token for an entity
|
57
|
-
*
|
58
|
-
* @param entityBaseUrl The url of the entity to fetch
|
59
|
-
* @param appFetch (optional) fetch api implementation
|
60
|
-
* @returns The signed Entity Configuration token
|
61
|
-
*/
|
62
|
-
async function getSignedEntityConfiguration(entityBaseUrl) {
|
63
|
-
let {
|
64
|
-
appFetch = fetch
|
65
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
66
|
-
const wellKnownUrl = `${entityBaseUrl}/.well-known/openid-federation`;
|
67
|
-
return await appFetch(wellKnownUrl, {
|
68
|
-
method: "GET"
|
69
|
-
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.text());
|
70
|
-
}
|
71
|
-
|
72
|
-
/**
|
73
|
-
* Fetch and parse the entity configuration document for a given federation entity.
|
74
|
-
* This is an inner method to serve public interfaces.
|
75
|
-
*
|
76
|
-
* To add another entity configuration type (example: Foo entity type):
|
77
|
-
* - create its zod schema and type by inherit from the base type (example: FooEntityConfiguration = BaseEntityConfiguration.and(...))
|
78
|
-
* - add such type to EntityConfiguration union
|
79
|
-
* - add an overload to this function
|
80
|
-
* - create a public function which use such type (example: getFooEntityConfiguration = (url, options) => Promise<FooEntityConfiguration>)
|
81
|
-
*
|
82
|
-
* @param entityBaseUrl The base url of the entity.
|
83
|
-
* @param schema The expected schema of the entity configuration, according to the kind of entity we are fetching from.
|
84
|
-
* @param options An optional object with additional options.
|
85
|
-
* @param options.appFetch An optional instance of the http client to be used.
|
86
|
-
* @returns The parsed entity configuration object
|
87
|
-
* @throws {IoWalletError} If the http request fails
|
88
|
-
* @throws Parse error if the document is not in the expected shape.
|
89
|
-
*/
|
90
|
-
|
91
|
-
async function fetchAndParseEntityConfiguration(entityBaseUrl, schema) {
|
92
|
-
let {
|
93
|
-
appFetch = fetch
|
94
|
-
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
95
|
-
const responseText = await getSignedEntityConfiguration(entityBaseUrl, {
|
96
|
-
appFetch
|
97
|
-
});
|
98
|
-
const responseJwt = (0, _ioReactNativeJwt.decode)(responseText);
|
99
|
-
return schema.parse({
|
100
|
-
header: responseJwt.protectedHeader,
|
101
|
-
payload: responseJwt.payload
|
102
|
-
});
|
103
|
-
}
|
104
|
-
const getWalletProviderEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.WalletProviderEntityConfiguration, options);
|
105
|
-
exports.getWalletProviderEntityConfiguration = getWalletProviderEntityConfiguration;
|
106
|
-
const getCredentialIssuerEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.CredentialIssuerEntityConfiguration, options);
|
107
|
-
exports.getCredentialIssuerEntityConfiguration = getCredentialIssuerEntityConfiguration;
|
108
|
-
const getTrustAnchorEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.TrustAnchorEntityConfiguration, options);
|
109
|
-
exports.getTrustAnchorEntityConfiguration = getTrustAnchorEntityConfiguration;
|
110
|
-
const getRelyingPartyEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.RelyingPartyEntityConfiguration, options);
|
111
|
-
exports.getRelyingPartyEntityConfiguration = getRelyingPartyEntityConfiguration;
|
112
|
-
const getEntityConfiguration = (entityBaseUrl, options) => fetchAndParseEntityConfiguration(entityBaseUrl, _types.EntityConfiguration, options);
|
113
|
-
|
114
|
-
/**
|
115
|
-
* Fetch and parse the entity statement document for a given federation entity.
|
116
|
-
*
|
117
|
-
* @param accreditationBodyBaseUrl The base url of the accreditation body which holds and signs the required entity statement
|
118
|
-
* @param subordinatedEntityBaseUrl The url that identifies the subordinate entity
|
119
|
-
* @param appFetch An optional instance of the http client to be used.
|
120
|
-
* @returns The parsed entity configuration object
|
121
|
-
* @throws {IoWalletError} If the http request fails
|
122
|
-
*/
|
123
|
-
exports.getEntityConfiguration = getEntityConfiguration;
|
124
|
-
async function getEntityStatement(accreditationBodyBaseUrl, subordinatedEntityBaseUrl) {
|
125
|
-
let {
|
126
|
-
appFetch = fetch
|
127
|
-
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
128
|
-
const responseText = await getSignedEntityStatement(accreditationBodyBaseUrl, subordinatedEntityBaseUrl, {
|
129
|
-
appFetch
|
130
|
-
});
|
131
|
-
const responseJwt = (0, _ioReactNativeJwt.decode)(responseText);
|
132
|
-
return _types.EntityStatement.parse({
|
133
|
-
header: responseJwt.protectedHeader,
|
134
|
-
payload: responseJwt.payload
|
135
|
-
});
|
136
|
-
}
|
137
|
-
|
138
|
-
/**
|
139
|
-
* Fetch the entity statement document for a given federation entity.
|
140
|
-
*
|
141
|
-
* @param federationFetchEndpoint The exact endpoint provided by the parent EC's metadata.
|
142
|
-
* @param subordinatedEntityBaseUrl The url that identifies the subordinate entity.
|
143
|
-
* @param appFetch An optional instance of the http client to be used.
|
144
|
-
* @returns The signed entity statement token.
|
145
|
-
* @throws {IoWalletError} If the http request fails.
|
146
|
-
*/
|
147
|
-
async function getSignedEntityStatement(federationFetchEndpoint, subordinatedEntityBaseUrl) {
|
148
|
-
let {
|
149
|
-
appFetch = fetch
|
150
|
-
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
151
|
-
const url = new URL(federationFetchEndpoint);
|
152
|
-
url.searchParams.set("sub", subordinatedEntityBaseUrl);
|
153
|
-
return await appFetch(url.toString(), {
|
154
|
-
method: "GET"
|
155
|
-
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.text());
|
156
|
-
}
|
157
|
-
|
158
|
-
/**
|
159
|
-
* Fetch the federation list document from a given endpoint.
|
160
|
-
*
|
161
|
-
* @param federationListEndpoint The URL of the federation list endpoint.
|
162
|
-
* @param appFetch An optional instance of the http client to be used.
|
163
|
-
* @returns The federation list as an array of strings.
|
164
|
-
* @throws {IoWalletError} If the HTTP request fails.
|
165
|
-
* @throws {FederationError} If the result is not in the expected format.
|
166
|
-
*/
|
167
|
-
async function getFederationList(federationListEndpoint) {
|
168
|
-
let {
|
169
|
-
appFetch = fetch
|
170
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
171
|
-
return await appFetch(federationListEndpoint, {
|
172
|
-
method: "GET"
|
173
|
-
}).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(json => {
|
174
|
-
const result = _types.FederationListResponse.safeParse(json);
|
175
|
-
if (!result.success) {
|
176
|
-
throw new _errors.FederationListParseError(`Invalid federation list format received from ${federationListEndpoint}. Error: ${result.error.message}`, {
|
177
|
-
url: federationListEndpoint,
|
178
|
-
parseError: result.error.toString()
|
179
|
-
});
|
180
|
-
}
|
181
|
-
return result.data;
|
182
|
-
});
|
183
|
-
}
|
184
|
-
|
185
|
-
/**
|
186
|
-
* Build a not-verified trust chain for a given Relying Party (RP) entity.
|
187
|
-
*
|
188
|
-
* @param relyingPartyEntityBaseUrl The base URL of the RP entity
|
189
|
-
* @param trustAnchorKey The public key of the Trust Anchor (TA) entity
|
190
|
-
* @param appFetch An optional instance of the http client to be used.
|
191
|
-
* @returns A list of signed tokens that represent the trust chain, in the order of the chain (from the RP to the Trust Anchor)
|
192
|
-
* @throws {FederationError} When an element of the chain fails to parse or other build steps fail.
|
193
|
-
*/
|
194
|
-
async function buildTrustChain(relyingPartyEntityBaseUrl, trustAnchorKey) {
|
195
|
-
let appFetch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : fetch;
|
196
|
-
// 1: Recursively gather the trust chain from the RP up to the Trust Anchor
|
197
|
-
const trustChain = await gatherTrustChain(relyingPartyEntityBaseUrl, appFetch);
|
198
|
-
|
199
|
-
// 2: Trust Anchor signature verification
|
200
|
-
const trustAnchorJwt = trustChain[trustChain.length - 1];
|
201
|
-
if (!trustAnchorJwt) {
|
202
|
-
throw new _errors.BuildTrustChainError("Cannot verify trust anchor: missing entity configuration in gathered chain.", {
|
203
|
-
relyingPartyUrl: relyingPartyEntityBaseUrl
|
204
|
-
});
|
205
|
-
}
|
206
|
-
if (!trustAnchorKey.kid) {
|
207
|
-
throw new _errors.TrustAnchorKidMissingError();
|
208
|
-
}
|
209
|
-
await (0, _utils.verify)(trustAnchorJwt, trustAnchorKey.kid, [trustAnchorKey]);
|
210
|
-
|
211
|
-
// 3: Check the federation list
|
212
|
-
const trustAnchorConfig = _types.EntityConfiguration.parse((0, _utils.decode)(trustAnchorJwt));
|
213
|
-
const federationListEndpoint = trustAnchorConfig.payload.metadata.federation_entity.federation_list_endpoint;
|
214
|
-
if (federationListEndpoint) {
|
215
|
-
const federationList = await getFederationList(federationListEndpoint, {
|
216
|
-
appFetch
|
217
|
-
});
|
218
|
-
if (!federationList.includes(relyingPartyEntityBaseUrl)) {
|
219
|
-
throw new _errors.RelyingPartyNotAuthorizedError("Relying Party entity base URL is not authorized by the Trust Anchor's federation list.", {
|
220
|
-
relyingPartyUrl: relyingPartyEntityBaseUrl,
|
221
|
-
federationListEndpoint
|
222
|
-
});
|
223
|
-
}
|
224
|
-
}
|
225
|
-
return trustChain;
|
226
|
-
}
|
227
|
-
|
228
|
-
/**
|
229
|
-
* Recursively gather the trust chain for an entity and all its superiors.
|
230
|
-
* @param entityBaseUrl The base URL of the entity for which to gather the chain.
|
231
|
-
* @param appFetch An optional instance of the http client to be used.
|
232
|
-
* @param isLeaf Whether the current entity is the leaf of the chain.
|
233
|
-
* @returns A full ordered list of JWTs (ECs and ESs) forming the trust chain.
|
234
|
-
* @throws {FederationError} If any of the fetched documents fail to parse or other errors occur during the gathering process.
|
235
|
-
*/
|
236
|
-
async function gatherTrustChain(entityBaseUrl, appFetch) {
|
237
|
-
let isLeaf = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
238
|
-
const chain = [];
|
239
|
-
|
240
|
-
// Fetch self-signed EC (only needed for the leaf)
|
241
|
-
const entityECJwt = await getSignedEntityConfiguration(entityBaseUrl, {
|
242
|
-
appFetch
|
243
|
-
});
|
244
|
-
const entityEC = _types.EntityConfiguration.parse((0, _utils.decode)(entityECJwt));
|
245
|
-
if (isLeaf) {
|
246
|
-
// Only push EC for the leaf
|
247
|
-
chain.push(entityECJwt);
|
248
|
-
}
|
249
|
-
|
250
|
-
// Find authority_hints (parent, if any)
|
251
|
-
const authorityHints = entityEC.payload.authority_hints ?? [];
|
252
|
-
if (authorityHints.length === 0) {
|
253
|
-
// This is the Trust Anchor (no parent)
|
254
|
-
if (!isLeaf) {
|
255
|
-
chain.push(entityECJwt);
|
256
|
-
}
|
257
|
-
return chain;
|
258
|
-
}
|
259
|
-
const parentEntityBaseUrl = authorityHints[0];
|
260
|
-
|
261
|
-
// Fetch parent EC
|
262
|
-
const parentECJwt = await getSignedEntityConfiguration(parentEntityBaseUrl, {
|
263
|
-
appFetch
|
264
|
-
});
|
265
|
-
const parentEC = _types.EntityConfiguration.parse((0, _utils.decode)(parentECJwt));
|
266
|
-
|
267
|
-
// Fetch ES
|
268
|
-
const federationFetchEndpoint = parentEC.payload.metadata.federation_entity.federation_fetch_endpoint;
|
269
|
-
if (!federationFetchEndpoint) {
|
270
|
-
throw new _errors.MissingFederationFetchEndpointError(`Missing federation_fetch_endpoint in parent's (${parentEntityBaseUrl}) configuration when gathering chain for ${entityBaseUrl}.`, {
|
271
|
-
entityBaseUrl,
|
272
|
-
missingInEntityUrl: parentEntityBaseUrl
|
273
|
-
});
|
274
|
-
}
|
275
|
-
const entityStatementJwt = await getSignedEntityStatement(federationFetchEndpoint, entityBaseUrl, {
|
276
|
-
appFetch
|
277
|
-
});
|
278
|
-
// Validate the ES
|
279
|
-
_types.EntityStatement.parse((0, _utils.decode)(entityStatementJwt));
|
280
|
-
|
281
|
-
// Push this ES into the chain
|
282
|
-
chain.push(entityStatementJwt);
|
283
|
-
|
284
|
-
// Recurse into the parent
|
285
|
-
const parentChain = await gatherTrustChain(parentEntityBaseUrl, appFetch, false);
|
286
|
-
return chain.concat(parentChain);
|
287
|
-
}
|
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; }
|
288
17
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
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":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAuCC,OAAA,CAAAH,KAAA,GAAAA,KAAA;AACvC,IAAAI,MAAA,GAAAH,uBAAA,CAAAC,OAAA;AAAyCC,OAAA,CAAAC,MAAA,GAAAA,MAAA;AACzC,IAAAC,MAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAAmCC,OAAA,CAAAE,MAA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, "__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
13
|
var _ioReactNativeCrypto = require("@pagopa/io-react-native-crypto");
|
14
|
+
var _buildChain = require("./build-chain");
|
14
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); }
|
15
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; }
|
16
17
|
// The first element of the chain is supposed to be the Entity Configuration for the document issuer
|
@@ -123,14 +124,14 @@ async function renewTrustChain(chain) {
|
|
123
124
|
const entityStatementResult = _types.EntityStatement.safeParse(decoded);
|
124
125
|
const entityConfigurationResult = _types.EntityConfiguration.safeParse(decoded);
|
125
126
|
if (entityConfigurationResult.success) {
|
126
|
-
return (0,
|
127
|
+
return (0, _buildChain.getSignedEntityConfiguration)(entityConfigurationResult.data.payload.iss, {
|
127
128
|
appFetch
|
128
129
|
});
|
129
130
|
}
|
130
131
|
if (entityStatementResult.success) {
|
131
132
|
const entityStatement = entityStatementResult.data;
|
132
133
|
const parentBaseUrl = entityStatement.payload.iss;
|
133
|
-
const parentECJwt = await (0,
|
134
|
+
const parentECJwt = await (0, _buildChain.getSignedEntityConfiguration)(parentBaseUrl, {
|
134
135
|
appFetch
|
135
136
|
});
|
136
137
|
const parentEC = _types.EntityConfiguration.parse((0, _utils.decode)(parentECJwt));
|
@@ -141,7 +142,7 @@ async function renewTrustChain(chain) {
|
|
141
142
|
missingInEntityUrl: parentBaseUrl
|
142
143
|
});
|
143
144
|
}
|
144
|
-
return (0,
|
145
|
+
return (0, _buildChain.getSignedEntityStatement)(federationFetchEndpoint, entityStatement.payload.sub, {
|
145
146
|
appFetch
|
146
147
|
});
|
147
148
|
}
|
@@ -150,4 +151,38 @@ async function renewTrustChain(chain) {
|
|
150
151
|
});
|
151
152
|
}));
|
152
153
|
}
|
153
|
-
|
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,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAA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ACzE;MAAEqE,aAAa,EAAE/E;IAAM,CACzB,CAAC;EACH,CAAC,CACH,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAegF,gBAAgBA,CACpCjF,iBAAiD,EACjDC,KAAe,EAUiC;EAAA,IAThDC,WAAmC,GAAAqD,SAAA,CAAApD,MAAA,QAAAoD,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG;IACpC2B,cAAc,EAAE,KAAK;IACrBC,WAAW,EAAE,KAAK;IAClBC,UAAU,EAAE;EACd,CAAC;EAAA,IACD;IACE9B,QAAQ,GAAGG,KAAK;IAChB4B,WAAW,GAAG;EAC4C,CAAC,GAAA9B,SAAA,CAAApD,MAAA,QAAAoD,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG,CAAC,CAAC;EAElE,IAAI;IACF,OAAOxD,kBAAkB,CAACC,iBAAiB,EAAEC,KAAK,EAAEC,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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
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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AMC,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,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":"
|
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 +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":"
|
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"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["decode","decodeJwt","verify","InvalidRequestObjectError","RequestObject","getJwksFromConfig","verifyRequestObject","requestObjectEncodedJwt","_ref","clientId","rpConf","rpSubject","state","requestObjectJwt","pubKey","getSigPublicKey","protectedHeader","kid","issuer","_","requestObject","validateRequestObjectShape","payload","isClientIdMatch","client_id","isStateMatch","requestObjectParse","safeParse","success","data","formatFlattenedZodErrors","error","flatten","keys","find","k","Error","errors","Object","entries","fieldErrors","map","_ref2","key","join"],"sourceRoot":"../../../../src","sources":["credential/presentation/05-verify-request-object.ts"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,EAAEC,MAAM,QAAQ,6BAA6B;
|
1
|
+
{"version":3,"names":["decode","decodeJwt","verify","InvalidRequestObjectError","RequestObject","getJwksFromConfig","verifyRequestObject","requestObjectEncodedJwt","_ref","clientId","rpConf","rpSubject","state","requestObjectJwt","pubKey","getSigPublicKey","protectedHeader","kid","issuer","_","requestObject","validateRequestObjectShape","payload","isClientIdMatch","client_id","isStateMatch","requestObjectParse","safeParse","success","data","formatFlattenedZodErrors","error","flatten","keys","find","k","Error","errors","Object","entries","fieldErrors","map","_ref2","key","join"],"sourceRoot":"../../../../src","sources":["credential/presentation/05-verify-request-object.ts"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,EAAEC,MAAM,QAAQ,6BAA6B;AACzE,SAASC,yBAAyB,QAAQ,UAAU;AACpD,SAASC,aAAa,QAAQ,SAAS;AACvC,SAASC,iBAAiB,QAAQ,uBAAuB;AAazD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,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CACjC,kDAAkD,EAClD2B,wBAAwB,CAACJ,kBAAkB,CAACK,KAAK,CAACC,OAAO,CAAC,CAAC,CAC7D,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMjB,eAAe,GAAGA,CACtBL,MAA8D,EAC9DO,GAAuB,KACpB;EACH,IAAI;IACF,MAAM;MAAEgB;IAAK,CAAC,GAAG5B,iBAAiB,CAACK,MAAM,CAAC;IAE1C,MAAMI,MAAM,GAAGmB,IAAI,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAAClB,GAAG,KAAKA,GAAG,CAAC;IAE9C,IAAI,CAACH,MAAM,EAAE,MAAM,IAAIsB,KAAK,CAAC,CAAC;IAE9B,OAAOtB,MAAM;EACf,CAAC,CAAC,OAAOK,CAAC,EAAE;IACV,MAAM,IAAIhB,yBAAyB,CAChC,8CAA6Cc,GAAI,+CACpD,CAAC;EACH;AACF,CAAC;;AAED;AACA;AACA;AACA,MAAMa,wBAAwB,GAC5BO,MAA+C,IAE/CC,MAAM,CAACC,OAAO,CAACF,MAAM,CAACG,WAAW,CAAC,CAC/BC,GAAG,CAACC,KAAA;EAAA,IAAC,CAACC,GAAG,EAAEZ,KAAK,CAAC,GAAAW,KAAA;EAAA,OAAM,GAAEC,GAAI,KAAIZ,KAAK,CAAC,CAAC,CAAE,EAAC;AAAA,EAAC,CAC5Ca,IAAI,CAAC,IAAI,CAAC"}
|
@@ -4,7 +4,7 @@ import { getJwksFromConfig } from "./04-retrieve-rp-jwks";
|
|
4
4
|
import { NoSuitableKeysFoundInEntityConfiguration } from "./errors";
|
5
5
|
import { hasStatusOrThrow } from "../../utils/misc";
|
6
6
|
import * as z from "zod";
|
7
|
-
import { RelyingPartyResponseError, ResponseErrorBuilder, UnexpectedStatusCodeError
|
7
|
+
import { RelyingPartyResponseError, RelyingPartyResponseErrorCodes, ResponseErrorBuilder, UnexpectedStatusCodeError } from "../../utils/errors";
|
8
8
|
export const AuthorizationResponse = z.object({
|
9
9
|
status: z.string().optional(),
|
10
10
|
response_code: z.string() /**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["EncryptJwe","uuid","getJwksFromConfig","NoSuitableKeysFoundInEntityConfiguration","hasStatusOrThrow","z","RelyingPartyResponseError","
|
1
|
+
{"version":3,"names":["EncryptJwe","uuid","getJwksFromConfig","NoSuitableKeysFoundInEntityConfiguration","hasStatusOrThrow","z","RelyingPartyResponseError","RelyingPartyResponseErrorCodes","ResponseErrorBuilder","UnexpectedStatusCodeError","AuthorizationResponse","object","status","string","optional","response_code","redirect_uri","choosePublicKeyToEncrypt","rpJwkKeys","encKey","find","jwk","use","buildDirectPostJwtBody","requestObject","rpConf","payload","authzResponsePayload","JSON","stringify","state","keys","encPublicJwk","authorization_encrypted_response_alg","authorization_encrypted_response_enc","openid_credential_verifier","defaultAlg","kty","encryptedResponse","alg","enc","kid","encrypt","formBody","URLSearchParams","response","toString","buildDirectPostBody","formUrlEncodedBody","Object","entries","reduce","acc","_ref","key","value","Array","isArray","sendLegacyAuthorizationResponse","presentationDefinitionId","remotePresentations","_remotePresentations$","appFetch","fetch","arguments","length","undefined","vp_token","vpToken","map","remotePresentation","descriptor_map","index","id","inputDescriptor","path","format","presentation_submission","v4","definition_id","requestBody","response_uri","method","headers","body","then","res","json","parse","sendAuthorizationResponse","presentation","credentialId","catch","handleAuthorizationResponseError","sendAuthorizationErrorResponse","_ref2","error","errorDescription","error_description","e","handle","code","InvalidAuthorizationResponse","message","RelyingPartyGenericError","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/presentation/08-send-authorization-response.ts"],"mappings":"AAAA,SAASA,UAAU,QAAQ,6BAA6B;AACxD,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAAyBC,iBAAiB,QAAQ,uBAAuB;AAEzE,SAASC,wCAAwC,QAAQ,UAAU;AACnE,SAASC,gBAAgB,QAAkB,kBAAkB;AAO7D,OAAO,KAAKC,CAAC,MAAM,KAAK;AAExB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