@mtkruto/node 0.0.991 → 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 +33 -18
- package/esm/client/3_client.js +47 -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 +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 +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 +33 -18
- package/script/client/3_client.js +291 -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 +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 +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
|
@@ -25,9 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.ConnectionWebSocket = void 0;
|
|
27
27
|
const dntShim = __importStar(require("../_dnt.shims.js"));
|
|
28
|
-
const
|
|
28
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
29
29
|
const _0_connection_js_1 = require("./0_connection.js");
|
|
30
|
-
const d = (0,
|
|
30
|
+
const d = (0, _0_deps_js_1.debug)("ConnectionWebSocket");
|
|
31
31
|
class ConnectionWebSocket extends _0_connection_js_1.ConnectionUnframed {
|
|
32
32
|
constructor(url) {
|
|
33
33
|
super();
|
|
@@ -47,13 +47,13 @@ class ConnectionWebSocket extends _0_connection_js_1.ConnectionUnframed {
|
|
|
47
47
|
enumerable: true,
|
|
48
48
|
configurable: true,
|
|
49
49
|
writable: true,
|
|
50
|
-
value: new
|
|
50
|
+
value: new _0_deps_js_1.Mutex()
|
|
51
51
|
});
|
|
52
52
|
Object.defineProperty(this, "wMutex", {
|
|
53
53
|
enumerable: true,
|
|
54
54
|
configurable: true,
|
|
55
55
|
writable: true,
|
|
56
|
-
value: new
|
|
56
|
+
value: new _0_deps_js_1.Mutex()
|
|
57
57
|
});
|
|
58
58
|
Object.defineProperty(this, "buffer", {
|
|
59
59
|
enumerable: true,
|
|
@@ -89,7 +89,7 @@ class ConnectionWebSocket extends _0_connection_js_1.ConnectionUnframed {
|
|
|
89
89
|
}
|
|
90
90
|
initWs() {
|
|
91
91
|
const webSocket = new dntShim.WebSocket(this.url, "binary");
|
|
92
|
-
const mutex = new
|
|
92
|
+
const mutex = new _0_deps_js_1.Mutex();
|
|
93
93
|
webSocket.addEventListener("close", () => {
|
|
94
94
|
this.stateChangeHandler?.(false);
|
|
95
95
|
});
|
package/script/mod.d.ts
CHANGED
|
@@ -1,26 +1,12 @@
|
|
|
1
|
-
import { getRandomId } from "./
|
|
1
|
+
import { getRandomId } from "./1_utilities.js";
|
|
2
2
|
import { checkPassword } from "./client/0_password.js";
|
|
3
3
|
export declare const utils: {
|
|
4
4
|
checkPassword: typeof checkPassword;
|
|
5
5
|
getRandomId: typeof getRandomId;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
8
|
-
export *
|
|
9
|
-
export *
|
|
10
|
-
export * from "./
|
|
11
|
-
export
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./client/2_client_plain.js";
|
|
14
|
-
export * from "./client/3_client.js";
|
|
15
|
-
export * from "./storage/0_storage.js";
|
|
16
|
-
export * from "./storage/1_storage_memory.js";
|
|
17
|
-
export * from "./storage/1_storage_local_storage.js";
|
|
18
|
-
export * from "./storage/1_storage_session_storage.js";
|
|
19
|
-
export * from "./storage/1_storage_indexed_db.js";
|
|
20
|
-
export * from "./transport/1_transport_abridged.js";
|
|
21
|
-
export * from "./transport/1_transport_intermediate.js";
|
|
22
|
-
export * from "./transport/0_transport.js";
|
|
23
|
-
export * from "./transport/2_transport_provider.js";
|
|
24
|
-
export * from "./connection/0_connection.js";
|
|
25
|
-
export * from "./connection/1_connection_web_socket.js";
|
|
26
|
-
export { APP_VERSION, DEVICE_MODEL, INITIAL_DC, LANG_CODE, LANG_PACK, LAYER, SYSTEM_LANG_CODE, SYSTEM_VERSION } from "./constants.js";
|
|
7
|
+
export * from "./2_tl.js";
|
|
8
|
+
export * from "./2_connection.js";
|
|
9
|
+
export * from "./3_storage.js";
|
|
10
|
+
export * from "./3_transport.js";
|
|
11
|
+
export { APP_VERSION, DEVICE_MODEL, INITIAL_DC, LANG_CODE, LANG_PACK, LAYER, SYSTEM_LANG_CODE, SYSTEM_VERSION } from "./4_constants.js";
|
|
12
|
+
export * from "./5_client.js";
|
package/script/mod.js
CHANGED
|
@@ -10,53 +10,25 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
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
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
15
|
};
|
|
28
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.SYSTEM_VERSION = exports.SYSTEM_LANG_CODE = exports.LAYER = exports.LANG_PACK = exports.LANG_CODE = exports.INITIAL_DC = exports.DEVICE_MODEL = exports.APP_VERSION = exports.
|
|
30
|
-
const
|
|
17
|
+
exports.SYSTEM_VERSION = exports.SYSTEM_LANG_CODE = exports.LAYER = exports.LANG_PACK = exports.LANG_CODE = exports.INITIAL_DC = exports.DEVICE_MODEL = exports.APP_VERSION = exports.utils = void 0;
|
|
18
|
+
const _1_utilities_js_1 = require("./1_utilities.js");
|
|
31
19
|
const _0_password_js_1 = require("./client/0_password.js");
|
|
32
|
-
exports.utils = { checkPassword: _0_password_js_1.checkPassword, getRandomId:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
__exportStar(require("./
|
|
47
|
-
__exportStar(require("./storage/1_storage_indexed_db.js"), exports);
|
|
48
|
-
__exportStar(require("./transport/1_transport_abridged.js"), exports);
|
|
49
|
-
__exportStar(require("./transport/1_transport_intermediate.js"), exports);
|
|
50
|
-
__exportStar(require("./transport/0_transport.js"), exports);
|
|
51
|
-
__exportStar(require("./transport/2_transport_provider.js"), exports);
|
|
52
|
-
__exportStar(require("./connection/0_connection.js"), exports);
|
|
53
|
-
__exportStar(require("./connection/1_connection_web_socket.js"), exports);
|
|
54
|
-
var constants_js_1 = require("./constants.js");
|
|
55
|
-
Object.defineProperty(exports, "APP_VERSION", { enumerable: true, get: function () { return constants_js_1.APP_VERSION; } });
|
|
56
|
-
Object.defineProperty(exports, "DEVICE_MODEL", { enumerable: true, get: function () { return constants_js_1.DEVICE_MODEL; } });
|
|
57
|
-
Object.defineProperty(exports, "INITIAL_DC", { enumerable: true, get: function () { return constants_js_1.INITIAL_DC; } });
|
|
58
|
-
Object.defineProperty(exports, "LANG_CODE", { enumerable: true, get: function () { return constants_js_1.LANG_CODE; } });
|
|
59
|
-
Object.defineProperty(exports, "LANG_PACK", { enumerable: true, get: function () { return constants_js_1.LANG_PACK; } });
|
|
60
|
-
Object.defineProperty(exports, "LAYER", { enumerable: true, get: function () { return constants_js_1.LAYER; } });
|
|
61
|
-
Object.defineProperty(exports, "SYSTEM_LANG_CODE", { enumerable: true, get: function () { return constants_js_1.SYSTEM_LANG_CODE; } });
|
|
62
|
-
Object.defineProperty(exports, "SYSTEM_VERSION", { enumerable: true, get: function () { return constants_js_1.SYSTEM_VERSION; } });
|
|
20
|
+
exports.utils = { checkPassword: _0_password_js_1.checkPassword, getRandomId: _1_utilities_js_1.getRandomId };
|
|
21
|
+
__exportStar(require("./2_tl.js"), exports);
|
|
22
|
+
__exportStar(require("./2_connection.js"), exports);
|
|
23
|
+
__exportStar(require("./3_storage.js"), exports);
|
|
24
|
+
__exportStar(require("./3_transport.js"), exports);
|
|
25
|
+
var _4_constants_js_1 = require("./4_constants.js");
|
|
26
|
+
Object.defineProperty(exports, "APP_VERSION", { enumerable: true, get: function () { return _4_constants_js_1.APP_VERSION; } });
|
|
27
|
+
Object.defineProperty(exports, "DEVICE_MODEL", { enumerable: true, get: function () { return _4_constants_js_1.DEVICE_MODEL; } });
|
|
28
|
+
Object.defineProperty(exports, "INITIAL_DC", { enumerable: true, get: function () { return _4_constants_js_1.INITIAL_DC; } });
|
|
29
|
+
Object.defineProperty(exports, "LANG_CODE", { enumerable: true, get: function () { return _4_constants_js_1.LANG_CODE; } });
|
|
30
|
+
Object.defineProperty(exports, "LANG_PACK", { enumerable: true, get: function () { return _4_constants_js_1.LANG_PACK; } });
|
|
31
|
+
Object.defineProperty(exports, "LAYER", { enumerable: true, get: function () { return _4_constants_js_1.LAYER; } });
|
|
32
|
+
Object.defineProperty(exports, "SYSTEM_LANG_CODE", { enumerable: true, get: function () { return _4_constants_js_1.SYSTEM_LANG_CODE; } });
|
|
33
|
+
Object.defineProperty(exports, "SYSTEM_VERSION", { enumerable: true, get: function () { return _4_constants_js_1.SYSTEM_VERSION; } });
|
|
34
|
+
__exportStar(require("./5_client.js"), exports);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { MaybePromise } from "../
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import * as types from "../tl/2_types.js";
|
|
1
|
+
import { MaybePromise } from "../1_utilities.js";
|
|
2
|
+
import { TLObject, types } from "../2_tl.js";
|
|
3
|
+
import { DC } from "../3_transport.js";
|
|
5
4
|
export type StorageKeyPart = string | number | bigint | Uint8Array;
|
|
6
5
|
export declare abstract class Storage {
|
|
7
6
|
private _authKeyId;
|
|
@@ -21,7 +20,7 @@ export declare abstract class Storage {
|
|
|
21
20
|
updateUsernames(type: "user" | "channel", id: bigint, usernames: string[]): Promise<void>;
|
|
22
21
|
getUsername(username: string): Promise<["channel" | "user", bigint, Date] | null>;
|
|
23
22
|
setTlObject(key: readonly StorageKeyPart[], value: TLObject | null): Promise<void>;
|
|
24
|
-
getTLObject(key: readonly StorageKeyPart[]): Promise<import("../
|
|
23
|
+
getTLObject(key: readonly StorageKeyPart[]): Promise<import("../2_tl.js").ReadObject | null>;
|
|
25
24
|
setState(state: types.UpdatesState): Promise<void>;
|
|
26
25
|
getState(): Promise<types.UpdatesState | null>;
|
|
27
26
|
setMessage(chatId: number, messageId: number, message: types.TypeMessage | null): Promise<void>;
|
|
@@ -1,37 +1,9 @@
|
|
|
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
3
|
exports.Storage = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const _1_tl_object_js_1 = require("../tl/1_tl_object.js");
|
|
31
|
-
const types = __importStar(require("../tl/2_types.js"));
|
|
32
|
-
const _3_tl_reader_js_1 = require("../tl/3_tl_reader.js");
|
|
33
|
-
const _0_rle_js_1 = require("../utilities/0_rle.js");
|
|
34
|
-
const constants_js_1 = require("../constants.js");
|
|
4
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
6
|
+
const _4_constants_js_1 = require("../4_constants.js");
|
|
35
7
|
const KPARTS__DC = ["dc"];
|
|
36
8
|
const KPARTS__AUTH_KEY = ["authKey"];
|
|
37
9
|
const KPARTS__CHANNEL_ACCESS_HASH = (v) => ["channelAccessHash", v];
|
|
@@ -61,7 +33,7 @@ class Storage {
|
|
|
61
33
|
}
|
|
62
34
|
async resetAuthKeyId(authKey) {
|
|
63
35
|
if (authKey != null) {
|
|
64
|
-
this._authKeyId = await (0,
|
|
36
|
+
this._authKeyId = await (0, _1_utilities_js_1.sha1)(authKey).then((hash) => (0, _1_utilities_js_1.bigIntFromBuffer)(hash.slice(-8), true, false));
|
|
65
37
|
}
|
|
66
38
|
else {
|
|
67
39
|
this._authKeyId = null;
|
|
@@ -111,13 +83,13 @@ class Storage {
|
|
|
111
83
|
await this.set(key, null);
|
|
112
84
|
}
|
|
113
85
|
else {
|
|
114
|
-
await this.set(key, (0,
|
|
86
|
+
await this.set(key, (0, _1_utilities_js_1.rleEncode)(value[_2_tl_js_1.serialize]()));
|
|
115
87
|
}
|
|
116
88
|
}
|
|
117
89
|
async getTLObject(key) {
|
|
118
90
|
const buffer = await this.get(key);
|
|
119
91
|
if (buffer != null) {
|
|
120
|
-
return new
|
|
92
|
+
return new _2_tl_js_1.TLReader((0, _1_utilities_js_1.rleDecode)(buffer)).readObject();
|
|
121
93
|
}
|
|
122
94
|
else {
|
|
123
95
|
return null;
|
|
@@ -130,7 +102,7 @@ class Storage {
|
|
|
130
102
|
return await this.getTLObject(KPARTS__STATE);
|
|
131
103
|
}
|
|
132
104
|
async setMessage(chatId, messageId, message) {
|
|
133
|
-
if (chatId >
|
|
105
|
+
if (chatId > _4_constants_js_1.ZERO_CHANNEL_ID) {
|
|
134
106
|
await this.set(KPARTS_MESSAGE_REF(messageId), message == null ? null : chatId);
|
|
135
107
|
}
|
|
136
108
|
await this.setTlObject(KPARTS_MESSAGE(chatId, messageId), message);
|
|
@@ -148,13 +120,13 @@ class Storage {
|
|
|
148
120
|
return this.get(KPARTS__CHANNEL_PTS(channelId));
|
|
149
121
|
}
|
|
150
122
|
async setEntity(peer) {
|
|
151
|
-
const type = peer instanceof types.Channel ? "channel" : peer instanceof types.Chat ? "chat" : peer instanceof types.User ? "user" : (0,
|
|
152
|
-
await this.set(KPARTS__PEER(type, peer.id), peer[
|
|
123
|
+
const type = peer instanceof _2_tl_js_1.types.Channel ? "channel" : peer instanceof _2_tl_js_1.types.Chat ? "chat" : peer instanceof _2_tl_js_1.types.User ? "user" : (0, _1_utilities_js_1.UNREACHABLE)();
|
|
124
|
+
await this.set(KPARTS__PEER(type, peer.id), peer[_2_tl_js_1.serialize]());
|
|
153
125
|
}
|
|
154
126
|
async getEntity(type, id) {
|
|
155
127
|
const peer_ = await this.get(KPARTS__PEER(type, id));
|
|
156
128
|
if (peer_ != null) {
|
|
157
|
-
return new
|
|
129
|
+
return new _2_tl_js_1.TLReader(peer_).readObject();
|
|
158
130
|
}
|
|
159
131
|
else {
|
|
160
132
|
return null;
|
|
@@ -163,7 +135,7 @@ class Storage {
|
|
|
163
135
|
async setAccountType(type) {
|
|
164
136
|
try {
|
|
165
137
|
await this.getAccountType();
|
|
166
|
-
(0,
|
|
138
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
167
139
|
}
|
|
168
140
|
catch (err) {
|
|
169
141
|
if (!(err instanceof Error) || !(err.message == "Unreachable")) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fixKey = exports.fromString = exports.toString = exports.ValueType = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
5
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
6
6
|
var ValueType;
|
|
7
7
|
(function (ValueType) {
|
|
8
8
|
ValueType[ValueType["Boolean"] = 0] = "Boolean";
|
|
@@ -30,13 +30,13 @@ function toString(value) {
|
|
|
30
30
|
return JSON.stringify([ValueType.Date, value.getTime()]);
|
|
31
31
|
}
|
|
32
32
|
else if (value instanceof Uint8Array) {
|
|
33
|
-
return JSON.stringify([ValueType.Uint8Array, (0,
|
|
33
|
+
return JSON.stringify([ValueType.Uint8Array, (0, _0_deps_js_1.base64Encode)(value)]);
|
|
34
34
|
}
|
|
35
35
|
else if (Array.isArray(value)) {
|
|
36
36
|
return JSON.stringify([ValueType.Array, value.map(toString)]);
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
|
-
(0,
|
|
39
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
exports.toString = toString;
|
|
@@ -52,13 +52,13 @@ function fromString(string) {
|
|
|
52
52
|
return new Date(value);
|
|
53
53
|
}
|
|
54
54
|
else if (type == ValueType.Uint8Array) {
|
|
55
|
-
return (0,
|
|
55
|
+
return (0, _0_deps_js_1.base64Decode)(value);
|
|
56
56
|
}
|
|
57
57
|
else if (type == ValueType.Array) {
|
|
58
58
|
return value.map(fromString);
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
|
-
(0,
|
|
61
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
exports.fromString = fromString;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MaybePromise } from "../
|
|
1
|
+
import { MaybePromise } from "../1_utilities.js";
|
|
2
2
|
import { Storage, StorageKeyPart } from "./0_storage.js";
|
|
3
3
|
export declare class StorageLocalStorage extends Storage implements Storage {
|
|
4
4
|
private readonly prefix;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MaybePromise } from "../
|
|
1
|
+
import { MaybePromise } from "../1_utilities.js";
|
|
2
2
|
import { Storage, StorageKeyPart } from "./0_storage.js";
|
|
3
3
|
export declare class StorageMemory extends Storage implements Storage {
|
|
4
4
|
protected map: Map<string, unknown>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MaybePromise } from "../
|
|
1
|
+
import { MaybePromise } from "../1_utilities.js";
|
|
2
2
|
import { Storage, StorageKeyPart } from "./0_storage.js";
|
|
3
3
|
export declare class StorageSessionStorage extends Storage implements Storage {
|
|
4
4
|
private readonly prefix;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TLRawReader = exports.TLError = void 0;
|
|
4
|
-
const
|
|
4
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
5
|
class TLError extends Error {
|
|
6
6
|
}
|
|
7
7
|
exports.TLError = TLError;
|
|
@@ -27,23 +27,23 @@ class TLRawReader {
|
|
|
27
27
|
}
|
|
28
28
|
readInt24(signed = true) {
|
|
29
29
|
const buffer = this.read(24 / 8);
|
|
30
|
-
return Number((0,
|
|
30
|
+
return Number((0, _1_utilities_js_1.bigIntFromBuffer)(buffer, true, signed));
|
|
31
31
|
}
|
|
32
32
|
readInt32(signed = true) {
|
|
33
33
|
const buffer = this.read(32 / 8);
|
|
34
|
-
return Number((0,
|
|
34
|
+
return Number((0, _1_utilities_js_1.bigIntFromBuffer)(buffer, true, signed));
|
|
35
35
|
}
|
|
36
36
|
readInt64(signed = true) {
|
|
37
37
|
const buffer = this.read(64 / 8);
|
|
38
|
-
return (0,
|
|
38
|
+
return (0, _1_utilities_js_1.bigIntFromBuffer)(buffer, true, signed);
|
|
39
39
|
}
|
|
40
40
|
readInt128(signed = true) {
|
|
41
41
|
const buffer = this.read(128 / 8);
|
|
42
|
-
return (0,
|
|
42
|
+
return (0, _1_utilities_js_1.bigIntFromBuffer)(buffer, true, signed);
|
|
43
43
|
}
|
|
44
44
|
readInt256(signed = true) {
|
|
45
45
|
const buffer = this.read(256 / 8);
|
|
46
|
-
return (0,
|
|
46
|
+
return (0, _1_utilities_js_1.bigIntFromBuffer)(buffer, true, signed);
|
|
47
47
|
}
|
|
48
48
|
readBytes() {
|
|
49
49
|
let L = this.read(1)[0];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TLRawWriter = void 0;
|
|
4
|
-
const
|
|
4
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
5
|
class TLRawWriter {
|
|
6
6
|
constructor() {
|
|
7
7
|
Object.defineProperty(this, "_buffer", {
|
|
@@ -15,27 +15,27 @@ class TLRawWriter {
|
|
|
15
15
|
return this._buffer;
|
|
16
16
|
}
|
|
17
17
|
write(buffer) {
|
|
18
|
-
this._buffer = (0,
|
|
18
|
+
this._buffer = (0, _1_utilities_js_1.concat)(this._buffer, buffer);
|
|
19
19
|
return this;
|
|
20
20
|
}
|
|
21
21
|
writeInt24(int, signed = true) {
|
|
22
|
-
this.write((0,
|
|
22
|
+
this.write((0, _1_utilities_js_1.bufferFromBigInt)(int, 24 / 8, true, signed));
|
|
23
23
|
return this;
|
|
24
24
|
}
|
|
25
25
|
writeInt32(int, signed = true) {
|
|
26
|
-
this.write((0,
|
|
26
|
+
this.write((0, _1_utilities_js_1.bufferFromBigInt)(int, 32 / 8, true, signed));
|
|
27
27
|
return this;
|
|
28
28
|
}
|
|
29
29
|
writeInt64(int, signed = true) {
|
|
30
|
-
this.write((0,
|
|
30
|
+
this.write((0, _1_utilities_js_1.bufferFromBigInt)(int, 64 / 8, true, signed));
|
|
31
31
|
return this;
|
|
32
32
|
}
|
|
33
33
|
writeInt128(int, signed = true) {
|
|
34
|
-
this.write((0,
|
|
34
|
+
this.write((0, _1_utilities_js_1.bufferFromBigInt)(int, 128 / 8, true, signed));
|
|
35
35
|
return this;
|
|
36
36
|
}
|
|
37
37
|
writeInt256(int, signed = true) {
|
|
38
|
-
this.write((0,
|
|
38
|
+
this.write((0, _1_utilities_js_1.bufferFromBigInt)(int, 256 / 8, true, signed));
|
|
39
39
|
return this;
|
|
40
40
|
}
|
|
41
41
|
writeBytes(bytes) {
|
package/script/tl/1_tl_object.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isTLObjectConstructor = exports.TLObject = exports.analyzeOptionalParam = exports.isOptionalParam = exports.as = exports.serialize = exports.length = exports.paramDesc = exports.params = exports.id = exports.flags = void 0;
|
|
4
|
-
const
|
|
4
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
5
5
|
const _0_tl_raw_writer_js_1 = require("./0_tl_raw_writer.js");
|
|
6
6
|
exports.flags = Symbol("flags");
|
|
7
7
|
exports.id = Symbol("id");
|
|
@@ -19,9 +19,9 @@ function analyzeOptionalParam(ntype) {
|
|
|
19
19
|
throw new Error("Parameter not optional");
|
|
20
20
|
}
|
|
21
21
|
const flagField = ntype.split(".")[0];
|
|
22
|
-
(0,
|
|
22
|
+
(0, _0_deps_js_1.assertEquals)(typeof flagField, "string");
|
|
23
23
|
const bitIndex = Number(ntype.split("?")[0].split(".")[1]);
|
|
24
|
-
(0,
|
|
24
|
+
(0, _0_deps_js_1.assertFalse)(isNaN(bitIndex));
|
|
25
25
|
return { flagField, bitIndex };
|
|
26
26
|
}
|
|
27
27
|
exports.analyzeOptionalParam = analyzeOptionalParam;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deserialize = void 0;
|
|
4
|
-
const
|
|
4
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
5
5
|
const _1_tl_object_js_1 = require("./1_tl_object.js");
|
|
6
6
|
const _2_types_js_1 = require("./2_types.js");
|
|
7
7
|
function deserializeSingleParam(reader, type, ntype) {
|
|
@@ -57,7 +57,7 @@ function deserialize(reader, paramDesc, constructor) {
|
|
|
57
57
|
continue;
|
|
58
58
|
}
|
|
59
59
|
if (type instanceof Array) {
|
|
60
|
-
(0,
|
|
60
|
+
(0, _0_deps_js_1.assertEquals)(reader.readInt32(false), 0x1CB5C415);
|
|
61
61
|
const count = reader.readInt32();
|
|
62
62
|
const items = new Array();
|
|
63
63
|
for (let i = 0; i < count; i++) {
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.peerToChatId = exports.getChannelChatId = void 0;
|
|
27
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
28
|
+
const _4_constants_js_1 = require("../4_constants.js");
|
|
29
|
+
const types = __importStar(require("./2_types.js"));
|
|
30
|
+
function getChannelChatId(channelId) {
|
|
31
|
+
return _4_constants_js_1.ZERO_CHANNEL_ID + -Number(channelId);
|
|
32
|
+
}
|
|
33
|
+
exports.getChannelChatId = getChannelChatId;
|
|
34
|
+
function peerToChatId(peer) {
|
|
35
|
+
if (peer instanceof types.PeerUser || peer instanceof types.InputPeerUser) {
|
|
36
|
+
return Number(peer.userId);
|
|
37
|
+
}
|
|
38
|
+
else if (peer instanceof types.PeerChat || peer instanceof types.InputPeerChat) {
|
|
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, _1_utilities_js_1.UNREACHABLE)();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.peerToChatId = peerToChatId;
|
package/script/tl/4_tl_writer.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TLWriter = void 0;
|
|
4
|
-
const
|
|
4
|
+
const _4_constants_js_1 = require("../4_constants.js");
|
|
5
5
|
const _0_tl_raw_writer_js_1 = require("./0_tl_raw_writer.js");
|
|
6
6
|
const _1_tl_object_js_1 = require("./1_tl_object.js");
|
|
7
7
|
class TLWriter extends _0_tl_raw_writer_js_1.TLRawWriter {
|
|
8
8
|
writeObject(object) {
|
|
9
9
|
if (Array.isArray(object)) {
|
|
10
|
-
this.writeInt32(
|
|
10
|
+
this.writeInt32(_4_constants_js_1.VECTOR_CONSTRUCTOR, false);
|
|
11
11
|
this.writeInt32(object.length);
|
|
12
12
|
for (const item of object) {
|
|
13
13
|
this.writeObject(item);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CTR } from "../
|
|
2
|
-
import { Connection } from "../
|
|
1
|
+
import { CTR } from "../1_utilities.js";
|
|
2
|
+
import { Connection } from "../2_connection.js";
|
|
3
3
|
export declare function getObfuscationParameters(protocol: number, connection: Connection): Promise<{
|
|
4
4
|
encryptionCTR: CTR;
|
|
5
5
|
decryptionCTR: CTR;
|
|
@@ -25,13 +25,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.getObfuscationParameters = void 0;
|
|
27
27
|
const dntShim = __importStar(require("../_dnt.shims.js"));
|
|
28
|
-
const
|
|
29
|
-
const _0_crypto_js_1 = require("../utilities/0_crypto.js");
|
|
28
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
30
29
|
async function getObfuscationParameters(protocol, connection) {
|
|
31
30
|
const dc = 0xFCFF;
|
|
32
31
|
let init;
|
|
33
32
|
while (true) {
|
|
34
|
-
init = (0,
|
|
33
|
+
init = (0, _1_utilities_js_1.concat)(dntShim.crypto.getRandomValues(new Uint8Array(56)), (0, _1_utilities_js_1.bufferFromBigInt)(protocol, 4, false), (0, _1_utilities_js_1.bufferFromBigInt)(dc, 2, false), dntShim.crypto.getRandomValues(new Uint8Array(2)));
|
|
35
34
|
if (init[0] == 0xEF) {
|
|
36
35
|
continue;
|
|
37
36
|
}
|
|
@@ -48,13 +47,13 @@ async function getObfuscationParameters(protocol, connection) {
|
|
|
48
47
|
}
|
|
49
48
|
const encryptKey = init.slice(8, 8 + 32);
|
|
50
49
|
const encryptIv = init.slice(40, 40 + 16);
|
|
51
|
-
const encryptionCTR = new
|
|
50
|
+
const encryptionCTR = new _1_utilities_js_1.CTR(encryptKey, encryptIv);
|
|
52
51
|
const encryptedInit = encryptionCTR.encrypt(init);
|
|
53
52
|
const initRev = new Uint8Array(init).reverse();
|
|
54
53
|
const decryptKey = initRev.slice(8, 8 + 32);
|
|
55
54
|
const decryptIv = initRev.slice(40, 40 + 16);
|
|
56
|
-
const decryptionCTR = new
|
|
57
|
-
await connection.write((0,
|
|
55
|
+
const decryptionCTR = new _1_utilities_js_1.CTR(decryptKey, decryptIv);
|
|
56
|
+
await connection.write((0, _1_utilities_js_1.concat)(init.slice(0, 56), encryptedInit.slice(56, 56 + 8)));
|
|
58
57
|
return { encryptionCTR, decryptionCTR };
|
|
59
58
|
}
|
|
60
59
|
exports.getObfuscationParameters = getObfuscationParameters;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { MaybePromise } from "../
|
|
2
|
-
import { CTR } from "../utilities/0_crypto.js";
|
|
1
|
+
import { CTR, MaybePromise } from "../1_utilities.js";
|
|
3
2
|
export declare abstract class Transport {
|
|
4
3
|
protected initialized: boolean;
|
|
5
4
|
protected obfuscationParameters: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TransportAbridged = void 0;
|
|
4
|
-
const
|
|
4
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
5
|
const _0_obfuscation_js_1 = require("./0_obfuscation.js");
|
|
6
6
|
const _0_transport_js_1 = require("./0_transport.js");
|
|
7
7
|
class TransportAbridged extends _0_transport_js_1.Transport {
|
|
@@ -63,8 +63,8 @@ class TransportAbridged extends _0_transport_js_1.Transport {
|
|
|
63
63
|
}
|
|
64
64
|
const bufferLength = buffer.length / 4;
|
|
65
65
|
const header = new Uint8Array([bufferLength >= 0x7F ? 0x7F : bufferLength]);
|
|
66
|
-
const length = bufferLength >= 0x7F ? (0,
|
|
67
|
-
await this.connection.write(this.encrypt((0,
|
|
66
|
+
const length = bufferLength >= 0x7F ? (0, _1_utilities_js_1.bufferFromBigInt)(bufferLength, 3) : new Uint8Array();
|
|
67
|
+
await this.connection.write(this.encrypt((0, _1_utilities_js_1.concat)(header, length, buffer)));
|
|
68
68
|
}
|
|
69
69
|
deinitialize() {
|
|
70
70
|
this.initialized = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Connection } from "../
|
|
1
|
+
import { Connection } from "../2_connection.js";
|
|
2
2
|
import { Transport } from "./0_transport.js";
|
|
3
3
|
export declare class TransportIntermediate extends Transport implements Transport {
|
|
4
4
|
private readonly connection;
|