Documentation ¶
Index ¶
- Constants
- Variables
- func Base32Decode(s string) ([]byte, error)
- func Base32Encode(data []byte) string
- func RandomSecret(length int) ([]byte, error)
- func WithBase32Secret(s string) option
- func WithCount(count int64) option
- func WithDigits(digits int) option
- func WithHOTP() option
- func WithHashingAlgorithm(ha HashingAlgorithm) option
- func WithIssuer(issuer string) option
- func WithPeriod(period int) option
- func WithSecret(secret []byte) option
- type Algorithm
- type HashingAlgorithm
- type OTP
Constants ¶
View Source
const ( DefaultWindow = 0 DefaultDigits = 6 DefaultPeriod = 30 )
Variables ¶
View Source
var DefaultHashingAlgorithm = sha1.New
Functions ¶
func Base32Decode ¶ added in v0.2.0
func Base32Encode ¶ added in v0.2.0
func RandomSecret ¶ added in v0.2.0
func WithBase32Secret ¶ added in v0.2.0
func WithBase32Secret(s string) option
func WithDigits ¶ added in v0.2.0
func WithDigits(digits int) option
func WithHashingAlgorithm ¶ added in v0.2.0
func WithHashingAlgorithm(ha HashingAlgorithm) option
func WithIssuer ¶ added in v0.2.0
func WithIssuer(issuer string) option
func WithPeriod ¶ added in v0.2.0
func WithPeriod(period int) option
func WithSecret ¶ added in v0.2.0
func WithSecret(secret []byte) option
Types ¶
type HashingAlgorithm ¶ added in v0.2.1
type HashingAlgorithm int
const ( SHA1 HashingAlgorithm = iota SHA256 SHA512 )
type OTP ¶
type OTP struct {
// contains filtered or unexported fields
}
func (*OTP) Base32Secret ¶ added in v0.2.1
Directories ¶
Path | Synopsis |
---|---|
Package hotp implements the HMAC-based One-Time Password (HOTP) algorithm.
|
Package hotp implements the HMAC-based One-Time Password (HOTP) algorithm. |
Package totp implements the Time-based One-Time Password (TOTP) algorithm.
|
Package totp implements the Time-based One-Time Password (TOTP) algorithm. |
Click to show internal directories.
Click to hide internal directories.