@energyweb/onchain-claims
TypeScript icon, indicating that this package has built-in type declarations

2.2.0 • Public • Published

Energy Web Foundation Logo

OnChain Claims

Description

This package consists of EVM smart contract registries related to EnergyWeb Roles, responsible to issuance for on-chain role issuance and revocation. The package majorly relies on two main contracts, ClaimManager and ClaimRevocationRegistry for issuance and revocation of EnergyWeb roles respectively. @energyweb/onchain-claims is a typescript module.

{onchain-claims} is a component of the Energy Web Decentralized Operating System

Usage

ClaimRevocation

The ClaimRevocation class can be used to revoke an on-chain issued claim / role. It used the ClaimRevocationRegistry contract to perform revocation.

import { EwSigner } from '@ew-did-registry/did-ethr-resolver';
import {
  VOLTA_CLAIM_REVOCATION_REG_ADDRESS,
} from "@energyweb/credential-governance";
import {
  ClaimRevocation
} from "@energyweb/onchain-claims";

(async () => {
  let revoker: EwSigner;
  const claimRevocation = new ClaimRevocation(
    VOLTA_CLAIM_REVOCATION_REG_ADDRESS,
    revoker
  );
  await claimRevocation.revokeClaim('namespace', 'subjectDID', 'revokerDID');
  const isRevoked = await claimRevocation.isClaimRevoked(
    'namespace',
    'subjectDID'
  );
})();

Contract Descriptions

ClaimManager.sol

This is an implementation to register claims / roles on-chain (current deployment - EnergyWeb Chain). ClaimManager is designed to register roles issued by authorised issuers (validated from RoleDefinition).

ClaimsRevocationRegistry.sol

This EVM contracts registers revocation for on-chain claims, it validates the authority of the revoker and existence of the subject's claim for revocation.

Installation

This is a Node.js module available through the npm registry.

Requirements

Before installing, download and install Node.js. Node.js 16.10.0 or higher is required.

Installation is done using the following commands:

$ npm install

Build

$ npm run build

Run

$ npm run start

Testing

Unit Tests

$ npm run test-rpc

Package Sidebar

Install

npm i @energyweb/onchain-claims

Weekly Downloads

95

Version

2.2.0

License

GPL-3.0-or-later

Unpacked Size

14.3 MB

Total Files

62

Last publish

Collaborators

  • kyleiankian
  • energywebdev
  • aznagy
  • bagaric
  • pkosin
  • drgorb
  • kroy
  • manihagh