mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
refactor(auth): share api key masking utility
This commit is contained in:
@@ -12,20 +12,10 @@ import {
|
||||
import { findNormalizedProviderValue, normalizeProviderId } from "../../agents/model-selection.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { shortenHomePath } from "../../utils.js";
|
||||
import { maskApiKey } from "../../utils/mask-api-key.js";
|
||||
|
||||
export type ModelAuthDetailMode = "compact" | "verbose";
|
||||
|
||||
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)}`;
|
||||
};
|
||||
|
||||
export const resolveAuthLabel = async (
|
||||
provider: string,
|
||||
cfg: OpenClawConfig,
|
||||
|
||||
Reference in New Issue
Block a user