zPass docs
  • zPass
    • Introduction
    • Quickstart
    • Background
    • Benefits & Use Cases
    • Technical Foundations
    • System Participants
    • Powered by Aleo
  • Fundamentals
    • Issuer
    • Holder
    • Verifier
    • Off-chain flow
    • On-chain flow
    • Local Execution with WASM
  • ZPass Programs
    • Background
    • Verify offchain program
    • zPass issuance program
    • zPass hiding program
    • zPass invalidate program
    • zPass invalidate hiding program
    • zPass merkle tree size 8 program
  • ZPass SDK
    • Methods References
      • constructor
      • setNewHost
      • issueZPass
      • getZPassRecord
      • proveOnChain
      • proveOffChain
      • verifyOnChain
      • verifyOffChain
      • signCredential
      • initThreadPool
      • createAleoWorker
      • getMerkleRoot
      • getMerkleTree
      • getMerkleProof
      • getLeavesHashes
      • signMerkleRoot
  • Example Usage
    • Step-by-step Guide
Powered by GitBook
On this page
  • Getting Started with zPass
  • ZPass SDK Methods References
  • Example Usage
  1. zPass

Quickstart

Getting Started with zPass

Install zPass-SDK using

npm install zpass-sdk

As zPass-SDK is using wasm for its core functionality, remember to install wasm supporting packages in your project such as vite-plugin-wasm to make sure wasm can be run properly.

It is recommended to setup worker thread in your project to run the zpass-sdk properly.

A helper function called createAleoWorker is provided in zpass-sdk to initialize the worker thread. worker.js is the file that will be used to run the worker thread.

import { createAleoWorker } from "zpass-sdk";

const AleoWorker = () => {
    return createAleoWorker({
        url: "worker.js",
        baseUrl: import.meta.url,
    });
};

export { AleoWorker };

Import ZPassSDK from zpass-sdk in your worker.js file to start using the SDK. An optional initThreadPool function is provided to enable multi-threading and improve performance.

import { ZPassSDK, initThreadPool } from "zpass-sdk";

await initThreadPool();

ZPass SDK Methods References

Please refer to Methods References for the methods references of zpass-sdk.

Example Usage

For example on how to use zpass-sdk, please refer to Step-by-step Guide.

PreviousIntroductionNextBackground

Last updated 4 months ago