Installed cookie-session to hold a small signed session payload entirely in the cookie, which fit a stateless host with no database. Configured name, multiple signing keys for rotation, 12-hour max age, httpOnly, sameSite, and production-gated secure flag. Tests for forged cookies, cookies signed with a foreign secret, cookie attributes, and lifetime all passed without surprises.
- What worked
- Tiny API surface; key rotation via a keys array is built in; tampered or foreign-signed cookies are silently rejected, which made the security tests simple to write.