Repository navigation
iOS: Hermit's data and keys stay out of iCloud and computer backups - #136
Draft
dbejarano820 wants to merge 1 commit into
Draft
dbejarano820 wants to merge 1 commit into
dbejarano820 wants to merge 1 commit into
Conversation
Contributor
|
Holding this one until it's been checked on an iPhone, as the description says. Merge it yourself once it passes, or say so here and I'll merge it. 🦀 |
On iOS, the documents folder (the model in models, QVAC's caches in .qvac) and the SQLCipher database with its journal siblings are flagged isExcludedFromBackup when each is created and again at every launch (HermitVault.excludeFromBackup, which reads the flag back). Every SecureStore write goes through keychain(), which adds WHEN_UNLOCKED_THIS_DEVICE_ONLY on iOS and leaves Android's options untouched; a test scans the adapters so no write can skip it. At launch, the plain items already written move to WhenUnlockedThisDeviceOnly in place (HermitVault.keychainToThisDevice: SecItemUpdate of the class only, never the value), then each class and value is read back. The biometric-gated approval key moves only right after the user's own authenticated read: deleted and added again with the value just read, so no extra Face ID prompt, and put back as it was if the add fails. docs/devices.md says a restore from backup starts Hermit empty and downloads the model again. Android is unchanged. Closes #126 Signed-off-by: Daniel Bejarano <dbejarano820@gmail.com>
dbejarano820
force-pushed
the
dbejarano820/126-ios-no-backup
branch
from
November 30, 2026 22:40
67e3e48 to
0c5c31f
Compare
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.
What and why
Closes #126
On iOS, Hermit's database, model and QVAC caches are now excluded from iCloud and computer backups, and every Keychain item is WhenUnlockedThisDeviceOnly. Items written before this change are moved over without losing any data. Android is unchanged (
allowBackupis already false).HermitVault.excludeFromBackup(Swift) flags Documents (which holdsmodelsand.qvac, QVAC's HOME_DIR) plus both folders by name, andLibrary/hermit.dbwith its-wal/-shm/-journalsiblings. Each flag is read back after it is set. It runs when the database opens (on first creation and at every launch), when the models folder is created, and after each model load (QVAC makes.qvac).keychain()inadapters/secure.tsaddsWHEN_UNLOCKED_THIS_DEVICE_ONLYon iOS and returns Android's options untouched. EverySecureStore.setItemAsyncgoes through it, and a test scans the adapters to keep it that way.HermitVault.keychainToThisDevicelists the items underapp:no-authand the legacyappservice by attributes only. It changes just the class withSecItemUpdate, so the value is never read or rewritten natively and the update is atomic. It reads the class back, and JS then reads each moved value back through SecureStore. A silent LAContext means it never shows a prompt.gatedSecret. Changing the item in place would ask for Face ID a second time, so the code deletes it and adds it again with the value it just read (an add shows no prompt), then reads the class back. If the add fails, the item is put back with its old class. Nothing prompts at launch. Provisioning on iOS deletes the old item first for the same reason.Vision fit
Data stays on the phone: a backup no longer carries Hermit's memories, model, caches or keys to Apple's servers or a computer.
Non-negotiables
Checklist
acceptedproposal.apps/mobile/src/backup-guard.test.ts: it first failed because the module was missing. With the pure module in place, the adapter scan failed on 9 unguarded writes in app-lock, credentials, secure, vault and wallet. After the change, all 9 tests pass.)pnpm check:privacy,pnpm typecheck,pnpm lint,pnpm testandnode scripts/guard/check.mjs --patterns scripts/guard/patterns.txt.packages/copy, in es-419 and en, with matching keys and placeholders, and no em or en dashes. (No UI strings added.)Model path
packages/model,agent,skillsoreval, the prompt, the router, tool descriptions, normalizers, examples or the model file.Screenshots
New dependencies and network calls
n/a
Verification
generic/platform=iOSwithCODE_SIGNING_ALLOWED=NOsucceeded, with no errors or warnings in HermitVaultModule.swift.AI agents