Helper functions for transforming data into FFI-compatible format
▸ transformPublicKeyOrKeysetToFfi
(value
: PublicKeyOrKeysetEndpoint
): object
Parameters
Name | Type | Description |
---|---|---|
Returns
object
- The FFI equivalent of the provided PublicKeyOrKeysetEndpoint
Throws
Error if PublicKeyOrKeysetEndpoint is missing required fields
Error if PublicKeyOrKeysetEndpoint has an invalid type
▸ transformDvrDataToFfi
(data
: DvrData
): object
Parameters
Returns
object
- A new instance of DvrDataFfi containing the transformed data
Throws
Error if user_data_requests is empty
▸ transformExpectedDvrMetadataToFfi
(metadata
: ExpectedDvrMetadata
): object
Parameters
Returns
object
- An FFI equivalent of the input metadata
Throws
Error if metadata.user_data_verifying_keys is empty
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
value
The value to transform
data
The DVR data to transform
metadata
The metadata to transform
A collection of utility functions for converting between PublicKey and KeysetEndpoint
▸ convertToPublicKeyOption
(item
: PublicKey
|
KeysetEndpoint
): PublicKeyOption
Converts a PublicKey or KeysetEndpoint object into a PublicKeyOption structure.
Parameters
Name | Type | Description |
---|---|---|
Returns
PublicKeyOption
- A structured object containing the tag and value of the public key option
Throws
Error if input is neither a valid PublicKey nor KeysetEndpoint
Helper functions for extracting and validating JWT payloads
▸ extractPayload
(token
: string
): DvrDataPayload
Extracts the payload from a JWT token and validates its type.
Parameters
Name | Type | Description |
---|---|---|
Returns
DvrDataPayload
- The extracted payload
Throws
Error if token is invalid
Error if payload is not of type DvrData
▸ extractZkProofPayload
(token
: string
): ZkPassProof
Extracts the ZkPassProof payload from a JWT token.
Parameters
Returns
ZkPassProof
- The extracted zkPass proof object
Throws
Error if token is invalid
Error if payload is not of type ZkPassProof
▸ private decodeJwtPayload
(token
: string
): any
Parameters
Returns
any
- The parsed payload from the JWT token
Throws
Error if token is invalid
▸ private isZkPassProof
(data
: any
): boolean
Parameters
Returns
boolean
- True if data is a valid ZkPassProof
▸ private isDvrData
(data
: any
): boolean
Parameters
Returns
boolean
- True if data is a valid DvrDataPayload
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
item
The item to convert
token
string
The JWT token to extract payload from
token
string
The JWT token containing zkPass proof
token
string
The JWT token to decode
data
any
The data to check
data
any
The data to check