Overview
DID methods are implemented through registrars (for creation) and resolvers (for resolution). Credo’sDidsModule manages both registrars and resolvers, allowing you to work with multiple DID methods simultaneously.
Core DID Methods
The following DID methods are supported in the@credo-ts/core package:
did:key
Thedid:key method is a self-contained DID method that derives the DID directly from a public key.
Features:
- No blockchain or ledger required
- Cryptographically self-verifying
- Instant creation with no network calls
- Always required for Credo to function
- Quick DID creation without infrastructure
- Testing and development
- Simple peer-to-peer connections
- Short-lived identifiers
The
KeyDidRegistrar and KeyDidResolver are always registered in Credo, even if you provide custom registrars/resolvers, as they are required for core functionality.did:peer
Thedid:peer method creates peer-to-peer DIDs for private relationships.
Features:
- Multiple algorithms (numalgo 0, 1, 2, 4)
- Off-ledger DID method
- Perfect for DIDComm connections
- Always required for Credo to function
- NumAlgo 0
- NumAlgo 1
- NumAlgo 2
- NumAlgo 4
Inception key-based DID. The simplest form, similar to did:key.
- DIDComm connections and messaging
- Peer-to-peer relationships
- Private, pairwise identifiers
- No need for public discoverability
The
PeerDidRegistrar and PeerDidResolver are always registered in Credo, as they are essential for the DIDComm and connection modules.packages/core/src/modules/dids/methods/peer/PeerDidRegistrar.ts:17
did:web
Thedid:web method uses web domains for DID hosting.
Features:
- DIDs hosted at HTTPS endpoints
- Uses existing web infrastructure
- Good for organizations with established domains
- Resolver included by default
- Organizations with existing web presence
- Public DIDs that need to be easily discoverable
- Integration with existing web infrastructure
- SEO and web-based verification
The
did:web method requires you to host the DID Document at the appropriate HTTPS endpoint. Only the resolver is provided by default; creation must be handled externally.did:jwk
Thedid:jwk method embeds a JSON Web Key in the DID.
Features:
- Self-contained like did:key
- Uses standard JWK format
- Good for JWT-based workflows
- No external dependencies
- JWT and JWS workflows
- OpenID4VC implementations
- SD-JWT credentials
- W3C VC with JWT proof format
Ledger-Based DID Methods
The following DID methods require separate packages and interact with blockchain networks:did:sov and did:indy
Hyperledger Indy-based DID methods for public and permissioned ledgers. Package:@credo-ts/indy-vdr
Features:
- Built for the Hyperledger Indy ecosystem
- Supports credential revocation
- Production-ready for AnonCreds workflows
- Interoperable with Sovrin, Indicio, and other Indy networks
- AnonCreds credential workflows
- Hyperledger Indy networks
- Production SSI implementations
- Revocation support required
did:cheqd
Cheqd network DIDs with on-chain DID Documents. Package:@credo-ts/cheqd
Features:
- Decentralized network with economic incentives
- Support for on-chain resources
- Payment rails for credential exchange
- Production-ready mainnet
- Projects requiring payment rails
- On-chain resource management
- Production verifiable credentials
- Decentralized network infrastructure
did:hedera
Hedera Hashgraph DIDs for high-throughput applications. Package:@credo-ts/hedera
Features:
- High transaction throughput
- Low, predictable fees
- Enterprise-grade network
- ABFT consensus
- High-throughput applications
- Enterprise environments
- Predictable cost requirements
- Fast finality needed
Configuring DID Methods
Default Configuration
By default, Credo includes these registrars and resolvers:packages/core/src/modules/dids/DidsModuleConfig.ts:57
Custom Configuration
You can customize which DID methods are available:DID Operations
Creating DIDs
Resolving DIDs
Importing DIDs
DID Method Selection Guide
Quick Selection Guide:For Development/Testing:
- Use
did:keyordid:peerfor quick setup - No infrastructure required
- Fast iteration
- Use
did:peer(numalgo 2) - Perfect for private connections
- Required for DIDComm protocols
- Use
did:webif you have a domain - Use
did:cheqdordid:hederafor public discoverability - Use
did:indyfor Hyperledger Indy networks
- Use
did:jwkfor JWT-based credentials - Use
did:indyfor AnonCreds - Use
did:keyfor simple W3C VCs - Use
did:cheqdordid:hederafor production
Best Practices
Security:
- Store private keys securely using the agent’s key management system
- Use production networks for production DIDs
- Rotate keys when necessary using DID Document updates (method-dependent)
- Cache resolved DID Documents when appropriate
- Use lightweight methods (did:key, did:peer) for temporary identifiers
- Consider network latency for ledger-based methods
- Use standard DID methods when possible
- Document which DID methods your application supports
- Test resolution across different implementations
Related Topics
- Agent - Learn about agent architecture
- Modules - Understand the module system
- Verifiable Credentials - Using DIDs with credentials
- Storage - DID storage and management