Documentation
¶
Overview ¶
Package local provides password hashing and verification for application-owned user stores.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashPassword ¶
HashPassword hashes a password with bcrypt, using its default work factor. Applications must enforce their own password and account policies before calling it.
func VerifyPassword ¶
VerifyPassword compares a supplied password with a stored bcrypt hash.
Types ¶
type CredentialStore ¶
type CredentialStore[User any] interface { // LookupCredential fetches a user's current bcrypt password hash. LookupCredential(context.Context, string) (User, string, error) }
CredentialStore loads an application-owned user and a bcrypt password hash. Unknown or disabled accounts must return auth.ErrInvalidCredentials.
type Service ¶
type Service[User any] struct { // Credentials provides application-owned user lookup and account policy. Credentials CredentialStore[User] // Sessions provides durable, revocable session persistence. Sessions session.Manager[User] }
Service verifies local passwords and issues hashed server-side sessions.
Click to show internal directories.
Click to hide internal directories.