server/utils/jwt

JWT utilities.

Source:

Methods

(static) generateToken(properties) → {string}

Source:
See:

Generates a JWT token with the specified properties.

This function will check that:

  • The exp claim is set and is valid.
  • The sub claim is set.

Only some JWT claims are documented in the function's parameters, but other claims can be included.

Parameters:
Name Type Description
properties object

Arbitrary JWT properties (see documentation links).

Properties
Name Type Attributes Description
exp number <optional>

The Unix timestamp (in seconds) at which the token will expire (defaults to 1 hour from the time the function is called).

iat number <optional>

The Unix timestamp (in seconds) at which the token was issued (defaults to the time the function is called).

sub string

The principal of the JWT.

Returns:

A JWT.

Type
string