Class: ZkPassClient

The main class which implements all of the traits defined in this module.

Hierarchy

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

â€ĸ new ZkPassClient(zkPassServiceUrl, zkPassApiKey, zkVm): ZkPassClient

Parameters

Returns

ZkPassClient

Overrides

ZkPassProofVerifier.constructor

Properties

zkPassServiceUrl

â€ĸ Private Readonly zkPassServiceUrl: string

Containing the URL address of the ZkPass service


zkPassApiKey

â€ĸ Private Optional Readonly zkPassApiKey: ZkPassApiKey

Representing a pair of keys (apiKey and secretApiKey) used for accessing ZkPass services securely.


zkVm

â€ĸ Private Readonly zkVm: string

Representing the user's chosen virtual machine (VM) for interacting with ZkPass services. Currently only support for r0

Methods

decryptJweToken

▸ decryptJweToken(key, jweToken): Promise<JWTDecryptResult>

Decrypts a JWT token

Parameters

Returns

Promise<JWTDecryptResult>

Implementation of

ZkPassUtility.decryptJweToken


encryptDataToJweToken

▸ encryptDataToJweToken(key, data): Promise<string>

Encrypts data into a JWE token

Parameters

Returns

Promise<string>

Implementation of

ZkPassUtility.encryptDataToJweToken


generateZkPassProof

▸ generateZkPassProof(userDataToken, dvrToken): Promise<string>

Generates a ZkPass proof.

This function calls the corresponding RESTful API provided by the zkPass Service, where the query in the DVR is processed and the proof is generated. It encrypts both the signed user data token and the signed DVR token prior to sending it to the zkPass Service.

This function is asynchronous and must be awaited. It’s designed to be used in asynchronous contexts, for example within async functions or blocks.

Parameters

Returns

Promise<string>

Implementation of

ZkPassProofGenerator.generateZkPassProof


getApiToken

▸ getApiToken(): string

Retrieves the API base64 token from the API key and API secret

Returns

string


getQueryEngineVersionInfo

▸ getQueryEngineVersionInfo(): Promise<QueryEngineVersionInfo>

Returns the query engine and method version information

Returns

Promise<QueryEngineVersionInfo>

Implementation of

ZkPassProofVerifier.getQueryEngineVersionInfo


signDataToJwsToken

▸ signDataToJwsToken(signingKey, data, verifyingKeyJwks?): Promise<string>

Signs data into a JWS token

Parameters

Returns

Promise<string>

Implementation of

ZkPassUtility.signDataToJwsToken


verifyJwsToken

▸ verifyJwsToken(key, jwsToken): Promise<JWTVerifyResult>

Verifies the signature of a JWS token

Parameters

Returns

Promise<JWTVerifyResult>

Implementation of

ZkPassUtility.verifyJwsToken


verifyZkPassProofInternal

▸ verifyZkPassProofInternal(zkPassProofToken): Promise<VerifyZkPassProofResult>

Parameters

Returns

Promise<VerifyzkPassProofResult>

Overrides

ZkPassProofVerifier.verifyZkPassProofInternal


getFfiWrapper

▸ Private getFfiWrapper(): ZkPassFfiR0

Get the FFI Wrapper for zkVm

Returns

ZkPassFfiR0


getKeys

▸ getKeys(): Promise<Keys>

Asynchronously fetches and verifies public keys for service signing and encryption from a remote JWKS endpoint.

Returns

Promise<Keys>


getEncryptionKey

▸ getEncryptionKey(): Promise<string>

Asynchronously retrieves the service encryption public key from the getKeys function

Returns

Promise<string>


getVerifyingKey

▸ getVerifyingKey(): Promise<string>

Asynchronously retrieves the service verifying public key from the getKeys function

Returns

Promise<string>

Last updated