mirror of
https://github.com/elyby/accounts.git
synced 2026-10-20 12:48:07 +05:30
21 lines
406 B
PHP
21 lines
406 B
PHP
<?php
|
|
namespace api\modules\accounts\models;
|
|
|
|
use common\models\Account;
|
|
use OTPHP\TOTP;
|
|
|
|
trait TotpHelper {
|
|
|
|
abstract public function getAccount(): Account;
|
|
|
|
protected function getTotp(): TOTP {
|
|
$account = $this->getAccount();
|
|
$totp = TOTP::create($account->otp_secret);
|
|
$totp->setLabel($account->email);
|
|
$totp->setIssuer('Ely.by');
|
|
|
|
return $totp;
|
|
}
|
|
|
|
}
|