Groundwork for securing the web front end (vrek gol-wqf95dq). The app does not enforce login yet. - src/lib/admin-file.ts: the admin file at ADMIN_AUTH_FILE (default .data/admin.json). scrypt hashing (N=2^16, random salt, bounded parameters, constant-time compare), zod-validated reads where a malformed file is an error, and atomic 0600 writes that won't replace an existing admin without overwrite. Plain Node, so the CLI can share it (iss-mffqscg). - src/lib/admin-auth.ts: server-only app layer; failed logins always cost one hash. - scripts/create-admin.mts + `npm run admin:create`: create or reset the admin outside the app, interactive (hidden, confirmed) or piped (iss-7xmka20). The README documents it, a no-npm Node one-liner, the file format, and password reset. - src/lib/session-token.ts and session.ts: stateless HMAC-signed session cookie, keyed from the password hash so a password change ends every session, with a 12 h sliding window (iss-e27nb70, dec-f0xar8r). 281 tests, 99.8% line coverage. Refreshes the vrek export. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
41 lines
1.0 KiB
JSON
41 lines
1.0 KiB
JSON
{
|
|
"name": "cameras",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"scripts": {
|
|
"dev": "next dev",
|
|
"build": "next build",
|
|
"start": "next start",
|
|
"lint": "eslint",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"coverage": "vitest run --coverage",
|
|
"admin:create": "node --disable-warning=MODULE_TYPELESS_PACKAGE_JSON scripts/create-admin.mts"
|
|
},
|
|
"dependencies": {
|
|
"@tanstack/react-query": "^5.103.1",
|
|
"next": "16.3.5",
|
|
"onvif": "^0.8.3",
|
|
"react": "19.2.8",
|
|
"react-dom": "19.2.8",
|
|
"server-only": "^0.0.1",
|
|
"zod": "^4.6.5"
|
|
},
|
|
"devDependencies": {
|
|
"@tailwindcss/postcss": "^4",
|
|
"@testing-library/dom": "^10.4.2",
|
|
"@testing-library/react": "^16.3.3",
|
|
"@types/node": "^24.13.6",
|
|
"@types/react": "^19",
|
|
"@types/react-dom": "^19",
|
|
"@vitejs/plugin-react": "^6.1.1",
|
|
"@vitest/coverage-v8": "^5.0.1",
|
|
"eslint": "^9",
|
|
"eslint-config-next": "16.3.5",
|
|
"jsdom": "^29.1.1",
|
|
"tailwindcss": "^4",
|
|
"typescript": "^5",
|
|
"vitest": "^5.0.1"
|
|
}
|
|
}
|