Indy AnonCreds issuer initialization
Procedure
- Write the issuer DID of the agent to a ledger or set the agents DID method to
did:indy.An issuer agent must have permission to write to an Indy ledger. To grant this permission, the issuer DID of the agent must be recorded on the ledger with the USER role (or a privileged role such as ENDORSER). Creating credential schema and credential definition as described in the following steps require ledger write access.
- Create or retrieve a credential schema.
- Only one credential schema can be active at a time. When you create multiple schemas, the first
one created is returned by
default.
GET https://${service_url}/v1.0/diagency/credential_schemas - The credential schema includes a list of attribute names that are written to the ledger. Multiple issuers can share this schema.
For example, suppose a credential schema which is used by a college to issue class credentials has the following attribute names: class, grade, rank, and instructor. Multiple colleges can use this credential schema to issue class credentials to their students.
In the following example,
issuer1creates its own credential schema.curl --location 'https://${service_url}/v1.0/diagency/credential_schemas' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ${issuer1_verifiable_credentials_access_token}' \ --data '{ "name": "course", "version": "1.0", "indy": { "attrs": [ "class", "grade", "rank", "instructor" ] } }'The
idvalue in the response is used in the next step.{ "id": "CRG4orwzg21CmvhErsyyjk:2:course:1.0", "name": "course", "version": "1.0", "namever": "course:1.0", "type": "indy", "attrs": [ "instructor", "rank", "class", "grade" ], "owner_did": "CRG4orwzg21CmvhErsyyjk", ... } - Only one credential schema can be active at a time. When you create multiple schemas, the first
one created is returned by
default.
- Create a credential definition: A credential definition uniquely identifies the
issuing agent and the attributes that are included in the credential. It is created by using the
schema ID. A credential schema is a template for issuing credentials whereas a credential definition
is an instance of that template which is used by a single agent.
Create a credential definition for
issuer1associated with the credential schemaid.curl --location 'https://${service_url}/v1.0/diagency/credential_definitions' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ${issuer1_verifiable_credentials_access_token}' \ --data '{ "schema_id": "CRG4orwzg21CmvhErsyyjk:2:course:1.0" }'The response includes details such as:
{ "id": "CRG4orwzg21CmvhErsyyjk:3:CL:33:TAG1", "type": "indy", "signature_type": "ed25519", "schema": { "id": "CRG4orwzg21CmvhErsyyjk:2:course:1.0", "name": "course", "version": "1.0", "namever": "course:1.0", "type": "indy", "attrs": [ "instructor", "rank", "class", "grade" ], "owner_did": "CRG4orwzg21CmvhErsyyjk" }, "agent_id": "605000BP6Q", "owner_did": "CRG4orwzg21CmvhErsyyjk" }Note: For V1.0 APIs, the credential definition inherits its type (indy,jsonld, orbbs) from the credential schema.
What to do next
After the issuer initialization is complete, issuer1 can issue a credential to
user1.