@digitalbazaar/oid4-client 3.8.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 +13 -9
- 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(),
|
|
@@ -590,16 +599,11 @@ export function _fromQueryByExampleQuery({credentialQuery, prefixJwtVcPath}) {
|
|
|
590
599
|
const filter = {};
|
|
591
600
|
if(Array.isArray(value)) {
|
|
592
601
|
filter.type = 'array';
|
|
593
|
-
|
|
594
|
-
/*filter.allOf = value.map(v => ({
|
|
602
|
+
filter.allOf = value.map(v => ({
|
|
595
603
|
contains: {
|
|
596
604
|
type: 'string',
|
|
597
605
|
const: v
|
|
598
606
|
}
|
|
599
|
-
}));*/
|
|
600
|
-
filter.contains = value.map(v => ({
|
|
601
|
-
type: 'string',
|
|
602
|
-
const: v
|
|
603
607
|
}));
|
|
604
608
|
} else if(key === 'type') {
|
|
605
609
|
// special provision for array/string for `type`
|
|
@@ -756,7 +760,7 @@ function _adjustErroneousPaths(paths) {
|
|
|
756
760
|
// presentation submission and adjust any paths that would be part of a
|
|
757
761
|
// JWT-secured VC, such that only actual VC paths remain
|
|
758
762
|
const removed = paths.filter(p => !_isPresentationSubmissionPath(p));
|
|
759
|
-
return removed.map(p => {
|
|
763
|
+
return [...new Set(removed.map(p => {
|
|
760
764
|
if(_isJWTPath(p)) {
|
|
761
765
|
return '$' + p.slice('$.vc'.length);
|
|
762
766
|
}
|
|
@@ -764,7 +768,7 @@ function _adjustErroneousPaths(paths) {
|
|
|
764
768
|
return '$' + p.slice('$[\'vc\']'.length);
|
|
765
769
|
}
|
|
766
770
|
return p;
|
|
767
|
-
});
|
|
771
|
+
}))];
|
|
768
772
|
}
|
|
769
773
|
|
|
770
774
|
function _parseOID4VPUrl({url}) {
|