mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 15:44:31 +00:00
refactor(auth): share api key masking utility
This commit is contained in:
10
src/utils/mask-api-key.ts
Normal file
10
src/utils/mask-api-key.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export const maskApiKey = (value: string): string => {
|
||||
const trimmed = value.trim();
|
||||
if (!trimmed) {
|
||||
return "missing";
|
||||
}
|
||||
if (trimmed.length <= 16) {
|
||||
return trimmed;
|
||||
}
|
||||
return `${trimmed.slice(0, 8)}...${trimmed.slice(-8)}`;
|
||||
};
|
||||
Reference in New Issue
Block a user