Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose TOTP window start #50

Merged
merged 1 commit into from
Jul 24, 2023
Merged

Conversation

miloush
Copy link
Contributor

@miloush miloush commented Jul 22, 2023

Implements #46

Currently there is no way to retrieve elapsed, remaining or absolute time of a window for TOTP. The RemainingSeconds() method returns an integer and is therefore not satisfactory to trigger actions on new time window (such as updating UI).

While Step is now available, the calculation of required values is non-trivial and requires knowledge of implementation details (such as the used epoch).

This PR adds WindowStart() method that returns absolute time of the current TOTP window. That way, users can get:

  • DateTime of when current window started ... WindowStart()
  • elapsed TimeSpan as WindowStart() - now
  • remaining TimeSpan as now + TimeSpan.FromSeconds(Step) - WindowStart()

@kspearrin kspearrin merged commit 0ac3c31 into kspearrin:master Jul 24, 2023
@miloush miloush deleted the window-start branch July 25, 2023 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants