lacewing - v2.0.1
    Preparing search index...

    Class SignJWT

    Fluent builder for a signed JWT. typ is a constructor argument, and .sign() refuses to run without issuer, audience and expiresIn (each waivable only via a grep-loud unsafeAllowMissing* call).

    const token = await new SignJWT("at+jwt")
    .issuer("https://auth.example.com")
    .audience("https://api.example.com")
    .subject("user-42")
    .claim("scope", "read")
    .expiresIn("10m")
    .sign(privateKey);
    Index
    • Parameters

      • aud: string | string[]

      Returns this

    • Set a custom claim. Registered claims must use their dedicated methods.

      Parameters

      • name: string
      • value: unknown

      Returns this

    • Token lifetime from now, e.g. "10m" or 600. Capped by maxLifetime.

      Parameters

      • duration: string | number

      Returns this

    • Parameters

      • iss: string

      Returns this

    • Override the auto-assigned jti. Uniqueness is then your problem.

      Parameters

      • jti: string

      Returns this

    • Delay validity by duration from now (nbf).

      Parameters

      • duration: string | number

      Returns this

    • Parameters

      • sub: string

      Returns this

    • Waive the payload hygiene scanner for one claim (LW-payload). Grep for this in review.

      Parameters

      • name: string

      Returns this

    • Waive the mandatory aud. Grep for this in review.

      Returns this

    • Waive the mandatory exp. Grep for this in review.

      Returns this

    • Waive the mandatory iss. Grep for this in review.

      Returns this