Commit 8113ba3
test(dogfood): converge two-factor-lockout on the shared TOTP helper (#11323)
`two-factor-lockout.dogfood.test.ts` carried a private `base32Decode` /
`totp` pair, byte-for-byte identical to the ones in `test/totp.ts` — the
shared module was extracted FROM this file (#10681) without rewriting its
internals, so the package held two spellings of RFC 6238.
Point the file at `./totp.js`, delete both local functions, and collapse
the inline otpauth:// parsing into `secretFromTotpUri`. Mechanical: no
assertion, timeout or fixture-semantics changes.
The hand-rolled rationale (`@better-auth/utils/otp` is a transitive
dependency; taking a direct one to make six digits would tie these
fixtures to an internal package's resolution) already lives in the shared
module's header, so it survives. That header's stale "the lockout file
still carries its own copy" warning is replaced by the fact that this is
now the package's single copy.
Verified the file really drives the shared helper rather than merely
importing it: mutating the shared `totp()` to return a fixed wrong code
turns the suite red in `beforeAll` (enrolment confirmation, 401
INVALID_CODE vs the expected 200); restoring it byte-identically returns
it to 5 passed.
Claude-Session: https://claude.ai/code/session_01APWX2AwT3a4xDcjPCe8bk4
Co-authored-by: Claude <noreply@anthropic.com>1 parent 7233907 commit 8113ba3
2 files changed
Lines changed: 7 additions & 48 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
Lines changed: 2 additions & 44 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | 68 | | |
109 | 69 | | |
110 | 70 | | |
| |||
180 | 140 | | |
181 | 141 | | |
182 | 142 | | |
183 | | - | |
184 | | - | |
185 | | - | |
| 143 | + | |
186 | 144 | | |
187 | 145 | | |
188 | 146 | | |
| |||
0 commit comments