This section demonstrates how to use the DVR types to interact with the DVR client binary to:
Generate a DVR token.
Generate a User Data token.
Generate a zkPass proof.
Verify a zkPass proof.
Ubuntu version 20 or higher WSL (Windows Subsystem for Linux) is also supported. Other similar Linux distros should also work.
For WSL installation guide, read here.
Some APT package dependencies Run the following to install the required packages:
Rust compiler toolchain Follow this 2-step instruction to install the Rust toolchain.
Follow these steps to install the zkPass SDK and to run the demo application.
For the purposes of this guide, the zkpass-sdk
repository is cloned under the home directory of the current user, retaining its default name. This places the root directory for the zkpass-sdk
repository at ~/zkpass-sdk
. As a result, the directory for the Rust/Linux binding of the SDK is set at ~/zkpass-sdk/rust
.
Should you choose to clone the zkpass-sdk
repository into a different location, ensure that you adjust any referenced paths in the instructions to match your chosen directory structure.
Clone the zkpass-sdk repo
Enter zkpass-sdk/rust
Directory
From the zkpass-sdk/rust
directory, execute test.sh
script to build the SDK and run the demo application:
The correct output of zkpass-demo should look like the following:
This demo will download a binary file. If the download process times out, try the following solutions:
Ensure you have a stable internet connection when running the script.
Turn off any active VPNs and try again.
The error message "cannot open shared object file: No such file or directory" indicates an issue. This may occur due to missing or corrupted .so. Here are some possible solutions:
Ensure you have a stable internet connection when running the script.
Turn off any active VPNs and try again.
Manually download the .so file:
Download libdvr_client.so
file from the website.
Move these files to zkpass-sdk/rust/lib
folder.
Comment out download-so.sh
in test.sh
script.
Run the test.sh
script again; the error should be resolved.
This section describes how we use the zkPass SDK in our demo code
This code snippet generates a zkPass proof. It requires 3 parameters:
credentials
: Get yours API key and secret at https://portal.ssi.id
user_data_tokens
: stringified signed users data.
dvr_token
: signed Dvr query.
This code snippet verifies a zkPass proof token. Components :
expected_metadata
: this is the expected metadata of the dvr.
zkvm
: zkvm used to generate proof, currently we only support r0
.
service_url
: you can use https://playground-zkpass.ssi.id
, or use your own endpoint if you deploy zkPass on your own server.
This code snippet generate user data token. Components :
signing_key
: a private key used to sign user data.
data
: user data in JSON format.
verifying_key
: a public key to verify that user data token.
This code snippet generate DVR token. Components :
signing_key
: a private key used to sign dvr.
dvr_data
: Dvr data to sign.
Here's the directory structure for Rust SDK tutorial.
The privacy-apps components :
DVR types provide the necessary definitions for developers to interact with libdvr_client.so
.
Client utils contain FFI helpers for working with DVR types.
The zkpass-demo components :
data_holder.rs
: Handles the entire process, from generating tokens to verifying proofs.
data_issuer.rs
: Manages the process of generating user data tokens.
proof_verifier.rs
: Handles the generation of DVR tokens and the proof verification process.
lib_loader.rs
: Contains the detailed logic for interacting with libdvr_client.so
.
zkpass_proof_token
: check section for more details.