clientidentity

package
v0.72.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package clientidentity derives the safe, stable identity used for untrusted MCP clientInfo names across persisted presence and session rows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeRaw

func NormalizeRaw(raw string) string

NormalizeRaw is for exact case-insensitive alias classification only. It intentionally preserves controls, so an escape-prefixed client cannot become a supported alias merely because its display label removes the escape.

func SanitizeDisplay

func SanitizeDisplay(raw string) string

SanitizeDisplay keeps rendered names safe and bounded.

Types

type Identity

type Identity struct {
	Key           string
	PublicID      string
	DisplayName   string
	RawNormalized string
}

Identity is a safe key and label derived from one untrusted client name. RawNormalized is retained only during the immediate classification step and must never be returned to an API consumer.

func FromRaw

func FromRaw(raw string) Identity

FromRaw derives a common identity for session names and initialize evidence. Key is versioned and namespace-separated: a printable name cannot reproduce the serialized key of a name changed by sanitization or truncation. PublicID keeps ordinary names readable while reserving a sentinel for transformed names; ordinary names beginning with that sentinel are escaped.

func FromStoredKey

func FromStoredKey(key string) Identity

FromStoredKey reconstructs the safe display label from a persisted key. The key is already an internal safe representation, so its identity stays exact. Legacy unversioned keys remain readable but never use the old hash-suffix heuristic, which could merge a printable name with a transformed one.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL