Schemas
cheqd support for Ledger-Agnostic AnonCreds schemas
Last updated
Was this helpful?
cheqd support for Ledger-Agnostic AnonCreds schemas
Last updated
Was this helpful?
Schemas are used to list a set of attributes. Issuers of Verifiable Credentials may reference schemas within Credentials they issue in order to provide a layer of semantic interoperability with other issuers utilising the same schema.
In the , schemas are written directly to a , rather than using a centralized service such as . Schemas are also referenced within Credential Definitions, which are used to link the schema, issuer and holder together ().
This documentation will guide an implementor of AnonCreds on cheqd on how the cheqd AnonCreds Object Method defines the structure of , the and the .
If you are not familiar with the latest Ledger-Agnostic AnonCreds Schema structure, click the collapsible tile below to learn about the new format.
cheqd uses to identify individual resources, associated with a DID, using fully resolvable DID URLs.
cheqd resources implementation uses the following path-based syntax:
did:cheqd:mainnet:<SchemaIssuerId>/resources/<SchemaId>
The cheqd AnonCreds object method uses a UUID to identify the Schema Object Content.
For example, the following DID URL is cheqd's representation of a schemaId
:
did:cheqd:mainnet:7BPMqYgYLQni258J8JPS8K/resources/6259d357-eeb1-4b98-8bee-12a8390d3497
The request format may be specific to each AnonCreds Object Method. However, the response format should be standardised to enable any AnonCreds supported application to understand the object, without needing custom or method-specific logic.
The cheqd schema request format comprises of:
A Resource file for the Schema object content (e.g. degreeSchema.json
); and
A Payload file (including the signing keys and additional inputs to create a DID-Linked Resource).
Both of these inputs are required to provide the ledger enough information to:
Before creating any on-ledger transaction, it is important to assemble the required Schema Object Content and save it as a file locally.
In the example below, the content should be saved as a JSON file, for example: degreeSchema.json
with the following content:
"name"
"name"
"version"
"version"
The Payload file utilises the inputs from the Resource file where possible, mapping common fields across. The Payload file may also require additional inputs to be provided by the creator to create a DID-Linked Resource for inputs not provided in the Resource file.
Below is an example of a Payload file:
"resourceType"
"anonCredsSchema"
The Payload file drawing inputs from the Resource file does not provide the ledger the requisite amount of information to create a full DID-Linked Resource. resourceType must be provided as an additional input parameter
For example, the full request format using a CLI should be structured as follows:
Once you have created your resource on cheqd, the following metadata will be generated in the DID Document Metadata associated with did:cheqd:mainnet:7BPMqYgYLQni258J8JPS8K
This can either be compiled by the associated SDK handling cheqd AnonCreds, or it can be assembled by the cheqd DID resolver.
The cheqd DID resolver will use the following logic to compile the standardised response format:
Existing DID Resolvers will be able to query for any AnonCreds Object Content using the following parameters:
"resourceId"
did:cheqd:mainnet:46e2af9a-2ea0-4815-999d-730a6778227c?resourceId=0f964a80-5d18-4867-83e3-b47f5a756f02
"resourceName"
did:cheqd:mainnet:46e2af9a-2ea0-4815-999d-730a6778227c?resourceName=degreeLaw
"resourceType"
did:cheqd:mainnet:46e2af9a-2ea0-4815-999d-730a6778227c?resourceName=degreeLaw&resourceType=JSONSchema2020
"resourceVersionId"
did:cheqd:mainnet:46e2af9a-2ea0-4815-999d-730a6778227c?resourceName=degreeLaw&resourceVersionId=1.3.1
"versionTime"
did:cheqd:mainnet:46e2af9a-2ea0-4815-999d-730a6778227c?resourceName=degreeLaw&resourceType=JSONSchema2020&versionTime=2015-03-11T05:30:02Z
"versionId"
did:cheqd:mainnet:46e2af9a-2ea0-4815-999d-730a6778227c?versionId=0f964a80-5d18-4867-83e3-b47f5a756f02
"versionTime"
did:cheqd:mainnet:46e2af9a-2ea0-4815-999d-730a6778227c?resourceName=degreeLaw&resourceType=JSONSchema2020&versionTime=2018-07-19T08:40:00Z
"linkedResource"
did:cheqd:mainnet:46e2af9a-2ea0-4815-999d-730a6778227c?linkedResource=true // note that this would only be a valid query if there is ONLY ONE resource associated with the DID and DID Document.
"resourceMetadata"
did:cheqd:mainnet:46e2af9a-2ea0-4815-999d-730a6778227c?resourceName=degreeLaw&resourceType=JSONSchema2020&versionTime=2018-07-19T08:40:00Z&resourceMetadata=true or, did:cheqd:46e2af9a-2ea0-4815-999d-730a6778227c?resourceMetadata=true // note that this would only be a valid query if there is ONLY ONE resource associated with the DID and DID Document.
"latestResourceVersion
"
did:cheqd:mainnet:46e2af9a-2ea0-4815-999d-730a6778227c?resourceName=degreeLaw&resourceType=JSONSchema2020&latestResourceVersion=true
"allResourceVersions
"
did:cheqd:mainnet:46e2af9a-2ea0-4815-999d-730a6778227c?resourceName=degreeLaw&resourceType=JSONSchema2020&allResourceVersions=true
It is important to differentiate between the Request format for creating an AnonCreds object on cheqd, and the Response format, for how an AnonCreds objectshould be compiled by SDKs and the .
Populate a ; and
Compile a standardised AnonCreds schema object in the .
This Schema Resource file inputs should be replicated where possible within the Payload file, to populate a stored on cheqd, with the following mapping:
When passing the Payload file to the ledger, additional inputs may be required within the Payload file to populate the . In this instance, the only additional information required is:
Using the and associated , the ledger has enough information to compile the following data structure as a response format.
To create a schema on cheqd, you should follow the , and pass the relevant JSON file for the object in the transaction.
publisher DID
: is a . The DID of the Schema Publisher.
name
: is a , the name of the schema
version
: is a , the version of the schema in format. The three part, period (â.â) separated format MAY be enforced.
This legacy format is now attributed to the