Repository navigation
fix(mobile): auto-lock on background and idle (#408) - #413
Open
mashfromband wants to merge 1 commit into
Open
mashfromband wants to merge 1 commit into
mashfromband wants to merge 1 commit into
Conversation
Mobile only required app-lock (PIN/biometric) on cold start; `unlocked` was then held for the whole process lifetime, so an unattended unlocked device exposed every password box. Add an auto-lock that returns the app to its locked state on two triggers: - Background transition (`visibilitychange` hidden / `pagehide`) — locks immediately by default (configurable grace). - Idle timeout — locks after inactivity (default 120s; user-selectable 60/120/300s in Settings), reset by pointer/key/touch activity. The decision logic is isolated in a framework-agnostic AutoLockController (`lib/auto-lock.ts`) unit-tested with a fake clock; React wiring lives in `hooks/useAutoLock.ts`. Re-lock resets `unlocked` and closes the open box, re-entering the existing biometric/PIN AppLockScreen. Adds ja/en/ru (+ should-locales) strings for the Settings control, and documents the auto-lock requirement in the biometric-unlock / mobile-ui specs (previously unspecified). Closes #408
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was previously deployed
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.
概要
モバイルアプリはアプリロック(PIN / 生体)を コールドスタート時に一度だけ 要求し、以後
unlockedがプロセス寿命の間ずっと保持され、バックグラウンド遷移・アイドル経過で再ロックされなかった(自動ロック不在)。本 PR で以下の 2 トリガーで自動再ロックを実装する。visibilitychange/pagehide)になったら猶予後に再ロック。既定は即時(猶予 0ms、設定可能)。復帰が猶予内なら取消。pointerdown/keydown/touchstartでリセット。再ロックは
unlockedを false に戻し、開いているパスワードボックスを閉じ、既存の生体 / PIN アンロックフロー(AppLockScreen)を再度通す。設計
AutoLockController(apps/mobile/src/lib/auto-lock.ts)に分離し、フェイククロックでユニットテスト(apps/mobile/test/auto-lock.test.ts、9 ケース)。hooks/useAutoLock.ts。App.tsxでuseAutoLock(unlocked, relock)。mobile.settings.autoLock*)。変更はpassshare:auto-lock-changed/storageイベントで実行中セッションに即時反映。i18n
mobile.autoLock.idle.{1m,2m,5m}/mobile.settings.autoLock/autoLockIdle/autoLockHint)を 全 10 ロケール に追加。node scripts/i18n-check.mjsgreen(273 keys)。「パスワードボックス」用語遵守(金庫 / Vault / ボルト不使用)。仕様
documents/spec/biometric-unlock.mdに「自動ロック / 再ロック」セクション、documents/spec/mobile-ui.mdに Auto-lock セクションを追記(issue 指摘の仕様欠落を解消)。テスト / 検証
pnpm --dir apps/mobile run test→ 24/24 pass(既存 15 + 新規 9)。pnpm --dir apps/mobile run build(vite)green。node scripts/i18n-check.mjs/jp-ui-contracts-check.mjsgreen。Closes #408