Add session management for user authentication

This commit is contained in:
bronku 2025-03-21 23:13:14 +01:00
parent e235e3d8a8
commit ab662bd4b8
3 changed files with 45 additions and 4 deletions

19
auth/token.go Normal file
View file

@ -0,0 +1,19 @@
package auth
import (
"crypto/rand"
"encoding/base64"
"time"
)
type token struct {
userName string
created time.Time
lastAccess time.Time
}
func generateKey() string {
key := [32]byte{}
rand.Read(key[:])
return base64.StdEncoding.EncodeToString(key[:])
}