local-auth-gate.mjs
26 lines 841 B
Raw
sha256:e4c529f14a0bb908c1caaaeb3f95f3623a1a82e636e7e3722ca2cd3dc9821263 security: npm audit fix pre-bridge 2026-07-29 Human 39 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 3 commits
sha256:e4c529f14a0bb908c1caaaeb3f95f3623a1a82e636e7e3722ca2cd3dc9821263 security: npm audit fix pre-bridge 2026-07-29 Human 39 days ago
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf mirror: GitHub Phase A durable MCP OAuth (#270) Human minor 56 days ago
sha256:873e30b7fafe601346295f8f4289f388f21d8f715f28584d5481899ba2b714fc Merge pull request #249 from aaronrene/muse-mirror Agent 73 days ago