UNPKG

@bitkyc08/opencodex

Version:

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM with Codex CLI/App/SDK and Claude Code

20 lines (18 loc) • 1.19 kB
import { ensurePickerCa, type PickerCa } from "./picker-ca"; import { withConfigDirHardeningSettled } from "../../config/paths"; import { drainPendingPickerCaUntrust } from "./picker-ca-cleanup"; import type { PickerCaStore } from "./picker-ca-store"; import type { SecurityRunner } from "./picker-trust"; import { supportsDesktopPicker } from "../desktop-picker-platform"; /** Internal activation seam: finish legacy cleanup before a persistent issuer is usable. */ export async function preparePersistentPickerAuthority(options: { configDir: string; store?: PickerCaStore; security?: SecurityRunner; platform: NodeJS.Platform; }): Promise<PickerCa> { if (!supportsDesktopPicker(options.platform)) throw new Error("picker_ca_unsupported_platform"); const drain = () => drainPendingPickerCaUntrust(options.configDir, options.security, options.platform); if (!await drain()) throw new Error("picker_ca_pending_untrust"); const ca = await withConfigDirHardeningSettled(options.configDir, () => ensurePickerCa(options.configDir, { rotation: "startup", persistent: true, store: options.store })); if (!await drain()) throw new Error("picker_ca_pending_untrust"); return ca; }