Schemas

Manage Anoncreds schemas created by the cloud agent

An Anoncreds schema, represented by AnoncredsSchema, defines a set of attributes which form what is essentially a credential template.

Anoncreds schemas are written to the ledger, and therefore cannot be modified or deleted once created. The schema version is intended as a mechanism to write an updated version of a schema to the ledger, however this has no effect on versions already written to the ledger, nor on credentials which are already issued using the schema.

Create an Anoncreds schema

The cloud agent creates a new AnoncredsSchema and writes it permanently to the ledger. The attributeNames param determines the set of attributes which must appear on credentials issued using this schema.

mutation MyMutation {
  createAnoncredsSchema(
    args: {
      name: "MySchema"
      version: "1.0"
      attributeNames: ["Firstname", "Lastname", "DOB"]
    }
  ) {
    id
  }
}

View Anoncreds schemas

View Anoncreds schemas 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.

query MyQuery {
  anoncredsSchemas(
    page: {
      nextToken: null
    }
    filter: {}
  ) {
    items {
      id
      name
      version
      attributeNames
    }
    nextToken
  }
}

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

query MyQuery {
  anoncredsSchema(
    schemaId: "Hoh1tsuYFJxqsuJ5vVjxuL:2:MySchema:1.0"
  ) {
    id
    name
    version
    attributeNames
  }
}

Last updated