Documentation
¶
Index ¶
- Constants
- Variables
- func HashPassword(password string) (string, error)
- func VerifyPassword(password, encodedHash string) (bool, error)
- type Argon2Params
- type Service
- func (s *Service) ChangePassword(ctx context.Context, oldPassword, newPassword string) error
- func (s *Service) CreateAPIKey(ctx context.Context, name string) (string, *models.APIKey, error)
- func (s *Service) DeleteAPIKey(ctx context.Context, id int) error
- func (s *Service) IsSetupComplete(ctx context.Context) (bool, error)
- func (s *Service) ListAPIKeys(ctx context.Context) ([]*models.APIKey, error)
- func (s *Service) Login(ctx context.Context, username, password string) (*models.User, error)
- func (s *Service) SetupUser(ctx context.Context, username, password string) (*models.User, error)
- func (s *Service) ValidateAPIKey(ctx context.Context, key string) (*models.APIKey, error)
Constants ¶
View Source
const (
SessionName = "qui_user_session"
)
Variables ¶
View Source
var ( ErrInvalidCredentials = errors.New("invalid username or password") ErrNotSetup = errors.New("initial setup required") )
Functions ¶
func HashPassword ¶
HashPassword generates an Argon2id hash of the password
func VerifyPassword ¶
VerifyPassword verifies a password against an Argon2id hash
Types ¶
type Argon2Params ¶
type Argon2Params struct {
Memory uint32
Iterations uint32
Parallelism uint8
SaltLength uint32
KeyLength uint32
}
Argon2 parameters - these are secure defaults
func DefaultArgon2Params ¶
func DefaultArgon2Params() *Argon2Params
DefaultArgon2Params returns secure default parameters for Argon2id
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(db dbinterface.Querier) *Service
func (*Service) ChangePassword ¶
ChangePassword updates the user's password
func (*Service) CreateAPIKey ¶
CreateAPIKey generates a new API key
func (*Service) DeleteAPIKey ¶
DeleteAPIKey removes an API key
func (*Service) IsSetupComplete ¶
IsSetupComplete checks if initial setup has been completed
func (*Service) ListAPIKeys ¶
ListAPIKeys returns all API keys
Click to show internal directories.
Click to hide internal directories.