
- Add JWT token generation and validation utilities - Add password hashing with bcrypt for secure authentication - Add pagination helper for API responses - Add random string generation for tokens and IDs - Add session management utilities - Add admin user initialization functionality
14 lines
214 B
Go
14 lines
214 B
Go
package utils
|
|
|
|
import (
|
|
"math/rand"
|
|
)
|
|
|
|
func GenerateRandomString(length int) string {
|
|
bytes := make([]byte, length)
|
|
for i := 0; i < length; i++ {
|
|
bytes[i] = byte(rand.Intn(26) + 97)
|
|
}
|
|
return string(bytes)
|
|
}
|