[PR #1472] [MERGED] Add option to set a function to generate OTPs #3822

Closed
opened 2026-03-13 11:15:21 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/1472
Author: @CordlessWool
Created: 2/17/2025
Status: Merged
Merged: 2/24/2025
Merged by: @Bekacru

Base: mainHead: allow_own_otp


📝 Commits (7)

  • 8c009b2 add option to create a otp
  • 783b990 add description
  • fe4dd86 use tabs instead of spaces
  • 35894e8 rename create to generate and replace all uses fo generateRandomString
  • 75adbaa remove length
  • ee774ca fix type in forgot-password
  • bb651f6 add generateOTP option and tests for email OTP functionality

📊 Changes

3 files changed (+66 additions, -6 deletions)

View changed files

📝 docs/content/docs/plugins/email-otp.mdx (+2 -0)
📝 packages/better-auth/src/plugins/email-otp/email-otp.test.ts (+36 -0)
📝 packages/better-auth/src/plugins/email-otp/index.ts (+28 -6)

📄 Description

The idea is to allow more than numbers, to reduce the length and still have a high level of security. This also gives more freedom by defining the letters. Could be hex or something else.

In my concrete need I want to have a string number combination without zero and O or other letters too similar to a number and I want to have a shorter OTP with higher security.


🔄 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/1472 **Author:** [@CordlessWool](https://github.com/CordlessWool) **Created:** 2/17/2025 **Status:** ✅ Merged **Merged:** 2/24/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `allow_own_otp` --- ### 📝 Commits (7) - [`8c009b2`](https://github.com/better-auth/better-auth/commit/8c009b2debe5af03d32485ddad03d193a09047b1) add option to create a otp - [`783b990`](https://github.com/better-auth/better-auth/commit/783b990727173973eaa7fb0d8a5c17eec415b2ed) add description - [`fe4dd86`](https://github.com/better-auth/better-auth/commit/fe4dd8678285c7f471b2be3117d33f7598f965e9) use tabs instead of spaces - [`35894e8`](https://github.com/better-auth/better-auth/commit/35894e836f0014c8f4c6605ee0b979275056dbc9) rename create to generate and replace all uses fo generateRandomString - [`75adbaa`](https://github.com/better-auth/better-auth/commit/75adbaa0bf5a9a7e4303dce36210b632e5b361ce) remove length - [`ee774ca`](https://github.com/better-auth/better-auth/commit/ee774cad9a80ca1597fd948f3c5a4bd9b6cf707b) fix type in forgot-password - [`bb651f6`](https://github.com/better-auth/better-auth/commit/bb651f61f3f9325bac8778aae76bbea6841dfb33) add generateOTP option and tests for email OTP functionality ### 📊 Changes **3 files changed** (+66 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/email-otp.mdx` (+2 -0) 📝 `packages/better-auth/src/plugins/email-otp/email-otp.test.ts` (+36 -0) 📝 `packages/better-auth/src/plugins/email-otp/index.ts` (+28 -6) </details> ### 📄 Description The idea is to allow more than numbers, to reduce the length and still have a high level of security. This also gives more freedom by defining the letters. Could be hex or something else. In my concrete need I want to have a string number combination without zero and O or other letters too similar to a number and I want to have a shorter OTP with higher security. --- <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 11:15:21 -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#3822