DID Registration Specification Implementation
Overview
TrustWeave now fully supports the official DID Method Registry format from https://identity.foundation/did-registration/. You can use registry entries directly to create DID method implementations without writing code.
What Was Implemented
1. Official Registry Format Support
New Data Model: DidMethodRegistryEntry
- Matches the official registry JSON structure
- Fields:
name,status,specification,contact,implementations - Supports
implementations[].driverUrlfor resolver endpoints
2. Automatic Mapping
Mapper: RegistryEntryMapper
- Converts official registry entries → TrustWeave
DidMethodimplementations - Automatically extracts resolver configuration from
driverUrl - Selects best implementation (prefers non-testnet)
- Determines protocol adapter (standard or godiddy)
3. Dual Format Support
The loader supports both:
- Official Format (recommended): Registry format with
implementations[].driverUrl - Legacy Format (backward compatible): TrustWeave format with
driverandcapabilities
Usage Examples
Official Registry Format
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"name": "web",
"status": "implemented",
"specification": "https://w3c-ccg.github.io/did-method-web/",
"contact": {
"name": "W3C CCG",
"url": "https://www.w3.org/community/credentials/"
},
"implementations": [
{
"name": "Universal Resolver",
"driverUrl": "https://dev.uniresolver.io",
"testNet": false
}
]
}
Loading and Using
1
2
3
4
5
6
7
8
val kms = InMemoryKeyManagementService()
val registry = DidMethodRegistry()
// Load from official registry format
DidMethodRegistration.registerFromClasspath(registry, kms)
// Use the method
val result = registry.resolve("did:web:example.com")
How It Works
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
┌─────────────────────────────────────────┐
│ Official Registry JSON Format │
│ { │
│ "name": "web", │
│ "implementations": [ │
│ { "driverUrl": "https://..." } │
│ ] │
│ } │
└──────────────┬──────────────────────────┘
│
│ Parsed by
│ DidMethodRegistryEntryParser
▼
┌─────────────────────────────────────────┐
│ DidMethodRegistryEntry (Data Class) │
│ - name: "web" │
│ - implementations: [...] │
└──────────────┬──────────────────────────┘
│
│ Mapped by
│ RegistryEntryMapper
▼
┌─────────────────────────────────────────┐
│ HttpDidMethod (DidMethod impl) │
│ - method: "web" │
│ - resolver: UniversalResolver │
│ (configured from driverUrl) │
└─────────────────────────────────────────┘
Key Features
- Official Format: Uses the exact format from identity.foundation/did-registration
- Automatic Detection: Protocol adapter automatically determined from URL/name
- Smart Selection: Prefers mainnet over testnet implementations
- Backward Compatible: Still supports legacy TrustWeave format
- Zero Code: Just drop a JSON file following the registry format
Files Created/Modified
New Files:
DidMethodRegistryEntry.kt- Official registry format data modelRegistryEntryMapper.kt- Maps registry entries to DidMethodOFFICIAL_SPEC.md- Documentation for official format support
Updated Files:
JsonDidMethodLoader.kt- Now supports both formatsJsonDidMethodProvider.kt- Works with registry entries- Example JSON files - Updated to official format
schema.json- Updated to match official spec
Benefits
- ✅ Standards Compliant: Uses official registry format
- ✅ Easy Integration: Copy registry entries directly
- ✅ Automatic Configuration: Resolver settings extracted automatically
- ✅ Future Proof: Supports additional registry fields via
additionalProperties