@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
17 lines • 982 B
JavaScript
import { createHmac } from "node:crypto";
import { join } from "node:path";
import { getAgentDir } from "../../../../config.js";
import { installSalt } from "../../../install-salt.js";
const SALT_FILE = join("anthropic-subscription", "seat-digest-salt");
/**
* An 8-hex digest of an account slot name keyed by a random per-install salt, so logs and
* diagnostics can tell seats apart without naming them, and a guessed slot name ("env", an email
* address) cannot be confirmed without this install's salt (oh-my-openagent#10304).
*/
export function seatDigest(accountName, agentDir = getAgentDir()) {
if (typeof accountName !== "string" || accountName.trim() === "") {
throw new Error("claude_account_unusable: a Claude account slot has no name; run /login anthropic-subscription to add a named account");
}
return createHmac("sha256", installSalt(agentDir, SALT_FILE)).update(accountName).digest("hex").slice(0, 8);
}
//# sourceMappingURL=seat-digest.js.map