blob: 568500197109a4244c533116dbee19eb778c7fa4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
package auth
import "fmt"
const (
// Maximum number of bytes in a Username.
MaxUsernameSize = 64
)
type Username string
func ValidiateUsername(s string) (Username, error) {
if len(s) > MaxUsernameSize {
return "", fmt.Errorf("username longer than %d bytes: %q", MaxUsernameSize, s)
}
return Username(s), nil
}
|