mirror of
https://github.com/better-auth/better-auth.git
synced 2026-07-27 16:53:02 -05:00
888 B
888 B
better-auth
| better-auth |
|---|
| minor |
feat(two-factor)!: add OTP-only enablement and remove skipVerificationOnEnable
enableTwoFactor now accepts a method parameter ("otp" | "totp", default "totp") and returns a discriminated response with a method field.
method: "otp"
- Sets
twoFactorEnabled: trueimmediately. - Returns
{ method: "otp" }. - Requires
otpOptions.sendOTPto be configured on the server; rejects withOTP_NOT_CONFIGUREDotherwise.
method: "totp" (default)
- Returns
{ method: "totp", totpURI, backupCodes }. - Rejects with
TOTP_NOT_CONFIGUREDiftotpOptions.disableis set.
Breaking changes
- Removed
skipVerificationOnEnable: usemethod: "otp"for immediate activation, or the standard TOTP verification flow. - Response shape changed:
enableTwoFactorincludes amethodfield in the response ("otp"or"totp").