From 79f55b0b233258623062db3c916783b4d14bf14a Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Sat, 7 Mar 2026 18:33:37 -0500 Subject: authfs: implement p9p.Session --- back/auth/auth.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 back/auth/auth.go (limited to 'back/auth/auth.go') 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 +} -- cgit v1.2.3