@digitalbazaar/oid4-client 5.6.1 → 5.6.2
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.
|
@@ -43,31 +43,32 @@ export function vprGroupsToPresentationDefinition({
|
|
|
43
43
|
input_descriptors
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
|
|
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
|
-
|
|
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
|
|
|
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) {
|
|
71
72
|
const queryByExamples = queries.get('QueryByExample');
|
|
72
73
|
|
|
73
74
|
// for each `QueryByExample`, add another input descriptor (for every
|
|
@@ -105,7 +106,7 @@ export function vprGroupsToPresentationDefinition({
|
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
if(submission_requirements) {
|
|
108
|
-
inputDescriptor.group = [
|
|
109
|
+
inputDescriptor.group = [peGroupId];
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
input_descriptors.push(inputDescriptor);
|