feat: add utility functions and helpers
- 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
This commit is contained in:
13
utils/random.go
Normal file
13
utils/random.go
Normal file
@@ -0,0 +1,13 @@
|
||||
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)
|
||||
}
|
Reference in New Issue
Block a user