Credential Schemas
Our credential schemas ensure user data is predictably structured. We use JSON Schema syntax for data validation purposes via a pre-compiled AJV engine. This makes our schemas robust enough to encapsulate any data while still being easily described, displayed, and validated.
All Verified credential schemas are accessible at https://schema.verified.inc/schema. To get the schema for a particular credential type, use the same URL with the credential type in the path. For example, https://schema.verified.inc/schema/AddressCredential yields the schema for an AddressCredential
.
These schemas are documented in our public Postman collection under Schema Resolver. We recommend using Postman for this because it formats the schema JSON for easier readability.
If our current credential schemas don't accommodate your use case, please reach out to us at Support@Verified.inc and we'll be happy to create new schemas for you.
Schema Definitions
We currently support what can be referred to as "single attribute atomic credentials" and "composite credentials".
Atomic credentials provide users a means of selective disclosure for
Composite credentials are credentials that contain multiple "Atomic Credentials". For example, the FullNameCredential
contains FirstNameCredential
, LastNameCredential
and MiddleNameCredential
. This provides a means of grouping atomic credentials with related data.
JSON Schema
The /jsonSchema
path will return the JSON schema definition, e.g. https://schema.verified.inc/jsonSchema/FirstNameCredential:
{
"$id": "FirstNameCredential",
"type": "object",
"properties": {
"firstName": {
"description": "A person's first name",
"examples": ["John", "Mary Kate"],
"title": "First Name",
"displayFormat": "String",
"type": "string"
}
},
"required": ["firstName"]
}
For composite credential schemas, the object will contain a allOf
property, which is an array of the atomic credential schemas:
{
"$id": "FullNameCredential",
"type": "object",
"allOf": [
{
"$ref": "FirstNameCredential"
},
{
"$ref": "LastNameCredential"
},
{
"$ref": "MiddleNameCredential"
}
]
}
Note that each attribute has a description
and examples
to help you understand the credential's schema. If you need more detailed information, look at our open source schema-sdk formats.
The $ref
property is a JSON Pointer, which is a string containing a URI fragment identifier. In this case, it is a reference to another schema. This is how we define composite credential schemas.
It's important to note that each of these credentials inside FullNameCredential
are single attribute atomic credentials, so you are able to request individually.
But if you need create or request a CityCredential
and a StateCredential
you will need to use AddressCredential
so data doesn't get mismatched.
Schema Library
Search for or select a schema, see its properties and attributes, and copy the schema JSON:
Example
First, we get the JSON schemas for the SsnCredential
, FullNameCredential
, which contains FirstNameCredential
and LastNameCredential
and review their attributes' description
s and examples
.
Next, we construct valid credential bodies, according to the schemas:
/*The credential data compliant with the Ssn, FullName (FirstName and LastName) Credentials schemas*/
const credentialsList: Credentials = [
{
type: 'SsnCredential',
data: {
ssn: '333224444',
},
},
{
type: 'FullNameCredential',
data: [
{
type: 'FirstNameCredential',
data: {
firstName: 'John',
},
},
{
type: 'LastNameCredential',
data: {
lastName: 'Doe',
},
},
],
},
];
{
"credentials": credentialsList, // a list of one or more Credentials objects
"email": "richard.hendricks@pipedpiper.net"
}