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

@interop/did-web-resolver

v4.0.0

Published

A did:web method Decentralized Identifier (DID) resolver for the did-io library.

Downloads

510

Readme

did:web Resolver (@interop/did-web-resolver)

Node.js CI NPM Version

A did:web method Decentralized Identifier (DID) resolver for the did-io library.

Table of Contents

Security

TBD

Background

A did:web method driver for use with in-browser and server-side on Node.js with the did-io resolver library.

Draft spec (W3C CCG Work Item):

did:web Decentralized Identifier Method Specification

Other implementations:

  • https://github.com/decentralized-identity/web-did-resolver

Usage

Initializing

import { Ed25519VerificationKey2020 }
  from '@digitalcredentials/ed25519-verification-key-2020'
import { X25519KeyAgreementKey2020 }
  from '@digitalcredentials/x25519-key-agreement-key-2020'
import { CryptoLD } from 'crypto-ld'

import * as didWeb from '@interop/did-web-resolver'

const cryptoLd = new CryptoLD()
cryptoLd.use(Ed25519VerificationKey2020)
cryptoLd.use(X25519KeyAgreementKey2020)

const didWebDriver = didWeb.driver({ cryptoLd })

// Optionally use it with the CachedResolver from did-io
import {CachedResolver} from '@digitalcredentials/did-io';
const resolver = new CachedResolver()
resolver.use(didWebDriver)

Generating a new DID

Generating from seed

If you have a deterministic secret seed (created with did-cli, for example) and would like to generate a did:web document from it:

const url = 'https://example.com'
const seed = 'z1AhV1bADy7RepJ64mvH7Kk7htFNGc7EA1WA5nGzLSTWc6o'

const { didDocument, keyPairs, methodFor } = await didWebDriver.generate({ url, seed })
// didDocument
{
  '@context': [
    'https://www.w3.org/ns/did/v1',
    'https://w3id.org/security/suites/ed25519-2020/v1',
    'https://w3id.org/security/suites/x25519-2020/v1'
  ],
  id: 'did:web:example.com',
  assertionMethod: [{
    id: 'did:web:example.com#z6MkmDMjfkjs9XPCN1LfoQQRHz1mJ8PEdiVYC66XKhj3wGyB',
    type: 'Ed25519VerificationKey2020',
    controller: 'did:web:example.com',
    publicKeyMultibase: 'z6MkmDMjfkjs9XPCN1LfoQQRHz1mJ8PEdiVYC66XKhj3wGyB'
  }]
}

Generating new random keys

Invoking generate() by itself will create new keypairs for each proof purpose.

const { didDocument, keyPairs, methodFor } = await didWebDriver.generate()
// didDocument
{
  '@context': [
    'https://www.w3.org/ns/did/v1',
    'https://w3id.org/security/suites/ed25519-2020/v1',
    'https://w3id.org/security/suites/x25519-2020/v1'
  ],
  id: 'did:web:example.com',
  capabilityInvocation: [{
    id: 'did:web:example.com#z6MkqUiWi2o5V5oDEVzqszpkDhzeJ2o9Z4zVyTWeASqgrgti',
    type: 'Ed25519VerificationKey2020',
    controller: 'did:web:example.com',
    publicKeyMultibase: 'zC2TU7nYe9YJk81A9CRruNcSeUTXJ9Bk9HSbiLAsfwU7L'
  }],
  authentication: [{
    id: 'did:web:example.com#z6MksjNYAxjiTrhPFx9Ljk3SVowEtFXhFqLdsMKJHV4KrcDT',
    type: 'Ed25519VerificationKey2020',
    controller: 'did:web:example.com',
    publicKeyMultibase: 'zEH7VaiVH8KCv9TJe4B5beiPF4gFqqx6HBLQNTD6JwPS5'
  }],
  assertionMethod: [{
    id: 'did:web:example.com#z6MkiyYa5mG4moiHrmXQea8bNvdEWRWi3KuouHqoiknGf7xV',
    type: 'Ed25519VerificationKey2020',
    controller: 'did:web:example.com',
    publicKeyMultibase: 'z5XHXVX1dSGDpkGghy1AkXq5EgrErdSfTDGvstUpFjuB7'
  }],
  capabilityDelegation: [{
    id: 'did:web:example.com#z6MknmeMZEXLhS6g2p6YPHkQG4PkNsJev652CqnsArPm3dZa',
    type: 'Ed25519VerificationKey2020',
    controller: 'did:web:example.com',
    publicKeyMultibase: 'z9KPJxzGuMtcCvKFqhinZQxqkZJ2oWCpfWpswLaRk8QnC'
  }],
  keyAgreement: [{
    id: 'did:web:example.com#z6LSg3dWQzpQgRpaVzNXkcosnheyhXJUQkNQQgXyDapFSCFZ',
    type: 'X25519KeyAgreementKey2020',
    controller: 'did:web:example.com',
    publicKeyMultibase: 'z5NTLth1Yay6qQbzmDyHvU7SVrNmMi9CFXhpHj8AiipUo'
  }]
}

Install

git clone https://github.com/interop-alliance/did-web-resolver.git
cd did-web-resolver
npm install

Contribute

PRs accepted.

License

The MIT License ©2020-2021 Interop Alliance and Dmitri Zagidulin