Trying to make sendCode work
This commit is contained in:
parent
2badf3f35e
commit
d1e7cce35b
@ -134,7 +134,18 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
|
||||
}
|
||||
$this->settings['authorization']['temp_auth_key'] = $this->create_auth_key($this->settings['authorization']['default_temp_auth_key_expires_in']);
|
||||
}
|
||||
$this->write_client_info();
|
||||
$nearestDc = $this->method_call('auth.sendCode', [
|
||||
'phone_number' => '393373737',
|
||||
'sms_type' => 5,
|
||||
'api_id' => $this->settings['app_info']['api_id'],
|
||||
'api_hash' => $this->settings['app_info']['api_hash'],
|
||||
'lang_code' => $this->settings['app_info']['lang_code'],
|
||||
]);
|
||||
var_dump($nearestDc);
|
||||
}
|
||||
|
||||
public function write_client_info() {
|
||||
$nearestDc = $this->method_call('invokeWithLayer', [
|
||||
'layer' => $this->settings['tl_schema']['layer'],
|
||||
'query' => $this->tl->serialize_method('initConnection',
|
||||
@ -151,7 +162,6 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
|
||||
$this->connection->dc_connect($nearestDc['nearest_dc']);
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
unset($this->sock);
|
||||
|
@ -458,4 +458,9 @@ class AuthKeyHandler extends AckHandler
|
||||
|
||||
throw new Exception('Auth Failed');
|
||||
}
|
||||
public function bind_temp_auth_key($expires_in = 86400) {
|
||||
$nonce = $this->struct->unpack('<q', \phpseclib\Crypt\Random::string(8));
|
||||
$expires_at = time() + $expires_in;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -91,10 +91,14 @@ class TL extends \danog\MadelineProto\Tools
|
||||
$bytes_io .= $this->struct->pack('<i', $tl_method->id);
|
||||
foreach ($tl_method->params as $arg) {
|
||||
if (!isset($kwargs[$arg['name']])) {
|
||||
if ($arg['opt']) {
|
||||
continue;
|
||||
if ($arg['name'] == 'flags') {
|
||||
$kwargs['flags'] = 0;
|
||||
} else {
|
||||
if ($arg['opt']) {
|
||||
continue;
|
||||
}
|
||||
throw new Exception('Missing required parameter ('.$arg['name'].')');
|
||||
}
|
||||
throw new Exception('Missing required parameter ('.$arg['name'].')');
|
||||
}
|
||||
$bytes_io .= $this->serialize_param($arg['type'], $arg['subtype'], $kwargs[$arg['name']]);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class TLConstructor
|
||||
$this->params = $json_dict['params'];
|
||||
foreach ($this->params as &$param) {
|
||||
$param['opt'] = false;
|
||||
$param['subtype'] = '';
|
||||
$param['subtype'] = null;
|
||||
if (preg_match('/^flags\.\d\?/', $param['type'])) {
|
||||
$param['opt'] = true;
|
||||
$param['flag'] = preg_replace(['/^flags\./', '/\?.*/'], '', $param['type']);
|
||||
|
@ -22,7 +22,7 @@ class TLMethod
|
||||
$this->params = $json_dict['params'];
|
||||
foreach ($this->params as &$param) {
|
||||
$param['opt'] = false;
|
||||
$param['subtype'] = '';
|
||||
$param['subtype'] = null;
|
||||
if (preg_match('/^flags\.\d\?/', $param['type'])) {
|
||||
$param['opt'] = true;
|
||||
$param['flag'] = preg_replace(['/^flags\./', '/\?.*/'], '', $param['type']);
|
||||
|
Loading…
Reference in New Issue
Block a user