Download the PHP package nishadil/mfa without Composer

On this page you can find all versions of the php package nishadil/mfa. 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 mfa

nishadil\mfa

A php library for Multi-factor authentication (MFA). MFA also known as 2FA or two factor authentication.

What is TOTP

TOTP, which stands for Time-based One-Time Password, is a computer algorithm that generates a temporary, unique password for authentication. It's widely used in two-factor authentication (2FA) systems to add an extra layer of security beyond a traditional password. The TOTP algorithm follows an open standard documented in RFC 6238. The inputs include a shared secret key and the system time.

What is HOTP

HOTP stands for HMAC-based One-Time Password and is the original standard that TOTP was based on. Both methods use a secret key as one of the inputs, but while TOTP uses the system time for the other input, HOTP uses a counter, which increments with each new validation. With HOTP, both parties increment the counter and use that to compute the one-time password. The HOTP standard is documented in RFC 4226.

Installation

This library can be installed using Composer. To install, please use following command

How to use

Generate Secret Code

To create new secret code for user, call public static mathod Mfa::createSecretCode();

output:

Generate long Secret Code

By default, we defined secret code length to 16 char long. You can change it if you need to generate long code. Accepted values should be in integer and within range of 16 to 128.

eg: now we want to generate a 32 char long secret code. Mfa::setSecretCodeLength(32); then Mfa::createSecretCode();

output:

Get TOTP from secret code

TOTP stands for Time-based One-Time Passwords and is a common form of Multi-factor authentication (MFA). To generate your TOTP based on your secret key and time you can call public static mathod Mfa::getTOTP( string $secretCode );

output:

Validate TOTP

To validate your TOTP based on your secret key and time you can call public static mathod Mfa::validateTOTP(string $secretCode, string $userProvided_otp, int $tolerance = 1); The $tolerance value is the number of time steps allowed before/after the current window (default 1). Use 0 for strict expiry.

output:

To change the TOTP time step (default 30 seconds), call Mfa::setTimeStep(int $seconds); before generating or validating codes:

Get HOTP from secret code

HOTP stands for HMAC-based One-Time Password and is the original standard that TOTP was based on. To generate your HOTP based on your secret key and counter value to call public static mathod Mfa::getHOTP( string $secretCode, int $counter );

output:

Validate HOTP

To validate your HOTP based on your secret key and counter value call public static mathod Mfa::validateHOTP(string $secretCode, string $userProvided_otp, int $counter);

output:

Create otpauth URI for Authenticator Apps

Many authenticator apps, such as Google Authenticator, Authy, and others, support scanning a QR code to quickly set up a new account. The QR code typically contains a special URI, called an otpauth URI, which holds all the necessary information for the app to generate one-time passwords.

The otpauth URI follows a specific format:

Generate otpauth URI for TOTP Based method

output:

Generate otpauth URI for HOTP Based method

output:

Generate Backup Codes

To generate backup codes, call public static mathod Mfa::generateBackupCodes(int $count = 10, int $length = 8);

output:

License

This library is licensed for use under the MIT License (MIT)


All versions of mfa with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
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 nishadil/mfa contains the following files

Loading the files please wait ...