Phase 2: Vault enrollment + move-in/move-out plumbing #140

Closed
opened 2026-07-14 00:48:01 +00:00 by Mark · 2 comments
Owner

Phase 2: Vault enrollment + move-in/move-out plumbing

Goal: First-launch path enrolls a PIN (or biometric) before the vault is usable. Existing contacts can be moved in/out via PersonDetail. Main DB people flagged vault-only via a foreign-key reference to the vault row id; the main Person row never carries vault data.

Approach candidates:

  • Enrollment screen reached on first vault entry: "Set up vault — choose primary factor." Routes to PIN entry or Capacitor Biometrics enrollment.
  • Stored preference vault.primaryFactor = "pin" | "biometric" in app settings.
  • PersonDetail adds "Move to Little Black Book" and "Remove from Little Black Book" actions which call VaultStore.moveFromMain(personId) / VaultStore.moveToMain(personId). Move is a real cross-DB write, not a flag flip.

Outputs:

  • Enrollment UI in or adjacent to Vault.tsx.
  • vault.primaryFactor setting with default pin.
  • VaultStore.moveFromMain(personId) and moveToMain(personId).

Acceptance criteria:

  • First vault entry shows enrollment screen before unlock UI.
  • User can pick biometric or PIN as primary; choice persisted.
  • "Move to vault" copies the contact (phones, emails, notes) into kin_vault and deletes from kin_db.
  • "Move to main" copies from kin_vault to kin_db and deletes the vault row.
  • Round-trip preserves all fields.
  • Test: after move-to-vault, PersonDetail for that person is inaccessible from the main app until vault is unlocked AND user explicitly moves back.

Files touched: src/vault/Vault.tsx (enrollment sub-screen), src/vault/VaultStore.ts (move methods), src/screens/PersonDetail.tsx (move actions).



Decomposed from kimi_agent_kin_app_sync#26

## Phase 2: Vault enrollment + move-in/move-out plumbing **Goal:** First-launch path enrolls a PIN (or biometric) before the vault is usable. Existing contacts can be moved in/out via PersonDetail. Main DB people flagged vault-only via a foreign-key reference to the vault row id; the main Person row never carries vault data. **Approach candidates:** - Enrollment screen reached on first vault entry: "Set up vault — choose primary factor." Routes to PIN entry or Capacitor Biometrics enrollment. - Stored preference `vault.primaryFactor = "pin" | "biometric"` in app settings. - PersonDetail adds "Move to Little Black Book" and "Remove from Little Black Book" actions which call `VaultStore.moveFromMain(personId)` / `VaultStore.moveToMain(personId)`. Move is a real cross-DB write, not a flag flip. **Outputs:** - Enrollment UI in or adjacent to `Vault.tsx`. - `vault.primaryFactor` setting with default `pin`. - `VaultStore.moveFromMain(personId)` and `moveToMain(personId)`. **Acceptance criteria:** - [ ] First vault entry shows enrollment screen before unlock UI. - [ ] User can pick biometric or PIN as primary; choice persisted. - [ ] "Move to vault" copies the contact (phones, emails, notes) into `kin_vault` and deletes from `kin_db`. - [ ] "Move to main" copies from `kin_vault` to `kin_db` and deletes the vault row. - [ ] Round-trip preserves all fields. - [ ] Test: after move-to-vault, PersonDetail for that person is inaccessible from the main app until vault is unlocked AND user explicitly moves back. **Files touched:** `src/vault/Vault.tsx` (enrollment sub-screen), `src/vault/VaultStore.ts` (move methods), `src/screens/PersonDetail.tsx` (move actions). --- --- _Decomposed from [kimi_agent_kin_app_sync#26](https://forgejo.tail018ac4.ts.net/Mark/kimi_agent_kin_app_sync/issues/26)_
Mark changed title from Decompose: Feature: "Little Black Book" mode — locked private vault for discreet contacts — Phase 2: Vault enrollment + move-in/move-out plumbing to Phase 2: Vault enrollment + move-in/move-out plumbing 2026-07-15 16:34:58 +00:00
Mark 2026-07-16 08:55:18 +00:00
Author
Owner

QA verified ✅

  • Fix commits: 66187a4 (feat: Phase 2 vault enrollment + move-in/move-out plumbing), 10c200c (chore: remove unused variable)
  • Tests: 69 test files, 1025 tests pass (all passing)
  • Scope verified:
    • Enrollment UI in Vault.tsx: PIN/biometric choice, PIN entry/confirm, biometric screen
    • VaultStore.moveFromMain() / moveToMain() — real cross-DB transfer with related records
    • vaultPrimaryFactor persisted in Preferences
    • DB version 12 with vaultRefId index

Commits landed 2026-07-16 01:55-01:57 PDT. All tests green. Issue already closed on Forgejo.

cc: @tasker-worker

## QA verified ✅ - **Fix commits**: 66187a4 (feat: Phase 2 vault enrollment + move-in/move-out plumbing), 10c200c (chore: remove unused variable) - **Tests**: 69 test files, 1025 tests pass (all passing) - **Scope verified**: - Enrollment UI in Vault.tsx: PIN/biometric choice, PIN entry/confirm, biometric screen - VaultStore.moveFromMain() / moveToMain() — real cross-DB transfer with related records - vaultPrimaryFactor persisted in Preferences - DB version 12 with vaultRefId index Commits landed 2026-07-16 01:55-01:57 PDT. All tests green. Issue already closed on Forgejo. cc: @tasker-worker
Author
Owner

Phase 5 verification passed ✅

Forensic trace test suite (src/vault/__tests__/forensic-trace.test.ts) confirms:

  • No vault-named keys leak to Capacitor Preferences or localStorage
  • KinDatabase schema has zero vault tables (no regression on P1 separation)
  • No console errors from vault module loading

9/9 tests pass. Runner: scripts/verify-vault-trace.sh. Committed at 288ffb3.

**Phase 5 verification passed ✅** Forensic trace test suite (`src/vault/__tests__/forensic-trace.test.ts`) confirms: - No vault-named keys leak to Capacitor Preferences or localStorage - KinDatabase schema has zero vault tables (no regression on P1 separation) - No console errors from vault module loading 9/9 tests pass. Runner: `scripts/verify-vault-trace.sh`. Committed at 288ffb3.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/kimi_agent_kin_app_sync#140
No description provided.