package auth import ( "crypto/rand" ) const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" func randStringBytes(n int) string { buf := make([]byte, n) _, err := rand.Read(buf) if err != nil { panic(err) } for k, v := range buf { buf[k] = letterBytes[v%byte(len(letterBytes))] } return string(buf) }