grimpirate / halberd
CodeIgniter4 Google Two-Factor Authentication Module for Shield
dev-develop
2025-06-06 01:39 UTC
Requires
- php: ^7.4.3 || ^8.0
- ext-xmlwriter: *
- bacon/bacon-qr-code: ^2.0.7
- codeigniter4/settings: ^2.1
- codeigniter4/shield: dev-develop
- pragmarx/google2fa: ^8.0.0
This package is auto-updated.
Last update: 2025-06-06 01:39:17 UTC
README
A TOTP (Time-Based One-Time Password) Two-Factor Authentication Module for codeigniter4/shield
Installation
Project should have a stability level of dev
composer config minimum-stability dev
composer config prefer-stable true
composer require grimpirate/halberd:dev-develop
CLI Configuration
php spark halberd:ini
Manual Configuration
- Copy the configuration file from vendor/grimpirate/halberd/app/Config/TOTP.php to your project's app/Config/ directory
- Copy the stylesheet from vendor/grimpirate/halberd/public/css/totp.css to your project's app/public/css/ directory
- The view, register/login actions and the TOTP authenticator class must be added to the app/Config/Auth.php file
...
class Auth extends BaseConfig
{
...
public array $views = [
'action_totp_2fa' => '\GrimPirate\Halberd\Views\totp_2fa_show',
...
];
...
public array $actions = [
'register' => \GrimPirate\Halberd\Authentication\Actions\TOTPActivator::class,
'login' => \GrimPirate\Halberd\Authentication\Actions\TOTPActivator::class,
];
...
public array $authenticators = [
'totp' => \GrimPirate\Halberd\Authentication\Authenticators\TOTP::class,
...
];
...
Dependencies
The dependency pragmarx/google2fa requires that your server time be accurately synchronized (via NTP or some other means). CodeIgniter's appTimezone will not affect OTP generation.