ax(node): replace prose comment with usage example on safeKeyPrefix

AX Principle 2: comments show HOW with real values, not WHAT the signature says.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 07:42:21 +01:00
parent c85217dfca
commit a4c4d64a98
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -56,7 +56,8 @@ const (
// peerNameRegex validates peer names: alphanumeric, hyphens, underscores, and spaces
var peerNameRegex = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9\-_ ]{0,62}[a-zA-Z0-9]$|^[a-zA-Z0-9]$`)
// safeKeyPrefix returns a truncated key for logging, handling short keys safely
// safeKeyPrefix("abc123def456xyz789") // "abc123def456xyz7..."
// safeKeyPrefix("") // "(empty)"
func safeKeyPrefix(key string) string {
if len(key) >= 16 {
return key[:16] + "..."