feat: implement session timeout auto-lock for inactive users#342
Open
Marnin-A wants to merge 2 commits into
Open
feat: implement session timeout auto-lock for inactive users#342Marnin-A wants to merge 2 commits into
Marnin-A wants to merge 2 commits into
Conversation
…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
Contributor
|
@Marnin-A Sorry please resolve conflicts |
Contributor
Author
On I'm on it |
Contributor
|
@Marnin-A can you please check again one of the workflow is failing? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
useSessionTimeouthook that starts a 15-minute inactivity timer when a wallet is connected, trackingmousemove,mousedown,keydown,touchstart, andscrollevents via a debounced listener (500ms debounce) so there is zero UI performance impactclearWalletCache) and the off-chain auth token (clearAuthToken), then callsdisconnectWalletand shows a Session Expired modalSessionExpiredModalrequires the user to click Reconnect Wallet, which re-invokesconnectWalletwith the previously used wallet type (triggering a re-sign)SessionTimeoutProviderwires the hook and modal together and is mounted inRootLayoutalongsideSignatureOverlayFlatCompat+ circular React plugin reference) that was blocking all commits via lint-staged — migrateseslint.config.jsto the native flat config APITest plan
useSessionTimeout.test.tsandSessionExpiredModal.test.tsxcovering: 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 disconnectnetworkDetection.test.tsare unrelated to this PR)Closes #241