Credential Definitions
cheqd support for Ledger-Agnostic AnonCreds CredDefs
cheqd AnonCreds Object Method for CredDefs
In the ledger-agnostic AnonCreds specification, Credential Definitions are used to specify the following information all in one place, to create an immutable record of:
The DID of the credential issuer
The schema the issued credentials will be based upon
The public/private key pairs that will be used to sign the claims within an issued credential
A cryptographic secret, embedded within the CredDef Object content, creating an uncorrelatable 'link secret' between the issuer and holder
Information necessary for the revocation of credentials, if revocation is to be enabled by the Issuer for this type of credential (Optional).
This documentation will guide an implementor of AnonCreds on cheqd on how the cheqd AnonCreds Object Method defines and structures cheqd CredDef IDs, CredDef Request formats and CredDef Response formats, with and without revocation enabled.
Hyperledger AnonCreds CredDef Object
If you are not familiar with the latest Ledger-Agnostic AnonCreds CredDef structure, click the collapsible tile below to learn about the new format.
cheqd CredDef ID
cheqd uses DID-Linked Resources to identify individual resources, associated with a DID, using fully resolvable DID URLs.
cheqd resources module uses the following path-based syntax:
did:cheqd:mainnet:<IssuerDid>/resources/<CredDefResourceId>
Rather than using a composite string for the CredDef Resource ID. The cheqd AnonCreds object method uses a UUID to identify the CredDef Object Content which includes additional CredDef Object Content Metadata, providing the required fields for equivalence with Hyperledger Indy implementations.
For example, the following DID URL is cheqd's representation of a credDefId
:
did:cheqd:mainnet:zF7rhDBfUt9d1gJPjx7s1J/resources/77465164-5646-42d9-9a0a-f7b2dcb855c0
Another supported format for a credDefId
may be used in applications where it is important to derive the credDefId
, revocRegDefId
and statusListEntryId
from the same root.
This format uses query-based syntax, for example:
did:cheqd:mainnet:<IssuerDid>?resourceName=<resourceName>&resourceType=<resourceType>
For example:
did:cheqd:mainnet:zF7rhDBfUt9d1gJPjx7s1J?resourceName=universityDegree&resourceType=anonCredsCredDef
Understanding Request vs Response formats
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 cheqd DID Resolver.
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.
cheqd CredDef Request Format
The cheqd CredDef request format comprises of:
A Resource file for the CredDef object content (e.g.
degreeCredDef.json
); andA 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:
Populate a cheqd DID-Linked Resource; and
Compile a standardised AnonCreds CredDef object in the Response format.
cheqd CredDef Resource file
Before creating any on-ledger resource transaction, it is important to assemble the required CredDef Resource file and save it as a file locally.
In the example below, the content should be saved as a file, for example: degreeCredDef.json
with the following content (without revocation):
Or with revocation:
This CredDef Resource file inputs should be replicated where possible within the Payload file, to populate a DID-Linked resource stored on cheqd, with the following mapping:
"type"
"CL"
"resourceType"
"anonCredsCredDef"
"tag"
""
"resourceVersion"
""
What this means is that if the Resource file has an object of "type" = "CL" then this should be represented as the "resourceType" = "anonCredsCredDef" within the Payload file.
CredDef Payload File
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:
When passing the Payload file to the ledger, additional inputs may be required within the Payload file to populate the DID-Linked Resource. In this instance, the only additional information required is:
"name"
"universityDegree"
The Payload file drawing inputs from the Resource file on its own does not provide the ledger the requisite amount of information to create a full DID-Linked Resource. resourceName must be provided as an additional input parameter
Publishing resource using CLI
For example, the full request format using a CLI should be structured as follows:
cheqd resource Metadata
Once you have created your resource on cheqd, the following metadata will be generated in the DID Document Metadata associated with did:cheqd:mainnet:zF7rhDBfUt9d1gJPjx7s1J
cheqd CredDef Response format
Using the cheqd CredDef Request format and associated resource metadata, the ledger has enough information to compile the following data structure as a response format.
This can either be compiled by the relevant SDK handling cheqd AnonCreds, or it can be assembled by the cheqd DID resolver.
Compiling Response format in cheqd DID Resolver
The cheqd DID resolver will use the following logic to compile the standardised response format:
If "resourceType=anonCredsCredDef" then append "issuerId" to the beginning of the Response Format for the resource presented
create CredDef transaction
To create a CredDef on cheqd, you should follow the tutorials for creating a DID-Linked Resource here, and pass the relevant JSON file for the object in the transaction.
Tying CredDef, RevRegDef and StatusList Objects together
Across the cheqd CredDef Object Method, the Revocation Registry Definition Object Method and the StatusListEntry Object Method - each resource is associated with the same issuer DID and Collection ID.
Importantly, this allows each new resource to be indexed and versioned by their:
resourceName
resourceType
New resources can be created to update the existing CredDef or RevRegDef, whilst maintaining the historical state of the previous versions. See the documentation on Publishing a New Version of a Resource to understand this further.
Fetching a cheqd CredDef Object
Existing DID Resolvers will be able to query for the CredDef Object Content using the same patterns and parameters as the Schema Object found here.
The cheqd AnonCreds method also enables applications to derive the CredDef, Revocation Registry Definition Object and Status List from the same root:
Same Resource Name, different Resource type
We propose that the resourceName
for CredDefs, Revocation Registry Definitions and Status Lists should remain the same when each of these resources is part of the same AnonCred. This will make it easier for resources to query by resourceName
and resourceType
to delineate between the three resources using a common root.
Using this logic, the following queries can be used to dereference to CredDefs, Revocation Registry Definitions and Status List, in a way which can derive all three resources from the same root:
Dereference to CredDef
did:cheqd:mainnet:zF7rhDBfUt9d1gJPjx7s1J?resourceName=universityDegree&resourceType=anonCredsCredDef
Dereference to Revocation Registry Definition
did:cheqd:mainnet:zF7rhDBfUt9d1gJPjx7s1J?resourceName=universityDegree&resourceType=anonCredsRevocRegDef
Dereference to Revocation Status List
did:cheqd:mainnet:zF7rhDBfUt9d1gJPjx7s1J?resourceName=universityDegree&resourceType=anonCredsStatusList
Note: across all three of these queries, the resolver would fetch the latest version of the resource by default
Constructing an AnonCred with this logic
The AnonCreds construction below uses this logic to demonstrate how an application could derive the latest Status List using the "rev_reg_id
" since it shares the same root and would only require replacing "anonCredsRevocRegDef" with "anonCredsStatusList".
This is similar to how Hyperledger Indy uses composite strings to derive assoicated AnonCreds Objects from others. For example:
Legacy AnonCreds CredDef Object
Last updated