
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@energyweb/credential-governance
Advanced tools
Smart contract and client code specific to EnergyWeb credential governance (including roles)
This package consists of EVM smart contract related to EnergyWeb Name Service and libraries to resolve / read namespaces & defintions.
@energyweb/credential-governance is a typescript module.
{credential-governance} is a component of the Energy Web Decentralized Operating System
The DomainReader class can be used as shown to read a domain definition.
import {
  DomainReader,
  VOLTA_ENS_REGISTRY_ADDRESS,
} from "@energyweb/credential-governance";
import { providers, utils } from "ethers";
(async () => {
  const provider = new providers.JsonRpcProvider(
    "https://volta-rpc.energyweb.org"
  );
  const reader = new DomainReader({
    ensRegistryAddress: VOLTA_ENS_REGISTRY_ADDRESS,
    provider,
  });
  const roleDefinition = await reader.read({
    node: utils.namehash("manufacturer.roles.flex.apps.exampleco.iam.ewc"),
  });
})();
The DomainTransactionFactory class can be used to add and update definitions specific to namespaces.
import {
  DomainTransactionFactoryV2,
  VOLTA_RESOLVER_V2_ADDRESS,
} from "@energyweb/credential-governance";
(async () => {
  const domainTransactionFactory = new DomainTransactionFactoryV2({
    domainResolverAddress: VOLTA_RESOLVER_V2_ADDRESS,
  });
  const domain = 'sampleDomain';
  const role: IRoleDefinitionV2 = {
    requestorFields: [
      {
        fieldType: 'fieldType',
        label: 'label',
        required: true,
        minLength: 5,
        minDate: new Date(),
        maxDate: new Date(),
      },
    ],
    issuer: {
      issuerType: 'DID',
      did: [`did:ethr:volta:0x7aA65E31d404A8857BA083f6195757a730b51CFe`],
    },
    revoker: {
      revokerType: 'DID',
      did: [`did:ethr:volta:0x7aA65E31d404A8857BA083f6195757a730b51CFe`],
    },
    metadata: [],
    roleName: 'myRole1',
    roleType: 'sample',
    version: 1,
    enrolmentPreconditions: [],
  };
  const call = domainDefTxFactoryV2.newRole({
    domain: domain,
    roleDefinition: role,
  });
  await (await owner.sendTransaction(call)).wait();
})();
RoleDefinitionResolverV2.solThis is an implementation of an ENS resolver that represents a role definition. It extends the ENS Public Resolver with additional resolver profiles, specifically for the use case of issuance, revocation and verify role claims using a smart contract. In other words, this custom ENS resolver allows some properties of a role definition to be (usefully) readable by another smart contract.
DomainNotifier.solThis EVM contracts notifies the updation of ENS namespaces resolved data.
This is a Node.js module available through the npm registry.
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
$ npm run build
$ npm run start
$ npm run test-rpc
FAQs
Smart contract and client code specific to EnergyWeb credential governance (including roles)
We found that @energyweb/credential-governance demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.