/** * Sovereign Node Key — SnapKitty execution gate. * Called before any model routing request fires. * * Get your key: licensing@snapkittywest.dev * Copyright (C) 2026 Bel Esprit D'Accord Irrevocable Trust (EIN 42-697643) */ const KEY_PREFIX = 'SNK-' const KEY_STORAGE = 'snapkitty_node_key' const KEY_ENV = import.meta.env?.VITE_SNAPKITTY_NODE_KEY export const SOVEREIGN_WALL = ` ╔══════════════════════════════════════════════════╗ ║ SOVEREIGN NODE KEY REQUIRED ║ ║ ║ ║ BOB IDE requires a valid SnapKitty node key ║ ║ to activate model routing. ║ ║ ║ ║ Get your key: ║ ║ licensing@snapkittywest.dev ║ ║ https://github.com/SNAPKITTYWEST ║ ╚══════════════════════════════════════════════════╝ ` export function getNodeKey(): string { return KEY_ENV || localStorage.getItem(KEY_STORAGE) || '' } export function setNodeKey(key: string): void { localStorage.setItem(KEY_STORAGE, key) } export function hasNodeKey(): boolean { const key = getNodeKey() return key.startsWith(KEY_PREFIX) && key.length > 10 } export function requireNodeKey(): void { if (!hasNodeKey()) { throw new Error(SOVEREIGN_WALL) } } /** Attach node key to fetch headers for model routing requests */ export function nodeKeyHeaders(): HeadersInit { const key = getNodeKey() if (!key) return {} return { 'X-Sovereign-Node-Key': key } }