crunch/one-time-password

This package is abandoned and no longer maintained. No replacement package was suggested.

One-Time-Password (OTP) generator. RFC4226 (HOTP) and RFC6238 (TOTP) complaint.

dev-master / 1.0.x-dev 2013-07-01 20:26 UTC

This package is not auto-updated.

Last update: 2023-01-10 22:25:54 UTC


README

Latest Stable Version Build Status Total Downloads

Generate one-time-passwords (aka OTP) both counter- and time-based. This library is RFC4226 and RFC6238 compliant. This includes, that you can use it with Google Authenticator.

It is currently under development, but works quite fine. The most important thing to get done is stabilization.

Installation

Add "crunch/one-time-password": "1.0.*@dev" to your composer.json.

Quickstart

Google Authenticator example. The shared token is abcdefghijklmnop.

require __DIR__ . '/../vendor/autoload.php';

use Crunch\OneTimePassword as otp;
use Crunch\Base32 as base32;

$secret = 'abcdefghijklmnop';

$code = otp\generateTimebased(base32\decode($secret), time(), 6);

Requirements

  • PHP => 5.3

Contributors

See CONTRIBUTING.md for details on how to contribute.

License

This library is licensed under the MIT License. See the LICENSE file for details.

References