[PR #7731] [MERGED] fix(passkey): compute expirationTime per-request instead of at init #15766

Closed
opened 2026-04-13 10:12:52 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7731
Author: @bytaesu
Created: 1/31/2026
Status: Merged
Merged: 2/4/2026
Merged by: @himself65

Base: canaryHead: 2026-02-01/fix/passkey-expiration-time


📝 Commits (2)

  • f1023eb fix(passkey): compute expirationTime per-request instead of at init
  • 014d072 refactor: move const to outer scope

📊 Changes

3 files changed (+72 additions, -115 deletions)

View changed files

📝 packages/passkey/src/index.ts (+4 -8)
📝 packages/passkey/src/passkey.test.ts (+64 -99)
📝 packages/passkey/src/routes.ts (+4 -8)

📄 Description


Summary by cubic

Compute passkey verification expiration per request instead of at init, ensuring each registration and authentication request gets a fresh 5-minute TTL. This prevents premature expiry tied to server start time.

  • Bug Fixes
    • Compute expirationTime inside registration/authentication endpoints; index passes only maxAgeInSeconds=300.
    • Store per-request expiration when creating verification values to avoid expiry after long uptime or delayed calls.
    • Added tests with fake timers to verify new requests get future expiresAt even after advancing time by 6 minutes.

Written for commit 014d0728f4. Summary will update on new commits.


🔄 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/7731 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 1/31/2026 **Status:** ✅ Merged **Merged:** 2/4/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `2026-02-01/fix/passkey-expiration-time` --- ### 📝 Commits (2) - [`f1023eb`](https://github.com/better-auth/better-auth/commit/f1023eb9663c3f9234185a5f870af59ba0c316d8) fix(passkey): compute expirationTime per-request instead of at init - [`014d072`](https://github.com/better-auth/better-auth/commit/014d0728f411031d96be2ce4d6b4f2194fcce1a5) refactor: move const to outer scope ### 📊 Changes **3 files changed** (+72 additions, -115 deletions) <details> <summary>View changed files</summary> 📝 `packages/passkey/src/index.ts` (+4 -8) 📝 `packages/passkey/src/passkey.test.ts` (+64 -99) 📝 `packages/passkey/src/routes.ts` (+4 -8) </details> ### 📄 Description - Closes #7725 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Compute passkey verification expiration per request instead of at init, ensuring each registration and authentication request gets a fresh 5-minute TTL. This prevents premature expiry tied to server start time. - **Bug Fixes** - Compute expirationTime inside registration/authentication endpoints; index passes only maxAgeInSeconds=300. - Store per-request expiration when creating verification values to avoid expiry after long uptime or delayed calls. - Added tests with fake timers to verify new requests get future expiresAt even after advancing time by 6 minutes. <sup>Written for commit 014d0728f411031d96be2ce4d6b4f2194fcce1a5. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <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-04-13 10:12:53 -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#15766