zkKYC - Compliance Suite
Use Case
To reduce the development cost for the project side, the project can use zkKYC capability by simply accessing the link. Users can complete full KYC verification directly on the web/H5, reducing user churn by minimizing the need to navigate to another page.
zkMe-Widget KYC Process
Step 1: Enter the service authorization Widget page; the user confirms and goes to the next step
Step 2: E-mail verification login
Step 3: Verify the SBT to confirm that it is authenticated
Step 4: Depending on the KYC configuration of the project, determine whether the user needs to undergo different verification processes.
Interaction Instructions

Integration via NPM
You can refer to @zkmelabs/widget and please make sure to use the latest version.
Installation
pnpm add @zkmelabs/widget
# or
yarn add @zkmelabs/widget
# or
npm install @zkmelabs/widget
Getting Started
Step 1. Import styles
import '@zkmelabs/widget/dist/style.css'
Step 2. Create a new ZkMeWidget
instance
ZkMeWidget
instanceimport { ZkMeWidget, type Provider } from '@zkmelabs/widget'
const provider: Provider = {
async getAccessToken() {
// -------------------------TODO-------------------------
// Request a new token from your backend service and return it to the widget.
// For the access token, see docs.zk.me/zkme-dochub/verify-with-zkme-protocol/integration-guide/javascript-sdk/zkkyc-compliance-suite#how-to-generate-an-access-token-with-api_key
// ------------------------------------------------------
return fetchNewToken()
},
async getUserAccounts() {
// -------------------------TODO-------------------------
// If your project is a Dapp,
// you need to return the user's connected wallet address.
const userConnectedAddress = await connect()
return [userConnectedAddress]
// If not,
// you should return the user's e-mail address, phone number or any other unique identifier.
//
// return ['email address']
// or
// return ['phone number']
// or
// return ['unique identifier']
// ------------------------------------------------------
},
}
const zkMeWidget = new ZkMeWidget(
// -------------------------TODO-------------------------
appId, // This parameter means the same thing as "mchNo"
'YourDappName',
'137', // chainId. No changes are needed here if the account is configured for cross-chain.
provider,
{
lv: 'zkKYC'
programNo: 'YourProgramNo' // You can find the Program No in the ‘Configuration’ section of your dashboard
// For other options, please refer to the table below
}
// ------------------------------------------------------
)
options.lv
VerificationLevel?
"zkKYC"
or "MeID"
, default "zkKYC"
options.programNo
string?
If you have activated multiple programs running in parallel, please pay attention to this setting:
The param can be found in Dashboard and please make sure the program is enabled. The SDK will take the number of the first activated program as the default value if this parameter is not provided in the code.
options.theme
Theme?
"auto"
, "light"
or "dark"
, default "auto"
.
options.locale
Language?
"en"
or "zh-hk"
, default "en"
.
Step 3. Listen to the kycFinished
widget events to detect when the user has completed the zkKYC process.
kycFinished
widget events to detect when the user has completed the zkKYC process.function handleFinished(results) {
const { isGrant, associatedAccount } = results
if (
isGrant &&
associatedAccount === userConnectedAddress.toLowerCase()
) {
// -------------------------TODO-------------------------
// Prompts the user that zkKYC verification has been completed
// ------------------------------------------------------
}
}
zkMeWidget.on('kycFinished', handleFinished)
Step 4. Launch the zkMe widget and it will be displayed in the center of your webpage.
// This is the code to launch our widget on your page
button.addEventListener('click', () => {
zkMeWidget.launch()
})
Helper functions
verifyKycWithZkMeServices()
Before launching the widget, you should check the zkKYC status of the user and launch the widget when the check result is false
.
import { verifyKycWithZkMeServices } from '@zkmelabs/widget'
// zkKYC
const { isGrant } = await verifyKycWithZkMeServices(
appId,
userAccount,
// Optional configurations are detailed in the table below
options
)
appId
string
This parameter means the same thing as "mchNo"
userAccount
string
The userAccount
info (such as wallet address, email, phone number, or unique identifier) must match the format of accounts returned by provider.getUserAccounts
.
options.programNo
string?
If you have activated multiple programs running in parallel, please pay attention to this setting: The param can be found in Dashboard and please make sure the program is enabled. The SDK will take the number of the first activated program as the default value if this parameter is not provided in the code.
If the level of your Dashboard account is not Cross-Chain, then you can also query users' zkKYC status from zkMe Verify & Certify Smart Contract here.
How to Generate an Access Token with API_KEY
To use your API_KEY to obtain an accessToken, you will need to make a specific HTTP request. Here's how you can do it:
a. Endpoint: Send a POST
request to the token exchange endpoint.
POST
request to the token exchange endpoint.POST https://nest-api.zk.me/api/token/get
b. Request Body:
apiKey
True
string
The API_KEY provided by zkMe.
appId
True
string
A unique identifier (mchNo) to DApp provided by zkMe.
apiModePermission
True
number
0 - email login (Only support email login)
lv
True
number
1 - zkKYC 2 - MeID
c. Response
ZkMeWidget instance methods
Common Response & Exceptions
Last updated