Documents for @litert/jwt / Validators/TimeValidity / JwtTimeValidityValidator
Class: JwtTimeValidityValidator
Defined in: src/lib/Validators/TimeValidity.ts:72
The JWT time validity validator.
Example
ts
import * as LibJWT from '@litert/jwt';
const info = LibJWT.parse(token);
if (!new LibJWT.JwtTimeValidityValidator().validate(info)) {
throw new Error('Out of the token time validity period.');
}Implements
Constructors
Constructor
new JwtTimeValidityValidator(
opts?):JwtTimeValidityValidator
Defined in: src/lib/Validators/TimeValidity.ts:81
Parameters
opts?
ITimeValidityValidationOptions
Returns
JwtTimeValidityValidator
Properties
name
readonlyname:string
Defined in: src/lib/Validators/TimeValidity.ts:74
The name of the validator.
When using with the JwtVerifier class, this name can be used to identify which validator failed.
Implementation of
Methods
validate()
validate(
info):void
Defined in: src/lib/Validators/TimeValidity.ts:104
Validates the time validity of a JWT token.
Parameters
info
The JWT token information returned by parse() function.
Returns
void
Throws
If the JWT is not valid in terms of time validity.