Skip to content

Commit

Permalink
leeway/window Migration path clarification
Browse files Browse the repository at this point in the history
  • Loading branch information
Spomky committed Nov 28, 2023
1 parent fd51b6f commit b819e56
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions doc/UPGRADE_v10-v11.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,19 @@

Congratulation, you have nothing to do!
This version requires PHP8.1+, but no changes on your side are expected.

However, please note the change in behavior of the `window` feature between versions 10 and 11.

With version 10
---------------

The `window` of timestamps goes from `timestamp - window * period` to `timestamp + window * period`.
For example, if the window is `5`, the period `30` and the timestamp `1476822000`, the OTP tested are within `1476821850` (`1476822000 - 5 * 30`) and `1476822150` (`1476822000 + 5 * 30`).
In other words, this validated the **5 OTP before and after** the current timestamp.

With version 11
---------------
The window of TOTP acts as time drift.
If the window is `10`, the period `30` and the timestamp `147682209`, the OTP tested are within `1476821999` (`147682209 - 10`), `147682209` and `1476822219` (`147682209 + 10`).
This includes the previous OTP, but not the next one.
The `window` shall be lower than the `period`. In the previous example, the `window` shall be between `0` and `30`.

0 comments on commit b819e56

Please sign in to comment.