Replace the FastAPI/HTMX prototype with a Node/Hono session proxy and a React 19/Vite SPA. Mail (conversation view, search operators, labels, sanitised HTML, privacy image proxy, invites, undo send, templates), calendar (month/week/day/agenda, invites, free/busy, categories, context menus), contacts (JSContact, groups, vCard), files, Sieve filter builder (incl. filter-from-message with retroactive apply), vacation, identities with default + Reply-To, PWA/mobile layout, push via SSE, in-memory mock Stalwart for dev, Docker + CI.
57 lines
1.8 KiB
TypeScript
57 lines
1.8 KiB
TypeScript
import {
|
|
createCipheriv,
|
|
createDecipheriv,
|
|
createHash,
|
|
hkdfSync,
|
|
randomBytes,
|
|
timingSafeEqual,
|
|
} from "node:crypto";
|
|
|
|
/**
|
|
* Credentials are sealed with a key derived from the per-session cookie secret
|
|
* combined with the app secret. The server persists only the ciphertext plus a
|
|
* hash of the cookie secret, so a stolen session file cannot be turned back into
|
|
* passwords without also holding the users' cookies.
|
|
*/
|
|
export function deriveKey(cookieSecret: string, appSecret: string, salt: Buffer): Buffer {
|
|
const ikm = Buffer.from(`${cookieSecret} |