Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrGenerateMissingAccountName = errors.New("AccountName must be set")
When generating a Key, the Account Name must be set.
View Source
var ErrGenerateMissingIssuer = errors.New("Issuer must be set")
When generating a Key, the Issuer must be set.
View Source
var ErrValidateInputInvalidLength = errors.New("Input length unexpected")
The user provided passcode length was not expected.
View Source
var ErrValidateSecretInvalidBase32 = errors.New("Decoding of secret as base32 failed.")
Error when attempting to convert the secret from base32 to raw bytes.
Functions ¶
This section is empty.
Types ¶
type Algorithm ¶
type Algorithm int
Algorithm represents the hashing function to use in the HMAC operation needed for OTPs.
const ( // AlgorithmSHA1 should be used for compatibility with Google Authenticator. // // See https://github.com/ecnepsnai/otp/issues/55 for additional details. AlgorithmSHA1 Algorithm = iota AlgorithmSHA256 AlgorithmSHA512 AlgorithmMD5 )
type Digits ¶
type Digits int
Digits represents the number of digits present in the user's OTP passcode. Six and Eight are the most common values.
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key represents an TOTP or HTOP key.
func NewKeyFromURL ¶
NewKeyFromURL creates a new Key from an TOTP or HOTP url.
The URL format is documented here:
https://github.com/google/google-authenticator/wiki/Key-Uri-Format
func (*Key) AccountName ¶
AccountName returns the name of the user's account.
Click to show internal directories.
Click to hide internal directories.