Hyperledger Indy Setup
This guide covers the setup of Hyperledger Indy ledger for identity proofs and credential verification in CCDigital.Indy/ACA-Py is used for credential proofs during login and user access state synchronization. It provides verifiable credential flows for secure authentication.
Prerequisites
Before starting, ensure you have:- Linux or WSL2 with Docker and Docker Compose
- Python 3.10+ with
venvfor credential issuance scripts curlandjqfor API testing- Available ports for ledger and agents (check your architecture)
Component Download
Get Indy Ledger Implementation
Obtain an Indy ledger implementation for local development. Options include:
- von-network (recommended for development)
- Indy-node standalone setup
Ledger Setup
Start Indy Ledger Nodes
Start the Indy ledger nodes:The ledger should be accessible at
http://localhost:9000.Validate Ledger Health
Check the ledger status through the web interface:Ensure all nodes show “Active” status.
Register Issuer DID
Register the issuer’s DID with write permissions. Access the web UI at
http://localhost:9000 and:- Enter a seed (32 characters, e.g.,
000000000000000000000000Issuer01) - Select “Endorser” role for write permissions
- Submit to register the DID
ACA-Py Agent Setup
CCDigital uses two ACA-Py agents:- Issuer Agent: Issues credentials to citizens
- Holder Agent: Holds credentials and presents proofs during login
Schema and Credential Definition
Create Schema
Create a credential schema on the issuer agent. The schema defines the attributes for citizen identity:Save the returned
schema_id.Create Credential Definition
Create a credential definition based on the schema:Save the returned
credential_definition_id.Connection Establishment
Generate Invitation from Issuer
Create an invitation from the issuer agent:Copy the
invitation_url or invitation object from the response.Credential Issuance
Python Issuance Script
CCDigital uses a Python script to issue credentials from the database. Configure the script location:Issue Credentials
Run the issuance script to create credentials for eligible users:Manual Credential Issuance
For testing, you can manually issue a credential:Login Flow with Present-Proof
CCDigital implements a verifiable credential login flow using the Present Proof 2.0 protocol.Flow Overview
- User initiates login at
/login/user - Backend creates a proof request via
IndyProofLoginService - User’s wallet receives the proof request
- User presents proof using their credential
- Backend verifies the proof and extracts attributes
- User completes second factor (TOTP or email OTP)
Service Implementation
The login flow is implemented in:- IndyProofLoginService (
src/main/java/co/edu/unbosque/ccdigital/service/IndyProofLoginService.java): Manages proof requests - UserAuthFlowService (
src/main/java/co/edu/unbosque/ccdigital/service/UserAuthFlowService.java): Orchestrates authentication - IndyAdminClient (
src/main/java/co/edu/unbosque/ccdigital/service/IndyAdminClient.java:30): HTTP client for ACA-Py Admin API
Extracted Attributes
After successful proof verification, CCDigital extracts:id_type: Document type (CC, TI, etc.)id_number: Identification numberfirst_name: First namelast_name: Last nameemail: Email address
Access State Synchronization
Overview
CCDigital synchronizes user access states (ENABLED/SUSPENDED/DISABLED) to ACA-Py connection metadata. This allows the system to enforce access control during authentication.Configuration
Implementation
TheUserAccessGovernanceService handles synchronization:
Environment Variables
Configure the following environment variables for Indy/ACA-Py integration:application.properties under ccdigital.indy.* and acapy.* prefixes.
Testing the Integration
Verify Proof Request
Test the proof request flow:Check Presentation State
Review Agent Logs
Troubleshooting
Connection Not Active
If connections remain in “invitation” or “request” state:- Check that both agents can reach each other’s endpoints
- Verify firewall rules allow traffic
- Check agent logs for connection errors
Credential Issuance Fails
Common issues:- Incorrect
cred_def_id - Schema attributes don’t match credential preview
- Connection not in “active” state
- Insufficient ledger write permissions
Proof Verification Fails
Check:- Credential was successfully issued and stored
- Proof request attributes match credential schema
- Connection is active
- Credential definition ID matches
Service References
- IndyAdminClient (
src/main/java/co/edu/unbosque/ccdigital/service/IndyAdminClient.java:30): HTTP client for ACA-Py Admin API - IndyProofLoginService (
src/main/java/co/edu/unbosque/ccdigital/service/IndyProofLoginService.java): Proof request management - UserAuthFlowService (
src/main/java/co/edu/unbosque/ccdigital/service/UserAuthFlowService.java): Authentication orchestration - UserAccessGovernanceService (
src/main/java/co/edu/unbosque/ccdigital/service/UserAccessGovernanceService.java): Access state synchronization - IndyProperties (
src/main/java/co/edu/unbosque/ccdigital/config/IndyProperties.java): Configuration properties
Next Steps
ACA-Py Agent Configuration
Detailed configuration for issuer and holder agents
Hyperledger Fabric Setup
Set up Fabric for document traceability
