Documentation
¶
Overview ¶
Package auth provides utilities to authenticate users, using modern hashing algorithms.
Index ¶
Constants ¶
View Source
const (
Argon2 = iota
)
Variables ¶
View Source
var (
ErrUnknownAlgorithm = errors.New("Unknown authentication algorithm.")
)
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator interface { Compare(hash, plaintext string) error Hash(plaintext string) (string, error) }
Authenticator is the interface that wraps password authentication utilities.
Compare performs a constant time comparison of the given plaintext and hash using the authenticators underlying key derivation function. It returns nil if and only if password is the hash's plaintext equivalent.
Hash hashes the given plaintext using the authenticator's underlying key derivation function.
func NewAuthenticator ¶
func NewAuthenticator(a Algorithm) (Authenticator, error)
Click to show internal directories.
Click to hide internal directories.