@bitkyc08/opencodex
Version:
Universal provider proxy for OpenAI Codex & Claude Code — use any LLM with Codex CLI/App/SDK and Claude Code
22 lines (20 loc) • 717 B
JavaScript
import { createHash } from "node:crypto";
/** Hash only the explicitly bound fields in a fixed order, never a runtime proof key. */
export function createUpdatePlanToken(input) {
const runtime = input.runtime === null ? null : {
pid: input.runtime.pid,
port: input.runtime.port,
hostname: input.runtime.hostname,
command: [...input.runtime.command],
};
const canonical = {
currentVersion: input.currentVersion,
targetVersion: input.targetVersion,
installer: input.installer,
cliRoot: input.cliRoot,
servingRoot: input.servingRoot,
runtimeOwner: input.runtimeOwner,
runtime,
};
return createHash("sha256").update(JSON.stringify(canonical)).digest("base64url");
}