Skip to content

Conversation

@jacekradko
Copy link
Member

@jacekradko jacekradko commented Apr 29, 2025

Description

Refactoring Handshake related code to HandShake service

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@vercel
Copy link

vercel bot commented Apr 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 29, 2025 3:26pm

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This feature introduces handshake nonce support in the backend authentication flow by refactoring handshake logic into a dedicated HandshakeService.

  • Refactored inline handshake logic in request.ts to delegate handshake resolution and redirection handling to HandshakeService.
  • Extracted helper methods for building handshake redirects and detecting infinite redirection loops into HandshakeService.
  • Introduced a placeholder for handshake nonce handling in the new service.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/backend/src/tokens/request.ts Updated to use HandshakeService methods for handshake resolution and redirect loop checks.
packages/backend/src/tokens/handshake.ts Introduced HandshakeService with consolidated handshake logic, organization sync support, and a new (placeholder) handshake nonce code path.

}

setHandshakeInfiniteRedirectionLoopHeaders(headers: Headers): boolean {
if (this.handshakeRedirectLoopCounter === 3) {
Copy link

Copilot AI Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The handshakeRedirectLoopCounter is not updated after computing newCounterValue; consider assigning newCounterValue back to this.handshakeRedirectLoopCounter to properly track the number of redirect loops.

Copilot uses AI. Check for mistakes.
@jacekradko jacekradko changed the title feat(backend): handshake nonce refactor(backend): Introduce HandshakeService Apr 29, 2025
@changeset-bot
Copy link

changeset-bot bot commented Apr 29, 2025

⚠️ No Changeset found

Latest commit: 292751c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@jacekradko jacekradko merged commit d6cf587 into feat/handshake-nonce Apr 29, 2025
4 of 5 checks passed
@jacekradko jacekradko deleted the refactor/handshake-service branch April 29, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants