The main class which implements all of the traits defined in this module.
• new ZkPassClient(zkPassServiceUrl
, zkPassApiKey
, zkVm
): ZkPassClient
Parameters
Returns
Overrides
ZkPassProofVerifier.constructor
• Private
Readonly
zkPassServiceUrl: string
Containing the URL address of the ZkPass service
• Private
Optional
Readonly
zkPassApiKey: ZkPassApiKey
Representing a pair of keys (apiKey and secretApiKey) used for accessing ZkPass services securely.
• Private
Readonly
zkVm: string
Representing the user's chosen virtual machine (VM) for interacting with ZkPass services. Currently only support for r0
▸ decryptJweToken(key
, jweToken
): Promise
<JWTDecryptResult
>
Decrypts a JWT token
Parameters
Returns
Promise
<JWTDecryptResult
>
Implementation of
▸ encryptDataToJweToken(key
, data
): Promise
<string
>
Encrypts data into a JWE token
Parameters
Returns
Promise
<string
>
Implementation of
ZkPassUtility.encryptDataToJweToken
▸ 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(): string
Retrieves the API base64 token from the API key and API secret
Returns
string
▸ getQueryEngineVersionInfo(): Promise
<QueryEngineVersionInfo
>
Returns the query engine and method version information
Returns
Promise
<QueryEngineVersionInfo
>
Implementation of
ZkPassProofVerifier.getQueryEngineVersionInfo
▸ signDataToJwsToken(signingKey
, data
, verifyingKeyJwks?
): Promise
<string
>
Signs data into a JWS token
Parameters
Returns
Promise
<string
>
Implementation of
ZkPassUtility.signDataToJwsToken
▸ verifyJwsToken(key
, jwsToken
): Promise
<JWTVerifyResult
>
Verifies the signature of a JWS token
Parameters
Returns
Promise
<JWTVerifyResult
>
Implementation of
▸ verifyZkPassProofInternal(zkPassProofToken
): Promise
<VerifyZkPassProofResult
>
Parameters
Returns
Promise
<VerifyzkPassProofResult
>
Overrides
ZkPassProofVerifier.verifyZkPassProofInternal
▸ Private
getFfiWrapper(): ZkPassFfiR0
Get the FFI Wrapper for zkVm
Returns
▸ getKeys(): Promise
<Keys
>
Asynchronously fetches and verifies public keys for service signing and encryption from a remote JWKS endpoint.
Returns
Promise
<Keys
>
▸ getEncryptionKey(): Promise
<string
>
Asynchronously retrieves the service encryption public key from the getKeys
function
Returns
Promise
<string
>
▸ getVerifyingKey(): Promise
<string
>
Asynchronously retrieves the service verifying public key from the getKeys
function
Returns
Promise
<string
>
Name | Type |
---|---|
Name | Type |
---|---|
Name | Type |
---|---|
Name | Type |
---|---|
Name | Type |
---|---|
Name | Type |
---|---|
Name | Type |
---|---|
string
string
key
string
jweToken
string
key
string
data
userDataToken
{ [tag: string
]: string
}
dvrToken
string
signingKey
string
data
verifyingKeyJwks?
key
string
jwsToken
string
zkPassProofToken
string