@digitalbazaar/oid4-client 5.4.0 → 5.5.0

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.
@@ -270,10 +270,11 @@ function _strictCheckVprGroups({groupMap, queryFormats}) {
270
270
  }
271
271
 
272
272
  function _fromDIDAuthenticationQuery({query, strict = false}) {
273
+ const vp_formats = {};
273
274
  const vp_formats_supported = {};
274
275
  const client_metadata = {
275
276
  require_signed_request_object: false,
276
- vp_formats: {},
277
+ vp_formats,
277
278
  vp_formats_supported
278
279
  };
279
280
 
@@ -300,13 +301,23 @@ function _fromDIDAuthenticationQuery({query, strict = false}) {
300
301
  for(const envelope of query.acceptedEnvelopes) {
301
302
  if(envelope === 'application/jwt') {
302
303
  // legacy (before OID4VP 1.0)
303
- vp_formats_supported.jwt_vp_json = {};
304
+ vp_formats.jwt_vp = vp_formats.jwt_vp_json = {
305
+ alg: ['EdDSA', 'Ed25519', 'ES256', 'ES384']
306
+ };
304
307
  // OID4VP 1.0+
305
308
  vp_formats_supported.jwt_vc_json = {};
306
309
  } else if(envelope === 'application/mdl' ||
307
310
  envelope === 'application/mdoc') {
311
+ // legacy (before OID4VP 1.0)
312
+ vp_formats.mso_mdoc = {
313
+ alg: ['EdDSA', 'ES256']
314
+ };
315
+ // OID4VP 1.0+
308
316
  vp_formats_supported.mso_mdoc = {};
309
317
  } else if(envelope === 'application/dc+sd-jwt') {
318
+ // legacy (before OID4VP 1.0)
319
+ vp_formats['dc+sd-jwt'] = {};
320
+ // OID4VP 1.0+
310
321
  vp_formats_supported['dc+sd-jwt'] = {};
311
322
  }
312
323
  // ignore unknown envelope format
package/lib/query/dcql.js CHANGED
@@ -112,7 +112,9 @@ export function _fromQueryByExampleQuery({
112
112
  id: crypto.randomUUID(),
113
113
  format: 'ldp_vc',
114
114
  meta: {
115
- type_values: ['https://www.w3.org/2018/credentials#VerifiableCredential']
115
+ type_values: [
116
+ ['https://www.w3.org/2018/credentials#VerifiableCredential']
117
+ ]
116
118
  }
117
119
  };
118
120
  if(credentialQuery?.reason) {
@@ -59,9 +59,25 @@ export function vprGroupsToPresentationDefinition({
59
59
  const all = Array.isArray(queryByExample.credentialQuery) ?
60
60
  queryByExample.credentialQuery : [queryByExample.credentialQuery];
61
61
  for(const credentialQuery of all) {
62
- input_descriptors.push(_fromQueryByExampleQuery({
62
+ const inputDescriptor = _fromQueryByExampleQuery({
63
63
  credentialQuery, prefixJwtVcPath
64
- }));
64
+ });
65
+ input_descriptors.push(inputDescriptor);
66
+ const {acceptedEnvelopes, acceptedCryptosuites} = credentialQuery;
67
+ const shouldAddFormat = acceptedEnvelopes || acceptedCryptosuites;
68
+ if(shouldAddFormat && !inputDescriptor.format) {
69
+ inputDescriptor.format = {};
70
+ }
71
+ if(acceptedEnvelopes?.includes('application/jwt')) {
72
+ inputDescriptor.format.jwt_vc_json = {
73
+ alg: ['EdDSA', 'Ed25519', 'ES256', 'ES384']
74
+ };
75
+ }
76
+ if(acceptedCryptosuites) {
77
+ inputDescriptor.format.ldp_vc = {
78
+ proof_type: acceptedCryptosuites.map(({cryptosuite}) => cryptosuite)
79
+ };
80
+ }
65
81
  }
66
82
  }
67
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalbazaar/oid4-client",
3
- "version": "5.4.0",
3
+ "version": "5.5.0",
4
4
  "description": "An OID4 (VC + VP) client",
5
5
  "homepage": "https://github.com/digitalbazaar/oid4-client",
6
6
  "author": {