A compact but complete JWT system made for CiSkeleton, providing JWT encoding/decoding plus secure refresh token handling.
- Access token: full JWT string
header.payload.signature, short-lived. - Refresh token: opaque string
selector.verifier, long-lived.
Only refresh tokens are persisted (OAuth2-style):
refresh_selector: plaintext, indexed UNIQUE, used for lookup.refresh_verifier_hash: hashed verifier, used for validation.- Metadata columns: expiry, revoked flag, timestamps, etc.
- Client authenticates → server issues an access token (JWT) and a refresh token.
- Client uses the access token in the
Authorization: Bearerheader on each request. - When the access token expires, client sends the refresh token to get a new pair.
- Server splits the refresh token into selector/verifier, looks up selector, and verifies the stored hash against the presented verifier.
- If valid, server rotates the refresh token (revokes old row, issues new access+refresh).
- Access tokens are stateless and validated purely via JWT signature & claims.
- Refresh tokens are stateful, persisted for rotation, revocation, and auditing.
- Revocation is enforced by marking refresh tokens as
revoked, preventing reuse.
Apache License 2.0. See LICENSE for details.
