Integrate and customize the Gatekeeper frontend with your existing frontend.
npm install @layer3/gatekeeper-sdkIntegrate and customize the Gatekeeper frontend with your existing frontend.
Install @layer3/gatekeeper-sdk with npm or yarn
``bash`
npm install @layer3/gatekeeper-sdk
`bash`
yarn add @layer3/gatekeeper-sdk
First, you'll need to setup the GatekeeperContext, you use it like any other React context:
`ts
import { GatekeeperContextProvider } from "@layer3/gatekeeper-sdk";
root.render(
);
`
Then anywhere in your app, import as:
`javascript
import AccessControlModal from "@layer3/gatekeeper-sdk";
const GateKeeperModal = () => {
return (
export default GateKeeperModal;
`
| Parameter | Description | Type | Required |
| ----------------- | --------------------------------------------------------------- | -------------- | -------- |
| account | Wallet address from the user | string | Yes |boolean
| polygonId | Boolean to enable polygon id claim | | No\* |string array
| roles | Arrays of roles | | No\* |string array
| checkIds | Arrays of checks ids | | No\* |Object
| customization | Color properties explained below | | No\\ |Object
| nftClaimLinks | Object with links to claim the nfts | | No |string
| signature | String provided to make the auth part with out user interaction | | No |boolean
| isStaging | Boolean to change between staging/production url | | No\\\* |
\* At least one have to be provide: polygonId or roles or checkIdsisStaging
\\ Default customization properties
\\\* by default is false
`js`
primaryColor: '#059669',
textColor: '#e2e8f0',
buttonTextColor: '#e2e8f0',
backgroundColor: '#141724',
#### Roles:
`js`
roles={['role1', 'role2']}
#### CheckIds:
`js`
checkIds={['KYC', 'exampleId']}
#### NftClaimLinks:
`js`
nftClaimLinks={{
'nftContractAddress1': 'https://claimNft1.1com',
'nftContractAddress2': 'https://claimNft2.com',
}}
Check Here for details on gating access to components/routes.
| Parameter | Description | Type | Required |
| ------------------- | ----------------------------- | -------- | -------- |
| backgroundColor | Background color of the modal | string | No |string
| textColor | Color for the body text | | No |string
| buttonTextColor | Color for button texts | | No |string
| primaryColor | Primary button, info color | | No |
- 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..
| Function name | Description | Parameters | Return type |
| ---------------- | ------------------------------------------------------------ | ---------- | ----------- |
| getSignature | Returns the user signature to avoid login process on the sdk | Object | string |string
| getNonce | Returns the currect Nonce for a provided user address | | number |
#### Parameters details
- getSignature
`js`
const params = {
address: string;
signer: any;
appId?: string;
allowUserRegistration?: boolean; // Default is true
isStaging?: boolean; // Default is false
}
const signature = getSignature(params)
- getNonce
`js`
const {nonce} = getNonce(address: string, isStaging?: boolean)
To start TSDX helps you develop, test, and publish modern TypeScript packages/
`bash`
yarn start
To start storybook Storybook is a frontend workshop for building UI components and pages in isolation.
`bash`
yarn storybook
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
`bash``
git add .
yarn run commit
git push