Giter Site home page Giter Site logo

Access generated digits about otphp HOT 5 CLOSED

spomky-labs avatar spomky-labs commented on May 8, 2024
Access generated digits

from otphp.

Comments (5)

Spomky avatar Spomky commented on May 8, 2024

Hi,

The current OTP is given by the method now().
But you dont't have to send it by SMS, email or whatever. It should be given by an application like Google Authenticator or FreeOTP.

from otphp.

onebeat avatar onebeat commented on May 8, 2024

Ok thank you for your reply.
My idea is to use this as sms verification of registrion for my client so system generates 6 number pin which has expire frame of 60 sec or more then is entered to php form.
My question how can i verify and what should i put -> $otp->verify("entered pin") or ?

from otphp.

Spomky avatar Spomky commented on May 8, 2024

hum... from my point of view, it doesn't seem appropriate.

An OTP is not necessarily valid during exactly X seconds when generated.
The time needed for a user to receive the SMS, open it, typing the OTP and validate it may take more time than the OTP lifetime.

When sending codes by email or SMS, it is preferable to use a random code with limited lifetime (approx 1h) instead of using TOTP.

from otphp.

onebeat avatar onebeat commented on May 8, 2024

I agree with you but if i change from 30 sec to 600 sec which is 10min or more then i can use this, right ? I the future idea is to implement qrcode verification...

My question how and if can verfiy digit ?

from otphp.

Spomky avatar Spomky commented on May 8, 2024

My question how and if can verfiy digit ?

It is explained in the doc

$otp = TOTP::create($secret); // create TOTP object from the secret.
$otp->verify($input); // Returns true if the input is verified, otherwise false.

If you want to send a unique / temporary code by SMS/email, just don't use TOTP for that but pure random values.
TOTP will undoubtedly lead to security issues or bad UX.

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.