func printGTOTP(label string, otp twofactor.OTP) { t := time.Now() fmt.Println(otp.OTP()) fmt.Println("Updates in", 30-(t.Second()%30), "seconds.") for { for { t = time.Now() if t.Second() == 0 { break } else if t.Second() == 30 { break } <-time.After(1 * time.Second) } fmt.Println(otp.OTP()) <-time.After(30 * time.Second) } }
func printTOTP(label string, otp twofactor.OTP) { last := otp.OTP() fmt.Println(last) for { if otp.OTP() != last { last = otp.OTP() fmt.Println(last) } <-time.After(1 * time.Second) } }
func printHOTP(label string, otp twofactor.OTP) { fmt.Println(otp.OTP()) }