
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
@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.sol
This 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.sol
This 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)
The npm package @energyweb/credential-governance receives a total of 220 weekly downloads. As such, @energyweb/credential-governance popularity was classified as not popular.
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.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.