totp

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: 4 Imported by: 0

Documentation

Overview

Package totp provides a TOTP (RFC 6238) second-factor verifier. It is intentionally decoupled from authentication.Authenticator so that password verification and second-factor verification can evolve independently.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidCode indicates the provided TOTP code did not validate against the secret.
	ErrInvalidCode = platformerrors.New("invalid TOTP code")
	// ErrCodeRequired indicates TOTP is enabled but no code was provided.
	ErrCodeRequired = platformerrors.New("TOTP code required but not provided")
)

Functions

This section is empty.

Types

type Verifier

type Verifier interface {
	// Verify returns nil if code is valid for secret. It returns ErrCodeRequired
	// if code is empty, and ErrInvalidCode if the code does not validate.
	Verify(ctx context.Context, secret, code string) error
}

Verifier verifies a TOTP code against a shared secret.

func NewVerifier

func NewVerifier(tracerProvider tracing.TracerProvider) Verifier

NewVerifier returns a Verifier backed by github.com/pquerna/otp.

Directories

Path Synopsis
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