First attempt at TelegramClient. Added fixes and doc

This commit is contained in:
Lonami
2016-09-04 11:07:18 +02:00
parent c863537b7b
commit 39a23559f0
19 changed files with 256 additions and 65 deletions

View File

@@ -4,18 +4,21 @@
# https://github.com/sochix/TLSharp/blob/master/TLSharp.Core/Auth/Step2_DHExchange.cs
# https://github.com/sochix/TLSharp/blob/master/TLSharp.Core/Auth/Step3_CompleteDHExchange.cs
from network.mtproto_plain_sender import MtProtoPlainSender
from utils.binary_writer import BinaryWriter
from utils.binary_reader import BinaryReader
from utils.factorizator import Factorizator
from utils.auth_key import AuthKey
import utils.helpers as utils
import time
from utils.rsa import RSA
from utils.aes import AES
import utils.helpers as utils
from crypto.aes import AES
from crypto.auth_key import AuthKey
from crypto.factorizator import Factorizator
from crypto.rsa import RSA
from network.mtproto_plain_sender import MtProtoPlainSender
from utils.binary_reader import BinaryReader
from utils.binary_writer import BinaryWriter
def do_authentication(transport):
"""Executes the authentication process with the Telegram servers.
If no error is rose, returns both the authorization key and the time offset"""
sender = MtProtoPlainSender(transport)
# Step 1 sending: PQ Request
@@ -201,4 +204,4 @@ def do_authentication(transport):
def get_fingerprint_text(fingerprint):
"""Gets a fingerprint text in 01-23-45-67-89-AB-CD-EF format (no hyphens)"""
return ''.join(hex(b)[2:].rjust(2, '0').upper() for b in fingerprint)
return ''.join(hex(b)[2:].rjust(2, '0').upper() for b in fingerprint)