Files
better-auth/packages
Bereket Engida 90127ff2a1 fix(core): make consumeOne and incrementOne optional on custom adapters
1.7.0 made both methods required on CustomAdapter and removed the
factory fallback, so a custom adapter written for 1.6 type-checks
against nothing and throws at request time on the first OTP, magic
link, password reset, or two-factor attempt.

Restore the fallbacks. consumeOne without a native implementation runs
findOne then an id-guarded deleteMany and wins only when exactly one
row was deleted. incrementOne runs a bounded compare-and-swap loop:
findOne, then updateMany guarded on the id and the counter values just
read, retried when a concurrent writer changed the row first. Both are
single guarded statements per attempt, so they stay atomic across
processes without transactions.
2026-09-03 22:14:45 -07:00
..
2026-08-26 18:53:57 +00:00
2026-08-26 18:53:57 +00:00
2026-08-26 18:53:57 +00:00