Create AnonCreds Credential Definition

Create a Credential Definition as a DID-Linked Resource (DLR) on cheqd for issuing AnonCreds.

Create Credential Definition

The request body must contain the credential_definition object with the Issuer DID and the Schema ID created in the previous steps.

To enable revocation, the options must contain the revocation flag, and the size of the revocation registry. Also, ensure that a Tails Server is configured for the issuer.

Create a credential definition on the connected datastore

post
Body
Responses
200Success
application/json
post
POST /anoncreds/credential-definition HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 310

{
  "credential_definition": {
    "issuerId": "did:(method):WgWxqztrNooG92RXvxSTWv",
    "schemaId": "did:(method):2:schema_name:1.0",
    "tag": "default"
  },
  "options": {
    "create_transaction_for_endorser": false,
    "endorser_connection_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "revocation_registry_size": 1000,
    "support_revocation": true
  }
}
200Success
{
  "credential_definition_metadata": {},
  "credential_definition_state": {
    "credential_definition": {
      "issuerId": "did:(method):WgWxqztrNooG92RXvxSTWv",
      "schemaId": "did:(method):2:schema_name:1.0",
      "tag": "default",
      "type": "CL",
      "value": {
        "primary": {
          "n": "0",
          "r": {},
          "rctxt": "0",
          "s": "0",
          "z": "0"
        },
        "revocation": {
          "g": "1 1F14F&ECB578F 2 095E45DDF417D",
          "g_dash": "1 1D64716fCDC00C 1 0C781960FA66E3D3 2 095E45DDF417D",
          "h": "1 16675DAE54BFAE8 2 095E45DD417D",
          "h0": "1 21E5EF9476EAF18 2 095E45DDF417D",
          "h1": "1 236D1D99236090 2 095E45DDF417D",
          "h2": "1 1C3AE8D1F1E277 2 095E45DDF417D",
          "h_cap": "1 1B2A32CF3167 1 2490FEBF6EE55 1 0000000000000000",
          "htilde": "1 1D8549E8C0F8 2 095E45DDF417D",
          "pk": "1 142CD5E5A7DC 1 153885BD903312 2 095E45DDF417D",
          "u": "1 0C430AAB2B4710 1 1CB3A0932EE7E 1 0000000000000000",
          "y": "1 153558BD903312 2 095E45DDF417D 1 0000000000000000"
        }
      }
    },
    "credential_definition_id": "did:(method):3:CL:20:tag",
    "state": "finished"
  },
  "job_id": "text",
  "registration_metadata": {}
}

Request Body

credential_definition (mandatory)

"issuerId": DID of the Issuer.

"schemaId": The AnonCreds Schema ID created by the Issuer (must be of the same DID).

"tag": Additional Name to identify the Credential Definition.

options (optional)

"support_revocation": Boolean value to indicate that the Credential can be revoked or not. (Tails server must be configured if this is set to `true`)

"revocation_registry_size": Maximum size of the Revocation Registry.

Check the new Credential Definition

Retrieve an individual credential definition details

get
Path parameters
cred_def_idstringRequired

Credential definition identifier

Example: {"value":"did:(method):3:CL:20:tag"}
Responses
200Success
application/json
get
GET /anoncreds/credential-definition/{cred_def_id} HTTP/1.1
Host: 
Accept: */*
200Success
{
  "credential_definition": {
    "issuerId": "did:(method):WgWxqztrNooG92RXvxSTWv",
    "schemaId": "did:(method):2:schema_name:1.0",
    "tag": "default",
    "type": "CL",
    "value": {
      "primary": {
        "n": "0",
        "r": {},
        "rctxt": "0",
        "s": "0",
        "z": "0"
      },
      "revocation": {
        "g": "1 1F14F&ECB578F 2 095E45DDF417D",
        "g_dash": "1 1D64716fCDC00C 1 0C781960FA66E3D3 2 095E45DDF417D",
        "h": "1 16675DAE54BFAE8 2 095E45DD417D",
        "h0": "1 21E5EF9476EAF18 2 095E45DDF417D",
        "h1": "1 236D1D99236090 2 095E45DDF417D",
        "h2": "1 1C3AE8D1F1E277 2 095E45DDF417D",
        "h_cap": "1 1B2A32CF3167 1 2490FEBF6EE55 1 0000000000000000",
        "htilde": "1 1D8549E8C0F8 2 095E45DDF417D",
        "pk": "1 142CD5E5A7DC 1 153885BD903312 2 095E45DDF417D",
        "u": "1 0C430AAB2B4710 1 1CB3A0932EE7E 1 0000000000000000",
        "y": "1 153558BD903312 2 095E45DDF417D 1 0000000000000000"
      }
    }
  },
  "credential_definition_id": "did:(method):3:CL:20:tag",
  "credential_definitions_metadata": {},
  "resolution_metadata": {}
}

Last updated

Was this helpful?