Go package for HOTP (RFC4226) and TOTP (RFC6238)
secret, _ := otp.NewSecret()
secret, _ := otp.NewSecretWithSize(otp.SECERT_SIZE_32)
hotpURI := otp.URI(secret, &otp.Options{
User: "testuser",
Issuer: "testissuer",
Counter: 1,
})
totpURI := otp.URI(secret, &otp.Options{
User: "testuser",
Issuer: "testissuer",
})
qr, uri, qrErr := otp.QR(secret, &otp.Options{
User: "testuser",
Issuer: "testissuer",
})
hotp := otp.HOTP(sha1.New, secret, 20, otp.DIGITS_4)
totp := otp.TOTP(sha1.New, secret, time.Now(), otp.PERIOD_45, otp.DIGITS_8)
ghotp := otp.GOOGLE_HOTP(secret, 1)
gtotp := otp.GOOGLE_TOTP(secret)