Skip to content

Commit d66c8fa

Browse files
authored
Use path for mdoc (#368)
6 approvals. open for more than a week.
1 parent b09439a commit d66c8fa

File tree

4 files changed

+65
-79
lines changed

4 files changed

+65
-79
lines changed

examples/query_lang/complex_mdoc.json

+10-20
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,15 @@
99
"claims": [
1010
{
1111
"id": "given_name",
12-
"namespace": "org.iso.18013.5.1",
13-
"claim_name": "given_name"
12+
"path": ["org.iso.18013.5.1", "given_name"]
1413
},
1514
{
1615
"id": "family_name",
17-
"namespace": "org.iso.18013.5.1",
18-
"claim_name": "family_name"
16+
"path": ["org.iso.18013.5.1", "family_name"]
1917
},
2018
{
2119
"id": "portrait",
22-
"namespace": "org.iso.18013.5.1",
23-
"claim_name": "portrait"
20+
"path": ["org.iso.18013.5.1", "portrait"]
2421
}
2522
]
2623
},
@@ -33,13 +30,11 @@
3330
"claims": [
3431
{
3532
"id": "resident_address",
36-
"namespace": "org.iso.18013.5.1",
37-
"claim_name": "resident_address"
33+
"path": ["org.iso.18013.5.1", "resident_address"]
3834
},
3935
{
4036
"id": "resident_country",
41-
"namespace": "org.iso.18013.5.1",
42-
"claim_name": "resident_country"
37+
"path": ["org.iso.18013.5.1", "resident_country"]
4338
}
4439
]
4540
},
@@ -52,18 +47,15 @@
5247
"claims": [
5348
{
5449
"id": "given_name",
55-
"namespace": "org.iso.23220.1",
56-
"claim_name": "given_name"
50+
"path": ["org.iso.18013.5.1", "given_name"]
5751
},
5852
{
5953
"id": "family_name",
60-
"namespace": "org.iso.23220.1",
61-
"claim_name": "family_name"
54+
"path": ["org.iso.18013.5.1", "family_name"]
6255
},
6356
{
6457
"id": "portrait",
65-
"namespace": "org.iso.23220.1",
66-
"claim_name": "portrait"
58+
"path": ["org.iso.18013.5.1", "portrait"]
6759
}
6860
]
6961
},
@@ -76,13 +68,11 @@
7668
"claims": [
7769
{
7870
"id": "resident_address",
79-
"namespace": "org.iso.23220.1",
80-
"claim_name": "resident_address"
71+
"path": ["org.iso.18013.5.1", "resident_address"]
8172
},
8273
{
8374
"id": "resident_country",
84-
"namespace": "org.iso.23220.1",
85-
"claim_name": "resident_country"
75+
"path": ["org.iso.18013.5.1", "resident_country"]
8676
}
8777
]
8878
}

examples/query_lang/multi_credentials.json

+2-8
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,8 @@
1919
"doctype_value": "org.iso.7367.1.mVRC"
2020
},
2121
"claims": [
22-
{
23-
"namespace": "org.iso.7367.1",
24-
"claim_name": "vehicle_holder"
25-
},
26-
{
27-
"namespace": "org.iso.18013.5.1",
28-
"claim_name": "first_name"
29-
}
22+
{"path": ["org.iso.7367.1", "vehicle_holder"]},
23+
{"path": ["org.iso.18013.5.1", "first_name"]}
3024
]
3125
}
3226
]

examples/query_lang/simple_mdoc.json

+2-8
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,8 @@
77
"doctype_value": "org.iso.7367.1.mVRC"
88
},
99
"claims": [
10-
{
11-
"namespace": "org.iso.7367.1",
12-
"claim_name": "vehicle_holder"
13-
},
14-
{
15-
"namespace": "org.iso.18013.5.1",
16-
"claim_name": "first_name"
17-
}
10+
{"path": ["org.iso.7367.1", "vehicle_holder"]},
11+
{"path": ["org.iso.18013.5.1", "first_name"]}
1812
]
1913
}
2014
]

