â ī¸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
Name | Type |
---|---|
| |
Returns
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.
Methods
encryptDataToJweToken
⸠encryptDataToJweToken(key
, value
): Promise
<string
>
Encrypts data to JWE token.
Parameters
Name | Type |
---|---|
|
|
|
|
Returns
Promise
<string
>
decryptJweToken
⸠decryptJweToken(key
, jwe
): Promise
<JWTDecryptResult
>
Decrypts a JWT token.
Parameters
Name | Type |
---|---|
|
|
|
|
Returns
Promise
<JWTDecryptResult
>
signDataToJwsToken
⸠signDataToJwsToken(key
, value
, verifyingKeyJWKS?
): Promise
<string
>
Signs data to JWS token.
Parameters
Name | Type |
---|---|
|
|
|
|
|
|
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
Name | Type |
---|---|
|
|
|
|
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
Name | Type |
---|---|
|
|
|
|
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