programmieren:php:otphp
OTPHP
OTPHP is a wonderful tool to handle OTPs in PHP. It can generate TOTPs from their given seeds that you can locally configure.
We use this in CSABM to bypass having to manually enter the TOTP every time by configuring the needed TOTP seed for every account locally using the Passbolt CLI.
Usage
It works really simple. Every TOTP has a certain seed that doesn't change (very smart amarite). Using that seed you can:
$totp = TOTP::create(<insert seed here>);
In CSABM it looks like this with the config:
$totp = TOTP::create(Configure::readOrFail($credentialsConfigPath . '.totp_seed'));
If you wanna output said OTP now you need to call the now() function like so:
$this->otp = $totp->now();
This is also how we use it in CSABM
programmieren/php/otphp.txt · Last modified: by admin
