Download the PHP package stealthfirems/laravel-otp-module without Composer
On this page you can find all versions of the php package stealthfirems/laravel-otp-module. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-otp-module
Introduction 🖖
This is the authentication module developed by StealthFireMS for authentication with the Laravel Frame Work. This module supports
- OTP Generaton and validation
- TOTP Generaton and validation
Installation 💽
Install via composer
Run Migrations
Notes
Responses are returned as objects to the calling functions. Repsonses are listed at the end of this doc.
Usage OTP
OTP Config
If you are using a custom auth contoller use the following to call any OTP related function.
Functions
-
$user_identifier
: The identity that will be tied to the OTP. E.G User ID $otp_token
: The code that is being validated for signin.
Sample
Responses
On Success
Does not exist
**Not Valid***
Expired
Delete expired tokens
You can add this artisan command to app/Console/Kernel.php
to automatically clean on scheduled
Usage TOTP
TOTP Config is in config/totp.php
:
Persistence
TOTP secrets are stored in the totps
table, linked to the users
table by user_id
.
Each user can have multiple TOTP secrets
Usage
generate_totp($user_id, $totp_name)
- Generates a new TOTP secret for the user (and optional name), saves it, and returns the secret and provisioning URI for QR code.
validate_totp($user_id, $totp_code)
- Validates the provided code against all of the user’s TOTP secrets.
Sample
Responses
On Success
Not Valid
Expired
Note:
- TOTP secrets are stored per user for persistence and multi-device support.
- Use the returned
uri
to generate a QR code for authenticator apps. - The TOTP logic is fully compatible with Google Authenticator and similar apps.