10 lines
548 B
TypeScript
10 lines
548 B
TypeScript
import { createHmac, randomBytes } from "node:crypto"
|
|
|
|
// An owned ingest batch never crosses a process boundary. Its proof stays with
|
|
// that batch through unknown-COMMIT reconciliation. No MCP state, filesystem,
|
|
// database, classifier initialization or network is needed to identify it.
|
|
const processKey = randomBytes(32)
|
|
export function flowBatchProof(payload: unknown, domain: "ingest" | "facts"): string {
|
|
return createHmac("sha256", processKey).update("flow-owned-batch-v1:" + domain + ":").update(JSON.stringify(payload)).digest("hex")
|
|
}
|