Abstract

Among other things, the [[VC-DATA-MODEL-2.0]] specifies the models used for Verifiable Credentials, Verifiable Presentations, and explains the relationships between three parties: issuers, holders, and verifiers. Verifiability, extensibility, and semantic interoperability are critical pieces of functionality referenced throughout the [[VC-DATA-MODEL-2.0]]. This specification provides a mechanism to make use of a Credential Schema in Verifiable Credential, leveraging the existing Data Schemas concept.

Status of This Document

The Working Group is actively seeking implementation feedback for this specification. In order to exit the Candidate Recommendation phase, the Working Group has set the requirement of at least two independent implementations for each mandatory feature in the specification. For details on the conformance testing process, see the test suites listed in the implementation report.

Introduction

This specification provides a mechanism for the use of JSON Schemas with Verifiable Credentials. A significant part of the integrity of a Verifiable Credential comes from the ability to structure its contents so that all three parties — issuer, holder, verifier — may have a consistent mechanism of trust in interpreting the data that they are provided with. We introducing a new data model for an object to facilitate backing Credentials with JSON Schemas that we call a Credential Schema.

This specification provides a standardized way of creating Credential Schemas to be used in credentialing systems. Credential Schemas may apply to any portion of a Verifiable Credential. Multiple JSON Schemas may back a single Verifiable Credential, e.g. a schema for the `credentialSubject` and another for other credential properties.

Terminology

Data Model

The following sections outline the data models for this document, of which there are two: JsonSchema for usage of a [[JSON-SCHEMA]] directly in a credentialSchema property, and JsonSchemaCredential for usage of a [[JSON-SCHEMA]] represented as a verifiable credential.

Implementers MAY package a [[JSON-SCHEMA]] as a verifiable credential when they wish to leverage features of the [[VC-DATA-MODEL-2.0]], answering questions such as:

JsonSchema

This term is part of the Verifiable Credentials Vocabulary v2.0.

JsonSchema is used for the validation of W3C Verifiable Credentials using JSON Schema. When dereferencing the id property associated with the JsonSchema type value the result is a valid JSON Schema document according to its specification version.

The specification version of [[JSON-SCHEMA]] can be any version noted in the section on JSON Schema Specifications.

Property Description
id The constraints on the id property are listed in the Verifiable Credentials Data Model specification [[VC-DATA-MODEL-2.0]]. The value MUST be a URL that identifies the schema associated with the verifiable credential.
type The type property MUST be JsonSchema.

The jsonSchema property is only to be used when the JsonSchema class instance is the object of the credentialSubject property within a JsonSchemaCredential instance.

An example of utilizing the VC Data Model's credentialSchema is provided below:

               {
                 "@context": [
                   "https://www.w3.org/ns/credentials/v2",
                   "https://www.w3.org/ns/credentials/examples/v2"
                 ],
                 "id": "https://example.com/credentials/3732",
                 "type": ["VerifiableCredential", "EmailCredential"],
                 "issuer": "https://example.com/issuers/14",
                 "issuanceDate": "2010-01-01T19:23:24Z",
                 "credentialSubject": {
                   "id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
                   "emailAddress": "subject@example.com"
                 },
                 "credentialSchema": {
                   "id": "https://example.com/schemas/email.json",
                   "type": "JsonSchema"
                 }
               }
              

Upon dereferencing the value of the id https://example.com/schemas/email.json, a process also be referred to as schema resolution, the following JSON Schema document is returned:

              {
                "$id": "https://example.com/schemas/email.json",
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "title": "EmailCredential",
                "description": "EmailCredential using JsonSchema",
                "type": "object",
                "properties": {
                  "credentialSubject": {
                    "type": "object",
                    "properties": {
                      "emailAddress": {
                        "type": "string",
                        "format": "email"
                      }
                    },
                    "required": [
                      "emailAddress"
                    ]
                  }
                }
              }
              

JsonSchemaCredential

This term is part of the Verifiable Credentials Vocabulary v2.0.

JsonSchemaCredential is used for the validation of W3C Verifiable Credentials using JSON Schema, where the JSON Schema is contained with a verifiable credential. When dereferencing the id property associated with the credentialSchema type value, the result is a valid verifiable credential. For the resulting verifiable credential:

Any version of [[JSON-SCHEMA]] in the section on JSON Schema Specifications can be used.

