Functions: jwtHelper
Helper functions for extracting and validating JWT payloads
Last updated
Helper functions for extracting and validating JWT payloads
Last updated
⸠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 |
---|---|---|
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