diff --git a/DESIGN-web-app.md b/DESIGN-web-app.md index 6481f76..180cdda 100644 --- a/DESIGN-web-app.md +++ b/DESIGN-web-app.md @@ -1,6 +1,6 @@ # Pithos in the browser (plan) -Status: plan, 2026-10-05. Nothing built yet. +Status: plan, 2026-10-05. Nothing built yet. Decided: `https://pithos.silentmode.st`, sign-in only, "Remember on this device" allowed. ## Goal @@ -14,8 +14,15 @@ hands over to the local Pithos ("Open my Pithos", port 47621). ## Where it lives: its own origin -**`https://s3.silentmode.st/app`**, served by the hosted gateway. +**`https://pithos.silentmode.st`**: a vhost of its own that serves the app +files and forwards `/hosted/v1/*`, `/api/*` and the S3 paths to the hosted +gateway (127.0.0.1:8720), so the page and the API share one origin. +- Not `app.pithos.sia` either: outside Theseus BNS names are paths of + navigate.st (and BNS folds subdomains into the parent name's folder), so + the origin would still be navigate.st. Per-name origins on navigate.st + (`.navigate.st`, wildcard certificate) would fix that for every BNS + site; a separate project. - Not on `navigate.st/bns/pithos.sia/app`: every BNS site served through navigate.st shares the origin `navigate.st`, so any other `.sia`/`.bch` site could open the app's window (same origin) and read the keys out of it, or @@ -25,7 +32,7 @@ hands over to the local Pithos ("Open my Pithos", port 47621). - `pithos.sia/app` keeps its meaning: in Theseus it is the full app (the add-on answers it); in any other browser the website's app-address hint gets a third button, "Open in the browser app", linking to - `https://s3.silentmode.st/app`. + `https://pithos.silentmode.st`. - Strict CSP (`default-src 'self'`, `connect-src 'self'`, no inline script, `frame-ancestors 'none'`), no third-party scripts, files served by the gateway from `Pithos/web/` (versioned with Pithos). @@ -56,9 +63,10 @@ Two kinds of key, both loaded from a file (drag and drop or picker) or pasted: gateway. Keys live **in memory only** by default; closing the tab signs out. -Optional "Remember on this device": the key file is wrapped with a +"Remember on this device" (allowed): the key file is wrapped with a passphrase (PBKDF2-SHA256 600k + AES-GCM, as Save credentials… does) in -IndexedDB on the gateway origin. Sign out wipes it and calls +IndexedDB on the pithos.silentmode.st origin; the next visit asks for the +passphrase only. Sign out wipes it and calls `DELETE` on the session. ## Crypto in the page @@ -92,13 +100,18 @@ in `Pithos/web/lib/`, sharing test vectors with the Node versions. Later: the docked music player, offline cache, PWA install. -## Gateway changes (Pithos/hosted) +## Server changes -- Serve `GET /app`, `/app/*` (static files, strict CSP, long cache with - versioned names), before the S3/auth routing. -- Nothing else: same origin, so no CORS. The S3 path rules stay as they are - (owner keys raw-proxied to s3d; grant keys checked by `rules.js`). -- Rate limits already in place for sign-in apply. +- DNS `pithos.silentmode.st` → the VPS; certificate; an Angie vhost that + serves `Pithos/web/` at `/` (strict CSP, versioned file names, long cache) + and proxies `/hosted/v1/`, `/api/` and S3 requests to 127.0.0.1:8720. +- The gateway must accept that Host for SigV4: the page signs requests for + host `pithos.silentmode.st`; owner keys go raw to s3d, which checks the + signature over the Host it receives, so the vhost passes `Host` through + unchanged and `publicUrl`-based checks (challenge message) need the second + name (the challenge text names the URL the client signed in at). +- No CORS: same origin. Path rules unchanged (owner keys raw-proxied to s3d; + grant keys checked by `rules.js`). Sign-in rate limits apply. ## Phases @@ -111,8 +124,8 @@ Later: the docked music player, offline cache, PWA install. ## Open questions -- Is `s3.silentmode.st/app` the address, or a dedicated `pithos.silentmode.st` - (same design, another certificate and vhost)? -- Should the browser app also sign up new accounts (BNS signature / invite), - or only sign in to accounts made in Pithos? -- "Remember on this device": allow it, or always ask for the key file? +- Decided 2026-10-05: `pithos.silentmode.st`; sign-in only (accounts are + made in Pithos); "Remember on this device" allowed (passphrase-wrapped). +- Still open: does s3d accept SigV4 for a Host other than the one it was set + up with? (It checks the signature over whatever Host arrives, so it should; + verify in phase 2.)