-
Notifications
You must be signed in to change notification settings - Fork 274
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
Old OTP can be used after a new one has been generated #59
Comments
Hello, totp.verify_with_drift(code, drift) Could you please confirm, that if you push down drift to zero, old otp will no longer be available? |
If I set |
In other words, I can keep generating new ones, but none of them will be valid. |
I think this is an |
It's strange it should not expire all OTP immediately. require 'rotp'
totp = ROTP::TOTP.new("base32secret3232")
totp.verify_with_drift(totp.now, 0) # true
totp.verify_with_drift(totp.at(Time.now - 60), 0) # false
totp.verify_with_drift(totp.at(Time.now - 60), 60) # true |
Maybe I'm not understanding how this works, but it looks like the How can a call with a different drift be called based on which OTP is requested? |
Sorry, I misread what you typed. I added some debugging statements to Scenario 1: User enters OTP within specified interval
Scenario 2: User enters OTP after specified interval and requests and enters a new one within the time step
Scenario 3: User requests a new OTP inside current time step but enters it after time step
This all seems to work as expected, but what if I want to increase the interval so that a user doesn't have to enter the OTP so fast? So, I added an What I would like is this behavior:
Is this possible? |
I asked this question on the rotp repo, and it looks like this is not possible. What I'm trying to do is not how ROTP is meant to work. See this comment: mdp/rotp#46 (comment) |
Hi, If this issue still persists, I got it working by resetting the OTP secret key for the user every time they request a new OTP. If the user requests a new OTP, I reset the secret, i.e I generate the secret again. Then use the new secret to send a new OTP. Since I'm using the secret while validating an OTP, the old OTP instantly becomes invalid. Generating OTP:
Verifying the OTP: |
Steps to reproduce:
Expected Result: OTP should no longer be valid since a new one was generated. There should only ever be one valid OTP at any given time
Actual Result: The old OTP is considered valid and the user is able to fully authenticate
The text was updated successfully, but these errors were encountered: