/**
 * Mask an API key for UI display.
 *
 * Keep only the last 4 characters to help users confirm which key is active.
 */
export function maskApiKey(v: string | undefined): string {
  const s = String(v ?? '').trim()
  if (!s) return ''
  const tail = s.slice(-4)
  return `***${tail || '****'}`
}
