Versions in this module Expand all Collapse all v0 v0.0.7 Nov 3, 2022 Changes in this version + const AlgorithmMD5 + const AlgorithmSHA1 + const AlgorithmSHA256 + const AlgorithmSHA512 + func Code(secret string) string + func CodeCustom(secret string, t time.Time) string + func GenerateURLHOTP(opts KeyOpts) (url string) + func GenerateURLTOTP(opts KeyOpts) (url string) + func HOTPCode(secret string, counter uint64) (code string) + func HOTPCodeCustom(secret string, counter uint64, opts *Opts) (code string) + func KeyFromHOTPOpts(opts KeyOpts) (*xtp.Key, error) + func KeyFromTOTPOpts(opts KeyOpts) (*xtp.Key, error) + func KeyFromURL(url string) (*xtp.Key, error) + func RandomSecret(length int) (secret string) + func TOTPCode(secret string) (code string) + func TOTPCodeCustom(secret string, t time.Time, opts *Opts) (code string) + func VerifyHOTP(passcode string, counter uint64, secret string) bool + func VerifyHOTPCustom(passcode string, counter uint64, secret string, opts *Opts) (ret bool) + func VerifySecret(secret string) bool + func VerifyTOTP(passcode string, secret string) bool + func VerifyTOTPCustom(passcode string, secret string, t time.Time, opts *Opts) (ret bool) + type KeyOpts struct + AccountName string + Algorithm xtp.Algorithm + Counter uint64 + Digits xtp.Digits + Issuer string + Period uint + Rand io.Reader + Secret []byte + SecretSize uint + type Opts struct + Algorithm xtp.Algorithm + Digits xtp.Digits + Period uint + Skew uint + func (opts *Opts) GetAlgorithm() xtp.Algorithm + func (opts *Opts) GetDigits() xtp.Digits + func (opts *Opts) GetPeriod() uint + func (opts *Opts) GetSkew() uint