This guide covers the did:plc method integration for TrustWeave. The did:plc plugin provides Personal Linked Container (PLC) DID resolution for AT Protocol.
Overview
The did/plugins/plc module provides an implementation of TrustWeave’s DidMethod interface using the Personal Linked Container (PLC) DID method for AT Protocol. This integration enables you to:
Create and resolve DIDs for AT Protocol applications
Store DID documents in PLC registry
Support distributed DID resolution via HTTP endpoints
Integrate with AT Protocol’s identity system
Installation
Add the did:plc module to your dependencies:
1
2
3
4
5
6
7
8
9
dependencies{implementation("com.trustweave.did:plc:1.0.0-SNAPSHOT")implementation("com.trustweave:trustweave-did:1.0.0-SNAPSHOT")implementation("com.trustweave.did:base:1.0.0-SNAPSHOT")implementation("com.trustweave:trustweave-common:1.0.0-SNAPSHOT")// HTTP client for AT Protocol integrationimplementation("com.squareup.okhttp3:okhttp:4.12.0")}
plcRegistryUrl (optional): PLC registry URL (defaults to https://plc.directory)
timeoutSeconds (optional): HTTP client timeout in seconds
Integration with TrustWeave
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
importcom.trustweave.TrustWeaveimportcom.trustweave.plcdid.*valconfig=PlcDidConfig.default()valTrustWeave=TrustWeave.create{kms=InMemoryKeyManagementService()didMethods{+PlcDidMethod(kms!!,config)}}// Use did:plcvaldid=TrustWeave.createDid("plc"){algorithm=KeyAlgorithm.ED25519}.getOrThrow()valresolved=TrustWeave.resolveDid(did.id).getOrThrow()
AT Protocol Integration
PLC DIDs are designed for AT Protocol applications, which use distributed identity:
AT Protocol Features
Personal Linked Container: Each user has a personal container for their identity
Distributed Registry: DID documents stored in distributed registry
HTTP Resolution: Resolves via HTTP endpoints
Update Support: Supports document updates
Example: AT Protocol Application
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Create PLC DID for AT Protocol uservalmethod=PlcDidMethod(kms,PlcDidConfig.default())valoptions=didCreationOptions{algorithm=KeyAlgorithm.ED25519purpose(KeyPurpose.AUTHENTICATION)purpose(KeyPurpose.ASSERTION)}valdocument=method.createDid(options)// Use DID in AT ProtocolvalatpHandle="alice.example.com"// Link PLC DID to AT Protocol handle
Error Handling
Common errors and solutions:
Error
Cause
Solution
PLC registry not accessible
Registry URL unreachable
Check registry URL and network connectivity
DID not found in PLC registry
DID not registered
Register DID first or verify DID identifier
HTTP timeout
Request took too long
Increase timeout or check network connectivity
Failed to register with PLC registry
Registration failed
Check registry endpoint and document format
Testing
For testing without actual PLC registry:
1
2
3
4
5
6
7
8
9
10
// Without PLC registry URL, documents are stored locallyvalconfig=PlcDidConfig.builder().plcRegistryUrl(null)// No registry URL.build()valmethod=PlcDidMethod(kms,config)// Create and resolve (stored in memory)valdocument=method.createDid(options)valresult=method.resolveDid(document.id)
Best Practices
Use default registry: Use https://plc.directory for production
Cache resolutions: Cache resolved documents for performance
Error handling: Implement proper error handling for registry operations
Timeout configuration: Set appropriate timeouts for network requests
Document validation: Validate document format before registration
Use Cases
AT Protocol Applications
PLC DIDs are designed for AT Protocol applications:
1
2
3
4
5
// Create PLC DID for AT Protocol uservalplcDid=method.createDid(options)// Use in AT Protocol identity system// Link to AT Protocol handle (e.g., alice.example.com)
Distributed Identity
PLC DIDs support distributed identity systems:
Personal containers for identity data
HTTP-based resolution
Update support for identity evolution
Troubleshooting
Registry Not Accessible
Verify registry URL is correct
Check network connectivity
Ensure registry is online and accessible
Verify firewall/network policies
Registration Failures
Check document format is valid
Verify registry accepts registration requests
Check for rate limiting or authentication requirements