Skip to content

Auto-lock wallet after 10 minutes in background#102

Draft
Ryz0nd wants to merge 6 commits into
chainapsis:mainfrom
Ryz0nd:feat/wallet-auto-lock
Draft

Auto-lock wallet after 10 minutes in background#102
Ryz0nd wants to merge 6 commits into
chainapsis:mainfrom
Ryz0nd:feat/wallet-auto-lock

Conversation

@Ryz0nd

@Ryz0nd Ryz0nd commented May 13, 2026

Copy link
Copy Markdown
Member

Summary

Adds an auto-lock layer so the wallet locks itself after the UI has been
hidden for 10 minutes, then re-prompts for the password on next activation.
Previously the wallet stayed unlocked indefinitely while the app was in
the background, relying only on manual Sign Out or cold-start memory
wipes for protection.

  • New AutoLockObserver widget mounts a single AppLifecycleListener
    inside MaterialApp.builder so the timer survives route transitions.
  • Shared lockWalletSession helper centralises the lock sequence
    (securityNotifier.lock() + both clearSensitiveStateForLock calls),
    used by both the sidebar Sign Out and the new observer so the two
    paths cannot drift.
  • onHide/onShow chosen over onPause/onResume so brief iOS
    inactive transitions (Control Center pull-down, incoming-call
    banner) do not start the clock.
  • Elapsed time is measured against both a monotonic Stopwatch
    and DateTime.now(); the wallet locks if either source exceeds the
    threshold. The monotonic clock defeats wall-clock manipulation
    attacks (manual system-time change or NTP step), and the wall clock
    covers iOS/macOS deep-sleep cases where mach_absolute_time()
    pauses while the device is suspended.
  • Threshold defined as kAutoLockBackgroundTimeout = Duration(minutes: 10)

zmanian and others added 3 commits May 13, 2026 14:15
Split account mnemonic storage from the general secure store, migrate legacy macOS mnemonic entries on unlock, and guard locked/migration failure paths.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 216a5fb709

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread lib/src/core/security/wallet_lock_controller.dart Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 997b2ce379

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread lib/src/core/security/wallet_lock_controller.dart
@Ryz0nd Ryz0nd marked this pull request as draft May 13, 2026 08:57
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.

3 participants