@mtkruto/node 0.62.1 → 0.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/2_tl.d.ts +6 -6
- package/esm/2_tl.d.ts.map +1 -1
- package/esm/2_tl.js +6 -6
- package/esm/3_errors.d.ts +1 -2
- package/esm/3_errors.d.ts.map +1 -1
- package/esm/3_errors.js +2 -1
- package/esm/4_constants.d.ts +0 -1
- package/esm/4_constants.d.ts.map +1 -1
- package/esm/4_constants.js +0 -1
- package/esm/4_errors.d.ts +2 -2
- package/esm/4_errors.d.ts.map +1 -1
- package/esm/4_session.d.ts +24 -0
- package/esm/4_session.d.ts.map +1 -0
- package/esm/4_session.js +23 -0
- package/esm/5_client.d.ts +1 -1
- package/esm/5_client.js +1 -1
- package/esm/client/0_client_abstract.d.ts +28 -26
- package/esm/client/0_client_abstract.d.ts.map +1 -1
- package/esm/client/0_client_abstract.js +16 -88
- package/esm/client/0_params.d.ts +5 -0
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/0_password.d.ts.map +1 -1
- package/esm/client/0_password.js +2 -2
- package/esm/client/0_storage_operations.d.ts +4 -4
- package/esm/client/0_storage_operations.d.ts.map +1 -1
- package/esm/client/0_storage_operations.js +14 -14
- package/esm/client/0_update_processor.d.ts +19 -0
- package/esm/client/0_update_processor.d.ts.map +1 -1
- package/esm/client/0_update_processor.js +19 -0
- package/esm/client/0_utilities.d.ts +6 -2
- package/esm/client/0_utilities.d.ts.map +1 -1
- package/esm/client/0_utilities.js +21 -23
- package/esm/client/1_client_plain.d.ts +9 -6
- package/esm/client/1_client_plain.d.ts.map +1 -1
- package/esm/client/1_client_plain.js +26 -41
- package/esm/client/1_types.d.ts +4 -23
- package/esm/client/1_types.d.ts.map +1 -1
- package/esm/client/2_account_manager.js +10 -10
- package/esm/client/2_business_connection_manager.d.ts.map +1 -1
- package/esm/client/2_business_connection_manager.js +4 -4
- package/esm/client/2_client_encrypted.d.ts +58 -0
- package/esm/client/2_client_encrypted.d.ts.map +1 -0
- package/esm/client/2_client_encrypted.js +265 -0
- package/esm/client/2_file_manager.d.ts.map +1 -1
- package/esm/client/2_file_manager.js +54 -74
- package/esm/client/2_network_statistics_manager.d.ts +1 -1
- package/esm/client/2_network_statistics_manager.d.ts.map +1 -1
- package/esm/client/2_network_statistics_manager.js +3 -3
- package/esm/client/2_payment_manager.d.ts.map +1 -1
- package/esm/client/2_payment_manager.js +3 -3
- package/esm/client/2_reaction_manager.d.ts.map +1 -1
- package/esm/client/2_reaction_manager.js +10 -10
- package/esm/client/2_translations_manager.d.ts +19 -0
- package/esm/client/2_translations_manager.d.ts.map +1 -1
- package/esm/client/2_translations_manager.js +24 -5
- package/esm/client/2_update_manager.d.ts +4 -4
- package/esm/client/2_update_manager.d.ts.map +1 -1
- package/esm/client/2_update_manager.js +69 -79
- package/esm/client/3_client_encrypted_pool.d.ts +30 -0
- package/esm/client/3_client_encrypted_pool.d.ts.map +1 -0
- package/esm/client/3_client_encrypted_pool.js +70 -0
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +96 -70
- package/esm/client/3_video_chat_manager.d.ts.map +1 -1
- package/esm/client/3_video_chat_manager.js +15 -20
- package/esm/client/4_callback_query_manager.d.ts.map +1 -1
- package/esm/client/4_callback_query_manager.js +2 -2
- package/esm/client/4_chat_list_manager.d.ts.map +1 -1
- package/esm/client/4_chat_list_manager.js +33 -33
- package/esm/client/4_chat_manager.d.ts.map +1 -1
- package/esm/client/4_chat_manager.js +25 -25
- package/esm/client/4_gift_manager.js +2 -2
- package/esm/client/4_inline_query_manager.d.ts.map +1 -1
- package/esm/client/4_inline_query_manager.js +4 -4
- package/esm/client/4_poll_manager.d.ts.map +1 -1
- package/esm/client/4_poll_manager.js +5 -5
- package/esm/client/4_story_manager.d.ts.map +1 -1
- package/esm/client/4_story_manager.js +10 -10
- package/esm/client/5_client.d.ts +3 -9
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +290 -306
- package/esm/connection/0_connection.d.ts +5 -4
- package/esm/connection/0_connection.d.ts.map +1 -1
- package/esm/connection/1_connection_web_socket.js +2 -2
- package/esm/mod.d.ts +1 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +1 -1
- package/{script/tl/2_tl_reader.d.ts → esm/session/0_session_error.d.ts} +4 -7
- package/esm/session/0_session_error.d.ts.map +1 -0
- package/esm/{tl/2_tl_reader.d.ts → session/0_session_error.js} +5 -7
- package/esm/{tl/2_tl_writer.d.ts → session/0_session_state.d.ts} +7 -5
- package/esm/session/0_session_state.d.ts.map +1 -0
- package/esm/session/0_session_state.js +77 -0
- package/esm/session/1_session.d.ts +31 -0
- package/esm/session/1_session.d.ts.map +1 -0
- package/esm/session/1_session.js +149 -0
- package/esm/session/2_session_encrypted.d.ts +40 -0
- package/esm/session/2_session_encrypted.d.ts.map +1 -0
- package/esm/session/2_session_encrypted.js +416 -0
- package/esm/session/2_session_plain.d.ts +25 -0
- package/esm/session/2_session_plain.d.ts.map +1 -0
- package/esm/session/2_session_plain.js +56 -0
- package/esm/tl/0_tl_error.d.ts +22 -0
- package/esm/tl/0_tl_error.d.ts.map +1 -0
- package/esm/tl/0_tl_error.js +21 -0
- package/esm/tl/0_types.d.ts +25 -0
- package/esm/tl/0_types.d.ts.map +1 -0
- package/esm/tl/0_types.js +20 -0
- package/esm/tl/0_utilities.d.ts +32 -0
- package/esm/tl/0_utilities.d.ts.map +1 -0
- package/esm/tl/0_utilities.js +51 -0
- package/esm/tl/0_utilities_test.d.ts.map +1 -0
- package/esm/tl/1_mtproto_api.d.ts +371 -0
- package/esm/tl/1_mtproto_api.d.ts.map +1 -0
- package/esm/tl/1_mtproto_api.js +416 -0
- package/esm/tl/{0_api.d.ts → 1_telegram_api.d.ts} +23 -340
- package/esm/tl/1_telegram_api.d.ts.map +1 -0
- package/esm/tl/{0_api.js → 1_telegram_api.js} +4945 -11109
- package/{script/tl/0_tl_raw_reader.d.ts → esm/tl/1_tl_reader.d.ts} +5 -2
- package/esm/tl/1_tl_reader.d.ts.map +1 -0
- package/esm/tl/{2_tl_reader.js → 1_tl_reader.js} +107 -40
- package/esm/tl/1_tl_reader_test.d.ts.map +1 -0
- package/esm/tl/{0_tl_raw_writer.d.ts → 1_tl_writer.d.ts} +5 -2
- package/esm/tl/1_tl_writer.d.ts.map +1 -0
- package/esm/tl/{2_tl_writer.js → 1_tl_writer.js} +80 -23
- package/esm/tl/1_tl_writer_test.d.ts.map +1 -0
- package/esm/tl/1_utilities.d.ts +9 -24
- package/esm/tl/1_utilities.d.ts.map +1 -1
- package/esm/tl/1_utilities.js +18 -64
- package/esm/tl/2_message.d.ts +2 -2
- package/esm/tl/2_message.d.ts.map +1 -1
- package/esm/tl/2_message.js +7 -7
- package/esm/tl/2_mtproto.d.ts +33 -0
- package/esm/tl/2_mtproto.d.ts.map +1 -0
- package/esm/tl/2_mtproto.js +53 -0
- package/{script/tl/2_utilities.d.ts → esm/tl/2_telegram.d.ts} +16 -2
- package/esm/tl/2_telegram.d.ts.map +1 -0
- package/esm/tl/{2_utilities.js → 2_telegram.js} +46 -1
- package/esm/transport/0_transport.d.ts +1 -1
- package/esm/transport/0_transport.d.ts.map +1 -1
- package/esm/types/0_chat_photo.d.ts.map +1 -1
- package/esm/types/0_chat_photo.js +2 -2
- package/esm/types/0_giveaway_parameters.d.ts.map +1 -1
- package/esm/types/0_giveaway_parameters.js +3 -3
- package/esm/types/0_location.d.ts.map +1 -1
- package/esm/types/0_location.js +5 -5
- package/esm/types/0_message_entity.d.ts.map +1 -1
- package/esm/types/0_message_entity.js +20 -20
- package/esm/types/0_reaction.d.ts.map +1 -1
- package/esm/types/0_reaction.js +4 -4
- package/esm/types/0_slow_mode_duration.d.ts +19 -0
- package/esm/types/0_slow_mode_duration.d.ts.map +1 -1
- package/esm/types/0_slow_mode_duration.js +19 -0
- package/esm/types/0_thumbnail.d.ts.map +1 -1
- package/esm/types/0_thumbnail.js +3 -3
- package/esm/types/0_translation.d.ts +19 -0
- package/esm/types/0_translation.d.ts.map +1 -1
- package/esm/types/0_translation.js +22 -3
- package/esm/types/0_video_chat.d.ts.map +1 -1
- package/esm/types/0_video_chat.js +2 -2
- package/esm/types/1_animation.d.ts.map +1 -1
- package/esm/types/1_animation.js +2 -2
- package/esm/types/1_audio.d.ts.map +1 -1
- package/esm/types/1_audio.js +2 -2
- package/esm/types/1_bot_command_scope.d.ts.map +1 -1
- package/esm/types/1_bot_command_scope.js +2 -2
- package/esm/types/1_chat_p.d.ts.map +1 -1
- package/esm/types/1_chat_p.js +6 -6
- package/esm/types/1_document.d.ts.map +1 -1
- package/esm/types/1_document.js +2 -2
- package/esm/types/1_keyboard_button.d.ts.map +1 -1
- package/esm/types/1_keyboard_button.js +10 -10
- package/esm/types/1_message_reaction.d.ts.map +1 -1
- package/esm/types/1_message_reaction.js +6 -6
- package/esm/types/1_photo.d.ts.map +1 -1
- package/esm/types/1_photo.js +3 -3
- package/esm/types/1_sticker.d.ts.map +1 -1
- package/esm/types/1_sticker.js +8 -8
- package/esm/types/1_story_privacy.d.ts.map +1 -1
- package/esm/types/1_story_privacy.js +7 -7
- package/esm/types/1_user.d.ts.map +1 -1
- package/esm/types/1_user.js +2 -2
- package/esm/types/1_venue.d.ts.map +1 -1
- package/esm/types/1_venue.js +2 -2
- package/esm/types/1_video.d.ts.map +1 -1
- package/esm/types/1_video.js +2 -2
- package/esm/types/1_video_note.d.ts.map +1 -1
- package/esm/types/1_video_note.js +2 -2
- package/esm/types/2_chat.d.ts.map +1 -1
- package/esm/types/2_chat.js +8 -8
- package/esm/types/2_chat_member.d.ts.map +1 -1
- package/esm/types/2_chat_member.js +10 -10
- package/esm/types/2_chat_settings.d.ts +19 -0
- package/esm/types/2_chat_settings.d.ts.map +1 -1
- package/esm/types/2_chat_settings.js +21 -2
- package/esm/types/2_chosen_inline_result.d.ts.map +1 -1
- package/esm/types/2_chosen_inline_result.js +4 -4
- package/esm/types/2_game.d.ts.map +1 -1
- package/esm/types/2_game.js +4 -4
- package/esm/types/2_gift_upgraded_component.d.ts.map +1 -1
- package/esm/types/2_gift_upgraded_component.js +3 -3
- package/esm/types/2_inactive_chat.d.ts.map +1 -1
- package/esm/types/2_inactive_chat.js +2 -2
- package/esm/types/2_inline_keyboard_button.d.ts.map +1 -1
- package/esm/types/2_inline_keyboard_button.js +10 -10
- package/esm/types/2_inline_query.d.ts.map +1 -1
- package/esm/types/2_inline_query.js +7 -7
- package/esm/types/2_message_reactions.d.ts.map +1 -1
- package/esm/types/2_message_reactions.js +2 -2
- package/esm/types/2_story_content.d.ts.map +1 -1
- package/esm/types/2_story_content.js +6 -6
- package/esm/types/2_story_interactive_area.d.ts.map +1 -1
- package/esm/types/2_story_interactive_area.js +9 -9
- package/esm/types/3_chat_member_updated.d.ts.map +1 -1
- package/esm/types/3_chat_member_updated.js +2 -2
- package/esm/types/3_gift.d.ts.map +1 -1
- package/esm/types/3_gift.js +3 -3
- package/esm/types/3_join_request.d.ts.map +1 -1
- package/esm/types/3_join_request.js +2 -2
- package/esm/types/3_reply_markup.d.ts.map +1 -1
- package/esm/types/3_reply_markup.js +5 -5
- package/esm/types/4_claimed_gift.d.ts.map +1 -1
- package/esm/types/4_claimed_gift.js +2 -2
- package/esm/types/4_inline_query_result.d.ts.map +1 -1
- package/esm/types/4_inline_query_result.js +14 -14
- package/esm/types/4_message.d.ts.map +1 -1
- package/esm/types/4_message.js +57 -57
- package/esm/types/5_callback_query.d.ts.map +1 -1
- package/esm/types/5_callback_query.js +6 -7
- package/esm/types/5_chat_list_item.d.ts.map +1 -1
- package/esm/types/5_chat_list_item.js +5 -5
- package/esm/types/5_claimed_gifts.d.ts.map +1 -1
- package/esm/types/5_claimed_gifts.js +6 -6
- package/esm/types/_file_id.d.ts.map +1 -1
- package/esm/types/_file_id.js +3 -3
- package/package.json +1 -1
- package/script/2_tl.d.ts +6 -6
- package/script/2_tl.d.ts.map +1 -1
- package/script/2_tl.js +11 -11
- package/script/3_errors.d.ts +1 -2
- package/script/3_errors.d.ts.map +1 -1
- package/script/3_errors.js +2 -1
- package/script/4_constants.d.ts +0 -1
- package/script/4_constants.d.ts.map +1 -1
- package/script/4_constants.js +1 -2
- package/script/4_errors.d.ts +2 -2
- package/script/4_errors.d.ts.map +1 -1
- package/script/4_session.d.ts +24 -0
- package/script/4_session.d.ts.map +1 -0
- package/script/4_session.js +39 -0
- package/script/5_client.d.ts +1 -1
- package/script/5_client.js +1 -1
- package/script/client/0_client_abstract.d.ts +28 -26
- package/script/client/0_client_abstract.d.ts.map +1 -1
- package/script/client/0_client_abstract.js +18 -113
- package/script/client/0_params.d.ts +5 -0
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/0_password.d.ts.map +1 -1
- package/script/client/0_password.js +1 -1
- package/script/client/0_storage_operations.d.ts +4 -4
- package/script/client/0_storage_operations.d.ts.map +1 -1
- package/script/client/0_storage_operations.js +13 -13
- package/script/client/0_update_processor.d.ts +19 -0
- package/script/client/0_update_processor.d.ts.map +1 -1
- package/script/client/0_update_processor.js +19 -0
- package/script/client/0_utilities.d.ts +6 -2
- package/script/client/0_utilities.d.ts.map +1 -1
- package/script/client/0_utilities.js +22 -24
- package/script/client/1_client_plain.d.ts +9 -6
- package/script/client/1_client_plain.d.ts.map +1 -1
- package/script/client/1_client_plain.js +25 -40
- package/script/client/1_types.d.ts +4 -23
- package/script/client/1_types.d.ts.map +1 -1
- package/script/client/2_account_manager.js +9 -9
- package/script/client/2_business_connection_manager.d.ts.map +1 -1
- package/script/client/2_business_connection_manager.js +3 -3
- package/script/client/2_client_encrypted.d.ts +58 -0
- package/script/client/2_client_encrypted.d.ts.map +1 -0
- package/script/client/2_client_encrypted.js +269 -0
- package/script/client/2_file_manager.d.ts.map +1 -1
- package/script/client/2_file_manager.js +52 -72
- package/script/client/2_network_statistics_manager.d.ts +1 -1
- package/script/client/2_network_statistics_manager.d.ts.map +1 -1
- package/script/client/2_network_statistics_manager.js +3 -3
- package/script/client/2_payment_manager.d.ts.map +1 -1
- package/script/client/2_payment_manager.js +2 -2
- package/script/client/2_reaction_manager.d.ts.map +1 -1
- package/script/client/2_reaction_manager.js +9 -9
- package/script/client/2_translations_manager.d.ts +19 -0
- package/script/client/2_translations_manager.d.ts.map +1 -1
- package/script/client/2_translations_manager.js +23 -4
- package/script/client/2_update_manager.d.ts +4 -4
- package/script/client/2_update_manager.d.ts.map +1 -1
- package/script/client/2_update_manager.js +68 -78
- package/script/client/3_client_encrypted_pool.d.ts +30 -0
- package/script/client/3_client_encrypted_pool.d.ts.map +1 -0
- package/script/client/3_client_encrypted_pool.js +74 -0
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +95 -69
- package/script/client/3_video_chat_manager.d.ts.map +1 -1
- package/script/client/3_video_chat_manager.js +14 -19
- package/script/client/4_callback_query_manager.d.ts.map +1 -1
- package/script/client/4_callback_query_manager.js +1 -1
- package/script/client/4_chat_list_manager.d.ts.map +1 -1
- package/script/client/4_chat_list_manager.js +32 -32
- package/script/client/4_chat_manager.d.ts.map +1 -1
- package/script/client/4_chat_manager.js +24 -24
- package/script/client/4_gift_manager.js +1 -1
- package/script/client/4_inline_query_manager.d.ts.map +1 -1
- package/script/client/4_inline_query_manager.js +3 -3
- package/script/client/4_poll_manager.d.ts.map +1 -1
- package/script/client/4_poll_manager.js +4 -4
- package/script/client/4_story_manager.d.ts.map +1 -1
- package/script/client/4_story_manager.js +9 -9
- package/script/client/5_client.d.ts +3 -9
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +284 -300
- package/script/connection/0_connection.d.ts +5 -4
- package/script/connection/0_connection.d.ts.map +1 -1
- package/script/connection/1_connection_web_socket.js +2 -2
- package/script/mod.d.ts +1 -1
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +1 -2
- package/script/session/0_session_error.d.ts +24 -0
- package/script/session/0_session_error.d.ts.map +1 -0
- package/script/session/0_session_error.js +29 -0
- package/script/{tl/2_tl_writer.d.ts → session/0_session_state.d.ts} +7 -5
- package/script/session/0_session_state.d.ts.map +1 -0
- package/script/session/0_session_state.js +81 -0
- package/script/session/1_session.d.ts +31 -0
- package/script/session/1_session.d.ts.map +1 -0
- package/script/session/1_session.js +176 -0
- package/script/session/2_session_encrypted.d.ts +40 -0
- package/script/session/2_session_encrypted.d.ts.map +1 -0
- package/script/session/2_session_encrypted.js +420 -0
- package/script/session/2_session_plain.d.ts +25 -0
- package/script/session/2_session_plain.d.ts.map +1 -0
- package/script/session/2_session_plain.js +60 -0
- package/script/tl/0_tl_error.d.ts +22 -0
- package/script/tl/0_tl_error.d.ts.map +1 -0
- package/script/tl/0_tl_error.js +25 -0
- package/script/tl/0_types.d.ts +25 -0
- package/script/tl/0_types.d.ts.map +1 -0
- package/script/tl/0_types.js +21 -0
- package/script/tl/0_utilities.d.ts +32 -0
- package/script/tl/0_utilities.d.ts.map +1 -0
- package/script/tl/0_utilities.js +59 -0
- package/script/tl/0_utilities_test.d.ts.map +1 -0
- package/script/tl/1_mtproto_api.d.ts +371 -0
- package/script/tl/1_mtproto_api.d.ts.map +1 -0
- package/script/tl/1_mtproto_api.js +419 -0
- package/script/tl/{0_api.d.ts → 1_telegram_api.d.ts} +23 -340
- package/script/tl/1_telegram_api.d.ts.map +1 -0
- package/script/tl/{0_api.js → 1_telegram_api.js} +4947 -11134
- package/{esm/tl/0_tl_raw_reader.d.ts → script/tl/1_tl_reader.d.ts} +5 -2
- package/script/tl/1_tl_reader.d.ts.map +1 -0
- package/script/tl/1_tl_reader.js +218 -0
- package/script/tl/1_tl_reader_test.d.ts.map +1 -0
- package/script/tl/{0_tl_raw_writer.d.ts → 1_tl_writer.d.ts} +5 -2
- package/script/tl/1_tl_writer.d.ts.map +1 -0
- package/script/tl/{2_tl_writer.js → 1_tl_writer.js} +102 -45
- package/script/tl/1_tl_writer_test.d.ts.map +1 -0
- package/script/tl/1_utilities.d.ts +9 -24
- package/script/tl/1_utilities.d.ts.map +1 -1
- package/script/tl/1_utilities.js +19 -72
- package/script/tl/2_message.d.ts +2 -2
- package/script/tl/2_message.d.ts.map +1 -1
- package/script/tl/2_message.js +7 -7
- package/script/tl/2_mtproto.d.ts +33 -0
- package/script/tl/2_mtproto.d.ts.map +1 -0
- package/script/tl/2_mtproto.js +78 -0
- package/{esm/tl/2_utilities.d.ts → script/tl/2_telegram.d.ts} +16 -2
- package/script/tl/2_telegram.d.ts.map +1 -0
- package/script/tl/2_telegram.js +167 -0
- package/script/transport/0_transport.d.ts +1 -1
- package/script/transport/0_transport.d.ts.map +1 -1
- package/script/types/0_chat_photo.d.ts.map +1 -1
- package/script/types/0_chat_photo.js +1 -1
- package/script/types/0_giveaway_parameters.d.ts.map +1 -1
- package/script/types/0_giveaway_parameters.js +2 -2
- package/script/types/0_location.d.ts.map +1 -1
- package/script/types/0_location.js +4 -4
- package/script/types/0_message_entity.d.ts.map +1 -1
- package/script/types/0_message_entity.js +19 -19
- package/script/types/0_reaction.d.ts.map +1 -1
- package/script/types/0_reaction.js +3 -3
- package/script/types/0_slow_mode_duration.d.ts +19 -0
- package/script/types/0_slow_mode_duration.d.ts.map +1 -1
- package/script/types/0_slow_mode_duration.js +19 -0
- package/script/types/0_thumbnail.d.ts.map +1 -1
- package/script/types/0_thumbnail.js +2 -2
- package/script/types/0_translation.d.ts +19 -0
- package/script/types/0_translation.d.ts.map +1 -1
- package/script/types/0_translation.js +21 -2
- package/script/types/0_video_chat.d.ts.map +1 -1
- package/script/types/0_video_chat.js +1 -1
- package/script/types/1_animation.d.ts.map +1 -1
- package/script/types/1_animation.js +1 -1
- package/script/types/1_audio.d.ts.map +1 -1
- package/script/types/1_audio.js +1 -1
- package/script/types/1_bot_command_scope.d.ts.map +1 -1
- package/script/types/1_bot_command_scope.js +1 -1
- package/script/types/1_chat_p.d.ts.map +1 -1
- package/script/types/1_chat_p.js +5 -5
- package/script/types/1_document.d.ts.map +1 -1
- package/script/types/1_document.js +1 -1
- package/script/types/1_keyboard_button.d.ts.map +1 -1
- package/script/types/1_keyboard_button.js +9 -9
- package/script/types/1_message_reaction.d.ts.map +1 -1
- package/script/types/1_message_reaction.js +5 -5
- package/script/types/1_photo.d.ts.map +1 -1
- package/script/types/1_photo.js +2 -2
- package/script/types/1_sticker.d.ts.map +1 -1
- package/script/types/1_sticker.js +7 -7
- package/script/types/1_story_privacy.d.ts.map +1 -1
- package/script/types/1_story_privacy.js +6 -6
- package/script/types/1_user.d.ts.map +1 -1
- package/script/types/1_user.js +1 -1
- package/script/types/1_venue.d.ts.map +1 -1
- package/script/types/1_venue.js +1 -1
- package/script/types/1_video.d.ts.map +1 -1
- package/script/types/1_video.js +1 -1
- package/script/types/1_video_note.d.ts.map +1 -1
- package/script/types/1_video_note.js +1 -1
- package/script/types/2_chat.d.ts.map +1 -1
- package/script/types/2_chat.js +7 -7
- package/script/types/2_chat_member.d.ts.map +1 -1
- package/script/types/2_chat_member.js +9 -9
- package/script/types/2_chat_settings.d.ts +19 -0
- package/script/types/2_chat_settings.d.ts.map +1 -1
- package/script/types/2_chat_settings.js +20 -1
- package/script/types/2_chosen_inline_result.d.ts.map +1 -1
- package/script/types/2_chosen_inline_result.js +3 -3
- package/script/types/2_game.d.ts.map +1 -1
- package/script/types/2_game.js +3 -3
- package/script/types/2_gift_upgraded_component.d.ts.map +1 -1
- package/script/types/2_gift_upgraded_component.js +2 -2
- package/script/types/2_inactive_chat.d.ts.map +1 -1
- package/script/types/2_inactive_chat.js +1 -1
- package/script/types/2_inline_keyboard_button.d.ts.map +1 -1
- package/script/types/2_inline_keyboard_button.js +9 -9
- package/script/types/2_inline_query.d.ts.map +1 -1
- package/script/types/2_inline_query.js +6 -6
- package/script/types/2_message_reactions.d.ts.map +1 -1
- package/script/types/2_message_reactions.js +1 -1
- package/script/types/2_story_content.d.ts.map +1 -1
- package/script/types/2_story_content.js +5 -5
- package/script/types/2_story_interactive_area.d.ts.map +1 -1
- package/script/types/2_story_interactive_area.js +8 -8
- package/script/types/3_chat_member_updated.d.ts.map +1 -1
- package/script/types/3_chat_member_updated.js +1 -1
- package/script/types/3_gift.d.ts.map +1 -1
- package/script/types/3_gift.js +2 -2
- package/script/types/3_join_request.d.ts.map +1 -1
- package/script/types/3_join_request.js +1 -1
- package/script/types/3_reply_markup.d.ts.map +1 -1
- package/script/types/3_reply_markup.js +4 -4
- package/script/types/4_claimed_gift.d.ts.map +1 -1
- package/script/types/4_claimed_gift.js +1 -1
- package/script/types/4_inline_query_result.d.ts.map +1 -1
- package/script/types/4_inline_query_result.js +13 -13
- package/script/types/4_message.d.ts.map +1 -1
- package/script/types/4_message.js +56 -56
- package/script/types/5_callback_query.d.ts.map +1 -1
- package/script/types/5_callback_query.js +5 -6
- package/script/types/5_chat_list_item.d.ts.map +1 -1
- package/script/types/5_chat_list_item.js +4 -4
- package/script/types/5_claimed_gifts.d.ts.map +1 -1
- package/script/types/5_claimed_gifts.js +5 -5
- package/script/types/_file_id.d.ts.map +1 -1
- package/script/types/_file_id.js +2 -2
- package/esm/client/0_message.d.ts +0 -29
- package/esm/client/0_message.d.ts.map +0 -1
- package/esm/client/0_message.js +0 -83
- package/esm/client/1_client_encrypted.d.ts +0 -52
- package/esm/client/1_client_encrypted.d.ts.map +0 -1
- package/esm/client/1_client_encrypted.js +0 -381
- package/esm/tl/0_api.d.ts.map +0 -1
- package/esm/tl/0_tl_raw_reader.d.ts.map +0 -1
- package/esm/tl/0_tl_raw_reader.js +0 -97
- package/esm/tl/0_tl_raw_reader_test.d.ts.map +0 -1
- package/esm/tl/0_tl_raw_writer.d.ts.map +0 -1
- package/esm/tl/0_tl_raw_writer.js +0 -86
- package/esm/tl/0_tl_raw_writer_test.d.ts.map +0 -1
- package/esm/tl/1_utilities_test.d.ts.map +0 -1
- package/esm/tl/2_tl_reader.d.ts.map +0 -1
- package/esm/tl/2_tl_reader_test.d.ts.map +0 -1
- package/esm/tl/2_tl_writer.d.ts.map +0 -1
- package/esm/tl/2_tl_writer_test.d.ts.map +0 -1
- package/esm/tl/2_utilities.d.ts.map +0 -1
- package/script/client/0_message.d.ts +0 -29
- package/script/client/0_message.d.ts.map +0 -1
- package/script/client/0_message.js +0 -90
- package/script/client/1_client_encrypted.d.ts +0 -52
- package/script/client/1_client_encrypted.d.ts.map +0 -1
- package/script/client/1_client_encrypted.js +0 -385
- package/script/tl/0_api.d.ts.map +0 -1
- package/script/tl/0_tl_raw_reader.d.ts.map +0 -1
- package/script/tl/0_tl_raw_reader.js +0 -102
- package/script/tl/0_tl_raw_reader_test.d.ts.map +0 -1
- package/script/tl/0_tl_raw_writer.d.ts.map +0 -1
- package/script/tl/0_tl_raw_writer.js +0 -90
- package/script/tl/0_tl_raw_writer_test.d.ts.map +0 -1
- package/script/tl/1_utilities_test.d.ts.map +0 -1
- package/script/tl/2_tl_reader.d.ts.map +0 -1
- package/script/tl/2_tl_reader.js +0 -150
- package/script/tl/2_tl_reader_test.d.ts.map +0 -1
- package/script/tl/2_tl_writer.d.ts.map +0 -1
- package/script/tl/2_tl_writer_test.d.ts.map +0 -1
- package/script/tl/2_utilities.d.ts.map +0 -1
- package/script/tl/2_utilities.js +0 -98
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
4
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
5
|
+
*
|
|
6
|
+
* This file is part of MTKruto.
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Lesser General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
22
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
23
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
24
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
25
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
26
|
+
};
|
|
27
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
28
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
29
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
30
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
31
|
+
};
|
|
32
|
+
var _SessionEncrypted_instances, _a, _SessionEncrypted_id, _SessionEncrypted_authKey, _SessionEncrypted_authKeyId, _SessionEncrypted_toAcknowledge, _SessionEncrypted_pendingMessages, _SessionEncrypted_pendingPings, _SessionEncrypted_L, _SessionEncrypted_TGCRYPTO_INITED, _SessionEncrypted_assertNotDisconnected, _SessionEncrypted_invalidateSession, _SessionEncrypted_rejectAllPending, _SessionEncrypted_onMessageFailed, _SessionEncrypted_setServerSalt, _SessionEncrypted_receive, _SessionEncrypted_encryptMessage, _SessionEncrypted_decryptMessage, _SessionEncrypted_startReceiveLoop, _SessionEncrypted_receiveLoopActive, _SessionEncrypted_receiveLoop, _SessionEncrypted_onMessage, _SessionEncrypted_onRpcResult, _SessionEncrypted_onMsgDetailedInfo, _SessionEncrypted_onMsgNewDetailedInfo, _SessionEncrypted_onBadMsgNotification, _SessionEncrypted_onBadServerSalt, _SessionEncrypted_onPong, _SessionEncrypted_onNewSessionCreated, _SessionEncrypted_onMessageContainer, _SessionEncrypted_pingInterval, _SessionEncrypted_startPingLoop, _SessionEncrypted_pingLoopAbortController, _SessionEncrypted_LpingLoop, _SessionEncrypted_pingLoop, _SessionEncrypted_sendPingDelayDisconnect;
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.SessionEncrypted = void 0;
|
|
35
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
36
|
+
const _0_errors_js_1 = require("../0_errors.js");
|
|
37
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
38
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
39
|
+
const _1_tl_writer_js_1 = require("../tl/1_tl_writer.js");
|
|
40
|
+
const _0_session_error_js_1 = require("./0_session_error.js");
|
|
41
|
+
const _1_session_js_1 = require("./1_session.js");
|
|
42
|
+
// global SessionEncrypted ID counter for logs
|
|
43
|
+
let id = 0;
|
|
44
|
+
const GZIP_PACKED = 0x3072CFA1;
|
|
45
|
+
const RPC_RESULT = 0xF35C6D01;
|
|
46
|
+
const RPC_ERROR = _2_tl_js_1.Mtproto.schema.definitions["rpc_error"][0];
|
|
47
|
+
class SessionEncrypted extends _1_session_js_1.Session {
|
|
48
|
+
constructor(dc, params) {
|
|
49
|
+
super(dc, params);
|
|
50
|
+
_SessionEncrypted_instances.add(this);
|
|
51
|
+
_SessionEncrypted_id.set(this, (0, _1_utilities_js_1.getRandomId)());
|
|
52
|
+
_SessionEncrypted_authKey.set(this, new Uint8Array());
|
|
53
|
+
_SessionEncrypted_authKeyId.set(this, 0n);
|
|
54
|
+
Object.defineProperty(this, "handlers", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
configurable: true,
|
|
57
|
+
writable: true,
|
|
58
|
+
value: {}
|
|
59
|
+
});
|
|
60
|
+
_SessionEncrypted_toAcknowledge.set(this, new Array());
|
|
61
|
+
_SessionEncrypted_pendingMessages.set(this, new Set());
|
|
62
|
+
_SessionEncrypted_pendingPings.set(this, new Map());
|
|
63
|
+
_SessionEncrypted_L.set(this, void 0);
|
|
64
|
+
_SessionEncrypted_receiveLoopActive.set(this, false);
|
|
65
|
+
//// PING LOOP ////
|
|
66
|
+
_SessionEncrypted_pingInterval.set(this, 56 * _0_deps_js_1.SECOND);
|
|
67
|
+
_SessionEncrypted_pingLoopAbortController.set(this, void 0);
|
|
68
|
+
_SessionEncrypted_LpingLoop.set(this, void 0);
|
|
69
|
+
const L = __classPrivateFieldSet(this, _SessionEncrypted_L, (0, _1_utilities_js_1.getLogger)("SessionEncrypted").client(id++), "f");
|
|
70
|
+
__classPrivateFieldSet(this, _SessionEncrypted_LpingLoop, L.branch("#pingLoop"), "f");
|
|
71
|
+
}
|
|
72
|
+
async setAuthKey(key) {
|
|
73
|
+
const hash = await (0, _1_utilities_js_1.sha1)(key);
|
|
74
|
+
__classPrivateFieldSet(this, _SessionEncrypted_authKeyId, (0, _1_utilities_js_1.bigIntFromBuffer)(hash.slice(-8), true, false), "f");
|
|
75
|
+
__classPrivateFieldSet(this, _SessionEncrypted_authKey, key, "f");
|
|
76
|
+
}
|
|
77
|
+
get authKey() {
|
|
78
|
+
return __classPrivateFieldGet(this, _SessionEncrypted_authKey, "f");
|
|
79
|
+
}
|
|
80
|
+
async connect() {
|
|
81
|
+
await super.connect();
|
|
82
|
+
if (!__classPrivateFieldGet(_a, _a, "f", _SessionEncrypted_TGCRYPTO_INITED)) {
|
|
83
|
+
await (0, _0_deps_js_1.initTgCrypto)();
|
|
84
|
+
__classPrivateFieldSet(_a, _a, true, "f", _SessionEncrypted_TGCRYPTO_INITED);
|
|
85
|
+
}
|
|
86
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_startReceiveLoop).call(this);
|
|
87
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_startPingLoop).call(this);
|
|
88
|
+
}
|
|
89
|
+
disconnect() {
|
|
90
|
+
super.disconnect();
|
|
91
|
+
this.state.reset();
|
|
92
|
+
__classPrivateFieldSet(this, _SessionEncrypted_id, (0, _1_utilities_js_1.getRandomId)(), "f");
|
|
93
|
+
__classPrivateFieldGet(this, _SessionEncrypted_pingLoopAbortController, "f")?.abort();
|
|
94
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_rejectAllPending).call(this, new _0_errors_js_1.ConnectionError("Not connected."));
|
|
95
|
+
}
|
|
96
|
+
async send(body) {
|
|
97
|
+
if (!this.disconnected && !this.connected) {
|
|
98
|
+
await super.waitUntilConnected();
|
|
99
|
+
}
|
|
100
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_assertNotDisconnected).call(this);
|
|
101
|
+
const msg_id = this.state.nextMessageId();
|
|
102
|
+
const seqno = this.state.nextSeqNo(true);
|
|
103
|
+
let message = {
|
|
104
|
+
_: "message",
|
|
105
|
+
msg_id,
|
|
106
|
+
seqno,
|
|
107
|
+
body,
|
|
108
|
+
};
|
|
109
|
+
if (__classPrivateFieldGet(this, _SessionEncrypted_toAcknowledge, "f").length) {
|
|
110
|
+
const ack = {
|
|
111
|
+
_: "message",
|
|
112
|
+
msg_id: this.state.nextMessageId(),
|
|
113
|
+
seqno: this.state.nextSeqNo(false),
|
|
114
|
+
body: _2_tl_js_1.Mtproto.serializeObject({ _: "msgs_ack", msg_ids: __classPrivateFieldGet(this, _SessionEncrypted_toAcknowledge, "f").splice(0, 8192) }),
|
|
115
|
+
};
|
|
116
|
+
message = {
|
|
117
|
+
_: "message",
|
|
118
|
+
msg_id: this.state.nextMessageId(),
|
|
119
|
+
seqno: this.state.nextSeqNo(false),
|
|
120
|
+
body: {
|
|
121
|
+
_: "msg_container",
|
|
122
|
+
messages: [message, ack],
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
__classPrivateFieldGet(this, _SessionEncrypted_L, "f").out(message);
|
|
127
|
+
const payload = await __classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_encryptMessage).call(this, message);
|
|
128
|
+
await this.transport.transport.send(payload);
|
|
129
|
+
__classPrivateFieldGet(this, _SessionEncrypted_pendingMessages, "f").add(msg_id);
|
|
130
|
+
return msg_id;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.SessionEncrypted = SessionEncrypted;
|
|
134
|
+
_a = SessionEncrypted, _SessionEncrypted_id = new WeakMap(), _SessionEncrypted_authKey = new WeakMap(), _SessionEncrypted_authKeyId = new WeakMap(), _SessionEncrypted_toAcknowledge = new WeakMap(), _SessionEncrypted_pendingMessages = new WeakMap(), _SessionEncrypted_pendingPings = new WeakMap(), _SessionEncrypted_L = new WeakMap(), _SessionEncrypted_receiveLoopActive = new WeakMap(), _SessionEncrypted_pingInterval = new WeakMap(), _SessionEncrypted_pingLoopAbortController = new WeakMap(), _SessionEncrypted_LpingLoop = new WeakMap(), _SessionEncrypted_instances = new WeakSet(), _SessionEncrypted_assertNotDisconnected = function _SessionEncrypted_assertNotDisconnected() {
|
|
135
|
+
if (this.disconnected) {
|
|
136
|
+
throw new _0_errors_js_1.ConnectionError("Not connected.");
|
|
137
|
+
}
|
|
138
|
+
}, _SessionEncrypted_invalidateSession = async function _SessionEncrypted_invalidateSession(reason) {
|
|
139
|
+
__classPrivateFieldGet(this, _SessionEncrypted_L, "f").debug("invalidating session because of", reason);
|
|
140
|
+
__classPrivateFieldSet(this, _SessionEncrypted_id, (0, _1_utilities_js_1.getRandomId)(), "f");
|
|
141
|
+
this.state.reset();
|
|
142
|
+
this.disconnect();
|
|
143
|
+
await this.connect();
|
|
144
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_rejectAllPending).call(this, new _0_session_error_js_1.SessionError("Session invalidated."));
|
|
145
|
+
}, _SessionEncrypted_rejectAllPending = function _SessionEncrypted_rejectAllPending(reason) {
|
|
146
|
+
for (const id of __classPrivateFieldGet(this, _SessionEncrypted_pendingMessages, "f")) {
|
|
147
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_onMessageFailed).call(this, id, reason);
|
|
148
|
+
}
|
|
149
|
+
for (const pendingPing of __classPrivateFieldGet(this, _SessionEncrypted_pendingPings, "f").values()) {
|
|
150
|
+
pendingPing.reject(reason);
|
|
151
|
+
}
|
|
152
|
+
__classPrivateFieldGet(this, _SessionEncrypted_pendingPings, "f").clear();
|
|
153
|
+
}, _SessionEncrypted_onMessageFailed = function _SessionEncrypted_onMessageFailed(id, reason) {
|
|
154
|
+
__classPrivateFieldGet(this, _SessionEncrypted_pendingMessages, "f").delete(id);
|
|
155
|
+
this.handlers.onMessageFailed?.(id, reason);
|
|
156
|
+
const pendingPing = __classPrivateFieldGet(this, _SessionEncrypted_pendingPings, "f").get(id);
|
|
157
|
+
if (pendingPing) {
|
|
158
|
+
pendingPing.reject(reason);
|
|
159
|
+
__classPrivateFieldGet(this, _SessionEncrypted_pendingPings, "f").delete(id);
|
|
160
|
+
}
|
|
161
|
+
}, _SessionEncrypted_setServerSalt = function _SessionEncrypted_setServerSalt(newServerSalt) {
|
|
162
|
+
this.state.serverSalt = newServerSalt;
|
|
163
|
+
this.handlers.onNewServerSalt?.(newServerSalt);
|
|
164
|
+
}, _SessionEncrypted_receive = async function _SessionEncrypted_receive() {
|
|
165
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_assertNotDisconnected).call(this);
|
|
166
|
+
const buffer = await this.transport.transport.receive();
|
|
167
|
+
if (buffer.length == 4) {
|
|
168
|
+
const int = (0, _1_utilities_js_1.bigIntFromBuffer)(buffer, true, true);
|
|
169
|
+
throw new _0_errors_js_1.TransportError(Number(int));
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
const decrypted = await __classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_decryptMessage).call(this, buffer);
|
|
173
|
+
__classPrivateFieldGet(this, _SessionEncrypted_L, "f").in(decrypted);
|
|
174
|
+
return decrypted;
|
|
175
|
+
}
|
|
176
|
+
catch (err) {
|
|
177
|
+
await __classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_invalidateSession).call(this, "decryption error");
|
|
178
|
+
throw err;
|
|
179
|
+
}
|
|
180
|
+
}, _SessionEncrypted_encryptMessage = async function _SessionEncrypted_encryptMessage(message) {
|
|
181
|
+
const payloadWriter = new _1_tl_writer_js_1.TLWriter();
|
|
182
|
+
payloadWriter.writeInt64(this.state.serverSalt);
|
|
183
|
+
payloadWriter.writeInt64(__classPrivateFieldGet(this, _SessionEncrypted_id, "f"));
|
|
184
|
+
payloadWriter.write(await (0, _2_tl_js_1.serializeMessage)(message));
|
|
185
|
+
payloadWriter.write(new Uint8Array((0, _1_utilities_js_1.mod)(-(payloadWriter.buffer.length + 12), 16) + 12));
|
|
186
|
+
const payload = payloadWriter.buffer;
|
|
187
|
+
const messageKey = (await (0, _1_utilities_js_1.sha256)((0, _0_deps_js_1.concat)([__classPrivateFieldGet(this, _SessionEncrypted_authKey, "f").subarray(88, 120), payload]))).subarray(8, 24);
|
|
188
|
+
const a = await (0, _1_utilities_js_1.sha256)((0, _0_deps_js_1.concat)([messageKey, __classPrivateFieldGet(this, _SessionEncrypted_authKey, "f").subarray(0, 36)]));
|
|
189
|
+
const b = await (0, _1_utilities_js_1.sha256)((0, _0_deps_js_1.concat)([__classPrivateFieldGet(this, _SessionEncrypted_authKey, "f").subarray(40, 76), messageKey]));
|
|
190
|
+
const aesKey = (0, _0_deps_js_1.concat)([a.subarray(0, 8), b.subarray(8, 24), a.subarray(24, 32)]);
|
|
191
|
+
const aesIV = (0, _0_deps_js_1.concat)([b.subarray(0, 8), a.subarray(8, 24), b.subarray(24, 32)]);
|
|
192
|
+
const messageWriter = new _1_tl_writer_js_1.TLWriter();
|
|
193
|
+
messageWriter.writeInt64(__classPrivateFieldGet(this, _SessionEncrypted_authKeyId, "f"));
|
|
194
|
+
messageWriter.write(messageKey);
|
|
195
|
+
messageWriter.write((0, _0_deps_js_1.ige256Encrypt)(payload, aesKey, aesIV));
|
|
196
|
+
return messageWriter.buffer;
|
|
197
|
+
}, _SessionEncrypted_decryptMessage = async function _SessionEncrypted_decryptMessage(buffer) {
|
|
198
|
+
const reader = new _2_tl_js_1.TLReader(buffer);
|
|
199
|
+
(0, _0_deps_js_1.assertEquals)(reader.readInt64(false), __classPrivateFieldGet(this, _SessionEncrypted_authKeyId, "f"));
|
|
200
|
+
const messageKey_ = reader.readInt128();
|
|
201
|
+
const messageKey = (0, _1_utilities_js_1.bufferFromBigInt)(messageKey_, 16, true, true);
|
|
202
|
+
const a = await (0, _1_utilities_js_1.sha256)((0, _0_deps_js_1.concat)([messageKey, __classPrivateFieldGet(this, _SessionEncrypted_authKey, "f").subarray(8, 44)]));
|
|
203
|
+
const b = await (0, _1_utilities_js_1.sha256)((0, _0_deps_js_1.concat)([__classPrivateFieldGet(this, _SessionEncrypted_authKey, "f").subarray(48, 84), messageKey]));
|
|
204
|
+
const aesKey = (0, _0_deps_js_1.concat)([a.subarray(0, 8), b.subarray(8, 24), a.subarray(24, 32)]);
|
|
205
|
+
const aesIv = (0, _0_deps_js_1.concat)([b.subarray(0, 8), a.subarray(8, 24), b.subarray(24, 32)]);
|
|
206
|
+
const plaintext = (0, _0_deps_js_1.ige256Decrypt)(reader.buffer, aesKey, aesIv);
|
|
207
|
+
(0, _0_deps_js_1.assertEquals)(plaintext.buffer.byteLength % 4, 0);
|
|
208
|
+
const plainReader = new _2_tl_js_1.TLReader(plaintext);
|
|
209
|
+
const _salt = plainReader.readInt64();
|
|
210
|
+
const _sessionId_ = plainReader.readInt64(false);
|
|
211
|
+
return (0, _2_tl_js_1.deserializeMessage)(plainReader);
|
|
212
|
+
}, _SessionEncrypted_startReceiveLoop = function _SessionEncrypted_startReceiveLoop() {
|
|
213
|
+
if (!__classPrivateFieldGet(this, _SessionEncrypted_receiveLoopActive, "f")) {
|
|
214
|
+
(0, _1_utilities_js_1.drop)(__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_receiveLoop).call(this));
|
|
215
|
+
}
|
|
216
|
+
}, _SessionEncrypted_receiveLoop = async function _SessionEncrypted_receiveLoop() {
|
|
217
|
+
__classPrivateFieldSet(this, _SessionEncrypted_receiveLoopActive, true, "f");
|
|
218
|
+
try {
|
|
219
|
+
while (this.connected) {
|
|
220
|
+
let message;
|
|
221
|
+
try {
|
|
222
|
+
message = await __classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_receive).call(this);
|
|
223
|
+
}
|
|
224
|
+
catch (err) {
|
|
225
|
+
if (!this.connected) {
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
__classPrivateFieldGet(this, _SessionEncrypted_L, "f").error("failed to receive message:", err);
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
try {
|
|
234
|
+
if (message.body instanceof Uint8Array) {
|
|
235
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_onMessage).call(this, message.msg_id, message.body);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_onMessageContainer).call(this, message.msg_id, message.body);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
catch (err) {
|
|
242
|
+
__classPrivateFieldGet(this, _SessionEncrypted_L, "f").error("failed to handle message:", err);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
finally {
|
|
247
|
+
__classPrivateFieldSet(this, _SessionEncrypted_receiveLoopActive, false, "f");
|
|
248
|
+
}
|
|
249
|
+
}, _SessionEncrypted_onMessage =
|
|
250
|
+
//// RECEIVE LOOP HANDLERS ////
|
|
251
|
+
async function _SessionEncrypted_onMessage(msgId, body) {
|
|
252
|
+
let reader = new _2_tl_js_1.TLReader(body);
|
|
253
|
+
let id = reader.readInt32(false);
|
|
254
|
+
if (id == GZIP_PACKED) {
|
|
255
|
+
reader = new _2_tl_js_1.TLReader(await (0, _1_utilities_js_1.gunzip)(reader.readBytes()));
|
|
256
|
+
id = reader.readInt32(false);
|
|
257
|
+
}
|
|
258
|
+
if (id == RPC_RESULT) {
|
|
259
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_onRpcResult).call(this, reader.buffer);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (!_2_tl_js_1.Mtproto.schema.identifierToName[id]) {
|
|
263
|
+
reader.unreadInt32();
|
|
264
|
+
this.handlers.onUpdate?.(reader.buffer);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
let type;
|
|
268
|
+
try {
|
|
269
|
+
reader.unreadInt32();
|
|
270
|
+
type = await _2_tl_js_1.Mtproto.deserializeType(_2_tl_js_1.X, reader);
|
|
271
|
+
}
|
|
272
|
+
catch (err) {
|
|
273
|
+
__classPrivateFieldGet(this, _SessionEncrypted_L, "f").error("failed to deserialize MTProto type:", err);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
__classPrivateFieldGet(this, _SessionEncrypted_L, "f").debug("received", (0, _2_tl_js_1.repr)(type));
|
|
277
|
+
if (_2_tl_js_1.Mtproto.is("new_session_created", type)) {
|
|
278
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_onNewSessionCreated).call(this, msgId, type);
|
|
279
|
+
}
|
|
280
|
+
else if (_2_tl_js_1.Mtproto.is("pong", type)) {
|
|
281
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_onPong).call(this, msgId, type);
|
|
282
|
+
}
|
|
283
|
+
else if (_2_tl_js_1.Mtproto.is("bad_server_salt", type)) {
|
|
284
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_onBadServerSalt).call(this, type);
|
|
285
|
+
}
|
|
286
|
+
else if (_2_tl_js_1.Mtproto.is("bad_msg_notification", type)) {
|
|
287
|
+
await __classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_onBadMsgNotification).call(this, msgId, type);
|
|
288
|
+
}
|
|
289
|
+
else if (_2_tl_js_1.Mtproto.is("msg_detailed_info", type)) {
|
|
290
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_onMsgDetailedInfo).call(this, type);
|
|
291
|
+
}
|
|
292
|
+
else if (_2_tl_js_1.Mtproto.is("msg_new_detailed_info", type)) {
|
|
293
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_onMsgNewDetailedInfo).call(this, type);
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
__classPrivateFieldGet(this, _SessionEncrypted_L, "f").debug(`unhandled MTProto type: ${(0, _2_tl_js_1.repr)(type)}`);
|
|
297
|
+
}
|
|
298
|
+
}, _SessionEncrypted_onRpcResult = async function _SessionEncrypted_onRpcResult(body) {
|
|
299
|
+
let reader = new _2_tl_js_1.TLReader(body);
|
|
300
|
+
const reqMsgId = reader.readInt64();
|
|
301
|
+
let id = reader.readInt32(false);
|
|
302
|
+
if (id == GZIP_PACKED) {
|
|
303
|
+
reader = new _2_tl_js_1.TLReader(await (0, _1_utilities_js_1.gunzip)(reader.readBytes()));
|
|
304
|
+
id = reader.readInt32(false);
|
|
305
|
+
reader.unreadInt32();
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
reader.unreadInt32();
|
|
309
|
+
}
|
|
310
|
+
if (id == RPC_ERROR) {
|
|
311
|
+
const error = await _2_tl_js_1.Mtproto.deserializeType("rpc_error", reader);
|
|
312
|
+
this.handlers.onRpcError?.(reqMsgId, error);
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
this.handlers.onRpcResult?.(reqMsgId, reader.buffer);
|
|
316
|
+
}
|
|
317
|
+
}, _SessionEncrypted_onMsgDetailedInfo = function _SessionEncrypted_onMsgDetailedInfo(msgDetailedInfo) {
|
|
318
|
+
__classPrivateFieldGet(this, _SessionEncrypted_toAcknowledge, "f").push(msgDetailedInfo.answer_msg_id);
|
|
319
|
+
}, _SessionEncrypted_onMsgNewDetailedInfo = function _SessionEncrypted_onMsgNewDetailedInfo(msgNewDetailedInfo) {
|
|
320
|
+
__classPrivateFieldGet(this, _SessionEncrypted_toAcknowledge, "f").push(msgNewDetailedInfo.answer_msg_id);
|
|
321
|
+
}, _SessionEncrypted_onBadMsgNotification = async function _SessionEncrypted_onBadMsgNotification(msgId, badMsgNotification) {
|
|
322
|
+
let low = false;
|
|
323
|
+
switch (badMsgNotification.error_code) {
|
|
324
|
+
case 16: // message ID too low
|
|
325
|
+
low = true;
|
|
326
|
+
/* falls through */
|
|
327
|
+
case 17: // message ID too high
|
|
328
|
+
this.state.timeDifference = Math.abs((0, _1_utilities_js_1.toUnixTimestamp)(new Date()) - Number(msgId >> 32n));
|
|
329
|
+
if (!low) {
|
|
330
|
+
this.state.timeDifference = -this.state.timeDifference;
|
|
331
|
+
await __classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_invalidateSession).call(this, "message ID too high");
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
__classPrivateFieldGet(this, _SessionEncrypted_L, "f").debug("message ID too low, resending message");
|
|
336
|
+
}
|
|
337
|
+
break;
|
|
338
|
+
case 48: // bad server salt
|
|
339
|
+
// resend
|
|
340
|
+
__classPrivateFieldGet(this, _SessionEncrypted_L, "f").debug("resending message that caused bad_server_salt");
|
|
341
|
+
break;
|
|
342
|
+
default:
|
|
343
|
+
await __classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_invalidateSession).call(this, "unexpected bad_msg_notification");
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_onMessageFailed).call(this, badMsgNotification.bad_msg_id, new _0_session_error_js_1.SessionError(badMsgNotification._));
|
|
347
|
+
}, _SessionEncrypted_onBadServerSalt = function _SessionEncrypted_onBadServerSalt(badServerSalt) {
|
|
348
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_setServerSalt).call(this, badServerSalt.new_server_salt);
|
|
349
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_onMessageFailed).call(this, badServerSalt.bad_msg_id, new _0_session_error_js_1.SessionError(badServerSalt._));
|
|
350
|
+
}, _SessionEncrypted_onPong = function _SessionEncrypted_onPong(msgId, pong) {
|
|
351
|
+
__classPrivateFieldGet(this, _SessionEncrypted_toAcknowledge, "f").push(msgId);
|
|
352
|
+
const pendingPing = __classPrivateFieldGet(this, _SessionEncrypted_pendingPings, "f").get(msgId);
|
|
353
|
+
if (pendingPing) {
|
|
354
|
+
pendingPing.resolve(pong);
|
|
355
|
+
__classPrivateFieldGet(this, _SessionEncrypted_pendingPings, "f").delete(msgId);
|
|
356
|
+
}
|
|
357
|
+
}, _SessionEncrypted_onNewSessionCreated = function _SessionEncrypted_onNewSessionCreated(msgId, newSessionCreated) {
|
|
358
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_setServerSalt).call(this, newSessionCreated.server_salt);
|
|
359
|
+
__classPrivateFieldGet(this, _SessionEncrypted_toAcknowledge, "f").push(msgId);
|
|
360
|
+
}, _SessionEncrypted_onMessageContainer = function _SessionEncrypted_onMessageContainer(msgId, msgContainer) {
|
|
361
|
+
for (const message of msgContainer.messages) {
|
|
362
|
+
if (message.body instanceof Uint8Array) {
|
|
363
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_onMessage).call(this, message.msg_id, message.body);
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_onMessageContainer).call(this, msgId, message.body);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}, _SessionEncrypted_startPingLoop = function _SessionEncrypted_startPingLoop() {
|
|
370
|
+
(0, _1_utilities_js_1.drop)(__classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_pingLoop).call(this));
|
|
371
|
+
}, _SessionEncrypted_pingLoop = async function _SessionEncrypted_pingLoop() {
|
|
372
|
+
__classPrivateFieldSet(this, _SessionEncrypted_pingLoopAbortController, new AbortController(), "f");
|
|
373
|
+
let timeElapsed = 0;
|
|
374
|
+
while (this.connected) {
|
|
375
|
+
const then = Date.now();
|
|
376
|
+
try {
|
|
377
|
+
await new Promise((resolve, reject) => {
|
|
378
|
+
const timeout = setTimeout(resolve, __classPrivateFieldGet(this, _SessionEncrypted_pingInterval, "f") - timeElapsed);
|
|
379
|
+
__classPrivateFieldGet(this, _SessionEncrypted_pingLoopAbortController, "f").signal.onabort = () => {
|
|
380
|
+
reject(__classPrivateFieldGet(this, _SessionEncrypted_pingLoopAbortController, "f")?.signal.reason);
|
|
381
|
+
clearTimeout(timeout);
|
|
382
|
+
};
|
|
383
|
+
});
|
|
384
|
+
if (!this.connected) {
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
__classPrivateFieldGet(this, _SessionEncrypted_pingLoopAbortController, "f").signal.throwIfAborted();
|
|
388
|
+
await __classPrivateFieldGet(this, _SessionEncrypted_instances, "m", _SessionEncrypted_sendPingDelayDisconnect).call(this, __classPrivateFieldGet(this, _SessionEncrypted_pingInterval, "f") / _0_deps_js_1.SECOND + 15);
|
|
389
|
+
__classPrivateFieldGet(this, _SessionEncrypted_pingLoopAbortController, "f").signal.throwIfAborted();
|
|
390
|
+
}
|
|
391
|
+
catch (err) {
|
|
392
|
+
if (err instanceof DOMException && err.name == "AbortError") {
|
|
393
|
+
__classPrivateFieldSet(this, _SessionEncrypted_pingLoopAbortController, new AbortController(), "f");
|
|
394
|
+
}
|
|
395
|
+
if (!this.connected) {
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
__classPrivateFieldGet(this, _SessionEncrypted_LpingLoop, "f").error(err);
|
|
399
|
+
}
|
|
400
|
+
finally {
|
|
401
|
+
timeElapsed = Date.now() - then;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}, _SessionEncrypted_sendPingDelayDisconnect = async function _SessionEncrypted_sendPingDelayDisconnect(disconnect_delay) {
|
|
405
|
+
const ping_id = (0, _1_utilities_js_1.getRandomId)();
|
|
406
|
+
const request = { _: "ping_delay_disconnect", ping_id, disconnect_delay };
|
|
407
|
+
await new Promise((resolve, reject) => {
|
|
408
|
+
Promise.resolve().then(async () => {
|
|
409
|
+
__classPrivateFieldGet(this, _SessionEncrypted_pendingPings, "f").set(ping_id, { resolve, reject });
|
|
410
|
+
try {
|
|
411
|
+
await this.send(_2_tl_js_1.Mtproto.serializeObject(request));
|
|
412
|
+
}
|
|
413
|
+
catch (err) {
|
|
414
|
+
reject(err);
|
|
415
|
+
__classPrivateFieldGet(this, _SessionEncrypted_pendingMessages, "f").delete(ping_id);
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
};
|
|
420
|
+
_SessionEncrypted_TGCRYPTO_INITED = { value: false };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import { Session } from "./1_session.js";
|
|
21
|
+
export declare class SessionPlain extends Session implements Session {
|
|
22
|
+
send(data: Uint8Array): Promise<bigint>;
|
|
23
|
+
receive(): Promise<Uint8Array>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=2_session_plain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"2_session_plain.d.ts","sourceRoot":"","sources":["../../src/session/2_session_plain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,qBAAa,YAAa,SAAQ,OAAQ,YAAW,OAAO;IACpD,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAiBvC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC;CAmBrC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
4
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
5
|
+
*
|
|
6
|
+
* This file is part of MTKruto.
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Lesser General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.SessionPlain = void 0;
|
|
23
|
+
const _0_errors_js_1 = require("../0_errors.js");
|
|
24
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
25
|
+
const _1_tl_reader_js_1 = require("../tl/1_tl_reader.js");
|
|
26
|
+
const _1_tl_writer_js_1 = require("../tl/1_tl_writer.js");
|
|
27
|
+
const _1_session_js_1 = require("./1_session.js");
|
|
28
|
+
class SessionPlain extends _1_session_js_1.Session {
|
|
29
|
+
async send(data) {
|
|
30
|
+
if (!this.connected) {
|
|
31
|
+
throw new _0_errors_js_1.ConnectionError("Not connected.");
|
|
32
|
+
}
|
|
33
|
+
const messageId = this.state.nextMessageId();
|
|
34
|
+
const writer = new _1_tl_writer_js_1.TLWriter();
|
|
35
|
+
writer.writeInt64(0n); // auth key ID
|
|
36
|
+
writer.writeInt64(messageId);
|
|
37
|
+
writer.writeInt32(data.length);
|
|
38
|
+
writer.write(data);
|
|
39
|
+
const payload = writer.buffer;
|
|
40
|
+
await this.transport.transport.send(payload);
|
|
41
|
+
return messageId;
|
|
42
|
+
}
|
|
43
|
+
async receive() {
|
|
44
|
+
if (!this.connected) {
|
|
45
|
+
throw new _0_errors_js_1.ConnectionError("Not connected.");
|
|
46
|
+
}
|
|
47
|
+
const buffer = await this.transport.transport.receive();
|
|
48
|
+
if (buffer.length == 4) {
|
|
49
|
+
const int = (0, _1_utilities_js_1.bigIntFromBuffer)(buffer, true, true);
|
|
50
|
+
throw new _0_errors_js_1.TransportError(Number(int));
|
|
51
|
+
}
|
|
52
|
+
const reader = new _1_tl_reader_js_1.TLReader(buffer);
|
|
53
|
+
const _authKeyId = reader.readInt64();
|
|
54
|
+
const _messageId = reader.readInt64();
|
|
55
|
+
const dataLength = reader.readInt32();
|
|
56
|
+
const data = reader.read(dataLength);
|
|
57
|
+
return data;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.SessionPlain = SessionPlain;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
export declare class TLError extends Error {
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=0_tl_error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"0_tl_error.d.ts","sourceRoot":"","sources":["../../src/tl/0_tl_error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,qBAAa,OAAQ,SAAQ,KAAK;CAEjC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
4
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
5
|
+
*
|
|
6
|
+
* This file is part of MTKruto.
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Lesser General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.TLError = void 0;
|
|
23
|
+
class TLError extends Error {
|
|
24
|
+
}
|
|
25
|
+
exports.TLError = TLError;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
export type ObjectDefinition = [number, /* ID */ [string, string][], /* fields */ string];
|
|
21
|
+
export interface Schema {
|
|
22
|
+
readonly definitions: Record<string, ObjectDefinition>;
|
|
23
|
+
readonly identifierToName: Record<string, string>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=0_types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"0_types.d.ts","sourceRoot":"","sources":["../../src/tl/0_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,YAAY,CAAC,MAAM,CAA4B,CAAC;AAErH,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACvD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
4
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
5
|
+
*
|
|
6
|
+
* This file is part of MTKruto.
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Lesser General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isOptionalParam(ntype: string): boolean;
|
|
21
|
+
export declare function getOptionalParamInnerType(ntype: string): string;
|
|
22
|
+
export declare function analyzeOptionalParam(ntype: string): {
|
|
23
|
+
flagField: string;
|
|
24
|
+
bitIndex: number;
|
|
25
|
+
};
|
|
26
|
+
export declare function repr(value: unknown): string | null;
|
|
27
|
+
export declare function getVectorItemType(type: string): string | null;
|
|
28
|
+
export declare const X = "X";
|
|
29
|
+
export declare const VECTOR = 481674261;
|
|
30
|
+
export declare const BOOL_TRUE = 2574415285;
|
|
31
|
+
export declare const BOOL_FALSE = 3162085175;
|
|
32
|
+
//# sourceMappingURL=0_utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"0_utilities.d.ts","sourceRoot":"","sources":["../../src/tl/0_utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AACD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/D;AACD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAY3F;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAElD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK7D;AAID,eAAO,MAAM,CAAC,MAAM,CAAC;AACrB,eAAO,MAAM,MAAM,YAAa,CAAC;AACjC,eAAO,MAAM,SAAS,aAAa,CAAC;AACpC,eAAO,MAAM,UAAU,aAAa,CAAC"}
|