npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

itn-did-resolver

v0.1.1

Published

Resolve DID documents for ITN Decentralized Identifiers

Downloads

47

Readme

ITN DID Resolver

This library is intended to use ITN fully self-managed Decentralized Identifiers and wrap them in a DID Document

It supports the proposed Decentralized Identifiers spec from the W3C Credentials Community Group.

It requires the DID Resolver library, which is the primary interface for resolving DIDs.

DID method

The did:itn method links the identifier cryptographically to the DID Document and through also cryptographically linked provenance information in a Distributed Ledger it ensures resolving to the latest valid version of the DID Document.

DID Document

The DID resolver takes the DID and makes http query to ITN Resolver server. The ITN Resolver server looks for requested DID in ITN CAS, proves DID Document validity from ITN Distributed Ledger and returns resolved DID Document to DID Resolver.

A minimal DID Document might contain the following information:

{
  "@context": [
    "https://www.w3.org/ns/did/v1"
  ],
  "id": "did:itn:5bFQ34F7kLe2bVzWP7te1j",
  "assertionMethod": [
    "did:itn:5bFQ34F7kLe2bVzWP7te1j#c4e60db9161a36efeb0b866c3503ec3c5b429bd156dd7b30c64bea8efb54cf35"
  ],
  "authentication": [
    "did:itn:5bFQ34F7kLe2bVzWP7te1j#c4e60db9161a36efeb0b866c3503ec3c5b429bd156dd7b30c64bea8efb54cf35"
  ],
  "keyAgreement": [
    {
      "id": "did:itn:5bFQ34F7kLe2bVzWP7te1j#5e367434275dd5f4d6a0eeb2b5a22710b588288fa5ec165e2bdb9a8e7b6e176c",
      "type": "X25519KeyAgreementKey2019",
      "controller": "did:itn:5bFQ34F7kLe2bVzWP7te1j",
      "publicKeyBase58": "Hz1Vip4r2MNFFkW7TLQvLLKjK3AnfSNNBypmvUvvSbcc"
    }
  ],
  "verificationMethod": [
    {
      "id": "did:itn:5bFQ34F7kLe2bVzWP7te1j#c4e60db9161a36efeb0b866c3503ec3c5b429bd156dd7b30c64bea8efb54cf35",
      "type": "Ed25519VerificationKey2018",
      "controller": "did:itn:5bFQ34F7kLe2bVzWP7te1j",
      "publicKeyBase58": "BPJgF3sz49umG4JrAR2Um7juqVfAUDqTLGjRYmV3oDxe"
    }
  ]
}

Resolving a DID document

The resolver presents a simple resolver() function that returns a ES6 Promise returning the DID document.

import { Resolver } from 'did-resolver'
import { getResolver } from 'itn-did-resolver'

// getResolver() accepts a DID Resolver server url
const itnResolver = getResolver("https://resolver.itn.mobi")

const didResolver = new Resolver({
    ...itnResolver
    //...you can flatten multiple resolver methods into the Resolver
})

didResolver.resolve('did:itn:881ZoZaRvZ66N1GrSenVKc').then(doc => console.log(doc))

// You can also use ES7 async/await syntax
;(async () => {
    const doc = await didResolver.resolve('did:itn:881ZoZaRvZ66N1GrSenVKc')
    console.log(doc)
})();