@bedrock/vc-delivery 7.17.2 → 7.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/issue.js CHANGED
@@ -197,6 +197,11 @@ function _getIssueZcap({
197
197
  }
198
198
 
199
199
  async function _issue({workflow, exchange, issueRequests, mediaType} = {}) {
200
+ if(issueRequests.length === 0) {
201
+ // no issue requests means nothing to issue or store
202
+ return {credentials: [], storedCredentials: [], exchangeChanged: false};
203
+ }
204
+
200
205
  // create zcap client for issuing VCs
201
206
  const {zcapClient, zcaps} = await getZcapClient({workflow});
202
207
 
package/lib/oid4/http.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright (c) 2022-2026 Digital Bazaar, Inc. All rights reserved.
2
+ * Copyright (c) 2022-2026 Digital Bazaar, Inc.
3
3
  */
4
4
  import * as oid4vci from './oid4vci.js';
5
5
  import * as oid4vp from './oid4vp.js';
@@ -439,12 +439,18 @@ function _normalizeCredentials({verifiablePresentation}) {
439
439
  vc.id?.startsWith('data:application/jwt,')) {
440
440
  return vc.id.slice('data:application/jwt,'.length);
441
441
  }
442
- // parse any mdoc mDL into its non-VC format (includes base64 => base64url)
443
- if(vc.type === 'EnvelopedVerifiableCredential' &&
444
- vc.id?.startsWith('data:application/mdl;base64,')) {
445
- const buffer = Buffer.from(
446
- vc.id.slice('data:application/mdl;base64,'.length), 'base64');
447
- return buffer.toString('base64url');
442
+ // parse any mdoc into its non-VC format (includes base64 => base64url)
443
+ if(vc.type === 'EnvelopedVerifiableCredential') {
444
+ if(vc.id?.startsWith('data:application/mdoc;base64,')) {
445
+ const buffer = Buffer.from(
446
+ vc.id.slice('data:application/mdoc;base64,'.length), 'base64');
447
+ return buffer.toString('base64url');
448
+ } else if(vc.id?.startsWith('data:application/mdl;base64,')) {
449
+ // deprecated `mdl` media type
450
+ const buffer = Buffer.from(
451
+ vc.id.slice('data:application/mdl;base64,'.length), 'base64');
452
+ return buffer.toString('base64url');
453
+ }
448
454
  }
449
455
  return vc;
450
456
  });
@@ -199,8 +199,10 @@ export async function processAuthorizationResponse({req, clientProfileId}) {
199
199
  expectedDomain = verifyPresentationOptions.domain;
200
200
 
201
201
  const {envelope} = parseResponseResult;
202
- if(envelope?.mediaType === 'application/mdl-vp-token') {
203
- // generate `handover` for mDL verification
202
+ if(envelope?.mediaType === 'application/mdoc-vp-token' ||
203
+ // deprecated
204
+ envelope?.mediaType === 'application/mdl-vp-token') {
205
+ // generate `handover` for mdoc verification
204
206
  let handover;
205
207
 
206
208
  // common `handover` parameters:
@@ -244,11 +246,15 @@ export async function processAuthorizationResponse({req, clientProfileId}) {
244
246
  };
245
247
  }
246
248
 
247
- verifyPresentationOptions.mdl = {
248
- ...verifyPresentationOptions.mdl,
249
- // send encoded mDL `sessionTranscript`
249
+ // handle deprecated `mdl` option; `mdoc` is preferred
250
+ const mdocKey = envelope.mediaType === 'application/mdoc-vp-token' ?
251
+ 'mdoc' : 'mdl';
252
+
253
+ verifyPresentationOptions[mdocKey] = {
254
+ ...verifyPresentationOptions[mdocKey],
255
+ // send encoded mdoc `sessionTranscript`
250
256
  sessionTranscript: Buffer
251
- .from(await oid4vp.mdl.encodeSessionTranscript({handover}))
257
+ .from(await oid4vp.mdoc.encodeSessionTranscript({handover}))
252
258
  .toString('base64url')
253
259
  };
254
260
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrock/vc-delivery",
3
- "version": "7.17.2",
3
+ "version": "7.18.1",
4
4
  "type": "module",
5
5
  "description": "Bedrock Verifiable Credential Delivery",
6
6
  "main": "./lib/index.js",
@@ -39,8 +39,8 @@
39
39
  "@digitalbazaar/ed25519-multikey": "^1.3.1",
40
40
  "@digitalbazaar/ed25519-signature-2020": "^5.4.0",
41
41
  "@digitalbazaar/ezcap": "^4.1.0",
42
- "@digitalbazaar/http-client": "^4.2.0",
43
- "@digitalbazaar/oid4-client": "^5.12.1",
42
+ "@digitalbazaar/http-client": "^4.4.0",
43
+ "@digitalbazaar/oid4-client": "^5.14.0",
44
44
  "@digitalbazaar/vc": "^7.2.0",
45
45
  "@digitalbazaar/webkms-client": "^14.2.0",
46
46
  "assert-plus": "^1.0.0",
@@ -48,7 +48,7 @@
48
48
  "body-parser": "^1.20.3",
49
49
  "cors": "^2.8.5",
50
50
  "delay": "^7.0.0",
51
- "jose": "^6.1.0",
51
+ "jose": "^6.2.10",
52
52
  "json-pointer": "^0.6.2",
53
53
  "jsonata": "^2.0.6",
54
54
  "serialize-error": "^12.0.0"