Are hashPassword and verifyPassowrd stable public API? #2017

Closed
opened 2026-03-13 09:21:16 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @otakutyrant on GitHub (Sep 25, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

I am migrating from NextAuth.js to better-auth. I was used to use argon2 to hash my admin account password in seed.ts that create a database in development environment, then use await argon2.verify(user.password, password) to verify it in auth.ts when I log in as the admin.

In order to make the seed.ts work with better-auth, I need to use the official hash function from better-auth instead. However, the authentication documentations and the options documentations are unclear about what the official hash function is exactly. So I dived into source code and found hashPassword and verifyPassowrd from better-auth/crypto, but they are not declared as public API in documentations.

By the way the authentication documentation and options documentation about password are confusing too, but let's focus in this issue at frist.

Current vs. Expected behavior

Current: No public API about the default hash function and verify function.

Expected: I can use hashPassword and verifyPassowrd without any doubt.

What version of Better Auth are you using?

1.3.16

System info

📊 Better Auth System Information

==================================================

🖥️  System Information:
  platform: linux
  arch: x64
  version: #1 SMP PREEMPT_DYNAMIC Thu, 28 Aug 2025 19:49:53 +0000
  release: 6.16.4-arch1-1
  cpuCount: 8
  cpuModel: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
  totalMemory: 31.28 GB
  freeMemory: 21.66 GB

📦 Node.js:
  version: v24.7.0
  env: development

📦 Package Manager:
  name: pnpm
  version: 10.15.1

🚀 Frameworks:
  name: next
  version: 15.4.6
  name: react
  version: 19.1.0

💾 Database Clients:
  name: postgres
  version: ^3.4.7
  name: @prisma/client
  version: ^6.15.0

🔐 Better Auth:
  Version: ^1.3.16
  Configuration:
    emailAndPassword:
      enabled: true
      password:
        {}
    socialProviders:
      google:
        clientId: [REDACTED]
        clientSecret: [REDACTED]

==================================================

💡 Tip: Use --json flag for JSON output
💡 Use --copy flag to copy output to clipboard
💡 When reporting issues, include this information

Which area(s) are affected? (Select all that apply)

Documentation

Auth config (if applicable)


Additional context

No response

Originally created by @otakutyrant on GitHub (Sep 25, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce I am migrating from NextAuth.js to better-auth. I was used to use argon2 to hash my admin account password in `seed.ts` that create a database in development environment, then use `await argon2.verify(user.password, password)` to verify it in `auth.ts` when I log in as the admin. In order to make the `seed.ts` work with better-auth, I need to use the official hash function from better-auth instead. However, [the authentication documentations](https://www.better-auth.com/docs/authentication/email-password) and [the options documentations](https://www.better-auth.com/docs/reference/options) are unclear about what the official hash function is exactly. So I dived into source code and found `hashPassword` and `verifyPassowrd` from `better-auth/crypto`, but they are not declared as public API in documentations. By the way the authentication documentation and options documentation about password are confusing too, but let's focus in this issue at frist. ### Current vs. Expected behavior Current: No public API about the default hash function and verify function. Expected: I can use `hashPassword` and `verifyPassowrd` without any doubt. ### What version of Better Auth are you using? 1.3.16 ### System info ```bash 📊 Better Auth System Information ================================================== 🖥️ System Information: platform: linux arch: x64 version: #1 SMP PREEMPT_DYNAMIC Thu, 28 Aug 2025 19:49:53 +0000 release: 6.16.4-arch1-1 cpuCount: 8 cpuModel: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz totalMemory: 31.28 GB freeMemory: 21.66 GB 📦 Node.js: version: v24.7.0 env: development 📦 Package Manager: name: pnpm version: 10.15.1 🚀 Frameworks: name: next version: 15.4.6 name: react version: 19.1.0 💾 Database Clients: name: postgres version: ^3.4.7 name: @prisma/client version: ^6.15.0 🔐 Better Auth: Version: ^1.3.16 Configuration: emailAndPassword: enabled: true password: {} socialProviders: google: clientId: [REDACTED] clientSecret: [REDACTED] ================================================== 💡 Tip: Use --json flag for JSON output 💡 Use --copy flag to copy output to clipboard 💡 When reporting issues, include this information ``` ### Which area(s) are affected? (Select all that apply) Documentation ### Auth config (if applicable) ```typescript ``` ### Additional context _No response_
GiteaMirror added the documentation label 2026-03-13 09:21:16 -05:00
Author
Owner

@otakutyrant commented on GitHub (Sep 25, 2025):

At present, I do not need to use them any more. I found out that I can use auth.api.signUpEmail in seed.ts, instead of handling hash myself. So even if the API are unstable, it does not matter.

@otakutyrant commented on GitHub (Sep 25, 2025): At present, I do not need to use them any more. I found out that I can use `auth.api.signUpEmail` in seed.ts, instead of handling hash myself. So even if the API are unstable, it does not matter.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2017