Versions in this module Expand all Collapse all v0 v0.1.1 Nov 12, 2026 v0.1.0 Oct 14, 2026 Changes in this version + const ColHash + const ColHistoryCreatedAt + const ColHistoryHash + const ColHistoryID + const ColHistorySeq + const ColHistoryUserID + const ColUpdatedAt + const ColUserID + const DefaultMaxLength + const DefaultMinLength + const DefaultResetPage + const DefaultResetTTL + const DefaultStuffingPasswordFailures + const DefaultStuffingWindow + const EndpointChange + const EndpointChangeExpired + const EndpointForgot + const EndpointReauthenticate + const EndpointReset + const EndpointResetCode + const EndpointSignIn + const EndpointSignUp + const EndpointVerify + const ForgotStatus + const MaxHistory + const PluginName + const PurposeResetCode + const PurposeResetToken + const TableAliasPassword + const TableAliasPasswordHistory + const TableNamePassword + const TableNamePasswordHistory + const WarnCredentialStuffing + var BetterAuthScrypt = ScryptParams + var DefaultArgon2 = Argon2Params + var ErrBadArgon2 = errors.New("password: Argon2 needs Time and Threads of at least 1") + var ErrBadLengths = errors.New(...) + var ErrBreached = auth.NewError("password.breached", http.StatusBadRequest, ...) + var ErrExpireRange = errors.New("password: ExpireAfter takes a positive duration") + var ErrExpired = auth.NewError("password.expired", http.StatusForbidden, ...) + var ErrHasPassword = auth.NewError("password.has_password", http.StatusConflict, ...) + var ErrHashUnrecognized = auth.NewError("password.hash_unrecognized", http.StatusBadRequest, ...) + var ErrHistoryRange = fmt.Errorf("password: History takes 1 to %d passwords", MaxHistory) + var ErrInvalidCredentials = auth.NewError("password.invalid_credentials", http.StatusUnauthorized, ...) + var ErrNoLoginKind = errors.New(...) + var ErrNoRecovery = errors.New(...) + var ErrNoResetLinks = errors.New("password: reset links need auth.WithBaseURL or password.ResetLinks") + var ErrNoUsernames = auth.NewError("password.no_usernames", http.StatusBadRequest, "Usernames are not available.") + var ErrNotExpired = auth.NewError("password.not_expired", http.StatusBadRequest, ...) + var ErrRedirectInvalid = auth.NewError("password.redirect_invalid", http.StatusBadRequest, ...) + var ErrReused = auth.NewError("password.reused", http.StatusBadRequest, ...) + var ErrTooLong = auth.NewError("password.too_long", http.StatusBadRequest, "Choose a shorter password.") + var ErrTooShort = auth.NewError("password.too_short", http.StatusBadRequest, "Choose a longer password.") + var ErrWeak = auth.NewError("password.weak", http.StatusBadRequest, "Choose a stronger password.") + var Hash = sqlb.Col[string](TablePassword, ColHash) + var HistoryCreatedAt = sqlb.Col[time.Time](TablePasswordHistory, ColHistoryCreatedAt) + var HistoryHash = sqlb.Col[string](TablePasswordHistory, ColHistoryHash) + var HistoryID = sqlb.Col[string](TablePasswordHistory, ColHistoryID) + var HistorySeq = sqlb.Col[int64](TablePasswordHistory, ColHistorySeq) + var HistoryUserID = sqlb.Col[string](TablePasswordHistory, ColHistoryUserID) + var TablePassword = sqlb.Table + var TablePasswordHistory = sqlb.Table + var UpdatedAt = sqlb.Col[time.Time](TablePassword, ColUpdatedAt) + var UserID = sqlb.Col[string](TablePassword, ColUserID) + type Argon2Params struct + Memory uint32 + Threads uint8 + Time uint32 + type Argon2id struct + Params Argon2Params + func (h Argon2id) Hash(pw Secret) (string, error) + func (h Argon2id) NeedsRehash(encoded string) bool + func (h Argon2id) Recognizes(encoded string) bool + func (h Argon2id) Verify(pw Secret, encoded string) (bool, error) + type BreachChecker interface + Breached func(ctx context.Context, password string) (bool, error) + type BreachMessenger interface + BreachedMessage func() string + type ChangeExpiredRequest struct + Current Secret + Identifier string + New Secret + Remember *bool + func (r ChangeExpiredRequest) RateIdentifier() string + type ChangeRequest struct + Current Secret + New Secret + RevokeOtherSessions *bool + type ForgotRequest struct + Identifier string + RedirectTo string + func (r ForgotRequest) RateIdentifier() string + type ForgotResult struct + Status string + type Hasher interface + Hash func(pw Secret) (string, error) + type Option func(*Plugin) + func AcceptLegacyHashes(v ...Verifier) Option + func Argon2(params Argon2Params) Option + func CheckBreached(c BreachChecker) Option + func ExpireAfter(d time.Duration) Option + func GuardCredentialStuffing(pol StuffingPolicy) Option + func History(n int) Option + func KeepSessionsOnChange() Option + func KeepSessionsOnReset() Option + func MaxLength(n int) Option + func MinLength(n int) Option + func Policy(fn func(pw string) error) Option + func RequireClasses(n int) Option + func ResetByCode() Option + func ResetLinks(fn func(t auth.Token) string) Option + func ResetTTL(d time.Duration) Option + func SignUpWithoutSession() Option + func WithHasher(h Hasher) Option + func WithoutRecovery() Option + func WithoutSignUp() Option + type Plugin struct + func New(opts ...Option) *Plugin + func (p *Plugin) Change(ctx context.Context, in ChangeRequest) error + func (p *Plugin) ChangeExpired(ctx context.Context, in ChangeExpiredRequest) (SignInResult, error) + func (p *Plugin) Forgot(ctx context.Context, identifier string) (ForgotResult, error) + func (p *Plugin) ForgotWith(ctx context.Context, in ForgotRequest) (ForgotResult, error) + func (p *Plugin) HasPassword(ctx context.Context, userID string) (bool, error) + func (p *Plugin) Hasher() Hasher + func (p *Plugin) ImportHash(ctx context.Context, userID string, hash string) error + func (p *Plugin) Init(a *auth.Auth) error + func (p *Plugin) Name() string + func (p *Plugin) Operations() []auth.Operation + func (p *Plugin) OptionErr() error + func (p *Plugin) RateLimits() []auth.RateRule + func (p *Plugin) Reauthenticate(ctx context.Context, password Secret) (auth.Reauthentication, error) + func (p *Plugin) Reset(ctx context.Context, in ResetRequest) error + func (p *Plugin) ResetWithCode(ctx context.Context, in ResetCodeRequest) error + func (p *Plugin) SetPassword(ctx context.Context, userID string, password Secret) error + func (p *Plugin) SignIn(ctx context.Context, in SignInRequest) (SignInResult, error) + func (p *Plugin) SignUp(ctx context.Context, in SignUpRequest) (SignInResult, error) + func (p *Plugin) SignsIn() bool + func (p *Plugin) Tables() []sqlb.Table + func (p *Plugin) TypedMigrations(engine string, t auth.SQLTypes) ([]auth.Migration, error) + func (p *Plugin) UserTables() []auth.UserTable + func (p *Plugin) Validate(c *auth.Config) error + func (p *Plugin) Verify(ctx context.Context, password Secret) error + type ReauthenticateRequest struct + Password Secret + type Rehasher interface + NeedsRehash func(encoded string) bool + type ResetCodeRequest struct + Code string + Identifier string + Password Secret + func (r ResetCodeRequest) RateIdentifier() string + type ResetRequest struct + Password Secret + Token auth.WireToken + type ScryptParams struct + KeyLen int + N int + P int + R int + type Secret = auth.Token + type SignInRequest struct + Identifier string + Password Secret + Remember *bool + func (r SignInRequest) RateIdentifier() string + type SignInResult struct + SecondFactorRequired bool + Token auth.Token + User auth.UserView + VerificationRequired bool + type SignUpRequest struct + DisplayUsername string + Fields auth.Fields + Identifier string + Image string + Name string + Password Secret + Remember *bool + Username string + func (r *SignUpRequest) UnmarshalJSON(data []byte) error + func (r SignUpRequest) RateIdentifier() string + type StuffingPolicy struct + GlobalFailures int + LogOnly bool + PasswordFailures int + Window time.Duration + type UsernameClaimer interface + ClaimWithDisplay func(ctx context.Context, userID, handle, display string) error + type Verifier interface + Recognizes func(encoded string) bool + Verify func(pw Secret, encoded string) (bool, error) + func Bcrypt() Verifier + func DjangoPBKDF2() Verifier + func Scrypt(params ScryptParams) Verifier + type VerifyRequest struct + Password Secret