feat(cache): allow non-expiring api tokens#1
Open
Uzaaft wants to merge 2 commits into
Open
Conversation
Tokens can now be created with no expiry by passing expiresInDays: null to the admin create endpoint, or --expires never on the CLI. The JWT exp claim becomes optional and the api_tokens.expires_at column is nullable. Previous behavior required a finite lifetime between 1 and 365 days (default 90). Long-running automation had to rotate tokens periodically. The new flow lets operators opt in to forever-tokens explicitly while keeping the safe default: omitting expiresInDays still yields the 90-day token, only an explicit null disables expiry. verifyJwt skips the exp comparison when the claim is absent and rejects malformed exp values otherwise. deleteExpiredApiTokens leaves rows with expires_at IS NULL untouched because SQL NULL comparisons are unknown. Added admin-tokens.spec.ts covering the admin endpoint, JWT round-trip, expiry cleanup, and a 67-year time-warp via vi.setSystemTime to confirm the never-expiring path.
Generated by drizzle-kit after relaxing the NOT NULL constraint on api_tokens.expires_at in schema.ts. SQLite cannot drop NOT NULL via ALTER TABLE, so the migration recreates the table via the standard rename-and-copy pattern.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.