[PR #4606] [MERGED] fix: remove use of global.crypto #5480

Closed
opened 2026-03-13 12:24:25 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4606
Author: @himself65
Created: 9/12/2025
Status: Merged
Merged: 9/12/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/09/12/crypto


📝 Commits (1)

  • 3f87595 fix: remove use of global.crypto

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/plugins/jwt/utils.ts (+1 -1)

📄 Description

Related: https://github.com/better-auth/better-auth/issues/4471

This has been brought in a very old version, since 0.8. So I don't think this will fix the issue, but let's not use crypto


Summary by cubic

Remove direct use of global.crypto in JWT key derivation to prevent runtime errors in environments where crypto isn’t on the global object (e.g., some edge/bundler targets). We now call subtle.importKey directly so PBKDF2 works across runtimes.


🔄 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/4606 **Author:** [@himself65](https://github.com/himself65) **Created:** 9/12/2025 **Status:** ✅ Merged **Merged:** 9/12/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/09/12/crypto` --- ### 📝 Commits (1) - [`3f87595`](https://github.com/better-auth/better-auth/commit/3f87595f9165a465a6a97c36e84e065ff1de6f59) fix: remove use of `global.crypto` ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/jwt/utils.ts` (+1 -1) </details> ### 📄 Description Related: https://github.com/better-auth/better-auth/issues/4471 This has been brought in a very old version, since 0.8. So I don't think this will fix the issue, but let's not use `crypto` <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Remove direct use of global.crypto in JWT key derivation to prevent runtime errors in environments where crypto isn’t on the global object (e.g., some edge/bundler targets). We now call subtle.importKey directly so PBKDF2 works across runtimes. <!-- End of auto-generated description by cubic. --> --- <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-03-13 12:24:25 -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#5480