authentication

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

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