secret.php 484 B

12345678910111213
  1. <?php
  2. require_once '/usr/local/hestia/web/inc/2fa/loader.php';
  3. Loader::register('./','RobThree\\Auth');
  4. use \RobThree\Auth\TwoFactorAuth;
  5. $tfa = new TwoFactorAuth('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;