MCPcopy Index your code
hub / github.com/tbphp/gpt-load / MaskAPIKey

Function MaskAPIKey

internal/utils/string_utils.go:9–15  ·  view source on GitHub ↗

MaskAPIKey masks an API key for safe logging.

(key string)

Source from the content-addressed store, hash-verified

7
8// MaskAPIKey masks an API key for safe logging.
9func MaskAPIKey(key string) string {
10 length := len(key)
11 if length <= 8 {
12 return key
13 }
14 return fmt.Sprintf("%s****%s", key[:4], key[length-4:])
15}
16
17// RedactSecret replaces every occurrence of secret in text with its masked form.
18func RedactSecret(text, secret string) string {

Callers 3

RedactSecretFunction · 0.85

Calls

no outgoing calls

Tested by 1