@mtkruto/node 0.0.967 → 0.0.969
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/client/1_client_abstract.js +3 -3
- package/esm/client/2_client_plain.d.ts +3 -0
- package/esm/client/2_client_plain.js +11 -5
- package/esm/client/3_client.d.ts +6 -3
- package/esm/client/3_client.js +19 -15
- package/esm/connection/0_connection.d.ts +11 -2
- package/esm/connection/0_connection.js +23 -1
- package/esm/connection/1_connection_http.d.ts +16 -0
- package/esm/connection/1_connection_http.js +91 -0
- package/esm/connection/1_connection_web_socket.d.ts +2 -2
- package/esm/connection/1_connection_web_socket.js +3 -2
- package/esm/constants.d.ts +11 -10
- package/esm/constants.js +10 -18
- package/esm/mod.d.ts +1 -1
- package/esm/mod.js +1 -1
- package/esm/tl/2_types.d.ts +437 -40
- package/esm/tl/2_types.js +1470 -130
- package/esm/tl/3_functions.d.ts +274 -36
- package/esm/tl/3_functions.js +871 -116
- package/esm/transport/1_transport_piped.d.ts +10 -0
- package/esm/transport/1_transport_piped.js +23 -0
- package/esm/transport/2_transport_provider.d.ts +8 -2
- package/esm/transport/2_transport_provider.js +40 -2
- package/package.json +1 -1
- package/script/client/1_client_abstract.js +1 -1
- package/script/client/2_client_plain.d.ts +3 -0
- package/script/client/2_client_plain.js +10 -4
- package/script/client/3_client.d.ts +6 -3
- package/script/client/3_client.js +18 -14
- package/script/connection/0_connection.d.ts +11 -2
- package/script/connection/0_connection.js +26 -3
- package/script/connection/1_connection_http.d.ts +16 -0
- package/script/connection/1_connection_http.js +95 -0
- package/script/connection/1_connection_web_socket.d.ts +2 -2
- package/script/connection/1_connection_web_socket.js +3 -2
- package/script/constants.d.ts +11 -10
- package/script/constants.js +11 -19
- package/script/mod.d.ts +1 -1
- package/script/mod.js +8 -8
- package/script/tl/2_types.d.ts +437 -40
- package/script/tl/2_types.js +1540 -160
- package/script/tl/3_functions.d.ts +274 -36
- package/script/tl/3_functions.js +901 -125
- package/script/transport/1_transport_piped.d.ts +10 -0
- package/script/transport/1_transport_piped.js +27 -0
- package/script/transport/2_transport_provider.d.ts +8 -2
- package/script/transport/2_transport_provider.js +43 -4
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { initTgCrypto } from "../deps.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { INITIAL_DC } from "../constants.js";
|
|
3
|
+
import { webSocketTransportProvider } from "../transport/2_transport_provider.js";
|
|
4
4
|
export class ClientAbstract {
|
|
5
5
|
get initialDc() {
|
|
6
6
|
return this._initialDc;
|
|
7
7
|
}
|
|
8
|
-
constructor(transportProvider =
|
|
8
|
+
constructor(transportProvider = webSocketTransportProvider({ initialDc: INITIAL_DC }), cdn = false) {
|
|
9
9
|
Object.defineProperty(this, "transportProvider", {
|
|
10
10
|
enumerable: true,
|
|
11
11
|
configurable: true,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Function } from "../tl/3_functions.js";
|
|
2
|
+
import { TransportProvider } from "../transport/2_transport_provider.js";
|
|
2
3
|
import { ClientAbstract } from "./1_client_abstract.js";
|
|
3
4
|
export declare class ClientPlain extends ClientAbstract {
|
|
5
|
+
private readonly publicKeys;
|
|
4
6
|
private lastMsgId;
|
|
7
|
+
constructor(transportProvider: TransportProvider, publicKeys?: import("../constants.js").PublicKeys);
|
|
5
8
|
invoke<T extends Function<unknown>>(function_: T): Promise<T["__R"]>;
|
|
6
9
|
createAuthKey(): Promise<{
|
|
7
10
|
authKey: Uint8Array;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assertEquals, assertInstanceOf, debug, factorize, ige256Decrypt, ige256Encrypt } from "../deps.js";
|
|
2
|
-
import {
|
|
2
|
+
import { PUBLIC_KEYS } from "../constants.js";
|
|
3
3
|
import { bigIntFromBuffer, getRandomBigInt, modExp } from "../utilities/0_bigint.js";
|
|
4
4
|
import { bufferFromBigInt, concat } from "../utilities/0_buffer.js";
|
|
5
5
|
import { UNREACHABLE } from "../utilities/0_control.js";
|
|
@@ -13,8 +13,14 @@ import { ClientAbstract } from "./1_client_abstract.js";
|
|
|
13
13
|
import { getMessageId, packUnencryptedMessage, unpackUnencryptedMessage } from "./0_message.js";
|
|
14
14
|
const d = debug("ClientPlain/createAuthKey");
|
|
15
15
|
export class ClientPlain extends ClientAbstract {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(
|
|
16
|
+
constructor(transportProvider, publicKeys = PUBLIC_KEYS) {
|
|
17
|
+
super(transportProvider);
|
|
18
|
+
Object.defineProperty(this, "publicKeys", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: publicKeys
|
|
23
|
+
});
|
|
18
24
|
Object.defineProperty(this, "lastMsgId", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
configurable: true,
|
|
@@ -64,10 +70,10 @@ export class ClientPlain extends ClientAbstract {
|
|
|
64
70
|
let publicKeyFingerprint;
|
|
65
71
|
let publicKey;
|
|
66
72
|
for (const fingerprint of resPq.serverPublicKeyFingerprints) {
|
|
67
|
-
const maybePublicKey = publicKeys.
|
|
73
|
+
const maybePublicKey = this.publicKeys.find(([k]) => (k == fingerprint));
|
|
68
74
|
if (maybePublicKey) {
|
|
69
75
|
publicKeyFingerprint = fingerprint;
|
|
70
|
-
publicKey = maybePublicKey;
|
|
76
|
+
publicKey = maybePublicKey[1];
|
|
71
77
|
break;
|
|
72
78
|
}
|
|
73
79
|
}
|
package/esm/client/3_client.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PublicKeys } from "../constants.js";
|
|
1
2
|
import { MaybePromise } from "../utilities/0_types.js";
|
|
2
3
|
import * as types from "../tl/2_types.js";
|
|
3
4
|
import * as functions from "../tl/3_functions.js";
|
|
@@ -58,6 +59,7 @@ export interface ClientParams {
|
|
|
58
59
|
* The system_version parameter to be passed to initConnection when calling `authorize`.
|
|
59
60
|
*/
|
|
60
61
|
systemVersion?: string;
|
|
62
|
+
publicKeys?: PublicKeys;
|
|
61
63
|
}
|
|
62
64
|
export interface ForwardMessagesParams {
|
|
63
65
|
messageThreadId?: number;
|
|
@@ -69,8 +71,8 @@ export interface ForwardMessagesParams {
|
|
|
69
71
|
}
|
|
70
72
|
export declare class Client extends ClientAbstract {
|
|
71
73
|
readonly storage: Storage;
|
|
72
|
-
readonly apiId: number;
|
|
73
|
-
readonly apiHash: string;
|
|
74
|
+
readonly apiId: number | null;
|
|
75
|
+
readonly apiHash: string | null;
|
|
74
76
|
private auth;
|
|
75
77
|
private sessionId;
|
|
76
78
|
private state;
|
|
@@ -85,6 +87,7 @@ export declare class Client extends ClientAbstract {
|
|
|
85
87
|
readonly langPack: string;
|
|
86
88
|
readonly systemLangCode: string;
|
|
87
89
|
readonly systemVersion: string;
|
|
90
|
+
private readonly publicKeys?;
|
|
88
91
|
/**
|
|
89
92
|
* Constructs the client.
|
|
90
93
|
*
|
|
@@ -93,7 +96,7 @@ export declare class Client extends ClientAbstract {
|
|
|
93
96
|
* @param apiHash App's API hash from [my.telegram.org/apps](https://my.telegram.org/apps). Default to empty string (unset).
|
|
94
97
|
* @param params Other parameters.
|
|
95
98
|
*/
|
|
96
|
-
constructor(storage?: Storage, apiId?: number, apiHash?: string, params?: ClientParams, cdn?: boolean);
|
|
99
|
+
constructor(storage?: Storage, apiId?: number | null, apiHash?: string | null, params?: ClientParams, cdn?: boolean);
|
|
97
100
|
private storageInited;
|
|
98
101
|
/**
|
|
99
102
|
* Sets the DC and resets the auth key stored in the session provider
|
package/esm/client/3_client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { debug, gunzip, Mutex } from "../deps.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ACK_THRESHOLD, APP_VERSION, CHANNEL_DIFFERENCE_LIMIT_BOT, CHANNEL_DIFFERENCE_LIMIT_USER, DEVICE_MODEL, LANG_CODE, LANG_PACK, LAYER, MAX_CHANNEL_ID, MAX_CHAT_ID, STICKER_SET_NAME_TTL, SYSTEM_LANG_CODE, SYSTEM_VERSION, USERNAME_TTL, ZERO_CHANNEL_ID } from "../constants.js";
|
|
3
3
|
import { bigIntFromBuffer, getRandomBigInt, getRandomId } from "../utilities/0_bigint.js";
|
|
4
4
|
import { UNREACHABLE } from "../utilities/0_control.js";
|
|
5
5
|
import { sha1 } from "../utilities/0_hash.js";
|
|
@@ -153,6 +153,12 @@ export class Client extends ClientAbstract {
|
|
|
153
153
|
writable: true,
|
|
154
154
|
value: void 0
|
|
155
155
|
});
|
|
156
|
+
Object.defineProperty(this, "publicKeys", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
configurable: true,
|
|
159
|
+
writable: true,
|
|
160
|
+
value: void 0
|
|
161
|
+
});
|
|
156
162
|
Object.defineProperty(this, "storageInited", {
|
|
157
163
|
enumerable: true,
|
|
158
164
|
configurable: true,
|
|
@@ -184,12 +190,13 @@ export class Client extends ClientAbstract {
|
|
|
184
190
|
value: new Mutex()
|
|
185
191
|
});
|
|
186
192
|
this.parseMode = params?.parseMode ?? ParseMode.None;
|
|
187
|
-
this.appVersion = params?.appVersion ??
|
|
188
|
-
this.deviceModel = params?.deviceModel ??
|
|
189
|
-
this.langCode = params?.langCode ??
|
|
190
|
-
this.langPack = params?.langPack ??
|
|
191
|
-
this.systemLangCode = params?.systemLangCode ??
|
|
192
|
-
this.systemVersion = params?.systemVersion ??
|
|
193
|
+
this.appVersion = params?.appVersion ?? APP_VERSION;
|
|
194
|
+
this.deviceModel = params?.deviceModel ?? DEVICE_MODEL;
|
|
195
|
+
this.langCode = params?.langCode ?? LANG_CODE;
|
|
196
|
+
this.langPack = params?.langPack ?? LANG_PACK;
|
|
197
|
+
this.systemLangCode = params?.systemLangCode ?? SYSTEM_LANG_CODE;
|
|
198
|
+
this.systemVersion = params?.systemVersion ?? SYSTEM_VERSION;
|
|
199
|
+
this.publicKeys = params?.publicKeys;
|
|
193
200
|
}
|
|
194
201
|
/**
|
|
195
202
|
* Sets the DC and resets the auth key stored in the session provider
|
|
@@ -226,7 +233,7 @@ export class Client extends ClientAbstract {
|
|
|
226
233
|
}
|
|
227
234
|
const authKey = await this.storage.getAuthKey();
|
|
228
235
|
if (authKey == null) {
|
|
229
|
-
const plain = new ClientPlain(this.transportProvider);
|
|
236
|
+
const plain = new ClientPlain(this.transportProvider, this.publicKeys);
|
|
230
237
|
const dc = await this.storage.getDc();
|
|
231
238
|
if (dc != null) {
|
|
232
239
|
plain.setDc(dc);
|
|
@@ -372,7 +379,7 @@ export class Client extends ClientAbstract {
|
|
|
372
379
|
apiId: this.apiId,
|
|
373
380
|
apiHash: this.apiHash,
|
|
374
381
|
phoneNumber,
|
|
375
|
-
settings: new types.CodeSettings(),
|
|
382
|
+
settings: new types.CodeSettings({}),
|
|
376
383
|
}));
|
|
377
384
|
dAuth("verification code sent");
|
|
378
385
|
if (sentCode instanceof types.AuthSentCode) {
|
|
@@ -458,7 +465,7 @@ export class Client extends ClientAbstract {
|
|
|
458
465
|
}
|
|
459
466
|
while (this.connected) {
|
|
460
467
|
try {
|
|
461
|
-
if (this.toAcknowledge.size >=
|
|
468
|
+
if (this.toAcknowledge.size >= ACK_THRESHOLD) {
|
|
462
469
|
await this.send(new types.MsgsAck({ msgIds: [...this.toAcknowledge] }));
|
|
463
470
|
this.toAcknowledge.clear();
|
|
464
471
|
}
|
|
@@ -567,9 +574,8 @@ export class Client extends ClientAbstract {
|
|
|
567
574
|
const messageId = this.lastMsgId = getMessageId(this.lastMsgId);
|
|
568
575
|
const message = new Message_(messageId, seqNo, function_);
|
|
569
576
|
await this.transport.send(await encryptMessage(message, this.auth.key, this.auth.id, this.state.salt, this.sessionId));
|
|
570
|
-
|
|
577
|
+
d("invoked %s", function_.constructor.name);
|
|
571
578
|
if (noWait) {
|
|
572
|
-
d_();
|
|
573
579
|
return;
|
|
574
580
|
}
|
|
575
581
|
const result = await new Promise((resolve, reject) => {
|
|
@@ -579,7 +585,6 @@ export class Client extends ClientAbstract {
|
|
|
579
585
|
return await this.invoke(function_);
|
|
580
586
|
}
|
|
581
587
|
else {
|
|
582
|
-
d_();
|
|
583
588
|
return result;
|
|
584
589
|
}
|
|
585
590
|
}
|
|
@@ -1147,8 +1152,7 @@ export class Client extends ClientAbstract {
|
|
|
1147
1152
|
noWebpage,
|
|
1148
1153
|
silent,
|
|
1149
1154
|
noforwards,
|
|
1150
|
-
replyToMsgId,
|
|
1151
|
-
topMsgId,
|
|
1155
|
+
replyTo: replyToMsgId !== undefined ? new types.InputReplyToMessage({ replyToMsgId, topMsgId }) : undefined,
|
|
1152
1156
|
sendAs,
|
|
1153
1157
|
entities,
|
|
1154
1158
|
replyMarkup,
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { MaybePromise } from "../utilities/0_types.js";
|
|
2
|
-
|
|
2
|
+
declare abstract class Foundation {
|
|
3
3
|
abstract get connected(): boolean;
|
|
4
4
|
abstract open(): MaybePromise<void>;
|
|
5
|
-
abstract read(p: Uint8Array): MaybePromise<void>;
|
|
6
5
|
abstract write(p: Uint8Array): MaybePromise<void>;
|
|
7
6
|
abstract close(): MaybePromise<void>;
|
|
8
7
|
}
|
|
8
|
+
export declare abstract class ConnectionUnframed extends Foundation {
|
|
9
|
+
readonly type: "framed";
|
|
10
|
+
abstract read(p: Uint8Array): MaybePromise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare abstract class ConnectionFramed extends Foundation {
|
|
13
|
+
readonly type: "framed";
|
|
14
|
+
abstract read(): MaybePromise<Uint8Array>;
|
|
15
|
+
}
|
|
16
|
+
export type Connection = ConnectionUnframed | ConnectionFramed;
|
|
17
|
+
export {};
|
|
@@ -1,2 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
class Foundation {
|
|
2
|
+
}
|
|
3
|
+
export class ConnectionUnframed extends Foundation {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
Object.defineProperty(this, "type", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true,
|
|
10
|
+
value: "framed"
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export class ConnectionFramed extends Foundation {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
Object.defineProperty(this, "type", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true,
|
|
21
|
+
value: "framed"
|
|
22
|
+
});
|
|
23
|
+
}
|
|
2
24
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ConnectionFramed } from "./0_connection.js";
|
|
2
|
+
export declare class ConnectionHTTP extends ConnectionFramed implements ConnectionFramed {
|
|
3
|
+
private readonly url;
|
|
4
|
+
private rMutex;
|
|
5
|
+
private wMutex;
|
|
6
|
+
private resolveCanRead;
|
|
7
|
+
private canRead;
|
|
8
|
+
private buffers;
|
|
9
|
+
constructor(url: string | URL);
|
|
10
|
+
private resetCanRead;
|
|
11
|
+
get connected(): boolean;
|
|
12
|
+
open(): Promise<void>;
|
|
13
|
+
read(): Promise<Uint8Array>;
|
|
14
|
+
write(buffer: Uint8Array): Promise<void>;
|
|
15
|
+
close(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Mutex } from "../deps.js";
|
|
2
|
+
import { UNREACHABLE } from "../utilities/0_control.js";
|
|
3
|
+
import { ConnectionFramed } from "./0_connection.js";
|
|
4
|
+
export class ConnectionHTTP extends ConnectionFramed {
|
|
5
|
+
constructor(url) {
|
|
6
|
+
super();
|
|
7
|
+
Object.defineProperty(this, "url", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
configurable: true,
|
|
10
|
+
writable: true,
|
|
11
|
+
value: url
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(this, "rMutex", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true,
|
|
17
|
+
value: new Mutex()
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(this, "wMutex", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: new Mutex()
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(this, "resolveCanRead", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true,
|
|
29
|
+
value: () => { }
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(this, "canRead", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
value: Promise.resolve()
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(this, "buffers", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: new Array()
|
|
42
|
+
});
|
|
43
|
+
this.resetCanRead();
|
|
44
|
+
}
|
|
45
|
+
resetCanRead() {
|
|
46
|
+
this.canRead = new Promise((r) => this.resolveCanRead = r);
|
|
47
|
+
}
|
|
48
|
+
get connected() {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
async open() {
|
|
52
|
+
}
|
|
53
|
+
async read() {
|
|
54
|
+
await this.canRead;
|
|
55
|
+
const release = await this.rMutex.acquire();
|
|
56
|
+
try {
|
|
57
|
+
const buffer = this.buffers.pop();
|
|
58
|
+
if (buffer === undefined) {
|
|
59
|
+
throw UNREACHABLE();
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return buffer;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
if (this.buffers.length == 0) {
|
|
67
|
+
this.resetCanRead();
|
|
68
|
+
}
|
|
69
|
+
release();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async write(buffer) {
|
|
73
|
+
const release = await this.wMutex.acquire();
|
|
74
|
+
try {
|
|
75
|
+
const res = await fetch(this.url, {
|
|
76
|
+
mode: "cors",
|
|
77
|
+
method: "POST",
|
|
78
|
+
body: buffer,
|
|
79
|
+
});
|
|
80
|
+
this.buffers.push(new Uint8Array(await res.arrayBuffer()));
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
if (this.buffers.length == 1) {
|
|
84
|
+
this.resolveCanRead();
|
|
85
|
+
}
|
|
86
|
+
release();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
close() {
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class ConnectionWebSocket implements
|
|
1
|
+
import { ConnectionUnframed } from "./0_connection.js";
|
|
2
|
+
export declare class ConnectionWebSocket extends ConnectionUnframed implements ConnectionUnframed {
|
|
3
3
|
private webSocket;
|
|
4
4
|
private rMutex;
|
|
5
5
|
private wMutex;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
|
2
2
|
import { debug, Mutex } from "../deps.js";
|
|
3
|
+
import { ConnectionUnframed } from "./0_connection.js";
|
|
3
4
|
const d = debug("ConnectionWebSocket");
|
|
4
|
-
export class ConnectionWebSocket {
|
|
5
|
+
export class ConnectionWebSocket extends ConnectionUnframed {
|
|
5
6
|
constructor(url) {
|
|
7
|
+
super();
|
|
6
8
|
Object.defineProperty(this, "webSocket", {
|
|
7
9
|
enumerable: true,
|
|
8
10
|
configurable: true,
|
|
@@ -46,7 +48,6 @@ export class ConnectionWebSocket {
|
|
|
46
48
|
value: null
|
|
47
49
|
});
|
|
48
50
|
this.webSocket = this.reinitWs(url);
|
|
49
|
-
// TODO
|
|
50
51
|
this.webSocket.addEventListener("close", (e) => {
|
|
51
52
|
if (e.code != 1000 && e.reason != "method") {
|
|
52
53
|
this.webSocket = this.reinitWs(url);
|
package/esm/constants.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { DC } from "./transport/2_transport_provider.js";
|
|
2
|
-
export declare const
|
|
3
|
-
export
|
|
2
|
+
export declare const ACK_THRESHOLD = 10;
|
|
3
|
+
export type PublicKeys = readonly [bigint, [bigint, bigint]][];
|
|
4
|
+
export declare const PUBLIC_KEYS: PublicKeys;
|
|
4
5
|
export declare const VECTOR_CONSTRUCTOR = 481674261;
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const LAYER =
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
6
|
+
export declare const INITIAL_DC: DC;
|
|
7
|
+
export declare const LAYER = 160;
|
|
8
|
+
export declare const APP_VERSION = "MTKruto 0.0.969";
|
|
9
|
+
export declare const DEVICE_MODEL: string;
|
|
10
|
+
export declare const LANG_CODE: string;
|
|
11
|
+
export declare const LANG_PACK = "";
|
|
12
|
+
export declare const SYSTEM_LANG_CODE: string;
|
|
13
|
+
export declare const SYSTEM_VERSION: string;
|
|
13
14
|
export declare const USERNAME_TTL = 86400;
|
|
14
15
|
export declare const STICKER_SET_NAME_TTL = 172800;
|
|
15
16
|
export declare const MAX_CHAT_ID = 999999999999;
|
package/esm/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as dntShim from "./_dnt.shims.js";
|
|
2
|
-
export const
|
|
3
|
-
export const
|
|
2
|
+
export const ACK_THRESHOLD = 10;
|
|
3
|
+
export const PUBLIC_KEYS = Object.freeze([
|
|
4
4
|
[
|
|
5
5
|
1562291298945373506n,
|
|
6
6
|
[
|
|
@@ -50,26 +50,18 @@ export const publicKeys = new Map([
|
|
|
50
50
|
0x010001n,
|
|
51
51
|
],
|
|
52
52
|
],
|
|
53
|
-
// Piltover
|
|
54
|
-
[
|
|
55
|
-
-5746138571559360724n,
|
|
56
|
-
[
|
|
57
|
-
26007219673003768186863565706940772901187119797549016801229858995725553827566821957407312503173782965285118977548255274803204174826509270586421841734996746493071723679186583391927378886693846518017621303145594627156874011707147548520576401963675756312298478878474644101348427872255774246965916073553469761183250044599310582333625453447885100318336864215713703860033765477732305055537755094341310278183464296754000479758644167423888581130401586546401934096183449791147912201040435037926911688179080223967863256047196705714611239523210563418382771999824529581206920323901890386681875893623076449827387008128524246269437n,
|
|
58
|
-
0x010001n,
|
|
59
|
-
],
|
|
60
|
-
],
|
|
61
53
|
]);
|
|
62
54
|
export const VECTOR_CONSTRUCTOR = 0x1CB5C415;
|
|
63
|
-
export const
|
|
64
|
-
export const LAYER =
|
|
65
|
-
export const
|
|
55
|
+
export const INITIAL_DC = "2-test";
|
|
56
|
+
export const LAYER = 160;
|
|
57
|
+
export const APP_VERSION = "MTKruto 0.0.969";
|
|
66
58
|
// @ts-ignore: lib
|
|
67
|
-
export const
|
|
68
|
-
export const
|
|
69
|
-
export const
|
|
70
|
-
export const
|
|
59
|
+
export const DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
|
|
60
|
+
export const LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
|
|
61
|
+
export const LANG_PACK = "";
|
|
62
|
+
export const SYSTEM_LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
|
|
71
63
|
// @ts-ignore: lib
|
|
72
|
-
export const
|
|
64
|
+
export const SYSTEM_VERSION = typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : "Node.js/" + process.versions.node : navigator.userAgent;
|
|
73
65
|
export const USERNAME_TTL = 86400;
|
|
74
66
|
export const STICKER_SET_NAME_TTL = 172800;
|
|
75
67
|
export const MAX_CHAT_ID = 999999999999;
|
package/esm/mod.d.ts
CHANGED
|
@@ -23,4 +23,4 @@ export * from "./transport/0_transport.js";
|
|
|
23
23
|
export * from "./transport/2_transport_provider.js";
|
|
24
24
|
export * from "./connection/0_connection.js";
|
|
25
25
|
export * from "./connection/1_connection_web_socket.js";
|
|
26
|
-
export {
|
|
26
|
+
export { APP_VERSION, DEVICE_MODEL, INITIAL_DC, LANG_CODE, LANG_PACK, LAYER, SYSTEM_LANG_CODE, SYSTEM_VERSION } from "./constants.js";
|
package/esm/mod.js
CHANGED
|
@@ -20,4 +20,4 @@ export * from "./transport/0_transport.js";
|
|
|
20
20
|
export * from "./transport/2_transport_provider.js";
|
|
21
21
|
export * from "./connection/0_connection.js";
|
|
22
22
|
export * from "./connection/1_connection_web_socket.js";
|
|
23
|
-
export {
|
|
23
|
+
export { APP_VERSION, DEVICE_MODEL, INITIAL_DC, LANG_CODE, LANG_PACK, LAYER, SYSTEM_LANG_CODE, SYSTEM_VERSION } from "./constants.js";
|