Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateSecret() string
- type HOTP
- func (ho *HOTP) AccountName() string
- func (ho *HOTP) Counter() uint64
- func (ho *HOTP) Digits() int
- func (ho *HOTP) HashFuncName() string
- func (ho *HOTP) IncCounter()
- func (ho *HOTP) Interval() int
- func (ho *HOTP) Issuer() string
- func (ho *HOTP) Password() string
- func (ho *HOTP) PasswordAt(counter uint64) string
- func (ho *HOTP) SetAccountName(account string) error
- func (ho *HOTP) SetCounter(c uint64)
- func (ho *HOTP) SetDigits(d int) error
- func (ho *HOTP) SetHashFunc(name string, h func() hash.Hash)
- func (ho *HOTP) SetInterval(_ int)
- func (ho *HOTP) SetIssuer(issuer string) error
- func (ho *HOTP) SetWindowSize(c int)
- func (ho *HOTP) String() string
- func (ho *HOTP) Type() string
- func (ho *HOTP) URI() string
- func (ho *HOTP) UseSHA1()
- func (ho *HOTP) UseSHA256()
- func (ho *HOTP) UseSHA512()
- func (ho *HOTP) Verify(password string) bool
- func (ho *HOTP) VerifyAt(password string, counter uint64) bool
- func (ho *HOTP) WindowSize() int
- type OTP
- type TOTP
- func (to *TOTP) Interval() int
- func (to *TOTP) Password() string
- func (to *TOTP) PasswordAt(time uint64) string
- func (to *TOTP) SetInterval(seconds int)
- func (to *TOTP) Type() string
- func (to *TOTP) URI() string
- func (to *TOTP) Verify(password string) bool
- func (to *TOTP) VerifyAt(password string, time uint64) bool
Constants ¶
View Source
const ( DefWindowSize = 100 DefTimeWindowSize = 2 DefInterval = 30 DefDigits = 6 )
Variables ¶
View Source
var ( ErrContainsColon = errors.New("issuer/account name cannot contain colon") ErrInvalidLen = errors.New("password can only be 6 or 8 characters long") )
Functions ¶
func GenerateSecret ¶
func GenerateSecret() string
Types ¶
type HOTP ¶
type HOTP struct {
// contains filtered or unexported fields
}
func NewHOTPAccount ¶
func (*HOTP) AccountName ¶
func (*HOTP) HashFuncName ¶
func (*HOTP) IncCounter ¶
func (ho *HOTP) IncCounter()
func (*HOTP) PasswordAt ¶
func (*HOTP) SetAccountName ¶
func (*HOTP) SetCounter ¶
func (*HOTP) SetInterval ¶
func (*HOTP) SetWindowSize ¶
func (*HOTP) WindowSize ¶
type OTP ¶
type OTP interface {
Type() string
SetIssuer(string) error
Issuer() string
SetAccountName(string) error
AccountName() string
SetHashFunc(string, func() hash.Hash)
UseSHA1()
UseSHA256()
UseSHA512()
HashFuncName() string
SetDigits(int) error
Digits() int
SetCounter(uint64)
Counter() uint64
IncCounter()
SetWindowSize(int)
WindowSize() int
VerifyAt(string, uint64) bool
Verify(string) bool
String() string
URI() string
PasswordAt(uint64) string
Password() string
SetInterval(int)
Interval() int
}
type TOTP ¶
type TOTP struct {
*HOTP
// contains filtered or unexported fields
}
func NewTOTPAccount ¶
func (*TOTP) PasswordAt ¶
func (*TOTP) SetInterval ¶
Click to show internal directories.
Click to hide internal directories.