Skip to content

Conversation

@jacekradko
Copy link
Member

@jacekradko jacekradko commented Apr 29, 2025

Description

Initial stub of the handshake nonce flow. Implementation will be in a separate PR

Related: SDKI-979

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:

@changeset-bot
Copy link

changeset-bot bot commented Apr 29, 2025

🦋 Changeset detected

Latest commit: 0d92d37

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@clerk/backend Minor
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/remix Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch

Not sure what this means? Click here to learn what changesets are.

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

@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 6:18pm

(cherry picked from commit 179622b)
@jacekradko jacekradko marked this pull request as ready for review April 29, 2025 16:39
@jacekradko jacekradko changed the title feat(backend): handshake nonce feat(backend): Initial handshake nonce pre-work Apr 29, 2025
@jacekradko jacekradko requested a review from Copilot April 29, 2025 16:43
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 PR introduces the initial handshake nonce pre-work and refactors parts of the handshake flow. Key changes include:

  • Adding new types and constants to support organization sync target matching and handshake nonce handling.
  • Refactoring the handshake logic by introducing the HandshakeService and updating request and authentication context handling.
  • Adding new API resources, endpoints, and tests for the handshake payload flow.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/backend/src/tokens/types.ts Added definitions for OrganizationSyncTargetMatchers and OrganizationSyncTarget.
packages/backend/src/tokens/request.ts Updated request handling to leverage methods from HandshakeService.
packages/backend/src/tokens/handshake.ts Introduced HandshakeService with methods to handle handshake flow including nonce handling (stubbed).
packages/backend/src/tokens/authenticateContext.ts Extended context to include handshakeNonce from query params and cookies.
packages/backend/src/api/resources/HandshakePayload.ts Added handshake payload resource model.
packages/backend/src/api/endpoints/HandshakePayloadApi.ts New API endpoint for retrieving handshake payload.
packages/backend/src/constants.ts Added handshakeNonce constant to cookies and query parameters.
packages/backend/src/tokens/tests/handshake.test.ts Created tests to validate HandshakeService behavior.
.changeset/better-vans-obey.md Changeset file to document the new handshake payload flow changes.

Copy link
Member

@brkalow brkalow left a comment

Choose a reason for hiding this comment

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

Looks good!

@jacekradko jacekradko merged commit be1c5d6 into main May 1, 2025
31 checks passed
@jacekradko jacekradko deleted the feat/handshake-nonce branch May 1, 2025 15:01
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.

4 participants