Developed by OpenMix: https://openmix.org
Install
go get github.com/mix-go/authenticator@latest
Generate Secret
secret := authenticator.GenerateSecret()
Generate Code
code := authenticator.GenerateToken(secret)
Verify Code
ok := authenticator.VerifyToken(secret, code)
// or
ok := authenticator.VerifyTokenCustom(secret, code, 60)
Generate Url
uri := authenticator.GenerateTotpUri("Foo", "bar", secret)
// or
url := authenticator.GenerateQRCodeGoogleUrl("Foo", "bar", secret)
Apache License Version 2.0, http://www.apache.org/licenses/