openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
11 lines (10 loc) • 398 B
JavaScript
//#region src/utils/mask-api-key.ts
const maskApiKey = (value) => {
const trimmed = value.trim();
if (!trimmed) return "missing";
if (trimmed.length <= 6) return `${trimmed.slice(0, 1)}...${trimmed.slice(-1)}`;
if (trimmed.length <= 16) return `${trimmed.slice(0, 2)}...${trimmed.slice(-2)}`;
return `${trimmed.slice(0, 8)}...${trimmed.slice(-8)}`;
};
//#endregion
export { maskApiKey as t };