Checkpoint: NIP-05 identifiers

This commit is contained in:
Avi 2026-08-23 22:00:13 -05:00
commit 2ad054e6e1

View file

@ -1,4 +1,123 @@
# Checkpoint — Responsive backend (concurrent IPC) + rename (2026-08-23)
# Checkpoint — NIP-05 identifiers (2026-08-23)
A stopping point you can return to if this session is closed. Everything below was
verified green at the moment this file was written.
## Where things are
- Project: `/home/avi/Projects/Nostr_Keynctr`
- Git repo: `master` @ `045fa47` ("Add NIP-05 identifiers: store, publish, GUI
modal, CLI helpers"). Before it: `f2c30d3` (checkpoint), `cb23a5e` (publish
latency trim), `4d70b25` (concurrent IPC), `d618a5a` (rename), and earlier
rebrand/UI commits listed in the previous checkpoint section below.
- Working tree is **clean** apart from this checkpoint update, which is committed right after.
## What was completed
1. **NIP-05 identifiers (2026-08-23, `045fa47`)** — the feature agreed on
2026-08-22 (see "Next feature" note in the older checkpoint below). A session
that crashed mid-edit had left most of the Rust side written but uncommitted
and non-compiling; this session finished it end-to-end:
- **Backend (Rust):** `nip05: Option<String>` on `StoredProfile` +
`ProfileSummary`; `set_nip05()` validates (`name@domain`, `_@domain` bare
form allowed; lower-cased; rejects malformed input without storing),
stores, and republishes kind 0 metadata with the identifier included;
wired through IPC (`set_nip05` request) and CLI (`set-nip05 <npub>
<id|clear>`); all other publish paths (create/rename/picture/publish-name)
now include the stored nip05.
- **GUI:** new **NIP-05** button on every Profiles card opens a modal
(prefilled) with live validation, *Save & publish* and *Remove*; the
handle is displayed on the profile card under the name. Wired:
Electron allowlist, `api.setNip05`, AppProvider, fake backend + tests.
- **CLI helper:** `keynectr nip05-file <npub> <id>` prints the exact
`.well-known/nostr.json` document (names + relays maps, hex pubkey) to
serve on your domain. Verified against the real vault.
- **Docs:** `docs/NIP-05.md` explains both halves (app publish + domain
serving, nginx example, CORS requirement).
- **Bug fix:** `Modal.tsx` stole focus from `autoFocus` inputs one frame
after opening (deferred `container.focus()`) — now it only focuses the
dialog when nothing inside has focus. This also fixes flaky typing in
modals generally.
2. Previous session work (rename with metadata republish, concurrent IPC,
publish latency trim, card-click selection, button wrap, rebrand) — see the
older notes below.
## Commits added most recently
- `045fa47` Add NIP-05 identifiers: store, publish, GUI modal, CLI helpers
## Verification commands run (all green)
Rust (repo root):
```
cargo test # 102 passed; 0 failed (3 new NIP-05 tests)
cargo clippy --all-targets # only 2 pre-existing warnings in src/profiles.rs
# (drop of reference, unused delete_profile)
cargo fmt --check # clean
cargo build --release # success
```
Frontend (`frontend/`):
```
npm test # 14 files, 84 tests passed (4 new NIP-05 tests)
npm run typecheck # clean
npm run lint # 0 errors
npm run format:check # clean
npm run build # vite build success
npm run electron:build # tsc electron main success
```
## How to use / reproduce
GUI:
```bash
cd ~/Projects/Nostr_Keynctr/frontend && npm start
```
- Profiles screen: **NIP-05** button → type `name@domain.com` → Save & publish.
Remove clears it. The handle shows on the profile card.
- Everything else as before (Edit name, Picture, Publish name, card-click
selection, delete + undo).
CLI:
```bash
B=~/Projects/Nostr_Keynctr/target/release/keynectr
$B list # show profiles
$B set-nip05 <npub> boo@l484.com # set + publish
$B set-nip05 <npub> clear # remove + publish removal
$B nip05-file <npub> boo@l484.com # print .well-known/nostr.json JSON
```
Domain side (one-time): serve the printed document at
`https://<domain>/.well-known/nostr.json` with `Content-Type: application/json`
and `Access-Control-Allow-Origin: *` — details + nginx snippet in
`docs/NIP-05.md`.
## Notes & next steps
- The `.well-known/nostr.json` HTTP half cannot be done by the app alone; users
must host the file themselves (`nip05-file` prints it for them).
- If rename/publish latency still feels long, next step would be background
publishing (return immediately, report via notice later).
- Pre-existing clippy warnings in `src/profiles.rs` (drop of a reference, unused
`delete_profile`) are untouched — worth cleaning up in a future pass.
- Nostr has no relay-to-relay sync: names/pictures/nip05 are only visible on
relays they were published to. Keep major relays enabled.
- Clients cache profiles; hard-refresh (Ctrl+Shift+R) after republishing.
- Candidate next features: banner/about fields in the edit UI.
- Binary is `keynectr`; data lives in `~/.local/share/keynectr`. The KDF verifier
string in crypto.rs was deliberately NOT renamed so old encrypted backups stay readable.
The git remote is `https://git.atitlan.io/avi/Nostr_Keynctr`.
- Relay config at time of writing: nos.lol, relay.primal.net, nostr.l484.com
(user's own), damus.io, snort.social, soloco.nl, relay.nostr.band.
---
# Older checkpoint — Responsive backend (concurrent IPC) + rename (2026-08-23)
**App renamed to Keynectr (2026-08-23).** A stopping point you can return to if this session is closed. Everything below was
verified green at the moment this file was written.