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

ppld-did-resolver

v1.1.0

Published

PPLDID resolver for did-resolve

Downloads

4

Readme

did:ppld Resolver

This library is intended to use PPLDID as 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. Also it is dependent on a hosted resolver that can resolve PPLDID DIDs. Such an implementation can be found here: https://github.com/peopledata/ppldid

There is also a publicly available resolver at https://ppld-resolver.peopledata.org.cn, which is used as fallback resolver within this library.

DID method

The did:ppld method links the identifier cryptographically to the DID Document and through also cryptographically linked provenance information in a public log it ensures resolving to the latest valid version of the DID Document. Read more about PPLDID at https://github.com/peopledata/ppldid

Example:
did:ppld:zQmaBZTghndXTgxNwfbdpVLWdFf6faYE4oeuN2zzXdQt1kh

Installation

Node.js and npm are prerequisites for installation.

npm install ppldid-did-resolver

Usage

The library presents a resolve() functions that returns a Promise returning the DID document. It is not meant to be used directly but through the did-resolver aggregator.

const { Resolver } = require('did-resolver');
const ppldid = require('ppldid-did-resolver');

const resolver = new Resolver({
  ...ppldid.getResolver()
});

// resolve test-did
resolver.resolve('did:ppld:zQmaBZTghndXTgxNwfbdpVLWdFf6faYE4oeuN2zzXdQt1kh').then(data =>
  console.log(JSON.stringify(data, undefined, 2))
);

DID Document

The did resolver takes the identifier and queries existing PPLDID repositories to retrieve a DID document with the hash representation of the given identifier.

A minimal DID document using the above sample DID looks like this:

{
  "didResolutionMetadata": {},
  "didDocument": {
    "@context": "https://www.w3.org/ns/did/v1",
    "id": "did:ppld:zQmaBZTghndXTgxNwfbdpVLWdFf6faYE4oeuN2zzXdQt1kh",
    "verificationMethod": [
      {
        "id": "did:ppld:zQmaBZTghndXTgxNwfbdpVLWdFf6faYE4oeuN2zzXdQt1kh",
        "type": "Ed25519VerificationKey2020",
        "controller": "did:ppld:zQmaBZTghndXTgxNwfbdpVLWdFf6faYE4oeuN2zzXdQt1kh",
        "publicKeyBase58": "z6MusYB5iT5krCHYsZ76EzBaTdRwGKsaBhMcSbrXaPJgkuRQ"
      }
    ],
    "keyAgreement": [
      {
        "id": "did:ppld:zQmaBZTghndXTgxNwfbdpVLWdFf6faYE4oeuN2zzXdQt1kh",
        "type": "Ed25519VerificationKey2020",
        "controller": "did:ppld:zQmaBZTghndXTgxNwfbdpVLWdFf6faYE4oeuN2zzXdQt1kh",
        "publicKeyBase58": "z6Mv7EYihbAat6Wq7GsjNsjcxt58dZT8fmsRjQGTkYamYrjB"
      }
    ],
    "service": [
      {
        "simple": "example"
      }
    ]
  },
  "didDocumentMetadata": {
    "did": "zQmaBZTghndXTgxNwfbdpVLWdFf6faYE4oeuN2zzXdQt1kh",
    "registry": "https://ppldid.peopledata.org.cn",
    "log_hash": "zQmVwMvovLy5KNYHHVHQ1wv8J7y9L6UPE8eyU4tzypFWtYe",
    "log": [
      {
        "ts": 1641224736,
        "op": 2,
        "doc": "zQmaBZTghndXTgxNwfbdpVLWdFf6faYE4oeuN2zzXdQt1kh",
        "sig": "z3Kb5qeReCqr3ftxpf2i5UypUwrzrVkyspMtaDcb6e9YdHVSptcAFgvwbgk3qWqspTcGiKDYKXZZh8g6XyM2WPmNp",
        "previous": []
      },
      {
        "ts": 1641224736,
        "op": 0,
        "doc": "zQmT8SG7a238bF7wdV7LdrEAQpimqhKGor7CQsjtCYdZdTS",
        "sig": "z63hu8LseptBrvB2kEDwhPP35sBj7JDDJsEDW85cjRkrjjac9ZV3HxPW9NVKewHcQYwrVLVsnDCcm1RjbEARE5rJU",
        "previous": []
      }
    ],
    "document_log_id": 0,
    "termination_log_id": 1
  }
}

 

License

[MIT License]