Files
9router/open-sse/shared/machineId.js
decolua 87fe069e9e refactor(open-sse): remove reverse coupling open-sse -> src (E2)
Move clineAuth into open-sse/shared (src re-exports back). Add standalone
open-sse/shared/machineId for codex session hashing (no @/lib/dataDir).
sttCore receives sttConfig via param instead of importing AI_PROVIDERS.
No behavior change; gate: no regression (26 known-fails unchanged).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-13 16:35:07 +07:00

20 lines
506 B
JavaScript

import { machineIdSync } from "node-machine-id";
import crypto from "node:crypto";
let cachedRawId = null;
function loadRawMachineId() {
if (cachedRawId) return cachedRawId;
try {
cachedRawId = machineIdSync();
} catch {
cachedRawId = crypto.randomUUID();
}
return cachedRawId;
}
export async function getConsistentMachineId(salt = "endpoint-proxy-salt") {
const rawId = loadRawMachineId();
return crypto.createHash("sha256").update(rawId + salt).digest("hex").substring(0, 16);
}