drizz Posted August 28, 2019 Report Posted August 28, 2019 Is there any feasible way to get the "remaining time" on a given TOTP code? I take it that there's a global tripping point where all codes older than 60? seconds expire, but I was unable to find any resources on this. Would it be enough to figure out this tripping point (and does it even exist)? I'd appreciate any pointers on the topic, no need for full solutions or anything. Cheers. Quote
Dr. McKay Posted August 28, 2019 Report Posted August 28, 2019 Assuming your clock is correct, this will tell you how many seconds are left until the code will change: let secondsRemaining = 30 - (Math.floor(Date.now() / 1000) % 30); But note that once a code changes, you still have another 30 seconds to use it before it comes invalid. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.