// Secret entry is only allowed on a real HTTPS origin or loopback. Plain LAN // HTTP must not receive a key that would then cross the network in the clear. export function secretEntryAllowed(location: { protocol: string; hostname: string }): boolean { return location.protocol === 'https:' || ['localhost', '127.0.0.1', '[::1]', '::1'].includes(location.hostname) } // True when a key typed here would cross a network in the clear, even though // the server presently allows it. Drives the warning only, never the gate: // the gate is the server-reported capability. export function plaintextRemoteConsole(location: { protocol: string; hostname: string }): boolean { return !secretEntryAllowed(location) }