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:
Björn Benouarets
2025-09-25 23:24:18 +02:00
parent 9a8a93061d
commit f509f6e524
6 changed files with 297 additions and 0 deletions

13
utils/random.go Normal file
View 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)
}