@mtkruto/node 0.0.991 → 0.0.993
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/1_utilities.d.ts +12 -0
- package/esm/1_utilities.js +12 -0
- package/esm/2_connection.d.ts +2 -0
- package/esm/2_connection.js +2 -0
- package/esm/2_tl.d.ts +10 -0
- package/esm/2_tl.js +10 -0
- package/esm/3_storage.d.ts +6 -0
- package/esm/3_storage.js +6 -0
- package/esm/3_transport.d.ts +4 -0
- package/esm/3_transport.js +4 -0
- package/esm/3_types.d.ts +35 -0
- package/esm/3_types.js +35 -0
- package/esm/{constants.d.ts → 4_constants.d.ts} +2 -2
- package/esm/{constants.js → 4_constants.js} +1 -1
- package/esm/5_client.d.ts +2 -0
- package/esm/5_client.js +2 -0
- package/esm/client/0_html.d.ts +1 -1
- package/esm/client/0_html.js +1 -1
- package/esm/client/0_message.d.ts +1 -2
- package/esm/client/0_message.js +7 -14
- package/esm/client/0_password.d.ts +2 -2
- package/esm/client/0_password.js +2 -4
- package/esm/client/0_utilities.d.ts +3 -5
- package/esm/client/0_utilities.js +3 -22
- package/esm/client/1_client_abstract.d.ts +2 -2
- package/esm/client/1_client_abstract.js +3 -3
- package/esm/client/2_client_plain.d.ts +3 -3
- package/esm/client/2_client_plain.js +13 -20
- package/esm/client/3_client.d.ts +95 -18
- package/esm/client/3_client.js +124 -35
- package/esm/connection/0_connection.d.ts +1 -1
- package/esm/connection/1_connection_web_socket.js +1 -1
- package/esm/mod.d.ts +8 -21
- package/esm/mod.js +8 -21
- package/esm/storage/0_storage.d.ts +4 -5
- package/esm/storage/0_storage.js +3 -8
- package/esm/storage/0_utilities.js +2 -2
- package/esm/storage/1_storage_local_storage.d.ts +1 -1
- package/esm/storage/1_storage_memory.d.ts +1 -1
- package/esm/storage/1_storage_session_storage.d.ts +1 -1
- package/esm/tl/0_tl_raw_reader.js +1 -1
- package/esm/tl/0_tl_raw_writer.js +1 -1
- package/esm/tl/1_tl_object.js +1 -1
- package/esm/tl/3_deserialize.js +1 -1
- package/esm/tl/3_utilities.d.ts +3 -0
- package/esm/tl/3_utilities.js +20 -0
- package/esm/tl/4_tl_writer.js +1 -1
- package/esm/transport/0_obfuscation.d.ts +2 -2
- package/esm/transport/0_obfuscation.js +1 -2
- package/esm/transport/0_transport.d.ts +1 -2
- package/esm/transport/1_transport_abridged.d.ts +1 -1
- package/esm/transport/1_transport_abridged.js +1 -1
- package/esm/transport/1_transport_intermediate.d.ts +1 -1
- package/esm/transport/1_transport_intermediate.js +1 -1
- package/esm/transport/2_transport_provider.d.ts +1 -1
- package/esm/transport/2_transport_provider.js +1 -1
- package/esm/types/!0_file_id.js +6 -9
- package/esm/types/!0_misc.d.ts +7 -0
- package/esm/types/!0_misc.js +1 -0
- package/esm/types/0_audio.d.ts +3 -3
- package/esm/types/0_audio.js +1 -1
- package/esm/types/0_chat_administrator_rights.d.ts +1 -1
- package/esm/types/0_chat_administrator_rights.js +1 -1
- package/esm/types/0_chat_photo.d.ts +3 -3
- package/esm/types/0_chat_photo.js +1 -1
- package/esm/types/0_color.d.ts +2 -0
- package/esm/types/0_color.js +16 -0
- package/esm/types/0_contact.d.ts +2 -2
- package/esm/types/0_dice.d.ts +1 -1
- package/esm/types/0_force_reply.d.ts +1 -1
- package/esm/types/0_force_reply.js +1 -1
- package/esm/types/0_location.d.ts +1 -1
- package/esm/types/0_location.js +1 -2
- package/esm/types/0_mask_position.d.ts +1 -1
- package/esm/types/0_message_entity.d.ts +5 -5
- package/esm/types/0_message_entity.js +1 -1
- package/esm/types/0_poll_option.d.ts +1 -1
- package/esm/types/0_reply_keyboard_remove.d.ts +1 -1
- package/esm/types/0_reply_keyboard_remove.js +2 -2
- package/esm/types/0_thumbnail.d.ts +2 -2
- package/esm/types/0_thumbnail.js +1 -1
- package/esm/types/0_venue.d.ts +1 -1
- package/esm/types/0_venue.js +1 -2
- package/esm/types/0_voice.d.ts +3 -3
- package/esm/types/0_web_app_info.d.ts +2 -2
- package/esm/types/1_animation.d.ts +3 -3
- package/esm/types/1_animation.js +1 -1
- package/esm/types/1_chat.d.ts +5 -4
- package/esm/types/1_chat.js +8 -9
- package/esm/types/1_document.d.ts +4 -4
- package/esm/types/1_document.js +1 -1
- package/esm/types/1_inline_keyboard_button.d.ts +4 -4
- package/esm/types/1_inline_keyboard_button.js +2 -2
- package/esm/types/1_keyboard_button.d.ts +8 -8
- package/esm/types/1_keyboard_button.js +2 -2
- package/esm/types/1_photo.d.ts +2 -2
- package/esm/types/1_photo.js +1 -1
- package/esm/types/1_poll.d.ts +8 -8
- package/esm/types/1_poll.js +1 -1
- package/esm/types/1_sticker.d.ts +3 -3
- package/esm/types/1_sticker.js +1 -2
- package/esm/types/1_user.d.ts +4 -3
- package/esm/types/1_user.js +4 -4
- package/esm/types/1_video.d.ts +3 -3
- package/esm/types/1_video.js +1 -1
- package/esm/types/1_video_note.d.ts +2 -2
- package/esm/types/1_video_note.js +1 -1
- package/esm/types/2_game.d.ts +3 -3
- package/esm/types/2_game.js +2 -3
- package/esm/types/2_inline_keyboard_markup.d.ts +2 -2
- package/esm/types/2_inline_keyboard_markup.js +1 -1
- package/esm/types/2_inline_query.d.ts +19 -0
- package/esm/types/2_inline_query.js +41 -0
- package/esm/types/2_reply_keyboard_markup.d.ts +2 -2
- package/esm/types/2_reply_keyboard_markup.js +1 -1
- package/esm/types/3_message.d.ts +21 -23
- package/esm/types/3_message.js +16 -18
- package/esm/types/4_callback_query.d.ts +14 -0
- package/esm/types/4_callback_query.js +24 -0
- package/esm/utilities/0_base64.js +1 -1
- package/esm/utilities/0_crypto.js +1 -1
- package/esm/utilities/0_queue.js +1 -1
- package/esm/utilities/1_auth.js +1 -1
- package/package.json +1 -1
- package/script/1_utilities.d.ts +12 -0
- package/script/1_utilities.js +28 -0
- package/script/2_connection.d.ts +2 -0
- package/script/2_connection.js +18 -0
- package/script/2_tl.d.ts +10 -0
- package/script/2_tl.js +40 -0
- package/script/3_storage.d.ts +6 -0
- package/script/3_storage.js +22 -0
- package/script/3_transport.d.ts +4 -0
- package/script/3_transport.js +20 -0
- package/script/3_types.d.ts +35 -0
- package/script/3_types.js +51 -0
- package/script/{constants.d.ts → 4_constants.d.ts} +2 -2
- package/script/{constants.js → 4_constants.js} +1 -1
- package/script/5_client.d.ts +2 -0
- package/script/5_client.js +18 -0
- package/script/client/0_html.d.ts +1 -1
- package/script/client/0_html.js +2 -2
- package/script/client/0_message.d.ts +1 -2
- package/script/client/0_message.js +32 -39
- package/script/client/0_password.d.ts +2 -2
- package/script/client/0_password.js +20 -22
- package/script/client/0_utilities.d.ts +3 -5
- package/script/client/0_utilities.js +24 -68
- package/script/client/1_client_abstract.d.ts +2 -2
- package/script/client/1_client_abstract.js +6 -6
- package/script/client/2_client_plain.d.ts +3 -3
- package/script/client/2_client_plain.js +45 -52
- package/script/client/3_client.d.ts +95 -18
- package/script/client/3_client.js +368 -303
- package/script/connection/0_connection.d.ts +1 -1
- package/script/connection/1_connection_web_socket.js +5 -5
- package/script/mod.d.ts +8 -21
- package/script/mod.js +18 -33
- package/script/storage/0_storage.d.ts +4 -5
- package/script/storage/0_storage.js +11 -39
- package/script/storage/0_utilities.js +6 -6
- package/script/storage/1_storage_local_storage.d.ts +1 -1
- package/script/storage/1_storage_memory.d.ts +1 -1
- package/script/storage/1_storage_session_storage.d.ts +1 -1
- package/script/tl/0_tl_raw_reader.js +6 -6
- package/script/tl/0_tl_raw_writer.js +7 -7
- package/script/tl/1_tl_object.js +3 -3
- package/script/tl/3_deserialize.js +2 -2
- package/script/tl/3_utilities.d.ts +3 -0
- package/script/tl/3_utilities.js +48 -0
- package/script/tl/4_tl_writer.js +2 -2
- package/script/transport/0_obfuscation.d.ts +2 -2
- package/script/transport/0_obfuscation.js +5 -6
- package/script/transport/0_transport.d.ts +1 -2
- package/script/transport/1_transport_abridged.d.ts +1 -1
- package/script/transport/1_transport_abridged.js +3 -3
- package/script/transport/1_transport_intermediate.d.ts +1 -1
- package/script/transport/1_transport_intermediate.js +3 -3
- package/script/transport/2_transport_provider.d.ts +1 -1
- package/script/transport/2_transport_provider.js +2 -2
- package/script/types/!0_file_id.js +24 -27
- package/script/types/!0_misc.d.ts +7 -0
- package/script/types/!0_misc.js +2 -0
- package/script/types/0_audio.d.ts +3 -3
- package/script/types/0_audio.js +2 -25
- package/script/types/0_chat_administrator_rights.d.ts +1 -1
- package/script/types/0_chat_administrator_rights.js +2 -25
- package/script/types/0_chat_photo.d.ts +3 -3
- package/script/types/0_chat_photo.js +2 -25
- package/script/types/0_color.d.ts +2 -0
- package/script/types/{!0_id_color.js → 0_color.js} +10 -10
- package/script/types/0_contact.d.ts +2 -2
- package/script/types/0_dice.d.ts +1 -1
- package/script/types/0_force_reply.d.ts +1 -1
- package/script/types/0_force_reply.js +2 -25
- package/script/types/0_location.d.ts +1 -1
- package/script/types/0_location.js +5 -29
- package/script/types/0_mask_position.d.ts +1 -1
- package/script/types/0_message_entity.d.ts +5 -5
- package/script/types/0_message_entity.js +39 -62
- package/script/types/0_poll_option.d.ts +1 -1
- package/script/types/0_reply_keyboard_remove.d.ts +1 -1
- package/script/types/0_reply_keyboard_remove.js +4 -27
- package/script/types/0_thumbnail.d.ts +2 -2
- package/script/types/0_thumbnail.js +2 -25
- package/script/types/0_venue.d.ts +1 -1
- package/script/types/0_venue.js +2 -26
- package/script/types/0_voice.d.ts +3 -3
- package/script/types/0_web_app_info.d.ts +2 -2
- package/script/types/1_animation.d.ts +3 -3
- package/script/types/1_animation.js +2 -25
- package/script/types/1_chat.d.ts +5 -4
- package/script/types/1_chat.js +20 -44
- package/script/types/1_document.d.ts +4 -4
- package/script/types/1_document.js +2 -25
- package/script/types/1_inline_keyboard_button.d.ts +4 -4
- package/script/types/1_inline_keyboard_button.js +19 -42
- package/script/types/1_keyboard_button.d.ts +8 -8
- package/script/types/1_keyboard_button.js +24 -47
- package/script/types/1_photo.d.ts +2 -2
- package/script/types/1_photo.js +4 -27
- package/script/types/1_poll.d.ts +8 -8
- package/script/types/1_poll.js +2 -2
- package/script/types/1_sticker.d.ts +3 -3
- package/script/types/1_sticker.js +6 -30
- package/script/types/1_user.d.ts +4 -3
- package/script/types/1_user.js +6 -29
- package/script/types/1_video.d.ts +3 -3
- package/script/types/1_video.js +2 -25
- package/script/types/1_video_note.d.ts +2 -2
- package/script/types/1_video_note.js +2 -25
- package/script/types/2_game.d.ts +3 -3
- package/script/types/2_game.js +6 -30
- package/script/types/2_inline_keyboard_markup.d.ts +2 -2
- package/script/types/2_inline_keyboard_markup.js +3 -26
- package/script/types/2_inline_query.d.ts +19 -0
- package/script/types/2_inline_query.js +45 -0
- package/script/types/2_reply_keyboard_markup.d.ts +2 -2
- package/script/types/2_reply_keyboard_markup.js +3 -26
- package/script/types/3_message.d.ts +21 -23
- package/script/types/3_message.js +94 -119
- package/script/types/4_callback_query.d.ts +14 -0
- package/script/types/4_callback_query.js +28 -0
- package/script/utilities/0_base64.js +3 -3
- package/script/utilities/0_crypto.js +3 -3
- package/script/utilities/0_queue.js +2 -2
- package/script/utilities/1_auth.js +5 -5
- package/esm/types/!0_id_color.d.ts +0 -1
- package/esm/types/!0_id_color.js +0 -16
- package/script/types/!0_id_color.d.ts +0 -1
- /package/esm/{deps.d.ts → 0_deps.d.ts} +0 -0
- /package/esm/{deps.js → 0_deps.js} +0 -0
- /package/script/{deps.d.ts → 0_deps.d.ts} +0 -0
- /package/script/{deps.js → 0_deps.js} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./utilities/0_base64.js";
|
|
2
|
+
export * from "./utilities/0_bigint.js";
|
|
3
|
+
export * from "./utilities/0_buffer.js";
|
|
4
|
+
export * from "./utilities/0_control.js";
|
|
5
|
+
export * from "./utilities/0_crypto.js";
|
|
6
|
+
export * from "./utilities/0_hash.js";
|
|
7
|
+
export * from "./utilities/0_object.js";
|
|
8
|
+
export * from "./utilities/0_queue.js";
|
|
9
|
+
export * from "./utilities/0_rle.js";
|
|
10
|
+
export * from "./utilities/0_types.js";
|
|
11
|
+
export * from "./utilities/1_auth.js";
|
|
12
|
+
export * from "./utilities/1_misc.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./utilities/0_base64.js";
|
|
2
|
+
export * from "./utilities/0_bigint.js";
|
|
3
|
+
export * from "./utilities/0_buffer.js";
|
|
4
|
+
export * from "./utilities/0_control.js";
|
|
5
|
+
export * from "./utilities/0_crypto.js";
|
|
6
|
+
export * from "./utilities/0_hash.js";
|
|
7
|
+
export * from "./utilities/0_object.js";
|
|
8
|
+
export * from "./utilities/0_queue.js";
|
|
9
|
+
export * from "./utilities/0_rle.js";
|
|
10
|
+
export * from "./utilities/0_types.js";
|
|
11
|
+
export * from "./utilities/1_auth.js";
|
|
12
|
+
export * from "./utilities/1_misc.js";
|
package/esm/2_tl.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { TLError } from "./tl/0_tl_raw_reader.js";
|
|
2
|
+
export * from "./tl/1_tl_object.js";
|
|
3
|
+
export * as types from "./tl/2_types.js";
|
|
4
|
+
export * as functions from "./tl/3_functions.js";
|
|
5
|
+
export * from "./tl/3_tl_reader.js";
|
|
6
|
+
export * from "./tl/3_utilities.js";
|
|
7
|
+
export * from "./tl/4_tl_writer.js";
|
|
8
|
+
export * from "./tl/5_rpc_result.js";
|
|
9
|
+
export * from "./tl/6_message.js";
|
|
10
|
+
export * from "./tl/7_message_container.js";
|
package/esm/2_tl.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { TLError } from "./tl/0_tl_raw_reader.js";
|
|
2
|
+
export * from "./tl/1_tl_object.js";
|
|
3
|
+
export * as types from "./tl/2_types.js";
|
|
4
|
+
export * as functions from "./tl/3_functions.js";
|
|
5
|
+
export * from "./tl/3_tl_reader.js";
|
|
6
|
+
export * from "./tl/3_utilities.js";
|
|
7
|
+
export * from "./tl/4_tl_writer.js";
|
|
8
|
+
export * from "./tl/5_rpc_result.js";
|
|
9
|
+
export * from "./tl/6_message.js";
|
|
10
|
+
export * from "./tl/7_message_container.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./storage/0_storage.js";
|
|
2
|
+
export * from "./storage/0_utilities.js";
|
|
3
|
+
export * from "./storage/1_storage_indexed_db.js";
|
|
4
|
+
export * from "./storage/1_storage_local_storage.js";
|
|
5
|
+
export * from "./storage/1_storage_memory.js";
|
|
6
|
+
export * from "./storage/1_storage_session_storage.js";
|
package/esm/3_storage.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./storage/0_storage.js";
|
|
2
|
+
export * from "./storage/0_utilities.js";
|
|
3
|
+
export * from "./storage/1_storage_indexed_db.js";
|
|
4
|
+
export * from "./storage/1_storage_local_storage.js";
|
|
5
|
+
export * from "./storage/1_storage_memory.js";
|
|
6
|
+
export * from "./storage/1_storage_session_storage.js";
|
package/esm/3_types.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export * from "./types/!0_file_id.js";
|
|
2
|
+
export * from "./types/0_audio.js";
|
|
3
|
+
export * from "./types/0_chat_administrator_rights.js";
|
|
4
|
+
export * from "./types/0_chat_photo.js";
|
|
5
|
+
export * from "./types/0_contact.js";
|
|
6
|
+
export * from "./types/0_dice.js";
|
|
7
|
+
export * from "./types/0_force_reply.js";
|
|
8
|
+
export * from "./types/0_keyboard_button_poll_type.js";
|
|
9
|
+
export * from "./types/0_location.js";
|
|
10
|
+
export * from "./types/0_login_url.js";
|
|
11
|
+
export * from "./types/0_mask_position.js";
|
|
12
|
+
export * from "./types/0_message_entity.js";
|
|
13
|
+
export * from "./types/0_poll_option.js";
|
|
14
|
+
export * from "./types/0_reply_keyboard_remove.js";
|
|
15
|
+
export * from "./types/0_thumbnail.js";
|
|
16
|
+
export * from "./types/0_venue.js";
|
|
17
|
+
export * from "./types/0_voice.js";
|
|
18
|
+
export * from "./types/0_web_app_info.js";
|
|
19
|
+
export * from "./types/1_animation.js";
|
|
20
|
+
export * from "./types/1_chat.js";
|
|
21
|
+
export * from "./types/1_document.js";
|
|
22
|
+
export * from "./types/1_inline_keyboard_button.js";
|
|
23
|
+
export * from "./types/1_keyboard_button.js";
|
|
24
|
+
export * from "./types/1_photo.js";
|
|
25
|
+
export * from "./types/1_poll.js";
|
|
26
|
+
export * from "./types/1_sticker.js";
|
|
27
|
+
export * from "./types/1_user.js";
|
|
28
|
+
export * from "./types/1_video_note.js";
|
|
29
|
+
export * from "./types/1_video.js";
|
|
30
|
+
export * from "./types/2_game.js";
|
|
31
|
+
export * from "./types/2_inline_keyboard_markup.js";
|
|
32
|
+
export * from "./types/2_inline_query.js";
|
|
33
|
+
export * from "./types/2_reply_keyboard_markup.js";
|
|
34
|
+
export * from "./types/3_message.js";
|
|
35
|
+
export * from "./types/4_callback_query.js";
|
package/esm/3_types.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export * from "./types/!0_file_id.js";
|
|
2
|
+
export * from "./types/0_audio.js";
|
|
3
|
+
export * from "./types/0_chat_administrator_rights.js";
|
|
4
|
+
export * from "./types/0_chat_photo.js";
|
|
5
|
+
export * from "./types/0_contact.js";
|
|
6
|
+
export * from "./types/0_dice.js";
|
|
7
|
+
export * from "./types/0_force_reply.js";
|
|
8
|
+
export * from "./types/0_keyboard_button_poll_type.js";
|
|
9
|
+
export * from "./types/0_location.js";
|
|
10
|
+
export * from "./types/0_login_url.js";
|
|
11
|
+
export * from "./types/0_mask_position.js";
|
|
12
|
+
export * from "./types/0_message_entity.js";
|
|
13
|
+
export * from "./types/0_poll_option.js";
|
|
14
|
+
export * from "./types/0_reply_keyboard_remove.js";
|
|
15
|
+
export * from "./types/0_thumbnail.js";
|
|
16
|
+
export * from "./types/0_venue.js";
|
|
17
|
+
export * from "./types/0_voice.js";
|
|
18
|
+
export * from "./types/0_web_app_info.js";
|
|
19
|
+
export * from "./types/1_animation.js";
|
|
20
|
+
export * from "./types/1_chat.js";
|
|
21
|
+
export * from "./types/1_document.js";
|
|
22
|
+
export * from "./types/1_inline_keyboard_button.js";
|
|
23
|
+
export * from "./types/1_keyboard_button.js";
|
|
24
|
+
export * from "./types/1_photo.js";
|
|
25
|
+
export * from "./types/1_poll.js";
|
|
26
|
+
export * from "./types/1_sticker.js";
|
|
27
|
+
export * from "./types/1_user.js";
|
|
28
|
+
export * from "./types/1_video_note.js";
|
|
29
|
+
export * from "./types/1_video.js";
|
|
30
|
+
export * from "./types/2_game.js";
|
|
31
|
+
export * from "./types/2_inline_keyboard_markup.js";
|
|
32
|
+
export * from "./types/2_inline_query.js";
|
|
33
|
+
export * from "./types/2_reply_keyboard_markup.js";
|
|
34
|
+
export * from "./types/3_message.js";
|
|
35
|
+
export * from "./types/4_callback_query.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { DC } from "./
|
|
1
|
+
import { DC } from "./3_transport.js";
|
|
2
2
|
export declare const ACK_THRESHOLD = 10;
|
|
3
3
|
export type PublicKeys = readonly [bigint, [bigint, bigint]][];
|
|
4
4
|
export declare const PUBLIC_KEYS: PublicKeys;
|
|
5
5
|
export declare const VECTOR_CONSTRUCTOR = 481674261;
|
|
6
6
|
export declare const INITIAL_DC: DC;
|
|
7
7
|
export declare const LAYER = 161;
|
|
8
|
-
export declare const APP_VERSION = "MTKruto 0.0.
|
|
8
|
+
export declare const APP_VERSION = "MTKruto 0.0.993";
|
|
9
9
|
export declare const DEVICE_MODEL: string;
|
|
10
10
|
export declare const LANG_CODE: string;
|
|
11
11
|
export declare const LANG_PACK = "";
|
|
@@ -54,7 +54,7 @@ export const PUBLIC_KEYS = Object.freeze([
|
|
|
54
54
|
export const VECTOR_CONSTRUCTOR = 0x1CB5C415;
|
|
55
55
|
export const INITIAL_DC = "2-test";
|
|
56
56
|
export const LAYER = 161;
|
|
57
|
-
export const APP_VERSION = "MTKruto 0.0.
|
|
57
|
+
export const APP_VERSION = "MTKruto 0.0.993";
|
|
58
58
|
// @ts-ignore: lib
|
|
59
59
|
export const DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
|
|
60
60
|
export const LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
|
package/esm/5_client.js
ADDED
package/esm/client/0_html.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MessageEntity } from "../
|
|
1
|
+
import { MessageEntity } from "../3_types.js";
|
|
2
2
|
export declare function parseHtml(html: string): readonly [string, MessageEntity[]];
|
package/esm/client/0_html.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Message } from "../
|
|
2
|
-
import { MessageContainer } from "../tl/7_message_container.js";
|
|
1
|
+
import { Message, MessageContainer } from "../2_tl.js";
|
|
3
2
|
export declare function getMessageId(lastMsgId: bigint): bigint;
|
|
4
3
|
export declare function packUnencryptedMessage(data: Uint8Array, messageId: bigint): Uint8Array;
|
|
5
4
|
export declare function unpackUnencryptedMessage(buffer: Uint8Array): {
|
package/esm/client/0_message.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import { assertEquals, ige256Decrypt, ige256Encrypt } from "../
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { id, serialize } from "../tl/1_tl_object.js";
|
|
5
|
-
import { TLReader } from "../tl/3_tl_reader.js";
|
|
6
|
-
import { RPCResult } from "../tl/5_rpc_result.js";
|
|
7
|
-
import { Message } from "../tl/6_message.js";
|
|
8
|
-
import { MessageContainer } from "../tl/7_message_container.js";
|
|
9
|
-
import { bufferFromBigInt, concat } from "../utilities/0_buffer.js";
|
|
10
|
-
import { sha256 } from "../utilities/0_hash.js";
|
|
1
|
+
import { assertEquals, ige256Decrypt, ige256Encrypt } from "../0_deps.js";
|
|
2
|
+
import { bufferFromBigInt, concat, sha256 } from "../1_utilities.js";
|
|
3
|
+
import { id, Message, MessageContainer, RPCResult, serialize, TLReader, TLWriter } from "../2_tl.js";
|
|
11
4
|
export function getMessageId(lastMsgId) {
|
|
12
5
|
const now = new Date().getTime() / 1000 + 0;
|
|
13
6
|
const nanoseconds = Math.floor((now - Math.floor(now)) * 1e9);
|
|
@@ -20,7 +13,7 @@ export function getMessageId(lastMsgId) {
|
|
|
20
13
|
return newMsgId;
|
|
21
14
|
}
|
|
22
15
|
export function packUnencryptedMessage(data, messageId) {
|
|
23
|
-
const writer = new
|
|
16
|
+
const writer = new TLWriter();
|
|
24
17
|
writer.writeInt64(0n); // auth key
|
|
25
18
|
writer.writeInt64(messageId);
|
|
26
19
|
writer.writeInt32(data.length);
|
|
@@ -28,7 +21,7 @@ export function packUnencryptedMessage(data, messageId) {
|
|
|
28
21
|
return writer.buffer;
|
|
29
22
|
}
|
|
30
23
|
export function unpackUnencryptedMessage(buffer) {
|
|
31
|
-
const reader = new
|
|
24
|
+
const reader = new TLReader(buffer);
|
|
32
25
|
const _authKeyId = reader.readInt64();
|
|
33
26
|
const messageId = reader.readInt64();
|
|
34
27
|
const messageLength = reader.readInt32();
|
|
@@ -37,7 +30,7 @@ export function unpackUnencryptedMessage(buffer) {
|
|
|
37
30
|
}
|
|
38
31
|
export async function encryptMessage(message, authKey, authKeyId, salt, sessionId) {
|
|
39
32
|
const encoded = message.body[serialize]();
|
|
40
|
-
const payloadWriter = new
|
|
33
|
+
const payloadWriter = new TLWriter();
|
|
41
34
|
payloadWriter.writeInt64(salt);
|
|
42
35
|
payloadWriter.writeInt64(sessionId);
|
|
43
36
|
payloadWriter.writeInt64(message.id);
|
|
@@ -57,7 +50,7 @@ export async function encryptMessage(message, authKey, authKeyId, salt, sessionI
|
|
|
57
50
|
const b = await sha256(concat(authKey.slice(40, 76), messageKey));
|
|
58
51
|
const aesKey = concat(a.slice(0, 8), b.slice(8, 24), a.slice(24, 32));
|
|
59
52
|
const aesIV = concat(b.slice(0, 8), a.slice(8, 24), b.slice(24, 32));
|
|
60
|
-
const messageWriter = new
|
|
53
|
+
const messageWriter = new TLWriter();
|
|
61
54
|
messageWriter.writeInt64(authKeyId);
|
|
62
55
|
messageWriter.write(messageKey);
|
|
63
56
|
messageWriter.write(ige256Encrypt(payload, aesKey, aesIV));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { sha256 } from "../1_utilities.js";
|
|
2
|
+
import { types } from "../2_tl.js";
|
|
3
3
|
export declare function isSafePrime(primeBytes: Uint8Array, g: number): boolean;
|
|
4
4
|
export declare const h: typeof sha256;
|
|
5
5
|
export declare const sh: (data: Uint8Array, salt: Uint8Array) => Promise<Uint8Array>;
|
package/esm/client/0_password.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { sha256 } from "../utilities/0_hash.js";
|
|
5
|
-
import { bigIntFromBuffer, getRandomBigInt, mod, modExp } from "../utilities/0_bigint.js";
|
|
2
|
+
import { bigIntFromBuffer, bufferFromBigInt, concat, getRandomBigInt, mod, modExp, sha256 } from "../1_utilities.js";
|
|
3
|
+
import { types } from "../2_tl.js";
|
|
6
4
|
export function isSafePrime(primeBytes, g) {
|
|
7
5
|
// deno-fmt-ignore
|
|
8
6
|
const goodPrime = new Uint8Array([
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function hasPts(v: types.TypeUpdate | types.TypeUpdates): v is types.UpdateShortMessage | types.UpdateShortChatMessage | types.UpdateShortSentMessage | types.UpdateNewMessage | types.UpdateDeleteMessages | types.UpdateReadHistoryInbox | types.UpdateReadHistoryOutbox | types.UpdatePinnedChannelMessages | types.UpdatePinnedMessages | types.UpdateFolderPeers | types.UpdateChannelWebPage | types.UpdateEditMessage | types.UpdateReadMessagesContents | types.UpdateWebPage;
|
|
5
|
-
export declare function hasChannelPts(v: types.TypeUpdate | types.TypeUpdates): v is types.UpdateNewChannelMessage | types.UpdateEditChannelMessage | types.UpdateDeleteChannelMessages | types.UpdateReadChannelInbox;
|
|
1
|
+
import { types } from "../2_tl.js";
|
|
2
|
+
export declare function isPtsUpdate(v: types.TypeUpdate | types.TypeUpdates): v is types.UpdateShortMessage | types.UpdateShortChatMessage | types.UpdateShortSentMessage | types.UpdateNewMessage | types.UpdateDeleteMessages | types.UpdateReadHistoryInbox | types.UpdateReadHistoryOutbox | types.UpdatePinnedChannelMessages | types.UpdatePinnedMessages | types.UpdateFolderPeers | types.UpdateChannelWebPage | types.UpdateEditMessage | types.UpdateReadMessagesContents | types.UpdateWebPage;
|
|
3
|
+
export declare function isChannelPtsUpdate(v: types.TypeUpdate | types.TypeUpdates): v is types.UpdateNewChannelMessage | types.UpdateEditChannelMessage | types.UpdateDeleteChannelMessages | types.UpdateReadChannelInbox;
|
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { UNREACHABLE } from "../utilities/0_control.js";
|
|
4
|
-
export function getChannelChatId(channelId) {
|
|
5
|
-
return ZERO_CHANNEL_ID + -Number(channelId);
|
|
6
|
-
}
|
|
7
|
-
export function peerToChatId(peer) {
|
|
8
|
-
if (peer instanceof types.PeerUser || peer instanceof types.InputPeerUser) {
|
|
9
|
-
return Number(peer.userId);
|
|
10
|
-
}
|
|
11
|
-
else if (peer instanceof types.PeerChat || peer instanceof types.InputPeerChat) {
|
|
12
|
-
return -Number(peer.chatId);
|
|
13
|
-
}
|
|
14
|
-
else if (peer instanceof types.PeerChannel || peer instanceof types.InputPeerChannel) {
|
|
15
|
-
return getChannelChatId(peer.channelId);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
UNREACHABLE();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export function hasPts(v) {
|
|
1
|
+
import { types } from "../2_tl.js";
|
|
2
|
+
export function isPtsUpdate(v) {
|
|
22
3
|
return v instanceof types.UpdateShortMessage ||
|
|
23
4
|
v instanceof types.UpdateShortChatMessage ||
|
|
24
5
|
v instanceof types.UpdateShortSentMessage ||
|
|
@@ -34,7 +15,7 @@ export function hasPts(v) {
|
|
|
34
15
|
v instanceof types.UpdateReadMessagesContents ||
|
|
35
16
|
v instanceof types.UpdateWebPage;
|
|
36
17
|
}
|
|
37
|
-
export function
|
|
18
|
+
export function isChannelPtsUpdate(v) {
|
|
38
19
|
return v instanceof types.UpdateNewChannelMessage ||
|
|
39
20
|
v instanceof types.UpdateEditChannelMessage ||
|
|
40
21
|
v instanceof types.UpdateDeleteChannelMessages ||
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MaybePromise } from "../
|
|
2
|
-
import { DC, TransportProvider } from "../
|
|
1
|
+
import { MaybePromise } from "../1_utilities.js";
|
|
2
|
+
import { DC, TransportProvider } from "../3_transport.js";
|
|
3
3
|
export interface ClientAbstractParams {
|
|
4
4
|
/**
|
|
5
5
|
* The first DC to connect to. This is commonly used to decide whether to connect to test or production servers. It is not necessarily the DC that the client will directly connect to or is currently connected to. Defaults to the default initial DC.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { initTgCrypto } from "../
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { initTgCrypto } from "../0_deps.js";
|
|
2
|
+
import { webSocketTransportProvider } from "../3_transport.js";
|
|
3
|
+
import { INITIAL_DC } from "../4_constants.js";
|
|
4
4
|
export class ClientAbstract {
|
|
5
5
|
constructor(params) {
|
|
6
6
|
Object.defineProperty(this, "initialDc", {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { functions } from "../2_tl.js";
|
|
2
|
+
import { PublicKeys } from "../4_constants.js";
|
|
3
3
|
import { ClientAbstract, ClientAbstractParams } from "./1_client_abstract.js";
|
|
4
4
|
export interface ClientPlainParams extends ClientAbstractParams {
|
|
5
5
|
/**
|
|
@@ -11,7 +11,7 @@ export declare class ClientPlain extends ClientAbstract {
|
|
|
11
11
|
private readonly publicKeys;
|
|
12
12
|
private lastMsgId;
|
|
13
13
|
constructor(params?: ClientPlainParams);
|
|
14
|
-
invoke<T extends Function<unknown>>(function_: T): Promise<T["__R"]>;
|
|
14
|
+
invoke<T extends functions.Function<unknown>>(function_: T): Promise<T["__R"]>;
|
|
15
15
|
createAuthKey(): Promise<{
|
|
16
16
|
authKey: Uint8Array;
|
|
17
17
|
salt: bigint;
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import { assertEquals, assertInstanceOf, debug, factorize, ige256Decrypt, ige256Encrypt } from "../
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { UNREACHABLE } from "../utilities/0_control.js";
|
|
6
|
-
import { sha1 } from "../utilities/0_hash.js";
|
|
7
|
-
import { rsaPad } from "../utilities/1_auth.js";
|
|
8
|
-
import { serialize } from "../tl/1_tl_object.js";
|
|
9
|
-
import { ClientDHInnerData, DHGenOK, PQInnerDataDC, ResPQ, ServerDHInnerData, ServerDHParamsOK } from "../tl/2_types.js";
|
|
10
|
-
import { ReqDHParams, ReqPQMulti, SetClientDHParams } from "../tl/3_functions.js";
|
|
11
|
-
import { TLReader } from "../tl/3_tl_reader.js";
|
|
1
|
+
import { assertEquals, assertInstanceOf, debug, factorize, ige256Decrypt, ige256Encrypt } from "../0_deps.js";
|
|
2
|
+
import { bigIntFromBuffer, bufferFromBigInt, concat, getRandomBigInt, modExp, rsaPad, sha1, UNREACHABLE } from "../1_utilities.js";
|
|
3
|
+
import { functions, serialize, TLReader, types } from "../2_tl.js";
|
|
4
|
+
import { PUBLIC_KEYS } from "../4_constants.js";
|
|
12
5
|
import { ClientAbstract } from "./1_client_abstract.js";
|
|
13
6
|
import { getMessageId, packUnencryptedMessage, unpackUnencryptedMessage } from "./0_message.js";
|
|
14
7
|
const d = debug("ClientPlain/createAuthKey");
|
|
@@ -53,8 +46,8 @@ export class ClientPlain extends ClientAbstract {
|
|
|
53
46
|
for (let i = 0; i < 10; i++) {
|
|
54
47
|
try {
|
|
55
48
|
d("req_pq_multi [%d]", i + 1);
|
|
56
|
-
resPq = await this.invoke(new ReqPQMulti({ nonce }));
|
|
57
|
-
assertInstanceOf(resPq, ResPQ);
|
|
49
|
+
resPq = await this.invoke(new functions.ReqPQMulti({ nonce }));
|
|
50
|
+
assertInstanceOf(resPq, types.ResPQ);
|
|
58
51
|
assertEquals(resPq.nonce, nonce);
|
|
59
52
|
d("got res_pq");
|
|
60
53
|
break;
|
|
@@ -88,7 +81,7 @@ export class ClientPlain extends ClientAbstract {
|
|
|
88
81
|
const pq = resPq.pq;
|
|
89
82
|
const serverNonce = resPq.serverNonce;
|
|
90
83
|
const newNonce = getRandomBigInt(32, false, true);
|
|
91
|
-
let encryptedData = await rsaPad(new PQInnerDataDC({
|
|
84
|
+
let encryptedData = await rsaPad(new types.PQInnerDataDC({
|
|
92
85
|
pq,
|
|
93
86
|
p,
|
|
94
87
|
q,
|
|
@@ -97,7 +90,7 @@ export class ClientPlain extends ClientAbstract {
|
|
|
97
90
|
nonce,
|
|
98
91
|
serverNonce,
|
|
99
92
|
})[serialize](), publicKey);
|
|
100
|
-
const dhParams = await this.invoke(new ReqDHParams({
|
|
93
|
+
const dhParams = await this.invoke(new functions.ReqDHParams({
|
|
101
94
|
nonce,
|
|
102
95
|
serverNonce,
|
|
103
96
|
p,
|
|
@@ -105,7 +98,7 @@ export class ClientPlain extends ClientAbstract {
|
|
|
105
98
|
publicKeyFingerprint,
|
|
106
99
|
encryptedData,
|
|
107
100
|
}));
|
|
108
|
-
assertInstanceOf(dhParams, ServerDHParamsOK);
|
|
101
|
+
assertInstanceOf(dhParams, types.ServerDHParamsOK);
|
|
109
102
|
d("got server_DH_params_ok");
|
|
110
103
|
const newNonce_ = bufferFromBigInt(newNonce, 32, true, true);
|
|
111
104
|
const serverNonce_ = bufferFromBigInt(serverNonce, 16, true, true);
|
|
@@ -113,13 +106,13 @@ export class ClientPlain extends ClientAbstract {
|
|
|
113
106
|
const tmpAesIv = concat((await sha1(concat(serverNonce_, newNonce_))).slice(12, 12 + 8), await sha1(concat(newNonce_, newNonce_)), newNonce_.slice(0, 0 + 4));
|
|
114
107
|
const answerWithHash = ige256Decrypt(dhParams.encryptedAnswer, tmpAesKey, tmpAesIv);
|
|
115
108
|
const dhInnerData = new TLReader(answerWithHash.slice(20)).readObject();
|
|
116
|
-
assertInstanceOf(dhInnerData, ServerDHInnerData);
|
|
109
|
+
assertInstanceOf(dhInnerData, types.ServerDHInnerData);
|
|
117
110
|
const { g, gA: gA_, dhPrime: dhPrime_ } = dhInnerData;
|
|
118
111
|
const gA = bigIntFromBuffer(gA_, false, false);
|
|
119
112
|
const dhPrime = bigIntFromBuffer(dhPrime_, false, false);
|
|
120
113
|
const b = getRandomBigInt(256, false, false);
|
|
121
114
|
const gB = modExp(BigInt(g), b, dhPrime);
|
|
122
|
-
const data = new ClientDHInnerData({
|
|
115
|
+
const data = new types.ClientDHInnerData({
|
|
123
116
|
nonce,
|
|
124
117
|
serverNonce,
|
|
125
118
|
retryId: 0n,
|
|
@@ -130,8 +123,8 @@ export class ClientPlain extends ClientAbstract {
|
|
|
130
123
|
dataWithHash = concat(dataWithHash, new Uint8Array(1));
|
|
131
124
|
}
|
|
132
125
|
encryptedData = ige256Encrypt(dataWithHash, tmpAesKey, tmpAesIv);
|
|
133
|
-
const dhGenOk = await this.invoke(new SetClientDHParams({ nonce, serverNonce, encryptedData }));
|
|
134
|
-
assertInstanceOf(dhGenOk, DHGenOK);
|
|
126
|
+
const dhGenOk = await this.invoke(new functions.SetClientDHParams({ nonce, serverNonce, encryptedData }));
|
|
127
|
+
assertInstanceOf(dhGenOk, types.DHGenOK);
|
|
135
128
|
d("got dh_gen_ok");
|
|
136
129
|
const serverNonceSlice = serverNonce_.slice(0, 8);
|
|
137
130
|
const salt = newNonce_.slice(0, 0 + 8).map((v, i) => v ^ serverNonceSlice[i]);
|