Versions in this module Expand all Collapse all v0 v0.5.0 Nov 24, 2026 Changes in this version + const DefaultSessionTTL + const RequiredEverywhere + const RequiredNone + const RequiredOutside + var ErrWrongPassword = errors.New("the current password is wrong") + var PasswordIterations = 600_000 + func CheckPassword(hash, password string) bool + func HashPassword(password string) (string, error) + func ListFromEnv(name string) []string + func LoadOrCreateKey(path string) (key string, created bool, err error) + func ParseNetworks(list []string) ([]netip.Prefix, error) + func ViaAPIKey(ctx context.Context) bool + type Auth struct + func New(opts Options, settings Settings) *Auth + func Open(opts Options, dir string, seed Settings) (*Auth, error) + func (a *Auth) CallerAddress(ctx context.Context) (addr string, local bool) + func (a *Auth) ConfirmPassword(ctx context.Context, password string) error + func (a *Auth) CookieName() string + func (a *Auth) LoginHandler() http.HandlerFunc + func (a *Auth) LogoutHandler() http.HandlerFunc + func (a *Auth) Middleware(next http.Handler) http.Handler + func (a *Auth) SetAllowedHosts(hosts []string) + func (a *Auth) SetSettings(s Settings) error + func (a *Auth) Settings() Settings + func (a *Auth) StatusHandler() http.HandlerFunc + func (a *Auth) WouldLockOut(ctx context.Context, next Settings) bool + type ErrTooManyAttempts struct + Wait time.Duration + func (e ErrTooManyAttempts) Error() string + type FileStore struct + Path string + func (f FileStore) Load() (s Settings, found bool, err error) + func (f FileStore) Save(s Settings) error + type Method int + const MethodAPIKey + const MethodLocal + const MethodNone + const MethodSession + func (m Method) String() string + type Options struct + APIKey string + AllowedHosts []string + App string + CookieName string + LocalNetworks []string + Store Store + type Settings struct + LocalNetworks []string + PasswordHash string + Required string + Username string + func (s Settings) CredentialsConfigured() bool + func (s Settings) Mode() string + type Store interface + Save func(Settings) error