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

@layer3/gatekeeper-sdk

v3.0.8

Published

Integrate and customize the Gatekeeper frontend with your existing frontend.

Downloads

11

Readme

Gatekeeper package

Integrate and customize the Gatekeeper frontend with your existing frontend.

Installation

Install @layer3/gatekeeper-sdk with npm or yarn

npm install @layer3/gatekeeper-sdk
yarn add @layer3/gatekeeper-sdk

Usage/Examples

First, you'll need to setup the GatekeeperContext, you use it like any other React context:

import { GatekeeperContextProvider } from "@layer3/gatekeeper-sdk";

root.render(
  <GatekeeperContextProvider>
    <AppContextProvider>
      <Router>
        <App />
      </Router>
    </AppContextProvider>
  </GatekeeperContextProvider>,
);

Then anywhere in your app, import as:

import AccessControlModal from "@layer3/gatekeeper-sdk";

const GateKeeperModal = () => {
  return (
    <div>
      <AccessControlModal
        account={address}
        checkIds={["KYC", "exampleId"]}
        roles={["role1", "role2"]}
        polygonId={false}
        checkCallback={checkCallback}
        customization={{
          primaryColor: "#000000",
          backgroundColor: "#FFFFFF",
          buttonTextColor: "#FFFFFF",
          textColor: "#000000",
        }}
      />
    </div>
  );
};

export default GateKeeperModal;

Parameters

| Parameter | Description | Type | Required | | ----------------- | --------------------------------------------------------------- | -------------- | -------- | | account | Wallet address from the user | string | Yes | | polygonId | Boolean to enable polygon id claim | boolean | No* | | roles | Arrays of roles | string array | No* | | checkIds | Arrays of checks ids | string array | No* | | customization | Color properties explained below | Object | No** | | nftClaimLinks | Object with links to claim the nfts | Object | No | | signature | String provided to make the auth part with out user interaction | string | No | | isStaging | Boolean to change between staging/production url | boolean | No*** |

* At least one have to be provide: polygonId or roles or checkIds ** Default customization properties *** isStaging by default is false

primaryColor: '#059669',
textColor: '#e2e8f0',
buttonTextColor: '#e2e8f0',
backgroundColor: '#141724',

Params examples

Roles:

roles={['role1', 'role2']}

CheckIds:

checkIds={['KYC', 'exampleId']}

NftClaimLinks:

nftClaimLinks={{
  'nftContractAddress1': 'https://claimNft1.1com',
  'nftContractAddress2': 'https://claimNft2.com',
}}

Security

Check Here for details on gating access to components/routes.

Customization

| Parameter | Description | Type | Required | | ------------------- | ----------------------------- | -------- | -------- | | backgroundColor | Background color of the modal | string | No | | textColor | Color for the body text | string | No | | buttonTextColor | Color for button texts | string | No | | primaryColor | Primary button, info color | string | No |

Issuance

  • During this process, if the role or roles you are using have a verifiable credential (VC) available, the user will be able to claim it during the issuance process..

issuanceExample

Funtions

| Function name | Description | Parameters | Return type | | ---------------- | ------------------------------------------------------------ | ---------- | ----------- | | getSignature | Returns the user signature to avoid login process on the sdk | Object | string | | getNonce | Returns the currect Nonce for a provided user address | string | number |

Parameters details

  • getSignature
const params = {
  address: string;
  signer: any;
  appId?: string;
  allowUserRegistration?: boolean; // Default is true
  isStaging?: boolean; // Default is false
}
const signature = getSignature(params)
  • getNonce
  const {nonce} = getNonce(address: string, isStaging?: boolean)

Commands

To start TSDX helps you develop, test, and publish modern TypeScript packages/

yarn start

To start storybook Storybook is a frontend workshop for building UI components and pages in isolation.

yarn storybook

GitHub Actions

One actions are added by default:

  • node which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix

We use a semantic versioning to update the build or changes that we have on the project. They way to handle this is using a command

git add .
yarn run commit
git push