@bedrock/vc-delivery 7.17.1 → 7.18.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.
- package/lib/oid4/http.js +14 -1
- package/lib/oid4/oid4vp.js +12 -6
- package/package.json +4 -4
package/lib/oid4/http.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2022-2026 Digital Bazaar, Inc.
|
|
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,6 +439,19 @@ 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 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
|
+
}
|
|
454
|
+
}
|
|
442
455
|
return vc;
|
|
443
456
|
});
|
|
444
457
|
}
|
package/lib/oid4/oid4vp.js
CHANGED
|
@@ -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/
|
|
203
|
-
//
|
|
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
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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.
|
|
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.
|
|
3
|
+
"version": "7.18.0",
|
|
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.
|
|
43
|
-
"@digitalbazaar/oid4-client": "^5.
|
|
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.
|
|
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"
|