Decompose: Feature: "Little Black Book" mode — locked private vault for discreet contacts — Phase 1: Vault DB + store split (separate Dexie instance) #139

Closed
opened 2026-07-14 00:48:00 +00:00 by Mark · 1 comment
Owner

Phase 1: Vault DB + store split (separate Dexie instance)

Goal: Stand up kin_vault as a distinct Dexie database. Vault data NEVER lives in the main kin_db. The main DB has zero knowledge of vault contacts. Future readers cannot infer vault existence from main-DB shape.

Approach candidates:

  • New file src/vault/vault-db.ts exporting a vaultDb instance with name kin_vault, version 1. Schema mirrors main Person / Interaction / Gift / Date tables but scoped to the vault.
  • vaultDb is constructed lazily inside VaultStore, never imported by db.ts or schemas.ts.

Outputs:

  • src/vault/vault-db.ts with tables: vaultPeople, vaultInteractions, vaultGifts, vaultDates, vaultNotes.
  • src/vault/VaultStore.ts skeleton wrapping all vault queries; rejects reads unless unlock state is "unlocked" in-memory.

Acceptance criteria:

  • kin_vault Dexie DB created with name kin_vault, separate from kin_db.
  • No import of vault-db from src/db.ts, src/schemas.ts, or any main-DB module.
  • VaultStore exports isUnlocked(): boolean; any query called while locked throws VaultLockedError.
  • Unit test proves kin_db (Inspect) has no vaultPeople table; kin_vault (Inspect) has no people table.

Files touched: src/vault/vault-db.ts (new), src/vault/VaultStore.ts (new), src/db.ts (untouched, verify no import path), new unit tests under src/vault/__tests__/.



Decomposed from kimi_agent_kin_app_sync#26

## Phase 1: Vault DB + store split (separate Dexie instance) **Goal:** Stand up `kin_vault` as a distinct Dexie database. Vault data NEVER lives in the main `kin_db`. The main DB has zero knowledge of vault contacts. Future readers cannot infer vault existence from main-DB shape. **Approach candidates:** - New file `src/vault/vault-db.ts` exporting a `vaultDb` instance with name `kin_vault`, version 1. Schema mirrors main Person / Interaction / Gift / Date tables but scoped to the vault. - `vaultDb` is constructed lazily inside `VaultStore`, never imported by `db.ts` or `schemas.ts`. **Outputs:** - `src/vault/vault-db.ts` with tables: `vaultPeople`, `vaultInteractions`, `vaultGifts`, `vaultDates`, `vaultNotes`. - `src/vault/VaultStore.ts` skeleton wrapping all vault queries; rejects reads unless unlock state is "unlocked" in-memory. **Acceptance criteria:** - [ ] `kin_vault` Dexie DB created with name `kin_vault`, separate from `kin_db`. - [ ] No import of `vault-db` from `src/db.ts`, `src/schemas.ts`, or any main-DB module. - [ ] `VaultStore` exports `isUnlocked(): boolean`; any query called while locked throws `VaultLockedError`. - [ ] Unit test proves `kin_db` (Inspect) has no `vaultPeople` table; `kin_vault` (Inspect) has no `people` table. **Files touched:** `src/vault/vault-db.ts` (new), `src/vault/VaultStore.ts` (new), `src/db.ts` (untouched, verify no import path), new unit tests under `src/vault/__tests__/`. --- --- _Decomposed from [kimi_agent_kin_app_sync#26](https://forgejo.tail018ac4.ts.net/Mark/kimi_agent_kin_app_sync/issues/26)_
Mark closed this issue 2026-07-14 00:51:11 +00:00
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#139
No description provided.