@credo-ts/openid4vc 0.6.0-pr-2209-20250321171013 → 0.6.0-pr-2195-20250321180923
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/build/openid4vc-holder/OpenId4VcHolderApi.d.ts +126 -21
- package/build/openid4vc-holder/OpenId4VcHolderApi.js +36 -21
- package/build/openid4vc-holder/OpenId4VcHolderApi.js.map +1 -1
- package/build/openid4vc-holder/OpenId4VcHolderModule.js +3 -3
- package/build/openid4vc-holder/OpenId4VcHolderModule.js.map +1 -1
- package/build/openid4vc-holder/OpenId4VciHolderService.d.ts +5 -6
- package/build/openid4vc-holder/OpenId4VciHolderService.js +13 -15
- package/build/openid4vc-holder/OpenId4VciHolderService.js.map +1 -1
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.d.ts +3 -3
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js +2 -2
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js.map +1 -1
- package/build/openid4vc-holder/OpenId4vpHolderService.d.ts +132 -0
- package/build/openid4vc-holder/OpenId4vpHolderService.js +317 -0
- package/build/openid4vc-holder/OpenId4vpHolderService.js.map +1 -0
- package/build/openid4vc-holder/OpenId4vpHolderServiceOptions.d.ts +81 -0
- package/build/openid4vc-holder/{OpenId4vcSiopHolderServiceOptions.js → OpenId4vpHolderServiceOptions.js} +1 -1
- package/build/openid4vc-holder/OpenId4vpHolderServiceOptions.js.map +1 -0
- package/build/openid4vc-holder/index.d.ts +2 -2
- package/build/openid4vc-holder/index.js +2 -2
- package/build/openid4vc-holder/index.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.d.ts +194 -44
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.js +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.d.ts +7 -7
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js +2 -10
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerService.d.ts +197 -48
- package/build/openid4vc-issuer/OpenId4VcIssuerService.js +28 -19
- package/build/openid4vc-issuer/OpenId4VcIssuerService.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.d.ts +11 -6
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.d.ts +11 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.js +2 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.js.map +1 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js +2 -2
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js.map +1 -1
- package/build/openid4vc-issuer/router/accessTokenEndpoint.js +1 -1
- package/build/openid4vc-issuer/router/accessTokenEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/authorizationChallengeEndpoint.js +1 -1
- package/build/openid4vc-issuer/router/authorizationChallengeEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/authorizationServerMetadataEndpoint.js +1 -1
- package/build/openid4vc-issuer/router/authorizationServerMetadataEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/credentialEndpoint.js +4 -3
- package/build/openid4vc-issuer/router/credentialEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/credentialOfferEndpoint.js +15 -0
- package/build/openid4vc-issuer/router/credentialOfferEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/issuerMetadataEndpoint.js +1 -1
- package/build/openid4vc-issuer/router/issuerMetadataEndpoint.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.d.ts +12 -25
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.js +16 -25
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.js +5 -8
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.d.ts +30 -7
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.js +16 -12
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VpVerifierService.d.ts +51 -0
- package/build/openid4vc-verifier/OpenId4VpVerifierService.js +765 -0
- package/build/openid4vc-verifier/OpenId4VpVerifierService.js.map +1 -0
- package/build/openid4vc-verifier/OpenId4VpVerifierServiceOptions.d.ts +146 -0
- package/build/openid4vc-verifier/{OpenId4VcSiopVerifierServiceOptions.js → OpenId4VpVerifierServiceOptions.js} +1 -1
- package/build/openid4vc-verifier/OpenId4VpVerifierServiceOptions.js.map +1 -0
- package/build/openid4vc-verifier/index.d.ts +2 -2
- package/build/openid4vc-verifier/index.js +2 -2
- package/build/openid4vc-verifier/index.js.map +1 -1
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.d.ts +39 -14
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js +38 -8
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js.map +1 -1
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.d.ts +3 -3
- package/build/openid4vc-verifier/router/authorizationEndpoint.d.ts +2 -10
- package/build/openid4vc-verifier/router/authorizationEndpoint.js +94 -105
- package/build/openid4vc-verifier/router/authorizationEndpoint.js.map +1 -1
- package/build/openid4vc-verifier/router/authorizationRequestEndpoint.d.ts +2 -10
- package/build/openid4vc-verifier/router/authorizationRequestEndpoint.js +21 -22
- package/build/openid4vc-verifier/router/authorizationRequestEndpoint.js.map +1 -1
- package/build/shared/callbacks.d.ts +13 -5
- package/build/shared/callbacks.js +104 -13
- package/build/shared/callbacks.js.map +1 -1
- package/build/shared/issuerMetadataUtils.d.ts +102 -144
- package/build/shared/models/OpenId4VcJwtIssuer.d.ts +2 -3
- package/build/shared/models/index.d.ts +10 -10
- package/build/shared/models/index.js +5 -5
- package/build/shared/models/index.js.map +1 -1
- package/build/shared/router/context.d.ts +3 -3
- package/build/shared/router/context.js +7 -3
- package/build/shared/router/context.js.map +1 -1
- package/build/shared/transactionData.d.ts +5 -0
- package/build/shared/transactionData.js +22 -0
- package/build/shared/transactionData.js.map +1 -0
- package/build/shared/utils.d.ts +6 -8
- package/build/shared/utils.js +34 -105
- package/build/shared/utils.js.map +1 -1
- package/package.json +7 -8
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.d.ts +0 -32
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.js +0 -300
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.js.map +0 -1
- package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.d.ts +0 -38
- package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.js.map +0 -1
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.d.ts +0 -55
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js +0 -553
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js.map +0 -1
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.d.ts +0 -77
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.js.map +0 -1
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.d.ts +0 -49
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js +0 -230
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js.map +0 -1
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.d.ts +0 -19
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js +0 -144
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js.map +0 -1
- package/build/shared/transform.d.ts +0 -5
- package/build/shared/transform.js +0 -69
- package/build/shared/transform.js.map +0 -1
|
@@ -1,127 +1,116 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.configureAuthorizationEndpoint = configureAuthorizationEndpoint;
|
|
4
|
-
const oauth2_1 = require("@
|
|
4
|
+
const oauth2_1 = require("@openid4vc/oauth2");
|
|
5
5
|
const core_1 = require("@credo-ts/core");
|
|
6
|
-
|
|
6
|
+
// FIXME: export parseOpenid4VpAuthorizationResponsePayload from openid4vp
|
|
7
|
+
const openid4vp_1 = require("@openid4vc/openid4vp");
|
|
7
8
|
const router_1 = require("../../shared/router");
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const openId4VcVerifierService = agentContext.dependencyManager.resolve(OpenId4VcSiopVerifierService_1.OpenId4VcSiopVerifierService);
|
|
12
|
-
const session = await openId4VcVerifierService.findVerificationSessionForAuthorizationResponse(agentContext, {
|
|
13
|
-
authorizationResponseParams: { state, nonce },
|
|
14
|
-
verifierId,
|
|
15
|
-
});
|
|
16
|
-
if (!session) {
|
|
17
|
-
agentContext.config.logger.warn(`No verification session found for incoming authorization response for verifier ${verifierId}`);
|
|
18
|
-
throw new core_1.CredoError(`No state or nonce provided in authorization response for verifier ${verifierId}`);
|
|
19
|
-
}
|
|
20
|
-
return session;
|
|
21
|
-
}
|
|
22
|
-
const decryptJarmResponse = (agentContext) => {
|
|
23
|
-
return async (input) => {
|
|
24
|
-
const { jwe: compactJwe, jwk: jwkJson } = input;
|
|
25
|
-
const key = core_1.Key.fromFingerprint(jwkJson.kid);
|
|
26
|
-
if (!agentContext.wallet.directDecryptCompactJweEcdhEs) {
|
|
27
|
-
throw new core_1.CredoError('Cannot decrypt Jarm Response, wallet does not support directDecryptCompactJweEcdhEs');
|
|
28
|
-
}
|
|
29
|
-
const { data, header } = await agentContext.wallet.directDecryptCompactJweEcdhEs({ compactJwe, recipientKey: key });
|
|
30
|
-
const decryptedPayload = core_1.TypedArrayEncoder.toUtf8String(data);
|
|
31
|
-
return {
|
|
32
|
-
plaintext: decryptedPayload,
|
|
33
|
-
protectedHeader: header,
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
};
|
|
9
|
+
const OpenId4VpVerifierService_1 = require("../OpenId4VpVerifierService");
|
|
10
|
+
const repository_1 = require("../repository");
|
|
11
|
+
const utils_1 = require("@openid4vc/utils");
|
|
37
12
|
function configureAuthorizationEndpoint(router, config) {
|
|
38
|
-
router.post(config.
|
|
13
|
+
router.post(config.authorizationEndpoint, async (request, response, next) => {
|
|
39
14
|
const { agentContext, verifier } = (0, router_1.getRequestContext)(request);
|
|
40
|
-
|
|
15
|
+
const openId4VcVerifierService = agentContext.dependencyManager.resolve(OpenId4VpVerifierService_1.OpenId4VpVerifierService);
|
|
41
16
|
try {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
verificationSession = await getVerificationSession(agentContext, {
|
|
50
|
-
verifierId: verifier.verifierId,
|
|
51
|
-
state: input.state,
|
|
52
|
-
nonce: input.nonce,
|
|
53
|
-
});
|
|
54
|
-
const req = await did_auth_siop_1.AuthorizationRequest.fromUriOrJwt(verificationSession.authorizationRequestJwt);
|
|
55
|
-
const requestObjectPayload = await req.requestObject?.getPayload();
|
|
56
|
-
if (!requestObjectPayload) {
|
|
57
|
-
throw new core_1.CredoError('No request object payload found.');
|
|
58
|
-
}
|
|
59
|
-
return { authRequestParams: requestObjectPayload };
|
|
60
|
-
},
|
|
61
|
-
decryptCompact: decryptJarmResponse(agentContext),
|
|
62
|
-
hasher: core_1.Hasher.hash,
|
|
63
|
-
});
|
|
64
|
-
jarmResponseType = res.type;
|
|
65
|
-
const [header] = request.body.response.split('.');
|
|
66
|
-
jarmHeader = core_1.JsonEncoder.fromBase64(header);
|
|
67
|
-
// FIXME: verify the apv matches the nonce of the authorization reuqest
|
|
68
|
-
authorizationResponsePayload = res.authResponseParams;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
authorizationResponsePayload = request.body;
|
|
72
|
-
verificationSession = await getVerificationSession(agentContext, {
|
|
73
|
-
verifierId: verifier.verifierId,
|
|
74
|
-
state: authorizationResponsePayload.state,
|
|
75
|
-
nonce: authorizationResponsePayload.nonce,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
if (typeof authorizationResponsePayload.presentation_submission === 'string') {
|
|
79
|
-
authorizationResponsePayload.presentation_submission = JSON.parse(request.body.presentation_submission);
|
|
80
|
-
}
|
|
81
|
-
// This feels hacky, and should probably be moved to OID4VP lib. However the OID4VP spec allows either object, string, or array...
|
|
82
|
-
if (typeof authorizationResponsePayload.vp_token === 'string' &&
|
|
83
|
-
(authorizationResponsePayload.vp_token.startsWith('{') || authorizationResponsePayload.vp_token.startsWith('['))) {
|
|
84
|
-
authorizationResponsePayload.vp_token = JSON.parse(authorizationResponsePayload.vp_token);
|
|
85
|
-
}
|
|
86
|
-
if (!verificationSession) {
|
|
87
|
-
throw new core_1.CredoError('Missing verification session, cannot verify authorization response.');
|
|
88
|
-
}
|
|
89
|
-
const authorizationRequest = await did_auth_siop_1.AuthorizationRequest.fromUriOrJwt(verificationSession.authorizationRequestJwt);
|
|
90
|
-
const response_mode = await authorizationRequest.getMergedProperty('response_mode');
|
|
91
|
-
if (response_mode?.includes('jwt') && !jarmResponseType) {
|
|
92
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
93
|
-
error: oauth2_1.Oauth2ErrorCodes.InvalidRequest,
|
|
94
|
-
error_description: `JARM response is required for JWT response mode '${response_mode}'.`,
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
if (!response_mode?.includes('jwt') && jarmResponseType) {
|
|
98
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
99
|
-
error: oauth2_1.Oauth2ErrorCodes.InvalidRequest,
|
|
100
|
-
error_description: `Recieved JARM response which is incompatible with response mode '${response_mode}'.`,
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
if (jarmResponseType && jarmResponseType !== 'encrypted') {
|
|
104
|
-
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
105
|
-
error: oauth2_1.Oauth2ErrorCodes.InvalidRequest,
|
|
106
|
-
error_description: `Only encrypted JARM responses are supported, received '${jarmResponseType}'.`,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
await openId4VcVerifierService.verifyAuthorizationResponse(agentContext, {
|
|
110
|
-
authorizationResponse: authorizationResponsePayload,
|
|
111
|
-
verificationSession,
|
|
112
|
-
jarmHeader,
|
|
17
|
+
const result = await getVerificationSession(agentContext, request, response, next, verifier);
|
|
18
|
+
// Response already handled in the method
|
|
19
|
+
if (!result.success)
|
|
20
|
+
return;
|
|
21
|
+
const { verificationSession } = await openId4VcVerifierService.verifyAuthorizationResponse(agentContext, {
|
|
22
|
+
authorizationResponse: request.body,
|
|
23
|
+
verificationSession: result.verificationSession,
|
|
113
24
|
});
|
|
114
25
|
return (0, router_1.sendJsonResponse)(response, next, {
|
|
115
26
|
// Used only for presentation during issuance flow, to prevent session fixation.
|
|
116
27
|
presentation_during_issuance_session: verificationSession.presentationDuringIssuanceSession,
|
|
28
|
+
// TODO: add callback for the user of Credo, where also a redirect_uri can be returned
|
|
29
|
+
// callback should also be called in case of failed verification
|
|
30
|
+
// redirect_uri
|
|
117
31
|
});
|
|
118
32
|
}
|
|
119
33
|
catch (error) {
|
|
120
34
|
if (error instanceof oauth2_1.Oauth2ServerErrorResponseError) {
|
|
121
35
|
return (0, router_1.sendOauth2ErrorResponse)(response, next, agentContext.config.logger, error);
|
|
122
36
|
}
|
|
123
|
-
|
|
37
|
+
// FIXME: should throw a Oauth2ServerErrorResponseError in the oid4vp library
|
|
38
|
+
if (error instanceof utils_1.ValidationError) {
|
|
39
|
+
return (0, router_1.sendOauth2ErrorResponse)(response, next, agentContext.config.logger, new oauth2_1.Oauth2ServerErrorResponseError({
|
|
40
|
+
error: oauth2_1.Oauth2ErrorCodes.InvalidRequest,
|
|
41
|
+
error_description: error.message,
|
|
42
|
+
}, { cause: error }));
|
|
43
|
+
}
|
|
44
|
+
// FIXME: Many CredoError will result in 500. We should either throw Oauth2ServerErrorResponseError as well
|
|
45
|
+
// Or have a special OpenID4VP verifier error that is similar to Oauth2ServerErrorResponseError
|
|
46
|
+
return (0, router_1.sendUnknownServerErrorResponse)(response, next, agentContext.config.logger, error);
|
|
124
47
|
}
|
|
125
48
|
});
|
|
126
49
|
}
|
|
50
|
+
async function getVerificationSession(agentContext, request, response, next, verifier) {
|
|
51
|
+
const openId4VcVerificationSessionRepository = agentContext.dependencyManager.resolve(repository_1.OpenId4VcVerificationSessionRepository);
|
|
52
|
+
try {
|
|
53
|
+
if (request.query.session) {
|
|
54
|
+
if (typeof request.query.session !== 'string') {
|
|
55
|
+
(0, router_1.sendErrorResponse)(response, next, agentContext.config.logger, 400, oauth2_1.Oauth2ErrorCodes.InvalidRequest, `Unexpected value for 'session' query param`);
|
|
56
|
+
return { success: false };
|
|
57
|
+
}
|
|
58
|
+
const verificationSession = await openId4VcVerificationSessionRepository.findSingleByQuery(agentContext, {
|
|
59
|
+
verifierId: verifier.verifierId,
|
|
60
|
+
authorizationRequestId: request.query.session,
|
|
61
|
+
});
|
|
62
|
+
if (!verificationSession) {
|
|
63
|
+
(0, router_1.sendErrorResponse)(response, next, agentContext.config.logger, 400, oauth2_1.Oauth2ErrorCodes.InvalidRequest, `Invalid 'session' parameter`);
|
|
64
|
+
return { success: false };
|
|
65
|
+
}
|
|
66
|
+
return { success: true, verificationSession };
|
|
67
|
+
}
|
|
68
|
+
const parsedResponse = openid4vp_1.zOpenid4vpAuthorizationResponse.safeParse(request.body);
|
|
69
|
+
if (parsedResponse.success) {
|
|
70
|
+
if (!parsedResponse.data.state) {
|
|
71
|
+
(0, router_1.sendErrorResponse)(response, next, agentContext.config.logger, 400, oauth2_1.Oauth2ErrorCodes.InvalidRequest, `Missing required 'state' parameter in response without response encryption`);
|
|
72
|
+
return { success: false };
|
|
73
|
+
}
|
|
74
|
+
const verificationSession = await openId4VcVerificationSessionRepository.findSingleByQuery(agentContext, {
|
|
75
|
+
payloadState: parsedResponse.data.state,
|
|
76
|
+
verifierId: verifier.verifierId,
|
|
77
|
+
});
|
|
78
|
+
if (!verificationSession) {
|
|
79
|
+
(0, router_1.sendErrorResponse)(response, next, agentContext.config.logger, 400, oauth2_1.Oauth2ErrorCodes.InvalidRequest, `Invalid 'state' parameter`);
|
|
80
|
+
return { success: false };
|
|
81
|
+
}
|
|
82
|
+
return { success: true, verificationSession };
|
|
83
|
+
}
|
|
84
|
+
// Try extracting apv (request nonce), which is used in encrypted responses (for ISO 18013-7/before draft 24)
|
|
85
|
+
if (typeof request.body === 'object' && 'response' in request.body) {
|
|
86
|
+
const { header } = (0, oauth2_1.decodeJwtHeader)({
|
|
87
|
+
jwt: request.body.response,
|
|
88
|
+
});
|
|
89
|
+
if (!header.apv) {
|
|
90
|
+
(0, router_1.sendErrorResponse)(response, next, agentContext.config.logger, 400, oauth2_1.Oauth2ErrorCodes.InvalidRequest, `Missing 'session' query param or 'apv' value in header of encrypted JARM response.`);
|
|
91
|
+
return { success: false };
|
|
92
|
+
}
|
|
93
|
+
if (typeof header.apv !== 'string') {
|
|
94
|
+
(0, router_1.sendErrorResponse)(response, next, agentContext.config.logger, 400, oauth2_1.Oauth2ErrorCodes.InvalidRequest, `'apv' value in header of encrypted JARM response is not of type string.`);
|
|
95
|
+
return { success: false };
|
|
96
|
+
}
|
|
97
|
+
const nonce = core_1.TypedArrayEncoder.toUtf8String(core_1.TypedArrayEncoder.fromBase64(header.apv));
|
|
98
|
+
const verificationSession = await openId4VcVerificationSessionRepository.findSingleByQuery(agentContext, {
|
|
99
|
+
nonce,
|
|
100
|
+
verifierId: verifier.verifierId,
|
|
101
|
+
});
|
|
102
|
+
if (!verificationSession) {
|
|
103
|
+
(0, router_1.sendErrorResponse)(response, next, agentContext.config.logger, 400, oauth2_1.Oauth2ErrorCodes.InvalidRequest, `Invalid 'apv' parameter`);
|
|
104
|
+
return { success: false };
|
|
105
|
+
}
|
|
106
|
+
return { success: true, verificationSession };
|
|
107
|
+
}
|
|
108
|
+
(0, router_1.sendErrorResponse)(response, next, agentContext.config.logger, 400, oauth2_1.Oauth2ErrorCodes.InvalidRequest, 'Invalid response');
|
|
109
|
+
return { success: false };
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
(0, router_1.sendUnknownServerErrorResponse)(response, next, agentContext.config.logger, error);
|
|
113
|
+
return { success: false };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
127
116
|
//# sourceMappingURL=authorizationEndpoint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorizationEndpoint.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/router/authorizationEndpoint.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"authorizationEndpoint.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/router/authorizationEndpoint.ts"],"names":[],"mappings":";;AAyBA,wEAiDC;AAvED,8CAAqG;AAErG,yCAAgE;AAChE,0EAA0E;AAC1E,oDAAsE;AACtE,gDAM4B;AAC5B,0EAAsE;AACtE,8CAIsB;AAEtB,4CAAkD;AAGlD,SAAgB,8BAA8B,CAAC,MAAc,EAAE,MAAqC;IAClG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,qBAAqB,EAAE,KAAK,EAAE,OAAqC,EAAE,QAAkB,EAAE,IAAI,EAAE,EAAE;QAClH,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,CAAA;QAC7D,MAAM,wBAAwB,GAAG,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,mDAAwB,CAAC,CAAA;QAEjG,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,sBAAsB,CAAC,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC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|
|
4
|
-
* The path at which the authorization request should be made available. Note that it will be
|
|
5
|
-
* hosted at a subpath to take into account multiple tenants and verifiers.
|
|
6
|
-
*
|
|
7
|
-
* @default /authorization-requests
|
|
8
|
-
*/
|
|
9
|
-
endpointPath: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function configureAuthorizationRequestEndpoint(router: Router, config: OpenId4VcSiopAuthorizationRequestEndpointConfig): void;
|
|
2
|
+
import { OpenId4VcVerifierModuleConfig } from '../OpenId4VcVerifierModuleConfig';
|
|
3
|
+
export declare function configureAuthorizationRequestEndpoint(router: Router, config: OpenId4VcVerifierModuleConfig): void;
|
|
@@ -3,32 +3,39 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.configureAuthorizationRequestEndpoint = configureAuthorizationRequestEndpoint;
|
|
4
4
|
const core_1 = require("@credo-ts/core");
|
|
5
5
|
const router_1 = require("../../shared/router");
|
|
6
|
-
const OpenId4VcSiopVerifierService_1 = require("../OpenId4VcSiopVerifierService");
|
|
7
6
|
const OpenId4VcVerificationSessionState_1 = require("../OpenId4VcVerificationSessionState");
|
|
8
|
-
const OpenId4VcVerifierEvents_1 = require("../OpenId4VcVerifierEvents");
|
|
9
7
|
const OpenId4VcVerifierModuleConfig_1 = require("../OpenId4VcVerifierModuleConfig");
|
|
10
|
-
const
|
|
8
|
+
const OpenId4VpVerifierService_1 = require("../OpenId4VpVerifierService");
|
|
11
9
|
function configureAuthorizationRequestEndpoint(router, config) {
|
|
12
|
-
router.get((0, core_1.joinUriParts)(config.
|
|
10
|
+
router.get((0, core_1.joinUriParts)(config.authorizationRequestEndpoint, [':authorizationRequestId']), async (request, response, next) => {
|
|
13
11
|
const { agentContext, verifier } = (0, router_1.getRequestContext)(request);
|
|
14
12
|
if (!request.params.authorizationRequestId || typeof request.params.authorizationRequestId !== 'string') {
|
|
15
13
|
return (0, router_1.sendErrorResponse)(response, next, agentContext.config.logger, 400, 'invalid_request', 'Invalid authorization request url');
|
|
16
14
|
}
|
|
17
15
|
try {
|
|
18
|
-
const verifierService = agentContext.dependencyManager.resolve(
|
|
19
|
-
const verificationSessionRepository = agentContext.dependencyManager.resolve(repository_1.OpenId4VcVerificationSessionRepository);
|
|
16
|
+
const verifierService = agentContext.dependencyManager.resolve(OpenId4VpVerifierService_1.OpenId4VpVerifierService);
|
|
20
17
|
const verifierConfig = agentContext.dependencyManager.resolve(OpenId4VcVerifierModuleConfig_1.OpenId4VcVerifierModuleConfig);
|
|
21
18
|
// We always use shortened URIs currently
|
|
22
19
|
const fullAuthorizationRequestUri = (0, core_1.joinUriParts)(verifierConfig.baseUrl, [
|
|
23
20
|
verifier.verifierId,
|
|
24
|
-
verifierConfig.authorizationRequestEndpoint
|
|
21
|
+
verifierConfig.authorizationRequestEndpoint,
|
|
25
22
|
request.params.authorizationRequestId,
|
|
26
23
|
]);
|
|
27
24
|
const [verificationSession] = await verifierService.findVerificationSessionsByQuery(agentContext, {
|
|
28
25
|
verifierId: verifier.verifierId,
|
|
29
|
-
|
|
26
|
+
$or: [
|
|
27
|
+
{
|
|
28
|
+
authorizationRequestId: request.params.authorizationRequestId,
|
|
29
|
+
},
|
|
30
|
+
// NOTE: this can soon be removed, authorization request id is cleaner,
|
|
31
|
+
// but only introduced since 0.6
|
|
32
|
+
{
|
|
33
|
+
authorizationRequestUri: fullAuthorizationRequestUri,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
30
36
|
});
|
|
31
|
-
|
|
37
|
+
// Not all requets are signed, and those are not fetcheable
|
|
38
|
+
if (!verificationSession || !verificationSession.authorizationRequestJwt) {
|
|
32
39
|
return (0, router_1.sendErrorResponse)(response, next, agentContext.config.logger, 404, 'not_found', 'Authorization request not found');
|
|
33
40
|
}
|
|
34
41
|
if (![
|
|
@@ -37,26 +44,18 @@ function configureAuthorizationRequestEndpoint(router, config) {
|
|
|
37
44
|
].includes(verificationSession.state)) {
|
|
38
45
|
return (0, router_1.sendErrorResponse)(response, next, agentContext.config.logger, 400, 'invalid_request', 'Invalid state for authorization request');
|
|
39
46
|
}
|
|
47
|
+
if (verificationSession.expiresAt && Date.now() > verificationSession.expiresAt.getTime()) {
|
|
48
|
+
return (0, router_1.sendNotFoundResponse)(response, next, agentContext.config.logger, 'Session expired');
|
|
49
|
+
}
|
|
40
50
|
// It's okay to retrieve the offer multiple times. So we only update the state if it's not already retrieved
|
|
41
51
|
if (verificationSession.state !== OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.RequestUriRetrieved) {
|
|
42
|
-
|
|
43
|
-
verificationSession.state = OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.RequestUriRetrieved;
|
|
44
|
-
await verificationSessionRepository.update(agentContext, verificationSession);
|
|
45
|
-
agentContext.dependencyManager
|
|
46
|
-
.resolve(core_1.EventEmitter)
|
|
47
|
-
.emit(agentContext, {
|
|
48
|
-
type: OpenId4VcVerifierEvents_1.OpenId4VcVerifierEvents.VerificationSessionStateChanged,
|
|
49
|
-
payload: {
|
|
50
|
-
verificationSession: verificationSession.clone(),
|
|
51
|
-
previousState,
|
|
52
|
-
},
|
|
53
|
-
});
|
|
52
|
+
await verifierService.updateState(agentContext, verificationSession, OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.RequestUriRetrieved);
|
|
54
53
|
}
|
|
55
54
|
response.type('application/oauth-authz-req+jwt').status(200).send(verificationSession.authorizationRequestJwt);
|
|
56
55
|
next();
|
|
57
56
|
}
|
|
58
57
|
catch (error) {
|
|
59
|
-
return (0, router_1.
|
|
58
|
+
return (0, router_1.sendUnknownServerErrorResponse)(response, next, agentContext.config.logger, error);
|
|
60
59
|
}
|
|
61
60
|
});
|
|
62
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorizationRequestEndpoint.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/router/authorizationRequestEndpoint.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"authorizationRequestEndpoint.js","sourceRoot":"","sources":["../../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,mBAAmB,CAAC,uBAAuB,CAAC,CAAA;YAC9G,IAAI,EAAE,CAAA;QACR,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAA,uCAA8B,EAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QAC1F,CAAC;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import type { ClientAuthenticationCallback, SignJwtCallback, VerifyJwtCallback } from '@animo-id/oauth2';
|
|
2
1
|
import type { AgentContext } from '@credo-ts/core';
|
|
2
|
+
import type { ClientAuthenticationCallback, DecryptJweCallback, EncryptJweCallback, SignJwtCallback, VerifyJwtCallback } from '@openid4vc/oauth2';
|
|
3
3
|
import type { OpenId4VcIssuerRecord } from '../openid4vc-issuer/repository';
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
|
|
4
|
+
export declare function getOid4vcJwtVerifyCallback(agentContext: AgentContext, trustedCertificates?: string[]): VerifyJwtCallback;
|
|
5
|
+
export declare function getOid4vcEncryptJweCallback(agentContext: AgentContext): EncryptJweCallback;
|
|
6
|
+
export declare function getOid4vcDecryptJweCallback(agentContext: AgentContext): DecryptJweCallback;
|
|
7
|
+
export declare function getOid4vcJwtSignCallback(agentContext: AgentContext): SignJwtCallback;
|
|
8
|
+
export declare function getOid4vcCallbacks(agentContext: AgentContext, trustedCertificates?: string[]): {
|
|
9
|
+
hash: (data: Uint8Array, alg: import("@openid4vc/oauth2").HashAlgorithm) => Uint8Array;
|
|
8
10
|
generateRandom: (length: number) => Uint8Array;
|
|
9
11
|
signJwt: SignJwtCallback;
|
|
10
12
|
clientAuthentication: () => void;
|
|
11
13
|
verifyJwt: VerifyJwtCallback;
|
|
12
14
|
fetch: typeof fetch;
|
|
15
|
+
encryptJwe: EncryptJweCallback;
|
|
16
|
+
decryptJwe: DecryptJweCallback;
|
|
17
|
+
getX509CertificateMetadata: (certificate: string) => {
|
|
18
|
+
sanDnsNames: string[];
|
|
19
|
+
sanUriNames: string[];
|
|
20
|
+
};
|
|
13
21
|
};
|
|
14
22
|
/**
|
|
15
23
|
* Allows us to authenticate when making requests to an external
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
3
|
+
exports.getOid4vcJwtVerifyCallback = getOid4vcJwtVerifyCallback;
|
|
4
|
+
exports.getOid4vcEncryptJweCallback = getOid4vcEncryptJweCallback;
|
|
5
|
+
exports.getOid4vcDecryptJweCallback = getOid4vcDecryptJweCallback;
|
|
6
|
+
exports.getOid4vcJwtSignCallback = getOid4vcJwtSignCallback;
|
|
7
|
+
exports.getOid4vcCallbacks = getOid4vcCallbacks;
|
|
6
8
|
exports.dynamicOid4vciClientAuthentication = dynamicOid4vciClientAuthentication;
|
|
7
|
-
const oauth2_1 = require("@animo-id/oauth2");
|
|
8
9
|
const core_1 = require("@credo-ts/core");
|
|
10
|
+
const oauth2_1 = require("@openid4vc/oauth2");
|
|
9
11
|
const utils_1 = require("./utils");
|
|
10
|
-
function
|
|
12
|
+
function getOid4vcJwtVerifyCallback(agentContext, trustedCertificates) {
|
|
11
13
|
const jwsService = agentContext.dependencyManager.resolve(core_1.JwsService);
|
|
12
14
|
return async (signer, { compact }) => {
|
|
13
|
-
const { isValid } = await jwsService.verifyJws(agentContext, {
|
|
15
|
+
const { isValid, signerKeys } = await jwsService.verifyJws(agentContext, {
|
|
14
16
|
jws: compact,
|
|
17
|
+
trustedCertificates,
|
|
15
18
|
// Only handles kid as did resolution. JWK is handled by jws service
|
|
16
19
|
jwkResolver: async () => {
|
|
17
20
|
if (signer.method === 'jwk') {
|
|
@@ -24,15 +27,94 @@ function getOid4vciJwtVerifyCallback(agentContext) {
|
|
|
24
27
|
throw new core_1.CredoError(`Unexpected call to jwk resolver for signer method ${signer.method}`);
|
|
25
28
|
},
|
|
26
29
|
});
|
|
27
|
-
|
|
30
|
+
if (!isValid) {
|
|
31
|
+
return { verified: false, signerJwk: undefined };
|
|
32
|
+
}
|
|
33
|
+
const signerKey = signerKeys[0];
|
|
34
|
+
const signerJwk = (0, core_1.getJwkFromKey)(signerKey).toJson();
|
|
35
|
+
if (signer.method === 'did') {
|
|
36
|
+
signerJwk.kid = signer.didUrl;
|
|
37
|
+
}
|
|
38
|
+
return { verified: true, signerJwk };
|
|
28
39
|
};
|
|
29
40
|
}
|
|
30
|
-
function
|
|
41
|
+
function getOid4vcEncryptJweCallback(agentContext) {
|
|
42
|
+
return async (jweEncryptor, compact) => {
|
|
43
|
+
if (jweEncryptor.method !== 'jwk') {
|
|
44
|
+
throw new core_1.CredoError(`Jwt encryption method '${jweEncryptor.method}' is not supported for jwt signer. Only 'jwk' is supported.`);
|
|
45
|
+
}
|
|
46
|
+
const jwk = (0, core_1.getJwkFromJson)(jweEncryptor.publicJwk);
|
|
47
|
+
const key = jwk.key;
|
|
48
|
+
if (jweEncryptor.alg !== 'ECDH-ES') {
|
|
49
|
+
throw new core_1.CredoError("Only 'ECDH-ES' is supported as 'alg' value for JARM response encryption");
|
|
50
|
+
}
|
|
51
|
+
if (jweEncryptor.enc !== 'A256GCM' && jweEncryptor.enc !== 'A128GCM' && jweEncryptor.enc !== 'A128CBC-HS256') {
|
|
52
|
+
throw new core_1.CredoError("Only 'A256GCM', 'A128GCM', and 'A128CBC-HS256' is supported as 'enc' value for JARM response encryption");
|
|
53
|
+
}
|
|
54
|
+
if (key.keyType !== core_1.KeyType.P256) {
|
|
55
|
+
throw new core_1.CredoError(`Only '${core_1.KeyType.P256}' key type is supported for JARM response encryption`);
|
|
56
|
+
}
|
|
57
|
+
if (!agentContext.wallet.directEncryptCompactJweEcdhEs) {
|
|
58
|
+
throw new core_1.CredoError('Cannot decrypt Jarm Response, wallet does not support directEncryptCompactJweEcdhEs. You need to upgrade your wallet implementation.');
|
|
59
|
+
}
|
|
60
|
+
const jwe = await agentContext.wallet.directEncryptCompactJweEcdhEs({
|
|
61
|
+
data: core_1.Buffer.from(compact),
|
|
62
|
+
recipientKey: key,
|
|
63
|
+
header: { kid: jweEncryptor.publicJwk.kid },
|
|
64
|
+
encryptionAlgorithm: jweEncryptor.enc,
|
|
65
|
+
apu: jweEncryptor.apu ? core_1.TypedArrayEncoder.toBase64URL(core_1.TypedArrayEncoder.fromString(jweEncryptor.apu)) : undefined,
|
|
66
|
+
apv: jweEncryptor.apv ? core_1.TypedArrayEncoder.toBase64URL(core_1.TypedArrayEncoder.fromString(jweEncryptor.apv)) : undefined,
|
|
67
|
+
});
|
|
68
|
+
return { encryptionJwk: jweEncryptor.publicJwk, jwe };
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function getOid4vcDecryptJweCallback(agentContext) {
|
|
72
|
+
return async (jwe, options) => {
|
|
73
|
+
const { header } = (0, oauth2_1.decodeJwtHeader)({ jwt: jwe });
|
|
74
|
+
const kid = options?.jwk?.kid ?? header.kid;
|
|
75
|
+
if (!kid) {
|
|
76
|
+
throw new core_1.CredoError('Uanbel to decrypt jwe. No kid or jwk found');
|
|
77
|
+
}
|
|
78
|
+
const key = core_1.Key.fromFingerprint(kid);
|
|
79
|
+
if (!agentContext.wallet.directDecryptCompactJweEcdhEs) {
|
|
80
|
+
throw new core_1.CredoError('Cannot decrypt Jarm Response, wallet does not support directDecryptCompactJweEcdhEs');
|
|
81
|
+
}
|
|
82
|
+
let decryptedPayload;
|
|
83
|
+
try {
|
|
84
|
+
const decrypted = await agentContext.wallet.directDecryptCompactJweEcdhEs({ compactJwe: jwe, recipientKey: key });
|
|
85
|
+
decryptedPayload = core_1.TypedArrayEncoder.toUtf8String(decrypted.data);
|
|
86
|
+
}
|
|
87
|
+
catch (_error) {
|
|
88
|
+
return {
|
|
89
|
+
decrypted: false,
|
|
90
|
+
encryptionJwk: options?.jwk,
|
|
91
|
+
payload: undefined,
|
|
92
|
+
header,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
decrypted: true,
|
|
97
|
+
decryptionJwk: (0, core_1.getJwkFromKey)(key).toJson(),
|
|
98
|
+
payload: decryptedPayload,
|
|
99
|
+
header,
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function getOid4vcJwtSignCallback(agentContext) {
|
|
31
104
|
const jwsService = agentContext.dependencyManager.resolve(core_1.JwsService);
|
|
32
105
|
return async (signer, { payload, header }) => {
|
|
33
|
-
if (signer.method === 'custom' || signer.method === '
|
|
106
|
+
if (signer.method === 'custom' || signer.method === 'trustChain') {
|
|
34
107
|
throw new core_1.CredoError(`Jwt signer method 'custom' and 'x5c' are not supported for jwt signer.`);
|
|
35
108
|
}
|
|
109
|
+
if (signer.method === 'x5c') {
|
|
110
|
+
const leafCertificate = core_1.X509Service.getLeafCertificate(agentContext, { certificateChain: signer.x5c });
|
|
111
|
+
const jws = await jwsService.createJwsCompact(agentContext, {
|
|
112
|
+
protectedHeaderOptions: { ...header, alg: signer.alg, jwk: undefined },
|
|
113
|
+
payload: core_1.JwtPayload.fromJson(payload),
|
|
114
|
+
key: leafCertificate.publicKey,
|
|
115
|
+
});
|
|
116
|
+
return { jwt: jws, signerJwk: (0, core_1.getJwkFromKey)(leafCertificate.publicKey).toJson() };
|
|
117
|
+
}
|
|
36
118
|
const key = signer.method === 'did' ? await (0, utils_1.getKeyFromDid)(agentContext, signer.didUrl) : (0, core_1.getJwkFromJson)(signer.publicJwk).key;
|
|
37
119
|
const jwk = (0, core_1.getJwkFromKey)(key);
|
|
38
120
|
if (!jwk.supportsSignatureAlgorithm(signer.alg)) {
|
|
@@ -46,17 +128,26 @@ function getOid4vciJwtSignCallback(agentContext) {
|
|
|
46
128
|
payload: core_1.JsonEncoder.toBuffer(payload),
|
|
47
129
|
key,
|
|
48
130
|
});
|
|
49
|
-
return jwt;
|
|
131
|
+
return { jwt, signerJwk: (0, core_1.getJwkFromKey)(key).toJson() };
|
|
50
132
|
};
|
|
51
133
|
}
|
|
52
|
-
function
|
|
134
|
+
function getOid4vcCallbacks(agentContext, trustedCertificates) {
|
|
53
135
|
return {
|
|
54
136
|
hash: (data, alg) => core_1.Hasher.hash(data, alg.toLowerCase()),
|
|
55
137
|
generateRandom: (length) => agentContext.wallet.getRandomValues(length),
|
|
56
|
-
signJwt:
|
|
138
|
+
signJwt: getOid4vcJwtSignCallback(agentContext),
|
|
57
139
|
clientAuthentication: (0, oauth2_1.clientAuthenticationNone)(),
|
|
58
|
-
verifyJwt:
|
|
140
|
+
verifyJwt: getOid4vcJwtVerifyCallback(agentContext, trustedCertificates),
|
|
59
141
|
fetch: agentContext.config.agentDependencies.fetch,
|
|
142
|
+
encryptJwe: getOid4vcEncryptJweCallback(agentContext),
|
|
143
|
+
decryptJwe: getOid4vcDecryptJweCallback(agentContext),
|
|
144
|
+
getX509CertificateMetadata: (certificate) => {
|
|
145
|
+
const leafCertificate = core_1.X509Service.getLeafCertificate(agentContext, { certificateChain: [certificate] });
|
|
146
|
+
return {
|
|
147
|
+
sanDnsNames: leafCertificate.sanDnsNames,
|
|
148
|
+
sanUriNames: leafCertificate.sanUriNames,
|
|
149
|
+
};
|
|
150
|
+
},
|
|
60
151
|
};
|
|
61
152
|
}
|
|
62
153
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callbacks.js","sourceRoot":"","sources":["../../src/shared/callbacks.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"callbacks.js","sourceRoot":"","sources":["../../src/shared/callbacks.ts"],"names":[],"mappings":";;AA6BA,gEAoCC;AAED,kEA0CC;AAED,kEAmCC;AAED,4DAuCC;AAED,gDAkBC;AAMD,gFA4BC;AAtOD,yCAauB;AACvB,8CAA0G;AAE1G,mCAAuC;AAEvC,SAAgB,0BAA0B,CACxC,YAA0B,EAC1B,mBAA8B;IAE9B,MAAM,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