@orveth/jwt
v0.1.1
Published
HS256 JWT sign, verify, and bearer header helpers for Orveth.
Maintainers
Readme
@orveth/jwt
HS256 JWT sign and verify helpers for Orveth services. Built on jose.
Install
npm install @orveth/jwtUsage
import { signJwt, verifyBearerJwt } from "@orveth/jwt";
const secret = process.env.JWT_SECRET!;
const token = await signJwt({ sub: "user-1" }, secret, { expiresIn: "1h" });
// In a route handler:
const claims = await verifyBearerJwt<{ sub: string }>(
ctx.request.headers.authorization,
secret,
);verifyJwt and verifyBearerJwt throw HttpError with status 401 and code ORVETH_JWT_INVALID when verification fails.
Scope
Symmetric HS256 only. No OAuth, refresh rotation, or RS256—add those in your application when needed.
License
MIT — VLODIA
