@mtkruto/node 0.0.906 → 0.0.910
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/{types/utilities → client}/0_html.d.ts +1 -1
- package/esm/{types/utilities → client}/0_html.js +2 -2
- package/esm/client/{utilities/0_message.d.ts → 0_message.d.ts} +2 -2
- package/esm/client/{utilities/0_message.js → 0_message.js} +10 -10
- package/esm/client/{utilities/0_password.d.ts → 0_password.d.ts} +2 -2
- package/esm/client/{utilities/0_password.js → 0_password.js} +5 -5
- package/esm/client/{client_abstract.d.ts → 1_client_abstract.d.ts} +5 -5
- package/esm/client/{client_abstract.js → 1_client_abstract.js} +1 -1
- package/esm/client/{client_plain.d.ts → 2_client_plain.d.ts} +1 -1
- package/esm/client/{client_plain.js → 2_client_plain.js} +2 -2
- package/esm/client/{client.d.ts → 3_client.d.ts} +3 -3
- package/esm/client/{client.js → 3_client.js} +7 -7
- package/{script/connection/connection_web_socket.d.ts → esm/connection/1_connection_web_socket.d.ts} +1 -1
- package/esm/constants.d.ts +2 -2
- package/esm/constants.js +1 -1
- package/esm/mod.d.ts +13 -13
- package/esm/mod.js +13 -13
- package/{script/storage/storage.d.ts → esm/storage/0_storage.d.ts} +1 -1
- package/{script/storage/storage_local_storage.d.ts → esm/storage/1_storage_local_storage.d.ts} +1 -1
- package/esm/storage/{storage_local_storage.js → 1_storage_local_storage.js} +1 -1
- package/{script/storage/storage_memory.d.ts → esm/storage/1_storage_memory.d.ts} +1 -1
- package/esm/storage/{storage_memory.js → 1_storage_memory.js} +1 -1
- package/esm/storage/{storage_session_storage.d.ts → 1_storage_session_storage.d.ts} +1 -1
- package/esm/storage/{storage_session_storage.js → 1_storage_session_storage.js} +1 -1
- package/esm/transport/{utilities/0_obfuscation.d.ts → 0_obfuscation.d.ts} +2 -2
- package/esm/transport/{utilities/0_obfuscation.js → 0_obfuscation.js} +3 -3
- package/esm/transport/{transport_abridged.d.ts → 1_transport_abridged.d.ts} +2 -2
- package/esm/transport/{transport_abridged.js → 1_transport_abridged.js} +2 -2
- package/esm/transport/{transport_intermediate.d.ts → 1_transport_intermediate.d.ts} +2 -2
- package/esm/transport/{transport_intermediate.js → 1_transport_intermediate.js} +2 -2
- package/{script/transport/transport_provider.d.ts → esm/transport/2_transport_provider.d.ts} +2 -2
- package/esm/transport/{transport_provider.js → 2_transport_provider.js} +2 -2
- package/esm/types/!0_file_id.d.ts +77 -0
- package/esm/types/!0_file_id.js +372 -0
- package/esm/types/0_chat_photo.d.ts +7 -15
- package/esm/types/0_chat_photo.js +30 -17
- package/esm/types/1_chat.js +4 -4
- package/esm/types/1_user.js +2 -2
- package/esm/types/3_message.js +12 -0
- package/package.json +1 -1
- package/script/{types/utilities → client}/0_html.d.ts +1 -1
- package/script/{types/utilities → client}/0_html.js +2 -2
- package/script/client/{utilities/0_message.d.ts → 0_message.d.ts} +2 -2
- package/script/client/{utilities/0_message.js → 0_message.js} +10 -10
- package/script/client/{utilities/0_password.d.ts → 0_password.d.ts} +2 -2
- package/script/client/{utilities/0_password.js → 0_password.js} +5 -5
- package/script/client/{client_abstract.d.ts → 1_client_abstract.d.ts} +5 -5
- package/script/client/{client_abstract.js → 1_client_abstract.js} +2 -2
- package/script/client/{client_plain.d.ts → 2_client_plain.d.ts} +1 -1
- package/script/client/{client_plain.js → 2_client_plain.js} +3 -3
- package/script/client/{client.d.ts → 3_client.d.ts} +3 -3
- package/script/client/{client.js → 3_client.js} +10 -10
- package/{esm/connection/connection_web_socket.d.ts → script/connection/1_connection_web_socket.d.ts} +1 -1
- package/script/constants.d.ts +2 -2
- package/script/constants.js +1 -1
- package/script/mod.d.ts +13 -13
- package/script/mod.js +13 -13
- package/{esm/storage/storage.d.ts → script/storage/0_storage.d.ts} +1 -1
- package/{esm/storage/storage_local_storage.d.ts → script/storage/1_storage_local_storage.d.ts} +1 -1
- package/script/storage/{storage_local_storage.js → 1_storage_local_storage.js} +2 -2
- package/{esm/storage/storage_memory.d.ts → script/storage/1_storage_memory.d.ts} +1 -1
- package/script/storage/{storage_memory.js → 1_storage_memory.js} +2 -2
- package/script/storage/{storage_session_storage.d.ts → 1_storage_session_storage.d.ts} +1 -1
- package/script/storage/{storage_session_storage.js → 1_storage_session_storage.js} +2 -2
- package/script/transport/{utilities/0_obfuscation.d.ts → 0_obfuscation.d.ts} +2 -2
- package/script/transport/{utilities/0_obfuscation.js → 0_obfuscation.js} +3 -3
- package/script/transport/{transport_abridged.d.ts → 1_transport_abridged.d.ts} +2 -2
- package/script/transport/{transport_abridged.js → 1_transport_abridged.js} +3 -3
- package/script/transport/{transport_intermediate.d.ts → 1_transport_intermediate.d.ts} +2 -2
- package/script/transport/{transport_intermediate.js → 1_transport_intermediate.js} +3 -3
- package/{esm/transport/transport_provider.d.ts → script/transport/2_transport_provider.d.ts} +2 -2
- package/script/transport/{transport_provider.js → 2_transport_provider.js} +4 -4
- package/script/types/!0_file_id.d.ts +77 -0
- package/script/types/!0_file_id.js +376 -0
- package/script/types/0_chat_photo.d.ts +7 -15
- package/script/types/0_chat_photo.js +31 -18
- package/script/types/1_chat.js +4 -4
- package/script/types/1_user.js +2 -2
- package/script/types/3_message.js +12 -0
- /package/esm/client/{utilities/0_password_test.d.ts → 0_password_test.d.ts} +0 -0
- /package/esm/connection/{connection.d.ts → 0_connection.d.ts} +0 -0
- /package/esm/connection/{connection.js → 0_connection.js} +0 -0
- /package/esm/connection/{connection_web_socket.js → 1_connection_web_socket.js} +0 -0
- /package/esm/storage/{storage.js → 0_storage.js} +0 -0
- /package/esm/transport/{transport.d.ts → 0_transport.d.ts} +0 -0
- /package/esm/transport/{transport.js → 0_transport.js} +0 -0
- /package/esm/types/{utilities/0_id_color.d.ts → !0_id_color.d.ts} +0 -0
- /package/esm/types/{utilities/0_id_color.js → !0_id_color.js} +0 -0
- /package/script/client/{utilities/0_password_test.d.ts → 0_password_test.d.ts} +0 -0
- /package/script/connection/{connection.d.ts → 0_connection.d.ts} +0 -0
- /package/script/connection/{connection.js → 0_connection.js} +0 -0
- /package/script/connection/{connection_web_socket.js → 1_connection_web_socket.js} +0 -0
- /package/script/storage/{storage.js → 0_storage.js} +0 -0
- /package/script/transport/{transport.d.ts → 0_transport.d.ts} +0 -0
- /package/script/transport/{transport.js → 0_transport.js} +0 -0
- /package/script/types/{utilities/0_id_color.d.ts → !0_id_color.d.ts} +0 -0
- /package/script/types/{utilities/0_id_color.js → !0_id_color.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MessageEntity } from "../0_message_entity.js";
|
|
1
|
+
import { MessageEntity } from "../types/0_message_entity.js";
|
|
2
2
|
export declare function parseHtml(html: string): readonly [string, MessageEntity[]];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Parser } from "
|
|
2
|
-
import { MessageEntityType } from "../0_message_entity.js";
|
|
1
|
+
import { Parser } from "../deps.js";
|
|
2
|
+
import { MessageEntityType } from "../types/0_message_entity.js";
|
|
3
3
|
export function parseHtml(html) {
|
|
4
4
|
let text = "";
|
|
5
5
|
const entities = new Array();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Message } from "
|
|
2
|
-
import { MessageContainer } from "
|
|
1
|
+
import { Message } from "../tl/6_message.js";
|
|
2
|
+
import { MessageContainer } from "../tl/7_message_container.js";
|
|
3
3
|
export declare function getMessageId(): bigint;
|
|
4
4
|
export declare function packUnencryptedMessage(data: Uint8Array): Uint8Array;
|
|
5
5
|
export declare function unpackUnencryptedMessage(buffer: Uint8Array): {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { assertEquals, ige256Decrypt, ige256Encrypt } from "
|
|
2
|
-
import { TLRawReader } from "
|
|
3
|
-
import { TLRawWriter } from "
|
|
4
|
-
import { id, serialize } from "
|
|
5
|
-
import { TLReader } from "
|
|
6
|
-
import { RPCResult } from "
|
|
7
|
-
import { Message } from "
|
|
8
|
-
import { MessageContainer } from "
|
|
9
|
-
import { bufferFromBigInt, concat } from "
|
|
10
|
-
import { sha256 } from "
|
|
1
|
+
import { assertEquals, ige256Decrypt, ige256Encrypt } from "../deps.js";
|
|
2
|
+
import { TLRawReader } from "../tl/0_tl_raw_reader.js";
|
|
3
|
+
import { TLRawWriter } from "../tl/0_tl_raw_writer.js";
|
|
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";
|
|
11
11
|
let lastMsgId = 0n;
|
|
12
12
|
export function getMessageId() {
|
|
13
13
|
const now = new Date().getTime() / 1000 + 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as types from "
|
|
2
|
-
import { sha256 } from "
|
|
1
|
+
import * as types from "../tl/2_types.js";
|
|
2
|
+
import { sha256 } from "../utilities/0_hash.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>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as dntShim from "
|
|
2
|
-
import * as types from "
|
|
3
|
-
import { bufferFromBigInt, concat } from "
|
|
4
|
-
import { sha256 } from "
|
|
5
|
-
import { bigIntFromBuffer, getRandomBigInt, mod, modExp } from "
|
|
1
|
+
import * as dntShim from "../_dnt.shims.js";
|
|
2
|
+
import * as types from "../tl/2_types.js";
|
|
3
|
+
import { bufferFromBigInt, concat } from "../utilities/0_buffer.js";
|
|
4
|
+
import { sha256 } from "../utilities/0_hash.js";
|
|
5
|
+
import { bigIntFromBuffer, getRandomBigInt, mod, modExp } from "../utilities/0_bigint.js";
|
|
6
6
|
export function isSafePrime(primeBytes, g) {
|
|
7
7
|
// deno-fmt-ignore
|
|
8
8
|
const goodPrime = new Uint8Array([
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { MaybePromise } from "../utilities/0_types.js";
|
|
2
|
-
import { Connection } from "../connection/
|
|
3
|
-
import { Transport } from "../transport/
|
|
4
|
-
import { DC } from "../transport/
|
|
2
|
+
import { Connection } from "../connection/0_connection.js";
|
|
3
|
+
import { Transport } from "../transport/0_transport.js";
|
|
4
|
+
import { DC } from "../transport/2_transport_provider.js";
|
|
5
5
|
export declare abstract class ClientAbstract {
|
|
6
|
-
protected transportProvider: import("../transport/
|
|
6
|
+
protected transportProvider: import("../transport/2_transport_provider.js").TransportProvider;
|
|
7
7
|
protected connection: Connection;
|
|
8
8
|
protected transport: Transport;
|
|
9
9
|
private _dcId;
|
|
10
10
|
private _initialDc;
|
|
11
11
|
get initialDc(): DC;
|
|
12
|
-
constructor(transportProvider?: import("../transport/
|
|
12
|
+
constructor(transportProvider?: import("../transport/2_transport_provider.js").TransportProvider);
|
|
13
13
|
get dcId(): number;
|
|
14
14
|
setDc(dc: DC): MaybePromise<void>;
|
|
15
15
|
get connected(): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { initTgCrypto } from "../deps.js";
|
|
2
2
|
import { DEFAULT_INITIAL_DC } from "../constants.js";
|
|
3
|
-
import { defaultTransportProvider } from "../transport/
|
|
3
|
+
import { defaultTransportProvider } from "../transport/2_transport_provider.js";
|
|
4
4
|
export class ClientAbstract {
|
|
5
5
|
get initialDc() {
|
|
6
6
|
return this._initialDc;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Function } from "../tl/3_functions.js";
|
|
2
|
-
import { ClientAbstract } from "./
|
|
2
|
+
import { ClientAbstract } from "./1_client_abstract.js";
|
|
3
3
|
export declare class ClientPlain extends ClientAbstract {
|
|
4
4
|
invoke<T extends Function<unknown>>(function_: T): Promise<T["__R"]>;
|
|
5
5
|
createAuthKey(): Promise<{
|
|
@@ -9,8 +9,8 @@ import { serialize } from "../tl/1_tl_object.js";
|
|
|
9
9
|
import { ClientDHInnerData, DHGenOK, PQInnerDataDC, ResPQ, ServerDHInnerData, ServerDHParamsOK } from "../tl/2_types.js";
|
|
10
10
|
import { ReqDHParams, ReqPQMulti, SetClientDHParams } from "../tl/3_functions.js";
|
|
11
11
|
import { TLReader } from "../tl/3_tl_reader.js";
|
|
12
|
-
import { ClientAbstract } from "./
|
|
13
|
-
import { packUnencryptedMessage, unpackUnencryptedMessage } from "./
|
|
12
|
+
import { ClientAbstract } from "./1_client_abstract.js";
|
|
13
|
+
import { packUnencryptedMessage, unpackUnencryptedMessage } from "./0_message.js";
|
|
14
14
|
const d = debug("ClientPlain/createAuthKey");
|
|
15
15
|
export class ClientPlain extends ClientAbstract {
|
|
16
16
|
async invoke(function_) {
|
|
@@ -2,15 +2,15 @@ import { MaybePromise } from "../utilities/0_types.js";
|
|
|
2
2
|
import * as types from "../tl/2_types.js";
|
|
3
3
|
import * as functions from "../tl/3_functions.js";
|
|
4
4
|
import { ReadObject } from "../tl/3_tl_reader.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { DC, TransportProvider } from "../transport/transport_provider.js";
|
|
5
|
+
import { Storage } from "../storage/0_storage.js";
|
|
6
|
+
import { DC, TransportProvider } from "../transport/2_transport_provider.js";
|
|
8
7
|
import { MessageEntity } from "../types/0_message_entity.js";
|
|
9
8
|
import { ReplyKeyboardRemove } from "../types/0_reply_keyboard_remove.js";
|
|
10
9
|
import { ForceReply } from "../types/0_force_reply.js";
|
|
11
10
|
import { ReplyKeyboardMarkup } from "../types/2_reply_keyboard_markup.js";
|
|
12
11
|
import { InlineKeyboardMarkup } from "../types/2_inline_keyboard_markup.js";
|
|
13
12
|
import { Message } from "../types/3_message.js";
|
|
13
|
+
import { ClientAbstract } from "./1_client_abstract.js";
|
|
14
14
|
export declare const getEntity: unique symbol;
|
|
15
15
|
export declare const restartAuth: unique symbol;
|
|
16
16
|
export declare enum ParseMode {
|
|
@@ -10,18 +10,18 @@ import { TLReader } from "../tl/3_tl_reader.js";
|
|
|
10
10
|
import { RPCResult } from "../tl/5_rpc_result.js";
|
|
11
11
|
import { Message as Message_ } from "../tl/6_message.js"; // MTProto API message
|
|
12
12
|
import { MessageContainer } from "../tl/7_message_container.js";
|
|
13
|
-
import {
|
|
14
|
-
import { ClientPlain } from "./client_plain.js";
|
|
15
|
-
import { StorageMemory } from "../storage/storage_memory.js";
|
|
16
|
-
import { parseHtml } from "../types/utilities/0_html.js";
|
|
13
|
+
import { StorageMemory } from "../storage/1_storage_memory.js";
|
|
17
14
|
import { messageEntityToTlObject } from "../types/0_message_entity.js";
|
|
18
15
|
import { replyKeyboardRemoveToTlObject } from "../types/0_reply_keyboard_remove.js";
|
|
19
16
|
import { forceReplyToTlObject } from "../types/0_force_reply.js";
|
|
20
17
|
import { replyKeyboardMarkupToTlObject } from "../types/2_reply_keyboard_markup.js";
|
|
21
18
|
import { inlineKeyboardMarkupToTlObject } from "../types/2_inline_keyboard_markup.js";
|
|
22
19
|
import { constructMessage } from "../types/3_message.js"; // high-level wrapper for Telegram API's message
|
|
23
|
-
import { decryptMessage, encryptMessage, getMessageId } from "./
|
|
24
|
-
import {
|
|
20
|
+
import { decryptMessage, encryptMessage, getMessageId } from "./0_message.js";
|
|
21
|
+
import { parseHtml } from "./0_html.js";
|
|
22
|
+
import { checkPassword } from "./0_password.js";
|
|
23
|
+
import { ClientAbstract } from "./1_client_abstract.js";
|
|
24
|
+
import { ClientPlain } from "./2_client_plain.js";
|
|
25
25
|
const d = debug("Client");
|
|
26
26
|
const dGap = debug("Client/recoverUpdateGap");
|
|
27
27
|
const dGapC = debug("Client/recoverChannelUpdateGap");
|
|
@@ -807,7 +807,7 @@ export class Client extends ClientAbstract {
|
|
|
807
807
|
try {
|
|
808
808
|
let state = await this.getLocalState();
|
|
809
809
|
while (true) {
|
|
810
|
-
const difference = await this.invoke(new functions.UpdatesGetDifference({ pts: state.pts, date: state.date, qts: state.qts }));
|
|
810
|
+
const difference = await this.invoke(new functions.UpdatesGetDifference({ pts: state.pts, date: state.date, qts: state.qts ?? 0 }));
|
|
811
811
|
if (difference instanceof types.UpdatesDifference || difference instanceof types.UpdatesDifferenceSlice) {
|
|
812
812
|
await this.processChats(difference.chats);
|
|
813
813
|
await this.processUsers(difference.users);
|
package/esm/constants.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { DC } from "./transport/
|
|
1
|
+
import { DC } from "./transport/2_transport_provider.js";
|
|
2
2
|
export declare const ackThreshold = 10;
|
|
3
3
|
export declare const publicKeys: Map<bigint, [bigint, bigint]>;
|
|
4
4
|
export declare const VECTOR_CONSTRUCTOR = 481674261;
|
|
5
5
|
export declare const DEFAULT_INITIAL_DC: DC;
|
|
6
6
|
export declare const LAYER = 158;
|
|
7
|
-
export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.
|
|
7
|
+
export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.910";
|
|
8
8
|
export declare const DEFAULT_DEVICE_MODEL: string;
|
|
9
9
|
export declare const DEFAULT_LANG_CODE: string;
|
|
10
10
|
export declare const DEFAULT_LANG_PACK = "";
|
package/esm/constants.js
CHANGED
|
@@ -62,7 +62,7 @@ export const publicKeys = new Map([
|
|
|
62
62
|
export const VECTOR_CONSTRUCTOR = 0x1CB5C415;
|
|
63
63
|
export const DEFAULT_INITIAL_DC = "2-test";
|
|
64
64
|
export const LAYER = 158;
|
|
65
|
-
export const DEFAULT_APP_VERSION = "MTKruto 0.0.
|
|
65
|
+
export const DEFAULT_APP_VERSION = "MTKruto 0.0.910";
|
|
66
66
|
// @ts-ignore: lib
|
|
67
67
|
export const DEFAULT_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;
|
|
68
68
|
export const DEFAULT_LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
|
package/esm/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getRandomId } from "./utilities/0_bigint.js";
|
|
2
|
-
import { checkPassword } from "./client/
|
|
2
|
+
import { checkPassword } from "./client/0_password.js";
|
|
3
3
|
export declare const utils: {
|
|
4
4
|
checkPassword: typeof checkPassword;
|
|
5
5
|
getRandomId: typeof getRandomId;
|
|
@@ -10,16 +10,16 @@ export * as functions from "./tl/3_functions.js";
|
|
|
10
10
|
export * from "./tl/5_rpc_result.js";
|
|
11
11
|
export * from "./tl/6_message.js";
|
|
12
12
|
export * from "./tl/7_message_container.js";
|
|
13
|
-
export * from "./client/
|
|
14
|
-
export * from "./client/
|
|
15
|
-
export * from "./storage/
|
|
16
|
-
export * from "./storage/
|
|
17
|
-
export * from "./storage/
|
|
18
|
-
export * from "./storage/
|
|
19
|
-
export * from "./transport/
|
|
20
|
-
export * from "./transport/
|
|
21
|
-
export * from "./transport/
|
|
22
|
-
export * from "./transport/
|
|
23
|
-
export * from "./connection/
|
|
24
|
-
export * from "./connection/
|
|
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 "./transport/1_transport_abridged.js";
|
|
20
|
+
export * from "./transport/1_transport_intermediate.js";
|
|
21
|
+
export * from "./transport/0_transport.js";
|
|
22
|
+
export * from "./transport/2_transport_provider.js";
|
|
23
|
+
export * from "./connection/0_connection.js";
|
|
24
|
+
export * from "./connection/1_connection_web_socket.js";
|
|
25
25
|
export { DEFAULT_APP_VERSION, DEFAULT_DEVICE_MODEL, DEFAULT_INITIAL_DC, DEFAULT_LANG_CODE, DEFAULT_LANG_PACK, DEFAULT_SYSTEM_LANG_CODE, DEFAULT_SYSTEM_VERSION, LAYER } from "./constants.js";
|
package/esm/mod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getRandomId } from "./utilities/0_bigint.js";
|
|
2
|
-
import { checkPassword } from "./client/
|
|
2
|
+
import { checkPassword } from "./client/0_password.js";
|
|
3
3
|
export const utils = { checkPassword, getRandomId };
|
|
4
4
|
export { as } from "./tl/1_tl_object.js";
|
|
5
5
|
export * as types from "./tl/2_types.js";
|
|
@@ -7,16 +7,16 @@ export * as functions from "./tl/3_functions.js";
|
|
|
7
7
|
export * from "./tl/5_rpc_result.js";
|
|
8
8
|
export * from "./tl/6_message.js";
|
|
9
9
|
export * from "./tl/7_message_container.js";
|
|
10
|
-
export * from "./client/
|
|
11
|
-
export * from "./client/
|
|
12
|
-
export * from "./storage/
|
|
13
|
-
export * from "./storage/
|
|
14
|
-
export * from "./storage/
|
|
15
|
-
export * from "./storage/
|
|
16
|
-
export * from "./transport/
|
|
17
|
-
export * from "./transport/
|
|
18
|
-
export * from "./transport/
|
|
19
|
-
export * from "./transport/
|
|
20
|
-
export * from "./connection/
|
|
21
|
-
export * from "./connection/
|
|
10
|
+
export * from "./client/2_client_plain.js";
|
|
11
|
+
export * from "./client/3_client.js";
|
|
12
|
+
export * from "./storage/0_storage.js";
|
|
13
|
+
export * from "./storage/1_storage_memory.js";
|
|
14
|
+
export * from "./storage/1_storage_local_storage.js";
|
|
15
|
+
export * from "./storage/1_storage_session_storage.js";
|
|
16
|
+
export * from "./transport/1_transport_abridged.js";
|
|
17
|
+
export * from "./transport/1_transport_intermediate.js";
|
|
18
|
+
export * from "./transport/0_transport.js";
|
|
19
|
+
export * from "./transport/2_transport_provider.js";
|
|
20
|
+
export * from "./connection/0_connection.js";
|
|
21
|
+
export * from "./connection/1_connection_web_socket.js";
|
|
22
22
|
export { DEFAULT_APP_VERSION, DEFAULT_DEVICE_MODEL, DEFAULT_INITIAL_DC, DEFAULT_LANG_CODE, DEFAULT_LANG_PACK, DEFAULT_SYSTEM_LANG_CODE, DEFAULT_SYSTEM_VERSION, LAYER } from "./constants.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MaybePromise } from "../utilities/0_types.js";
|
|
2
|
-
import { DC } from "../transport/
|
|
2
|
+
import { DC } from "../transport/2_transport_provider.js";
|
|
3
3
|
import * as types from "../tl/2_types.js";
|
|
4
4
|
export declare abstract class Storage {
|
|
5
5
|
private _authKeyId;
|
package/{script/storage/storage_local_storage.d.ts → esm/storage/1_storage_local_storage.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MaybePromise } from "../utilities/0_types.js";
|
|
2
|
-
import { Storage } from "./
|
|
2
|
+
import { Storage } from "./0_storage.js";
|
|
3
3
|
export declare class StorageLocalStorage extends Storage implements Storage {
|
|
4
4
|
private readonly prefix;
|
|
5
5
|
constructor(prefix: string);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MaybePromise } from "../utilities/0_types.js";
|
|
2
|
-
import { Storage } from "./
|
|
2
|
+
import { Storage } from "./0_storage.js";
|
|
3
3
|
export declare class StorageSessionStorage extends Storage implements Storage {
|
|
4
4
|
private readonly prefix;
|
|
5
5
|
constructor(prefix: string);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CTR } from "
|
|
2
|
-
import { Connection } from "
|
|
1
|
+
import { CTR } from "../utilities/0_crypto.js";
|
|
2
|
+
import { Connection } from "../connection/0_connection.js";
|
|
3
3
|
export declare function getObfuscationParameters(protocol: number, connection: Connection): Promise<{
|
|
4
4
|
encryptionCTR: CTR;
|
|
5
5
|
decryptionCTR: CTR;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as dntShim from "
|
|
2
|
-
import { bufferFromBigInt, concat } from "
|
|
3
|
-
import { CTR } from "
|
|
1
|
+
import * as dntShim from "../_dnt.shims.js";
|
|
2
|
+
import { bufferFromBigInt, concat } from "../utilities/0_buffer.js";
|
|
3
|
+
import { CTR } from "../utilities/0_crypto.js";
|
|
4
4
|
export async function getObfuscationParameters(protocol, connection) {
|
|
5
5
|
const dc = 0xFCFF;
|
|
6
6
|
let init;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Connection } from "../connection/
|
|
2
|
-
import { Transport } from "./
|
|
1
|
+
import { Connection } from "../connection/0_connection.js";
|
|
2
|
+
import { Transport } from "./0_transport.js";
|
|
3
3
|
export declare class TransportAbridged extends Transport implements Transport {
|
|
4
4
|
private readonly connection;
|
|
5
5
|
private readonly obfuscated;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { bufferFromBigInt, concat } from "../utilities/0_buffer.js";
|
|
2
|
-
import { getObfuscationParameters } from "./
|
|
3
|
-
import { Transport } from "./
|
|
2
|
+
import { getObfuscationParameters } from "./0_obfuscation.js";
|
|
3
|
+
import { Transport } from "./0_transport.js";
|
|
4
4
|
export class TransportAbridged extends Transport {
|
|
5
5
|
constructor(connection, obfuscated = false) {
|
|
6
6
|
super();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Connection } from "../connection/
|
|
2
|
-
import { Transport } from "./
|
|
1
|
+
import { Connection } from "../connection/0_connection.js";
|
|
2
|
+
import { Transport } from "./0_transport.js";
|
|
3
3
|
export declare class TransportIntermediate extends Transport implements Transport {
|
|
4
4
|
private readonly connection;
|
|
5
5
|
private readonly obfuscated;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { bufferFromBigInt, concat } from "../utilities/0_buffer.js";
|
|
2
|
-
import { getObfuscationParameters } from "./
|
|
3
|
-
import { Transport } from "./
|
|
2
|
+
import { getObfuscationParameters } from "./0_obfuscation.js";
|
|
3
|
+
import { Transport } from "./0_transport.js";
|
|
4
4
|
export class TransportIntermediate extends Transport {
|
|
5
5
|
constructor(connection, obfuscated = false) {
|
|
6
6
|
super();
|
package/{script/transport/transport_provider.d.ts → esm/transport/2_transport_provider.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Connection } from "../connection/
|
|
2
|
-
import { Transport } from "./
|
|
1
|
+
import { Connection } from "../connection/0_connection.js";
|
|
2
|
+
import { Transport } from "./0_transport.js";
|
|
3
3
|
export type DC = "1" | "2" | "3" | "4" | "5" | "1-test" | "2-test" | "3-test";
|
|
4
4
|
export interface TransportProviderParams {
|
|
5
5
|
dc?: DC;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConnectionWebSocket } from "../connection/
|
|
2
|
-
import { TransportIntermediate } from "./
|
|
1
|
+
import { ConnectionWebSocket } from "../connection/1_connection_web_socket.js";
|
|
2
|
+
import { TransportIntermediate } from "./1_transport_intermediate.js";
|
|
3
3
|
const dcToNameMap = {
|
|
4
4
|
"1": "pluto",
|
|
5
5
|
"1-test": "pluto",
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export declare enum FileType {
|
|
2
|
+
Thumbnail = 0,
|
|
3
|
+
ChatPhoto = 1,
|
|
4
|
+
Photo = 2,
|
|
5
|
+
Voice = 3,
|
|
6
|
+
Video = 4,
|
|
7
|
+
Document = 5,
|
|
8
|
+
Encrypted = 6,
|
|
9
|
+
Temp = 7,
|
|
10
|
+
Sticker = 8,
|
|
11
|
+
Audio = 9,
|
|
12
|
+
Animation = 10,
|
|
13
|
+
EncryptedThumbnail = 11,
|
|
14
|
+
Wallpaper = 12,
|
|
15
|
+
VideoNote = 13,
|
|
16
|
+
SecureRaw = 14,
|
|
17
|
+
Secure = 15,
|
|
18
|
+
Background = 16,
|
|
19
|
+
DocumentAsFile = 17
|
|
20
|
+
}
|
|
21
|
+
export declare enum ThumbnailSource {
|
|
22
|
+
Legacy = 0,
|
|
23
|
+
Thumbnail = 1,
|
|
24
|
+
ChatPhotoSmall = 2,
|
|
25
|
+
ChatPhotoBig = 3,
|
|
26
|
+
StickerSetThumbnail = 4
|
|
27
|
+
}
|
|
28
|
+
interface FileIDParams {
|
|
29
|
+
fileReference?: Uint8Array;
|
|
30
|
+
url?: string;
|
|
31
|
+
mediaId?: bigint;
|
|
32
|
+
accessHash?: bigint;
|
|
33
|
+
volumeId?: bigint;
|
|
34
|
+
thumbnailSource?: ThumbnailSource;
|
|
35
|
+
thumbnailFileType?: FileType;
|
|
36
|
+
thumbnailSize?: string;
|
|
37
|
+
secret?: bigint;
|
|
38
|
+
localId?: number;
|
|
39
|
+
chatId?: bigint;
|
|
40
|
+
chatAccessHash?: bigint;
|
|
41
|
+
stickerSetId?: bigint;
|
|
42
|
+
stickerSetAccessHash?: bigint;
|
|
43
|
+
}
|
|
44
|
+
export declare class FileID {
|
|
45
|
+
private readonly fileType;
|
|
46
|
+
private readonly dcId;
|
|
47
|
+
private readonly params;
|
|
48
|
+
static MAJOR: number;
|
|
49
|
+
static MINOR: number;
|
|
50
|
+
private readonly major;
|
|
51
|
+
private readonly minor;
|
|
52
|
+
constructor(major: number | null | undefined, minor: number | null | undefined, fileType: FileType, dcId: number, params: FileIDParams);
|
|
53
|
+
static decode(fileId: string): FileID;
|
|
54
|
+
encode(major?: number, minor?: number): string;
|
|
55
|
+
}
|
|
56
|
+
export declare enum FileUniqueType {
|
|
57
|
+
Web = 0,
|
|
58
|
+
Photo = 1,
|
|
59
|
+
Document = 2,
|
|
60
|
+
Secure = 3,
|
|
61
|
+
Encrypted = 4,
|
|
62
|
+
Temp = 5
|
|
63
|
+
}
|
|
64
|
+
interface FileUniqueParams {
|
|
65
|
+
url?: string;
|
|
66
|
+
mediaId?: bigint;
|
|
67
|
+
volumeId?: bigint;
|
|
68
|
+
localId?: number;
|
|
69
|
+
}
|
|
70
|
+
export declare class FileUniqueID {
|
|
71
|
+
private readonly fileUniqueType;
|
|
72
|
+
private readonly params;
|
|
73
|
+
constructor(fileUniqueType: FileUniqueType, params: FileUniqueParams);
|
|
74
|
+
static decode(fileId: string): FileUniqueID;
|
|
75
|
+
encode(): string;
|
|
76
|
+
}
|
|
77
|
+
export {};
|