⚠️ Deprecated API Notice
This API is deprecated and will be removed in a future release.
⚠️ Deprecated API Notice
This API is deprecated and will be removed in a future release.
new ZkPassApiKey(apiKey
, secretApiKey
): ZkPassApiKey
Parameters
Returns
Readonly
apiKey: string
Readonly
secretApiKey: string
▸ getApiToken(): string
Returns
string
apiKey
string
secretApiKey
string
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.
new ZkPassClient(zkpassServiceUrl
, zkpassApiKey?
): ZkPassClient
Parameters
Returns
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.
▸ encryptDataToJweToken(key
, value
): Promise
<string
>
Encrypts data to JWE token.
Parameters
Returns
Promise
<string
>
▸ decryptJweToken(key
, jwe
): Promise
<JWTDecryptResult
>
Decrypts a JWT token.
Parameters
Returns
Promise
<JWTDecryptResult
>
▸ signDataToJwsToken(key
, value
, verifyingKeyJWKS?
): Promise
<string
>
Signs data to JWS token.
Parameters
Returns
Promise
<string
>
▸ 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
Returns
Promise
<JWTVerifyResult
>
▸ 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
>
▸ 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 |
---|---|
string
key
string
value
string
| object
key
string
jwe
string
key
string
value
string
| object
verifyingKeyJWKS?
VerifyingKeyJWKS
key
string
jwt
string
userDataToken
string
dvrToken
string