Skip to content

zeroows/Laravel-OTPass-Bundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OTPass Bundle

The Laravel OTPass bundle can work with Google's Authenticator app and/or support most (if not all) OATH based HOTP/TOTP systems.

Installing using Artisan CLI:

php artisan bundle:install OTPass

Either auto-load the bundle in application/bundles.php:

return array(
    'otpass' => array('auto' => true)
);

Or manually start:

Bundle::start('otpass');

Usage/Examples

To Generate a User Random Key

HOTPass::userRandomKey();

// will generate a random key like 35ZCFIQ4SXTO6EYL

Getting the HOTP number

This will generate the HOTP number that will change every 30 sec, and you can compare it with the same code generated by Google's Authenticator app.

You have to provied the User Random Key that should be stored with User Info.

HOTPass::generate("35ZCFIQ4SXTO6EYL", 30);
// for example HOTP number 173787

Generate QRcode

To Generate QRcode to be scanned with Google's Authenticator app. To setup the account in the app.

@param String $user is the user name @param String $host is the website base url @param String $secret is the secret that was genereted for the user

HOTPass::getQRcodeURL("zeroows", "localhost", $secret);
// it will return link like http://chart.apis.google.com/chart?cht=qr&chs=150x150&chl=otpauth://totp/localhost:zeroows?secret=35ZCFIQ4SXTO6EYL&chld=H|0

License

Apache License 2

Copyright 2012 Abdulrhman Alkhodiry

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

OneTimePass PHP Class. Laravel Bundle

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages