Files
electric-cherry/src/lib/server/fleet/files.ts
T
josh e5c0fda1ed Add native host management and role-based operator authentication
Introduce an outbound Python host agent, Debian installer, durable remote
operations, immutable game-file libraries, host-aware deployments and ports,
and occupancy-safe campaigns and draining. Native hosts do not require Komodo.

Add administrator, operator and viewer accounts, protected management routes,
secure sessions, password recovery, audit history and separate telemetry tokens.
Document first-admin setup, reporter migration and live-host acceptance checks.

Validation: 1,343 TypeScript tests and 39 agent tests passed, along with type
checking, the production build, compiled SSR/API smoke tests and administrator
recovery. Real Debian/Docker T5/T6 acceptance remains unrun.
2026-10-03 11:42:36 -04:00

21 lines
553 B
TypeScript

import { createHash } from 'node:crypto';
import { readFile, stat } from '../backends/files.js';
export async function sha256(path: string): Promise<string> {
const buf = await readFile(path);
return createHash('sha256').update(buf).digest('hex');
}
export async function sha256OrNull(path: string): Promise<string | null> {
try {
await stat(path);
} catch {
return null;
}
return sha256(path);
}
export function sha256Buffer(buf: Buffer): string {
return createHash('sha256').update(buf).digest('hex');
}