From bae0892751b8c48364fcfc7ada34533ebecf8ba5 Mon Sep 17 00:00:00 2001 From: Avi Date: Tue, 1 Sep 2026 10:42:14 -0500 Subject: [PATCH] checkpoint: document profile import over IPC --- CHECKPOINT-encryption.md | 107 ++++++++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 41 deletions(-) diff --git a/CHECKPOINT-encryption.md b/CHECKPOINT-encryption.md index ffbb89c..e138d77 100644 --- a/CHECKPOINT-encryption.md +++ b/CHECKPOINT-encryption.md @@ -1,54 +1,79 @@ -# Checkpoint — Release packages with profile metadata fix (2026-09-01) +# Checkpoint — Profile import over IPC (2026-09-01) ## Where things are - Project: `/home/avi/Projects/Keynctr` -- Git repo: `master` @ `3107508` ("fix: query imported metadata by relay"). -- Working tree: intended profile metadata fix is committed; unrelated UI/branding changes remain uncommitted and untracked. +- Git repo: `master` @ `0207636` ("feat: expose profile import over IPC"). +- Working tree: clean except four untracked items (`.directory`, `.opencode/`, + `COSMIC_THEME.md`, `KeynectrAppIconPossibility02.jpeg`) — none are part of this + feature and none have been committed. ## What was completed -1. **Cosmic branding update.** The Cosmic theme now uses Gold `#F3B407` and Light Blue `#87E6FB`; Cosmic’s dark sidebar presents the logo in white while retaining black-on-white artwork elsewhere. The visible brand is `SOLARPUNK SUMMIT` with `KITCHEN 484`. -2. **Fixed broken profile delete/undo** (previous). `src/ipc.rs` missing `DeleteProfile`/`UndoDelete`; added handlers returning `state_view`; exposed `profiles::delete_profile` outside tests; `api.ts`/`AppProvider` now `call` via `applyState`; `fakeBackend` delete/undo. -2. **Themed auto-dismiss undo bar.** Replaced permanent white bar with `var(--primary-soft)` + `var(--primary)` link `Undo and restore profile`, 5s `useEffect` watching `lastDeleted`, shown in both empty/populated states. -3. **Impeccable themes (light + dark).** `src/settings.rs`: `Theme::Impeccable` + `ImpeccableDark` (serde `impeccable-dark`); `types.ts` union extended; `styles.css` added `:root[data-theme='impeccable']` (oklch 97% lacquer light, kinpaku gold `oklch(77% .13 82)`, Alumni Sans 300) and `impeccable-dark` (oklch 15% lacquer-deep, champagne text), editorial refinements (uppercase labels, 8/3px radii, nav left-border active, card offset bar); `SettingsScreen.tsx` adds both options with live `var(--*)` swatches. -4. **Unified ProfileEditModal.** `frontend/src/components/ProfileEditModal.tsx` — Paper Lift modal (`var(--surface)`/`var(--border)`/`16px`/`0 12px 40px`), 3 tabs (Name/Picture/NIP-05) sharing `renameProfile`/`setProfilePicture`/`setNip05`; `ProfilesScreen.tsx` wires `Edit profile` (secondary) alongside legacy ghosts; `DESIGN.md` + `PRODUCT.md` + `.impeccable/design.json` from `impeccable document` (Vault & Atelier, warm ivory/charcoal/coral, 9 primitives). -5. **Linux installers.** Electron Builder now produces both AppImage and Debian targets. Generated artifacts are `frontend/release/SOLARPUNK SUMMIT-0.1.0.AppImage` and `frontend/release/keynectr_0.1.0_amd64.deb`. -6. **Keynctr branding.** Replaced the visible `SOLARPUNK SUMMIT` / `KITCHEN 484` labels with `Keynctr` in the window, page title, sidebar, home screen, settings, and tests. Rebuilt artifacts: `frontend/release/Keynctr-0.1.0.AppImage` and `frontend/release/keynectr_0.1.0_amd64.deb`. +1. **Profile import is now usable from the GUI.** The `profiles::import_profile` + function (already in the Rust core from the account-import work) is now exposed + through the JSON-lines IPC protocol: new `ImportProfile` request and handler in + `src/ipc.rs`, `import_profile` added to the Electron method allowlist, + `api.importProfile` + `AppProvider.importProfile` in the frontend, and + "Add existing account" buttons on the Profiles screen (empty and populated + states). The existing `ImportProfileModal` (enter only the private key; the name + and kind-0 metadata are derived from the network) is now wired to it. +2. **Active signing identity card on Home.** The Home screen shows a card with the + active profile's avatar, name, shortened npub, and a "Switch profile" button. +3. **HomeScreen test fixes.** The identity card duplicates the active profile's name + and npub on the page, so the two affected tests now scope their queries to the + identity card (via the "Active signing identity" heading) and to the profile + list, instead of querying the whole screen. +4. **Prettier** applied to `ImportProfileModal.tsx`, `ProfilesScreen.tsx`, + `AppProvider.tsx` (and the test file), clearing the three existing + `format:check` warnings — `npm run format:check` is now fully clean. ## Commits added in this session (newest first) -- `3107508` fix: query imported metadata by relay -- `da33652` fix: query imported metadata by public key -- `bde35bc` fix: import existing profile metadata -- `d2d773a` fix: remove Stardust background dots -- `7605f51` fix: keep NIP-46 signer subscription open -- `76deca6` feat: add Cosmic theme + motion system (palette/branding refinements currently uncommitted) -- `8366af7` feat: add Impeccable themes (light + dark) + unified ProfileEditModal -- `832e114` checkpoint: fix delete/undo + themed auto-dismiss bar -- `9e635e7` fix: restore profile delete/undo and themed auto-dismiss undo bar +- `0207636` feat: expose profile import over IPC +- `2604cf9` checkpoint: document release packages ## Verification commands run -- Rust: `cargo fmt --check`, `cargo clippy --all-targets`, `cargo test` (115 passed), and `cargo build --release` passed; existing warnings remain in `src/ipc.rs` and `src/profiles.rs`. -- Frontend: `npm test` (15 files / 99 tests), `npm run typecheck`, `npm run lint`, `npm run format:check`, `npm run build`, and `npm run electron:build` passed. -- Packaging: `npx electron-builder --linux AppImage deb` passed; AppImage and Debian files verified with `file`. -- Branding verification: `npm test`, `npm run typecheck`, `npm run lint`, `npm run format:check`, `npm run electron:build`, `npm run build`, and `npx electron-builder --linux AppImage deb` passed. -- Frontend build no longer reports the Cosmic font `@import` ordering warning; standard Vite/ESM and ESLint module warnings remain. -- Wayland `--ozone-platform` / `has no handler` messages on `electron:build` are harmless. -- NIP-46 fix: use a persistent subscription instead of the auto-closing `stream_events` helper, so clients can send requests after EOSE. -- Stardust verification: `npm test` (99 passed), `npm run typecheck`, `npm run lint`, `npm run electron:build`, and `npm run build` passed. `npm run format:check` still reports existing issues in three unrelated frontend files. -- Existing-account import verification: `cargo test` (115 passed), `cargo clippy --all-targets`, `cargo fmt --check`, `cargo build --release`, `npm test` (99 passed), `npm run typecheck`, `npm run lint`, `npm run electron:build`, and `npm run build` passed. `npm run format:check` reports existing issues in three frontend files. -- Imported account naming: the name field is no longer required; kind-0 `display_name`/`name` is used automatically, with a shortened npub fallback. Verification: `cargo test` (116 passed), `cargo clippy --all-targets`, `cargo fmt --check`, `cargo build --release`, `npm test` (99 passed), `npm run typecheck`, `npm run lint`, `npm run electron:build`, and `npm run build` passed. `npm run format:check` still reports existing issues in three frontend files. -- Corrected metadata lookup to query with the derived public-key type directly, preventing silent fallback when importing accounts. -- Release verification: Rust test suite (116 passed), clippy, fmt, release build, frontend tests (99 passed), typecheck, lint, Electron build, production build, and AppImage/Debian packaging passed. Frontend format check retains three existing warnings. +All green in this session, run after the changes: + +- Rust: `cargo fmt --check` clean; `cargo test` — 116 passed; + `cargo clippy --all-targets` — only the 2 pre-existing warnings (`std::mem::drop` + on a reference, unused variable `restored`); `cargo build --release` — success. +- Frontend: `npm test` — 15 files / 99 passed (the 2 previously failing HomeScreen + tests now pass); `npm run typecheck` clean; `npm run lint` clean (only the + harmless ES-module reparsing warning); `npm run format:check` — all files clean; + `npm run electron:build` — success; `npm run build` — success (Vite bundle built). +- Packaging (previous session, still valid artifacts): + `npx electron-builder --linux AppImage deb` produced + `frontend/release/Keynctr-0.1.0.AppImage` and + `frontend/release/keynectr_0.1.0_amd64.deb`, verified with `file`. +- Wayland `--ozone-platform` / `has no handler` messages on `electron:build` are + harmless. ## How to resume / reproduce -GUI (Cosmic): `cargo build --release && cd frontend && npm run build && npm run electron:build && npm start` (or dev: `npm run dev` in one terminal + `NOSTR_GUI_DEV_URL=http://localhost:5173 npm start` in second). Settings → Appearance → `Cosmic — Stardust`. CLI: `cargo run -- settings set theme cosmic`. -- Build installers: `cd frontend && npm run build && npm run electron:build && npx electron-builder --linux AppImage deb`. Install the `.deb` with `sudo apt install ./release/keynectr_0.1.0_amd64.deb`, or run the AppImage with `./release/SOLARPUNK\ SUMMIT-0.1.0.AppImage`. -- Current installers: `sudo apt install ./release/keynectr_0.1.0_amd64.deb`, or `./release/Keynctr-0.1.0.AppImage`. -- Signer GUI: unlock vault, open `Signer`, select remote signer in the client, paste its `nostrconnect://` URI, then approve requests. CLI: `cargo run --release -- signer connect `. -- Stardust GUI: select `Settings -> Appearance -> Cosmic - Stardust`, then restart the frontend to load the updated CSS bundle. -- Import GUI: restart after rebuilding, open `Profiles -> Add existing account`, enter only the private key, and Keynctr will derive the profile name and metadata from the network. -- Release artifacts: `frontend/release/Keynctr-0.1.0.AppImage` and `frontend/release/keynectr_0.1.0_amd64.deb`, verified with `file`. +- Build + run the GUI: `cargo build --release && cd frontend && npm run build && + npm run electron:build && npm start` (dev: `npm run dev` in one terminal + + `NOSTR_GUI_DEV_URL=http://localhost:5173 npm start` in a second, or + `npm run start:dev`). +- Import an existing account (GUI): unlock the vault if needed, open + **Profiles → Add existing account**, paste only the private key + (`nsec1...`), and confirm — the profile name and metadata (picture, NIP-05) are + derived from the network automatically, with a shortened-npub name fallback. +- Import (IPC/CLI): the `serve` loop now accepts + `{"id": 1, "method": "import_profile", "params": {"label": "...", "secret": "nsec1..."}}` + and replies with the new profile summary plus full app state. +- Home identity card: the card appears at the top of Home whenever a profile is + active; "Switch profile" navigates to the Profiles screen. +- Installers: `sudo apt install ./frontend/release/keynectr_0.1.0_amd64.deb` or + `./frontend/release/Keynctr-0.1.0.AppImage` (rebuild with + `npx electron-builder --linux AppImage deb` after changes). ## Outstanding / next-step items -- Undo restores with empty `secret_key` (stores `ProfileSummary`); needs `StoredProfile` in `undo_history` for full secret recovery. -- `.opencode/`, `COSMIC_THEME.md`, and `KeynectrAppIconPossibility02.jpeg` remain untracked; no commit was created in this session. -- Installer artifacts are local build outputs under `frontend/release/` and are not committed. +- **Undo restores with empty `secret_key`** (stores `ProfileSummary`); needs + `StoredProfile` in `undo_history` for full secret recovery. +- `.opencode/`, `COSMIC_THEME.md`, `KeynctrAppIconPossibility02.jpeg` remain + untracked (`.directory` is a file-manager artifact); no commit was created for + them in this session. +- Installer artifacts are local build outputs under `frontend/release/` and are + not committed. +- Two pre-existing clippy warnings remain in `src/ipc.rs` / `src/profiles.rs` + (drop of a reference, unused `restored`) — trivial to clean up. +- README is stale (title, dependency versions, test counts, Forgejo references) — + worth a docs pass before 0.2.