NexeraID KYC SDK
- NexeraID KYC SDK, written in TypeScript.
How to install
$ npm install @nexeraid/kyc-sdk
First steps
- You need to provide NexeraID Team with the Web App domain and a Webhook
- You need to provide NexeraID with the required rules
- NexeraID Team will provide to you with an API_KEY and a RULE_ID
How to use
Server app
const response = await fetch('https://api.nexera.id/kyc/auth/access-token', {
body: JSON.stringify({ publicAddress }),
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${API_KEY}`
},
method: 'POST'
})
const { accessToken } = await response.json()
const response = await fetch('https://api.nexera.id/compliance/rules/execute', {
body: JSON.stringify({
inputData: input.data,
address: input.address,
policyId: `${POLICY_ID}`,
}),
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${API_KEY}`
},
method: 'POST'
})
const validationResult = await response.json()
Web app
const KYC_CLIENT = new KycClient({ identifier: "myIdentifier"})
KYC_CLIENT.onSignPersonalData(async (data: string) => {
return await signMessageAsync({ message: data })
})
KYC_CLIENT.onOffChainShareCompletition((isValid: boolean) => {
if (isValid)
console.log(`Success Off chain data sharing`)
else
console.error(`Off chain share data was invalid`)
})
KYC_CLIENT.onZkCallback(async (data) => {
const tx = await signer.data.sendTransaction(data);
return tx.hash;
});
const signingMessage = KycClient.buildSignatureMessage(address)
const signature = await signMessageAsync({ message: signingMessage })
const accessToken = getAccessTokenFromYourServer(address)
<button id="kyc-btn">Start KYC</button>
KYC_CLIENT.init({
auth: {
accessToken,
signingMessage,
signature,
},
initOnFlow: "REQUEST",
})
KYC_CLIENT.init({
auth: {
accessToken,
signingMessage,
signature,
},
initOnFlow: "MANAGEMENT",
})
Keep Updated
For the latest changes, see the CHANGELOG.