Functions: jwtHelper
Helper functions for extracting and validating JWT payloads
Table of contents
Functions: jwtHelper
Functions: jwtHelper
extractPayload
⸠extractPayload
(token
: string
): DvrDataPayload
Extracts the payload from a JWT token and validates its type.
Parameters
token
string
The JWT token to extract payload from
Returns
DvrDataPayload
- The extracted payload
Throws
Error if token is invalid
Error if payload is not of type DvrData
extractZkProofPayload
⸠extractZkProofPayload
(token
: string
): ZkPassProof
Extracts the ZkPassProof payload from a JWT token.
Parameters
token
string
The JWT token containing zkPass proof
Returns
ZkPassProof
- The extracted zkPass proof object
Throws
Error if token is invalid
Error if payload is not of type ZkPassProof
decodeJwtPayload
⸠private decodeJwtPayload
(token
: string
): any
Parameters
token
string
The JWT token to decode
Returns
any
- The parsed payload from the JWT token
Throws
Error if token is invalid
isZkPassProof
⸠private isZkPassProof
(data
: any
): boolean
Parameters
data
any
The data to check
Returns
boolean
- True if data is a valid ZkPassProof
isDvrData
⸠private isDvrData
(data
: any
): boolean
Parameters
data
any
The data to check
Returns
boolean
- True if data is a valid DvrDataPayload
Last updated