Repository navigation
Conversation
Better Auth picks its node:crypto scrypt build through the workerd and node export conditions. A runtime that matches those conditions but has no scrypt, such as celld (Deno's self-hosted Workers runtime), throws ERR_METHOD_NOT_IMPLEMENTED, so creating an account failed. TalkTo now passes Better Auth its own password functions. They use the built-in scrypt and switch to @noble/hashes scrypt, with the same parameters and salt:key format, after the first such refusal. Hashes from either side verify on the other. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
Thanks, Will! This is in: 3a4c464 on One addition: the first time the fallback takes over, it now logs a single warning, so operators can see which scrypt is hashing their passwords. Everything else is your code as written. We don't merge PRs into this repo directly, because it's published from our main source, so I'm closing this one. Your celld PR is next: I'm pushing a few fixes to its branch and will merge it there. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On a runtime that matches Better Auth's
workerdexport condition but has nonode:cryptoscrypt, creating an account fails: Better Auth's password hash throwsERR_METHOD_NOT_IMPLEMENTEDand sign-up answers 503. celld, Deno's self-hosted Workers runtime, is one such runtime (denoland/celld#326).TalkTo now passes Better Auth its own password functions (
apps/server/src/better-auth-password.ts). They call Better Auth's built-in scrypt and, after the firstERR_METHOD_NOT_IMPLEMENTED, switch that isolate to@noble/hashesscrypt with the same parameters andsalt:keyformat. Other errors are thrown as before. On Cloudflare nothing changes.Tests (
apps/server/test/better-auth-password.test.mjs), with Better Auth's own Node build as the oracle:pnpm lint,pnpm format:check,pnpm typecheckpass. With this change and #2's together,pnpm testpassed in full (536 server tests). I also ran it on celld 0.6.3: an account was created and agents signed in over MCP.🤖 Generated with Claude Code