Documentation
¶
Overview ¶
Package otp implements the one-time password schemes carried in otpauth:// URIs: TOTP (RFC 6238) and HOTP (RFC 4226).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Kind is totp or hotp.
Kind Kind
// Secret is the shared key, already base32-decoded.
Secret []byte
// Digits is the length of the generated code, normally 6.
Digits int
// Period is the TOTP time step.
Period time.Duration
// Counter is the HOTP counter.
Counter uint64
// Algorithm names the HMAC hash: SHA1, SHA256 or SHA512.
Algorithm string
// Issuer is the service the code belongs to, for display.
Issuer string
// Account is the account name, for display.
Account string
}
Config is a parsed otpauth:// URI.
func (*Config) Code ¶
Code returns the one-time password for the given moment. For HOTP the time is ignored and the configured counter is used.
Click to show internal directories.
Click to hide internal directories.