summaryrefslogtreecommitdiffstats
path: root/back/auth/auth.go
diff options
context:
space:
mode:
Diffstat (limited to 'back/auth/auth.go')
-rw-r--r--back/auth/auth.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/back/auth/auth.go b/back/auth/auth.go
new file mode 100644
index 0000000..5685001
--- /dev/null
+++ b/back/auth/auth.go
@@ -0,0 +1,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
+}