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)
| 91 | // for the mask format — handleGetPlatformSettings emits it and |
| 92 | // handleUpdatePlatformSettings uses it to detect an unchanged (echoed-back) key. |
| 93 | func 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. |
no outgoing calls