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

Make totp_timestamp column an integer #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jmhooper
Copy link

The ROTP gem expects the prior timestamp in verify_with_drift_and_prior to be an integer. Moreover, when verify_with_drift_and_prior returns it returns an integer.

We noticed a bug where the totp_timestamp column was always nil. The reason for this was that the database had a timestamp column and when this gem was attempting to assign totp_timestamp to an integer, it was actually set to nil.

This commit changes the column to an integer instead of a timestamp to avoid the problem described above.

Another potential solution is to change the result of verify_with_drift_and_prior to a datetime before saving, and then change the value of totp_timestamp to an integer before calling verify_with_drift_and_prior.

I went with the solution I did instead b/c it looked like the path of least resistance, but am happy to modify my PR to leave the column as a timestamp and handle moving between integers and dates in the authenticate_totp method.

The ROTP gem expects the prior timestamp in
`verify_with_drift_and_prior` to be an integer. Moreover, when
`verify_with_drift_and_prior` returns it returns an integer.

We noticed a bug where the totp_timestamp column was always nil. The
reason for this was that the database had a timestamp column and when
this gem was attempting to assign `totp_timestamp` to an integer, it
was actually set to nil.

This commit changes the column to an integer instead of an integer to
avoid the problem described above.
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

1 participant