Quick Start

You can read A Comprehensive Guide to Verifying Private Data with zkPass before start to integrate zkPass AITransGate-JS-SDK.

Register and Config the Project in zkPass AIDevHub


Login zkPass DevHub, connect the wallet.

Create a new project, enter project information.

After "Create", a project is created with an appID.

Click on 'Add Schema' and choose the schema category.

Choose a base schema (the base schema is a default template of schema without assertions).

Config the assertions based on the requirements.

After 'Submit', a schema is created automatically with an unique schemaId for the project.

Developers can add multiple schemas for the project.

Once the schema is successfully created, it cannot be modified but can be deleted. Please carefully review before submitting.

Integrate TransGate JS-SDK


Developers can install the package using either NPM or Yarn

Using NPM

npm install @zkpass/transgate-js-sdk

Using Yarn

yarn add @zkpass/transgate-js-sdk

Integrate the TransGate JS-SDK with your project

const verify = async () => {
  try {
    // The appid of the project created in dev center
    const appid = "8fb9d43c-2f24-424e-a98d-7ba34a5532f5"

    // Create the connector instance
    const connector = new TransgateConnect(appid)
    // The schema id of the project
    const schemaId = "516a720e-29a4-4307-ae7b-5aec286e446e"

    // Launch the process of verification
    // When running the TransGate SDK on a PC, if the user has not installed TransGate,
    // a QR code will pop up. The user can scan it using the TransGate App on their 
    // phone to complete verification (iOS users can directly use the system scanner)
    // or install TransGate from the Google Play Store. On mobile DApps, 
    // TransGate will automatically invoke the TransGate App.
    // If it is not installed, the user will be prompted to install it.
    const res = await connector.launch(schemaId)
    
    //If you want to bind the user's address with the proof, the `launch` function
    //also accepts a second parameter, which is the user's wallet address.
    const address = "0xD038048D1AE4c04dF2759F33BFda969999999641"
    const responseWithAddress = await connector.launch(schemaId, address)

    // verifiy the res onchain/offchain based on the requirement  
    } catch (error) {
    console.log('transgate error', error)
  }
}

TransGate download link is https://chromewebstore.google.com/detail/zkpass-transgate/afkoofjocpbclhnldmmaphappihehpma

Please make sure the domain of DApp matches the configuration of the project in dev center.

Validate the result


After receiving the verification result(resin code block), developers should validate it.

You can refer to API References and Generate proof and verify the result for more information.

Last updated