@tanstack/ai
Version:
Type-safe TypeScript AI SDK for streaming chat, tool calling, agents, structured outputs, and multimodal generation.
17 lines (15 loc) • 365 B
text/typescript
export function maskKey(key: string): string {
if (key.length <= 4) return '••'
return key.slice(-4)
}
export function scrubSecrets(
input: string,
secrets: ReadonlyArray<string>,
): string {
let next = input
for (const secret of secrets) {
if (secret.length === 0) continue
next = next.split(secret).join('[redacted]')
}
return next
}