Documentation
¶
Overview ¶
Package auth defines storage-independent authentication failures.
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 = 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
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 ¶
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.