DID Resolver
Interactive example
Resolve DID documents from EBSI Decentralized Identifiers (DIDs) using our libraries.
Library
The resolver is built on the open-source did-resolver library (v6) and two EBSI drivers:
| Package | DID method | Usage |
|---|---|---|
@europeum-ebsi/ebsi-did-resolver | did:ebsi | getResolver({ registry }), where registry is the URL of the DID Registry identifiers endpoint |
@europeum-ebsi/key-did-resolver | did:key | getResolver(), which takes no options |
Both packages also export a util object:
util.createDid(...)creates a DID from a subject identifier (did:ebsi) or from a public key JWK (did:key).util.validateDid(did)checks that a DID is well formed.
import { Resolver } from "did-resolver";
import { getResolver as getEbsiResolver } from "@europeum-ebsi/ebsi-did-resolver";
import { getResolver as getKeyResolver } from "@europeum-ebsi/key-did-resolver";
const didResolver = new Resolver({
...getEbsiResolver({
registry: "https://api-test.testnode02.ebsi.eu/v1/did-registry/identifiers",
}),
...getKeyResolver(),
});
const { didDocument } = await didResolver.resolve(
"did:ebsi:zvHWX359A3CvfJnCYaAiAde",
);
DID URL parameters
The did:ebsi resolver supports two query parameters on the DID:
versionTime: resolve the DID document as it was at the given time (for exampledid:ebsi:z...?versionTime=2025-01-01T00:00:00Z).contractAddress: resolve the DID from a specific DID Registry contract instance. It takes precedence over thecontractAddressresolution option.
Errors
Resolution failures are returned in didResolutionMetadata.error (for example invalidDid, notFound, or configurationError). When the registry answers with an RFC 9457 problem document, the message lists each entry of its errors member as pointer: detail.
For local development, a registry on localhost or 127.0.0.1 is reached over http:// instead of https://.