Documentation
¶
Index ¶
- Constants
- Variables
- func BuildToken(lookup, secret string) string
- func GenerateTokenSecret(length int) (string, error)
- func HashToken(token string) (string, error)
- func IsValidNameChar(r rune, isFirst bool) bool
- func ParseToken(token string) (lookup, secret string, err error)
- func ValidateName(name string) error
- func ValidateNameInput(runes []rune, currentText string) bool
- func VerifyToken(token, encodedHash string) error
Constants ¶
const ( MaxNameLength = 128 MinNameLength = 1 )
Name validation constraints
Variables ¶
Functions ¶
func BuildToken ¶
BuildToken constructs a token string from its components. Format: eph_<lookup>_<secret>
func GenerateTokenSecret ¶
GenerateTokenSecret generates a cryptographically secure random hex string.
func HashToken ¶
HashToken creates an argon2id hash of the token with a random salt. Returns the hash in PHC string format: $argon2id$v=19$m=65536,t=1,p=4$<salt>$<hash>
func IsValidNameChar ¶
IsValidNameChar returns true if the rune is valid in a name. For the first character, only ASCII letters and digits are allowed. For subsequent characters, dots, underscores, and hyphens are also allowed.
func ParseToken ¶
ParseToken extracts components from a token string. Returns lookup key and secret.
func ValidateName ¶ added in v0.0.5
ValidateName validates a namespace or repository name.
func ValidateNameInput ¶
ValidateNameInput validates a sequence of runes being added to an existing name. Returns true if all runes are valid for their position in the resulting string.
func VerifyToken ¶
VerifyToken checks if a token matches an argon2id hash. Returns nil if the token matches, ErrHashMismatch if it doesn't.
Types ¶
This section is empty.