Download the PHP package khooz/oath without Composer

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

Oath

Oath is a One Time Password library used in authenticators. It covers both HOTP and TOTP methods of code generation.

What is this package?

It implements the HMAC-based One-Time Password specified in RFC6238 used in many Two Step Authentication solutions. It is compatible with Authenticator Apps Like Google's and Microsoft's. It uses a @devicenull 's class called Base32 for RFC3548 Base32 encodeing and decoding. Feel free to use any custom Base32-converting class, which have encode and decode public static functions.

Getting Started

This package uses PSR-4 autoloading which eases the installation and use with major framework or any projects utilising composer. Simply use composer to install this package as your project's dependency:

Usage

You can simply use the default parameters of this package to generate or check HMAC-based One-Time Passwords:

You can also customize the default parameters using config static method before instantiating the Oath class, or after, for the newer instantiations.

One instantiated, the Oath object encapsulates all the data it needs for a single user and defaults can safely be changed for furthur users.

Methods

Oath::generate(int $pivot)

Generates a new code based on object parameter. By using $pivot, you can go back and forth with codes and generate expired codes (negative value) or coming codes (positive value). You will get the current valid code when $pivot = 0 (default behaviour).

Oath::check(int $code, int $rabge, int $pivot)

Checks an n-digit, integer $code with a telorance of $range around a $pivot point in codes sequence.

Properties

All non-static properties of Oath is accessible through it's name's __get and __set invocations; though there are some important properties and some virtual properties woth mentioning. I encourage you to see the Oath class in detail.

Oath::secret

Along with Oath::message and Oath::salt, the secret or the other two (which make the secret if they are present) define an instance for authentication. You should exchange the secret to the user to store so you could generate the same codes sequence to compare against. You should also store either the secret, or the message & salt. The secret is a binary string represented in Base32 encoding.

Oath::message and Oath::salt

You either introduce a Base32 secret, or make one using a message and a salt. if you don't provide either, a randomly generated message and salt will generate a secret for you.

Oath->uri

This is a virtual property which will give you an otpauth URL-encoded URI, so you could use a QR-code or a link to exchange authentication token instances with user. It is formatted as bellow:

The parameters are secret, digits, algorithm, period or counter in URL-encoded HTTP Query format.

Special Thanks goes to

finally()

{

And if you feel like it, you can donate here to help me.

}


All versions of oath with dependencies

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

Loading the files please wait ....