Property Description
id The constraints on the id property are listed in the Verifiable Credentials Data Model specification [[VC-DATA-MODEL-2.0]]. The value MUST be a URL that identifies the verifiable credential which contains a credential schema.
type The type property MUST be JsonSchemaCredential.
credentialSubject.id The credentialSubject's id property MUST follow the guidance provided for identifiers in the [[VC-DATA-MODEL-2.0]] specification.
credentialSubject.type The credentialSubject's type property MUST be JsonSchema.
credentialSubject.jsonSchema The credentialSubject MUST use the jsonSchema property to represent a valid [[JSON-SCHEMA]].

An example of utilizing the VC Data Model's credentialSchema is provided below:
               {
                 "@context": [
                   "https://www.w3.org/ns/credentials/v2",
                   "https://www.w3.org/ns/credentials/examples/v2"
                 ],
                 "id": "https://example.com/credentials/3733",
                 "type": ["VerifiableCredential", "ExampleEmailCredential"],
                 "issuer": "https://example.com/issuers/14",
                 "issuanceDate": "2010-01-01T19:23:24Z",
                 "credentialSubject": {
                   "id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
                   "emailAddress": "subject@example.com"
                 },
                 "credentialSchema": {
                   "id": "https://example.com/credentials/3734",
                   "type": "JsonSchemaCredential"
                 }
               }
              

Upon dereferencing the value of the id https://example.com/credentials/3734, a process also be referred to as schema resolution, the following verifiable credential, representing a JSON Schema, is returned:

              {
                "@context": [
                    "https://www.w3.org/ns/credentials/v2",
                    "https://www.w3.org/ns/credentials/examples/v2"
                ],
                "id": "https://example.com/credentials/3734",
                "type": ["VerifiableCredential", "JsonSchemaCredential"],
                "issuer": "https://example.com/issuers/14",
                "issuanceDate": "2010-01-01T19:23:24Z",
                "credentialSchema": {
                  "id": "https://www.w3.org/2022/credentials/v2/json-schema-credential-schema.json",
                  "type": "JsonSchema",
                  "digestSRI": "sha384-S57yQDg1MTzF56Oi9DbSQ14u7jBy0RDdx0YbeV7shwhCS88G8SCXeFq82PafhCrW"
                },
                "credentialSubject": {
                  "id": "https://example.com/schemas/email-credential-schema.json",
                  "type": "JsonSchema",
                  "jsonSchema": {
                     "$id": "https://example.com/schemas/email-credential-schema.json",
                     "$schema": "https://json-schema.org/draft/2020-12/schema",
                     "title": "EmailCredential",
                     "description": "EmailCredential using JsonSchemaCredential",
                     "type": "object",
                     "properties": {
                       "credentialSubject": {
                         "type": "object",
                         "properties": {
                           "emailAddress": {
                             "type": "string",
                             "format": "email"
                           }
                         },
                         "required": ["emailAddress"]
                       }
                     }
                  }
                }
              }
              

jsonSchema

This term is part of the Verifiable Credentials Vocabulary v2.0.

jsonSchema enables the use of the jsonSchema property within the credentialSubject of a verifiable credential. The term is intended to be used with the type only. The value of the jsonSchema property MUST be a valid [[JSON-SCHEMA]].

                  {
                   "@context": [
                       "https://www.w3.org/ns/credentials/v2",
                       "https://www.w3.org/ns/credentials/examples/v2"
                   ],
                   "id": "https://example.com/credentials/3734",
                   "type": ["VerifiableCredential", "JsonSchemaCredential"],
                   "issuer": "https://example.com/issuers/14",
                   "issuanceDate": "2010-01-01T19:23:24Z",
                   "credentialSchema": {
                     "id": "https://www.w3.org/2022/credentials/v2/json-schema-credential-schema.json",
                     "type": "JsonSchema",
                   },
                   "credentialSubject": {
                     "id": "https://example.com/schemas/favorite-color-schema.json",
                     "type": "JsonSchema",
                      "jsonSchema": {
                        "$id": "https://example.com/schemas/favorite-color-schema.json",
                        "$schema": "https://json-schema.org/draft/2020-12/schema",
                        "title": "Favorite Color Schema",
                        "description": "Favorite Color using JsonSchemaCredential",
                        "type": "object",
                        "properties": {
                          "credentialSubject": {
                            "type": "object",
                            "properties": {
                              "favoriteColor": {
                                "type": "string"
                                "enum": ["red", "orange", "green", "blue", "yellow", "purple"]
                              }
                            },
                            "required": ["favoriteColor"]
                          }
                        }
                     }
                     
                   }
                 }
                 

