auth

package
v2.0.0-...-0cf2a4b Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound      = errors.New("user not found")
	ErrIncorrectPassword = errors.New("password does not match stored hash")
)

Functions

This section is empty.

Types

type AuthStore

type AuthStore interface {
	ReadPasswordHash(username string) (PasswordHash, error)
}

type Authenticator

type Authenticator struct {
	// contains filtered or unexported fields
}

func New

func New(store AuthStore) Authenticator

func (Authenticator) Authenticate

func (a Authenticator) Authenticate(username, password string) error

type PasswordHash

type PasswordHash interface {
	MatchesPlaintext(string) bool
	Bytes() []byte
}

func HashPassword

func HashPassword(plaintext string) (PasswordHash, error)

Hash a plaintext password into a secure password hash.

func PasswordHashFromBytes

func PasswordHashFromBytes(bytes []byte) PasswordHash

Converts raw bytes into a password hash. Note that this doesn't perform a hash on the bytes. The bytes represent an already-hashed password.

Jump to

Keyboard shortcuts

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