@mtkruto/node 0.0.990 → 0.0.992
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 +43 -18
- package/esm/client/3_client.js +107 -46
- package/esm/connection/0_connection.d.ts +1 -1
- package/esm/connection/1_connection_web_socket.js +1 -1
- package/esm/mod.d.ts +7 -21
- package/esm/mod.js +7 -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 +23 -23
- package/esm/types/3_message.js +19 -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 +43 -18
- package/script/client/3_client.js +342 -305
- package/script/connection/0_connection.d.ts +1 -1
- package/script/connection/1_connection_web_socket.js +5 -5
- package/script/mod.d.ts +7 -21
- package/script/mod.js +17 -45
- 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 +23 -23
- package/script/types/3_message.js +97 -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,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./transport/0_transport.js"), exports);
|
|
18
|
+
__exportStar(require("./transport/1_transport_abridged.js"), exports);
|
|
19
|
+
__exportStar(require("./transport/1_transport_intermediate.js"), exports);
|
|
20
|
+
__exportStar(require("./transport/2_transport_provider.js"), exports);
|
|
@@ -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";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types/!0_file_id.js"), exports);
|
|
18
|
+
__exportStar(require("./types/0_audio.js"), exports);
|
|
19
|
+
__exportStar(require("./types/0_chat_administrator_rights.js"), exports);
|
|
20
|
+
__exportStar(require("./types/0_chat_photo.js"), exports);
|
|
21
|
+
__exportStar(require("./types/0_contact.js"), exports);
|
|
22
|
+
__exportStar(require("./types/0_dice.js"), exports);
|
|
23
|
+
__exportStar(require("./types/0_force_reply.js"), exports);
|
|
24
|
+
__exportStar(require("./types/0_keyboard_button_poll_type.js"), exports);
|
|
25
|
+
__exportStar(require("./types/0_location.js"), exports);
|
|
26
|
+
__exportStar(require("./types/0_login_url.js"), exports);
|
|
27
|
+
__exportStar(require("./types/0_mask_position.js"), exports);
|
|
28
|
+
__exportStar(require("./types/0_message_entity.js"), exports);
|
|
29
|
+
__exportStar(require("./types/0_poll_option.js"), exports);
|
|
30
|
+
__exportStar(require("./types/0_reply_keyboard_remove.js"), exports);
|
|
31
|
+
__exportStar(require("./types/0_thumbnail.js"), exports);
|
|
32
|
+
__exportStar(require("./types/0_venue.js"), exports);
|
|
33
|
+
__exportStar(require("./types/0_voice.js"), exports);
|
|
34
|
+
__exportStar(require("./types/0_web_app_info.js"), exports);
|
|
35
|
+
__exportStar(require("./types/1_animation.js"), exports);
|
|
36
|
+
__exportStar(require("./types/1_chat.js"), exports);
|
|
37
|
+
__exportStar(require("./types/1_document.js"), exports);
|
|
38
|
+
__exportStar(require("./types/1_inline_keyboard_button.js"), exports);
|
|
39
|
+
__exportStar(require("./types/1_keyboard_button.js"), exports);
|
|
40
|
+
__exportStar(require("./types/1_photo.js"), exports);
|
|
41
|
+
__exportStar(require("./types/1_poll.js"), exports);
|
|
42
|
+
__exportStar(require("./types/1_sticker.js"), exports);
|
|
43
|
+
__exportStar(require("./types/1_user.js"), exports);
|
|
44
|
+
__exportStar(require("./types/1_video_note.js"), exports);
|
|
45
|
+
__exportStar(require("./types/1_video.js"), exports);
|
|
46
|
+
__exportStar(require("./types/2_game.js"), exports);
|
|
47
|
+
__exportStar(require("./types/2_inline_keyboard_markup.js"), exports);
|
|
48
|
+
__exportStar(require("./types/2_inline_query.js"), exports);
|
|
49
|
+
__exportStar(require("./types/2_reply_keyboard_markup.js"), exports);
|
|
50
|
+
__exportStar(require("./types/3_message.js"), exports);
|
|
51
|
+
__exportStar(require("./types/4_callback_query.js"), exports);
|
|
@@ -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.992";
|
|
9
9
|
export declare const DEVICE_MODEL: string;
|
|
10
10
|
export declare const LANG_CODE: string;
|
|
11
11
|
export declare const LANG_PACK = "";
|
|
@@ -80,7 +80,7 @@ exports.PUBLIC_KEYS = Object.freeze([
|
|
|
80
80
|
exports.VECTOR_CONSTRUCTOR = 0x1CB5C415;
|
|
81
81
|
exports.INITIAL_DC = "2-test";
|
|
82
82
|
exports.LAYER = 161;
|
|
83
|
-
exports.APP_VERSION = "MTKruto 0.0.
|
|
83
|
+
exports.APP_VERSION = "MTKruto 0.0.992";
|
|
84
84
|
// @ts-ignore: lib
|
|
85
85
|
exports.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;
|
|
86
86
|
exports.LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./client/2_client_plain.js"), exports);
|
|
18
|
+
__exportStar(require("./client/3_client.js"), exports);
|
|
@@ -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/script/client/0_html.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseHtml = void 0;
|
|
4
|
-
const
|
|
4
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
5
5
|
function parseHtml(html) {
|
|
6
6
|
let text = "";
|
|
7
7
|
const entities = new Array();
|
|
8
8
|
const queue = new Array();
|
|
9
|
-
const parser = new
|
|
9
|
+
const parser = new _0_deps_js_1.Parser({
|
|
10
10
|
onopentag(name, attribs) {
|
|
11
11
|
switch (name) {
|
|
12
12
|
case "b":
|
|
@@ -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): {
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.decryptMessage = exports.encryptMessage = exports.unpackUnencryptedMessage = exports.packUnencryptedMessage = exports.getMessageId = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const _1_tl_object_js_1 = require("../tl/1_tl_object.js");
|
|
8
|
-
const _3_tl_reader_js_1 = require("../tl/3_tl_reader.js");
|
|
9
|
-
const _5_rpc_result_js_1 = require("../tl/5_rpc_result.js");
|
|
10
|
-
const _6_message_js_1 = require("../tl/6_message.js");
|
|
11
|
-
const _7_message_container_js_1 = require("../tl/7_message_container.js");
|
|
12
|
-
const _0_buffer_js_1 = require("../utilities/0_buffer.js");
|
|
13
|
-
const _0_hash_js_1 = require("../utilities/0_hash.js");
|
|
4
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
5
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
6
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
14
7
|
function getMessageId(lastMsgId) {
|
|
15
8
|
const now = new Date().getTime() / 1000 + 0;
|
|
16
9
|
const nanoseconds = Math.floor((now - Math.floor(now)) * 1e9);
|
|
@@ -24,7 +17,7 @@ function getMessageId(lastMsgId) {
|
|
|
24
17
|
}
|
|
25
18
|
exports.getMessageId = getMessageId;
|
|
26
19
|
function packUnencryptedMessage(data, messageId) {
|
|
27
|
-
const writer = new
|
|
20
|
+
const writer = new _2_tl_js_1.TLWriter();
|
|
28
21
|
writer.writeInt64(0n); // auth key
|
|
29
22
|
writer.writeInt64(messageId);
|
|
30
23
|
writer.writeInt32(data.length);
|
|
@@ -33,7 +26,7 @@ function packUnencryptedMessage(data, messageId) {
|
|
|
33
26
|
}
|
|
34
27
|
exports.packUnencryptedMessage = packUnencryptedMessage;
|
|
35
28
|
function unpackUnencryptedMessage(buffer) {
|
|
36
|
-
const reader = new
|
|
29
|
+
const reader = new _2_tl_js_1.TLReader(buffer);
|
|
37
30
|
const _authKeyId = reader.readInt64();
|
|
38
31
|
const messageId = reader.readInt64();
|
|
39
32
|
const messageLength = reader.readInt32();
|
|
@@ -42,8 +35,8 @@ function unpackUnencryptedMessage(buffer) {
|
|
|
42
35
|
}
|
|
43
36
|
exports.unpackUnencryptedMessage = unpackUnencryptedMessage;
|
|
44
37
|
async function encryptMessage(message, authKey, authKeyId, salt, sessionId) {
|
|
45
|
-
const encoded = message.body[
|
|
46
|
-
const payloadWriter = new
|
|
38
|
+
const encoded = message.body[_2_tl_js_1.serialize]();
|
|
39
|
+
const payloadWriter = new _2_tl_js_1.TLWriter();
|
|
47
40
|
payloadWriter.writeInt64(salt);
|
|
48
41
|
payloadWriter.writeInt64(sessionId);
|
|
49
42
|
payloadWriter.writeInt64(message.id);
|
|
@@ -56,49 +49,49 @@ async function encryptMessage(message, authKey, authKeyId, salt, sessionId) {
|
|
|
56
49
|
if (payload.length % 16 == 0 && (payload.length) % 4 == 0) {
|
|
57
50
|
break;
|
|
58
51
|
}
|
|
59
|
-
payload = (0,
|
|
52
|
+
payload = (0, _1_utilities_js_1.concat)(payload, new Uint8Array(1));
|
|
60
53
|
}
|
|
61
|
-
const messageKey = (await (0,
|
|
62
|
-
const a = await (0,
|
|
63
|
-
const b = await (0,
|
|
64
|
-
const aesKey = (0,
|
|
65
|
-
const aesIV = (0,
|
|
66
|
-
const messageWriter = new
|
|
54
|
+
const messageKey = (await (0, _1_utilities_js_1.sha256)((0, _1_utilities_js_1.concat)(authKey.slice(88, 120), payload))).slice(8, 24);
|
|
55
|
+
const a = await (0, _1_utilities_js_1.sha256)((0, _1_utilities_js_1.concat)(messageKey, authKey.slice(0, 36)));
|
|
56
|
+
const b = await (0, _1_utilities_js_1.sha256)((0, _1_utilities_js_1.concat)(authKey.slice(40, 76), messageKey));
|
|
57
|
+
const aesKey = (0, _1_utilities_js_1.concat)(a.slice(0, 8), b.slice(8, 24), a.slice(24, 32));
|
|
58
|
+
const aesIV = (0, _1_utilities_js_1.concat)(b.slice(0, 8), a.slice(8, 24), b.slice(24, 32));
|
|
59
|
+
const messageWriter = new _2_tl_js_1.TLWriter();
|
|
67
60
|
messageWriter.writeInt64(authKeyId);
|
|
68
61
|
messageWriter.write(messageKey);
|
|
69
|
-
messageWriter.write((0,
|
|
62
|
+
messageWriter.write((0, _0_deps_js_1.ige256Encrypt)(payload, aesKey, aesIV));
|
|
70
63
|
return messageWriter.buffer;
|
|
71
64
|
}
|
|
72
65
|
exports.encryptMessage = encryptMessage;
|
|
73
66
|
async function decryptMessage(buffer, authKey, authKeyId, _sessionId) {
|
|
74
|
-
const reader = new
|
|
75
|
-
(0,
|
|
67
|
+
const reader = new _2_tl_js_1.TLReader(buffer);
|
|
68
|
+
(0, _0_deps_js_1.assertEquals)(reader.readInt64(false), authKeyId);
|
|
76
69
|
const messageKey_ = reader.readInt128();
|
|
77
|
-
const messageKey = (0,
|
|
78
|
-
const a = await (0,
|
|
79
|
-
const b = await (0,
|
|
80
|
-
const aesKey = (0,
|
|
81
|
-
const aesIv = (0,
|
|
82
|
-
const plaintext = (0,
|
|
83
|
-
(0,
|
|
84
|
-
let plainReader = new
|
|
70
|
+
const messageKey = (0, _1_utilities_js_1.bufferFromBigInt)(messageKey_, 16, true, true);
|
|
71
|
+
const a = await (0, _1_utilities_js_1.sha256)((0, _1_utilities_js_1.concat)(messageKey, authKey.slice(8, 44)));
|
|
72
|
+
const b = await (0, _1_utilities_js_1.sha256)((0, _1_utilities_js_1.concat)(authKey.slice(48, 84), messageKey));
|
|
73
|
+
const aesKey = (0, _1_utilities_js_1.concat)(a.slice(0, 8), b.slice(8, 24), a.slice(24, 32));
|
|
74
|
+
const aesIv = (0, _1_utilities_js_1.concat)(b.slice(0, 8), a.slice(8, 24), b.slice(24, 32));
|
|
75
|
+
const plaintext = (0, _0_deps_js_1.ige256Decrypt)(reader.buffer, aesKey, aesIv);
|
|
76
|
+
(0, _0_deps_js_1.assertEquals)(plaintext.buffer.byteLength % 4, 0);
|
|
77
|
+
let plainReader = new _2_tl_js_1.TLReader(plaintext);
|
|
85
78
|
const _salt = plainReader.readInt64();
|
|
86
79
|
const _sessionId_ = plainReader.readInt64(false);
|
|
87
80
|
const mid = plainReader.readInt64();
|
|
88
81
|
const seqno = plainReader.readInt32();
|
|
89
82
|
const length = plainReader.readInt32();
|
|
90
|
-
plainReader = new
|
|
83
|
+
plainReader = new _2_tl_js_1.TLReader(plainReader.read(length));
|
|
91
84
|
const cid = plainReader.readInt32(false);
|
|
92
|
-
if (cid ==
|
|
93
|
-
return
|
|
85
|
+
if (cid == _2_tl_js_1.MessageContainer[_2_tl_js_1.id]) {
|
|
86
|
+
return _2_tl_js_1.MessageContainer.deserialize(plainReader.buffer);
|
|
94
87
|
}
|
|
95
|
-
else if (cid ==
|
|
96
|
-
const body =
|
|
97
|
-
return new
|
|
88
|
+
else if (cid == _2_tl_js_1.RPCResult[_2_tl_js_1.id]) {
|
|
89
|
+
const body = _2_tl_js_1.RPCResult.deserialize(plainReader.buffer);
|
|
90
|
+
return new _2_tl_js_1.Message(mid, seqno, body);
|
|
98
91
|
}
|
|
99
92
|
else {
|
|
100
93
|
const body = plainReader.readObject(cid);
|
|
101
|
-
return new
|
|
94
|
+
return new _2_tl_js_1.Message(mid, seqno, body);
|
|
102
95
|
}
|
|
103
96
|
}
|
|
104
97
|
exports.decryptMessage = decryptMessage;
|
|
@@ -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>;
|
|
@@ -25,10 +25,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.checkPassword = exports.pad = exports.isGoodModExpFirst = exports.ph2 = exports.pbkdf2 = exports.ph1 = exports.sh = exports.h = exports.isSafePrime = void 0;
|
|
27
27
|
const dntShim = __importStar(require("../_dnt.shims.js"));
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const _0_hash_js_1 = require("../utilities/0_hash.js");
|
|
31
|
-
const _0_bigint_js_1 = require("../utilities/0_bigint.js");
|
|
28
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
29
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
32
30
|
function isSafePrime(primeBytes, g) {
|
|
33
31
|
// deno-fmt-ignore
|
|
34
32
|
const goodPrime = new Uint8Array([
|
|
@@ -64,9 +62,9 @@ function isSafePrime(primeBytes, g) {
|
|
|
64
62
|
}
|
|
65
63
|
exports.isSafePrime = isSafePrime;
|
|
66
64
|
// H(data) := sha256(data)
|
|
67
|
-
exports.h =
|
|
65
|
+
exports.h = _1_utilities_js_1.sha256;
|
|
68
66
|
// SH(data, salt) := H(salt | data | salt)
|
|
69
|
-
const sh = (data, salt) => (0, exports.h)((0,
|
|
67
|
+
const sh = (data, salt) => (0, exports.h)((0, _1_utilities_js_1.concat)(salt, data, salt));
|
|
70
68
|
exports.sh = sh;
|
|
71
69
|
// PH1(password, salt1, salt2) := SH(SH(password, salt1), salt2)
|
|
72
70
|
const ph1 = async (password, salt1, salt2) => await (0, exports.sh)(await (0, exports.sh)(password, salt1), salt2);
|
|
@@ -95,10 +93,10 @@ function pad(bigint) {
|
|
|
95
93
|
bigint = BigInt(bigint);
|
|
96
94
|
}
|
|
97
95
|
if (typeof bigint === "bigint") {
|
|
98
|
-
return (0,
|
|
96
|
+
return (0, _1_utilities_js_1.bufferFromBigInt)(bigint, 256, false);
|
|
99
97
|
}
|
|
100
98
|
else {
|
|
101
|
-
return (0,
|
|
99
|
+
return (0, _1_utilities_js_1.concat)(new Uint8Array(256 - bigint.length), bigint);
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
102
|
exports.pad = pad;
|
|
@@ -106,13 +104,13 @@ async function checkPassword(password_, ap) {
|
|
|
106
104
|
const password = new TextEncoder().encode(password_);
|
|
107
105
|
const algo = ap.currentAlgo;
|
|
108
106
|
if (!(algo instanceof
|
|
109
|
-
types.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow)) {
|
|
107
|
+
_2_tl_js_1.types.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow)) {
|
|
110
108
|
throw new Error("Unexpected algorithm");
|
|
111
109
|
}
|
|
112
110
|
// g := algo.g
|
|
113
111
|
const g = algo.g;
|
|
114
112
|
// p := algo.p
|
|
115
|
-
const p = (0,
|
|
113
|
+
const p = (0, _1_utilities_js_1.bigIntFromBuffer)(algo.p, false);
|
|
116
114
|
if (!isSafePrime(algo.p, g)) {
|
|
117
115
|
throw new Error("Got unsafe prime");
|
|
118
116
|
}
|
|
@@ -131,18 +129,18 @@ async function checkPassword(password_, ap) {
|
|
|
131
129
|
// salt2 := algo.salt2
|
|
132
130
|
const salt2 = algo.salt2;
|
|
133
131
|
// g_b := srp_B
|
|
134
|
-
const gB = (0,
|
|
132
|
+
const gB = (0, _1_utilities_js_1.bigIntFromBuffer)(srpB, false);
|
|
135
133
|
// k := H(p | g)
|
|
136
|
-
const k = (0,
|
|
134
|
+
const k = (0, _1_utilities_js_1.bigIntFromBuffer)(await (0, exports.h)((0, _1_utilities_js_1.concat)(pad(p), pad(g))), false);
|
|
137
135
|
let u = 0n;
|
|
138
136
|
let a = 0n;
|
|
139
137
|
let gA = 0n;
|
|
140
138
|
for (let i = 0; i < 1000; i++) {
|
|
141
|
-
a = (0,
|
|
139
|
+
a = (0, _1_utilities_js_1.getRandomBigInt)(256, false);
|
|
142
140
|
// g_a := pow(g, a) mod p
|
|
143
|
-
gA = (0,
|
|
141
|
+
gA = (0, _1_utilities_js_1.modExp)(BigInt(g), a, p);
|
|
144
142
|
if (isGoodModExpFirst(gA, p)) {
|
|
145
|
-
u = (0,
|
|
143
|
+
u = (0, _1_utilities_js_1.bigIntFromBuffer)(await (0, _1_utilities_js_1.sha256)((0, _1_utilities_js_1.concat)(pad(gA), pad(gB))), false);
|
|
146
144
|
if (u > 0n) {
|
|
147
145
|
break;
|
|
148
146
|
}
|
|
@@ -152,21 +150,21 @@ async function checkPassword(password_, ap) {
|
|
|
152
150
|
throw new Error();
|
|
153
151
|
}
|
|
154
152
|
// x := PH2(password, salt1, salt2)
|
|
155
|
-
const x = (0,
|
|
153
|
+
const x = (0, _1_utilities_js_1.bigIntFromBuffer)(await (0, exports.ph2)(password, salt1, salt2), false);
|
|
156
154
|
// v := pow(g, x) mod p
|
|
157
|
-
const v = (0,
|
|
155
|
+
const v = (0, _1_utilities_js_1.modExp)(BigInt(g), x, p);
|
|
158
156
|
// k_v := (k * v) mod p
|
|
159
|
-
const kV = (0,
|
|
157
|
+
const kV = (0, _1_utilities_js_1.mod)(k * v, p);
|
|
160
158
|
// t := (g_b - k_v) mod p
|
|
161
|
-
const t = (0,
|
|
159
|
+
const t = (0, _1_utilities_js_1.mod)(gB - kV, p);
|
|
162
160
|
// s_a := pow(t, a + u * x) mod p
|
|
163
|
-
const sA = (0,
|
|
161
|
+
const sA = (0, _1_utilities_js_1.modExp)(t, a + u * x, p);
|
|
164
162
|
// k_a := H(s_a)
|
|
165
163
|
const kA = await (0, exports.h)(pad(sA));
|
|
166
164
|
// M1 := H(H(p) xor H(g) | H(salt1) | H(salt2) | g_a | g_b | k_a)
|
|
167
165
|
const hG = await (0, exports.h)(pad(g));
|
|
168
|
-
const m1 = await (0, exports.h)((0,
|
|
169
|
-
return new types.InputCheckPasswordSRP({
|
|
166
|
+
const m1 = await (0, exports.h)((0, _1_utilities_js_1.concat)((await (0, exports.h)(pad(p))).map((v, i) => v ^ hG[i]), await (0, exports.h)(salt1), await (0, exports.h)(salt2), pad(gA), pad(gB), kA));
|
|
167
|
+
return new _2_tl_js_1.types.InputCheckPasswordSRP({
|
|
170
168
|
srpId: srpId,
|
|
171
169
|
A: pad(gA),
|
|
172
170
|
M1: m1,
|
|
@@ -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,72 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
3
|
+
exports.isChannelPtsUpdate = exports.isPtsUpdate = void 0;
|
|
4
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
5
|
+
function isPtsUpdate(v) {
|
|
6
|
+
return v instanceof _2_tl_js_1.types.UpdateShortMessage ||
|
|
7
|
+
v instanceof _2_tl_js_1.types.UpdateShortChatMessage ||
|
|
8
|
+
v instanceof _2_tl_js_1.types.UpdateShortSentMessage ||
|
|
9
|
+
v instanceof _2_tl_js_1.types.UpdateNewMessage ||
|
|
10
|
+
v instanceof _2_tl_js_1.types.UpdateDeleteMessages ||
|
|
11
|
+
v instanceof _2_tl_js_1.types.UpdateReadHistoryInbox ||
|
|
12
|
+
v instanceof _2_tl_js_1.types.UpdateReadHistoryOutbox ||
|
|
13
|
+
v instanceof _2_tl_js_1.types.UpdatePinnedChannelMessages ||
|
|
14
|
+
v instanceof _2_tl_js_1.types.UpdatePinnedMessages ||
|
|
15
|
+
v instanceof _2_tl_js_1.types.UpdateFolderPeers ||
|
|
16
|
+
v instanceof _2_tl_js_1.types.UpdateChannelWebPage ||
|
|
17
|
+
v instanceof _2_tl_js_1.types.UpdateEditMessage ||
|
|
18
|
+
v instanceof _2_tl_js_1.types.UpdateReadMessagesContents ||
|
|
19
|
+
v instanceof _2_tl_js_1.types.UpdateWebPage;
|
|
32
20
|
}
|
|
33
|
-
exports.
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return -Number(peer.chatId);
|
|
40
|
-
}
|
|
41
|
-
else if (peer instanceof types.PeerChannel || peer instanceof types.InputPeerChannel) {
|
|
42
|
-
return getChannelChatId(peer.channelId);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
(0, _0_control_js_1.UNREACHABLE)();
|
|
46
|
-
}
|
|
21
|
+
exports.isPtsUpdate = isPtsUpdate;
|
|
22
|
+
function isChannelPtsUpdate(v) {
|
|
23
|
+
return v instanceof _2_tl_js_1.types.UpdateNewChannelMessage ||
|
|
24
|
+
v instanceof _2_tl_js_1.types.UpdateEditChannelMessage ||
|
|
25
|
+
v instanceof _2_tl_js_1.types.UpdateDeleteChannelMessages ||
|
|
26
|
+
v instanceof _2_tl_js_1.types.UpdateReadChannelInbox;
|
|
47
27
|
}
|
|
48
|
-
exports.
|
|
49
|
-
function hasPts(v) {
|
|
50
|
-
return v instanceof types.UpdateShortMessage ||
|
|
51
|
-
v instanceof types.UpdateShortChatMessage ||
|
|
52
|
-
v instanceof types.UpdateShortSentMessage ||
|
|
53
|
-
v instanceof types.UpdateNewMessage ||
|
|
54
|
-
v instanceof types.UpdateDeleteMessages ||
|
|
55
|
-
v instanceof types.UpdateReadHistoryInbox ||
|
|
56
|
-
v instanceof types.UpdateReadHistoryOutbox ||
|
|
57
|
-
v instanceof types.UpdatePinnedChannelMessages ||
|
|
58
|
-
v instanceof types.UpdatePinnedMessages ||
|
|
59
|
-
v instanceof types.UpdateFolderPeers ||
|
|
60
|
-
v instanceof types.UpdateChannelWebPage ||
|
|
61
|
-
v instanceof types.UpdateEditMessage ||
|
|
62
|
-
v instanceof types.UpdateReadMessagesContents ||
|
|
63
|
-
v instanceof types.UpdateWebPage;
|
|
64
|
-
}
|
|
65
|
-
exports.hasPts = hasPts;
|
|
66
|
-
function hasChannelPts(v) {
|
|
67
|
-
return v instanceof types.UpdateNewChannelMessage ||
|
|
68
|
-
v instanceof types.UpdateEditChannelMessage ||
|
|
69
|
-
v instanceof types.UpdateDeleteChannelMessages ||
|
|
70
|
-
v instanceof types.UpdateReadChannelInbox;
|
|
71
|
-
}
|
|
72
|
-
exports.hasChannelPts = hasChannelPts;
|
|
28
|
+
exports.isChannelPtsUpdate = isChannelPtsUpdate;
|
|
@@ -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,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ClientAbstract = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
4
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
5
|
+
const _3_transport_js_1 = require("../3_transport.js");
|
|
6
|
+
const _4_constants_js_1 = require("../4_constants.js");
|
|
7
7
|
class ClientAbstract {
|
|
8
8
|
constructor(params) {
|
|
9
9
|
Object.defineProperty(this, "initialDc", {
|
|
@@ -42,8 +42,8 @@ class ClientAbstract {
|
|
|
42
42
|
writable: true,
|
|
43
43
|
value: void 0
|
|
44
44
|
});
|
|
45
|
-
this.initialDc = params?.initialDc ??
|
|
46
|
-
this.transportProvider = params?.transportProvider ?? (0,
|
|
45
|
+
this.initialDc = params?.initialDc ?? _4_constants_js_1.INITIAL_DC;
|
|
46
|
+
this.transportProvider = params?.transportProvider ?? (0, _3_transport_js_1.webSocketTransportProvider)();
|
|
47
47
|
this.cdn = params?.cdn ?? false;
|
|
48
48
|
}
|
|
49
49
|
get dcId() {
|
|
@@ -62,7 +62,7 @@ class ClientAbstract {
|
|
|
62
62
|
async connect() {
|
|
63
63
|
this.transport = this.transportProvider({ dc: this.dc ?? this.initialDc, cdn: this.cdn });
|
|
64
64
|
this.transport.connection.stateChangeHandler = this.stateChangeHandler;
|
|
65
|
-
await (0,
|
|
65
|
+
await (0, _0_deps_js_1.initTgCrypto)();
|
|
66
66
|
await this.transport.connection.open();
|
|
67
67
|
await this.transport.transport.initialize();
|
|
68
68
|
}
|
|
@@ -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;
|