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.
Click to show internal directories.
Click to hide internal directories.