In this demo, we will demonstrate how to connect two agents and perform SSI operations, including creating a connection, offering a credential, and requesting a proof. One agent will act as an Issuer and Verifier (Identity Service Agent), while the other will act as a Holder (Mobile agent).
Before proceeding with the demo, it is necessary to set up the Heka Identity Service. Additionally, you will need to install the Heka Wallet Android application.
You can find instructions on how to set up the Heka Identity Service in the Setup and Configure section. After setting up the service, you should be able to access the Heka Identity Service Swagger UI (by default http://localhost:3000/docs). All Issuer and Verifier operations for this demo will be executed from this Swagger UI.
You can install the Heka Wallet app using the APK provided in the repo.
To use the Heka Identity Service API, you need to get an auth token. You can receive this token from a local deployment of Heka Auth Service or by interacting with a third-party OAuth provider (requires changes in JWT configuration, see corresponding setup guidance.
Once you have the token, follow these steps to authenticate:
- Open the Heka Identity Service Swagger page (To access the Swagger page, simple append
/docsto the URL of the Heka Identity Service). - Click the
Authorizebutton in the top right corner of the page and enter the received token, then clickAuthorize.
For agent communication, you need to create a connection. To create a connection between the Issuer/Verifier (Heka Identity Service Agent) and the Holder (Mobile Agent), follow these steps:
- On the Swagger page, expand the
POST: /connections/create-invitationendpoint section and click theTry it outbutton. - Fill the
labelandaliasfields with desired values and click theExecutebutton. - If the execution result returns a success code (200), you will receive an invitation URL.
- To accept this invitation link using the Heka Wallet app, convert it to a QR code, and then scan it using the Heka Wallet app.
After scanning the QR code, a pairwise connection should be created between your Mobile agent and the Heka Identity Service Agent. You can check this connection using the GET: /connections endpoint on the Heka Identity Service side or in the Contacts section of the Heka Wallet app.
To offer a credential to the Holder, we need a Public DID, a Schema, and a Credential Definition.
To create a Public Issuer DID, follow these steps:
- On the Swagger page, expand the
POST: /didsendpoint section and click theTry it outbutton. - In the request body, specify the DID method — for AnonCreds-compatible DIDs, use
{"method": "hedera"}or{"method": "indy"}. Omitting the body falls back todid:key, which can't anchor schemas or credential definitions and will block the later steps of this demo. - Click the
Executebutton. If the execution result returns a success code (201), a new Public DID and DID Document will be returned in the response body.
You can either create a new schema or use an existing one from the ledger:
- Create a new schema: expand the
POST: /schemasendpoint section on the Swagger page and clickTry it out. Fill in the schema name, version, attribute names, and the issuer DID created above, then clickExecute. On success (201), the response contains the new schema ID. - Use an existing schema: call
GET: /schemas/{schemaId}with a known schema ID — for example one previously published on the same Hedera testnet (e.g.did:hedera:testnet:zFAeKMsqnNc2bwEsC8oqENBvGqjpGu9tpUi3VWaFEBXBo_0.0.5896419/anoncreds/v1/SCHEMA/0.0.7121291) by another issuer — to view its attributes before issuing against it.
To create a credential definition, follow these steps:
- On the Swagger page, expand the
POST: /credential-definitionsendpoint section and click theTry it outbutton. - Fill the
issuerId,schemaId, andtagfields, and click the "Execute" button. - If the execution result returns a success code (201), you will receive credential defenition ID in the response body.
Now, let's offer a verifiable credential to the Holder by following these steps:
- On the Swagger page, expand the
POST: /credentials/offerendpoint section and click theTry it outbutton. - Fill the
connectionId,credentialDefinitionId,comment, andattributesfields. Note that the attributes must match the selected schema attributes. Click the "Execute" button. - If the execution result returns a success code (200), it means that the offer has been sent to the holder, and you will receive a notification about the new credential offer in the Heka Wallet app.
- Open the Heka Wallet app and click on the
Viewbutton in theNew Credential Offernotification. - On the opened page, you can see the details of the offered credential. To accept the provided credential, click the
Acceptbutton. - If you accept the offer, you will need to wait until the credential is issued and stored in your wallet.
After the credential is issued, you can view it in the credentials tab of the Heka Wallet app.
To request a proof from the Holder, follow these steps:
- On the Swagger page, expand the
POST: /proofs/requestendpoint section and click theTry it outbutton. - Fill the
connectionId,name,commentandproofParams(InsideproofParamsyou can providecredentialDefinitionIdorschemaIdorattributeswithpredicates) fields. Click theExecutebutton. - If the execution result returns a success code (200), it means that the proof request has been sent to the holder, and you will receive a notification about the new proof request in the Heka Wallet app.
- Open the Heka Wallet app and click on the
Viewbutton in theNew Proof Requestnotification. - On the opened page, you can see the details of the proof request. To present the requested proof, click the
Sharebutton.
After a proof being presented has been formed, it is sent to the verifier. You can view presented proof using GET /proofs endpoint