Managing Agents

In this tutorial, you will create 3 agents to play the 3 basic roles of issuer, verifier, and user. The user plays the role of the holder in the issuance flow and the prover in the verification flow.

Use the following curl commands to create 3 agents: issuer1, verifier1, and user1, respectively.

curl -u $ACCOUNT -X POST -d '{"name": "issuer1"}' $URL/api/v1/agents -H "Content-Type: application/json"
curl -u $ACCOUNT -X POST -d '{"name": "verifier1"}' $URL/api/v1/agents -H "Content-Type: application/json"
curl -u $ACCOUNT -X POST -d '{"name": "user1"}' $URL/api/v1/agents -H "Content-Type: application/json"

The body of the response of each of the above commands returns both an id field (which uniquely identifies each agent within the agency) and a pass field (which is the password for the agent).

Set the following environment variables as follows which will be used for the remainder of this tutorial:

export ISSUER1_ID=<issuer1-id>
export ISSUER1=<issuer1-id>:<issuer1-pass>
export VERIFIER1_ID=<verifier1-id>
export VERIFIER1=<verifier1-id>:<verifier1-pass>
export USER1_ID=<user1-id>
export USER1=<user1-id>:<user1-pass>

List the agents in your account as follows:

curl -u $ACCOUNT $URL/api/v1/agents

Or get agent details for just user1 as follows:

curl -u $USER1 $URL/api/v1/info

The response contains the following fields:

  • id is identifier of the agent which is unique within the agency;
  • name is the human-readable name of the agent;
  • pass is the password of the agent;
  • url is the URL of the agent;
  • creation_time is the time at which the agent was created in seconds since midnight on January 1st, 1970;
  • did is the public DID for the agent; for more information on DIDs, refer to the W3C Specification;
  • verkey is the verification key associated with the public DID;
  • master_secret_id is the ID of the master secret for the agent;
  • default_ledger_name is the name of the default ledger for this agent;
  • capabilities are the capabilities for this agent.

For your reference only (i.e. don't do this now), if you wanted to delete these 3 agents from your account in order to restart the tutorial at any point along the way, you could do so as follows:

curl -u $ACCOUNT -X DELETE $URL/api/v1/agents/$ISSUER1_ID
curl -u $ACCOUNT -X DELETE $URL/api/v1/agents/$VERIFIER1_ID
curl -u $ACCOUNT -X DELETE $URL/api/v1/agents/$USER1_ID

or to delete your entire account (including all agents in your account):

curl -u $ACCOUNT -X DELETE $URL/api/v1/agents/<account-id>?force

The force query parameter is required to force the removal of all agents in your account as well as your account itself.

But for now let's continue the tutorial by showing you how to connect agents, issue credentials, verify proofs, and more.

First, let's look at how to manage invitations so that our agents can communicate with one another.