@digitalbazaar/oid4-client 4.0.0 → 4.2.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.
Files changed (2) hide show
  1. package/lib/oid4vp.js +12 -3
  2. package/package.json +8 -8
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 = false
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}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalbazaar/oid4-client",
3
- "version": "4.0.0",
3
+ "version": "4.2.0",
4
4
  "description": "An OID4 (VC + VP) client",
5
5
  "homepage": "https://github.com/digitalbazaar/oid4-client",
6
6
  "author": {
@@ -25,10 +25,10 @@
25
25
  "dependencies": {
26
26
  "@digitalbazaar/http-client": "^4.0.0",
27
27
  "base64url-universal": "^2.0.0",
28
- "jose": "^4.15.4",
29
- "jsonpath-plus": "^7.2.0",
28
+ "jose": "^5.9.4",
29
+ "jsonpath-plus": "^10.0.0",
30
30
  "jsonpointer": "^5.0.1",
31
- "uuid": "^9.0.1"
31
+ "uuid": "^10.0.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "c8": "^7.11.3",
@@ -36,16 +36,16 @@
36
36
  "cross-env": "^7.0.3",
37
37
  "eslint": "^8.41.0",
38
38
  "eslint-config-digitalbazaar": "^5.0.1",
39
- "eslint-plugin-jsdoc": "^45.0.0",
40
- "eslint-plugin-unicorn": "^42.0.0",
39
+ "eslint-plugin-jsdoc": "^50.4.1",
40
+ "eslint-plugin-unicorn": "^56.0.0",
41
41
  "jsdoc": "^4.0.2",
42
- "jsdoc-to-markdown": "^8.0.0",
42
+ "jsdoc-to-markdown": "^9.0.2",
43
43
  "karma": "^6.3.20",
44
44
  "karma-chai": "^0.1.0",
45
45
  "karma-chrome-launcher": "^3.1.1",
46
46
  "karma-mocha": "^2.0.1",
47
47
  "karma-mocha-reporter": "^2.2.5",
48
- "karma-sourcemap-loader": "^0.3.8",
48
+ "karma-sourcemap-loader": "^0.4.0",
49
49
  "karma-webpack": "^5.0.0",
50
50
  "mocha": "^10.0.0",
51
51
  "mocha-lcov-reporter": "^1.3.0",