Versions in this module Expand all Collapse all v1 v1.0.1 Apr 18, 2018 Changes in this version + func Pad(s string) string v1.0.0 Apr 16, 2018 Changes in this version + const OATH_HOTP + const OATH_TOTP + var ErrInvalidAlgo = errors.New("twofactor: invalid algorithm") + var ErrInvalidURL = errors.New("twofactor: invalid URL") + var PRNG = rand.Reader + type HOTP struct + func GenerateGoogleHOTP() *HOTP + func NewHOTP(key []byte, counter uint64, digits int) *HOTP + func (otp *HOTP) OTP() string + func (otp *HOTP) QR(label string) ([]byte, error) + func (otp *HOTP) SetProvider(provider string) + func (otp *HOTP) Type() Type + func (otp *HOTP) URL(label string) string + type OATH struct + func (o OATH) Counter() uint64 + func (o OATH) Hash() func() hash.Hash + func (o OATH) Key() []byte + func (o OATH) OTP(counter uint64) string + func (o OATH) QR(t Type, label string) ([]byte, error) + func (o OATH) SetCounter(counter uint64) + func (o OATH) Size() int + func (o OATH) URL(t Type, label string) string + type OTP interface + Counter func() uint64 + Hash func() func() hash.Hash + Key func() []byte + OTP func() string + SetCounter func(uint64) + Size func() int + Type func() Type + func FromURL(URL string) (OTP, string, error) + type TOTP struct + func GenerateGoogleTOTP() *TOTP + func NewGoogleTOTP(secret string) (*TOTP, error) + func NewTOTP(key []byte, start uint64, step uint64, digits int, algo crypto.Hash) *TOTP + func NewTOTPSHA1(key []byte, start uint64, step uint64, digits int) *TOTP + func (otp *TOTP) OTP() string + func (otp *TOTP) OTPCounter() uint64 + func (otp *TOTP) QR(label string) ([]byte, error) + func (otp *TOTP) SetProvider(provider string) + func (otp *TOTP) Type() Type + func (otp *TOTP) URL(label string) string + type Type uint