3.0.8 • Published 2 years ago

@layer3/gatekeeper-sdk v3.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

ParameterDescriptionTypeRequired
accountWallet address from the userstringYes
polygonIdBoolean to enable polygon id claimbooleanNo*
rolesArrays of rolesstring arrayNo*
checkIdsArrays of checks idsstring arrayNo*
customizationColor properties explained belowObjectNo**
nftClaimLinksObject with links to claim the nftsObjectNo
signatureString provided to make the auth part with out user interactionstringNo
isStagingBoolean to change between staging/production urlbooleanNo***

* 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

ParameterDescriptionTypeRequired
backgroundColorBackground color of the modalstringNo
textColorColor for the body textstringNo
buttonTextColorColor for button textsstringNo
primaryColorPrimary button, info colorstringNo

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 nameDescriptionParametersReturn type
getSignatureReturns the user signature to avoid login process on the sdkObjectstring
getNonceReturns the currect Nonce for a provided user addressstringnumber

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
3.0.4

2 years ago

3.0.3

2 years ago

3.0.8

2 years ago

3.0.7

2 years ago

3.0.6

2 years ago

3.0.5

2 years ago

1.12.0

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

1.11.4

2 years ago

1.13.1

2 years ago

1.11.3

2 years ago

1.13.0

2 years ago

1.11.7

2 years ago

1.11.6

2 years ago

1.11.5

2 years ago

1.10.5

2 years ago

1.10.4

2 years ago

1.10.3

2 years ago

1.10.2

2 years ago

1.10.9

2 years ago

1.10.8

2 years ago

1.10.7

2 years ago

1.8.1

2 years ago

1.8.0

2 years ago

1.9.4

2 years ago

1.9.3

2 years ago

1.9.2

2 years ago

1.11.0

2 years ago

1.11.2

2 years ago

1.11.1

2 years ago

1.9.1

2 years ago

1.7.3

2 years ago

1.9.0

2 years ago

1.7.2

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.10.1

2 years ago

1.10.0

2 years ago

1.6.9

2 years ago

1.6.11

2 years ago

1.6.8

2 years ago

1.6.10

2 years ago

1.6.7

2 years ago

1.6.13

2 years ago

1.6.12

2 years ago

1.6.15

2 years ago

1.6.14

2 years ago

1.6.6

2 years ago

1.6.5

2 years ago

1.6.4

2 years ago

1.6.3

2 years ago

1.6.2

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.5.1

2 years ago

1.5.0

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.13

3 years ago

1.2.12

3 years ago

1.2.11

3 years ago

1.2.10

3 years ago

1.2.9

3 years ago

1.2.8

3 years ago

1.2.7

3 years ago