repositorypackage
0.0.0-20230315233719-84be93b240fd
Repository: https://github.com/xrjr/otp.git
Documentation: pkg.go.dev
# README
otp - HOTP and TOTP in Go
Informations
General
This library implements HMAC-based One-Time Password (HOTP) and Time-based One-Time Password (TOTP) algorithms.
As this package hasn't reached v1 yet, its API shouldn't be considered stable and can change at any moment. However, it is unlikely to happen.
Supported standards
TOTP example usage
Using defaults :
code := otp.TOTP(secret, time.Now(), TOTPOptions{})
Using options :
code := otp.TOTP(secret, time.Now(), TOTPOptions{
HOTPOptions: HOTPOptions{
Digits: 8,
},
Period: 60,
Step: -1,
})
Default options are :
- 6 digits
- 30 seconds time period
- SHA1 hash function