Skip to content

feat(otp): write expires_at when creating one_time_tokens - #2766

Open
annabkr wants to merge 6 commits into
masterfrom
annabaker/auth-1572-start-writing-to-one_time_tokensexpiresat
Open

feat(otp): write expires_at when creating one_time_tokens#2766
annabkr wants to merge 6 commits into
masterfrom
annabaker/auth-1572-start-writing-to-one_time_tokensexpiresat

Conversation

@annabkr

@annabkr annabkr commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Write to the new expires_at column when creating one_time_tokens

What is the current behavior?

The column was added in #2765 , but it is not yet written to.

What is the new behavior?

We write to expires_at, and have tests asserting expected behavior, but do not yet read from it.

Additional context

See AUTH-1552.

@annabkr annabkr changed the title Annabaker/auth 1572 start writing to one time tokensexpiresat feat(top): write expires_at when creating one_time_tokens Aug 31, 2026
@annabkr annabkr changed the title feat(top): write expires_at when creating one_time_tokens feat(top): write expires_at when creating one_time_tokens Aug 31, 2026
@annabkr annabkr changed the title feat(top): write expires_at when creating one_time_tokens feat(otp): write expires_at when creating one_time_tokens Sep 1, 2026
@annabkr
annabkr marked this pull request as ready for review September 1, 2026 13:25
@annabkr
annabkr requested a review from a team as a code owner September 1, 2026 13:25
Comment thread internal/conf/configuration.go
Base automatically changed from annabaker/auth-1552-add-expiresat-column-to-the-one_time_tokens-table to master September 2, 2026 13:56
CreateOneTimeToken now takes the validity window and stores
expires_at on insert. Call sites pass Mailer.OtpExp for email
flows and Sms.OtpExp for phone flows, matching the windows the
verify path infers from users.*_sent_at today. Reads are
unchanged. Adds OtpExpAsDuration helpers on the mailer and SMS
configurations. Existing tests are updated for the new signature.
Add a models suite covering persistence, past windows, and resend
replacement, and an api suite asserting expires_at equals
sent_at + OtpExp per channel. The api suite pins Mailer.OtpExp
and Sms.OtpExp to different values so a swapped config field
fails the test.
@annabkr
annabkr force-pushed the annabaker/auth-1572-start-writing-to-one_time_tokensexpiresat branch from ac7da1d to fcaf26e Compare September 2, 2026 13:56
@blacksmith-sh

blacksmith-sh Bot commented Sep 2, 2026

Copy link
Copy Markdown

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
github.com/supabase/auth/internal/models/Build View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@annabkr
annabkr force-pushed the annabaker/auth-1572-start-writing-to-one_time_tokensexpiresat branch from 14d855c to fcaf26e Compare September 2, 2026 20:42
annabkr and others added 2 commits September 2, 2026 16:53
The test came in from master via merge after this branch added the
validityDuration parameter, so the models package did not compile.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants