Skip to content

feat(auth): JWT refresh token rotation — Issue #804 - #994

Merged
github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
Prozaks:feat/issue-804-jwt-refresh-token-rotation
Sep 28, 2026
Merged

github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
Prozaks:feat/issue-804-jwt-refresh-token-rotation

Conversation

@Prozaks

@Prozaks Prozaks commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds comprehensive tests for the JWT refresh token rotation implementation (Issue #804).

The core service was already implemented in src/auth/token-rotation.ts and src/routes/token-refresh.ts. This PR adds full test coverage.

What was tested

  • issueTokenFamily — returns correctly shaped token pair, prisma.create called, audit event emitted
  • rotateRefreshToken — success path issues new tokens and revokes old; not_found; family_compromised (reuse detection triggers family revocation); expired (absoluteExpiresAt / slidingExpiresAt)
  • revokeToken — valid, already-revoked, and missing tokens
  • revokeAllUserTokens — revokes all families, returns count
  • listUserTokenFamilies — deduplicates by familyId
  • pruneExpiredTokens — deletes tokens past either expiry
  • Redis blacklist integration paths

Test results

Test Files  1 passed
     Tests  42 passed
  Duration  ~1.6s

Closes #804

@vercel

vercel Bot commented Sep 28, 2026

Copy link
Copy Markdown

@Prozaks is attempting to deploy a commit to the smartdevs17's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Sep 28, 2026

Copy link
Copy Markdown

@Prozaks Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@github-actions
github-actions Bot merged commit d6dc84d into Smartdevs17:main Sep 28, 2026
2 of 3 checks passed
- Add comprehensive vitest tests for token rotation service
- Tests cover: issueTokenFamily, rotateRefreshToken (success, not_found,
  family_compromised, expired), revokeToken, revokeAllUserTokens,
  listUserTokenFamilies, pruneExpiredTokens
- Redis blacklist integration tests included
- Mocks: prisma, rate-limit-redis, auditService

Closes Smartdevs17#804
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement JWT refresh token rotation

1 participant