mirror of
https://github.com/antonioribeiro/google2fa.git
synced 2026-04-26 00:25:52 +03:00
[GH-ISSUE #23] [Q] keyRegeneration period and window (key) #246
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/google2fa#246
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sokai on GitHub (Jan 25, 2016).
Original GitHub issue: https://github.com/antonioribeiro/google2fa/issues/23
Hi there! Yesterday I played a bit with G2FA and now have a question. (I don't know another place to ask and I know that the original code was made by a Phil …)
Background of my understanding
G2FA generates (default) every 30 secs (=
keyRegeneration) a new OTP with a valid. time/period from now (=timeStamp) up tonow + 4x30 secs(nowis rounded down to the last 30st second).Example one
Example two
Questions
Examples
With the above examples my expected
valid up to-time is not true. My OTPs always are 30 secs longer valid.→ So I'm missing something or is my understanding wrong?
My scenario
Is a scenario where OTPs are generated every second and are valid for 20 secs realisable/feasible. And if yes, how can I do it?
Tanks a lot for your help and best regards!
@aik099 commented on GitHub (Mar 11, 2016):
The window concept is a way to compensate following:
@antonioribeiro commented on GitHub (Jul 17, 2016):
30 seconds is the OTP general lifetime, if you change it on your end, you will not be able to use things like Google Authenticator. This is the first window.
There's a second window, to solve the problems pointed by @aik099: your OTP is valid 4 seconds before the 30s window starts and lasts 4 seconds after the window has ended.
@ghost commented on GitHub (Sep 15, 2016):
Using lifetime of 30 seconds is fine, because most apps (FreeOTP) use 30 seconds to show "valid graph". Using
$google2fa->verifyKey($key_from_user, $entered_key, 0)will make the key only valid for 30 seconds, but keep in mind many companies use some kind of "offset" as mentioned above (time for submitting request etc.).