Download the PHP package oops/totp-authenticator without Composer

On this page you can find all versions of the php package oops/totp-authenticator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package totp-authenticator

Oops/TotpAuthenticator

🏚️ THIS PROJECT HAS BEEN ABANDONED

Please use https://github.com/jiripudil/otp for an up-to-date, more feature-rich implementation of one-time passwords.


Oops/TotpAuthenticator implements the TOTP algorithm that lets you easily set up a two-factor authentication mechanism. The TOTP, in short, generates a pseudo-random six-digit number based on current Unix time and given seed (a base32 string of at least 16 characters). The seed is shared between you and mobile app and passed to the app via a QR code. Whenever you need to authenticate the user, ask them to enter the code generated by the application, and verify it against the code generated by your server.

Installation and requirements

Oops/TotpAuthenticator requires PHP >= 7.2.

Usage

If you use Nette's DI container, you can easily integrate Oops/TotpAuthenticator with a few lines of configuration:

Otherwise, you can directly instantiate Oops\TotpAuthenticator\Security\TotpAuthenticator and optionally configure it:

The timeWindow option sets a benevolence that compensates for possible differences between your server's time and the app's time. The default value is 1, which means the code for previous or next 30-second block would be also considered valid. You can set it to zero if you want to be super strict, but I'd strongly recommend not setting it to a higher value than one.

The issuer is optional, but is quite useful if you use some generic value as the user's account name, such as their email address. As multiple services can use that same value as a way of identifying the user, you should provide issuer to distinguish your app's code in the TOTP app.

Setting up 2FA

First, you need to generate a secret - a base32 string - that is shared between you and the application. TotpAuthenticator provides a method for that. The secret must be unique to the user and should thus be stored somewhere with other user data, e.g. in the database. Just remember to encrypt it as it is a very sensitive piece of information.

Then, you can display the secret and unique account name (e.g. user's email address) to the user, or, more conveniently, provide them with a QR code containing the URI in a specific format. Again, TotpAuthenticator can build the URI for you:

Verification

Once the user has set up the account in their TOTP app, you can ask them to enter the 6-digit code and easily verify it against the secret:


All versions of totp-authenticator with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
paragonie/constant_time_encoding Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package oops/totp-authenticator contains the following files

Loading the files please wait ....