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

revocation-manager

v2.0.1

Published

This library enables revocation of Verifiable Credentials in a decentralized manner using the Tezos Blockchain. It uses the [Revocation List 2020](https://w3c-ccg.github.io/vc-status-rl-2020/) specification as base principle to manage revocation.

Downloads

3

Readme

revocation-manager

This library enables revocation of Verifiable Credentials in a decentralized manner using the Tezos Blockchain. It uses the Revocation List 2020 specification as base principle to manage revocation.

Installation

This package requires NodeJS and NPM installed.

git clone https://github.com/GravityID/revocation-manager.git
cd revocation-manager
npm i

Usage

It is possible to use this package either by integrating it on a Typescript / Javascript code or by running its CLI

With code

This is the primary way of using the Revocation Manager package. It unlocks all the possibilities of the package directly embedded in an existing Typescript or Javascript code.

Originate

Deploy an instance of Revocation Manager with an initial revocation list

import { InMemorySigner } from "@taquito/signer";
import { originate } from "revocation-manager";

const key = "edsk...";
const signer = await InMemorySigner.fromSecretKey(key);
const size = 16384;

await originate(signer, size);

Revoke

Revoke a Verifiable Credential associated with a Revocation Manager. It changes the storage of the on-chain Revocation Manager.

import { InMemorySigner } from "@taquito/signer";
import { revoke } from "revocation-manager";

const key = "edsk...";
const signer = await InMemorySigner.fromSecretKey(key);
const vc = {
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/vc-revocation-list-2020/v1"
  ],
  "id": "https://example.com/credentials/23894672394",
  "type": ["VerifiableCredential"],
  "issuer": "did:example:12345",
  "issued": "2020-04-05T14:27:42Z",
  "credentialStatus": {
    "id": "https://dmv.example.gov/credentials/status/3#94567",
    "type": "RevocationList2020Status",
    "revocationListIndex": "94567",
    "revocationListCredential": "rlist://KT1U4xsumuCWY7UZRrr7hVGtqEi2MsuisUUB",
  },
  "credentialSubject": {
    "id": "did:example:6789",
    "type": "Person"
  }
}

await revoke([vc], signer);

Resolve

Build a RevocationList2020Credential from a Revocation Manager. The result can be cached and accessed while being offline.

import { InMemorySigner } from "@taquito/signer";
import { resolve } from "revocation-manager";

const id = "rlist://KT1U4xsumuCWY7UZRrr7hVGtqEi2MsuisUUB";
const vc = await resolve(id);

console.log(vc);

/**
 * {
 *   "@context": [
 *     "https://www.w3.org/2018/credentials/v1",
 *     "https://w3id.org/vc-revocation-list-2020/v1"
 *   ],
 *   "id": "rlist://KT1U4xsumuCWY7UZRrr7hVGtqEi2MsuisUUB",
 *   "type": [
 *     "VerifiableCredential",
 *     "RevocationList2020Credential"
 *   ],
 *   "issuer": "did:pkh:tz:tz1aSkwEot3L2kmUvcoxzjMomb9mvBNuzFK6",
 *   "credentialSubject": {
 *     "id": "rlist://KT1U4xsumuCWY7UZRrr7hVGtqEi2MsuisUUB#list",
 *     "type": "RevocationList2020",
 *     "encodedList": "H4sIAAAAAAAAA-3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAIC3AYbSVKsAQAAA"
 *   }
 * }
 */

Revocation status

Check whether a Verifiable Credential is revoked or not. This method directly reads the revocation status from the on-chain Revocation Manager.

import { InMemorySigner } from "@taquito/signer";
import { isRevoked } from "revocation-manager";

const vc = {
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/vc-revocation-list-2020/v1"
  ],
  "id": "https://example.com/credentials/23894672394",
  "type": ["VerifiableCredential"],
  "issuer": "did:example:12345",
  "issued": "2020-04-05T14:27:42Z",
  "credentialStatus": {
    "id": "https://dmv.example.gov/credentials/status/3#94567",
    "type": "RevocationList2020Status",
    "revocationListIndex": "94567",
    "revocationListCredential": "rlist://KT1U4xsumuCWY7UZRrr7hVGtqEi2MsuisUUB"
  },
  "credentialSubject": {
    "id": "did:example:6789",
    "type": "Person"
  }
}
const revoked = await isRevoked(vc);

console.log(revoked); // boolean

With CLI

A command-line interface (CLI) is also available for developers to use and does not require any software integration.

jean@pc-de-jean:~/Projects/Code/revocation-manager$ ./bin/cli.js -h
Usage: revocation-manager [options] [command]

Options:
  -V, --version                output the version number
  -h, --help                   display help for command

Commands:
  originate [options]          deploy an instance of Revocation Manager with an initial revocation list
  resolve [options] <manager>  build a RevocationList2020Credential from a Revocation Manager
  is-revoked [options]         check whether a Verifiable Credential is revoked or not
  revoke [options]             revoke a Verifiable Credential associated with a Revocation Manager
  help [command]               display help for command