Skip to content

A TOTP (Time-Based One-Time Password) Two-Factor Authentication Module for codeigniter4/shield

License

Notifications You must be signed in to change notification settings

grimpirate/halberd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Halberd

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

Configuration

The TOTP authenticator class must be added to the Config/Auth file

...

class Auth extends BaseConfig
{

  ...

  public array $authenticators = [
    'tokens'  => AccessTokens::class,
    'session' => Session::class,
    'hmac'    => HmacSha256::class,
    // 'jwt'     => JWT::class,
    'totp'    => \GrimPirate\Halberd\Authentication\Authenticators\TOTP::class,
  ];

  ...

A spark command is provided to finalize installation. It will use codeigniter4/settings to set up the configuration for: Auth.views, Auth.actions, TOTP.issuer and TOTP.stylesheet

php spark halberd:ini

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.

The QR Code will not be visible without creating a stylesheet and applying some basic styles, for instance

svg
{
  width: 100%;
  height: 240px;
  fill-rule: evenodd;
}

About

A TOTP (Time-Based One-Time Password) Two-Factor Authentication Module for codeigniter4/shield

Topics

Resources

License

Stars

Watchers

Forks

Languages