Giter Site home page Giter Site logo

spherity / ethr-revocation-registry-controller Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 1.35 MB

The node module that allows you to control your Ethereum revocation lists & resolve revocation keys.

Home Page: https://www.npmjs.com/package/@spherity/ethr-revocation-registry-controller

TypeScript 100.00%
ethereum revocation eip-5539 credential ssi crl eip-712 eip5539 eip712

ethr-revocation-registry-controller's Introduction

Ethereum Revocation Registry Controller

The controller module for interacting with EIP-5539-compatible Ethereum revocation lists.

EIP Draft Registry Repo GitHub contributors GitHub issues GitHub pull-requests

Motivation

The EIP-5539 draft proposes a new RBAC-enabled revocation registry that can be used by any valid Ethereum address to maintain a set of revocation lists. In those, arbitrary revocation keys can be marked as either revoked or not. Additionally, the registry includes a set of management features that enables owners to have features like delegates, owner changes, and meta transactions.

This repository includes a controller module for interacting with EIP-5539-compatible revocation lists. This includes managing owners, delegates, revocation lists, revocation keys, and the support for meta transactions.

Installation

Execute this to install this dependency:

npm install --save @spherity/ethr-revocation-registry-controller

You can then build the controller object by instantiating it for example with a WebsocketProvider connected to Infura:

const { ethers } = require("ethers");
const {EthereumRevocationRegistryController} = require("@spherity/ethr-revocation-registry-controller");
const {InfuraWebSocketProvider} = require('@ethersproject/providers');

const provider = new InfuraWebSocketProvider(5, "XXXXXX");
const signer = ethers.Wallet.createRandom();
const signerAndProvider = signer.connect(provider);

const config = {
  signer: signerAndProvider,
  chainId: 5,
  address: "0x534b89b798e45929A24a217d7324EAd0EAF9413E"
}

const controller = new EthereumRevocationRegistryController(config);

async function checkRevocation() {
  const date = new Date(1686386460*1000);
  console.log(`Date: ${date.toDateString()}`);

  const revoked = await controller.isRevoked({
    namespace: "0x68849D547F49f19291737bFebA5ca5a0E1e19d84",
    list: "0x1bfcc5aaebc43b53d181ad28013ffb74e750b43b5f7c3340bfe6f33ac66e3d49",
    revocationKey: "0x6c329cb9bd41aa21e38d2c1c6ca83d88b381f2dad0a489769684f4d5c575eb2b",
  });

  console.log(`Credential status is: ${revoked}`);
}

Make sure to provide a TypedDataSigner if you intend to use Meta transactions (for example 'Wallet')!

Now you're ready to interact with your revocation lists/keys!

Development

Test Suite

To start the test suite, you can call:

npm run test

To get a coverage report you need to run:

npm run test:coverage

ethr-revocation-registry-controller's People

Contributors

fermentfan avatar strumswell avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.