feat(mobile): app-lock / lock screen with biometric unlock - #596
Open
Lazyartist1 wants to merge 1 commit into
Open
feat(mobile): app-lock / lock screen with biometric unlock#596Lazyartist1 wants to merge 1 commit into
Lazyartist1 wants to merge 1 commit into
Conversation
Protect the wallet when the device is idle or the app is backgrounded by requiring a biometric to return, so a lost or borrowed phone doesn't expose funds. Ports the web wallet's inactivity lock to native AppState and expo-local-authentication. - lib/idleLock.ts: framework-agnostic countdown (native port of idle-lock.ts), pure and injectable-clock testable, with the 5/15/30/never options and the defer-while-busy behaviour. - hooks/useInactivityLock.ts: wires the countdown to AppState + expo-router — background locks immediately, foreground restarts the countdown, both route to /lock. Mounted once at the root in _layout.tsx. - app/lock.tsx: lock screen; unlock requires a real biometric via LocalAuthentication.authenticateAsync (Face ID / fingerprint, device-passcode fallback), then returns to the dashboard. Closes Miracle656#456
|
@Lazyartist1 is attempting to deploy a commit to the miracle656's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Lazyartist1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
Adds the app-lock / lock screen (backlog item 28) — the wallet locks after inactivity or when backgrounded, and a device biometric is required to return. Ports the web wallet's inactivity-lock behaviour to native
AppState+expo-local-authentication, so a lost or borrowed phone doesn't expose funds.Changes
lib/idleLock.ts— framework-agnostic countdown (native port of the weblib/idle-lock.ts). Pure, with an injectable clock; keeps the 5 / 15 / 30 / never options and the "defer while a transaction is in flight" behaviour.hooks/useInactivityLock.ts— wires the countdown toAppStateand expo-router: background locks immediately, foreground restarts the idle countdown, and either trigger routes to/lock. Re-arms off the current route so it never fights the lock screen it just pushed.app/lock.tsx— lock screen. Unlock requires a real biometric viaLocalAuthentication.authenticateAsync(Face ID / fingerprint, with device-passcode fallback); on success it returns to the dashboard.app/_layout.tsx— mounts the lock gate once at the root, alongside the existing connectivity gate.expo-local-authenticationdependency (listed in the issue).Acceptance
Testing
tsc --noEmitcleanjest lib/__tests__/idleLock.test.ts— 6/6 passing (timeout fires, reset postpones, stop cancels, never-disabled, defer-while-busy, ms conversion)Closes #456