You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat!: enforce mandatory token expiration with capped lifetimes
Changes:
- Add time constants (ONE_MINUTE_MS, ONE_HOUR_MS, FOUR_WEEKS_MS, DEFAULT_MAX_LIFETIME_MS)
- Add `expiresIn()` method to builder for ergonomic expiration setting
- Add `maxLifetime()` method to customize maximum token lifetime
- Add validation in `sign()` to require expiration and enforce lifetime caps
- Fix time unit bug: convert milliseconds to seconds in payload (exp, nbf)
- Cap chained token lifetimes by parent's remaining validity
- Update NilauthClient to set expiration on internal tokens
- Update documentation and all tests to use new expiration API
Security improvements:
- Prevents tokens from being created without expiration dates
- Enforces maximum lifetime of 4 weeks by default
- Child tokens cannot outlive their parents
- Provides clear error messages when lifetime constraints are violated
BREAKING CHANGE: All tokens must now specify an expiration via `expiresAt()` or `expiresIn()`. Tokens without expiration will be rejected during the build process.
0 commit comments