zkKYC SDK - Simply execute KYC progress using the RedirectURL as the src-attribute value for the iFrame.
Use Case
To reduce the development cost for the project side, the project can use zkKYC capability by simply accessing the link. Users can achieve full KYC capability on the web/H5, reducing the possibility of 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.
import { ZkMeWidget,type Provider } from'@zkmelabs/widget'constprovider:Provider= {asyncgetAccessToken() {// Request a new token from your backend service and return it to the widget.// For the access token, please refer to Usage Example -> Exchanging API_KEY for Access Token belowreturnfetchNewToken() },asyncgetUserAccounts() {// If your project is a Dapp,// you need to return the user's connected wallet address.if (!userConnectedAddress) { userConnectedAddress =awaitconnect() }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'] },// According to which blockchain your project is integrated with,// choose and implement the corresponding methods as shown below.// EVMasyncdelegateTransaction(tx) {consttxResponse=awaitsigner.sendTransaction(tx)returntxResponse.hash },// CosmosasyncdelegateCosmosTransaction(tx) {consttxResponse=awaitsigningCosmWasmClient.execute(tx.senderAddress,tx.contractAddress,tx.msg,'auto' )returntxResponse.transactionHash },// AptosasyncdelegateAptosTransaction(tx) {consttxResponse=awaitaptos.signAndSubmitTransaction(tx)returntxResponse.hash },// ...// See the Provider interface definition for more details on other chains.}constzkMeWidget=newZkMeWidget( appId,// This parameter means the same thing as "mchNo"'YourDappName', chainId, provider, options)
NOTE: The specific configuration for the "option" parameter is shown in the table below
Param
Type
Description
options.lv
VerificationLevel?
"zkKYC" or "Anti-Sybil", default "zkKYC"
Step 3. Listen to the finished widget events to detect when the user has completed the zkKYC process.
import { verifyWithZkMeServices } from'@zkmelabs/widget'functionhandleFinished(verifiedAccount:string) {// We recommend that you double-check this by calling// the functions mentioned in the "Helper functions" section.if ( verifiedAccount === userConnectedAddress ) {// zkKYCconstresults=awaitverifyWithZkMeServices(appId, userConnectedAddress)if (results) {// Prompts the user that zkKYC verification has been completed } }}zkMeWidget.on('finished', handleFinished)
Step 4. Launch the zkMe widget and it will be displayed in the center of your webpage.
zkMeWidget.launch()
Helper functions
verifyWithZkMeServices
Before launching the widget, you should check the zkKYC status of the user and launch the widget when the check result is false.
If the user has passed the KYC verification and the user’s SBT could be accessed by your project, the following interface will be seen. Meanwhile, there will be a message with KYC results sent to your DApp.
Camera Permission Denied Error
The following screen will be displayed for possible issues such as the user denying browser camera access or not having a camera on the device.
OCR Scan Error
The following screen will be displayed when an exception occurs during the OCR process.
Face Recognition Error
The following screen will be displayed for possible problems such as eyes closed detected, art mask detected etc.
Face Mismatch Error
The following screen will be displayed when the face could not match the uploaded ID.
Faceprint Mismatch Error
The following screen will be displayed for the possible problem that the fully homomorphically encrypted faceprint does not match the one associated with this MeID.
Faceprint Recognition Server Error
The following screen will be displayed when something goes wrong on the faceprint recognition server.
Unknown Error
The following screen will be displayed when something goes wrong not listed above.