13 lines
228 B
Go
13 lines
228 B
Go
package utils
|
|
|
|
import "fmt"
|
|
|
|
// MaskAPIKey masks an API key for safe logging.
|
|
func MaskAPIKey(key string) string {
|
|
length := len(key)
|
|
if length <= 8 {
|
|
return key
|
|
}
|
|
return fmt.Sprintf("%s****%s", key[:4], key[length-4:])
|
|
}
|