JSON Schema Specifications

The following section describes the allowed specifications for using a [[JSON-SCHEMA]] with a credential schema.

To promote conformance and enable interoperability, implementers MUST provide support for JSON Schema specifications where, in the following table, the required column's value is yes.

JSON Schema Specification Date of Publication $schema URI Required
[[JSON-SCHEMA-2020-12]] 10 June 2022 https://json-schema.org/draft/2020-12/schema Yes
[[?JSON-SCHEMA-2019-09]] 19 March 2020 https://json-schema.org/draft/2019-09/schema No
[[?JSON-SCHEMA-DRAFT-7]] 20 September 2018 http://json-schema.org/draft-07/schema# No

A stable JSON Schema specification is in the works. When it's released, we intend to update this table to require the stable version.

Reserved Keywords

JSON Schema specifications reserve certain keywords that hold specific meanings and functions during the processing of JSON Schemas. It is crucial to avoid using conflicting keys when creating JSON Schemas. The specification document for each version of JSON Schema lists these reserved keywords, which can be found in the table provided above.

In the upcoming sections we list some keywords that possess unique significance in [[JSON-SCHEMA]] documents and SHOULD NOT be used in conflicting ways, such as redefining these keywords, or using them in a manner other than as noted by [[JSON-SCHEMA]] specifications.

Furthermore, we identify specific keywords, that are not explicitly defined by JSON Schema, but are emphasized in this specification to support widespread usage.

$id

Across JSON Schema specifications, the $id keyword identifies a schema resource with its canonical URI. The $id MUST be present, and its value MUST represent a valid URI-reference as specified by the associated [[JSON-SCHEMA]] version.

It is RECOMMENDED that the value of the $id property match the id value in the credentialSchema object of a verifiable credential, and that the value of the $id is a dereferenceable URL.

$schema

Across JSON Schema specifications, the $schema keyword identifies a JSON Schema providing the feature set for a given JSON Schema specification. This property MUST be present in each schema. For example, when constructing a schema for Draft 2020-12 the value of the $schema identifier MUST be https://json-schema.org/draft/2020-12/schema.

title

It is RECOMMENDED that all JSON Schemas include the optional title property as defined in [[JSON-SCHEMA]].

description

It is RECOMMENDED that all JSON Schemas include the optional description property as defined in [[JSON-SCHEMA]].

lang

JSON Schemas SHOULD choose to include an optional lang property that indicates the language tag for the values of the [=title=] and [=description=] properties defined in the JSON Schema. The value of this field MUST be a canonical unicode locale identifier. When absent, implementers MUST assume that the value of this property is `und`.

dir

JSON Schemas SHOULD choose to include an optional dir property that indicates the base direction for the values of the [=title=] and [=description=] properties defined in the JSON Schema. The value of this property MUST be a text-direction. When absent, implementers MUST assume that the value of this property is "[=text-direction/auto=]".

The text-directions are the following:

"ltr"
Left-to-right text.
"rtl"
Right-to-left text.
"auto" (default)
No explicit directionality.

Representations of JSON Schema

The standard representation of [[JSON-SCHEMA]] uses the [[RFC8259]] JSON data interchange syntax with .json as the file extension.

Implementers MAY use OpenAPI Specification's [[[OPENAPIS-3.1.0]]] [[YAML]] representation of a [[JSON-SCHEMA]] with .yaml as the file extension.

YAML representations of JSON Schemas can only be used with credential schemas whose type is JsonSchema.

An example [[JSON-SCHEMA]] using [[YAML]] is provided below.

            

Processing

This section details how to process Credential Schemas, which is commonly referred to as JSON schema validation.

There are many open source implementations of [[JSON-SCHEMA]] validators across many common programming languages. The OpenJS Foundation maintains a list of implementations as a part of the JSON Schema official documentation.

A common feature of a JSON Schema validator is the ability to detect the version of a JSON Schema document and select the validator for that specific version of [[JSON-SCHEMA]]. This is done by switching on the schema's $schema property and picking the corresponding validator. Schemas without a $schema property are not considered valid and MUST NOT be processed. Implementers SHOULD choose validators which possess this capability and are able to limit validation to the JSON Schema specifications supported by this document.

