Documentation
¶
Overview ¶
Package identity normalizes and validates user-facing identifiers and names (emails, usernames, org, team, project and token names) so lookalike or invisible-character input cannot forge or duplicate an identity.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( MaxNameRunes = 100 MaxNameBytes = 400 MaxEmailBytes = 254 )
Default caps, exported vars so a deployment can tune them at boot.
var ErrInvalid = errors.New("invalid text")
ErrInvalid wraps every validation failure.
Functions ¶
func Normalize ¶
Normalize returns s in NFKC with surrounding space trimmed, so composed, decomposed and compatibility forms of one string compare equal.
func NormalizeEmail ¶
NormalizeEmail is the canonical form used to store and look up an email or username: NFKC, trimmed, lowercased.
func Sanitize ¶
Sanitize replaces characters that could spoof or break a log or audit view with U+FFFD, for values that are shown but cannot be rejected.
func ValidateEmail ¶
ValidateEmail normalizes s and rejects control, format, space and over-long input. A value without "@" passes, legacy bare usernames exist.
func ValidateName ¶
ValidateName normalizes a display name to NFC and rejects control, bidi, zero-width and invisible-filler characters and over-long input. ZWNJ and ZWJ stay allowed: scripts such as Persian need them.
Types ¶
This section is empty.