diff options
author | Christian Riesen <chris.riesen@gmail.com> | 2017-03-16 16:46:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-16 16:46:10 +0100 |
commit | f29c9eb9f9a7117a9e9912dac2f474120061260d (patch) | |
tree | ec9bb9249ab8e40ec76764f7b1b1835cb73f2873 /README.md | |
parent | 83f941e1ad6f7a2ff318e30cbf5b3219e63a9a62 (diff) | |
parent | 34bcbead1414383a0f2fc98fabf98acd2b9a3ae8 (diff) | |
download | otp-master.zip otp-master.tar.gz otp-master.tar.bz2 |
Merge pull request #18 from fkooman/random_compatHEAD2.4.0origin/masterorigin/HEADmaster
use paragonie/random_compat
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -26,9 +26,7 @@ Usage use Otp\Otp; use Otp\GoogleAuthenticator; - -// Seperate class, see https://github.com/ChristianRiesen/base32, requirement for this one -use Base32\Base32; +use ParagonIE\ConstantTime\Encoding; // Get a Pseudo Secret // Defaults to 16 characters @@ -48,7 +46,7 @@ $otp = new Otp(); // Assuming this is present and sanitized // Allows for a 1 code time drift by default // Third parameter can alter that behavior -if ($otp->checkTotp(Base32::decode($secret), $key)) { +if ($otp->checkTotp(Encoding::base32Decode($secret), $key)) { // Correct key // IMPORTANT! Note this key as being used // so nobody could launch a replay attack. @@ -59,7 +57,7 @@ if ($otp->checkTotp(Base32::decode($secret), $key)) { } // Just to create a key for display (testing) -$key = $otp->totp(Base32::decode($secret)); +$key = $otp->totp(Encoding::base32Decode($secret)); ``` @@ -75,9 +73,7 @@ Class GoogleAuthenticator Static function class to generate a correct url for the QR code, so you can easy scan it with your device. Google Authenticator is avaiaible as application for iPhone and Android. This removes the burden to create such an app from the developers of websites by using this set of classes. -There are also older open source versions of the Google Authenticator app for both [iPhone](https://github.com/google/google-authenticator) and [Android](https://github.com/google/google-authenticator-android) - -This helper class uses the random_int function from PHP7, or the polyfill method from [paragonie/random_compat](https://packagist.org/packages/paragonie/random_compat) if present and falls back on other (less "secure") random generators. +There are also older open source versions of the Google Authenticator app for both [iPhone](https://github.com/google/google-authenticator) and [Android](https://github.com/google/google-authenticator-android). About ===== @@ -87,7 +83,7 @@ Requirements PHP 5.4.x+ -Uses [Base32 class](https://github.com/ChristianRiesen/base32). +Uses [paragonie/random_compat](https://github.com/paragonie/random_compat) and [paragonie/constant_time_encoding](https://github.com/paragonie/constant_time_encoding). If you want to run the tests, PHPUnit 3.6 or up is required. |