Conformant implementers MUST support JSON Schema specification versions marked as required in the table defined in the JSON Schema specifications section of this document. Implementers MAY support JSON Schema specification versions not marked as required.

Integrity Validation

Credential Schemas MAY be packaged as verifiable credentials as defined by usage of the JsonSchemaCredential type. The credential containing a credential schema MAY be secured by using either an embedded or external proof as defined in Securing Verifiable Credentials.

Secured credentials representing credential schemas SHOULD first be validated according to the rules set out in the aforementioned securing specifications before proceeding with additional processing.

Provide examples for secured credential schemas.

Credential Schemas of type JsonSchema MAY be annotated with integrity information by adding the `digestSRI` property to the `credentialSchema` value in the Verifiable Credential which contains the schema, using the method specified in Integrity of Related Resources. It is RECOMMENDED that validation of the integrity of the schema be done before evaluation.

An example of such usage is provided below:

         {
           "@context": [
             "https://www.w3.org/ns/credentials/v2",
             "https://www.w3.org/ns/credentials/examples/v2"
           ],
           "id": "https://example.com/credentials/3733",
           "type": ["VerifiableCredential", "EmailCredential"],
           "issuer": "https://example.com/issuers/14",
           "issuanceDate": "2010-01-01T19:23:24Z",
           "credentialSubject": {
             "id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
             "emailAddress": "subject@example.com"
           },
           "credentialSchema": {
             "id": "https://example.com/schemas/email.json",
             "type": "JsonSchema",
             "digestSRI": "sha384-dNwyy/Zs/YjPor8aoOgnaCqb+PH24QcNFxbxM1XoBOxdbgnpQcVaGYH8QunXww2U"
           }
         }
        

Evaluation

Validation of a given credential against a schema is to be performed according to its associated [[JSON-SCHEMA]] specification. Validation MUST result in one of the following three possible outcomes:

Examples for the Success and Failure possible outcomes are provided below.

Success Result

               {
                 "$id": "https://example.com/schemas/email.json",
                 "$schema": "https://json-schema.org/draft/2020-12/schema",
                 "title": "EmailCredential",
                 "description": "EmailCredential using JsonSchema",
                 "type": "object",
                 "properties": {
                   "credentialSubject": {
                     "type": "object",
                     "properties": {
                       "emailAddress": {
                         "type": "string",
                         "format": "email"
                       }
                     },
                     "required": ["emailAddress"]
                    }
                  }
               }
               

Validation according to the spec [[JSON-SCHEMA-2020-12]] yields a Success result when applying it to the VC below.

               {
                 "@context": [
                   "https://www.w3.org/ns/credentials/v2",
                   "https://www.w3.org/ns/credentials/examples/v2"
                 ],
                 "id": "https://example.com/credentials/3732",
                 "type": ["VerifiableCredential", "EmailCredential"],
                 "issuer": "https://example.com/issuers/14",
                 "issuanceDate": "2010-01-01T19:23:24Z",
                 "credentialSubject": {
                   "id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
                   "emailAddress": "subject@example.com"
                 },
                 "credentialSchema": {
                   "id": "https://example.com/schemas/email.json",
                   "type": "JsonSchema"
                 }
               }
               

Failure Result

Validation according to the spec [[JSON-SCHEMA-2020-12]] yields a Failure result when applying it to the VC below.

                {
                  "@context": [
                    "https://www.w3.org/ns/credentials/v2",
                    "https://www.w3.org/ns/credentials/examples/v2"
                  ],
                  "id": "https://example.com/credentials/3732",
                  "type": ["VerifiableCredential", "EmailCredential"],
                  "issuer": "https://example.com/issuers/14",
                  "issuanceDate": "2010-01-01T19:23:24Z",
                  "credentialSubject": {
                    "id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
                    "emailAddress": "not an email"
                  },
                  "credentialSchema": {
                    "id": "https://example.com/schemas/email.json",
                    "type": "JsonSchema"
                  }
                }
               

Indeterminate Result

Assuming that the implementer does not support [[?JSON-SCHEMA-2019-09]], an example of an Indeterminate evaluation is provided below.

                {
                  "$id": "https://example.com/schemas/email.json",
                  "$schema": "https://json-schema.org/draft/2019-09/schema",
                  "title": "EmailCredential",
                  "description": "EmailCredential using JsonSchema",
                  "type": "object",
                  "properties": {
                    "credentialSubject": {
                      "type": "object",
                      "properties": {
                        "emailAddress": {
                          "type": "string",
                          "format": "email"
                        }
                      },
                      "required": [
                        "emailAddress"
                      ]
                    }
                  }
                }
               

             {
               "@context": [
                 "https://www.w3.org/ns/credentials/v2",
                 "https://www.w3.org/ns/credentials/examples/v2"
               ],
               "id": "https://example.com/credentials/3732",
               "type": ["VerifiableCredential", "EmailCredential"],
               "issuer": "https://example.com/issuers/14",
               "issuanceDate": "2010-01-01T19:23:24Z",
               "credentialSubject": {
                 "id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
                 "emailAddress": "not an email"
               },
               "credentialSchema": {
                 "id": "https://example.com/schemas/email.json",
                 "type": "JsonSchema"
               }
             }
             

Implementation Considerations

This section details some issues implementers of the specification may consider.

Credential Property Validation

Implementers may wish to validate certain properties in a verifiable credential. To do this, credential schemas can be constructed to validate subsets of a credential's data.

One example of such a construction would be to validate the presence of certain top-level properties in a verifiable credential. The following example demonstrates a schema which enforces that a credential issued against it has an validUntil property and includes evidence.

            {
              "$id": "validuntil-and-evidence-schema",
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "title": "Example validUntil and evidence schema",
              "description": "Schema requiring validUntil and evidence properties",
              "type": "object",
              "properties": {
                "validUntil": {
                  "type": "object"
                },
                "evidence": {
                  "type": "object"
                }
              },
              "required": ["validUntil", "evidence"]
            }
            

Additional Properties

When using [[JSON-SCHEMA]], it is advised that implementers avoid setting the additionalProperties to false. Doing so could inadvertently exclude properties in a credential from passing validation.

As an example, consider a credential schema that is intended to validate the credentialSubject property of a credential. It is common for the credentialSubject property to include an id, denoting the identifier the subject. Not including this id property in a given schema would result in validation failure. The simple alternative is to avoid setting additionalProperties to false.

            {
              "$id": "name-schema",
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "title": "Name schema",
              "description": "A schema capturing a human name",
              "type": "object",
              "properties": {
                "credentialSubject": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "object",
                      "properties": {
                        "firstName": {
                          "type": "string"
                        },
                        "lastName": {
                          "type": "string"
                        },
                        "additionalProperties": false
                      },
                      "required": [
                        "firstName",
                        "lastName"
                      ]
                    }
                  }
                }
              }
            }
            

Versioning

Versioning is not provided as an explicit feature of this specification. Implementers are advised to make backwards compatabile changes to schemas, should they be adjusted. Otherwise, it is advised that new credential schemas be created with unique identifiers to avoid processing conflicts.

Content Integrity Protection

It is important to make sure that credential schemas have not been tampered with before processing. When making use of the JsonSchemaCredential2023 representation of a schema, the credential's associated integrity protection mechanism can be used to detect mutations of a credential schema via its digital signature.

As an alternative, the aforementioned Integrity of Related Resources scheme may be used to provide content integrity protection, ensuring that the underlying credential schema resource has not been tampered with.

Storage

Credential schemas can be stored on any number of storage media such as a distributed ledger, traditional database, or decentralized file storage. For more robust availability guarantees, the same schema could be replicated across multiple file stores.

Multiple Schemas

A common use case is to include multiple schemas to validate against a single verifiable Credential. One such use case is to use the JSON Schema defined by the [[VC-DATA-MODEL-2.0]] in addition to a schema to validate a specific property in the credential, such as the credentialSubject. Multiple schemas MAY be combined using native constructs from the [[JSON-SCHEMA]] specification, through use of properties such as oneOf, anyOf, or allOf.

An example of how to construct such a schema using the [[JSON-SCHEMA]] property allOf is provided below, combining schemas for a verifiable credential, name, and email address:

            {
              "allOf": [
                {
                  "$ref": "https://raw.githubusercontent.com/w3c/vc-data-model/main/schema/verifiable-credential/verifiable-credential-schema.json"
                },
                {
                  "$id": "name-schema",
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "title": "Name schema",
                  "description": "A schema capturing a human name",
                  "type": "object",
                  "properties": {
                    "credentialSubject": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "object",
                          "properties": {
                            "firstName": {
                              "type": "string"
                            },
                            "lastName": {
                              "type": "string"
                            },
                            "additionalProperties": false
                          },
                          "required": [
                            "firstName",
                            "lastName"
                          ]
                        }
                      }
                    }
                  }
                },
                {
                  "$id": "email-schema-1.0",
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "title": "Email schema",
                  "description": "A schema requiring an email address.",
                  "type": "object",
                  "properties": {
                    "credentialSubject": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "object",
                          "properties": {
                            "emailAddress": {
                              "type": "string",
                              "format": "email"
                            }
                          },
                          "required": ["emailAddress"]
                        }
                      }
                    }
                  }
                }
              ]
            }
            

The example above is used to validate every property in the following verifiable credential:

            {
                "@context": ["https://www.w3.org/ns/credentials/v2"],
                "id": "4995c86c-851f-43a6-9dd2-03dc891091fd",
                "type": ["VerifiableCredential"],
                "issuer": "did:example:1234",
                "validFrom": "2023-01-01T05:05:05Z",
                "credentialSubject": {
                    "firstName": "Alice",
                    "lastName": "Bobertson",
                    "emailAddress": "alice@bobertson.com"
                },
                "credentialSchema": {
                    "id": "multiple-credential-schema-test",
                    "type": "JsonSchemaCredential"
                }
            }
            

Using `allOf` when composing a JSON Schema can easily result in a schema for which all JSON documents will fail to validate. Such a situation may happen when multiple schemas reference the same property. Implementers are advised to test their schemas against a set of sample input documents before introducing any real world usage. Including sample input that suceeds and fails is considered a good practice.

Validity of a Verifiable Credential

Validation against a [[JSON-SCHEMA]] may be confused with validation or verification of a Verifiable Credential. A valid credential according to a [[JSON-SCHEMA]] refers only to the structure of the claims comprising a Verifiable Credential. This idea of validity does not imply anything about the validity of the Verifiable Credential itself. It's possible for a Verifiable Credential to be considered valid by one verifier, while another verifier would not consider it valid.

Relationship to Verifiable Credential Type Property

It is common to define a credential schema that will be set for Verifiable Credentials whose type property contains a specific type. In this scenario, it is advised to use the value of the specific type in the id or in a name or description property. of a [[JSON-SCHEMA]].

The example below illustrates this for EmailCredential:

              {
                "@context": [
                  "https://www.w3.org/ns/credentials/v2",
                  "https://www.w3.org/ns/credentials/examples/v2"
                ],
                "id": "https://example.com/credentials/email-credential",
                "type": ["VerifiableCredential", "EmailCredential"],
                "issuer": "https://example.com/issuers/14",
                "issuanceDate": "2010-01-01T19:23:24Z",
                "credentialSubject": {
                  "id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
                  "emailAddress": "tester@example.com"
                },
                "credentialSchema": {
                  "id": "https://example.org/examples/email.json",
                  "type": "JsonSchema"
                }
              }
            

              {
                "$id": "https://example.com/schemas/email.json",
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "title": "Email Credential",
                "description": "Email Credential Schema for usage in JsonSchema",
                "type": "object",
                "properties": {
                  "credentialSubject": {
                    "type": "object",
                    "properties": {
                      "emailAddress": {
                        "type": "string",
                        "format": "email"
                      }
                    },
                    "required": [
                      "emailAddress"
                    ]
                  }
                }
              }
            

It is important to note that a credential schema enables issuers to communicate how to process the structure of data inside a verifiable credential, whereas the type property of a verifiable credential lets issuers communicate the semantics of the data. It is advised to associate all properties that have a semantic mapping with a property in a credential schema.

Privacy Considerations

This section details the general privacy considerations and specific privacy implications of deploying this specification into production environments.

When using the JsonSchemaCredential type, implementers are advised to review the Privacy Considerations outlined in the [[VC-DATA-MODEL-2.0]].

Personally Identifiable Information

Data associated with schemas and verifiable credentials are susceptible to privacy violations when shared. Personally identifying data, such as a government-issued identifier, address, or name, can be used to track and correlate entities. Even less overt personal data such as a birthdate or postal code has the ability to result in correlation and de-anonymization.

Implementers are strongly advised to avoid constructing schemas with any personally identifiable information (PII).

