KYC/AML Data Collection

The following page will explain how to integrate with the ky0x Compliance Toolkit which will perform KYC and AML verification on the consumer, and if successful the consumer will be prompted to claim a Web3 Identity Passport, an extended ERC-1155 contract.

Authenticating to ky0x

You will first need to authenticate to our service to generate a JWT token that will be used in subsequent interactions. Perform a POST request to the/v1/login endpoint and in the body include the API key and the consumer-provided wallet address to obtain a JWT session token.

The authentication endpoint must be invoked each time a consumer onboards through ky0x.

The JWT session token is valid for 24 hours and is unique to the consumer-provided wallet address.

Authenticate to obtain JWT

POST /v1/login

apiKey: The API Key assigned to your DAPP walletAddress: The target wallet address to go through Ky0x. The generated session token will only work for this specific wallet address.

Request Body

{
    'accessToken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
}

Here's a javascript function which will invoke the /v1/login endpoint and return the JWT session token:

export default async function Login({
    apiKey,
    walletAddress,
}: {
    apiKey: string;
    walletAddress: string;
}): Promise<string> {
    const url = `https://endpoint.com/v1/login`;
    const response = await fetch(url, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
        },
        body: JSON.stringify({
            apiKey,
            walletAddress,
        }),
    });
    if (response.status >= 400) {
        throw Error('Failed to authenticate');
    }
    const responseJson = await response.json();
    return responseJson.accessToken;
}

Accessing the ky0x Compliance Toolkit

You will now load the ky0x Compliance Toolkit in a new browser context using the JWT token as a URL hash parameter.

Here's a javascript example of launching a new tab:

 window.open(`https://endpoint.com/#${jwtToken}`, '_blank');

The user will perform KYC/AML verifications in the ky0x Compliance Toolkit and once complete the user will be prompted to claim an Identity Passport.

Last updated