Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(backend): cache by optional kid param in loadClerkJWKFromLocal #5035

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

itsjxck
Copy link
Contributor

@itsjxck itsjxck commented Jan 29, 2025

Description

Updates loadClerkJWKFromLocal to accept an optional second parameter kid that allows overriding the default local cache key.

Original behaviour preserved using default value for new kid field.

I also updated the loads the local key in PEM format test to make use of the cache key override, because the original test would always be successful since the first loads the local key test would create a cache entry, so the logic to parse the key in the second test was skipped.

A secondary note, while adding this and updating tests, I noticed the throws an error if no key has been provided test will only ever succeed if there is nothing in the cache for the cache key. I haven't changed this test as part of this PR but thought it was worth raising that the test does not work when there is a cached value, allowing passing undefined to be successful. (I actually make use of this in a test to demonstrate loadClerkJWKFromLocal using a custom cache key).

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:

Copy link

changeset-bot bot commented Jan 29, 2025

🦋 Changeset detected

Latest commit: 7bd970b

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

This PR includes changesets to release 10 packages
Name Type
@clerk/backend 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-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

Copy link

vercel bot commented Jan 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 Feb 10, 2025 3:56pm

@itsjxck
Copy link
Contributor Author

itsjxck commented Mar 22, 2025

Can someone check this out...?

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.

2 participants