local-auth-gate.mjs
26 lines 841 B
Raw
sha256:87f84653ce4706be8c65b0c4494ed6fb891213cca82db2b1824772cddc41a752 feat(auth): durable MCP OAuth refresh via shared strong sto… Agent minor 62 days ago
1 /**
2 * Phase 8 P1b-b — env gate for offline-locked auth (read once at boot, §2.2).
3 */
4
5 import { isOfflineLockedAuthActive } from './local-auth-feature-flag.mjs';
6
7 /**
8 * Read KNOWTATION_OFFLINE_LOCKED_AUTH at boot. Only `enabled` turns the gate on.
9 * @returns {boolean}
10 */
11 export function readOfflineLockedAuthEnvGate() {
12 const raw = process.env.KNOWTATION_OFFLINE_LOCKED_AUTH;
13 return typeof raw === 'string' && raw.trim().toLowerCase() === 'enabled';
14 }
15
16 /**
17 * Cached boot snapshot: env gate + compile-time shipped flag.
18 * @param {boolean} [envGate] - optional pre-read env gate
19 * @returns {{ envGateEnabled: boolean, active: boolean }}
20 */
21 export function resolveOfflineLockedAuthPosture(envGate = readOfflineLockedAuthEnvGate()) {
22 return {
23 envGateEnabled: envGate,
24 active: isOfflineLockedAuthActive(envGate),
25 };
26 }
File History 2 commits
sha256:87f84653ce4706be8c65b0c4494ed6fb891213cca82db2b1824772cddc41a752 feat(auth): durable MCP OAuth refresh via shared strong sto… Agent minor 62 days ago
sha256:873e30b7fafe601346295f8f4289f388f21d8f715f28584d5481899ba2b714fc Merge pull request #249 from aaronrene/muse-mirror Agent 79 days ago