Versions in this module Expand all Collapse all v0 v0.0.1 Feb 22, 2021 Changes in this version + const DefaultPeriod + var ErrInvalidDigitsLength = errors.New("digits length unexpected") + var ErrOtpAuthOptionIsNil = errors.New("otpauth option is nil") + type Algorithm int + const AlgorithmMD5 + const AlgorithmSHA1 + const AlgorithmSHA256 + const AlgorithmSHA512 + func (a Algorithm) Enabled() bool + func (a Algorithm) Hash() hash.Hash + type Digits int + const DigitsEight + const DigitsSix + func (d Digits) Enabled() bool + func (d Digits) Format(in int32) string + func (d Digits) Length() int + type Host int + const HostHOTP + const HostTOTP + type Option struct + func NewOption() (*Option, error) + func (opt *Option) Secret() string + func (opt *Option) SetAlgorithm(a Algorithm) error + func (opt *Option) SetDigits(d Digits) error + func (opt *Option) SetIconURL(url string) error + func (opt *Option) SetPeriod(period uint) error + func (opt *Option) SetSecret(secret string) error + func (opt *Option) SetSecretSize(secretSize uint) error + type OtpAuth struct + func GenerateOtpAuth(issuer, accountName string, host Host) (*OtpAuth, error) + func GenerateOtpAuthWithOption(issuer, accountName string, host Host, opt *Option) (*OtpAuth, error) + func (oa *OtpAuth) QRCode() (string, error) + func (oa *OtpAuth) Secret() string + func (oa *OtpAuth) URL() string