Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashMD5 ¶
HashMD5 hashes a string using MD5 (legacy compatibility) This matches the behavior of HashHelper.GetHash(value, HashHelper.HashType.MD5) in C#
func HashPassword ¶
HashPassword hashes a password (SHA1 for legacy compatibility)
func HashResponse ¶
HashResponse hashes a security question response (SHA1, lowercase)
func HashSHA1 ¶
HashSHA1 hashes a string using SHA1 (legacy compatibility) This matches the behavior of HashHelper.GetHash(value, HashHelper.HashType.SHA1) in C# Note: C# uses UnicodeEncoding (UTF-16) for SHA1, not UTF-8
func VerifyPassword ¶
VerifyPassword verifies a password against a hash
Types ¶
type Session ¶
type Session struct {
ID string
UserID int
User *models.User
MachineID *int
CreatedAt time.Time
ExpiresAt time.Time
}
Session represents a user session
type SessionStore ¶
type SessionStore struct {
// contains filtered or unexported fields
}
SessionStore manages user sessions in memory In production, consider using Redis or database-backed sessions
func NewSessionStore ¶
func NewSessionStore() *SessionStore
NewSessionStore creates a new session store
func (*SessionStore) CreateSession ¶
func (s *SessionStore) CreateSession(user *models.User) (*Session, error)
CreateSession creates a new session for a user
func (*SessionStore) DeleteSession ¶
func (s *SessionStore) DeleteSession(sessionID string)
DeleteSession removes a session
func (*SessionStore) ExtendSession ¶
func (s *SessionStore) ExtendSession(sessionID string) bool
ExtendSession extends the expiration time of a session
func (*SessionStore) GetSession ¶
func (s *SessionStore) GetSession(sessionID string) (*Session, bool)
GetSession retrieves a session by ID