UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

19 lines (18 loc) • 748 B
//#region src/utils/normalize-secret-input.ts /** * Normalizes a raw secret value from config, env, setup prompts, or plugin SDK callers. * Returns an empty string for absent/invalid input so callers can keep boolean presence checks simple. */ function normalizeSecretInput(e) { if (typeof e !== "string") return ""; return e.replace(/[^\u0020-\u007e\u00a0-\u00ff]/gu, "").trim(); } /** * Normalizes a raw secret value and converts empty normalized output to `undefined`. * Use this at optional config boundaries where "not configured" is clearer than an empty string. */ function normalizeOptionalSecretInput(e) { return normalizeSecretInput(e) || void 0; } //#endregion export { normalizeSecretInput as n, normalizeOptionalSecretInput as t };