1.0.0 • Published 15 days ago

@did-ipns/resolver v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
15 days ago

ipns-did-resolver

A resolver library for the IPNS method, to be used with the did-resolver library.

IPNS method resolution works with both IPNS (Peer ID hash) CIDs and DNSLink domains. Paths will be resolved as UnixFS blocks.

Note: The default DID path is .well-known/did.json which is similar to did:web.

Documents that resolve but have an ID that doesn't match the DID used to resolve it will throw an error.

Usage

import { Resolver } from "did-resolver";
import { getResolver } from "@did-ipns/resolver";

import { createHeliaHTTP } from '@helia/http'

const helia = await createHeliaHTTP()

const ipnsResolver = getResolver(
    helia
);
const resolver = new Resolver(ipnsResolver);

const result = await resolver.resolve("did:ipns:did.ipfs.io");

console.log(result);

API

The library exports a function getResolver(helia). The first parameter is an instance of Helia.