Parse JWT payloads and expiry without verification for client-side observability.
// Source: https://github.com/plur-ai/plur | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/**
* Minimal, dependency-free JWT inspection — we only ever READ the `exp`
* claim to warn about token expiry. We do NOT verify the signature (the
* server does that); this is purely for client-side "your token expires
* in N days" / "your token has expired" observability (#295).
*
* Enterprise tokens are HS256 JWTs (`iss: plur-enterprise`) with a 30-day
* TTL and no refresh, so silent expiry is a recurring failure mode. Opaque
* API keys (e.g. `plur_sk_...`) are not JWTs — those return all-null and the
* caller falls back to the live `/me` probe.
*/
export interface JwtExpiry {
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key