@digitalbazaar/oid4-client 4.0.0 → 4.1.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/oid4vp.js +12 -3
- package/package.json +1 -1
package/lib/oid4vp.js
CHANGED
|
@@ -298,7 +298,7 @@ export async function toVpr({
|
|
|
298
298
|
|
|
299
299
|
// converts a VPR to partial "authorization request"
|
|
300
300
|
export function fromVpr({
|
|
301
|
-
verifiablePresentationRequest, strict = false, prefixJwtVcPath
|
|
301
|
+
verifiablePresentationRequest, strict = false, prefixJwtVcPath
|
|
302
302
|
} = {}) {
|
|
303
303
|
try {
|
|
304
304
|
let {query} = verifiablePresentationRequest;
|
|
@@ -571,6 +571,15 @@ function _matchesInputDescriptor({
|
|
|
571
571
|
|
|
572
572
|
// exported for testing purposes only
|
|
573
573
|
export function _fromQueryByExampleQuery({credentialQuery, prefixJwtVcPath}) {
|
|
574
|
+
// determine `prefixJwtVcPath` default:
|
|
575
|
+
// if `credentialQuery` specifies `acceptedEnvelopes: ['application/jwt']`,
|
|
576
|
+
// then default `prefixJwtVcPath` to `true`
|
|
577
|
+
if(prefixJwtVcPath === undefined &&
|
|
578
|
+
(Array.isArray(credentialQuery.acceptedEnvelopes) &&
|
|
579
|
+
credentialQuery.acceptedEnvelopes.includes?.('application/jwt'))) {
|
|
580
|
+
prefixJwtVcPath = true;
|
|
581
|
+
}
|
|
582
|
+
|
|
574
583
|
const fields = [];
|
|
575
584
|
const inputDescriptor = {
|
|
576
585
|
id: uuid(),
|
|
@@ -751,7 +760,7 @@ function _adjustErroneousPaths(paths) {
|
|
|
751
760
|
// presentation submission and adjust any paths that would be part of a
|
|
752
761
|
// JWT-secured VC, such that only actual VC paths remain
|
|
753
762
|
const removed = paths.filter(p => !_isPresentationSubmissionPath(p));
|
|
754
|
-
return removed.map(p => {
|
|
763
|
+
return [...new Set(removed.map(p => {
|
|
755
764
|
if(_isJWTPath(p)) {
|
|
756
765
|
return '$' + p.slice('$.vc'.length);
|
|
757
766
|
}
|
|
@@ -759,7 +768,7 @@ function _adjustErroneousPaths(paths) {
|
|
|
759
768
|
return '$' + p.slice('$[\'vc\']'.length);
|
|
760
769
|
}
|
|
761
770
|
return p;
|
|
762
|
-
});
|
|
771
|
+
}))];
|
|
763
772
|
}
|
|
764
773
|
|
|
765
774
|
function _parseOID4VPUrl({url}) {
|