如何使用电报API代码?

我在
https://my.telegram.org/apps注册并获得了api_hash和api_id以及公钥,现在我想使用这个功能
https://core.telegram.org/method/auth.sendCode

auth.sentCode#efed51d9 phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode;
auth.sentAppCode#e325edcf phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode;
---functions---
auth.sendCode#768d5f4d phone_number:string sms_type:int api_id:int api_hash:string lang_code:string = auth.SentCode;

查询示例

(auth.sendCode "79991234567" 1 32 "test-hash" "en")
=
(auth.sentCode
  phone_registered:(boolFalse)
  phone_code_hash:"2dc02d2cda9e615c84"
)

d16ff372 3939370b 33323139 37363534 00000001 00000020 73657409 61682d74 00006873 e77e812d
=
2215bcbd bc799737 63643212 32643230 39616463 35313665 00343863 e12b7901

我该如何使用此查询示例?

这个二进制文件是什么? ==> “d16ff372 3939370b 33323139 ….”

最佳答案 您无法直接开始向Telegram发送查询.创建api_hash和api_id是从Telegram API开始的基本步骤.希望你知道Telegram使用自己的协议’MTProto’.您可以在Telegram的官方网站上获得详细的描述.

根据Telegram Protocol,客户端和服务器使用Diffie-Hellman算法共享“授权密钥”(用于加密和解密).有关示例,请参阅https://core.telegram.org/mtproto/samples-auth_key.成功创建授权密钥后,我们可以开始调用称为RPC查询的Telegram API.

您也可以参考https://github.com/ex3ndr/telegram-api进行实施.

示例中的十六进制数据只是通过遵循算法进行的查询.

点赞