Exemplo n.º 1
0
    def read(data: BytesIO, *args: Any) -> "Password":
        flags = Int.read(data)

        has_recovery = True if flags & (1 << 0) else False
        has_secure_values = True if flags & (1 << 1) else False
        has_password = True if flags & (1 << 2) else False
        current_algo = TLObject.read(data) if flags & (1 << 2) else None

        srp_B = Bytes.read(data) if flags & (1 << 2) else None
        srp_id = Long.read(data) if flags & (1 << 2) else None
        hint = String.read(data) if flags & (1 << 3) else None
        email_unconfirmed_pattern = String.read(
            data) if flags & (1 << 4) else None
        new_algo = TLObject.read(data)

        new_secure_algo = TLObject.read(data)

        secure_random = Bytes.read(data)

        return Password(new_algo=new_algo,
                        new_secure_algo=new_secure_algo,
                        secure_random=secure_random,
                        has_recovery=has_recovery,
                        has_secure_values=has_secure_values,
                        has_password=has_password,
                        current_algo=current_algo,
                        srp_B=srp_B,
                        srp_id=srp_id,
                        hint=hint,
                        email_unconfirmed_pattern=email_unconfirmed_pattern)
Exemplo n.º 2
0
    def read(data: BytesIO, *args: Any) -> "PQInnerDataTempDc":
        # No flags

        pq = Bytes.read(data)

        p = Bytes.read(data)

        q = Bytes.read(data)

        nonce = Int128.read(data)

        server_nonce = Int128.read(data)

        new_nonce = Int256.read(data)

        dc = Int.read(data)

        expires_in = Int.read(data)

        return PQInnerDataTempDc(pq=pq,
                                 p=p,
                                 q=q,
                                 nonce=nonce,
                                 server_nonce=server_nonce,
                                 new_nonce=new_nonce,
                                 dc=dc,
                                 expires_in=expires_in)
Exemplo n.º 3
0
 def read(data: BytesIO, *args: Any) -> "ReuploadCdnFile":
     # No flags
     
     file_token = Bytes.read(data)
     
     request_token = Bytes.read(data)
     
     return ReuploadCdnFile(file_token=file_token, request_token=request_token)
Exemplo n.º 4
0
    def read(data: BytesIO, *args: Any) -> "SecureCredentialsEncrypted":
        # No flags

        data = Bytes.read(data)

        hash = Bytes.read(data)

        secret = Bytes.read(data)

        return SecureCredentialsEncrypted(data=data, hash=hash, secret=secret)
Exemplo n.º 5
0
    def read(data: BytesIO, *args: Any) -> "SecureData":
        # No flags

        data = Bytes.read(data)

        data_hash = Bytes.read(data)

        secret = Bytes.read(data)

        return SecureData(data=data, data_hash=data_hash, secret=secret)
    def read(data: BytesIO, *args: Any) -> "InputCheckPasswordSRP":
        # No flags

        srp_id = Long.read(data)

        A = Bytes.read(data)

        M1 = Bytes.read(data)

        return InputCheckPasswordSRP(srp_id=srp_id, A=A, M1=M1)
Exemplo n.º 7
0
 def read(data: BytesIO, *args: Any) -> "DhConfig":
     # No flags
     
     g = Int.read(data)
     
     p = Bytes.read(data)
     
     version = Int.read(data)
     
     random = Bytes.read(data)
     
     return DhConfig(g=g, p=p, version=version, random=random)
Exemplo n.º 8
0
 def read(data: BytesIO, *args: Any) -> "PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow":
     # No flags
     
     salt1 = Bytes.read(data)
     
     salt2 = Bytes.read(data)
     
     g = Int.read(data)
     
     p = Bytes.read(data)
     
     return PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow(salt1=salt1, salt2=salt2, g=g, p=p)
 def read(data: BytesIO, *args: Any) -> "FileCdnRedirect":
     # No flags
     
     dc_id = Int.read(data)
     
     file_token = Bytes.read(data)
     
     encryption_key = Bytes.read(data)
     
     encryption_iv = Bytes.read(data)
     
     file_hashes = TLObject.read(data)
     
     return FileCdnRedirect(dc_id=dc_id, file_token=file_token, encryption_key=encryption_key, encryption_iv=encryption_iv, file_hashes=file_hashes)
 def read(data: BytesIO, *args: Any) -> "InputSecureFileUploaded":
     # No flags
     
     id = Long.read(data)
     
     parts = Int.read(data)
     
     md5_checksum = String.read(data)
     
     file_hash = Bytes.read(data)
     
     secret = Bytes.read(data)
     
     return InputSecureFileUploaded(id=id, parts=parts, md5_checksum=md5_checksum, file_hash=file_hash, secret=secret)
