local-auth-gate.mjs
sha256:c2dbf04d56308f3bbf2d06e6d2eb022b8948b1e827195fe525a44e5e18d5f9c0
feat(auth): Phase B Connect cloud agent (RFC 8628) + Hermes…
Human
minor
⚠ breaking
11 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
1 commit
sha256:93bcf8f9bd56d8c5b9339f4ec73b9ebd66571398d56262d38eedc2cfa9db9882
fix(test): align Band B landing assertion with desktop MCP …
Human
11 days ago