package atproto import ( "regexp" ) var ( // ref: https://atproto.com/specs/handle handleRegex = regexp.MustCompile(`^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$`) // ref: https://atproto.com/specs/did didRegex = regexp.MustCompile(`^did:[a-z]+:[a-zA-Z0-9._:%-]*[a-zA-Z0-9._-]$`) ) func IsHandle(s string) bool { return handleRegex.MatchString(s) } func IsDid(s string) bool { return didRegex.MatchString(s) }