authentication

package
v10.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 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
Package argon2 is the argon2id authentication.Authenticator: the password hasher this module recommends, and the only implementation of that interface it ships.
Package argon2 is the argon2id authentication.Authenticator: the password hasher this module recommends, and the only implementation of that interface it ships.
Package oauth2server is an OAuth 2.1 authorization server: the endpoints, the grant logic, and a Store seam underneath them.
Package oauth2server is an OAuth 2.1 authorization server: the endpoints, the grant logic, and a Store seam underneath them.
config
Package oauth2servercfg assembles an OAuth 2.1 authorization server, and the Store behind it, from environment configuration.
Package oauth2servercfg assembles an OAuth 2.1 authorization server, and the Store behind it, from environment configuration.
database
Package database keeps an authorization server's state in SQL tables.
Package database keeps an authorization server's state in SQL tables.
database/migrations
Package migrations supplies the authorization server's DDL, rendered for a dialect and table prefix.
Package migrations supplies the authorization server's DDL, rendered for a dialect and table prefix.
memory
Package memory keeps an authorization server's state in maps.
Package memory keeps an authorization server's state in maps.
oauth2servertest
Package oauth2servertest holds the behavior every oauth2server.Store owes its callers, written once and run against each implementation.
Package oauth2servertest holds the behavior every oauth2server.Store owes its callers, written once and run against each implementation.
Package tokens is the seam for bearer tokens: an Issuer mints them and parses them back, and the jwt and paseto subpackages implement it.
Package tokens is the seam for bearer tokens: an Issuer mints them and parses them back, and the jwt and paseto subpackages implement it.
config
Package tokenscfg selects and builds a tokens.Issuer from configuration: either the JWT signer or the PASETO one.
Package tokenscfg selects and builds a tokens.Issuer from configuration: either the JWT signer or the PASETO one.
jwt
Package jwt is the HS256 tokens.Issuer: JSON Web Tokens signed with a shared secret.
Package jwt is the HS256 tokens.Issuer: JSON Web Tokens signed with a shared secret.
mock
Package tokensmock provides moq-generated mock implementations of interfaces in the tokens package.
Package tokensmock provides moq-generated mock implementations of interfaces in the tokens package.
paseto
Package paseto is the PASETO v2.local tokens.Issuer: tokens whose claims are encrypted rather than merely signed.
Package paseto is the PASETO v2.local tokens.Issuer: tokens whose claims are encrypted rather than merely signed.
Package totp provides a TOTP (RFC 6238) second-factor verifier.
Package totp provides a TOTP (RFC 6238) second-factor verifier.
mock
Package totpmock provides moq-generated mock implementations of interfaces in the totp package.
Package totpmock provides moq-generated mock implementations of interfaces in the totp package.
Package webauthn provides passkey registration and login over github.com/go-webauthn/webauthn, and the ceremony store that makes it work on more than one replica.
Package webauthn provides passkey registration and login over github.com/go-webauthn/webauthn, and the ceremony store that makes it work on more than one replica.
cache
Package cache stores WebAuthn ceremony state in a cache.Cache.
Package cache stores WebAuthn ceremony state in a cache.Cache.
config
Package webauthncfg assembles a WebAuthn relying party, and the ceremony store under it, from environment configuration.
Package webauthncfg assembles a WebAuthn relying party, and the ceremony store under it, from environment configuration.
database
Package database stores WebAuthn ceremony state in a SQL table.
Package database stores WebAuthn ceremony state in a SQL table.
database/migrations
Package migrations supplies the WebAuthn ceremony session table's DDL, rendered for a dialect and table prefix.
Package migrations supplies the WebAuthn ceremony session table's DDL, rendered for a dialect and table prefix.
mock
Package webauthnmock provides moq-generated mock implementations of interfaces in the webauthn package.
Package webauthnmock provides moq-generated mock implementations of interfaces in the webauthn package.
webauthntest
Package webauthntest holds the behavior every webauthn.SessionStore owes its callers, written once and run against each implementation.
Package webauthntest holds the behavior every webauthn.SessionStore owes its callers, written once and run against each implementation.

Jump to

Keyboard shortcuts

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