auth

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleAdmin  = "admin"
	RoleViewer = "viewer"

	MethodPassword = "password"
)

Variables

View Source
var DefaultPasswordParams = &argon2id.Params{
	Memory:      19 * 1024,
	Iterations:  2,
	Parallelism: 1,
	SaltLength:  16,
	KeyLength:   32,
}
View Source
var ErrInvalidCredentials = errors.New("invalid credentials")

Functions

func ComparePassword

func ComparePassword(password, hash string) (bool, error)

func HashPassword

func HashPassword(password string) (string, error)

func NormalizeEmail

func NormalizeEmail(email string) string

Types

type Principal

type Principal struct {
	UserID int64
	Email  string
	Role   string // "admin" or "viewer"
	Method string // "password" now; "oidc" later
}

func (Principal) IsAdmin

func (p Principal) IsAdmin() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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