From d95817ff2ecc0b16724db66ea926b6964d3d1361 Mon Sep 17 00:00:00 2001 From: Avi Date: Tue, 4 Aug 2026 13:37:26 -0500 Subject: [PATCH] Refresh checkpoint with NIP-98 upload fix --- CHECKPOINT-encryption.md | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/CHECKPOINT-encryption.md b/CHECKPOINT-encryption.md index ab2b078..c2e8710 100644 --- a/CHECKPOINT-encryption.md +++ b/CHECKPOINT-encryption.md @@ -6,9 +6,9 @@ verified green at the moment this file was written. ## Where things are - Project: `/home/avi/Projects/skills/nost-feed-manager` -- Git repo: `master` @ `3e3467b` ("Add compose preview with image attachments (NIP-92 imeta)"), - on top of `17e8ace` ("Clarify the Profiles subtitle about private keys") and `8eb6685` - ("Add reveal-secret-key after unlock (CLI + GUI)"). +- Git repo: `master` @ `03f6877` ("Sign NIP-98 auth for nostr.build image uploads"), on top of + `3e3467b` ("Add compose preview with image attachments (NIP-92 imeta)"), `17e8ace` (Profiles + subtitle copy), and `8eb6685` (reveal-secret-key). - The working tree is **clean** — everything from this session is committed. - `/home/avi/Projects/nostr_backend/nostr_backendmanager.md` (old-CLI docs) has been updated to match reality; it lives outside this repo so it is not part of any commit. @@ -33,6 +33,14 @@ will appear (profile avatar + npub, the text, and any images), without publishin ## Commits this session (newest first) +- `03f6877` "Sign NIP-98 auth for nostr.build image uploads" — fixes the attach-image flow, which + failed with "Unauthorized, please provide a valid nip-98 token". nostr.build now requires a + NIP-98 `Authorization` header. Backend: new `src/uploads.rs` (`nip98_authorization` signs a kind + 27235 auth event with the active profile's key and returns `Nostr `), IPC method + `upload_auth { url, http_method }`, `nostr-sdk` feature `nip98` added. Electron: + `frontend/electron/main.ts` fetches the header from the backend and sends it on the upload. + Verified live: throwaway profile → IPC `upload_auth` → `curl` upload to nostr.build returned + `status: success` (temp data cleaned up). - `3e3467b` "Add compose preview with image attachments (NIP-92 imeta)" — 11 files, 1 new. Backend: `src/publish.rs` (`extract_image_urls`, `image_mime_from_url`, `image_tags` + tests). Electron: `frontend/electron/main.ts` (`pickImage`, `uploadImage`, routed from `backend:request`). @@ -45,7 +53,7 @@ will appear (profile avatar + npub, the text, and any images), without publishin ## How it was verified (all green) ``` -cargo test # 60 passed +cargo test # 64 passed cargo clippy --all-targets # clean cargo fmt --check # clean cargo build --release # builds (rebuilt so the GUI runs the new backend) @@ -53,10 +61,13 @@ npm run typecheck # clean (frontend/) npm run lint # clean (pre-existing module warning only) npm run format:check # clean npm test # 60 passed (11 files) -npm run build # rebuilds the React bundle (dist/) npm run electron:build # compiles the Electron main process ``` +Plus a live upload test: created a throwaway profile under `XDG_DATA_HOME=/tmp/...`, got the +`upload_auth` header through the IPC `serve` loop, and `curl`-uploaded a tiny PNG to nostr.build — +returned `status: success`. Temp data cleaned up. + ## How to resume 1. Open the repo: `cd /home/avi/Projects/skills/nost-feed-manager` @@ -72,6 +83,7 @@ npm run electron:build # compiles the Electron main process ## Outstanding / next steps (if you continue) - Nothing uncommitted. Possible follow-ups: a real feed view (currently Home only shows the last - publication); optional NIP-98 auth for nostr.build uploads; relay defaults in code still point at - `relay.damus.io` (503 upstream) and `relay.nostr.band` (timeout) — user's local settings already - use `nos.lol` + `relay.primal.net` instead. + publication); the upload uses the active profile's key for NIP-98 (so an encrypted, locked vault + needs unlocking before attaching an image — the attach error explains this); relay defaults in code + still point at `relay.damus.io` (503 upstream) and `relay.nostr.band` (timeout) — user's local + settings already use `nos.lol` + `relay.primal.net` instead.