@digitalbazaar/oid4-client 5.6.1 → 5.6.3

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/query/dcql.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright (c) 2025 Digital Bazaar, Inc. All rights reserved.
2
+ * Copyright (c) 2025-2026 Digital Bazaar, Inc. All rights reserved.
3
3
  */
4
4
  import {
5
5
  fromJsonPointerMap, isNumber, toJsonPointerMap, toNumberIfNumber
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright (c) 2023-2025 Digital Bazaar, Inc. All rights reserved.
2
+ * Copyright (c) 2023-2026 Digital Bazaar, Inc. All rights reserved.
3
3
  */
4
4
  import {resolvePointer, toJsonPointerMap} from './util.js';
5
5
  import {exampleToJsonPointerMap} from './queryByExample.js';
@@ -43,32 +43,33 @@ export function vprGroupsToPresentationDefinition({
43
43
  input_descriptors
44
44
  };
45
45
 
46
- // if there is more than one group, create submission requirements that will
47
- // be populated for each group
48
- let defaultGroupId;
46
+ // in VPR, each group is an 'AND' and just one group must be selected; to
47
+ // map this to presentation exchange groups, each `input_descriptor`
48
+ // represents a VPR group, but they are all part of the same PR group, and
49
+ // the `submission_requirements` will indicate that just one
50
+ // `input_descriptor` is to be selected via `{pick: 1, count: 1}`
51
+ let peGroupId;
49
52
  let submission_requirements;
50
53
  if(groupMap.size > 1) {
51
- defaultGroupId = crypto.randomUUID();
52
- submission_requirements = [];
54
+ peGroupId = crypto.randomUUID();
55
+ submission_requirements = [{
56
+ rule: 'pick',
57
+ count: 1,
58
+ from: peGroupId
59
+ }];
53
60
  }
54
61
 
62
+ // keep track of whether VPR queries express accepted cryptosuites/envelopes
63
+ // to add this to `presentation_definition.format` at the end
55
64
  let acceptsVpJwt = false;
56
65
  let acceptsVcJwt = false;
57
-
58
66
  const ldpVpProofTypes = new Set();
59
67
  const ldpVcProofTypes = new Set();
60
- // note: same group ID is logical "AND" and different group ID is "OR"
61
- for(const [groupId, queries] of groupMap.entries()) {
62
- // add to submission_requirements if present
63
- if(submission_requirements) {
64
- submission_requirements.push({
65
- rule: 'pick',
66
- count: 1,
67
- from: groupId ?? defaultGroupId
68
- });
69
- }
70
68
 
71
- const queryByExamples = queries.get('QueryByExample');
69
+ // note: same group ID is logical "AND" and different group ID is "OR"
70
+ const groups = [...groupMap.values()];
71
+ for(const queries of groups) {
72
+ const queryByExamples = queries.get('QueryByExample') ?? [];
72
73
 
73
74
  // for each `QueryByExample`, add another input descriptor (for every
74
75
  // "credentialQuery" within it
@@ -105,14 +106,14 @@ export function vprGroupsToPresentationDefinition({
105
106
  }
106
107
 
107
108
  if(submission_requirements) {
108
- inputDescriptor.group = [submission_requirements.at(-1).from];
109
+ inputDescriptor.group = [peGroupId];
109
110
  }
110
111
 
111
112
  input_descriptors.push(inputDescriptor);
112
113
  }
113
114
  }
114
115
 
115
- const didAuthentications = queries.get('DIDAuthentication');
116
+ const didAuthentications = queries.get('DIDAuthentication') ?? [];
116
117
  for(const didAuthentication of didAuthentications) {
117
118
  const {acceptedEnvelopes, acceptedCryptosuites} = didAuthentication;
118
119
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalbazaar/oid4-client",
3
- "version": "5.6.1",
3
+ "version": "5.6.3",
4
4
  "description": "An OID4 (VC + VP) client",
5
5
  "homepage": "https://github.com/digitalbazaar/oid4-client",
6
6
  "author": {