@mtkruto/node 0.0.801 → 0.0.820
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/client_plain.js +4 -3
- package/esm/connection/connection_web_socket.js +3 -1
- package/esm/mod.js +1 -0
- package/esm/tl/1_tl_object.js +14 -7
- package/esm/tl/3_tl_reader.js +1 -1
- package/esm/tl/3_tl_writer.js +2 -1
- package/esm/tl/5_message.js +2 -2
- package/esm/utilities/1_message.js +2 -2
- package/package.json +1 -1
- package/script/client/client_plain.js +4 -3
- package/script/connection/connection_web_socket.js +3 -1
- package/script/mod.js +3 -1
- package/script/tl/1_tl_object.js +15 -8
- package/script/tl/3_tl_reader.js +2 -2
- package/script/tl/3_tl_writer.js +2 -1
- package/script/tl/5_message.js +1 -1
- package/script/utilities/1_message.js +1 -1
- package/types/mod.d.ts +1 -0
- package/types/tl/1_tl_object.d.ts +5 -2
- /package/esm/tl/{3_tl_object_deserializer.js → 3_deserialize.js} +0 -0
- /package/script/tl/{3_tl_object_deserializer.js → 3_deserialize.js} +0 -0
- /package/types/tl/{3_tl_object_deserializer.d.ts → 3_deserialize.d.ts} +0 -0
|
@@ -4,6 +4,7 @@ import { bigIntFromBuffer, getRandomBigInt, modExp } from "../utilities/0_bigint
|
|
|
4
4
|
import { bufferFromBigInt, concat } from "../utilities/0_buffer.js";
|
|
5
5
|
import { sha1 } from "../utilities/0_hash.js";
|
|
6
6
|
import { rsaPad } from "../utilities/1_auth.js";
|
|
7
|
+
import { serialize } from "../tl/1_tl_object.js";
|
|
7
8
|
import { packUnencryptedMessage, unpackUnencryptedMessage } from "../utilities/1_message.js";
|
|
8
9
|
import { ClientDHInnerData, DHGenOK, PQInnerDataDC, ResPQ, ServerDHInnerData, ServerDHParamsOK } from "../tl/2_types.js";
|
|
9
10
|
import { ReqDHParams, ReqPQMulti, SetClientDHParams } from "../tl/3_functions.js";
|
|
@@ -11,7 +12,7 @@ import { TLReader } from "../tl/3_tl_reader.js";
|
|
|
11
12
|
import { ClientAbstract } from "./client_abstract.js";
|
|
12
13
|
export class ClientPlain extends ClientAbstract {
|
|
13
14
|
async invoke(function_) {
|
|
14
|
-
await this.transport.send(packUnencryptedMessage(function_
|
|
15
|
+
await this.transport.send(packUnencryptedMessage(function_[serialize]()));
|
|
15
16
|
const buffer = await this.transport.receive();
|
|
16
17
|
if (buffer.length == 4) {
|
|
17
18
|
const int = bigIntFromBuffer(buffer, true, true);
|
|
@@ -60,7 +61,7 @@ export class ClientPlain extends ClientAbstract {
|
|
|
60
61
|
newNonce,
|
|
61
62
|
nonce,
|
|
62
63
|
serverNonce,
|
|
63
|
-
})
|
|
64
|
+
})[serialize](), publicKey);
|
|
64
65
|
const dhParams = await this.invoke(new ReqDHParams({
|
|
65
66
|
nonce,
|
|
66
67
|
serverNonce,
|
|
@@ -88,7 +89,7 @@ export class ClientPlain extends ClientAbstract {
|
|
|
88
89
|
serverNonce,
|
|
89
90
|
retryId: 0n,
|
|
90
91
|
gB: bufferFromBigInt(gB, 256, false, false),
|
|
91
|
-
})
|
|
92
|
+
})[serialize]();
|
|
92
93
|
let dataWithHash = concat(await sha1(data), data);
|
|
93
94
|
while (dataWithHash.length % 16 != 0) {
|
|
94
95
|
dataWithHash = concat(dataWithHash, new Uint8Array(1));
|
|
@@ -36,7 +36,9 @@ export class ConnectionWebSocket {
|
|
|
36
36
|
this.webSocket.onmessage = async (e) => {
|
|
37
37
|
// deno-lint-ignore no-explicit-any
|
|
38
38
|
const data = e.data instanceof Blob ? new Uint8Array(await e.data.arrayBuffer()) : new Uint8Array(e.data);
|
|
39
|
-
|
|
39
|
+
for (const byte of data) {
|
|
40
|
+
this.buffer.push(byte);
|
|
41
|
+
}
|
|
40
42
|
if (this.nextResolve != null && this.buffer.length >= this.nextResolve[0]) {
|
|
41
43
|
this.nextResolve[1]();
|
|
42
44
|
this.nextResolve = null;
|
package/esm/mod.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { checkPassword } from "./utilities/1_password.js";
|
|
2
2
|
import { getRandomId } from "./utilities/0_bigint.js";
|
|
3
3
|
export const utils = { checkPassword, getRandomId };
|
|
4
|
+
export { as } from "./tl/1_tl_object.js";
|
|
4
5
|
export * as types from "./tl/2_types.js";
|
|
5
6
|
export * as functions from "./tl/3_functions.js";
|
|
6
7
|
export * from "./tl/4_rpc_result.js";
|
package/esm/tl/1_tl_object.js
CHANGED
|
@@ -5,6 +5,8 @@ export const id = Symbol("id");
|
|
|
5
5
|
export const params = Symbol("params");
|
|
6
6
|
export const paramDesc = Symbol("paramDesc");
|
|
7
7
|
export const length = Symbol("length");
|
|
8
|
+
export const serialize = Symbol();
|
|
9
|
+
export const as = Symbol();
|
|
8
10
|
export function isOptionalParam(ntype) {
|
|
9
11
|
return ntype.includes("?");
|
|
10
12
|
}
|
|
@@ -22,7 +24,7 @@ function serializeSingleParam(writer, value, type, ntype) {
|
|
|
22
24
|
if (isTLObjectConstructor(type)) {
|
|
23
25
|
if ((type.name == "TypeX" && value instanceof TLObject) ||
|
|
24
26
|
value instanceof type) {
|
|
25
|
-
writer.write(value
|
|
27
|
+
writer.write(value[serialize]());
|
|
26
28
|
return;
|
|
27
29
|
}
|
|
28
30
|
else {
|
|
@@ -87,10 +89,7 @@ function serializeSingleParam(writer, value, type, ntype) {
|
|
|
87
89
|
}
|
|
88
90
|
break;
|
|
89
91
|
case "true":
|
|
90
|
-
if (value
|
|
91
|
-
writer.writeInt32(0x997275B5);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
92
|
+
if (value !== true) {
|
|
94
93
|
throw new TypeError("Expected true");
|
|
95
94
|
}
|
|
96
95
|
}
|
|
@@ -101,9 +100,9 @@ export class TLObject {
|
|
|
101
100
|
return [];
|
|
102
101
|
}
|
|
103
102
|
get [length]() {
|
|
104
|
-
return this
|
|
103
|
+
return this[serialize]().byteLength;
|
|
105
104
|
}
|
|
106
|
-
serialize() {
|
|
105
|
+
[serialize]() {
|
|
107
106
|
const writer = new TLRawWriter();
|
|
108
107
|
writer.writeInt32(this[id], false);
|
|
109
108
|
for (const [value, type, ntype] of this[params]) {
|
|
@@ -142,6 +141,14 @@ export class TLObject {
|
|
|
142
141
|
}
|
|
143
142
|
return writer.buffer;
|
|
144
143
|
}
|
|
144
|
+
[as](constructor) {
|
|
145
|
+
if (this instanceof constructor) {
|
|
146
|
+
return this;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
throw new TypeError(`Expected ${constructor.name}, got ${this.constructor.name}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
145
152
|
}
|
|
146
153
|
export function isTLObjectConstructor(t) {
|
|
147
154
|
// deno-lint-ignore no-explicit-any
|
package/esm/tl/3_tl_reader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TLRawReader } from "./0_tl_raw_reader.js";
|
|
2
2
|
import { paramDesc } from "./1_tl_object.js";
|
|
3
3
|
import { map } from "./2_types.js";
|
|
4
|
-
import { deserialize } from "./
|
|
4
|
+
import { deserialize } from "./3_deserialize.js";
|
|
5
5
|
export class TLReader extends TLRawReader {
|
|
6
6
|
readObject(id) {
|
|
7
7
|
if (!id) {
|
package/esm/tl/3_tl_writer.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { VECTOR_CONSTRUCTOR } from "../constants.js";
|
|
2
2
|
import { TLRawWriter } from "./0_tl_raw_writer.js";
|
|
3
|
+
import { serialize } from "./1_tl_object.js";
|
|
3
4
|
export class TLWriter extends TLRawWriter {
|
|
4
5
|
writeObject(object) {
|
|
5
6
|
if (Array.isArray(object)) {
|
|
@@ -10,7 +11,7 @@ export class TLWriter extends TLRawWriter {
|
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
else {
|
|
13
|
-
this.write(object
|
|
14
|
+
this.write(object[serialize]());
|
|
14
15
|
}
|
|
15
16
|
return this;
|
|
16
17
|
}
|
package/esm/tl/5_message.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { id } from "./1_tl_object.js";
|
|
1
|
+
import { id, serialize } from "./1_tl_object.js";
|
|
2
2
|
import { TLReader } from "./3_tl_reader.js";
|
|
3
3
|
import { TLWriter } from "./3_tl_writer.js";
|
|
4
4
|
import { RPCResult } from "./4_rpc_result.js";
|
|
@@ -13,7 +13,7 @@ function calculateLength(object) {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
|
-
length += object
|
|
16
|
+
length += object[serialize]().length;
|
|
17
17
|
}
|
|
18
18
|
return length;
|
|
19
19
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assertEquals, ige256Decrypt, ige256Encrypt } from "../deps.js";
|
|
2
2
|
import { TLRawReader } from "../tl/0_tl_raw_reader.js";
|
|
3
3
|
import { TLRawWriter } from "../tl/0_tl_raw_writer.js";
|
|
4
|
-
import { id } from "../tl/1_tl_object.js";
|
|
4
|
+
import { id, serialize } from "../tl/1_tl_object.js";
|
|
5
5
|
import { TLReader } from "../tl/3_tl_reader.js";
|
|
6
6
|
import { RPCResult } from "../tl/4_rpc_result.js";
|
|
7
7
|
import { Message } from "../tl/5_message.js";
|
|
@@ -34,7 +34,7 @@ export function unpackUnencryptedMessage(buffer) {
|
|
|
34
34
|
return { messageId, message };
|
|
35
35
|
}
|
|
36
36
|
export async function encryptMessage(message, authKey, authKeyId, salt, sessionId) {
|
|
37
|
-
const encoded = message.body
|
|
37
|
+
const encoded = message.body[serialize]();
|
|
38
38
|
const payloadWriter = new TLRawWriter();
|
|
39
39
|
payloadWriter.writeInt64(salt);
|
|
40
40
|
payloadWriter.writeInt64(sessionId);
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@ const _0_bigint_js_1 = require("../utilities/0_bigint.js");
|
|
|
7
7
|
const _0_buffer_js_1 = require("../utilities/0_buffer.js");
|
|
8
8
|
const _0_hash_js_1 = require("../utilities/0_hash.js");
|
|
9
9
|
const _1_auth_js_1 = require("../utilities/1_auth.js");
|
|
10
|
+
const _1_tl_object_js_1 = require("../tl/1_tl_object.js");
|
|
10
11
|
const _1_message_js_1 = require("../utilities/1_message.js");
|
|
11
12
|
const _2_types_js_1 = require("../tl/2_types.js");
|
|
12
13
|
const _3_functions_js_1 = require("../tl/3_functions.js");
|
|
@@ -14,7 +15,7 @@ const _3_tl_reader_js_1 = require("../tl/3_tl_reader.js");
|
|
|
14
15
|
const client_abstract_js_1 = require("./client_abstract.js");
|
|
15
16
|
class ClientPlain extends client_abstract_js_1.ClientAbstract {
|
|
16
17
|
async invoke(function_) {
|
|
17
|
-
await this.transport.send((0, _1_message_js_1.packUnencryptedMessage)(function_.serialize()));
|
|
18
|
+
await this.transport.send((0, _1_message_js_1.packUnencryptedMessage)(function_[_1_tl_object_js_1.serialize]()));
|
|
18
19
|
const buffer = await this.transport.receive();
|
|
19
20
|
if (buffer.length == 4) {
|
|
20
21
|
const int = (0, _0_bigint_js_1.bigIntFromBuffer)(buffer, true, true);
|
|
@@ -63,7 +64,7 @@ class ClientPlain extends client_abstract_js_1.ClientAbstract {
|
|
|
63
64
|
newNonce,
|
|
64
65
|
nonce,
|
|
65
66
|
serverNonce,
|
|
66
|
-
}).serialize(), publicKey);
|
|
67
|
+
})[_1_tl_object_js_1.serialize](), publicKey);
|
|
67
68
|
const dhParams = await this.invoke(new _3_functions_js_1.ReqDHParams({
|
|
68
69
|
nonce,
|
|
69
70
|
serverNonce,
|
|
@@ -91,7 +92,7 @@ class ClientPlain extends client_abstract_js_1.ClientAbstract {
|
|
|
91
92
|
serverNonce,
|
|
92
93
|
retryId: 0n,
|
|
93
94
|
gB: (0, _0_buffer_js_1.bufferFromBigInt)(gB, 256, false, false),
|
|
94
|
-
}).serialize();
|
|
95
|
+
})[_1_tl_object_js_1.serialize]();
|
|
95
96
|
let dataWithHash = (0, _0_buffer_js_1.concat)(await (0, _0_hash_js_1.sha1)(data), data);
|
|
96
97
|
while (dataWithHash.length % 16 != 0) {
|
|
97
98
|
dataWithHash = (0, _0_buffer_js_1.concat)(dataWithHash, new Uint8Array(1));
|
|
@@ -62,7 +62,9 @@ class ConnectionWebSocket {
|
|
|
62
62
|
this.webSocket.onmessage = async (e) => {
|
|
63
63
|
// deno-lint-ignore no-explicit-any
|
|
64
64
|
const data = e.data instanceof Blob ? new Uint8Array(await e.data.arrayBuffer()) : new Uint8Array(e.data);
|
|
65
|
-
|
|
65
|
+
for (const byte of data) {
|
|
66
|
+
this.buffer.push(byte);
|
|
67
|
+
}
|
|
66
68
|
if (this.nextResolve != null && this.buffer.length >= this.nextResolve[0]) {
|
|
67
69
|
this.nextResolve[1]();
|
|
68
70
|
this.nextResolve = null;
|
package/script/mod.js
CHANGED
|
@@ -26,10 +26,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
26
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.LAYER = exports.DEFAULT_SYSTEM_VERSION = exports.DEFAULT_SYSTEM_LANG_CODE = exports.DEFAULT_LANG_PACK = exports.DEFAULT_LANG_CODE = exports.DEFAULT_INITIAL_DC = exports.DEFAULT_DEVICE_MODEL = exports.DEFAULT_APP_VERSION = exports.functions = exports.types = exports.utils = void 0;
|
|
29
|
+
exports.LAYER = exports.DEFAULT_SYSTEM_VERSION = exports.DEFAULT_SYSTEM_LANG_CODE = exports.DEFAULT_LANG_PACK = exports.DEFAULT_LANG_CODE = exports.DEFAULT_INITIAL_DC = exports.DEFAULT_DEVICE_MODEL = exports.DEFAULT_APP_VERSION = exports.functions = exports.types = exports.as = exports.utils = void 0;
|
|
30
30
|
const _1_password_js_1 = require("./utilities/1_password.js");
|
|
31
31
|
const _0_bigint_js_1 = require("./utilities/0_bigint.js");
|
|
32
32
|
exports.utils = { checkPassword: _1_password_js_1.checkPassword, getRandomId: _0_bigint_js_1.getRandomId };
|
|
33
|
+
var _1_tl_object_js_1 = require("./tl/1_tl_object.js");
|
|
34
|
+
Object.defineProperty(exports, "as", { enumerable: true, get: function () { return _1_tl_object_js_1.as; } });
|
|
33
35
|
exports.types = __importStar(require("./tl/2_types.js"));
|
|
34
36
|
exports.functions = __importStar(require("./tl/3_functions.js"));
|
|
35
37
|
__exportStar(require("./tl/4_rpc_result.js"), exports);
|
package/script/tl/1_tl_object.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isTLObjectConstructor = exports.TLObject = exports.analyzeOptionalParam = exports.isOptionalParam = exports.length = exports.paramDesc = exports.params = exports.id = exports.flags = void 0;
|
|
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
4
|
const deps_js_1 = require("../deps.js");
|
|
5
5
|
const _0_tl_raw_writer_js_1 = require("./0_tl_raw_writer.js");
|
|
6
6
|
exports.flags = Symbol("flags");
|
|
@@ -8,6 +8,8 @@ exports.id = Symbol("id");
|
|
|
8
8
|
exports.params = Symbol("params");
|
|
9
9
|
exports.paramDesc = Symbol("paramDesc");
|
|
10
10
|
exports.length = Symbol("length");
|
|
11
|
+
exports.serialize = Symbol();
|
|
12
|
+
exports.as = Symbol();
|
|
11
13
|
function isOptionalParam(ntype) {
|
|
12
14
|
return ntype.includes("?");
|
|
13
15
|
}
|
|
@@ -27,7 +29,7 @@ function serializeSingleParam(writer, value, type, ntype) {
|
|
|
27
29
|
if (isTLObjectConstructor(type)) {
|
|
28
30
|
if ((type.name == "TypeX" && value instanceof TLObject) ||
|
|
29
31
|
value instanceof type) {
|
|
30
|
-
writer.write(value.serialize());
|
|
32
|
+
writer.write(value[exports.serialize]());
|
|
31
33
|
return;
|
|
32
34
|
}
|
|
33
35
|
else {
|
|
@@ -92,10 +94,7 @@ function serializeSingleParam(writer, value, type, ntype) {
|
|
|
92
94
|
}
|
|
93
95
|
break;
|
|
94
96
|
case "true":
|
|
95
|
-
if (value
|
|
96
|
-
writer.writeInt32(0x997275B5);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
97
|
+
if (value !== true) {
|
|
99
98
|
throw new TypeError("Expected true");
|
|
100
99
|
}
|
|
101
100
|
}
|
|
@@ -106,9 +105,9 @@ class TLObject {
|
|
|
106
105
|
return [];
|
|
107
106
|
}
|
|
108
107
|
get [exports.length]() {
|
|
109
|
-
return this.serialize().byteLength;
|
|
108
|
+
return this[exports.serialize]().byteLength;
|
|
110
109
|
}
|
|
111
|
-
serialize() {
|
|
110
|
+
[exports.serialize]() {
|
|
112
111
|
const writer = new _0_tl_raw_writer_js_1.TLRawWriter();
|
|
113
112
|
writer.writeInt32(this[exports.id], false);
|
|
114
113
|
for (const [value, type, ntype] of this[exports.params]) {
|
|
@@ -147,6 +146,14 @@ class TLObject {
|
|
|
147
146
|
}
|
|
148
147
|
return writer.buffer;
|
|
149
148
|
}
|
|
149
|
+
[exports.as](constructor) {
|
|
150
|
+
if (this instanceof constructor) {
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
throw new TypeError(`Expected ${constructor.name}, got ${this.constructor.name}`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
150
157
|
}
|
|
151
158
|
exports.TLObject = TLObject;
|
|
152
159
|
function isTLObjectConstructor(t) {
|
package/script/tl/3_tl_reader.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.TLReader = void 0;
|
|
|
4
4
|
const _0_tl_raw_reader_js_1 = require("./0_tl_raw_reader.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
|
-
const
|
|
7
|
+
const _3_deserialize_js_1 = require("./3_deserialize.js");
|
|
8
8
|
class TLReader extends _0_tl_raw_reader_js_1.TLRawReader {
|
|
9
9
|
readObject(id) {
|
|
10
10
|
if (!id) {
|
|
@@ -20,7 +20,7 @@ class TLReader extends _0_tl_raw_reader_js_1.TLRawReader {
|
|
|
20
20
|
}
|
|
21
21
|
const constructor = _2_types_js_1.map.get(id);
|
|
22
22
|
if (constructor) {
|
|
23
|
-
return (0,
|
|
23
|
+
return (0, _3_deserialize_js_1.deserialize)(this, constructor[_1_tl_object_js_1.paramDesc], constructor);
|
|
24
24
|
}
|
|
25
25
|
throw new Error(`Unknown constructor ${id.toString(16)}`);
|
|
26
26
|
}
|
package/script/tl/3_tl_writer.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TLWriter = void 0;
|
|
4
4
|
const constants_js_1 = require("../constants.js");
|
|
5
5
|
const _0_tl_raw_writer_js_1 = require("./0_tl_raw_writer.js");
|
|
6
|
+
const _1_tl_object_js_1 = require("./1_tl_object.js");
|
|
6
7
|
class TLWriter extends _0_tl_raw_writer_js_1.TLRawWriter {
|
|
7
8
|
writeObject(object) {
|
|
8
9
|
if (Array.isArray(object)) {
|
|
@@ -13,7 +14,7 @@ class TLWriter extends _0_tl_raw_writer_js_1.TLRawWriter {
|
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
else {
|
|
16
|
-
this.write(object.serialize());
|
|
17
|
+
this.write(object[_1_tl_object_js_1.serialize]());
|
|
17
18
|
}
|
|
18
19
|
return this;
|
|
19
20
|
}
|
package/script/tl/5_message.js
CHANGED
|
@@ -40,7 +40,7 @@ function unpackUnencryptedMessage(buffer) {
|
|
|
40
40
|
}
|
|
41
41
|
exports.unpackUnencryptedMessage = unpackUnencryptedMessage;
|
|
42
42
|
async function encryptMessage(message, authKey, authKeyId, salt, sessionId) {
|
|
43
|
-
const encoded = message.body.serialize();
|
|
43
|
+
const encoded = message.body[_1_tl_object_js_1.serialize]();
|
|
44
44
|
const payloadWriter = new _0_tl_raw_writer_js_1.TLRawWriter();
|
|
45
45
|
payloadWriter.writeInt64(salt);
|
|
46
46
|
payloadWriter.writeInt64(sessionId);
|
package/types/mod.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare const utils: {
|
|
|
4
4
|
checkPassword: typeof checkPassword;
|
|
5
5
|
getRandomId: typeof getRandomId;
|
|
6
6
|
};
|
|
7
|
+
export { as } from "./tl/1_tl_object.js";
|
|
7
8
|
export * as types from "./tl/2_types.js";
|
|
8
9
|
export * as functions from "./tl/3_functions.js";
|
|
9
10
|
export * from "./tl/4_rpc_result.js";
|
|
@@ -16,6 +16,8 @@ export declare const id: unique symbol;
|
|
|
16
16
|
export declare const params: unique symbol;
|
|
17
17
|
export declare const paramDesc: unique symbol;
|
|
18
18
|
export declare const length: unique symbol;
|
|
19
|
+
export declare const serialize: unique symbol;
|
|
20
|
+
export declare const as: unique symbol;
|
|
19
21
|
export declare function isOptionalParam(ntype: string): boolean;
|
|
20
22
|
export declare function analyzeOptionalParam(ntype: string): {
|
|
21
23
|
flagField: string;
|
|
@@ -26,11 +28,12 @@ export declare abstract class TLObject {
|
|
|
26
28
|
protected abstract get [params](): Params;
|
|
27
29
|
protected static get [paramDesc](): ParamDesc;
|
|
28
30
|
get [length](): number;
|
|
29
|
-
serialize(): Uint8Array;
|
|
31
|
+
[serialize](): Uint8Array;
|
|
32
|
+
[as]<T extends TLObjectConstructor<InstanceType<T>>>(constructor: T): InstanceType<T>;
|
|
30
33
|
}
|
|
31
34
|
export type MaybeVectorTLObject = TLObject | Array<MaybeVectorTLObject | TLObject>;
|
|
32
35
|
export interface TLObjectConstructor<T = TLObject> {
|
|
33
|
-
new (params:
|
|
36
|
+
new (params: any): T;
|
|
34
37
|
[paramDesc]: ParamDesc;
|
|
35
38
|
}
|
|
36
39
|
export declare function isTLObjectConstructor(t: unknown): t is typeof TLObject;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|