⚠ī¸Class: ZkPassClient

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

⚠ī¸ Deprecated API Notice

This API is deprecated and will be removed in a future release.

Table of contents

Constructors

Properties

Methods

Constructor

constructor

  • new ZkPassClient(zkpassServiceUrl, zkpassApiKey?): ZkPassClient

Parameters

Returns

ZkPassClient

Properties

zkPassServiceUrl

  • Private Readonly zkpassServiceUrl: string

Containing the URL address of the ZkPass service


zkPassApiKey

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

Methods

encryptDataToJweToken

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

Encrypts data to JWE token.

Parameters

NameType

key

string

value

string | object

Returns

Promise<string>


decryptJweToken

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

Decrypts a JWT token.

Parameters

NameType

key

string

jwe

string

Returns

Promise<JWTDecryptResult>


signDataToJwsToken

▸ signDataToJwsToken(key, value, verifyingKeyJWKS?): Promise<string>

Signs data to JWS token.

Parameters

NameType

key

string

value

string | object

verifyingKeyJWKS?

VerifyingKeyJWKS

Returns

Promise<string>


verifyJwsToken

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

Verifies the JWT format (to be a JWS Compact format), verifies the JWS signature, validates the JWT Claims Set.

Parameters

NameType

key

string

jwt

string

Returns

Promise<JWTVerifyResult>


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

NameType

userDataToken

string

dvrToken

string

Returns

Promise<string>


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