Documentation ¶
Overview ¶
otp.go
Index ¶
- func GOOGLE_HOTP(secret string, counter uint64) (otp string)
- func GOOGLE_TOTP(secret string) (otp string)
- func HOTP(hasher func() hash.Hash, secret string, counter uint64, length Digit) (otp string)
- func HOTP_SHA1(secret string, counter uint64, length Digit) (otp string)
- func NewSecret() (secret string, err error)
- func NewSecretWithSize(size SecretSize) (secret string, err error)
- func QR(secret string, options *Options) (qrCode string, uri string, err error)
- func TOTP(hasher func() hash.Hash, secret string, timeStamp time.Time, period Period, ...) (otp string)
- func TOTP_SHA1(secret string, timeStamp time.Time, period Period, length Digit) (otp string)
- func URI(secret string, options *Options) string
- type Algorithm
- type Digit
- type Options
- type Period
- type SecretSize
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GOOGLE_HOTP ¶
Generate a Hmac based OTP that is compatible with Google Authenticator
func GOOGLE_TOTP ¶
Generate a Time based OTP that is compatible with Google Authenticator
func NewSecretWithSize ¶
func NewSecretWithSize(size SecretSize) (secret string, err error)
Generate a new secret of specified size. Mininum size is 16 bytes
func TOTP ¶
func TOTP(hasher func() hash.Hash, secret string, timeStamp time.Time, period Period, length Digit) (otp string)
Generate a Time based OTP
Types ¶
type SecretSize ¶
type SecretSize uint8
const ( SECRET_SIZE_16 SecretSize = 16 SECRET_SIZE_20 SecretSize = 20 SECERT_SIZE_32 SecretSize = 32 SECRET_SIZE_64 SecretSize = 64 SECRET_SIZE_MIN SecretSize = SECRET_SIZE_16 SECRET_SIZE_DEFAULT SecretSize = SECRET_SIZE_20 )
Standard Secret sizes
Click to show internal directories.
Click to hide internal directories.