[PR #4161] [MERGED] refactor(jwt): separate createJwk function #30830

Closed
opened 2026-04-17 21:50:44 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4161
Author: @dvanmali
Created: 8/22/2025
Status: Merged
Merged: 8/26/2025
Merged by: @himself65

Base: canaryHead: createJwk


📝 Commits (4)

  • 484b339 chore: move jwk creation into common createJwk function
  • 169621c fix: circular dependency causes test errors
  • 1ad9399 fix: specify the alg and crv, merge common generateExportedKeyPair code
  • 580ce2b feat: remove zod as a runtime requirement

📊 Changes

7 files changed (+319 additions, -374 deletions)

View changed files

📝 packages/better-auth/src/plugins/jwt/adapter.ts (+1 -1)
📝 packages/better-auth/src/plugins/jwt/index.ts (+24 -211)
📝 packages/better-auth/src/plugins/jwt/jwt.test.ts (+75 -127)
📝 packages/better-auth/src/plugins/jwt/schema.ts (+0 -10)
📝 packages/better-auth/src/plugins/jwt/sign.ts (+5 -25)
packages/better-auth/src/plugins/jwt/types.ts (+151 -0)
📝 packages/better-auth/src/plugins/jwt/utils.ts (+63 -0)

📄 Description

Consolidates the create jwk functionality into a single function createJwk.

Value:

  • Ensures signing jwt key signing uses the same key as /jwks (some local tests for )
  • Prepares for an admin plugin function for rotateJwk
  • Cleans types into ./types.ts
  • Ensures algorithms used for signing/jwks work via tests

Partial: #3458, #3572

Fixes:


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4161 **Author:** [@dvanmali](https://github.com/dvanmali) **Created:** 8/22/2025 **Status:** ✅ Merged **Merged:** 8/26/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `createJwk` --- ### 📝 Commits (4) - [`484b339`](https://github.com/better-auth/better-auth/commit/484b33939d4947fdd9760efea44a2ba13575224d) chore: move jwk creation into common createJwk function - [`169621c`](https://github.com/better-auth/better-auth/commit/169621c8912549ef4c605052910d62ee79ebf00b) fix: circular dependency causes test errors - [`1ad9399`](https://github.com/better-auth/better-auth/commit/1ad93999acfe9862e0c4754af27f980e4dc1ccd8) fix: specify the alg and crv, merge common generateExportedKeyPair code - [`580ce2b`](https://github.com/better-auth/better-auth/commit/580ce2b4fed5b46be080eab525f34daad9f8207b) feat: remove zod as a runtime requirement ### 📊 Changes **7 files changed** (+319 additions, -374 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/jwt/adapter.ts` (+1 -1) 📝 `packages/better-auth/src/plugins/jwt/index.ts` (+24 -211) 📝 `packages/better-auth/src/plugins/jwt/jwt.test.ts` (+75 -127) 📝 `packages/better-auth/src/plugins/jwt/schema.ts` (+0 -10) 📝 `packages/better-auth/src/plugins/jwt/sign.ts` (+5 -25) ➕ `packages/better-auth/src/plugins/jwt/types.ts` (+151 -0) 📝 `packages/better-auth/src/plugins/jwt/utils.ts` (+63 -0) </details> ### 📄 Description Consolidates the create jwk functionality into a single function `createJwk`. Value: - Ensures signing jwt key signing uses the same key as `/jwks` (some local tests for ) - Prepares for an admin plugin function for `rotateJwk` - Cleans types into `./types.ts` - Ensures algorithms used for signing/jwks work via tests Partial: #3458, #3572 Fixes: - [X] #3226 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 21:50:44 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#30830