Add optional vault auto-unlock via system keyring#9
Merged
Conversation
Introduce a v2 key-slot vault envelope so the local vault can be unlocked without a password on a trusted device. - v2 envelope wraps a random data key with one or more key slots (password + optional keyring), binding all slots into the payload AAD - keyring slot stores its KEK in flutter_secure_storage with a read-back verify; auto-unlock reads it at startup and silently falls back to the password prompt on any failure - v1 vaults still decrypt and are transparently upgraded to v2 after a successful password unlock - opt-in toggle with a trade-off confirmation dialog, offered once after vault migration; unknown slot types are preserved for forward compat - lockout-safe orderings: enable writes the keyring key before adding the slot and rolls back on save failure; disable drops the slot before deleting the key; password changes re-wrap only the password slot
- Guard all vault write paths (enable/disable auto-unlock, change password, migrate) against a concurrent operation, since the busy overlay does not cover the storage menu - Log the primary failure and surface the exception text when enabling or disabling auto-unlock, in OtpState and the dashboard - Drop the cached vault password once a v2 session is established; keep it only for the v1 legacy fallback - Set the macOS keychain accessibility constraint to match iOS - Remove the unused readVersion helper - Add tests: v1 to v2 upgrade (success and fallback), enable rollback on save failure, concurrent-operation guard, missing keyring entry, and toggle guard clauses - Document the keyring service and the silent auto-unlock step in CLAUDE.md
henricook
marked this pull request as ready for review
July 5, 2026 15:49
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.
flutter_secure_storage(VaultKeyringService, read-back verified); startup auto-unlock reads it and silently falls back to the password prompt on any failure.