ACA-Py Agent Configuration
This guide provides detailed configuration steps for ACA-Py (Aries Cloud Agent - Python) agents used in CCDigital for verifiable credential issuance and proof verification.ACA-Py implements the Aries protocols for verifiable credential exchange. CCDigital uses two agents: an issuer for credential issuance and a holder for user authentication.
Architecture Overview
CCDigital’s ACA-Py architecture consists of:- Issuer Agent: Issues verifiable credentials to citizens based on database records
- Holder Agent: Holds user credentials and presents proofs during login
- Admin API: REST API for agent management and credential operations
- Indy Ledger: Stores schemas, credential definitions, and DIDs
Prerequisites
Before configuring agents, ensure you have:- Docker and Docker Compose installed
- Indy ledger running (see Hyperledger Indy Setup)
- Registered issuer DID with endorser role
- Python 3.10+ for issuance scripts
- Network connectivity between agents
Issuer Agent Setup
Holder Agent Setup
Create Holder Wallet Configuration
Define the wallet configuration for the holder agent:
The
--auto-* flags simplify credential acceptance for development. For production, implement manual acceptance flows with user consent.Wallet Configuration
Wallet Types
ACA-Py supports multiple wallet types:- indy: Default Indy wallet (recommended)
- askar: Newer Aries Askar wallet
Wallet Security
For production deployments:- Use strong wallet keys (not simple passwords)
- Store wallet keys securely (e.g., HashiCorp Vault, AWS Secrets Manager)
- Enable wallet encryption at rest
- Use PostgreSQL wallet storage for better performance
PostgreSQL Wallet Storage
For production, use PostgreSQL instead of SQLite:Admin API Endpoints
Issuer Agent Endpoints
The issuer agent exposes these key endpoints:| Endpoint | Method | Description |
|---|---|---|
/status | GET | Agent status and version |
/connections | GET | List all connections |
/connections/create-invitation | POST | Create connection invitation |
/schemas | POST | Create credential schema |
/credential-definitions | POST | Create credential definition |
/issue-credential-2.0/send | POST | Issue credential |
/present-proof-2.0/send-request | POST | Request proof presentation |
/present-proof-2.0/records | GET | List proof exchanges |
Holder Agent Endpoints
| Endpoint | Method | Description |
|---|---|---|
/status | GET | Agent status |
/connections | GET | List connections |
/connections/receive-invitation | POST | Accept invitation |
/credentials | GET | List stored credentials |
/present-proof-2.0/records | GET | List proof exchanges |
Admin API Authentication
Secure the admin API with an API key:IndyAdminClient automatically includes the API key in requests via the X-API-Key header.
Connection Establishment
Automatic Connection Resolution
CCDigital can automatically resolve connections by label:their_label matches the configured label.
Manual Connection ID
Alternatively, specify a fixed connection ID:Creating Connections
Integration with CCDigital
Java Service Classes
CCDigital integrates with ACA-Py through these service classes:IndyAdminClient
Location:src/main/java/co/edu/unbosque/ccdigital/service/IndyAdminClient.java:30
HTTP client for ACA-Py Admin API:
- Automatic
X-API-Keyheader injection - JSON request/response handling
- RestTemplate-based HTTP client
IndyProofLoginService
Location:src/main/java/co/edu/unbosque/ccdigital/service/IndyProofLoginService.java
Manages proof requests for login:
UserAuthFlowService
Location:src/main/java/co/edu/unbosque/ccdigital/service/UserAuthFlowService.java
Orchestrates the complete authentication flow including:
- Proof request initiation
- Proof verification
- User lookup by verified attributes
- Second factor authentication
UserAccessGovernanceService
Location:src/main/java/co/edu/unbosque/ccdigital/service/UserAccessGovernanceService.java
Synchronizes user access states to ACA-Py:
Proof Polling Configuration
Configure polling behavior for proof requests:IndyProofLoginService when waiting for proof completion.
Credential Issuance
From Database
CCDigital uses a Python script to issue credentials from MySQL:- Queries eligible users from MySQL
- Resolves the active connection
- Issues credentials via ACA-Py Admin API
- Tracks issuance status
Manual Issuance
Issue a credential manually:Access State Synchronization
Configuration
Enable synchronization of user access states:Metadata Structure
CCDigital writes user access state to connection metadata:ENABLED: User can log in and access documentsSUSPENDED: User login temporarily disabledDISABLED: User login permanently disabled
Admin Operations
From the Admin module, update user access state:Environment Variables
Complete environment variable reference:application.properties entries:
ccdigital.indy.*for Indy-specific configurationacapy.*for legacy ACA-Py configurationexternal-tools.indy.*for script execution
Troubleshooting
Agent Won’t Start
Check:- Docker logs:
docker logs <container-id> - Wallet key is correct
- Genesis URL is accessible
- Ports are not already in use
Connection Fails
Verify:- Both agents can reach each other’s endpoints
- Firewall rules allow traffic on configured ports
- Agent labels are correctly configured
- Connection invitation is valid
Credential Issuance Fails
Common issues:- Connection not in “active” state
- Incorrect
cred_def_id - Schema attributes don’t match preview
- Holder agent not configured with
--auto-respond-credential-offer
Proof Verification Fails
Check:- Credential was successfully issued and stored in holder wallet
- Proof request attributes match credential schema
- Connection is active
- Credential definition ID matches
- Polling timeout is sufficient
API Key Errors
If you see “Unauthorized” errors:- Ensure
INDY_ADMIN_API_KEYmatches agent’s--admin-api-key - Check that
IndyAdminClientis including theX-API-Keyheader - Verify the API key format (no extra spaces/newlines)
Production Considerations
Security
- Use
--admin-api-keyfor admin API authentication - Store wallet keys securely (secrets management system)
- Use PostgreSQL wallet storage for reliability
- Enable TLS for agent endpoints
- Implement rate limiting on admin endpoints
Performance
- Use connection pooling for database-backed wallets
- Enable wallet caching
- Monitor agent memory usage
- Scale horizontally with load balancers
Monitoring
- Collect agent logs (JSON format recommended)
- Monitor proof request success rate
- Track credential issuance metrics
- Alert on failed authentication attempts
Backup and Recovery
- Regular wallet backups
- Document seed phrases securely
- Test recovery procedures
- Maintain DID recovery mechanisms
Service References
- IndyAdminClient (
src/main/java/co/edu/unbosque/ccdigital/service/IndyAdminClient.java:30) - IndyProofLoginService (
src/main/java/co/edu/unbosque/ccdigital/service/IndyProofLoginService.java) - UserAuthFlowService (
src/main/java/co/edu/unbosque/ccdigital/service/UserAuthFlowService.java) - UserAccessGovernanceService (
src/main/java/co/edu/unbosque/ccdigital/service/UserAccessGovernanceService.java) - IndyProperties (
src/main/java/co/edu/unbosque/ccdigital/config/IndyProperties.java)
Next Steps
Hyperledger Indy Setup
Complete Indy ledger setup and configuration
Hyperledger Fabric Setup
Set up Fabric for document traceability
