What is Decentralized Identity?
AT Protocol uses a dual identity system combining cryptographic DIDs (Decentralized Identifiers) with human-readable handles. This allows users to have both a permanent, secure identity and a friendly display name.Identity Components
DIDs (Decentralized Identifiers)
DIDs are the permanent, cryptographic identifiers for users in AT Protocol:- Format:
did:method:identifier - Example:
did:plc:ewvi7nxzyoun6zhxrhs64oiz - Permanent: DIDs don’t change, even if you switch servers
- Self-sovereign: You control your DID through cryptographic keys
Handles
Handles are human-readable names that map to DIDs:- Format: Domain name (e.g.,
alice.bsky.social,bob.com) - Changeable: Can be updated without losing your identity
- Verifiable: Proven through DNS or HTTPS
- Portable: Can use your own domain
Why Two Identifiers?
- DIDs provide permanence and cryptographic security
- Handles provide usability and memorability
- Together they enable both security and user-friendliness
Resolving Handles
The@atproto/identity package provides handle resolution:
1. DNS TXT Record
The preferred method using DNS:2. HTTPS Well-Known
Fallback method using HTTPS:DID Resolution
DIDs resolve to DID Documents containing service endpoints and public keys:DID Methods
AT Protocol supports two DID methods:did:plc
PLC (Placeholder) is the primary method used in AT Protocol:- Centralized directory with plans for decentralization
- Fast resolution
- Supports key rotation and service updates
- Used by default in Bluesky
did:web
Web DIDs use domain names:- Fully decentralized
- Resolution via HTTPS to
https://example.com/.well-known/did.json - Relies on domain ownership
- Slower resolution than PLC
Extracting AT Protocol Data
The identity package provides helpers to extract AT Protocol-specific data from DID documents:Identity Verification Flow
Verify that a handle matches its DID document:Caching
DID resolution can be expensive, so caching is important:Using Your Own Domain
One of AT Protocol’s key features is the ability to use your own domain as your handle:Option 1: DNS TXT Record
Add a TXT record to your domain:Option 2: HTTPS Well-Known
Create a file athttps://yourdomain.com/.well-known/atproto-did:
yourdomain.com.
Identity Portability
The separation of DID and handle enables powerful portability:Best Practices
Cache DID resolutions
Cache DID resolutions
DID resolution involves network requests. Always use caching in production to reduce latency and load.
Verify handle-to-DID consistency
Verify handle-to-DID consistency
Always verify that a resolved DID’s document contains the expected handle in
alsoKnownAs to prevent impersonation.Handle resolution failures gracefully
Handle resolution failures gracefully
Handle resolution can fail due to DNS issues or misconfiguration. Always have fallback logic.
Use timeouts
Use timeouts
Set reasonable timeouts for both handle and DID resolution to prevent hanging requests.
Error Handling
Related Topics
- Authentication - Using identities for session management
- Repositories - Data storage tied to DIDs
- Overview - AT Protocol architecture
Additional Resources
@atproto/identity Package
NPM package documentation
DID Specification
W3C DID specification
PLC Directory
Public PLC DID directory
Identity Spec
AT Protocol identity specification