Credential Definitions

Manage Anoncreds credential definitions created by the cloud agent

An Anoncreds credential definition, represented by AnoncredsCredDef, enables the cloud agent to issue credentials from a specific Anoncreds schema.

Anoncreds credential definitions are written to the ledger, and therefore cannot be modified or deleted once created. However, it is possible for multiple credential definitions to reference a single schema.

Create an Anoncreds credential definition

The cloud agent creates a new AnoncredsCredDef and writes it permanently to the ledger. The schemaId param references an Anoncreds schema which must be already written to the ledger. The isRevocable param determines whether credentials issued using this credential definition can be revoked.

mutation MyMutation {
  createAnoncredsCredDef(
    args: {
      schemaId: "Hoh1tsuYFJxqsuJ5vVjxuL:2:MySchema:1.0"
      tag: "MyCredDefTag"
      isRevocable: false
    }
  ) {
    id
  }
}

View Anoncreds credential definitions

View Anoncreds credential definitions which are created by the cloud agent, with pagination and filtering options. Returns a nextToken which can be passed into the same query in order to fetch subsequent pages.

The AnoncredsCredDef type provides the option to resolve its associated AnoncredsSchema within a single operation.

query MyQuery {
  anoncredsCredDefs(
    page: {
      nextToken: null
    }
    filter: {}
  ) {
    items {
      id
      schemaId
      schema {
        name
        version
        attributeNames
      }
      tag
      isRevocable
    }
    nextToken
  }
}

Alternatively, view a single Anoncreds credential definition, referenced by its unique ID.

query MyQuery {
  anoncredsCredDef(
    credDefId: "Hoh1tsuYFJxqsuJ5vVjxuL:3:CL:3050:MyCredDefTag"
  ) {
    id
    schemaId
    schema {
      name
      version
      attributeNames
    }
    tag
    isRevocable
  }
}

Last updated