If such personally identifiable information is necessary in a schema, or a credential schema, implementers are strongly advised to use mechanisms while storing and transporting verifiable credentials that protect the data from those who should not access it such as Transportation Layer Security (TLS) or other means of encrypting the data whether in transit or at rest.

Verifier Caching

Since schemas are immutable, they are highly cachable. It is possible for verifiers to increase the privacy of the holder whose verifiable credential is being checked by caching schemas that have been fetched from remote servers. By caching the content locally, less correlatable information can be inferred from verifier-based access patterns on the schema.

Schema Resolution

Schema resolution is the process of dereferencing a credential schema's identifier in order to fetch a credential schema.

Issuers can increase the privacy of holders by using content distribution networks to reduce or eliminate requests for the schemas from the issuer. Often, a request for a schema will be served by an edge device and thus be faster and reduce the load on the server as well as cloaking verifiers and holders from issuers.

Furthermore, the use of Oblivious HTTP can prevent linkage of schema requests made by holders. Implementers are encouraged to allow configuration of an Oblivious Relay Resource for use during schema resolution.

When using credential schema identifiers that are unique to the issued credential, it is possible to correlate schema resolution of a credential with an IP address. Implementers are encouraged to prevent such correlation by selecting identifiers which are shared among a class of credentials.

Data Minimization

Data minimization refers to the principle of sharing the minimum necessary data for any given data request, such as a verifier requesting one or more verifiable credentials from a holder.

When using a credential schema with a credential that supports selective disclosure, it may be possible for a verifier to deduce additional attributes that would be available but were not presented when verifying a credential from a holder. To mitigate data leakage, holders may choose to reject verification requests that could disclose such additional attributes, or, if the capability is available, to selectively disclose properties in the associated credential schema. To enable this functionality, issuers can use selective disclosure schemes when creating credential schemas using the JsonCredentialSchema type.

Security Considerations

There are a number of security considerations that implementers should be aware of when processing data described by this specification. Ignoring or not understanding the implications of this section can result in security vulnerabilities.

When using the JsonSchemaCredential type, implementers are advised to review the Security Considerations outlined in the [[VC-DATA-MODEL-2.0]].

Issuer Impersonation

It is possible for a schema to become authoritative, such as a schema provided by a recognized industry group like a consortium of financial companies. To avoid confusion as to the authorship of credential schemas, it is advised that they be packaged as verifiable credentials using the JsonSchemaCredential type.

Accessibility Considerations

There are a number of accessibility considerations implementers should be aware of when processing data described in this specification. As with any web standards or protocols implementation, ignoring accessibility issues makes this information unusable to a large subset of the population. It is important to follow accessibility guidelines and standards, such as [[WCAG21]], to ensure all people, regardless of ability, can make use of this data. This is especially important when establishing systems utilizing cryptography, which have historically created problems for assistive technologies.

JSON Schemas are designed to be a machine-readable format which provides static validation. As such, human readability is a secondary concern. When using a verifiable credential to represent a schema, we recommend following the guidance in the VC Data Model.

Internationalization Considerations

JSON Schemas are JSON text intended primarily for machines to read, since they are used for strict static validation of data. Language and text direction concerns are addressed by the noted specification documents for JSON Schema itself.

When using a verifiable credential to represent a schema, we recommend following the guidance in the VC Data Model.

IANA Considerations

Media Types

JsonSchema

The media type application/schema+json, as defined in [[JSON-SCHEMA]], SHOULD be used when transmitting a [[JSON-SCHEMA]] expressed as JSON over HTTP. Clients receiving [[JSON-SCHEMA]] files over HTTP MAY accept content using either the application/schema+json media type or the application/json media type as defined in [[JSON]].

When using the JsonSchema type with a [[YAML]] representation of a [[JSON-SCHEMA]], defined by [[[OPENAPIS-3.1.0]]], the types application/openapi+yaml or application/yaml MAY be used.

JsonSchemaCredential

The media types application/vc+ld+json, application/vc+ld+json+jwt, or application/vc+ld+json+sd-jwt as defined in [[VC-DATA-MODEL-2.0]], [[VC-JOSE-COSE]], or [[SD-JWT]] specifications, respectively, SHOULD be used when transmitting a [[JSON-SCHEMA]] represented as a verifiable credential with usage of the JsonSchemaCredential type. Clients receiving credential schemas files over HTTP MAY accept content using any of these types.

Revision History

This section contains the substantive changes that have been made to this specification over time.

Changes since the First Public Working Draft: