Skip to content

[70] [Backend] Create refresh token rotation service - #184

Open
Goodnessukaigwe wants to merge 1 commit into
Hamplard-Hub:mainfrom
Goodnessukaigwe:fix/70-backend-create-refresh-token-rotation-service
Open

[70] [Backend] Create refresh token rotation service#184
Goodnessukaigwe wants to merge 1 commit into
Hamplard-Hub:mainfrom
Goodnessukaigwe:fix/70-backend-create-refresh-token-rotation-service

Conversation

@Goodnessukaigwe

@Goodnessukaigwe Goodnessukaigwe commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Closes #70

Summary

  • Adds a refresh token rotation service that exchanges a valid refresh token for a new access/refresh pair.
  • Each login starts a token family at generation 1; every successful rotation keeps the same family and increments the generation.
  • The previous refresh token is hashed, persisted, and marked consumed so it cannot be replayed.
  • Reuse of an already-consumed (or unknown-but-signed) refresh token is treated as a compromise: the entire family is revoked and no new pair is issued.
  • Stellar and Google login now return both tokens; POST /auth/refresh handles the exchange. Refresh JWTs cannot be used as access tokens.

Tests

  • Successful refresh and new pair issuance
  • Token rotation, family/generation tracking, and previous-token invalidation
  • Reused-token detection, concurrent consume, and compromised-family revocation
  • Access-token-as-refresh rejection and refresh-token-as-access rejection

Made with Cursor

Rotate refresh tokens on each exchange, track family and generation, and revoke the compromised family when a consumed token is reused.

Co-authored-by: Cursor <cursoragent@cursor.com>
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@Goodnessukaigwe 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

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.

[Backend] Create refresh token rotation service

1 participant