Skip to content

feat: implement session timeout auto-lock for inactive users#342

Open
Marnin-A wants to merge 2 commits into
BETAIL-BOYS:mainfrom
Marnin-A:feat/session-timeout-auto-lock
Open

feat: implement session timeout auto-lock for inactive users#342
Marnin-A wants to merge 2 commits into
BETAIL-BOYS:mainfrom
Marnin-A:feat/session-timeout-auto-lock

Conversation

@Marnin-A

Copy link
Copy Markdown
Contributor

Summary

  • Adds useSessionTimeout hook that starts a 15-minute inactivity timer when a wallet is connected, tracking mousemove, mousedown, keydown, touchstart, and scroll events via a debounced listener (500ms debounce) so there is zero UI performance impact
  • On timeout, clears the wallet connection cache (clearWalletCache) and the off-chain auth token (clearAuthToken), then calls disconnectWallet and shows a Session Expired modal
  • SessionExpiredModal requires the user to click Reconnect Wallet, which re-invokes connectWallet with the previously used wallet type (triggering a re-sign)
  • SessionTimeoutProvider wires the hook and modal together and is mounted in RootLayout alongside SignatureOverlay
  • Fixes a pre-existing ESLint flat-config crash (FlatCompat + circular React plugin reference) that was blocking all commits via lint-staged — migrates eslint.config.js to the native flat config API

Test plan

  • 20 unit tests across useSessionTimeout.test.ts and SessionExpiredModal.test.tsx covering: initial state, 15-minute expiry, cache/token clearing, pre-expiry no-op, activity-resets (mousemove, keydown), no-timer when disconnected, dismissExpiry, listener cleanup on unmount, and expired state persistence after external disconnect
  • All pre-existing passing tests continue to pass (pre-existing failures in networkDetection.test.ts are unrelated to this PR)
  • ESLint and Prettier run cleanly via the pre-commit hook

Closes #241

…BOYS#241)

After 15 minutes of inactivity, clears the wallet connection cache and
auth tokens then shows a Session Expired modal requiring the user to
reconnect their wallet. Activity is tracked via a debounced listener on
mousemove, mousedown, keydown, touchstart, and scroll events so there is
no UI performance impact.

Also migrates eslint.config.js from the broken FlatCompat approach to
the native flat config API, fixing a pre-existing crash in the lint-
staged pre-commit hook that prevented all commits.

Closes BETAIL-BOYS#241
@AlAfiz

AlAfiz commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

@Marnin-A Sorry please resolve conflicts

@Marnin-A

Copy link
Copy Markdown
Contributor Author

@Marnin-A Sorry please resolve conflicts

On I'm on it

@AlAfiz

AlAfiz commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

@Marnin-A can you please check again one of the workflow is failing?

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.

Implement session timeout/auto-lock features for inactive users

2 participants