Exemplo n.º 11
0
    def read(data: BytesIO, *args: Any) -> "Document":
        flags = Int.read(data)

        id = Long.read(data)

        access_hash = Long.read(data)

        file_reference = Bytes.read(data)

        date = Int.read(data)

        mime_type = String.read(data)

        size = Int.read(data)

        thumbs = TLObject.read(data) if flags & (1 << 0) else []

        video_thumbs = TLObject.read(data) if flags & (1 << 1) else []

        dc_id = Int.read(data)

        attributes = TLObject.read(data)

        return Document(id=id,
                        access_hash=access_hash,
                        file_reference=file_reference,
                        date=date,
                        mime_type=mime_type,
                        size=size,
                        dc_id=dc_id,
                        attributes=attributes,
                        thumbs=thumbs,
                        video_thumbs=video_thumbs)
Exemplo n.º 12
0
 def read(data: BytesIO, *args: Any) -> "ReqDHParams":
     # No flags
     
     nonce = Int128.read(data)
     
     server_nonce = Int128.read(data)
     
     p = Bytes.read(data)
     
     q = Bytes.read(data)
     
     public_key_fingerprint = Long.read(data)
     
     encrypted_data = Bytes.read(data)
     
     return ReqDHParams(nonce=nonce, server_nonce=server_nonce, p=p, q=q, public_key_fingerprint=public_key_fingerprint, encrypted_data=encrypted_data)
Exemplo n.º 13
0
 def read(data: BytesIO, *args: Any) -> "PhoneCall":
     flags = Int.read(data)
     
     p2p_allowed = True if flags & (1 << 5) else False
     video = True if flags & (1 << 6) else False
     id = Long.read(data)
     
     access_hash = Long.read(data)
     
     date = Int.read(data)
     
     admin_id = Int.read(data)
     
     participant_id = Int.read(data)
     
     g_a_or_b = Bytes.read(data)
     
     key_fingerprint = Long.read(data)
     
     protocol = TLObject.read(data)
     
     connections = TLObject.read(data)
     
     start_date = Int.read(data)
     
     return PhoneCall(id=id, access_hash=access_hash, date=date, admin_id=admin_id, participant_id=participant_id, g_a_or_b=g_a_or_b, key_fingerprint=key_fingerprint, protocol=protocol, connections=connections, start_date=start_date, p2p_allowed=p2p_allowed, video=video)
Exemplo n.º 14
0
 def read(data: BytesIO, *args: Any) -> "ServerDHInnerData":
     # No flags
     
     nonce = Int128.read(data)
     
     server_nonce = Int128.read(data)
     
     g = Int.read(data)
     
     dh_prime = Bytes.read(data)
     
     g_a = Bytes.read(data)
     
     server_time = Int.read(data)
     
     return ServerDHInnerData(nonce=nonce, server_nonce=server_nonce, g=g, dh_prime=dh_prime, g_a=g_a, server_time=server_time)
Exemplo n.º 15
0
    def read(data: BytesIO, *args: Any) -> "Photo":
        flags = Int.read(data)

        has_stickers = True if flags & (1 << 0) else False
        id = Long.read(data)

        access_hash = Long.read(data)

        file_reference = Bytes.read(data)

        date = Int.read(data)

        sizes = TLObject.read(data)

        video_sizes = TLObject.read(data) if flags & (1 << 1) else []

        dc_id = Int.read(data)

        return Photo(id=id,
                     access_hash=access_hash,
                     file_reference=file_reference,
                     date=date,
                     sizes=sizes,
                     dc_id=dc_id,
                     has_stickers=has_stickers,
                     video_sizes=video_sizes)
    def read(data: BytesIO, *args: Any) -> "PhoneCallAccepted":
        flags = Int.read(data)

        video = True if flags & (1 << 6) else False
        id = Long.read(data)

        access_hash = Long.read(data)

        date = Int.read(data)

        admin_id = Int.read(data)

        participant_id = Int.read(data)

        g_b = Bytes.read(data)

        protocol = TLObject.read(data)

        return PhoneCallAccepted(id=id,
                                 access_hash=access_hash,
                                 date=date,
                                 admin_id=admin_id,
                                 participant_id=participant_id,
                                 g_b=g_b,
                                 protocol=protocol,
                                 video=video)
Exemplo n.º 17
0
    def read(data: BytesIO,
             *args: Any) -> "SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000":
        # No flags

        salt = Bytes.read(data)

        return SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000(salt=salt)
Exemplo n.º 18
0
    def read(data: BytesIO, *args: Any) -> "SecureValue":
        flags = Int.read(data)

        type = TLObject.read(data)

        data = TLObject.read(data) if flags & (1 << 0) else None

        front_side = TLObject.read(data) if flags & (1 << 1) else None

        reverse_side = TLObject.read(data) if flags & (1 << 2) else None

        selfie = TLObject.read(data) if flags & (1 << 3) else None

        translation = TLObject.read(data) if flags & (1 << 6) else []

        files = TLObject.read(data) if flags & (1 << 4) else []

        plain_data = TLObject.read(data) if flags & (1 << 5) else None

        hash = Bytes.read(data)

        return SecureValue(type=type,
                           hash=hash,
                           data=data,
                           front_side=front_side,
                           reverse_side=reverse_side,
                           selfie=selfie,
                           translation=translation,
                           files=files,
                           plain_data=plain_data)
Exemplo n.º 19
0
    def read(data: BytesIO, *args: Any) -> "InputMediaInvoice":
        flags = Int.read(data)

        title = String.read(data)

        description = String.read(data)

        photo = TLObject.read(data) if flags & (1 << 0) else None

        invoice = TLObject.read(data)

        payload = Bytes.read(data)

        provider = String.read(data)

        provider_data = TLObject.read(data)

        start_param = String.read(data)

        return InputMediaInvoice(title=title,
                                 description=description,
                                 invoice=invoice,
                                 payload=payload,
                                 provider=provider,
                                 provider_data=provider_data,
                                 start_param=start_param,
                                 photo=photo)
Exemplo n.º 20
0
    def read(data: BytesIO, *args: Any) -> "PollAnswer":
        # No flags

        text = String.read(data)

        option = Bytes.read(data)

        return PollAnswer(text=text, option=option)
Exemplo n.º 21
0
    def read(data: BytesIO, *args: Any) -> "TmpPassword":
        # No flags

        tmp_password = Bytes.read(data)

        valid_until = Int.read(data)

        return TmpPassword(tmp_password=tmp_password, valid_until=valid_until)
Exemplo n.º 22
0
    def read(data: BytesIO, *args: Any) -> "ImportAuthorization":
        # No flags

        id = Int.read(data)

        bytes = Bytes.read(data)

        return ImportAuthorization(id=id, bytes=bytes)
    def read(data: BytesIO, *args: Any) -> "GetCdnFileHashes":
        # No flags

        file_token = Bytes.read(data)

        offset = Int.read(data)

        return GetCdnFileHashes(file_token=file_token, offset=offset)
Exemplo n.º 24
0
    def read(data: BytesIO, *args: Any) -> "KeyboardButtonCallback":
        # No flags

        text = String.read(data)

        data = Bytes.read(data)

        return KeyboardButtonCallback(text=text, data=data)
    def read(data: BytesIO, *args: Any) -> "InputPaymentCredentialsSaved":
        # No flags

        id = String.read(data)

        tmp_password = Bytes.read(data)

        return InputPaymentCredentialsSaved(id=id, tmp_password=tmp_password)
Exemplo n.º 26
0
    def read(data: BytesIO, *args: Any) -> "SendSignalingData":
        # No flags

        peer = TLObject.read(data)

        data = Bytes.read(data)

        return SendSignalingData(peer=peer, data=data)
    def read(data: BytesIO, *args: Any) -> "SecureValueHash":
        # No flags

        type = TLObject.read(data)

        hash = Bytes.read(data)

        return SecureValueHash(type=type, hash=hash)
Exemplo n.º 28
0
 def read(data: BytesIO, *args: Any) -> "LoginToken":
     # No flags
     
     expires = Int.read(data)
     
     token = Bytes.read(data)
     
     return LoginToken(expires=expires, token=token)
Exemplo n.º 29
0
 def read(data: BytesIO, *args: Any) -> "PhotoPathSize":
     # No flags
     
     type = String.read(data)
     
     bytes = Bytes.read(data)
     
     return PhotoPathSize(type=type, bytes=bytes)
    def read(data: BytesIO, *args: Any) -> "LoginTokenMigrateTo":
        # No flags

        dc_id = Int.read(data)

        token = Bytes.read(data)

        return LoginTokenMigrateTo(dc_id=dc_id, token=token)