ipns-did-resolver
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

ipns-did-resolver

NOTE: The IPNS-DID spec is unstable.

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 across both UnixFS blocks and other IPLD blocks, using ipfs-uniform-resolve.

Fragments and queries are currently ignored and will resolve the entire document instead.

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 * as IPNSMethod from "ipns-did-resolver";

import * as IPFS from 'ipfs-core'

const ipfs = await IPFS.create()

const ipns = IPNSMethod.getResolver(
  ipfs.block,
  ipfs.name
);
const resolver = new Resolver({ ipns });

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

API

The library exports a function getResolver(block, name, multidecoder?). The first two parameters are the Block and Name APIs of the IPFS API.

multidecoder is a either a Multidecoder instance, or a {decoders, hashers} object, to let you provide whatever decoder/hasher you need.

Learn more about Multidecoder here.

Package Sidebar

Install

npm i ipns-did-resolver

Weekly Downloads

3

Version

0.1.1

License

ISC

Unpacked Size

8.14 kB

Total Files

6

Last publish

Collaborators

  • misterupkeep