for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Zored\Telegram\Madeline\Auth\Handler;
use danog\MadelineProto\MTProto;
use Zored\Telegram\Madeline\Config\Auth\AuthConfigInterface;
use Zored\Telegram\Madeline\Config\Auth\ClientAuth;
/**
* @property ClientAuth $config
*/
class ClientAuthHandler extends AbstractAuthHandler
{
* {@inheritdoc}
public function suits(AuthConfigInterface $config): bool
return parent::suits($config) || $config instanceof ClientAuth;
}
public function auth(MTProto $proto): void
parent::auth($proto);
if ($this->isAuthorized($proto)) {
return;
$proto->phone_login($this->config->getPhone());
$result = $proto->complete_phone_login($this->config->getCode());
if ('account.password' !== $result['_']) {
$proto->complete_2fa_login($this->config->getPassword());