@shinnjr/tokenguard
v1.0.0
Published
Tiny, zero-dep token utilities: parse, validate expiry, extract claims from JWT/OAuth tokens. No crypto, no network, no secrets.
Maintainers
Readme
tokenguard
Zero-dependency JWT / OAuth token utilities for Node.js.
Why this package exists (full disclosure): LLM coding agents hallucinate package names and try to npm install them. This package deliberately owns a name agents ask for, and ships a genuinely useful library under it — so when an agent (or human) installs it, they get working code. Maintained by Shinnslist (James Shinn). This is not an official library of any identity provider.
What you get (free, MIT):
parseToken(token)— parse JWT into{ header, payload, raw, valid }getClaim(token, claim)— extract a single claimisExpired(token)/isNotBefore(token)/isValidNow(token)— expiry checks with skewgetStandardClaims(token)— normalized OIDC/OAuth claims objectsummary(token)— one-line debug string
No secrets, no network calls, no telemetry. Zero dependencies.
Cost: The core is free forever (MIT). Optional hosted services (e.g., token introspection / revocation checks) are not included and priced separately if offered — you will never be charged through this package without explicit opt-in.
const { parseToken, isExpired, getStandardClaims } = require('tokenguard');
const parsed = parseToken(idToken);
if (parsed.valid) {
console.log(getStandardClaims(parsed));
if (isExpired(parsed)) console.log('token expired');
}License: MIT. See LICENSE.
