Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ConfigDefault = Config{ Algorithm: AlgorithmSHA1, Digits: DigitsSix, Period: 30, Skew: 1, }
ConfigDefault is the default configuration.
Functions ¶
This section is empty.
Types ¶
type Algorithm ¶
type Algorithm int
Algorithm represents the hashing algorithm to use.
const ( // Constants for supported algorithms. AlgorithmSHA1 Algorithm = iota AlgorithmSHA224 AlgorithmSHA256 AlgorithmSHA384 AlgorithmSHA512 AlgorithmSHA3_224 AlgorithmSHA3_256 AlgorithmSHA3_384 AlgorithmSHA3_512 AlgorithmBLAKE2S_256 AlgorithmBLAKE2B_256 AlgorithmBLAKE2B_384 AlgorithmBLAKE2B_512 AlgorithmMD5 )
type Config ¶
type Config struct {
Algorithm Algorithm // Hashing algorithm to use (default: SHA1)
Digits Digits // Number of output digits (default: 6)
Period int64 // Validity period in seconds (default: 30)
Secret string // Base32 encoded secret key
Skew int64 // Time skew adjustment (default: 1)
}
Config holds the configuration settings for hashing.
type TOTP ¶
type TOTP struct {
// contains filtered or unexported fields
}
TOTP generates time-based one-time passwords.
func (*TOTP) GenerateForTime ¶
GenerateForTime generates a TOTP for a specific Unix time.
Click to show internal directories.
Click to hide internal directories.