rinvex / laravel-authy
Rinvex Authy is a simple wrapper for Authy TOTP, the best rated Two-Factor Authentication service for consumers, simplest 2fa Rest API for developers and a strong authentication platform for the enterprise.
Installs: 60 988
Dependents: 1
Suggesters: 0
Security: 0
Stars: 34
Watchers: 4
Forks: 7
Open Issues: 0
Requires
- php: ^8.1.0
- guzzlehttp/guzzle: ^7.4.0
- illuminate/support: ^10.0.0 || ^11.0.0
- rinvex/authy: ^7.0.0
Requires (Dev)
- codedungeon/phpunit-result-printer: ^0.32.0
- illuminate/container: ^10.0.0 || ^11.0.0
- phpunit/phpunit: ^10.1.0
README
This package is just a Laravel wrapper for rinvex/authy
.
Rinvex Authy is a simple wrapper for Authy TOTP API, the best rated Two-Factor Authentication service for consumers, simplest 2fa Rest API for developers and a strong authentication platform for the enterprise.
Table Of Contents
- Usage
- Installation
- Upgrade
- Changelog
- Support
- Contributing & Protocols
- Security Vulnerabilities
- About Rinvex
- Trademarks
- License
Usage
Usage is pretty easy and straightforward:
Authy App
Get Authy app instance and interact with it:
$authyApp = app('rinvex.authy.app'); $appStats = $authyApp->stats(); // Get app stats $appDetails = $authyApp->details(); // Get app details
Authy User
Get Authy user instance and interact with it:
$authyUser = app('rinvex.authy.user'); $user = $authyUser->register('user@domain.com', '317-338-9302', '54'); // Register user $userActivity = $authyUser->registerActivity($user->get('user')['id'], 'cookie_login', 'Test Data'); // Register user activity $userStatus = $authyUser->status($user->get('user')['id']); // Get user status $userDeleted = $authyUser->delete($user->get('user')['id']); // Delete user
Authy Token
Get Authy token instance and interact with it:
$authyToken = app('rinvex.authy.token'); $smsTokenSent = $authyToken->send($user->get('user')['id'], 'sms'); // Send SMS token $callTokenStarted = $authyToken->send($user->get('user')['id'], 'call'); // Start automated call $tokenVerified = $authyToken->verify(54321, $user->get('user')['id']); // Verify token
Intuitive Responses
Work Intuitively with Authy responses:
$body = $tokenVerified->body(); // Get all response body $code = $tokenVerified->statusCode(); // Get response status code $succeed = $tokenVerified->succeed(); // Check whether respose is a success $failed = $tokenVerified->failed(); // Check whether respose is a failure $message = $tokenVerified->message(); // Get response message $item = $tokenVerified->get('item'); // Get response body item $errors = $tokenVerified->errors(); // Get response errors
Note: All authy requests return authy response, with a unified interface for your convenience, so you can interact with all responses the same way as above.
Installation
-
Install the package via composer:
composer require rinvex/laravel-authy
-
If you don't have the following lines already, add them to your
config/services.php
file, before the end of the array:'authy' => [ 'secret' => env('AUTHY_SECRET'), ],
-
If you haven't already: Register an Authy account -> Sign in -> Access dashboard -> Create new application -> Copy your API Secret key
-
If you don't have the following lines already, add them to your project's
.env
file, at the end:AUTHY_SECRET=AuthySecretKey
Note: make sure to replace
AuthySecretKey
with your key from the previous step. -
Done! You can refer to Usage again.
Upgrade
-
Upgrading To
v2.x
Fromv1.x
API implementation is 100% backward compatible, but sandbox API has been dropped since it's officially deprecated. Also note that PHP7 is now required. Lastly the config options has been changed from
services.authy.mode
,services.authy.keys.production
, andservices.authy.keys.sandbox
to only one keyservices.authy.secret
for ease of use and consistency, accordingly the environment variablesAUTHY_MODE
,AUTHY_PRODUCTION_KEY
, andAUTHY_SANDBOX_KEY
are replaced with only one environment variableAUTHY_SECRET
.
Changelog
Refer to the Changelog for a full history of the project.
Support
The following support channels are available at your fingertips:
Contributing & Protocols
Thank you for considering contributing to this project! The contribution guide can be found in CONTRIBUTING.md.
Bug reports, feature requests, and pull requests are very welcome.
Security Vulnerabilities
If you discover a security vulnerability within this project, please send an e-mail to help@rinvex.com. All security vulnerabilities will be promptly addressed.
About Rinvex
Rinvex is a software solutions startup, specialized in integrated enterprise solutions for SMEs established in Alexandria, Egypt since June 2016. We believe that our drive The Value, The Reach, and The Impact is what differentiates us and unleash the endless possibilities of our philosophy through the power of software. We like to call it Innovation At The Speed Of Life. That’s how we do our share of advancing humanity.
Trademarks
- Authy™ is a trademark of Twilio Inc.
- Laravel™ is a trademark of TAYLOR OTWELL
License
This software is released under The MIT License (MIT).
(c) 2016-2022 Rinvex LLC, Some rights reserved.