Git Product home page Git Product logo

Comments (5)

Spomky avatar Spomky commented on August 26, 2024

Hi,

Thank you for the issue report.
I am not sure it is a bug from the library. I think that when you run your test the timecode changed.

Could you try your tests using a window parameter i.e. $totp->verify($otp, null, 1)?

from otphp.

Spomky avatar Spomky commented on August 26, 2024

In fact I think you misunderstood how period works.

In your example the OTP are valid for 10 sec. but if you get it 2 sec before it expires then 5 seconds later the test will fail.
Example: the timestamp is 123456789. The timecode is 12345678. If you wait 5 seconds the timestamp is 123456794 but the timecode is 12345679. The otp is not verified.

An OTP is always valid for the given period of time. But when you get it, it may be valid only for few seconds.

from otphp.

oatto avatar oatto commented on August 26, 2024

What's the point of a few second life for otp password in real world use ? Could you give me an example ?

from otphp.

Spomky avatar Spomky commented on August 26, 2024

None. That is why a window parameter exists.

from otphp.

oatto avatar oatto commented on August 26, 2024

That means if I really want OTP life for 60 seconds, so I have to set period to 30 and window = 1. Am I right ?

from otphp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.