secret.php 507 B

123456789101112
  1. <?php
  2. use RobThree\Auth\TwoFactorAuth;
  3. use RobThree\Auth\Providers\Qr\QRServerProvider;
  4. require_once __DIR__ . "/../vendor/autoload.php";
  5. $tfa = new TwoFactorAuth(new QRServerProvider(), "Hestia Control Panel");
  6. $secret = $tfa->createSecret(160); // Though the default is an 80 bits secret (for backwards compatibility reasons) we recommend creating 160+ bits secrets (see RFC 4226 - Algorithm Requirements)
  7. $qrcode = $tfa->getQRCodeImageAsDataUri(gethostname(), $secret);
  8. echo $secret . "-" . $qrcode;