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
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
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
verifyZkPassProofInternal
⸠verifyZkPassProofInternal(zkPassProofToken
): Promise
<VerifyZkPassProofResult
>
Parameters
Returns
Promise
<VerifyzkPassProofResult
>
Overrides
ZkPassProofVerifier.verifyZkPassProofInternal
getFfiWrapper
⸠Private
getFfiWrapper(): ZkPassFfiR0
Get the FFI Wrapper for zkVm
Returns
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