Follow-on from #14. #14 implemented TTOTP.ValidatePassword returning Boolean
over a +/- N step window. RFC 6238 section 6 and RFC 4226 resynchronization
describe using the matched step offset to detect and correct a client's
persistent clock drift, which the current Boolean API discards.
Deferred scope:
- Add a verification overload that reports the matched step delta (e.g. an out
parameter or a small result record { Matched: Boolean; StepDelta: Integer }),
where StepDelta is the offset from the reference step at which the candidate
matched (0 = exact, -1 = one step behind, +1 = one step ahead).
- A server can persist per-account drift and pre-shift the reference step on
subsequent validations.
Implementation notes:
- Builds on
ValidateAtCounter in radRTL.TOTP. The loop already visits each step
in the window; capture the delta on match without adding an early-out.
- Keep the existing Boolean
ValidatePassword overloads. The delta is returned to
the (trusted) caller; the full window is still evaluated so timing does not leak
which step matched.
Acceptance criteria:
Follow-on from #14. #14 implemented
TTOTP.ValidatePasswordreturningBooleanover a +/- N step window. RFC 6238 section 6 and RFC 4226 resynchronization
describe using the matched step offset to detect and correct a client's
persistent clock drift, which the current Boolean API discards.
Deferred scope:
parameter or a small result record
{ Matched: Boolean; StepDelta: Integer }),where StepDelta is the offset from the reference step at which the candidate
matched (0 = exact, -1 = one step behind, +1 = one step ahead).
subsequent validations.
Implementation notes:
ValidateAtCounterin radRTL.TOTP. The loop already visits each stepin the window; capture the delta on match without adding an early-out.
ValidatePasswordoverloads. The delta is returned tothe (trusted) caller; the full window is still evaluated so timing does not leak
which step matched.
Acceptance criteria: