* feat: 支持自托管的 remote-control-server (#214) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
13 lines
372 B
TypeScript
13 lines
372 B
TypeScript
import { createHash } from "node:crypto";
|
|
import { config } from "../config";
|
|
|
|
/** Validate a raw API key token string */
|
|
export function validateApiKey(token: string | undefined): boolean {
|
|
if (!token) return false;
|
|
return config.apiKeys.includes(token);
|
|
}
|
|
|
|
export function hashApiKey(key: string): string {
|
|
return createHash("sha256").update(key).digest("hex");
|
|
}
|