MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / maskAPIKey

Function maskAPIKey

internal/server/handlers_admin.go:93–101  ·  view source on GitHub ↗

maskAPIKey returns the display form of a sensitive setting value. Keys longer than 8 chars show their first and last 4 chars (abcd...wxyz); shorter non-empty keys collapse to "****". Empty stays empty. This is the single source of truth for the mask format — handleGetPlatformSettings emits it and ha

(key string)

Source from the content-addressed store, hash-verified

91// for the mask format — handleGetPlatformSettings emits it and
92// handleUpdatePlatformSettings uses it to detect an unchanged (echoed-back) key.
93func maskAPIKey(key string) string {
94 if len(key) > 8 {
95 return key[:4] + "..." + key[len(key)-4:]
96 }
97 if key != "" {
98 return "****"
99 }
100 return ""
101}
102
103// handleUpdatePlatformSettings updates one or more platform settings.
104// Admin-only. Accepts a JSON object of key-value pairs.

Calls

no outgoing calls