Create Issuer DID

Create a DID using the did:cheqd method

To create a cheqd DID (did:cheqd) and associated DID Document there are two ways of building the payload for the request:

Step 1: Set up your account

Make sure you have set up your account with cheqd Studio and are logged in, using our guide below:

Step 2: Create a DID and associated DID Document

Using the /did/create API, users have two options for creating a did:cheqd DID and associated DID Document on-ledger:

  1. Filling out a simple form using the application/x-www-url-form-encoded option on the Swagger UI

  2. Compiling a DID Document body yourself using the application/json option on the Swagger UI

Create a DID Document.

This endpoint creates a DID and associated DID Document. As input, it can take the DID Document parameters via a form, or the fully-assembled DID Document itself.

POST/did/create
Body
networkenum

Network to create the DID on (testnet or mainnet)

testnetmainnet
identifierFormatTypeenum

Algorithm to use for generating the method-specific ID. The two styles supported are UUIDs and Indy-style Base58. See cheqd DID method documentation for more details.

uuidbase58btc
verificationMethodTypeenum

Type of verification method to use for the DID. See DID Core specification for more details. Only the types listed below are supported.

Ed25519VerificationKey2018JsonWebKey2020Ed25519VerificationKey2020
servicearray of object

It's a list of special objects which are designed to build the actual service. It's almost the same as in DID Core specification, but instead of id it utilises idFragment field for making the right id for each service. !!! WARN. Cause swagger-ui does not handle x-ww-form based arrays correctly, please frame all your services in brackets while using swagger UI. !!!

keystring

The unique identifier in hexadecimal public key format used in the verification method to create the DID.

@contextarray of string
Response

The request was successful.

Body
didstring
controllerKeyIdstring
keysarray of object
servicesarray of Service (object)
Request
const response = await fetch('/did/create', {
    method: 'POST',
    headers: {
      "Content-Type": "application/x-www-form-urlencoded"
    },
    body: JSON.stringify({}),
});
const data = await response.json();
Response
{
  "did": "text",
  "controllerKeyId": "text",
  "keys": [],
  "services": [
    {
      "id": "did:cheqd:mainnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1",
      "type": "LinkedDomains",
      "serviceEndpoint": [
        "https://example.com"
      ]
    }
  ]
}

Option 1. Choose from a few variables and we will compile the DID for you

This is the easiest way to create DIDs on cheqd and is recommended for users who are not overly familiar with compiling DID Documents.

Using the application/x-www-url-form-encoded option on the Swagger UI, users are able to choose between the following variables to compile your DID:

network (required)
  • "testnet" (recommended for testing)

  • "mainnet" (recommended for production)

methodSpecificIdAlgo (required)
  • "uuid" - this is a Universally Unique Identifier (recommended)

  • "base58btc" - this is an identifier which is commonly used for Hyperledger Indy transactions

verificationMethod / type (required)
  • "Ed25519VerificationKey2018" (recommended)

  • "Ed25519VerificationKey2020"

  • "JSONWebKey2020"

assertionMethod (optional)
  • true (recommended if used for issuing Verifiable Credentials)

  • false

didDocument (optional)

This input field contains either a complete DID document, or an incremental change (diff) to a DID document. For example:

{
  "service": [
    {
      "id": "did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1",
      "type": "LinkedDomains",
      "serviceEndpoint": [
        "https://example.com"
      ]
    }
  ]
}

From this request, the Credential Service will automatically create and publish a DID and associated DID Document to the ledger and return it as a response.

Option 2. Publish a DID Document body yourself

Instead of generating a DID Document using simple parameters, you can create a fully formatted DID Document yourself. Before, submitting a manually created DID, you will need to have created a set of identity keys to input the key material into the DID document.

Step 1: Create a new keypair

Use the /key/create API to generate a new keypair within the Credential Service key management store. Copy the "publicKeyHex".

Step 2: Utilise the DID Document template helper

To simplify this process of formatting a DID Document using your own keys, we've created a Helper Tool in our DID Registrar here. Simply paste in your publicKeyHex and choose the variables to compile your DID Document template.

Step 3: Paste the response

Within the /did/create JSON payload, paste the response of your DID Document template, with your own signing keys.

Request format:

{
  "didDocument": {
    "id": "did:cheqd:testnet:0ff9df5d-653b-4f77-a66c-0035abc34d63",
    "controller": [
      "did:cheqd:testnet:0ff9df5d-653b-4f77-a66c-0035abc34d63"
    ],
    "verificationMethod": [
      {
        "id": "did:cheqd:testnet:0ff9df5d-653b-4f77-a66c-0035abc34d63#key-1",
        "type": "JsonWebKey2020",
        "controller": "did:cheqd:testnet:0ff9df5d-653b-4f77-a66c-0035abc34d63",
        "publicKeyJwk": {
          "crv": "Ed25519",
          "kty": "OKP",
          "x": "BFSLOxwMJgpmWRtTUuo0JAvz6VXGp4WDDcN0dFfCQKo"
        }
      }
    ],
    "authentication": [
      "did:cheqd:testnet:0ff9df5d-653b-4f77-a66c-0035abc34d63#key-1"
    ]
  }
}

Step 3: Hit execute on the API

Hit execute on the API below to create your did:cheqd DID and associated DID Document.

Create a DID Document.

This endpoint creates a DID and associated DID Document. As input, it can take the DID Document parameters via a form, or the fully-assembled DID Document itself.

POST/did/create
Body
networkenum

Network to create the DID on (testnet or mainnet)

testnetmainnet
identifierFormatTypeenum

Algorithm to use for generating the method-specific ID. The two styles supported are UUIDs and Indy-style Base58. See cheqd DID method documentation for more details.

uuidbase58btc
verificationMethodTypeenum

Type of verification method to use for the DID. See DID Core specification for more details. Only the types listed below are supported.

Ed25519VerificationKey2018JsonWebKey2020Ed25519VerificationKey2020
servicearray of object

It's a list of special objects which are designed to build the actual service. It's almost the same as in DID Core specification, but instead of id it utilises idFragment field for making the right id for each service. !!! WARN. Cause swagger-ui does not handle x-ww-form based arrays correctly, please frame all your services in brackets while using swagger UI. !!!

keystring

The unique identifier in hexadecimal public key format used in the verification method to create the DID.

@contextarray of string
Response

The request was successful.

Body
didstring
controllerKeyIdstring
keysarray of object
servicesarray of Service (object)
Request
const response = await fetch('/did/create', {
    method: 'POST',
    headers: {
      "Content-Type": "application/x-www-form-urlencoded"
    },
    body: JSON.stringify({}),
});
const data = await response.json();
Response
{
  "did": "text",
  "controllerKeyId": "text",
  "keys": [],
  "services": [
    {
      "id": "did:cheqd:mainnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1",
      "type": "LinkedDomains",
      "serviceEndpoint": [
        "https://example.com"
      ]
    }
  ]
}

List DIDs associated with your account

After creating a DID or multiple DIDs, users can list all the created DIDs associated with their account. Using the /did/list API.

Fetch DIDs associated with an account.

This endpoint returns the list of DIDs controlled by the account.

GET/did/list
Response

The request was successful.

Body
itemsstring
Request
const response = await fetch('/did/list', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
[
  "text"
]

Alternatives

Below are a list of alternatives for creating cheqd DIDs.

Last updated