Overview
Overview
When integrating data verification solutions with your DApps, especially web-based DApps, you can utilize the Primus zkTLS SDK. For server-side integration of zkTLS capabilities, please refer to the Backend Integration guide.
With the zkTLS SDK, you can verify any data from the internet, generate proofs, and enable on-chain verifications. To verify custom data from your users, follow these simple steps:
Create a Template: Use the Primus Develop Hub to easily set up a data verification template. This template includes the target data items, allowing you to test the verification process.
Create a Project: Obtain a paired appID and appSecret, then configure them in your DApp to integrate the zkTLS SDK and APIs.
For more details on creating templates and setting up your project, refer to the Developer Hub.
How to Integrate
Here's a simplified flow of how Primus zkTLS SDK integrates with a web-based DApp:
1. Create/Search Template: Login to the Primus Develop Hub to create or search for a Template containing the data you need to verify. This is a key step in integrating the zkTLS SDK into your DApp.
2. Create Project: Create a Project on the Primus Develop Hub to obtain a paired appID and appSecret, which are required to use the zkTLS SDK.
3. Configure Verification Parameters: Ensure the SDK parameters are configured correctly. Refer to the test example and the production example for guidance.
4. Execute zkTLS Protocol: Invoke the zkTLS protocol via your DApp to initiate the data verification process.
5. Verify Data Verification Result: Your DApp retrieves the verification result from the zkTLS SDK and validates Primus' signature to ensure trustworthiness.
6. Execute Business Logic: Based on the verification result, your DApp executes the relevant business logic, such as submitting the proof on-chain or triggering other operations.
Set Verification Patterns
Verification Models
Primus zkTLS SDK supports two models: the Proxy TLS model and the MPC TLS model. You can specify the desired model by setting the "algorithmType" parameter during SDK integration.
Verification Logics
For each data verification process, you can predefine the verification logic, such as whether the process returns plaintext or hashed text, or whether additional verification conditions need to be incorporated into the data verification process.
Supported logics:
- Hashed result
By default, our zkTLS SDK retrieves a plaintext verification result. If, in some cases, you want to keep the user’s data private, a hashed verification result is preferred. In the hashed result case, a ‘SHA256’ hashed data item will be returned to your DApp.
- Conditions result
For more flexible verification requirements, several different comparison operators can be added to the data items during the verification process, and a true or false result will be returned based on the comparison. The comparison operators include:
'>' (greater than): verifies if the data item is greater than a target value
'<' (less than): verifies if the data item is less than a target value
'=' (equal to): verifies if the data item is equal to a target value
'!=' (not equal to): verifies if the data item is not equal to a target value
'>=' (greater than or equal to): verifies if the data item is greater than or equal to a target value
'<=' (less than or equal to): verifies if the data item is less than or equal to a target value
All of this logic should be configured during the SDK integration process. For configuration details, refer to the test example and the production example for guidance.
Interact with Blockchains
The Primus zkTLS protocol is compatible with multiple blockchains. We provide smart contracts that can be deployed on various blockchains to verify data proofs generated by users via the zkTLS SDK.
Currently, support is available for several testnets and mainnets. For more details, refer to the on-chain interactions section.
Quick Start for Beginners
Installation Get the SDK set up in your project.
Test Example Understand how to use the zkTLS SDK.
Stay Connected
Keep up with the latest Primus developments:
- Star our GitHub Repository
- Join our Discord Community