import { createHmac, createHash } from "node:crypto"; export function runEventEnvelopeSignature(secret: string, workspaceId: string, ts: number, payload: string): string { const payloadHash = createHash("sha256").update(payload, "utf8").digest("hex"); const baseString = ["EVENT", `/run-events/${workspaceId}`, ts, payloadHash].join("\n"); // eslint-disable-next-line codemation/no-buffer-everything -- pairing secret is a 32-byte base64 value, never large. const secretBytes = Buffer.from(secret, "base64"); return createHmac("sha256", secretBytes).update(baseString, "utf8").digest("base64"); }