auth

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 14 Imported by: 1 module, 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 auth defines storage-independent authentication failures.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCredentialNotFound identifies the corresponding authentication-source failure.
	ErrCredentialNotFound = errors.New("credential not found")
	// ErrCredentialStoreLocked identifies the corresponding authentication-source failure.
	ErrCredentialStoreLocked = errors.New("credential store is locked")
	// ErrCredentialStoreUnavailable identifies the corresponding authentication-source failure.
	ErrCredentialStoreUnavailable = errors.New("credential store is unavailable")
	// ErrCredentialAccessDenied identifies the corresponding authentication-source failure.
	ErrCredentialAccessDenied = errors.New("credential access denied")
	// ErrConfigConflict identifies the corresponding authentication-source failure.
	ErrConfigConflict = errors.New("configuration conflict")
	// ErrInvalidRef identifies the corresponding authentication-source failure.
	ErrInvalidRef = errors.New("invalid credential reference")
	// ErrStoreNotFound identifies the corresponding authentication-source failure.
	ErrStoreNotFound = errors.New("credential store not found")

	// ErrProxyCycle identifies a cycle in a resolved jump-host plan.
	ErrProxyCycle = errors.New("proxy jump cycle detected")
)

Functions

func GenerateTOTP added in v0.16.0

func GenerateTOTP(rawSecret string, now time.Time) (string, error)

GenerateTOTP generates a time-based one-time password at the specified time using raw secret.

func GenerateTOTPWithConfig added in v0.16.0

func GenerateTOTPWithConfig(cfg TOTPConfig, now time.Time) (string, error)

GenerateTOTPWithConfig generates a time-based one-time password at the specified time per RFC 6238 / RFC 4226.

func RecoverableRead

func RecoverableRead(err error) bool

RecoverableRead classifies source availability failures for an explicitly interactive caller. Invalid references, conflicts and cancellation never authorize temporary credential input, even when joined to an availability error. This grants no permission to persist a replacement secret.

Types

type TOTPConfig added in v0.16.0

type TOTPConfig struct {
	Secret    []byte
	Algorithm string // "SHA1", "SHA256", "SHA512" (defaults to "SHA1")
	Digits    int    // Number of OTP digits, usually 6, 7, or 8 (defaults to 6)
	Period    int    // Time step in seconds (defaults to 30)
}

TOTPConfig encapsulates parameters for RFC 6238 / RFC 4226 Time-based One-Time Passwords.

func ParseTOTPSecret added in v0.16.0

func ParseTOTPSecret(raw string) (TOTPConfig, error)

ParseTOTPSecret parses an otpauth URI or a raw Base32 secret string into a TOTPConfig. It is tolerant of whitespace, hyphens, lowercase letters, and missing Base32 padding.

Jump to

Keyboard shortcuts

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