Repository navigation
v0.1.36 — admin password + device pairing
Opt-in API security via per-device pairing.
Backend behavior: When ADMIN_PASSWORD_HASH is unset (default after upgrade), the backend behaves exactly as before — LAN clients keep working without changes. Once an admin password is set via /setup, every /api/* request requires X-Whatson-Auth except a small allowlist (health, login, pair start/poll, providers, update status).
Pair flow:
- Client POSTs
/api/auth/pair/start, gets a 6-digit code - Client shows 'Open /setup, log in, enter
' - Admin enters the code in /setup → server generates a 32-byte auth key, stores SHA-256 hash + device label in
data/paired-devices.json - Client polls
/api/auth/pair/polluntil it sees the key once, then stores it forX-Whatson-Auth
Admin UI: /setup now has a login screen, first-run admin-password setup, paired-devices list with revoke, and password change.
Implementation:
- bcryptjs for password hashing
- HMAC-signed cookies for admin sessions (no store, stateless)
- Session secret auto-generated and persisted to
.env on first run
- Per-device auth keys stored only as SHA-256 hashes —
paired-devices.json leaks don't expose keys
Roku and mobile pair flows ship in follow-up commits. Order of operations: upgrade backend now (no enforcement yet); pair clients once they ship; set admin password in /setup to flip enforcement on.