auth

package
v0.0.0-...-f6cd9c6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashMD5

func HashMD5(value string) string

HashMD5 hashes a string using MD5 (legacy compatibility) This matches the behavior of HashHelper.GetHash(value, HashHelper.HashType.MD5) in C#

func HashPassword

func HashPassword(password string) string

HashPassword hashes a password (SHA1 for legacy compatibility)

func HashResponse

func HashResponse(response string) string

HashResponse hashes a security question response (SHA1, lowercase)

func HashSHA1

func HashSHA1(value string) string

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

func VerifyPassword(password, hash string) bool

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL