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

iam-client-lib

v8.1.2

Published

Library for Decentralized Identity and Access Management

Downloads

1,067

Readme

Identity and Access Management (IAM) Client Library

Overview

IAM Client Library is a TypeScript library to be used in decentralized applications for authentication and authorization using Decentralized Identifiers (DIDs) and Verifiable Credentials (VCs). DIDs and VCs are central components of self-sovereign identity, a paradigm that promotes user custody over their digital identity.

To read more about Decentralized Identifiers and Verifiable Credentials, and how they are used in the Energy Web tech stack, see our documentation here.

iam-client-lib is a key dependency of Switchboard, the identity and access management (IAM) interface for the Energy Web Decentralized Operating System.

Using iam-client-lib, Switchboard allows users to:

  • Create self-sovereign Decentralized Identifiers (DID) for users and assets using a connection with a crypto wallet such as MetaMask. DIDs are anchored in a smart contract on the Energy Web Chain
  • Define hierarchical, role-based structures for organizations, applications and assets that participate in grid activities
  • Request and issue Verifiable Credentials that are required to take on roles within an organization or application that is registered on Switchboard

Documentation

For documentation on iam-client-lib modules and API:

Development

The following is for installing and building iam-client-lib directly. For guidance on how to integrate the library into an application, see Getting Started below.

Installing Dependencies

Use npm >= 7 to install dependencies.

npm install

Compile and Build

To generate bundled JS files and types, use npm run build. Generated files are located in the dist folder.

Testing

Tests are located in the /e2e directory. For testing, use npm run test:watch.

Getting Started

The following is for integrating iam-client-lib as a dependency in your application.

Demo Source Code

See source code examples for integrating iam-client-lib into client applications here: iam-client-examples

react logo React Demo / angular logo Angular Demo / vue logo Vue Demo

Pre-requisites

  • iam-client-lib is written in TypeScript. Your application must use Node.js >= 10
  • iam-client-lib has a WebAssembly dependency. Some frameworks/bundlers do not support this out of the box, so additional action is required based on the framework you are using:

For Angular applications, add the following to package.json:

"browser": { "fs": false, "os": false, "path": false }

For React applications:

Install

To install the latest version of iam-client-lib:

npm i iam-client-lib

To install the pre-release version of iam-client-lib:

npm i iam-client-lib@canary

Note that some library dependencies require node.js built-ins. When iam-client-lib is used in browser applications, you must make sure these dependencies are polyfilled. If your application is bundled with Webpack, most dependencies can be polyfilled with node-polyfill-webpack-plugin.

Initialization

Note: You can see a full implementation of initializing iam-client-lib in the Switchboard application here.

Your application will need to initialize the library's modules. Because the library's modules have internal depenencies, modules must be initialized by the application in the correct order:

1. Initialize signer service

This will initialize staking and messaging services, and allow a connection to the cache server.

const { signerService, messagingService, connectToCacheServer } =
  await initWithPrivateKeySigner(privateKey, rpcUrl);

2. Connect to the cache server.

Depending on the signer type (i.e. MetaMask, WalletConnect), a signature may be requested.

// IAM has builtin default settings for VOLTA CHAIN, which can overriden
// 1111 is an example of another ChainID (https://chainlist.org/)
setChainConfig(1111, {
  didContractAddress: '0x3e2fb24edc3536d655720280b427c91bcb55f3d6',
  ensRegistryAddress: '0xa372d665f83197a63bbe633ebe19c7bfd4943003',
  ensResolverAddress: '0xe878bdcf5148307378043bfd2b584909aa48a227',
  rpcUrl: 'http://some-rpc.com',
});

setMessagingConfig(1111, {
  messagingMethod: MessagingMethod.Nats,
  natsServerUrl: 'https://some-exchange-server.com',
});

setCacheConfig(1111, {
  url: 'https://some-cache-server.com/',
  cacheServerSupportsAuth: true,
});

const {
  cacheClient,
  domainsService,
  connectToDidRegistry,
  verifiableCredentialsService,
} = await connectToCacheServer();

3. Connect to the DID registry

const { didRegistry, claimsService } = await connectToDidRegistry();

Contributing Guidelines

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Questions and Support

For questions and support please use Energy Web's Discord channel

Or reach out to our contributing team members by posting an issue on this repository:

EW-DOS

The Energy Web Decentralized Operating System is a blockchain-based, multi-layer digital infrastructure.

The purpose of EW-DOS is to develop and deploy an open and decentralized digital operating system for the energy sector in support of a low-carbon, customer-centric energy future.

We develop blockchain technology, full-stack applications and middleware packages that facilitate participation of Distributed Energy Resources on the grid, and create open market places for transparent and efficient renewable energy trading.

  • To learn about more about the EW-DOS tech stack, see our documentation.

  • For an overview of the energy-sector challenges our use cases address, go here.

For a deep-dive into the motivation and methodology behind our technical solutions, we encourage you to read our White Papers:

Connect with Energy Web

License

This project is licensed under the GNU General Public License v3.0 or later - see the LICENSE file for details