Skip to content
Night Owls.dev
Jump to a page

@nightowlsdev/auth-jwt

Auth

Dependency-free JWT primitives (HS256 sign/verify + ES256/RS256 JWKS verify) and signed-session helpers, on node:crypto only.

What it does

@nightowlsdev/auth-jwt provides small, dependency-free JWT primitives built on `node:crypto` only, no JOSE, no SDK: `signJwt`/`verifyJwt` (HS256) for tokens you sign yourself, `verifyJwtWithJwks` (ES256/RS256) for verifying a provider's tokens against its public JWKS, plus generic signed-session / cookie helpers (`mintSession`, `sessionCookie`). SERVER-ONLY and pure (the secret and `now` are parameters), so it is hermetically unit-testable with a known secret and a fixed clock. Use it to wire your app's existing JWTs into a Night Owls runner without an Auth0/Supabase-specific adapter.

Install

pnpm add @nightowlsdev/auth-jwt

Key exports

  • signJwt
  • verifyJwt
  • verifyJwtWithJwks
  • mintSession
  • sessionCookie

Usage

auth-jwt.ts
import * as pkg from "@nightowlsdev/auth-jwt";