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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

data

any

The data to check

Returns

boolean - True if data is a valid ZkPassProof


isDvrData

▸ private isDvrData(data: any): boolean

Parameters

Name
Type
Description

data

any

The data to check

Returns

boolean - True if data is a valid DvrDataPayload

Last updated