openid-4-verifiable-presentations-1_0.md

+51-43
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,8 @@ Credential.
690690

691691
`claims`:
692692
: OPTIONAL. A non-empty array of objects as defined in (#claims_query) that specifies
693-
claims in the requested Credential.
693+
claims in the requested Credential. Verifiers MUST NOT point to the same claim more than
694+
once in a single query. Wallets SHOULD ignore such duplicate claim queries.
694695

695696
`claim_sets`:
696697
: OPTIONAL. A non-empty array containing arrays of identifiers for
@@ -735,17 +736,14 @@ Within the particular `claims` array, the same `id` MUST NOT
735736
be present more than once.
736737

737738
`path`:
738-
: REQUIRED if the Credential Format uses a JSON-based claims structure (e.g., IETF SD-JWT VC and W3C Verifiable Credentials); MUST NOT
739-
be present otherwise. The value MUST be a non-empty array representing a claims path pointer that specifies the path to a claim
739+
: REQUIRED The value MUST be a non-empty array representing a claims path pointer that specifies the path to a claim
740740
within the Verifiable Credential, as defined in (#claims_path_pointer).
741741

742742
`values`:
743743
: OPTIONAL. An array of strings, integers or boolean values that specifies the expected values of the claim.
744744
If the `values` property is present, the Wallet SHOULD return the claim only if the
745745
type and value of the claim both match for at least one of the elements in the array. Details of the processing rules are defined in (#selecting_claims).
746746

747-
The ISO mdoc specific parameters to be used in the Claims Query are defined in (#mdocs_claims_query).
748-
749747
### Selecting Claims and Credentials {#dcql_query_lang_processing_rules}
750748

751749
The following section describes the logic that applies for selecting claims
@@ -827,33 +825,36 @@ these constraints. The Wallet is not controlled by the Verifier and the Verifier
827825
MUST perform its own security checks on the returned Credentials and
828826
presentations.
829827

830-
## Claims Path Pointer {#claims_path_pointer}
828+
# Claims Path Pointer {#claims_path_pointer}
829+
830+
A claims path pointer is a pointer into the Verifiable Credential, identifying one or more claims.
831+
A claims path pointer MUST be a non-empty array of strings, nulls and non-negative integers.
832+
A claims path pointer can be processed, which means it is applied to a credential. The results of
833+
processing are the referenced claims.
834+
835+
## Semantics for JSON-based credentials
831836

832-
A claims path pointer is a pointer into the JSON structure of the Verifiable
833-
Credential, identifying one or more claims. A claims path pointer MUST be a
834-
non-empty array of strings and non-negative integers. A string value
835-
indicates that the respective key is to be selected, a null value
837+
This section defines the semantics of a claims path pointer when applied to a JSON-based credential.
838+
839+
A string value indicates that the respective key is to be selected, a null value
836840
indicates that all elements of the currently selected array(s) are to be selected;
837841
and a non-negative integer indicates that the respective index in an array is to be selected. The path
838842
is formed as follows:
839843

840-
Start with an empty array and repeat the following until the full path is formed.
841-
842-
- To address a particular claim within an object, append the key (claim name)
843-
to the array.
844-
- To address an element within an array, append the index to the array (as a
845-
non-negative, 0-based integer).
846-
- To address all elements within an array, append a null value to the array.
844+
Start with an empty array and repeat the following until the full path is formed.
847845

848-
Verifiers MUST NOT point to the same claim more than once in a single query.
849-
Wallets SHOULD ignore such duplicate claim queries.
846+
- To address a particular claim within an object, append the key (claim name)
847+
to the array.
848+
- To address an element within an array, append the index to the array (as a
849+
non-negative, 0-based integer).
850+
- To address all elements within an array, append a null value to the array.
850851

851852
### Processing
852853

853-
In detail, the array is processed by the Wallet from left to right as follows:
854+
In detail, the array is processed from left to right as follows:
854855

855-
1. Select the root element of the Credential, i.e., the top-level JSON object.
856-
2. Process the query of the claims path pointer array from left to right:
856+
1. Select the root element of the Credential, i.e., the top-level JSON object.
857+
2. Process the query of the claims path pointer array from left to right:
857858
1. If the component is a string, select the element in the respective
858859
key in the currently selected element(s). If any of the currently
859860
selected element(s) is not an object, abort processing and return an
@@ -867,15 +868,36 @@ In detail, the array is processed by the Wallet from left to right as follows:
867868
currently selected element(s) is not an array, abort processing and
868869
return an error. If the index does not exist in a selected array, remove
869870
that array from the selection.
870-
3. If the set of elements currently selected is empty, abort processing and
871-
return an error.
871+
3. If the set of elements currently selected is empty, abort processing and
872+
return an error.
873+
874+
The result of the processing is the set of selected JSON elements.
875+
876+
## Semantics for ISO mdoc-based credentials
877+
878+
This section defines the semantics of a claims path pointer when applied to a
879+
credential in ISO mdoc format.
880+
881+
A claims path pointer into an mdoc contains two elements of type string. The
882+
first element refers to a namespace and the second element refers to a data
883+
element identifier.
872884

873-
The result of the processing is the set of elements which is requested for
874-
presentation.
885+
### Processing
886+
887+
In detail, the array is processed as follows:
888+
889+
1. If the claims path pointer does not contain exactly two components or
890+
one of the components is not a string abort processing and return an error.
891+
2. Select the namespace referenced by the first component. If the namespace does
892+
not exist in the mdoc abort processing and return an error.
893+
3. Select the data element referenced by the second component. If the data element does not exist
894+
in the credential abort processing and return an error.
875895

876-
### Claims Path Pointer Example {#claims_path_pointer_example}
896+
The result of the processing is the selected data element value as CBOR data item.
877897

878-
The following shows a non-normative, simplified example of a Credential:
898+
## Claims Path Pointer Example {#claims_path_pointer_example}
899+
900+
The following shows a non-normative, simplified example of a JSON-based Credential:
879901

880902
```json
881903
{
@@ -2223,20 +2245,6 @@ The following is an ISO mdoc specific parameter in the `meta` parameter in a Cre
22232245
doctype of the requested Verifiable Credential. It MUST
22242246
be a valid doctype identifier as defined in [@ISO.18013-5].
22252247

2226-
#### Parameters in the Claims Query {#mdocs_claims_query}
2227-
2228-
The following are ISO mdoc specific parameters to be used in a Claims Query as defined in (#claims_query).
2229-
2230-
`namespace`:
2231-
: REQUIRED if the Credential Format is based on the mdoc format defined in [@ISO.18013-5]; MUST NOT be present otherwise.
2232-
The value MUST be a string that specifies the namespace of the data element
2233-
within the mdoc, e.g., `org.iso.18013.5.1`.
2234-
2235-
`claim_name`:
2236-
: REQUIRED if the Credential Format is based on mdoc format defined in [@ISO.18013-5]; MUST NOT be present otherwise.
2237-
The value MUST be a string that specifies the data element identifier of the data element within the provided namespace
2238-
in the mdoc, e.g., `first_name`.
2239-
22402248
#### mdoc DCQL Query example
22412249

22422250
An example DCQL query using the mdoc format is shown in (#more_dcql_query_examples). The following is a non-normative example for a VP Token in the response:
@@ -2716,7 +2724,7 @@ The technology described in this specification was made available from contribut
27162724
[[ To be removed from the final specification ]]
27172725

27182726
-24
2719-
2727+
* use claims path pointer for mdoc based credentials
27202728

27212729
-23
27222730

0 commit comments

Comments
 (0)