@credo-ts/core 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/agent/AgentModules.d.ts +2 -0
- package/build/agent/AgentModules.js +2 -0
- package/build/agent/AgentModules.js.map +1 -1
- package/build/crypto/JwsService.js +1 -1
- package/build/crypto/JwsService.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/modules/dcql/DcqlError.d.ts +8 -0
- package/build/modules/dcql/DcqlError.js +12 -0
- package/build/modules/dcql/DcqlError.js.map +1 -0
- package/build/modules/dcql/DcqlModule.d.ts +10 -0
- package/build/modules/dcql/DcqlModule.js +23 -0
- package/build/modules/dcql/DcqlModule.js.map +1 -0
- package/build/modules/dcql/DcqlService.d.ts +336 -0
- package/build/modules/dcql/DcqlService.js +327 -0
- package/build/modules/dcql/DcqlService.js.map +1 -0
- package/build/modules/dcql/index.d.ts +5 -0
- package/build/modules/dcql/index.js +22 -0
- package/build/modules/dcql/index.js.map +1 -0
- package/build/modules/dcql/models/DcqlCredentialsForRequest.d.ts +25 -0
- package/build/modules/dcql/models/DcqlCredentialsForRequest.js +3 -0
- package/build/modules/dcql/models/DcqlCredentialsForRequest.js.map +1 -0
- package/build/modules/dcql/models/index.d.ts +32 -0
- package/build/modules/dcql/models/index.js +18 -0
- package/build/modules/dcql/models/index.js.map +1 -0
- package/build/modules/dcql/utils/DcqlPresentationsToCreate.d.ts +36 -0
- package/build/modules/dcql/utils/DcqlPresentationsToCreate.js +36 -0
- package/build/modules/dcql/utils/DcqlPresentationsToCreate.js.map +1 -0
- package/build/modules/dcql/utils/index.d.ts +1 -0
- package/build/modules/dcql/utils/index.js +18 -0
- package/build/modules/dcql/utils/index.js.map +1 -0
- package/build/modules/dif-presentation-exchange/DifPresentationExchangeService.d.ts +6 -4
- package/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js +10 -5
- package/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js.map +1 -1
- package/build/modules/dif-presentation-exchange/models/DifPexCredentialsForRequest.d.ts +11 -5
- package/build/modules/dif-presentation-exchange/models/index.d.ts +1 -1
- package/build/modules/dif-presentation-exchange/models/index.js.map +1 -1
- package/build/modules/dif-presentation-exchange/utils/credentialSelection.js +5 -5
- package/build/modules/dif-presentation-exchange/utils/credentialSelection.js.map +1 -1
- package/build/modules/dif-presentation-exchange/utils/presentationSelection.d.ts +4 -4
- package/build/modules/dif-presentation-exchange/utils/presentationSelection.js +3 -3
- package/build/modules/dif-presentation-exchange/utils/presentationSelection.js.map +1 -1
- package/build/modules/dif-presentation-exchange/utils/presentationsToCreate.d.ts +6 -1
- package/build/modules/dif-presentation-exchange/utils/presentationsToCreate.js +31 -20
- package/build/modules/dif-presentation-exchange/utils/presentationsToCreate.js.map +1 -1
- package/build/modules/dif-presentation-exchange/utils/transform.d.ts +5 -3
- package/build/modules/dif-presentation-exchange/utils/transform.js +2 -15
- package/build/modules/dif-presentation-exchange/utils/transform.js.map +1 -1
- package/build/modules/mdoc/Mdoc.d.ts +15 -1
- package/build/modules/mdoc/Mdoc.js +23 -1
- package/build/modules/mdoc/Mdoc.js.map +1 -1
- package/build/modules/mdoc/MdocDeviceResponse.d.ts +13 -2
- package/build/modules/mdoc/MdocDeviceResponse.js +60 -11
- package/build/modules/mdoc/MdocDeviceResponse.js.map +1 -1
- package/build/modules/mdoc/MdocOptions.d.ts +26 -9
- package/build/modules/mdoc/MdocOptions.js +3 -0
- package/build/modules/mdoc/MdocOptions.js.map +1 -1
- package/build/modules/mdoc/MdocService.d.ts +3 -2
- package/build/modules/mdoc/MdocService.js +2 -2
- package/build/modules/mdoc/MdocService.js.map +1 -1
- package/build/modules/mdoc/mdocUtil.d.ts +2 -0
- package/build/modules/mdoc/mdocUtil.js +11 -0
- package/build/modules/mdoc/mdocUtil.js.map +1 -0
- package/build/modules/mdoc/repository/MdocRecord.d.ts +8 -0
- package/build/modules/mdoc/repository/MdocRecord.js +12 -0
- package/build/modules/mdoc/repository/MdocRecord.js.map +1 -1
- package/build/modules/sd-jwt-vc/SdJwtVcApi.d.ts +2 -0
- package/build/modules/sd-jwt-vc/SdJwtVcOptions.d.ts +4 -0
- package/build/modules/sd-jwt-vc/SdJwtVcService.d.ts +18 -1
- package/build/modules/sd-jwt-vc/SdJwtVcService.js +36 -1
- package/build/modules/sd-jwt-vc/SdJwtVcService.js.map +1 -1
- package/build/modules/sd-jwt-vc/decodeSdJwtVc.d.ts +2 -7
- package/build/modules/sd-jwt-vc/decodeSdJwtVc.js +11 -2
- package/build/modules/sd-jwt-vc/decodeSdJwtVc.js.map +1 -1
- package/build/modules/sd-jwt-vc/disclosureFrame.d.ts +6 -0
- package/build/modules/sd-jwt-vc/disclosureFrame.js +19 -0
- package/build/modules/sd-jwt-vc/disclosureFrame.js.map +1 -0
- package/build/modules/sd-jwt-vc/repository/SdJwtVcRecord.d.ts +8 -0
- package/build/modules/sd-jwt-vc/repository/SdJwtVcRecord.js +12 -0
- package/build/modules/sd-jwt-vc/repository/SdJwtVcRecord.js.map +1 -1
- package/build/modules/vc/jwt-vc/W3cJwtVerifiablePresentation.d.ts +1 -1
- package/build/modules/vc/repository/W3cCredentialRecord.d.ts +4 -0
- package/build/modules/vc/repository/W3cCredentialRecord.js +6 -0
- package/build/modules/vc/repository/W3cCredentialRecord.js.map +1 -1
- package/build/utils/domain.js +1 -1
- package/build/utils/domain.js.map +1 -1
- package/build/wallet/Wallet.d.ts +1 -1
- package/package.json +7 -5
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.DcqlService = void 0;
|
|
10
|
+
const dcql_1 = require("dcql");
|
|
11
|
+
const tsyringe_1 = require("tsyringe");
|
|
12
|
+
const utils_1 = require("../../utils");
|
|
13
|
+
const mdoc_1 = require("../mdoc");
|
|
14
|
+
const sd_jwt_vc_1 = require("../sd-jwt-vc");
|
|
15
|
+
const disclosureFrame_1 = require("../sd-jwt-vc/disclosureFrame");
|
|
16
|
+
const vc_1 = require("../vc");
|
|
17
|
+
const DcqlError_1 = require("./DcqlError");
|
|
18
|
+
const utils_2 = require("./utils");
|
|
19
|
+
let DcqlService = class DcqlService {
|
|
20
|
+
/**
|
|
21
|
+
* Queries the wallet for credentials that match the given dcql query. This only does an initial query based on the
|
|
22
|
+
* schema of the input descriptors. It does not do any further filtering based on the constraints in the input descriptors.
|
|
23
|
+
*/
|
|
24
|
+
async queryCredentialsForDcqlQuery(agentContext, dcqlQuery) {
|
|
25
|
+
const w3cCredentialRepository = agentContext.dependencyManager.resolve(vc_1.W3cCredentialRepository);
|
|
26
|
+
const formats = new Set(dcqlQuery.credentials.map((c) => c.format));
|
|
27
|
+
const allRecords = [];
|
|
28
|
+
const w3cCredentialRecords = formats.has('jwt_vc_json') || formats.has('jwt_vc_json-ld')
|
|
29
|
+
? await w3cCredentialRepository.getAll(agentContext)
|
|
30
|
+
: [];
|
|
31
|
+
allRecords.push(...w3cCredentialRecords);
|
|
32
|
+
const mdocDoctypes = dcqlQuery.credentials
|
|
33
|
+
.filter((credentialQuery) => credentialQuery.format === 'mso_mdoc')
|
|
34
|
+
.map((c) => c.meta?.doctype_value);
|
|
35
|
+
const mdocApi = this.getMdocApi(agentContext);
|
|
36
|
+
if (mdocDoctypes.every((doctype) => doctype !== undefined)) {
|
|
37
|
+
const mdocRecords = await mdocApi.findAllByQuery({
|
|
38
|
+
$or: mdocDoctypes.map((docType) => ({
|
|
39
|
+
docType: docType,
|
|
40
|
+
})),
|
|
41
|
+
});
|
|
42
|
+
allRecords.push(...mdocRecords);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
const mdocRecords = await mdocApi.getAll();
|
|
46
|
+
allRecords.push(...mdocRecords);
|
|
47
|
+
}
|
|
48
|
+
const sdJwtVctValues = dcqlQuery.credentials
|
|
49
|
+
.filter((credentialQuery) => credentialQuery.format === 'vc+sd-jwt' || credentialQuery.format === 'dc+sd-jwt')
|
|
50
|
+
.flatMap((c) => c.meta?.vct_values);
|
|
51
|
+
const sdJwtVcApi = this.getSdJwtVcApi(agentContext);
|
|
52
|
+
if (sdJwtVctValues.every((vct) => vct !== undefined)) {
|
|
53
|
+
const sdjwtVcRecords = await sdJwtVcApi.findAllByQuery({
|
|
54
|
+
$or: sdJwtVctValues.map((vct) => ({
|
|
55
|
+
vct: vct,
|
|
56
|
+
})),
|
|
57
|
+
});
|
|
58
|
+
allRecords.push(...sdjwtVcRecords);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
const sdJwtVcRecords = await sdJwtVcApi.getAll();
|
|
62
|
+
allRecords.push(...sdJwtVcRecords);
|
|
63
|
+
}
|
|
64
|
+
return allRecords;
|
|
65
|
+
}
|
|
66
|
+
getDcqlCredentialRepresentation(presentation, queryCredential) {
|
|
67
|
+
// SD-JWT credential can be used as both dc+sd-jwt and vc+sd-jwt
|
|
68
|
+
// At some point we might want to look at the header value of the sd-jwt (vc+sd-jwt vc dc+sd-jwt)
|
|
69
|
+
if (presentation.claimFormat === vc_1.ClaimFormat.SdJwtVc) {
|
|
70
|
+
return {
|
|
71
|
+
credential_format: queryCredential.format === 'dc+sd-jwt' ? 'dc+sd-jwt' : 'vc+sd-jwt',
|
|
72
|
+
vct: presentation.prettyClaims.vct,
|
|
73
|
+
claims: presentation.prettyClaims,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (presentation.claimFormat === vc_1.ClaimFormat.MsoMdoc) {
|
|
77
|
+
if (presentation.documents.length !== 1) {
|
|
78
|
+
throw new DcqlError_1.DcqlError('MDOC presentations must contain exactly one document');
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
credential_format: 'mso_mdoc',
|
|
82
|
+
doctype: presentation.documents[0].docType,
|
|
83
|
+
namespaces: presentation.documents[0].issuerSignedNamespaces,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
throw new DcqlError_1.DcqlError('W3C credentials are not supported yet');
|
|
87
|
+
}
|
|
88
|
+
async getCredentialsForRequest(agentContext, dcqlQuery) {
|
|
89
|
+
const credentialRecords = await this.queryCredentialsForDcqlQuery(agentContext, dcqlQuery);
|
|
90
|
+
const credentialRecordsWithFormatDuplicates = [];
|
|
91
|
+
const dcqlCredentials = credentialRecords.flatMap((record) => {
|
|
92
|
+
if (record.type === 'MdocRecord') {
|
|
93
|
+
credentialRecordsWithFormatDuplicates.push(record);
|
|
94
|
+
const mdoc = mdoc_1.Mdoc.fromBase64Url(record.base64Url);
|
|
95
|
+
return {
|
|
96
|
+
credential_format: 'mso_mdoc',
|
|
97
|
+
doctype: record.getTags().docType,
|
|
98
|
+
namespaces: mdoc.issuerSignedNamespaces,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if (record.type === 'SdJwtVcRecord') {
|
|
102
|
+
const claims = this.getSdJwtVcApi(agentContext).fromCompact(record.compactSdJwtVc)
|
|
103
|
+
.prettyClaims;
|
|
104
|
+
// To keep correct mapping of input credential index, we add it twice here (for dc+sd-jwt and vc+sd-jwt)
|
|
105
|
+
credentialRecordsWithFormatDuplicates.push(record, record);
|
|
106
|
+
return [
|
|
107
|
+
{
|
|
108
|
+
credential_format: 'dc+sd-jwt',
|
|
109
|
+
vct: record.getTags().vct,
|
|
110
|
+
claims,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
credential_format: 'vc+sd-jwt',
|
|
114
|
+
vct: record.getTags().vct,
|
|
115
|
+
claims,
|
|
116
|
+
},
|
|
117
|
+
];
|
|
118
|
+
}
|
|
119
|
+
// TODO:
|
|
120
|
+
throw new DcqlError_1.DcqlError('W3C credentials are not supported yet');
|
|
121
|
+
});
|
|
122
|
+
const queryResult = dcql_1.DcqlQuery.query(dcql_1.DcqlQuery.parse(dcqlQuery), dcqlCredentials);
|
|
123
|
+
const matchesWithRecord = Object.fromEntries(Object.entries(queryResult.credential_matches).map(([credential_query_id, result]) => {
|
|
124
|
+
const all = result.all.map((entry) => entry.map((inner) => {
|
|
125
|
+
if (!inner || !inner.success)
|
|
126
|
+
return inner;
|
|
127
|
+
const record = credentialRecordsWithFormatDuplicates[inner.input_credential_index];
|
|
128
|
+
return {
|
|
129
|
+
...inner,
|
|
130
|
+
output: record.type === 'SdJwtVcRecord' &&
|
|
131
|
+
(inner.output.credential_format === 'dc+sd-jwt' || inner.output.credential_format === 'vc+sd-jwt')
|
|
132
|
+
? {
|
|
133
|
+
...inner.output,
|
|
134
|
+
claims: agentContext.dependencyManager
|
|
135
|
+
.resolve(sd_jwt_vc_1.SdJwtVcService)
|
|
136
|
+
.applyDisclosuresForPayload(record.compactSdJwtVc, inner.output.claims).prettyClaims,
|
|
137
|
+
}
|
|
138
|
+
: inner.output,
|
|
139
|
+
record: credentialRecordsWithFormatDuplicates[inner.input_credential_index],
|
|
140
|
+
};
|
|
141
|
+
}));
|
|
142
|
+
if (result.success) {
|
|
143
|
+
if (result.output.credential_format === 'vc+sd-jwt' || result.output.credential_format === 'dc+sd-jwt') {
|
|
144
|
+
const sdJwtVcRecord = credentialRecordsWithFormatDuplicates[result.input_credential_index];
|
|
145
|
+
const claims = agentContext.dependencyManager
|
|
146
|
+
.resolve(sd_jwt_vc_1.SdJwtVcService)
|
|
147
|
+
.applyDisclosuresForPayload(sdJwtVcRecord.compactSdJwtVc, result.output.claims).prettyClaims;
|
|
148
|
+
return [
|
|
149
|
+
credential_query_id,
|
|
150
|
+
{
|
|
151
|
+
...result,
|
|
152
|
+
all,
|
|
153
|
+
output: { ...result.output, claims },
|
|
154
|
+
record: credentialRecordsWithFormatDuplicates[result.input_credential_index],
|
|
155
|
+
},
|
|
156
|
+
];
|
|
157
|
+
}
|
|
158
|
+
return [
|
|
159
|
+
credential_query_id,
|
|
160
|
+
{ ...result, record: credentialRecordsWithFormatDuplicates[result.input_credential_index], all },
|
|
161
|
+
];
|
|
162
|
+
}
|
|
163
|
+
return [credential_query_id, { ...result, all }];
|
|
164
|
+
}));
|
|
165
|
+
return {
|
|
166
|
+
...queryResult,
|
|
167
|
+
credential_matches: matchesWithRecord,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
assertValidDcqlPresentation(dcqlPresentation, dcqlQuery) {
|
|
171
|
+
const internalDcqlPresentation = Object.fromEntries(Object.entries(dcqlPresentation).map(([credentialId, value]) => {
|
|
172
|
+
const queryCredential = dcqlQuery.credentials.find((c) => c.id === credentialId);
|
|
173
|
+
if (!queryCredential) {
|
|
174
|
+
throw new DcqlError_1.DcqlError(`DCQL presentation contains presentation entry for credential id '${credentialId}', but this id is not present in the DCQL query`);
|
|
175
|
+
}
|
|
176
|
+
return [credentialId, this.getDcqlCredentialRepresentation(value, queryCredential)];
|
|
177
|
+
}));
|
|
178
|
+
const presentationResult = dcql_1.DcqlPresentationResult.fromDcqlPresentation(internalDcqlPresentation, { dcqlQuery });
|
|
179
|
+
// TODO: better error handling
|
|
180
|
+
if (!presentationResult.canBeSatisfied) {
|
|
181
|
+
throw new DcqlError_1.DcqlError('Invalid presentations. Presentations do not satisfy the credential query.');
|
|
182
|
+
}
|
|
183
|
+
return presentationResult;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Selects the credentials to use based on the output from `getCredentialsForRequest`
|
|
187
|
+
* Use this method if you don't want to manually select the credentials yourself.
|
|
188
|
+
*/
|
|
189
|
+
selectCredentialsForRequest(dcqlQueryResult) {
|
|
190
|
+
if (!dcqlQueryResult.canBeSatisfied) {
|
|
191
|
+
throw new DcqlError_1.DcqlError('Cannot select the credentials for the dcql query presentation if the request cannot be satisfied');
|
|
192
|
+
}
|
|
193
|
+
const credentials = {};
|
|
194
|
+
if (dcqlQueryResult.credential_sets) {
|
|
195
|
+
for (const credentialSet of dcqlQueryResult.credential_sets) {
|
|
196
|
+
// undefined defaults to true
|
|
197
|
+
if (credentialSet.required === false)
|
|
198
|
+
continue;
|
|
199
|
+
const firstFullFillableOption = credentialSet.options.find((option) => option.every((credential_id) => dcqlQueryResult.credential_matches[credential_id].success));
|
|
200
|
+
if (!firstFullFillableOption) {
|
|
201
|
+
throw new DcqlError_1.DcqlError('Invalid dcql query result. No option is fullfillable');
|
|
202
|
+
}
|
|
203
|
+
for (const credentialQueryId of firstFullFillableOption) {
|
|
204
|
+
const credential = dcqlQueryResult.credential_matches[credentialQueryId];
|
|
205
|
+
if (credential.success && credential.record.type === 'MdocRecord' && 'namespaces' in credential.output) {
|
|
206
|
+
credentials[credentialQueryId] = {
|
|
207
|
+
claimFormat: vc_1.ClaimFormat.MsoMdoc,
|
|
208
|
+
credentialRecord: credential.record,
|
|
209
|
+
disclosedPayload: credential.output.namespaces,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
else if (credential.success &&
|
|
213
|
+
credential.record.type === 'SdJwtVcRecord' &&
|
|
214
|
+
'claims' in credential.output) {
|
|
215
|
+
credentials[credentialQueryId] = {
|
|
216
|
+
claimFormat: vc_1.ClaimFormat.SdJwtVc,
|
|
217
|
+
credentialRecord: credential.record,
|
|
218
|
+
disclosedPayload: credential.output.claims,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
throw new DcqlError_1.DcqlError('Invalid dcql query result. Cannot auto-select credentials');
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
for (const credentialQuery of dcqlQueryResult.credentials) {
|
|
229
|
+
const credential = dcqlQueryResult.credential_matches[credentialQuery.id];
|
|
230
|
+
if (credential.success && credential.record.type === 'MdocRecord' && 'namespaces' in credential.output) {
|
|
231
|
+
credentials[credentialQuery.id] = {
|
|
232
|
+
claimFormat: vc_1.ClaimFormat.MsoMdoc,
|
|
233
|
+
credentialRecord: credential.record,
|
|
234
|
+
disclosedPayload: credential.output.namespaces,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
else if (credential.success && credential.record.type === 'SdJwtVcRecord' && 'claims' in credential.output) {
|
|
238
|
+
credentials[credentialQuery.id] = {
|
|
239
|
+
claimFormat: vc_1.ClaimFormat.SdJwtVc,
|
|
240
|
+
credentialRecord: credential.record,
|
|
241
|
+
disclosedPayload: credential.output.claims,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
throw new DcqlError_1.DcqlError('Invalid dcql query result. Cannot auto-select credentials');
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return credentials;
|
|
250
|
+
}
|
|
251
|
+
validateDcqlQuery(dcqlQuery) {
|
|
252
|
+
return dcql_1.DcqlQuery.parse(dcqlQuery);
|
|
253
|
+
}
|
|
254
|
+
async createPresentation(agentContext, options) {
|
|
255
|
+
const { domain, challenge, openid4vp } = options;
|
|
256
|
+
const dcqlPresentation = {};
|
|
257
|
+
const encodedDcqlPresentation = {};
|
|
258
|
+
const vcPresentationsToCreate = (0, utils_2.dcqlGetPresentationsToCreate)(options.credentialQueryToCredential);
|
|
259
|
+
for (const [credentialQueryId, presentationToCreate] of Object.entries(vcPresentationsToCreate)) {
|
|
260
|
+
if (presentationToCreate.claimFormat === vc_1.ClaimFormat.MsoMdoc) {
|
|
261
|
+
const mdocRecord = presentationToCreate.credentialRecord;
|
|
262
|
+
if (!openid4vp) {
|
|
263
|
+
throw new DcqlError_1.DcqlError('Missing openid4vp options for creating MDOC presentation.');
|
|
264
|
+
}
|
|
265
|
+
const deviceResponse = await mdoc_1.MdocDeviceResponse.createDeviceResponse(agentContext, {
|
|
266
|
+
mdocs: [mdoc_1.Mdoc.fromBase64Url(mdocRecord.base64Url)],
|
|
267
|
+
documentRequests: [
|
|
268
|
+
{
|
|
269
|
+
docType: mdocRecord.getTags().docType,
|
|
270
|
+
nameSpaces: Object.fromEntries(Object.entries(presentationToCreate.disclosedPayload).map(([key, value]) => {
|
|
271
|
+
// FIXME: we need the DCQL query here to get the intent_to_retain from query (currnetly hardcoded to false)
|
|
272
|
+
return [key, Object.fromEntries(Object.entries(value).map(([key]) => [key, false]))];
|
|
273
|
+
})),
|
|
274
|
+
},
|
|
275
|
+
],
|
|
276
|
+
sessionTranscriptOptions: {
|
|
277
|
+
...openid4vp,
|
|
278
|
+
verifierGeneratedNonce: challenge,
|
|
279
|
+
},
|
|
280
|
+
});
|
|
281
|
+
const deviceResponseBase64Url = utils_1.TypedArrayEncoder.toBase64URL(deviceResponse);
|
|
282
|
+
encodedDcqlPresentation[credentialQueryId] = deviceResponseBase64Url;
|
|
283
|
+
dcqlPresentation[credentialQueryId] = mdoc_1.MdocDeviceResponse.fromBase64Url(deviceResponseBase64Url);
|
|
284
|
+
}
|
|
285
|
+
else if (presentationToCreate.claimFormat === vc_1.ClaimFormat.SdJwtVc) {
|
|
286
|
+
const presentationFrame = (0, disclosureFrame_1.buildDisclosureFrameForPayload)(presentationToCreate.disclosedPayload);
|
|
287
|
+
if (!domain) {
|
|
288
|
+
throw new DcqlError_1.DcqlError('Missing domain property for creating SdJwtVc presentation.');
|
|
289
|
+
}
|
|
290
|
+
const sdJwtVcApi = this.getSdJwtVcApi(agentContext);
|
|
291
|
+
const presentation = await sdJwtVcApi.present({
|
|
292
|
+
compactSdJwtVc: presentationToCreate.credentialRecord.compactSdJwtVc,
|
|
293
|
+
presentationFrame,
|
|
294
|
+
verifierMetadata: {
|
|
295
|
+
audience: domain,
|
|
296
|
+
nonce: challenge,
|
|
297
|
+
issuedAt: Math.floor(Date.now() / 1000),
|
|
298
|
+
},
|
|
299
|
+
additionalPayload: presentationToCreate.additionalPayload,
|
|
300
|
+
});
|
|
301
|
+
encodedDcqlPresentation[credentialQueryId] = presentation;
|
|
302
|
+
dcqlPresentation[credentialQueryId] = sdJwtVcApi.fromCompact(presentation);
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
throw new DcqlError_1.DcqlError('W3c Presentation are not yet supported in combination with DCQL.');
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return {
|
|
309
|
+
dcqlPresentation: dcqlPresentation,
|
|
310
|
+
encodedDcqlPresentation: encodedDcqlPresentation,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
getEncodedPresentations(dcqlPresentation) {
|
|
314
|
+
return Object.fromEntries(Object.entries(dcqlPresentation).map(([key, value]) => [key, value.encoded]));
|
|
315
|
+
}
|
|
316
|
+
getSdJwtVcApi(agentContext) {
|
|
317
|
+
return agentContext.dependencyManager.resolve(sd_jwt_vc_1.SdJwtVcApi);
|
|
318
|
+
}
|
|
319
|
+
getMdocApi(agentContext) {
|
|
320
|
+
return agentContext.dependencyManager.resolve(mdoc_1.MdocApi);
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
exports.DcqlService = DcqlService;
|
|
324
|
+
exports.DcqlService = DcqlService = __decorate([
|
|
325
|
+
(0, tsyringe_1.injectable)()
|
|
326
|
+
], DcqlService);
|
|
327
|
+
//# sourceMappingURL=DcqlService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DcqlService.js","sourceRoot":"","sources":["../../../src/modules/dcql/DcqlService.ts"],"names":[],"mappings":";;;;;;;;;AAGA,+BAAmH;AACnH,uCAAqC;AAErC,uCAA+C;AAC/C,kCAOgB;AAChB,4CAAwE;AACxE,kEAA6E;AAC7E,8BAAiF;AAEjF,2CAAuC;AAEvC,mCAAwF;AAGjF,IAA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AAM,CAAC;gBACN,MAAM,IAAI,qBAAS,CAAC,kEAAkE,CAAC,CAAA;YACzF,CAAC;QACH,CAAC;QAED,OAAO;YACL,gBAAgB,EAAE,gBAAgB;YAClC,uBAAuB,EAAE,uBAAuB;SACjD,CAAA;IACH,CAAC;IAEM,uBAAuB,CAAC,gBAAkC;QAC/D,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IACzG,CAAC;IAEO,aAAa,CAAC,YAA0B;QAC9C,OAAO,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,sBAAU,CAAC,CAAA;IAC3D,CAAC;IAEO,UAAU,CAAC,YAA0B;QAC3C,OAAO,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,cAAO,CAAC,CAAA;IACxD,CAAC;CACF,CAAA;AA5XY,kCAAW;sBAAX,WAAW;IADvB,IAAA,qBAAU,GAAE;GACA,WAAW,CA4XvB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DcqlError"), exports);
|
|
18
|
+
__exportStar(require("./DcqlModule"), exports);
|
|
19
|
+
__exportStar(require("./DcqlService"), exports);
|
|
20
|
+
__exportStar(require("./utils"), exports);
|
|
21
|
+
__exportStar(require("./models"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/dcql/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,+CAA4B;AAC5B,gDAA6B;AAC7B,0CAAuB;AACvB,2CAAwB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { JsonObject } from '../../../types';
|
|
2
|
+
import type { MdocNameSpaces, MdocRecord } from '../../mdoc';
|
|
3
|
+
import type { SdJwtVcRecord } from '../../sd-jwt-vc';
|
|
4
|
+
import type { ClaimFormat, W3cCredentialRecord } from '../../vc';
|
|
5
|
+
/**
|
|
6
|
+
* Mapping of credential query IDs to the selected credential record and the disclosed payload.
|
|
7
|
+
*/
|
|
8
|
+
export type DcqlCredentialsForRequest = Record<string, {
|
|
9
|
+
claimFormat: ClaimFormat.MsoMdoc;
|
|
10
|
+
credentialRecord: MdocRecord;
|
|
11
|
+
disclosedPayload: MdocNameSpaces;
|
|
12
|
+
} | {
|
|
13
|
+
claimFormat: ClaimFormat.SdJwtVc;
|
|
14
|
+
credentialRecord: SdJwtVcRecord;
|
|
15
|
+
disclosedPayload: JsonObject;
|
|
16
|
+
/**
|
|
17
|
+
* Additional payload that will be added to the Key Binding JWT. This can overwrite
|
|
18
|
+
* existing parameters for KB-JWT so ensure you are only using this for non-default properties.
|
|
19
|
+
*/
|
|
20
|
+
additionalPayload?: JsonObject;
|
|
21
|
+
} | {
|
|
22
|
+
claimFormat: ClaimFormat.JwtVc | ClaimFormat.LdpVc;
|
|
23
|
+
credentialRecord: W3cCredentialRecord;
|
|
24
|
+
disclosedPayload: JsonObject;
|
|
25
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DcqlCredentialsForRequest.js","sourceRoot":"","sources":["../../../../src/modules/dcql/models/DcqlCredentialsForRequest.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export * from './DcqlCredentialsForRequest';
|
|
2
|
+
import type { DcqlCredential as _DcqlCredential, DcqlMdocCredential as _DcqlMdocCredential, DcqlPresentation as _DcqlPresentation, DcqlPresentationResult as _DcqlPresentationResult, DcqlQuery as _DcqlQuery, DcqlQueryResult as _DcqlQueryResult, DcqlSdJwtVcCredential as _DcqlSdJwtVcCredential, DcqlW3cVcCredential as _DcqlW3cVcCredential } from 'dcql';
|
|
3
|
+
import type { VerifiablePresentation } from '../../dif-presentation-exchange';
|
|
4
|
+
import type { MdocRecord } from '../../mdoc';
|
|
5
|
+
import type { SdJwtVcRecord } from '../../sd-jwt-vc';
|
|
6
|
+
import type { W3cCredentialRecord } from '../../vc';
|
|
7
|
+
export type DcqlQuery = _DcqlQuery.Input | _DcqlQuery.Output;
|
|
8
|
+
export type DcqlCredential = _DcqlCredential.Model['Input'];
|
|
9
|
+
export type DcqlMdocCredential = _DcqlMdocCredential.Model['Input'];
|
|
10
|
+
export type DcqlSdJwtVcCredential = _DcqlSdJwtVcCredential.Model['Input'];
|
|
11
|
+
export type DcqlW3cVcCredential = _DcqlW3cVcCredential.Model['Input'];
|
|
12
|
+
type DcqlEntrySuccess = _DcqlQueryResult['credential_matches'][string]['all'][number][number] & {
|
|
13
|
+
success: true;
|
|
14
|
+
record: MdocRecord | SdJwtVcRecord | W3cCredentialRecord;
|
|
15
|
+
};
|
|
16
|
+
type DcqlEntryNoSuccess = _DcqlQueryResult['credential_matches'][string]['all'][number][number] & {
|
|
17
|
+
success: false;
|
|
18
|
+
record?: undefined;
|
|
19
|
+
};
|
|
20
|
+
export type DcqlMatchWithRecord = (_DcqlQueryResult['credential_matches'][string] & {
|
|
21
|
+
success: true;
|
|
22
|
+
record: MdocRecord | SdJwtVcRecord | W3cCredentialRecord;
|
|
23
|
+
all: Array<Array<DcqlEntrySuccess | DcqlEntryNoSuccess>>;
|
|
24
|
+
}) | (_DcqlQueryResult['credential_matches'][string] & {
|
|
25
|
+
success: false;
|
|
26
|
+
});
|
|
27
|
+
export type DcqlQueryResult = Omit<_DcqlQueryResult.Input, 'credential_matches'> & {
|
|
28
|
+
credential_matches: Record<string, DcqlMatchWithRecord>;
|
|
29
|
+
};
|
|
30
|
+
export type DcqlEncodedPresentations = _DcqlPresentation.Input;
|
|
31
|
+
export type DcqlPresentation = Record<string, VerifiablePresentation>;
|
|
32
|
+
export type DcqlPresentationResult = _DcqlPresentationResult.Input;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DcqlCredentialsForRequest"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/dcql/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA2C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { DcqlMdocCredential, DcqlSdJwtVcCredential, DcqlW3cVcCredential } from 'dcql';
|
|
2
|
+
import { JsonObject } from '../../../types';
|
|
3
|
+
import { MdocRecord } from '../../mdoc';
|
|
4
|
+
import { SdJwtVcRecord } from '../../sd-jwt-vc';
|
|
5
|
+
import { ClaimFormat, W3cCredentialRecord } from '../../vc';
|
|
6
|
+
import type { DcqlCredentialsForRequest } from '../models';
|
|
7
|
+
export interface DcqlSdJwtVcPresentationToCreate {
|
|
8
|
+
claimFormat: ClaimFormat.SdJwtVc;
|
|
9
|
+
subjectIds: [];
|
|
10
|
+
credentialRecord: SdJwtVcRecord;
|
|
11
|
+
disclosedPayload: DcqlSdJwtVcCredential.Claims;
|
|
12
|
+
/**
|
|
13
|
+
* Additional payload to include in the Key Binding JWT
|
|
14
|
+
*/
|
|
15
|
+
additionalPayload?: JsonObject;
|
|
16
|
+
}
|
|
17
|
+
export interface DcqlJwtVpPresentationToCreate {
|
|
18
|
+
claimFormat: ClaimFormat.JwtVp;
|
|
19
|
+
subjectIds: [string];
|
|
20
|
+
credentialRecord: W3cCredentialRecord;
|
|
21
|
+
disclosedPayload: DcqlW3cVcCredential.Claims;
|
|
22
|
+
}
|
|
23
|
+
export interface DcqlLdpVpPresentationToCreate {
|
|
24
|
+
claimFormat: ClaimFormat.LdpVp;
|
|
25
|
+
subjectIds: undefined | [string];
|
|
26
|
+
credentialRecord: W3cCredentialRecord;
|
|
27
|
+
disclosedPayload: DcqlW3cVcCredential.Claims;
|
|
28
|
+
}
|
|
29
|
+
export interface DcqlMdocPresentationToCreate {
|
|
30
|
+
claimFormat: ClaimFormat.MsoMdoc;
|
|
31
|
+
subjectIds: [];
|
|
32
|
+
credentialRecord: MdocRecord;
|
|
33
|
+
disclosedPayload: DcqlMdocCredential.NameSpaces;
|
|
34
|
+
}
|
|
35
|
+
export type DcqlPresentationToCreate = Record<string, DcqlSdJwtVcPresentationToCreate | DcqlJwtVpPresentationToCreate | DcqlLdpVpPresentationToCreate | DcqlMdocPresentationToCreate>;
|
|
36
|
+
export declare function dcqlGetPresentationsToCreate(credentialsForInputDescriptor: DcqlCredentialsForRequest): DcqlPresentationToCreate;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dcqlGetPresentationsToCreate = dcqlGetPresentationsToCreate;
|
|
4
|
+
const vc_1 = require("../../vc");
|
|
5
|
+
function dcqlGetPresentationsToCreate(credentialsForInputDescriptor) {
|
|
6
|
+
const presentationsToCreate = {};
|
|
7
|
+
for (const [credentialQueryId, match] of Object.entries(credentialsForInputDescriptor)) {
|
|
8
|
+
if (match.claimFormat === vc_1.ClaimFormat.SdJwtVc) {
|
|
9
|
+
presentationsToCreate[credentialQueryId] = {
|
|
10
|
+
claimFormat: vc_1.ClaimFormat.SdJwtVc,
|
|
11
|
+
subjectIds: [],
|
|
12
|
+
credentialRecord: match.credentialRecord,
|
|
13
|
+
disclosedPayload: match.disclosedPayload,
|
|
14
|
+
additionalPayload: match.additionalPayload,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
else if (match.claimFormat === vc_1.ClaimFormat.MsoMdoc) {
|
|
18
|
+
presentationsToCreate[credentialQueryId] = {
|
|
19
|
+
claimFormat: vc_1.ClaimFormat.MsoMdoc,
|
|
20
|
+
subjectIds: [],
|
|
21
|
+
credentialRecord: match.credentialRecord,
|
|
22
|
+
disclosedPayload: match.disclosedPayload,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
presentationsToCreate[credentialQueryId] = {
|
|
27
|
+
claimFormat: match.credentialRecord.credential.claimFormat === vc_1.ClaimFormat.JwtVc ? vc_1.ClaimFormat.JwtVp : vc_1.ClaimFormat.LdpVp,
|
|
28
|
+
subjectIds: [match.credentialRecord.credential.credentialSubjectIds[0]],
|
|
29
|
+
credentialRecord: match.credentialRecord,
|
|
30
|
+
disclosedPayload: match.disclosedPayload,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return presentationsToCreate;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=DcqlPresentationsToCreate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DcqlPresentationsToCreate.js","sourceRoot":"","sources":["../../../../src/modules/dcql/utils/DcqlPresentationsToCreate.ts"],"names":[],"mappings":";;AAmDA,oEAiCC;AAhFD,iCAA2D;AA+C3D,SAAgB,4BAA4B,CAC1C,6BAAwD;IAExD,MAAM,qBAAqB,GAA6B,EAAE,CAAA;IAE1D,KAAK,MAAM,CAAC,iBAAiB,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,6BAA6B,CAAC,EAAE,CAAC;QACvF,IAAI,KAAK,CAAC,WAAW,KAAK,gBAAW,CAAC,OAAO,EAAE,CAAC;YAC9C,qBAAqB,CAAC,iBAAiB,CAAC,GAAG;gBACzC,WAAW,EAAE,gBAAW,CAAC,OAAO;gBAChC,UAAU,EAAE,EAAE;gBACd,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;gBACxC,gBAAgB,EAAE,KAAK,CAAC,gBAA8C;gBACtE,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;aAC3C,CAAA;QACH,CAAC;aAAM,IAAI,KAAK,CAAC,WAAW,KAAK,gBAAW,CAAC,OAAO,EAAE,CAAC;YACrD,qBAAqB,CAAC,iBAAiB,CAAC,GAAG;gBACzC,WAAW,EAAE,gBAAW,CAAC,OAAO;gBAChC,UAAU,EAAE,EAAE;gBACd,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;gBACxC,gBAAgB,EAAE,KAAK,CAAC,gBAAiD;aAC1E,CAAA;QACH,CAAC;aAAM,CAAC;YACN,qBAAqB,CAAC,iBAAiB,CAAC,GAAG;gBACzC,WAAW,EACT,KAAK,CAAC,gBAAgB,CAAC,UAAU,CAAC,WAAW,KAAK,gBAAW,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAW,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAW,CAAC,KAAK;gBAC7G,UAAU,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;gBACvE,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;gBACxC,gBAAgB,EAAE,KAAK,CAAC,gBAA8C;aACvE,CAAA;QACH,CAAC;IACH,CAAC;IAED,OAAO,qBAAqB,CAAA;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DcqlPresentationsToCreate';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DcqlPresentationsToCreate"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/dcql/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA2C"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AgentContext } from '../../agent';
|
|
2
|
+
import type { W3cJsonPresentation } from '../vc';
|
|
2
3
|
import type { DifPexCredentialsForRequest, DifPexInputDescriptorToCredentials, DifPresentationExchangeDefinition, DifPresentationExchangeSubmission, VerifiablePresentation } from './models';
|
|
3
|
-
import { MdocOpenId4VpSessionTranscriptOptions } from '../mdoc';
|
|
4
|
+
import { MdocOpenId4VpDcApiSessionTranscriptOptions, MdocOpenId4VpSessionTranscriptOptions } from '../mdoc';
|
|
4
5
|
import { MdocDeviceResponse } from '../mdoc/MdocDeviceResponse';
|
|
5
6
|
import { W3cCredentialService } from '../vc';
|
|
6
7
|
import { DifPresentationExchangeSubmissionLocation } from './models';
|
|
@@ -19,7 +20,7 @@ export declare class DifPresentationExchangeService {
|
|
|
19
20
|
selectCredentialsForRequest(credentialsForRequest: DifPexCredentialsForRequest): DifPexInputDescriptorToCredentials;
|
|
20
21
|
validatePresentationDefinition(presentationDefinition: DifPresentationExchangeDefinition): void;
|
|
21
22
|
validatePresentationSubmission(presentationSubmission: DifPresentationExchangeSubmission): void;
|
|
22
|
-
validatePresentation(presentationDefinition: DifPresentationExchangeDefinition,
|
|
23
|
+
validatePresentation(presentationDefinition: DifPresentationExchangeDefinition, presentations: VerifiablePresentation | VerifiablePresentation[], presentationSubmission?: DifPresentationExchangeSubmission): void;
|
|
23
24
|
private formatValidated;
|
|
24
25
|
createPresentation(agentContext: AgentContext, options: {
|
|
25
26
|
credentialsForInputDescriptor: DifPexInputDescriptorToCredentials;
|
|
@@ -30,9 +31,10 @@ export declare class DifPresentationExchangeService {
|
|
|
30
31
|
presentationSubmissionLocation?: DifPresentationExchangeSubmissionLocation;
|
|
31
32
|
challenge: string;
|
|
32
33
|
domain?: string;
|
|
33
|
-
openid4vp?: Omit<MdocOpenId4VpSessionTranscriptOptions, 'verifierGeneratedNonce' | '
|
|
34
|
+
openid4vp?: Omit<MdocOpenId4VpSessionTranscriptOptions, 'verifierGeneratedNonce'> | Omit<MdocOpenId4VpDcApiSessionTranscriptOptions, 'verifierGeneratedNonce'>;
|
|
34
35
|
}): Promise<{
|
|
35
|
-
verifiablePresentations: (import("../sd-jwt-vc").SdJwtVc<import("../sd-jwt-vc").SdJwtVcHeader, import("../sd-jwt-vc").SdJwtVcPayload> | import("../vc").
|
|
36
|
+
verifiablePresentations: (import("../vc").W3cJwtVerifiablePresentation | import("../sd-jwt-vc").SdJwtVc<import("../sd-jwt-vc").SdJwtVcHeader, import("../sd-jwt-vc").SdJwtVcPayload> | import("../vc").W3cJsonLdVerifiablePresentation | MdocDeviceResponse)[];
|
|
37
|
+
encodedVerifiablePresentations: (string | W3cJsonPresentation)[];
|
|
36
38
|
presentationSubmission: import("@sphereon/pex-models").PresentationSubmission;
|
|
37
39
|
presentationSubmissionLocation: DifPresentationExchangeSubmissionLocation;
|
|
38
40
|
}>;
|