The did:key
method represents static cryptographic keys as Decentralized Identifiers (DIDs).
did:key
is self-contained. The identifier encodes the public key material required to verify signatures or perform encryption without relying on any external registry or multi-party resolution process.
did:key
is suited for portable and lightweight use cases such as verifiable credentials, decentralized identifiers (DIDs), and other decentralized or domain-specific deployments that operate without blockchains or centralized registries.
It can also be used for testing and local development where a simple, self-contained DID method is required.
- DidKey API & Resolver – work with
did:key
identifiers programmatically. - Verification Methods
- Multikey
- JSON Web Key (JWK):
- Ed25519
- Bls12381G1, Bls12381G2
- P-256 (secp256r1)
- P-384 (secp384r1)
- secp256k1
// Create a resolver for did:key
DidKeyResolver resolver = DidKeyResolver
// Initialize the resolver builder with a multicodec decoder
.with(codecs)
// Configure the resolver to emit Multikey verification methods
.multikey()
// Also configure the resolver to emit JWK verification methods
.jwk()
// Override how verification method identifiers are constructed.
// In this example, each method will be given a fragment "#vm"
// relative to the did:key identifier.
.verificationMethodId(key -> DidUrl.fragment(key, "vm"))
// Build the resolver instance
.build();
// Parse an existing `did:key`
var didKey = Did.of("did:key:z6MkvG5D...", ...);
// Resolve the did:key into a minimal DID Document
var didDoc = resolver.resolve(didKey);
// Print the DID Document identifier
System.out.println(didDoc.document().id());
// Print all verification method identifiers contained in the DID Document
didDooc.document().verification().forEach(vm -> System.out.println(vm.id()));
<dependency>
<groupId>com.apicatalog</groupId>
<artifactId>carbon-did-key</artifactId>
<version>0.10.0</version>
</dependency>
All PR's welcome!
Fork and clone the project repository.
> cd carbon-did-key
> mvn package
- The did:key Method v0.7
- W3C Controlled Identifiers v1.0
- W3C Decentralized Identifiers (DIDs) v1.0
- Carbon DID Core
- Carbon Controlled Identifiers
Commercial support and consulting are available.
For inquiries, please contact: filip26@gmail.com