Skip to content

Commit ec6d9b9

Browse files
awoiedanielfett
andauthored
Add schema type metadata (#231)
* feat: added schema type metadata * fix: removed redundant file * fix: fixed typo * fix: changed title for schema metadata * Apply suggestions from Daniel Co-authored-by: Daniel Fett <[email protected]> * fix: added examples and base document description for schemas * fix: moved schema examples to main doc * fix: marked cnf as required in presentation * fix: fine-tuned language * Update draft-ietf-oauth-sd-jwt-vc.md Co-authored-by: Daniel Fett <[email protected]> * Update draft-ietf-oauth-sd-jwt-vc.md Co-authored-by: Daniel Fett <[email protected]> * Update draft-ietf-oauth-sd-jwt-vc.md Co-authored-by: Daniel Fett <[email protected]> * Update draft-ietf-oauth-sd-jwt-vc.md Co-authored-by: Daniel Fett <[email protected]> * fix: editorial changes --------- Co-authored-by: Daniel Fett <[email protected]>
1 parent a8eedd9 commit ec6d9b9

File tree

1 file changed

+170
-27
lines changed

1 file changed

+170
-27
lines changed

draft-ietf-oauth-sd-jwt-vc.md

Lines changed: 170 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ document are to be interpreted as described in RFC 2119 [@!RFC2119].
130130
This specification uses the terms "Holder", "Issuer", "Verifier", "Key Binding", and "Key Binding JWT" defined by
131131
[@!I-D.ietf-oauth-selective-disclosure-jwt].
132132

133+
Consumer:
134+
: Applications using the Type Metadata specified in (#type-metadata) are called Consumer. This typically includes Issuers, Verifiers, and Wallets.
135+
133136
Verifiable Credential (VC):
134137
: An assertion with claims about a Subject that is cryptographically secured by an Issuer (usually by a digital signature).
135138

@@ -309,6 +312,8 @@ the Key Binding JWT, the `cnf` claim of the SD-JWT MUST be used.
309312
Furthermore, the recipient of the SD-JWT VC MUST validate the public verification key
310313
for the Issuer-signed JWT as defined in (#issuer-signed-jwt-verification-key-validation).
311314

315+
If a schema is provided in the Type Metadata, a recipient MUST validate the schema as defined in (#schema-type-metadata).
316+
312317
If there are no selectively disclosable claims, there is no need to process the
313318
`_sd` claim nor any Disclosures.
314319

@@ -478,23 +483,21 @@ MUST NOT be used.
478483

479484
# Type Metadata {#type-metadata}
480485

481-
A type is associated with metadata defining, for example, information about the type, a schema defining which claims MAY or MUST appear in the SD-JWT VC, and how they can be displayed.
486+
A SD-JWT VC type, i.e., the `vct` value, is associated with Type Metadata defining, for example, information about the type or a schema defining (see (#schema-definition)) which claims MAY or MUST appear in the SD-JWT VC.
482487

483-
This section defines Type Metadata that can be associated with a type of a SD-JWT VC as well as a method for retrieving the Type Metadata and processing rules. This Type Metadata is intended to be used, among other things, for the following purposes:
488+
This section defines Type Metadata that can be associated with a type of a SD-JWT VC, as well as a method for retrieving the Type Metadata and processing rules. This Type Metadata is intended to be used, among other things, for the following purposes:
484489

485-
* Developers of Issuers and Verifiers can use the Typ Metadata to understand the
490+
* Developers of Issuers and Verifiers can use the Type Metadata to understand the
486491
semantics of the type and the associated rules. While in some cases,
487-
Issuers are the parties that define types (credential formats), this is
492+
Issuers are the parties that define types, this is
488493
not always the case. For example, a type can be defined by a
489494
standardization body or a community.
490-
* Verifiers can use the metadata to determine whether a credential is valid
495+
* Verifiers can use the Type Metadata to determine whether a credential is valid
491496
according to the rules of the type. For example, a Verifier can check
492497
whether a credential contains all required claims and whether the claims
493498
are selectively disclosable.
494-
* Wallets can use the metadata to display the credential in a way that is
495-
consistent with the Issuer's intent.
496499

497-
Applications using Type Metadata defined in this specification are called "Consumers" in the following. This typically includes Issuers, Verifiers, and Wallets.
500+
Type Metadata can be retrieved as described in (#retrieving-type-metadata).
498501

499502
## Type Metadata Example {#type-metadata-example}
500503

@@ -524,7 +527,9 @@ retrieved from the URL
524527
"name":"Betelgeuse Education Credential - Preliminary Version",
525528
"description":"This is our development version of the education credential. Don't panic.",
526529
"extends":"https://galaxy.example.com/galactic-education-credential-0.9",
527-
"extends#integrity":"sha256-9cLlJNXN-TsMk-PmKjZ5t0WRL5ca_xGgX3c1VLmXfh-WRL5"
530+
"extends#integrity":"sha256-9cLlJNXN-TsMk-PmKjZ5t0WRL5ca_xGgX3c1VLmXfh-WRL5",
531+
"schema_uri":"https://exampleuniversity.com/public/credential-schema-0.9",
532+
"schema_uri#integrity":"sha256-o984vn819a48ui1llkwPmKjZ5t0WRL5ca_xGgX3c1VLmXfh"
528533
}
529534
```
530535

@@ -546,17 +551,14 @@ defined:
546551
* `extends`
547552
* OPTIONAL. A URI of another type that this type extends, as described in
548553
(#extending-type-metadata).
549-
550-
## Extending Type Metadata {#extending-type-metadata}
551-
552-
A type can extend another type. The extended type is identified by the URI in
553-
the `extends` property. Consumers MUST retrieve and process
554-
Type Metadata for the extended type before processing the Type Metadata for the extending
555-
type.
556-
557-
The extended type MAY itself extend another type. This can be used to create a
558-
chain or hierarchy of types. The security considerations described in
559-
(#circular-extends) apply in order to avoid problems with circular dependencies.
554+
* `schema`
555+
* OPTIONAL. An embedded JSON Schema document describing the structure of
556+
the Verifiable Credential as described in (#schema-definition). `schema` MUST NOT be used
557+
if `schema_uri` is present.
558+
* `schema_uri`
559+
* OPTIONAL. A URL pointing to a JSON Schema document describing the structure
560+
of the Verifiable Credential as described in (#schema-definition). `schema_uri` MUST NOT
561+
be used if `schema` is present.
560562

561563
## Retrieving Type Metadata {#retrieving-type-metadata}
562564

@@ -575,7 +577,7 @@ If the claim `vct#integrity` is present in the SD-JWT VC, its value
575577

576578
### From a Registry {#retrieval-from-registry}
577579

578-
A Consumer MAY use a registry to retrieve Type Metadata for a type,
580+
A Consumer MAY use a registry to retrieve Type Metadata for a SD-JWT VC type,
579581
e.g., if the type is not a HTTPS URL or if the Consumer does not have
580582
access to the URL. The registry MUST be a trusted registry, i.e., the Consumer MUST trust the registry to provide correct Type Metadata for the type.
581583

@@ -590,15 +592,15 @@ retrieve Type Metadata based on a URN in the `vct` claim.
590592

591593
### From a Local Cache {#retrieval-from-local-cache}
592594

593-
A Consumer MAY cache Type metadata for a type. If a hash for integrity
595+
A Consumer MAY cache Type Metadata for a SD-JWT VC type. If a hash for integrity
594596
protection is present in the Type Metadata as defined in (#document-integrity), the Consumer MAY assume that the Type Metadata is static and can be cached
595597
indefinitely. Otherwise, the Consumer MUST use the `Cache-Control`
596598
header of the HTTP response to determine how long the metadata can be cached.
597599

598600
### From Type Metadata Glue Documents {#glue-documents}
599601

600602
Credentials MAY encode Type Metadata directly, providing it as "glue
601-
information" to the consumer.
603+
information" to the Consumer.
602604

603605
For JSON-serialized JWS-based credentials, such Type Metadata documents MAY be
604606
included in the unprotected header of the JWS. In this case, the key `vctm` MUST
@@ -618,13 +620,146 @@ array instead of retrieving the respective Type Metadata elsewhere as follows:
618620
Type Metadata document matches that of the `vct` in the Type Metadata document, and it MUST verify the integrity of the Type Metadata document as defined in
619621
(#document-integrity). The Consumer MUST NOT use the Type Metadata if no hash for integrity protection was provided.
620622

623+
## Extending Type Metadata {#extending-type-metadata}
624+
625+
An SD-JWT VC type can extend another type. The extended type is identified by the URI in
626+
the `extends` property. Consumers MUST retrieve and process
627+
Type Metadata for the extended type before processing the Type Metadata for the extending
628+
type.
629+
630+
The extended type MAY itself extend another type. This can be used to create a
631+
chain or hierarchy of types. The security considerations described in
632+
(#circular-extends) apply in order to avoid problems with circular dependencies.
633+
634+
## Schema Type Metadata {#schema-type-metadata}
635+
636+
### Schema Definition {#schema-definition}
637+
638+
Schemas for Verifiable Credentials are contained in the `schema` or retrieved via the `schema_uri` Type Metadata parameters (as defined in (#type-metadata-format)).
639+
A schema MUST be represented by a JSON Schema document according to draft version 2020-12 [@JSON.SCHEMA.2020-12] or above.
640+
641+
The schema of a Verifiable Credential MUST include all properties that are required by this specification and MUST NOT override their cardinality, JSON data type, or semantic intent.
642+
643+
The following is a non-normative example of a JSON Schema document for the example in (#vc-sd-jwt-example) requiring the presence of the `cnf` claim in an SD-JWT VC presentation:
644+
645+
```
646+
{
647+
"$schema":"https://json-schema.org/draft/2020-12/schema",
648+
"type":"object",
649+
"properties":{
650+
"vct":{
651+
"type":"string"
652+
},
653+
"iss":{
654+
"type":"string"
655+
},
656+
"nbf":{
657+
"type":"number"
658+
},
659+
"exp":{
660+
"type":"number"
661+
},
662+
"cnf":{
663+
"type":"object"
664+
},
665+
"status":{
666+
"type":"object"
667+
},
668+
"given_name":{
669+
"type":"string"
670+
},
671+
"family_name":{
672+
"type":"string"
673+
},
674+
"email":{
675+
"type":"string"
676+
},
677+
"phone_number":{
678+
"type":"string"
679+
},
680+
"address":{
681+
"type":"object",
682+
"properties":{
683+
"street_address":{
684+
"type":"string"
685+
},
686+
"locality":{
687+
"type":"string"
688+
},
689+
"region":{
690+
"type":"string"
691+
},
692+
"country":{
693+
"type":"string"
694+
}
695+
}
696+
},
697+
"birthdate":{
698+
"type":"string"
699+
},
700+
"is_over_18":{
701+
"type":"boolean"
702+
},
703+
"is_over_21":{
704+
"type":"boolean"
705+
},
706+
"is_over_65":{
707+
"type":"boolean"
708+
}
709+
},
710+
"required":[
711+
"iss",
712+
"vct",
713+
"cnf"
714+
]
715+
}
716+
```
717+
718+
Note that `iss` and `vct` are always required by this specification.
719+
720+
### Schema Validation {#schema-validation}
721+
722+
If a `schema` or `schema_uri` property is present, a Consumer MUST validate the JSON document resulting from the SD-JWT verification algorithm
723+
(as defined in Section 8 of [@!I-D.ietf-oauth-selective-disclosure-jwt]) against the JSON Schema document provided by the `schema` or `schema_uri` property.
724+
725+
If an `extends` property is present, the schema of the extended type MUST also be validated in the same manner. This process includes
726+
validating all subsequent extended types recursively until a type is encountered that does not contain an `extends` property in its Type Metadata.
727+
Each schema in this chain MUST be evaluated for a specific Verifiable Credential.
728+
729+
If the schema validation fails for any of the types in the chain, the Consumer MUST reject the Verifiable Credential.
730+
731+
The following is a non-normative example of a result JSON document after executing the SD-JWT verification algorithm that is validated against the JSON Schema document in the example provided in (#schema-definition):
732+
733+
```
734+
{
735+
"vct":"https://credentials.example.com/identity_credential",
736+
"iss":"https://example.com/issuer",
737+
"iat":1683000000,
738+
"exp":1883000000,
739+
"sub":"6c5c0a49-b589-431d-bae7-219122a9ec2c",
740+
"address":{
741+
"country":"DE"
742+
},
743+
"cnf":{
744+
"jwk":{
745+
"kty":"EC",
746+
"crv":"P-256",
747+
"x":"TCAER19Zvu3OHF4j4W4vfSVoHIP1ILilDls7vCeGemc",
748+
"y":"ZxjiWWbZMQGHVWKVQ4hbSIirsVfuecCE6t4jT9F2HZQ"
749+
}
750+
}
751+
}
752+
```
753+
754+
Note, the example above does not contain any `_sd_alg`, `_sd`, or `...` claims.
755+
621756
# Document Integrity {#document-integrity}
622757

623-
Both the `vct` claim in the SD-JWT VC and various URIs in the metadata
624-
document MAY be accompanied by a respective claim suffixed with `#integrity`, in particular:
758+
Both the `vct` claim in the SD-JWT VC and the various URIs in the Type Metadata MAY be accompanied by a respective claim suffixed with `#integrity`, in particular:
625759

626760
* `vct` as defined in (#claims),
627761
* `extends` as defined in (#extending-type-metadata)
762+
* `schema_uri` as defined in (#schema-type-metadata)
628763

629764
The value MUST be an "integrity metadata" string as defined in Section 3 of
630765
[@!W3C.SRI]. A Consumer of the respective documents MUST verify the
@@ -889,6 +1024,13 @@ recommendations in (#robust-retrieval) apply.
8891024
<title>The European Digital Identity Wallet Architecture and Reference Framework</title>
8901025
</front>
8911026
</reference>
1027+
1028+
<reference anchor="JSON.SCHEMA.2020-12" target="https://json-schema.org/draft/2020-12/release-notes">
1029+
<front>
1030+
<author fullname="OpenJS Foundation"></author>
1031+
<title>JSON Schema (2020-12)</title>
1032+
</front>
1033+
</reference>
8921034
{backmatter}
8931035

8941036
# IANA Considerations
@@ -898,12 +1040,12 @@ recommendations in (#robust-retrieval) apply.
8981040
- Claim Name: "vct"
8991041
- Claim Description: Verifiable credential type identifier
9001042
- Change Controller: IETF
901-
- Specification Document(s): [[ (#type-claim) of this of this specification ]]
1043+
- Specification Document(s): [[ (#type-claim) of this of this specification ]]
9021044

9031045
- Claim Name: "vct#integrity"
9041046
- Claim Description: SD-JWT VC vct claim "integrity metadata" value
9051047
- Change Controller: IETF
906-
- Specification Document(s): [[ (#document-integrity) of this of this specification ]]
1048+
- Specification Document(s): [[ (#document-integrity) of this of this specification ]]
9071049

9081050
## Media Types Registry
9091051

@@ -1013,6 +1155,7 @@ for their contributions (some of which substantial) to this draft and to the ini
10131155
* Include Type Metadata
10141156
* Editorial changes
10151157
* Updated terminology to clarify digital signatures are one way to secure VCs and presentations
1158+
* Include schema Type Metadata
10161159

10171160
-03
10181161

0 commit comments

Comments
 (0)