openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 868 B
JavaScript
import{o as hasConfiguredSecretInput}from"./types.secrets-UWdyCdE6.mjs";
//!src/gateway/auth-mode-policy.ts
const EXPLICIT_GATEWAY_AUTH_MODE_REQUIRED_ERROR=`Invalid config: gateway.auth.token and gateway.auth.password are both configured, but gateway.auth.mode is unset. Set gateway.auth.mode to token or password.`;function hasAmbiguousGatewayAuthModeConfig(e){const t=e.gateway?.auth;if(!t)return false;if(typeof t.mode===`string`&&t.mode.trim().length>0)return false;const n=e.secrets?.defaults;const r=hasConfiguredSecretInput(t.token,n);const i=hasConfiguredSecretInput(t.password,n);return r&&i}function assertExplicitGatewayAuthModeWhenBothConfigured(e){if(!hasAmbiguousGatewayAuthModeConfig(e))return;throw new Error(EXPLICIT_GATEWAY_AUTH_MODE_REQUIRED_ERROR)}export{hasAmbiguousGatewayAuthModeConfig as n,assertExplicitGatewayAuthModeWhenBothConfigured as t};