@credo-ts/openid4vc 0.6.0-pr-2195-20250226092707 → 0.6.0-pr-2209-20250321171013
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 +14 -119
- package/build/openid4vc-holder/OpenId4VcHolderApi.js +9 -24
- package/build/openid4vc-holder/OpenId4VcHolderApi.js.map +1 -1
- package/build/openid4vc-holder/OpenId4VcHolderModule.js +1 -1
- package/build/openid4vc-holder/OpenId4VcHolderModule.js.map +1 -1
- package/build/openid4vc-holder/OpenId4VciHolderService.d.ts +8 -7
- package/build/openid4vc-holder/OpenId4VciHolderService.js +21 -19
- package/build/openid4vc-holder/OpenId4VciHolderService.js.map +1 -1
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.d.ts +4 -4
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js +2 -2
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js.map +1 -1
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.d.ts +15 -116
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.js +233 -239
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.js.map +1 -1
- package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.d.ts +9 -25
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.d.ts +44 -194
- package/build/openid4vc-issuer/OpenId4VcIssuerEvents.d.ts +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.d.ts +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.js +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.d.ts +8 -8
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js +10 -2
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerService.d.ts +48 -198
- package/build/openid4vc-issuer/OpenId4VcIssuerService.js +27 -39
- package/build/openid4vc-issuer/OpenId4VcIssuerService.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.d.ts +6 -11
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.d.ts +2 -2
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.js +1 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.js.map +1 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRepository.d.ts +1 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.d.ts +1 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js +3 -3
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js.map +1 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.d.ts +1 -1
- package/build/openid4vc-issuer/router/accessTokenEndpoint.d.ts +2 -2
- 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.d.ts +1 -1
- package/build/openid4vc-issuer/router/credentialEndpoint.js +3 -3
- package/build/openid4vc-issuer/router/credentialEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/credentialOfferEndpoint.d.ts +1 -1
- package/build/openid4vc-issuer/router/issuerMetadataEndpoint.js +1 -1
- package/build/openid4vc-issuer/router/issuerMetadataEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/jwksEndpoint.d.ts +1 -1
- package/build/openid4vc-issuer/router/nonceEndpoint.d.ts +1 -1
- package/build/openid4vc-issuer/util/txCode.d.ts +1 -1
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.d.ts +12 -20
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js +325 -571
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.d.ts +20 -36
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.d.ts +2 -2
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.js +2 -2
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierEvents.d.ts +1 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.d.ts +1 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.js +4 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.d.ts +2 -2
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.d.ts +49 -0
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js +230 -0
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js.map +1 -0
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.d.ts +19 -0
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js +144 -0
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js.map +1 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.d.ts +11 -20
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js +7 -18
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js.map +1 -1
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRepository.d.ts +1 -1
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.d.ts +1 -1
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.d.ts +1 -1
- package/build/openid4vc-verifier/router/authorizationEndpoint.js +103 -5
- package/build/openid4vc-verifier/router/authorizationEndpoint.js.map +1 -1
- package/build/openid4vc-verifier/router/authorizationRequestEndpoint.js +16 -3
- package/build/openid4vc-verifier/router/authorizationRequestEndpoint.js.map +1 -1
- package/build/shared/callbacks.d.ts +6 -14
- package/build/shared/callbacks.js +14 -102
- package/build/shared/callbacks.js.map +1 -1
- package/build/shared/issuerMetadataUtils.d.ts +144 -102
- package/build/shared/models/OpenId4VcJwtIssuer.d.ts +3 -2
- 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 +4 -4
- package/build/shared/router/context.js.map +1 -1
- package/build/shared/router/express.js +1 -2
- package/build/shared/router/express.js.map +1 -1
- package/build/shared/transform.d.ts +5 -0
- package/build/shared/transform.js +69 -0
- package/build/shared/transform.js.map +1 -0
- package/build/shared/utils.d.ts +8 -6
- package/build/shared/utils.js +105 -34
- package/build/shared/utils.js.map +1 -1
- package/package.json +8 -6
|
@@ -11,296 +11,290 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.OpenId4VcSiopHolderService = void 0;
|
|
13
13
|
const core_1 = require("@credo-ts/core");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const did_auth_siop_1 = require("@sphereon/did-auth-siop");
|
|
15
|
+
const transform_1 = require("../shared/transform");
|
|
16
|
+
const utils_1 = require("../shared/utils");
|
|
16
17
|
let OpenId4VcSiopHolderService = class OpenId4VcSiopHolderService {
|
|
17
|
-
constructor(presentationExchangeService
|
|
18
|
+
constructor(presentationExchangeService) {
|
|
18
19
|
this.presentationExchangeService = presentationExchangeService;
|
|
19
|
-
this.dcqlService = dcqlService;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
definition
|
|
30
|
-
credentialsForRequest: await this.presentationExchangeService.getCredentialsForRequest(agentContext, presentationDefinition),
|
|
31
|
-
};
|
|
32
|
-
let credentialsForTransactionData = undefined;
|
|
33
|
-
// for each transaction data entry, get all submission entries that can be used to sign the respective transaction
|
|
34
|
-
if (transactionData) {
|
|
35
|
-
credentialsForTransactionData = [];
|
|
36
|
-
for (const transactionDataEntry of transactionData) {
|
|
37
|
-
for (const requirement of presentationExchange.credentialsForRequest.requirements) {
|
|
38
|
-
const recordSet = new Set();
|
|
39
|
-
const filtered = requirement.submissionEntry.filter((submission) => transactionDataEntry.credential_ids.includes(submission.inputDescriptorId));
|
|
40
|
-
for (const submission of filtered) {
|
|
41
|
-
for (const credential of submission.verifiableCredentials) {
|
|
42
|
-
recordSet.add(credential);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (recordSet.size === 0) {
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
credentialsForTransactionData.push({
|
|
49
|
-
transactionDataEntry,
|
|
50
|
-
submissionEntry: { ...filtered[0], verifiableCredentials: Array.from(recordSet) },
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return { pex: { ...presentationExchange, transactionData: credentialsForTransactionData } };
|
|
56
|
-
}
|
|
57
|
-
async handleDcqlRequest(agentContext, dcql, transactionData) {
|
|
58
|
-
const dcqlQuery = this.dcqlService.validateDcqlQuery(dcql);
|
|
59
|
-
const dcqlQueryResult = await this.dcqlService.getCredentialsForRequest(agentContext, dcqlQuery);
|
|
60
|
-
let credentialsForTransactionData = undefined;
|
|
61
|
-
// for each transaction data entry, get all submission entries that can be used to sign the respective transaction
|
|
62
|
-
if (transactionData) {
|
|
63
|
-
credentialsForTransactionData = [];
|
|
64
|
-
for (const transactionDataEntry of transactionData) {
|
|
65
|
-
const result = transactionDataEntry.credential_ids
|
|
66
|
-
.map((credentialId) => {
|
|
67
|
-
const match = dcqlQueryResult.credential_matches[credentialId];
|
|
68
|
-
if (!match.success)
|
|
69
|
-
return undefined;
|
|
70
|
-
return {
|
|
71
|
-
transactionDataEntry,
|
|
72
|
-
dcql: {
|
|
73
|
-
record: match.record,
|
|
74
|
-
credentialQueryId: match.input_credential_index,
|
|
75
|
-
claimSetId: match.claim_set_index,
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
})
|
|
79
|
-
.filter((r) => r !== undefined);
|
|
80
|
-
credentialsForTransactionData.push(...result);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return { dcql: { queryResult: dcqlQueryResult, transactionData: credentialsForTransactionData } };
|
|
84
|
-
}
|
|
85
|
-
async resolveAuthorizationRequest(agentContext,
|
|
86
|
-
/**
|
|
87
|
-
* Can be:
|
|
88
|
-
* - JWT
|
|
89
|
-
* - URI containing request or request_uri param
|
|
90
|
-
* - Request payload
|
|
91
|
-
*/
|
|
92
|
-
request, options) {
|
|
93
|
-
const openid4vpClient = this.getOpenid4vpClient(agentContext, options?.trustedCertificates);
|
|
94
|
-
const { params } = openid4vpClient.parseOpenid4vpAuthorizationRequestPayload({ authorizationRequest: request });
|
|
95
|
-
const verifiedAuthRequest = await openid4vpClient.resolveOpenId4vpAuthorizationRequest({
|
|
96
|
-
request: params,
|
|
97
|
-
origin: options?.origin,
|
|
98
|
-
});
|
|
99
|
-
const { client, pex, transactionData, dcql } = verifiedAuthRequest;
|
|
100
|
-
if (client.scheme !== 'x509_san_dns' &&
|
|
101
|
-
client.scheme !== 'x509_san_uri' &&
|
|
102
|
-
client.scheme !== 'did' &&
|
|
103
|
-
client.scheme !== 'web-origin') {
|
|
104
|
-
throw new core_1.CredoError(`Client scheme '${client.scheme}' is not supported`);
|
|
21
|
+
async resolveAuthorizationRequest(agentContext, requestJwtOrUri, trustedCertificates) {
|
|
22
|
+
const openidProvider = await this.getOpenIdProvider(agentContext, trustedCertificates);
|
|
23
|
+
// parsing happens automatically in verifyAuthorizationRequest
|
|
24
|
+
const verifiedAuthorizationRequest = await openidProvider.verifyAuthorizationRequest(requestJwtOrUri);
|
|
25
|
+
agentContext.config.logger.debug(`verified SIOP Authorization Request for issuer '${verifiedAuthorizationRequest.issuer}'`);
|
|
26
|
+
agentContext.config.logger.debug(`requestJwtOrUri '${requestJwtOrUri}'`);
|
|
27
|
+
if (verifiedAuthorizationRequest.presentationDefinitions &&
|
|
28
|
+
verifiedAuthorizationRequest.presentationDefinitions.length > 1) {
|
|
29
|
+
throw new core_1.CredoError('Only a single presentation definition is supported.');
|
|
105
30
|
}
|
|
106
|
-
const
|
|
107
|
-
? await this.handlePresentationExchangeRequest(agentContext, pex.presentation_definition, transactionData)
|
|
108
|
-
: { pex: undefined };
|
|
109
|
-
const { dcql: dcqlResult } = dcql?.query
|
|
110
|
-
? await this.handleDcqlRequest(agentContext, dcql.query, transactionData)
|
|
111
|
-
: { dcql: undefined };
|
|
112
|
-
agentContext.config.logger.debug(`verified Authorization Request`);
|
|
113
|
-
agentContext.config.logger.debug(`request '${request}'`);
|
|
31
|
+
const presentationDefinition = verifiedAuthorizationRequest.presentationDefinitions?.[0]?.definition;
|
|
114
32
|
return {
|
|
115
|
-
authorizationRequest:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
33
|
+
authorizationRequest: verifiedAuthorizationRequest,
|
|
34
|
+
// Parameters related to DIF Presentation Exchange
|
|
35
|
+
presentationExchange: presentationDefinition
|
|
36
|
+
? {
|
|
37
|
+
definition: presentationDefinition,
|
|
38
|
+
credentialsForRequest: await this.presentationExchangeService.getCredentialsForRequest(agentContext, presentationDefinition),
|
|
39
|
+
}
|
|
40
|
+
: undefined,
|
|
119
41
|
};
|
|
120
42
|
}
|
|
121
|
-
async getCredentialQueryIdsToSignTransactionData(dcql, transactionData) {
|
|
122
|
-
// check if all credentials are present for the transaction data
|
|
123
|
-
// This needs a deep integration into pex and out pex requirements
|
|
124
|
-
const dcqlCredentialQueryIds = [];
|
|
125
|
-
for (const tdEntry of transactionData) {
|
|
126
|
-
// find a inputDescriptor in the credential_ids which is present in the response
|
|
127
|
-
// and use it to sign of the transaction
|
|
128
|
-
const dcqlCredentialForRequest = tdEntry.credential_ids.find((credentialId) => dcql.credentials[credentialId]);
|
|
129
|
-
if (!dcqlCredentialForRequest) {
|
|
130
|
-
throw new core_1.CredoError('Cannot create authorization response. No credentials found for signing transaction data.');
|
|
131
|
-
}
|
|
132
|
-
dcqlCredentialQueryIds.push(dcqlCredentialForRequest);
|
|
133
|
-
}
|
|
134
|
-
return dcqlCredentialQueryIds;
|
|
135
|
-
}
|
|
136
|
-
async getInputDescriptorsToSignTransactionData(presentationExchange, transactionData) {
|
|
137
|
-
// check if all credentials are present for the transaction data
|
|
138
|
-
// This needs a deep integration into pex and out pex requirements
|
|
139
|
-
const inputDescriptorsToSignTransactionData = [];
|
|
140
|
-
for (const tdEntry of transactionData) {
|
|
141
|
-
// find a inputDescriptor in the credential_ids which is present in the response
|
|
142
|
-
// and use it to sign of the transaction
|
|
143
|
-
const inputDescriptorForCredential = tdEntry.credential_ids.find((credentialId) => presentationExchange.credentials[credentialId]);
|
|
144
|
-
if (!inputDescriptorForCredential) {
|
|
145
|
-
throw new core_1.CredoError('Cannot create authorization response. No credentials found for signing transaction data.');
|
|
146
|
-
}
|
|
147
|
-
inputDescriptorsToSignTransactionData.push(inputDescriptorForCredential);
|
|
148
|
-
}
|
|
149
|
-
return inputDescriptorsToSignTransactionData;
|
|
150
|
-
}
|
|
151
43
|
async acceptAuthorizationRequest(agentContext, options) {
|
|
152
|
-
const { authorizationRequest, presentationExchange
|
|
44
|
+
const { authorizationRequest, presentationExchange } = options;
|
|
45
|
+
let openIdTokenIssuer = options.openIdTokenIssuer;
|
|
46
|
+
let presentationExchangeOptions = undefined;
|
|
47
|
+
const wantsIdToken = await authorizationRequest.authorizationRequest.containsResponseType(did_auth_siop_1.ResponseType.ID_TOKEN);
|
|
153
48
|
const authorizationResponseNonce = await agentContext.wallet.generateNonce();
|
|
154
|
-
const nonce = authorizationRequest.payload.nonce;
|
|
155
|
-
const clientId = authorizationRequest.client.originalValue;
|
|
156
|
-
let openid4vpOptions;
|
|
157
|
-
if ((0, openid4vp_1.isOpenid4vpAuthorizationRequestDcApi)(authorizationRequest.payload)) {
|
|
158
|
-
if (!options.origin) {
|
|
159
|
-
throw new core_1.CredoError('Missing required parameter `origin` parameter for accepting openid4vp dc api requests.');
|
|
160
|
-
}
|
|
161
|
-
openid4vpOptions = { type: 'openId4VpDcApi', clientId, origin: options.origin, verifierGeneratedNonce: nonce };
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
const responseUri = authorizationRequest.payload.response_uri ?? authorizationRequest.payload.redirect_uri;
|
|
165
|
-
if (!responseUri) {
|
|
166
|
-
throw new core_1.CredoError('Missing required parameter `response_uri` or `redirect_uri` in the authorization request.');
|
|
167
|
-
}
|
|
168
|
-
openid4vpOptions = {
|
|
169
|
-
type: 'openId4Vp',
|
|
170
|
-
mdocGeneratedNonce: authorizationResponseNonce,
|
|
171
|
-
responseUri,
|
|
172
|
-
clientId,
|
|
173
|
-
verifierGeneratedNonce: nonce,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
let vpToken;
|
|
177
|
-
let presentationSubmission = undefined;
|
|
178
49
|
// Handle presentation exchange part
|
|
179
|
-
if (authorizationRequest.
|
|
50
|
+
if (authorizationRequest.presentationDefinitions && authorizationRequest.presentationDefinitions.length > 0) {
|
|
180
51
|
if (!presentationExchange) {
|
|
181
52
|
throw new core_1.CredoError('Authorization request included presentation definition. `presentationExchange` MUST be supplied to accept authorization requests.');
|
|
182
53
|
}
|
|
183
|
-
|
|
184
|
-
|
|
54
|
+
const nonce = await authorizationRequest.authorizationRequest.getMergedProperty('nonce');
|
|
55
|
+
if (!nonce) {
|
|
56
|
+
throw new core_1.CredoError("Unable to extract 'nonce' from authorization request");
|
|
57
|
+
}
|
|
58
|
+
const clientId = await authorizationRequest.authorizationRequest.getMergedProperty('client_id');
|
|
59
|
+
if (!clientId) {
|
|
60
|
+
throw new core_1.CredoError("Unable to extract 'client_id' from authorization request");
|
|
185
61
|
}
|
|
186
|
-
const
|
|
62
|
+
const responseUri = (await authorizationRequest.authorizationRequest.getMergedProperty('response_uri')) ??
|
|
63
|
+
(await authorizationRequest.authorizationRequest.getMergedProperty('redirect_uri'));
|
|
64
|
+
if (!responseUri) {
|
|
65
|
+
throw new core_1.CredoError("Unable to extract 'response_uri' from authorization request");
|
|
66
|
+
}
|
|
67
|
+
const { verifiablePresentations, presentationSubmission } = await this.presentationExchangeService.createPresentation(agentContext, {
|
|
187
68
|
credentialsForInputDescriptor: presentationExchange.credentials,
|
|
188
|
-
|
|
189
|
-
? {
|
|
190
|
-
credentials: await this.getInputDescriptorsToSignTransactionData(presentationExchange, authorizationRequest.transactionData),
|
|
191
|
-
transactionData: authorizationRequest.transactionData,
|
|
192
|
-
}
|
|
193
|
-
: undefined,
|
|
194
|
-
presentationDefinition: authorizationRequest.pex
|
|
195
|
-
.presentation_definition,
|
|
69
|
+
presentationDefinition: authorizationRequest.presentationDefinitions[0].definition,
|
|
196
70
|
challenge: nonce,
|
|
197
71
|
domain: clientId,
|
|
198
72
|
presentationSubmissionLocation: core_1.DifPresentationExchangeSubmissionLocation.EXTERNAL,
|
|
199
|
-
openid4vp:
|
|
73
|
+
openid4vp: {
|
|
74
|
+
mdocGeneratedNonce: authorizationResponseNonce,
|
|
75
|
+
responseUri,
|
|
76
|
+
},
|
|
200
77
|
});
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
if (!authorizationRequest.dcql) {
|
|
209
|
-
throw new core_1.CredoError('`dcql` was supplied, but no dcql request was found in the presentation request.');
|
|
210
|
-
}
|
|
211
|
-
if (!dcql) {
|
|
212
|
-
throw new core_1.CredoError('Authorization request included dcql request. `dcql` MUST be supplied to accept authorization requests.');
|
|
78
|
+
presentationExchangeOptions = {
|
|
79
|
+
verifiablePresentations: verifiablePresentations.map((vp) => (0, transform_1.getSphereonVerifiablePresentation)(vp)),
|
|
80
|
+
presentationSubmission,
|
|
81
|
+
vpTokenLocation: did_auth_siop_1.VPTokenLocation.AUTHORIZATION_RESPONSE,
|
|
82
|
+
};
|
|
83
|
+
if (wantsIdToken && !openIdTokenIssuer) {
|
|
84
|
+
openIdTokenIssuer = this.getOpenIdTokenIssuerFromVerifiablePresentation(verifiablePresentations[0]);
|
|
213
85
|
}
|
|
214
|
-
const { encodedDcqlPresentation } = await this.dcqlService.createPresentation(agentContext, {
|
|
215
|
-
credentialQueryToCredential: dcql.credentials,
|
|
216
|
-
transactionDataAuthorization: authorizationRequest.transactionData
|
|
217
|
-
? {
|
|
218
|
-
credentials: await this.getCredentialQueryIdsToSignTransactionData(dcql, authorizationRequest.transactionData),
|
|
219
|
-
transactionData: authorizationRequest.transactionData,
|
|
220
|
-
}
|
|
221
|
-
: undefined,
|
|
222
|
-
challenge: nonce,
|
|
223
|
-
domain: clientId,
|
|
224
|
-
openid4vp: openid4vpOptions,
|
|
225
|
-
});
|
|
226
|
-
vpToken = encodedDcqlPresentation;
|
|
227
86
|
}
|
|
228
|
-
else {
|
|
229
|
-
throw new core_1.CredoError('
|
|
87
|
+
else if (options.presentationExchange) {
|
|
88
|
+
throw new core_1.CredoError('`presentationExchange` was supplied, but no presentation definition was found in the presentation request.');
|
|
230
89
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
90
|
+
if (wantsIdToken) {
|
|
91
|
+
if (!openIdTokenIssuer) {
|
|
92
|
+
throw new core_1.CredoError('Unable to create authorization response. openIdTokenIssuer MUST be supplied when no presentation is active and the ResponseType includes id_token.');
|
|
93
|
+
}
|
|
94
|
+
this.assertValidTokenIssuer(authorizationRequest, openIdTokenIssuer);
|
|
95
|
+
}
|
|
96
|
+
const jwtIssuer = wantsIdToken && openIdTokenIssuer
|
|
97
|
+
? await (0, utils_1.openIdTokenIssuerToJwtIssuer)(agentContext, openIdTokenIssuer)
|
|
98
|
+
: undefined;
|
|
99
|
+
const openidProvider = await this.getOpenIdProvider(agentContext);
|
|
100
|
+
const authorizationResponseWithCorrelationId = await openidProvider.createAuthorizationResponse(authorizationRequest, {
|
|
101
|
+
jwtIssuer,
|
|
102
|
+
presentationExchange: presentationExchangeOptions,
|
|
103
|
+
// https://openid.net/specs/openid-connect-self-issued-v2-1_0.html#name-aud-of-a-request-object
|
|
104
|
+
audience: authorizationRequest.authorizationRequestPayload.client_id,
|
|
105
|
+
});
|
|
106
|
+
const getCreateJarmResponseCallback = (authorizationResponseNonce) => {
|
|
107
|
+
return async (opts) => {
|
|
108
|
+
const { authorizationResponsePayload, requestObjectPayload } = opts;
|
|
109
|
+
const jwk = await did_auth_siop_1.OP.extractEncJwksFromClientMetadata(requestObjectPayload.client_metadata);
|
|
110
|
+
if (!jwk.kty) {
|
|
111
|
+
throw new core_1.CredoError('Missing kty in jwk.');
|
|
112
|
+
}
|
|
113
|
+
const validatedMetadata = did_auth_siop_1.OP.validateJarmMetadata({
|
|
114
|
+
client_metadata: requestObjectPayload.client_metadata,
|
|
115
|
+
server_metadata: {
|
|
243
116
|
authorization_encryption_alg_values_supported: ['ECDH-ES'],
|
|
244
|
-
authorization_encryption_enc_values_supported: ['
|
|
117
|
+
authorization_encryption_enc_values_supported: ['A256GCM', 'A128CBC-HS256'],
|
|
245
118
|
},
|
|
119
|
+
});
|
|
120
|
+
if (validatedMetadata.type !== 'encrypted') {
|
|
121
|
+
throw new core_1.CredoError('Only encrypted JARM responses are supported.');
|
|
246
122
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
123
|
+
// Extract nonce from the request, we use this as the `apv`
|
|
124
|
+
const nonce = authorizationRequest.payload?.nonce;
|
|
125
|
+
if (!nonce || typeof nonce !== 'string') {
|
|
126
|
+
throw new core_1.CredoError('Missing nonce in authorization request payload');
|
|
127
|
+
}
|
|
128
|
+
const jwe = await this.encryptJarmResponse(agentContext, {
|
|
129
|
+
jwkJson: jwk,
|
|
130
|
+
payload: authorizationResponsePayload,
|
|
131
|
+
authorizationRequestNonce: nonce,
|
|
132
|
+
alg: validatedMetadata.client_metadata.authorization_encrypted_response_alg,
|
|
133
|
+
enc: validatedMetadata.client_metadata.authorization_encrypted_response_enc,
|
|
134
|
+
authorizationResponseNonce,
|
|
135
|
+
});
|
|
136
|
+
return { response: jwe };
|
|
261
137
|
};
|
|
262
|
-
}
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
response: response.responseParams,
|
|
266
|
-
jarm: response.jarm ? { responseJwt: response.jarm.responseJwt } : undefined,
|
|
267
|
-
});
|
|
268
|
-
const responseText = await result.response
|
|
138
|
+
};
|
|
139
|
+
const response = await openidProvider.submitAuthorizationResponse(authorizationResponseWithCorrelationId, getCreateJarmResponseCallback(authorizationResponseNonce));
|
|
140
|
+
const responseText = await response
|
|
269
141
|
.clone()
|
|
270
142
|
.text()
|
|
271
143
|
.catch(() => null);
|
|
272
|
-
const responseJson = (await
|
|
144
|
+
const responseJson = (await response
|
|
273
145
|
.clone()
|
|
274
146
|
.json()
|
|
275
147
|
.catch(() => null));
|
|
276
|
-
if (!
|
|
148
|
+
if (!response.ok) {
|
|
277
149
|
return {
|
|
278
150
|
ok: false,
|
|
279
151
|
serverResponse: {
|
|
280
|
-
status:
|
|
152
|
+
status: response.status,
|
|
281
153
|
body: responseJson ?? responseText,
|
|
282
154
|
},
|
|
283
|
-
|
|
284
|
-
authorizationResponsePayload,
|
|
155
|
+
submittedResponse: authorizationResponseWithCorrelationId.response.payload,
|
|
285
156
|
};
|
|
286
157
|
}
|
|
287
158
|
return {
|
|
288
159
|
ok: true,
|
|
289
160
|
serverResponse: {
|
|
290
|
-
status:
|
|
161
|
+
status: response.status,
|
|
291
162
|
body: responseJson ?? {},
|
|
292
163
|
},
|
|
293
|
-
|
|
294
|
-
authorizationResponsePayload,
|
|
164
|
+
submittedResponse: authorizationResponseWithCorrelationId.response.payload,
|
|
295
165
|
redirectUri: responseJson?.redirect_uri,
|
|
296
166
|
presentationDuringIssuanceSession: responseJson?.presentation_during_issuance_session,
|
|
297
167
|
};
|
|
298
168
|
}
|
|
169
|
+
async getOpenIdProvider(agentContext, trustedCertificates) {
|
|
170
|
+
const builder = did_auth_siop_1.OP.builder()
|
|
171
|
+
.withExpiresIn(6000)
|
|
172
|
+
.withIssuer(did_auth_siop_1.ResponseIss.SELF_ISSUED_V2)
|
|
173
|
+
.withResponseMode(did_auth_siop_1.ResponseMode.POST)
|
|
174
|
+
.withSupportedVersions([
|
|
175
|
+
did_auth_siop_1.SupportedVersion.SIOPv2_D11,
|
|
176
|
+
did_auth_siop_1.SupportedVersion.SIOPv2_D12_OID4VP_D18,
|
|
177
|
+
did_auth_siop_1.SupportedVersion.SIOPv2_D12_OID4VP_D20,
|
|
178
|
+
])
|
|
179
|
+
.withCreateJwtCallback((0, utils_1.getCreateJwtCallback)(agentContext))
|
|
180
|
+
.withVerifyJwtCallback((0, utils_1.getVerifyJwtCallback)(agentContext, trustedCertificates))
|
|
181
|
+
.withHasher(core_1.Hasher.hash);
|
|
182
|
+
const openidProvider = builder.build();
|
|
183
|
+
return openidProvider;
|
|
184
|
+
}
|
|
185
|
+
getOpenIdTokenIssuerFromVerifiablePresentation(verifiablePresentation) {
|
|
186
|
+
let openIdTokenIssuer;
|
|
187
|
+
if (verifiablePresentation instanceof core_1.W3cJsonLdVerifiablePresentation) {
|
|
188
|
+
const [firstProof] = (0, core_1.asArray)(verifiablePresentation.proof);
|
|
189
|
+
if (!firstProof)
|
|
190
|
+
throw new core_1.CredoError('Verifiable presentation does not contain a proof');
|
|
191
|
+
if (!firstProof.verificationMethod.startsWith('did:')) {
|
|
192
|
+
throw new core_1.CredoError('Verifiable presentation proof verificationMethod is not a did. Unable to extract openIdTokenIssuer from verifiable presentation');
|
|
193
|
+
}
|
|
194
|
+
openIdTokenIssuer = {
|
|
195
|
+
method: 'did',
|
|
196
|
+
didUrl: firstProof.verificationMethod,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
else if (verifiablePresentation instanceof core_1.W3cJwtVerifiablePresentation) {
|
|
200
|
+
const kid = verifiablePresentation.jwt.header.kid;
|
|
201
|
+
if (!kid)
|
|
202
|
+
throw new core_1.CredoError('Verifiable Presentation does not contain a kid in the jwt header');
|
|
203
|
+
if (kid.startsWith('#') && verifiablePresentation.presentation.holderId) {
|
|
204
|
+
openIdTokenIssuer = {
|
|
205
|
+
didUrl: `${verifiablePresentation.presentation.holderId}${kid}`,
|
|
206
|
+
method: 'did',
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
else if (kid.startsWith('did:')) {
|
|
210
|
+
openIdTokenIssuer = {
|
|
211
|
+
didUrl: kid,
|
|
212
|
+
method: 'did',
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
throw new core_1.CredoError("JWT W3C Verifiable presentation does not include did in JWT header 'kid'. Unable to extract openIdTokenIssuer from verifiable presentation");
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
else if (verifiablePresentation instanceof core_1.MdocDeviceResponse) {
|
|
220
|
+
throw new core_1.CredoError('Mdoc Verifiable Presentations are not yet supported');
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
const cnf = verifiablePresentation.payload.cnf;
|
|
224
|
+
// FIXME: SD-JWT VC should have better payload typing, so this doesn't become so ugly
|
|
225
|
+
if (!cnf ||
|
|
226
|
+
typeof cnf !== 'object' ||
|
|
227
|
+
!('kid' in cnf) ||
|
|
228
|
+
typeof cnf.kid !== 'string' ||
|
|
229
|
+
!cnf.kid.startsWith('did:') ||
|
|
230
|
+
!cnf.kid.includes('#')) {
|
|
231
|
+
throw new core_1.CredoError("SD-JWT Verifiable presentation has no 'cnf' claim or does not include 'cnf' claim where 'kid' is a didUrl pointing to a key. Unable to extract openIdTokenIssuer from verifiable presentation");
|
|
232
|
+
}
|
|
233
|
+
openIdTokenIssuer = {
|
|
234
|
+
didUrl: cnf.kid,
|
|
235
|
+
method: 'did',
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
return openIdTokenIssuer;
|
|
239
|
+
}
|
|
240
|
+
assertValidTokenIssuer(authorizationRequest, openIdTokenIssuer) {
|
|
241
|
+
const subjectSyntaxTypesSupported = authorizationRequest.registrationMetadataPayload.subject_syntax_types_supported;
|
|
242
|
+
if (!subjectSyntaxTypesSupported) {
|
|
243
|
+
throw new core_1.CredoError('subject_syntax_types_supported is not supplied in the registration metadata. subject_syntax_types is REQUIRED.');
|
|
244
|
+
}
|
|
245
|
+
let allowedSubjectSyntaxTypes = [];
|
|
246
|
+
if (openIdTokenIssuer.method === 'did') {
|
|
247
|
+
const parsedDid = (0, core_1.parseDid)(openIdTokenIssuer.didUrl);
|
|
248
|
+
// Either did:<method> or did (for all did methods) is allowed
|
|
249
|
+
allowedSubjectSyntaxTypes = [`did:${parsedDid.method}`, 'did'];
|
|
250
|
+
}
|
|
251
|
+
else if (openIdTokenIssuer.method === 'jwk') {
|
|
252
|
+
allowedSubjectSyntaxTypes = ['urn:ietf:params:oauth:jwk-thumbprint'];
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
throw new core_1.CredoError("Only 'did' and 'jwk' are supported as openIdTokenIssuer at the moment");
|
|
256
|
+
}
|
|
257
|
+
// At least one of the allowed subject syntax types must be supported by the RP
|
|
258
|
+
if (!allowedSubjectSyntaxTypes.some((allowed) => subjectSyntaxTypesSupported.includes(allowed))) {
|
|
259
|
+
throw new core_1.CredoError([
|
|
260
|
+
'The provided openIdTokenIssuer is not supported by the relying party.',
|
|
261
|
+
`Supported subject syntax types: '${subjectSyntaxTypesSupported.join(', ')}'`,
|
|
262
|
+
].join('\n'));
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
async encryptJarmResponse(agentContext, options) {
|
|
266
|
+
const { payload, jwkJson } = options;
|
|
267
|
+
const jwk = (0, core_1.getJwkFromJson)(jwkJson);
|
|
268
|
+
const key = jwk.key;
|
|
269
|
+
if (!agentContext.wallet.directEncryptCompactJweEcdhEs) {
|
|
270
|
+
throw new core_1.CredoError('Cannot decrypt Jarm Response, wallet does not support directEncryptCompactJweEcdhEs. You need to upgrade your wallet implementation.');
|
|
271
|
+
}
|
|
272
|
+
if (options.alg !== 'ECDH-ES') {
|
|
273
|
+
throw new core_1.CredoError("Only 'ECDH-ES' is supported as 'alg' value for JARM response encryption");
|
|
274
|
+
}
|
|
275
|
+
if (options.enc !== 'A256GCM' && options.enc !== 'A128CBC-HS256') {
|
|
276
|
+
throw new core_1.CredoError("Only 'A256GCM' and 'A128CBC-HS256' are supported as 'enc' value for JARM response encryption");
|
|
277
|
+
}
|
|
278
|
+
if (key.keyType !== core_1.KeyType.P256) {
|
|
279
|
+
throw new core_1.CredoError(`Only '${core_1.KeyType.P256}' key type is supported for JARM response encryption`);
|
|
280
|
+
}
|
|
281
|
+
const data = core_1.Buffer.from(JSON.stringify(payload));
|
|
282
|
+
const jwe = await agentContext.wallet.directEncryptCompactJweEcdhEs({
|
|
283
|
+
data,
|
|
284
|
+
recipientKey: key,
|
|
285
|
+
header: {
|
|
286
|
+
kid: jwkJson.kid,
|
|
287
|
+
},
|
|
288
|
+
encryptionAlgorithm: options.enc,
|
|
289
|
+
apu: core_1.TypedArrayEncoder.toBase64URL(core_1.TypedArrayEncoder.fromString(options.authorizationResponseNonce)),
|
|
290
|
+
apv: core_1.TypedArrayEncoder.toBase64URL(core_1.TypedArrayEncoder.fromString(options.authorizationRequestNonce)),
|
|
291
|
+
});
|
|
292
|
+
return jwe;
|
|
293
|
+
}
|
|
299
294
|
};
|
|
300
295
|
exports.OpenId4VcSiopHolderService = OpenId4VcSiopHolderService;
|
|
301
296
|
exports.OpenId4VcSiopHolderService = OpenId4VcSiopHolderService = __decorate([
|
|
302
297
|
(0, core_1.injectable)(),
|
|
303
|
-
__metadata("design:paramtypes", [core_1.DifPresentationExchangeService
|
|
304
|
-
core_1.DcqlService])
|
|
298
|
+
__metadata("design:paramtypes", [core_1.DifPresentationExchangeService])
|
|
305
299
|
], OpenId4VcSiopHolderService);
|
|
306
300
|
//# sourceMappingURL=OpenId4vcSiopHolderService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenId4vcSiopHolderService.js","sourceRoot":"","sources":["../../src/openid4vc-holder/OpenId4vcSiopHolderService.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"OpenId4vcSiopHolderService.js","sourceRoot":"","sources":["../../src/openid4vc-holder/OpenId4vcSiopHolderService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAaA,yCAeuB;AACvB,2DAAwH;AAExH,mDAAuE;AACvE,2CAA0G;AAGnG,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IACrC,YAA2B,2BAA2D;QAA3D,gCAA2B,GAA3B,2BAA2B,CAAgC;IAAG,CAAC;IAEnF,KAAK,CAAC,2BAA2B,CACtC,YAA0B,EAC1B,eAAuB,EACvB,mBAA8C;QAE9C,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAA;QAEtF,8DAA8D;QAC9D,MAAM,4BAA4B,GAAG,MAAM,cAAc,CAAC,0BAA0B,CAAC,eAAe,CAAC,CAAA;QAErG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAC9B,mDAAmD,4BAA4B,CAAC,MAAM,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