DID-Linked Resources

"DID-Linked Resources" are identified with a did:cheqd Decentralized Identifier with a Universally Unique Identifier (UUID) that acts as a permanently-accessible link to fetch the resources from the cheqd ledger. We refer to this as the "resource ID". Through the "resource ID" or a set of DID URL query parameters, applications are able to persistently access a digital resource on the cheqd network.

Create Resource

Using the createResource cheqd api agents are able to create custom DID-Linked Resources, including:

  • Trust Registries

  • Status Lists

  • Logos associated with DIDs

  • Governance files

Parameters

  1. did*

  2. name*

  3. resourceType*

  4. id*

  5. data* : Text, Base64 string or an object

  6. alsoKnownAs

  7. version

await agent.modules.cheqd.createResource('did:cheqd:testnet:92874297-d824-40ea-8ae5-364a1ec9237d', {
  name: 'resourceName',
  resourceType: 'resourceType',
  id: '6de33634-6439-4e46-aa3f-bfe03606b000',
  version: '1.0',
  data: {
    name: 'name',
    age: 18,
  },
})

Resolve Resource

The resolveResource function in the cheqd API allows agents to resolve DID-Linked Resources in two ways:

  • By resourceId

  • By resourceName and resourceType

Additionally, both conventions support the following query parameters:

  • To fetch a specific resource version: resourceUrl?version=<versionId>

  • To fetch the closest resource version for a given time: resourceUrl?resourceVersionTime=<epoch time>

Using resourceId

await agent.modules.cheqd.resolveResource(
  'did:cheqd:testnet:92874297-d824-40ea-8ae5-364a1ec9237d/resources/6de33634-6439-4e46-aa3f-bfe03606b000'
)

Using resourceName and resourceType

await agent.modules.cheqd.resolveResource(
  'did:cheqd:testnet:92874297-d824-40ea-8ae5-364a1ec9237d?resourceName=resourceName&resourceType=resourceType'
)

Get started

Last updated

Was this helpful?