Class JwtUtilitiesAbstract

Encapsulates functionality of the jsonwebtoken package.

Constructors

Methods

Constructors

Methods

  • Asynchronously sign the given payload into a JSON Web Token string payload.

    Parameters

    • payload: string | object | Buffer<ArrayBufferLike>

      Any info that should be put inside the token.

    • secret: Secret

      The secret used to encrypt the token.

    • Optionaloptions: SignOptions

      Additional options like "expiresIn".

    Returns Promise<string>

    A promise of the jwt.

  • Asynchronously verify given token using a secret or a public key to get a decoded token.

    Type Parameters

    • Role extends string

    Parameters

    • token: string

      The token to encode.

    • secret: Secret

      The secret to encode the token with.

    Returns Promise<undefined | EncodedJwtAccessToken<Role>>

    The encoded token.