Skip to main content

Resolve a DID

Querying the state of a DID is called resolution. The entity that queries the DID Document for a given DID, i.e., resolves it, is called a resolver.

The KILT SDK provides such a resolver to use with KILT DIDs, as the snippet below shows:

import * as Kilt from '@kiltprotocol/sdk-js'

export async function queryFullDid(
didUri: Kilt.DidUri
): Promise<Kilt.DidDocument | null> {
const { metadata, document } = await Kilt.Did.resolve(didUri)
if (metadata.deactivated) {
console.log(`DID ${didUri} has been deleted.`)
return null
} else if (document === undefined) {
console.log(`DID ${didUri} does not exist.`)
return null
} else {
return document

The DID resolver can resolve both light and full DIDs. For a more in-depth explanation about the KILT DID method and resolution, refer to our specification.