authentication

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: AGPL-3.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package authentication defines interfaces for password hashing and credential verification. Second-factor verification (TOTP, WebAuthn, etc.) lives in sibling packages (e.g. authentication/totp) so callers can compose whichever factors their application needs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	Hasher

	// PasswordMatches reports whether password matches hash. A non-match
	// returns (false, nil); only genuine errors (malformed hash, runtime
	// failure) populate err.
	PasswordMatches(ctx context.Context, hash, password string) (bool, error)
}

Authenticator hashes passwords and verifies them against a stored hash.

Second-factor verification (TOTP, WebAuthn, backup codes, etc.) is intentionally NOT part of this interface. Callers compose password verification with any second-factor verifier they need — see the authentication/totp package for the TOTP verifier.

type Hasher

type Hasher interface {
	HashPassword(ctx context.Context, password string) (string, error)
}

Hasher hashes passwords.

Directories

Path Synopsis
jwt
mock
Package mock provides moq-generated mock implementations of interfaces in the tokens package.
Package mock provides moq-generated mock implementations of interfaces in the tokens package.
Package totp provides a TOTP (RFC 6238) second-factor verifier.
Package totp provides a TOTP (RFC 6238) second-factor verifier.
mock
Package mock provides moq-generated mock implementations of interfaces in the totp package.
Package mock provides moq-generated mock implementations of interfaces in the totp package.

Jump to

Keyboard shortcuts

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