enbox docs
Packages

@enbox/dids

DID creation, resolution, and key management — supporting did:dht, did:jwk, did:key, and did:web methods.

@enbox/dids handles everything related to Decentralised Identifiers (DIDs) — creating them, resolving them, and managing the cryptographic keys they contain.

What it does

  • DID creation — Generates new DIDs using supported methods. Each method produces a DID document with verification methods (public keys) and service endpoints.
  • DID resolution — Resolves any DID URI to its DID document, discovering the subject's public keys, service endpoints, and authentication methods.
  • Key management — Manages the key pairs associated with DIDs, including key generation, export, and storage in encrypted vaults.
  • Universal resolver — A UniversalResolver that delegates to method-specific resolvers and caches results.

Supported DID methods

MethodClassDescription
did:dhtDidDhtDIDs anchored to the Mainline DHT network. Recommended for production use.
did:jwkDidJwkSelf-contained DIDs where the DID string encodes the public key directly.
did:keyDidKeySimilar to did:jwk but uses the Multicodec encoding format.
did:webDidWebDIDs resolved via HTTPS from a web domain (e.g. did:web:example.com).

When to use it

Most applications interact with DIDs through @enbox/api and @enbox/auth, which handle DID creation and resolution internally. Use @enbox/dids directly when you need:

  • Custom DID method support or resolver configuration
  • Standalone DID resolution without the full Enbox SDK
  • Direct key management operations (export, rotation, etc.)
  • Building a DID-aware service or verifier

Key exports

ExportDescription
DidDht, DidJwk, DidKey, DidWebMethod-specific DID handlers
UniversalResolverMulti-method DID resolver with caching
DidResolverCacheMemoryIn-memory resolver cache
DidMethodResolverInterface for custom DID method resolvers
DidDocumentThe W3C DID Document type

On this page