@mtkruto/node 0.0.820 → 0.0.822

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.
Files changed (148) hide show
  1. package/esm/_dnt.test_shims.d.ts +10 -0
  2. package/esm/client/client.d.ts +114 -0
  3. package/esm/client/client.js +126 -1
  4. package/esm/tl/0_tl_raw_reader_test.d.ts +1 -0
  5. package/esm/tl/0_tl_raw_writer_test.d.ts +1 -0
  6. package/esm/tl/1_tl_object_test.d.ts +1 -0
  7. package/{types → esm}/tl/2_types.d.ts +48 -48
  8. package/esm/tl/2_types.js +180 -180
  9. package/esm/tl/2_types_test.d.ts +1 -0
  10. package/esm/tl/3_deserialize_test.d.ts +1 -0
  11. package/{types → esm}/tl/3_functions.d.ts +13 -13
  12. package/esm/tl/3_functions.js +39 -39
  13. package/esm/tl/3_functions_test.d.ts +1 -0
  14. package/esm/utilities/0_bigint_test.d.ts +1 -0
  15. package/esm/utilities/0_buffer_test.d.ts +1 -0
  16. package/{types → esm}/utilities/1_password.d.ts +1 -1
  17. package/esm/utilities/1_password.js +2 -1
  18. package/esm/utilities/1_password_test.d.ts +1 -0
  19. package/package.json +5 -12
  20. package/script/_dnt.shims.d.ts +10 -0
  21. package/script/_dnt.test_shims.d.ts +10 -0
  22. package/script/client/client.d.ts +114 -0
  23. package/script/client/client.js +127 -2
  24. package/script/client/client_abstract.d.ts +16 -0
  25. package/script/client/client_plain.d.ts +9 -0
  26. package/script/connection/connection.d.ts +7 -0
  27. package/script/connection/connection_web_socket.d.ts +13 -0
  28. package/script/constants.d.ts +12 -0
  29. package/script/deps/deno.land/std@0.186.0/fmt/colors.d.ts +270 -0
  30. package/script/deps/deno.land/std@0.186.0/testing/_diff.d.ts +26 -0
  31. package/script/deps/deno.land/std@0.186.0/testing/_format.d.ts +1 -0
  32. package/script/deps/deno.land/std@0.186.0/testing/asserts.d.ts +284 -0
  33. package/script/deps/deno.land/x/crc32@v0.2.0/mod.d.ts +15 -0
  34. package/script/deps/deno.land/x/tgcrypto@0.1.3/mod.d.ts +47 -0
  35. package/script/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.d.ts +2 -0
  36. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/gzip/gzip.d.ts +16 -0
  37. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/utils/uint8.d.ts +1 -0
  38. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/deflate.d.ts +29 -0
  39. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/inflate.d.ts +23 -0
  40. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/mod.d.ts +2 -0
  41. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/adler32.d.ts +1 -0
  42. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/crc32.d.ts +2 -0
  43. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/deflate.d.ts +78 -0
  44. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/gzheader.d.ts +12 -0
  45. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inffast.d.ts +1 -0
  46. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inflate.d.ts +47 -0
  47. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inftrees.d.ts +1 -0
  48. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/messages.d.ts +12 -0
  49. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/status.d.ts +30 -0
  50. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/trees.d.ts +5 -0
  51. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/zstream.d.ts +14 -0
  52. package/script/deps.d.ts +4 -0
  53. package/script/mod.d.ts +24 -0
  54. package/script/session/session.d.ts +12 -0
  55. package/script/session/session_local_storage.d.ts +7 -0
  56. package/script/session/session_memory.d.ts +5 -0
  57. package/script/tl/0_tl_raw_reader.d.ts +13 -0
  58. package/script/tl/0_tl_raw_reader_test.d.ts +1 -0
  59. package/script/tl/0_tl_raw_writer.d.ts +13 -0
  60. package/script/tl/0_tl_raw_writer_test.d.ts +1 -0
  61. package/script/tl/1_tl_object.d.ts +40 -0
  62. package/script/tl/1_tl_object_test.d.ts +1 -0
  63. package/script/tl/2_types.d.ts +14815 -0
  64. package/script/tl/2_types.js +180 -180
  65. package/script/tl/2_types_test.d.ts +1 -0
  66. package/script/tl/3_deserialize.d.ts +3 -0
  67. package/script/tl/3_deserialize_test.d.ts +1 -0
  68. package/script/tl/3_functions.d.ts +6122 -0
  69. package/script/tl/3_functions.js +39 -39
  70. package/script/tl/3_functions_test.d.ts +1 -0
  71. package/script/tl/3_tl_reader.d.ts +6 -0
  72. package/script/tl/3_tl_writer.d.ts +5 -0
  73. package/script/tl/4_rpc_result.d.ts +8 -0
  74. package/script/tl/5_message.d.ts +11 -0
  75. package/script/tl/6_message_container.d.ts +9 -0
  76. package/script/transport/transport.d.ts +15 -0
  77. package/script/transport/transport_abridged.d.ts +11 -0
  78. package/script/transport/transport_intermediate.d.ts +11 -0
  79. package/script/transport/transport_provider.d.ts +17 -0
  80. package/script/types.d.ts +1 -0
  81. package/script/utilities/0_bigint.d.ts +5 -0
  82. package/script/utilities/0_bigint_test.d.ts +1 -0
  83. package/script/utilities/0_buffer.d.ts +2 -0
  84. package/script/utilities/0_buffer_test.d.ts +1 -0
  85. package/script/utilities/0_crypto.d.ts +8 -0
  86. package/script/utilities/0_hash.d.ts +2 -0
  87. package/script/utilities/1_auth.d.ts +1 -0
  88. package/script/utilities/1_message.d.ts +10 -0
  89. package/script/utilities/1_obfuscation.d.ts +6 -0
  90. package/script/utilities/1_password.d.ts +11 -0
  91. package/script/utilities/1_password.js +2 -1
  92. package/script/utilities/1_password_test.d.ts +1 -0
  93. package/types/client/client.d.ts +0 -50
  94. /package/{types → esm}/_dnt.shims.d.ts +0 -0
  95. /package/{types → esm}/client/client_abstract.d.ts +0 -0
  96. /package/{types → esm}/client/client_plain.d.ts +0 -0
  97. /package/{types → esm}/connection/connection.d.ts +0 -0
  98. /package/{types → esm}/connection/connection_web_socket.d.ts +0 -0
  99. /package/{types → esm}/constants.d.ts +0 -0
  100. /package/{types → esm}/deps/deno.land/std@0.186.0/fmt/colors.d.ts +0 -0
  101. /package/{types → esm}/deps/deno.land/std@0.186.0/testing/_diff.d.ts +0 -0
  102. /package/{types → esm}/deps/deno.land/std@0.186.0/testing/_format.d.ts +0 -0
  103. /package/{types → esm}/deps/deno.land/std@0.186.0/testing/asserts.d.ts +0 -0
  104. /package/{types → esm}/deps/deno.land/x/crc32@v0.2.0/mod.d.ts +0 -0
  105. /package/{types → esm}/deps/deno.land/x/tgcrypto@0.1.3/mod.d.ts +0 -0
  106. /package/{types → esm}/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.d.ts +0 -0
  107. /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/gzip/gzip.d.ts +0 -0
  108. /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/utils/uint8.d.ts +0 -0
  109. /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/deflate.d.ts +0 -0
  110. /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/inflate.d.ts +0 -0
  111. /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/mod.d.ts +0 -0
  112. /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/adler32.d.ts +0 -0
  113. /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/crc32.d.ts +0 -0
  114. /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/deflate.d.ts +0 -0
  115. /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/gzheader.d.ts +0 -0
  116. /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inffast.d.ts +0 -0
  117. /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inflate.d.ts +0 -0
  118. /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inftrees.d.ts +0 -0
  119. /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/messages.d.ts +0 -0
  120. /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/status.d.ts +0 -0
  121. /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/trees.d.ts +0 -0
  122. /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/zstream.d.ts +0 -0
  123. /package/{types → esm}/deps.d.ts +0 -0
  124. /package/{types → esm}/mod.d.ts +0 -0
  125. /package/{types → esm}/session/session.d.ts +0 -0
  126. /package/{types → esm}/session/session_local_storage.d.ts +0 -0
  127. /package/{types → esm}/session/session_memory.d.ts +0 -0
  128. /package/{types → esm}/tl/0_tl_raw_reader.d.ts +0 -0
  129. /package/{types → esm}/tl/0_tl_raw_writer.d.ts +0 -0
  130. /package/{types → esm}/tl/1_tl_object.d.ts +0 -0
  131. /package/{types → esm}/tl/3_deserialize.d.ts +0 -0
  132. /package/{types → esm}/tl/3_tl_reader.d.ts +0 -0
  133. /package/{types → esm}/tl/3_tl_writer.d.ts +0 -0
  134. /package/{types → esm}/tl/4_rpc_result.d.ts +0 -0
  135. /package/{types → esm}/tl/5_message.d.ts +0 -0
  136. /package/{types → esm}/tl/6_message_container.d.ts +0 -0
  137. /package/{types → esm}/transport/transport.d.ts +0 -0
  138. /package/{types → esm}/transport/transport_abridged.d.ts +0 -0
  139. /package/{types → esm}/transport/transport_intermediate.d.ts +0 -0
  140. /package/{types → esm}/transport/transport_provider.d.ts +0 -0
  141. /package/{types → esm}/types.d.ts +0 -0
  142. /package/{types → esm}/utilities/0_bigint.d.ts +0 -0
  143. /package/{types → esm}/utilities/0_buffer.d.ts +0 -0
  144. /package/{types → esm}/utilities/0_crypto.d.ts +0 -0
  145. /package/{types → esm}/utilities/0_hash.d.ts +0 -0
  146. /package/{types → esm}/utilities/1_auth.d.ts +0 -0
  147. /package/{types → esm}/utilities/1_message.d.ts +0 -0
  148. /package/{types → esm}/utilities/1_obfuscation.d.ts +0 -0
@@ -1674,9 +1674,9 @@ class AccountUpdateProfile extends Function {
1674
1674
  writable: true,
1675
1675
  value: void 0
1676
1676
  });
1677
- this.firstName = params.firstName;
1678
- this.lastName = params.lastName;
1679
- this.about = params.about;
1677
+ this.firstName = params?.firstName;
1678
+ this.lastName = params?.lastName;
1679
+ this.about = params?.about;
1680
1680
  }
1681
1681
  }
1682
1682
  exports.AccountUpdateProfile = AccountUpdateProfile;
@@ -2779,13 +2779,13 @@ class AccountInitTakeoutSession extends Function {
2779
2779
  writable: true,
2780
2780
  value: void 0
2781
2781
  });
2782
- this.contacts = params.contacts;
2783
- this.messageUsers = params.messageUsers;
2784
- this.messageChats = params.messageChats;
2785
- this.messageMegagroups = params.messageMegagroups;
2786
- this.messageChannels = params.messageChannels;
2787
- this.files = params.files;
2788
- this.fileMaxSize = params.fileMaxSize;
2782
+ this.contacts = params?.contacts;
2783
+ this.messageUsers = params?.messageUsers;
2784
+ this.messageChats = params?.messageChats;
2785
+ this.messageMegagroups = params?.messageMegagroups;
2786
+ this.messageChannels = params?.messageChannels;
2787
+ this.files = params?.files;
2788
+ this.fileMaxSize = params?.fileMaxSize;
2789
2789
  }
2790
2790
  }
2791
2791
  exports.AccountInitTakeoutSession = AccountInitTakeoutSession;
@@ -2813,7 +2813,7 @@ class AccountFinishTakeoutSession extends Function {
2813
2813
  writable: true,
2814
2814
  value: void 0
2815
2815
  });
2816
- this.success = params.success;
2816
+ this.success = params?.success;
2817
2817
  }
2818
2818
  }
2819
2819
  exports.AccountFinishTakeoutSession = AccountFinishTakeoutSession;
@@ -2946,8 +2946,8 @@ class AccountGetNotifyExceptions extends Function {
2946
2946
  writable: true,
2947
2947
  value: void 0
2948
2948
  });
2949
- this.compareSound = params.compareSound;
2950
- this.peer = params.peer;
2949
+ this.compareSound = params?.compareSound;
2950
+ this.peer = params?.peer;
2951
2951
  }
2952
2952
  }
2953
2953
  exports.AccountGetNotifyExceptions = AccountGetNotifyExceptions;
@@ -3453,10 +3453,10 @@ class AccountInstallTheme extends Function {
3453
3453
  writable: true,
3454
3454
  value: void 0
3455
3455
  });
3456
- this.dark = params.dark;
3457
- this.theme = params.theme;
3458
- this.format = params.format;
3459
- this.baseTheme = params.baseTheme;
3456
+ this.dark = params?.dark;
3457
+ this.theme = params?.theme;
3458
+ this.format = params?.format;
3459
+ this.baseTheme = params?.baseTheme;
3460
3460
  }
3461
3461
  }
3462
3462
  exports.AccountInstallTheme = AccountInstallTheme;
@@ -3554,7 +3554,7 @@ class AccountSetContentSettings extends Function {
3554
3554
  writable: true,
3555
3555
  value: void 0
3556
3556
  });
3557
- this.sensitiveEnabled = params.sensitiveEnabled;
3557
+ this.sensitiveEnabled = params?.sensitiveEnabled;
3558
3558
  }
3559
3559
  }
3560
3560
  exports.AccountSetContentSettings = AccountSetContentSettings;
@@ -8520,7 +8520,7 @@ class MessagesClearRecentStickers extends Function {
8520
8520
  writable: true,
8521
8521
  value: void 0
8522
8522
  });
8523
- this.attached = params.attached;
8523
+ this.attached = params?.attached;
8524
8524
  }
8525
8525
  }
8526
8526
  exports.MessagesClearRecentStickers = MessagesClearRecentStickers;
@@ -10183,10 +10183,10 @@ class MessagesRequestURLAuth extends Function {
10183
10183
  writable: true,
10184
10184
  value: void 0
10185
10185
  });
10186
- this.peer = params.peer;
10187
- this.msgId = params.msgId;
10188
- this.buttonId = params.buttonId;
10189
- this.url = params.url;
10186
+ this.peer = params?.peer;
10187
+ this.msgId = params?.msgId;
10188
+ this.buttonId = params?.buttonId;
10189
+ this.url = params?.url;
10190
10190
  }
10191
10191
  }
10192
10192
  exports.MessagesRequestURLAuth = MessagesRequestURLAuth;
@@ -10246,11 +10246,11 @@ class MessagesAcceptURLAuth extends Function {
10246
10246
  writable: true,
10247
10247
  value: void 0
10248
10248
  });
10249
- this.writeAllowed = params.writeAllowed;
10250
- this.peer = params.peer;
10251
- this.msgId = params.msgId;
10252
- this.buttonId = params.buttonId;
10253
- this.url = params.url;
10249
+ this.writeAllowed = params?.writeAllowed;
10250
+ this.peer = params?.peer;
10251
+ this.msgId = params?.msgId;
10252
+ this.buttonId = params?.buttonId;
10253
+ this.url = params?.url;
10254
10254
  }
10255
10255
  }
10256
10256
  exports.MessagesAcceptURLAuth = MessagesAcceptURLAuth;
@@ -10940,7 +10940,7 @@ class MessagesDeletePhoneCallHistory extends Function {
10940
10940
  writable: true,
10941
10941
  value: void 0
10942
10942
  });
10943
- this.revoke = params.revoke;
10943
+ this.revoke = params?.revoke;
10944
10944
  }
10945
10945
  }
10946
10946
  exports.MessagesDeletePhoneCallHistory = MessagesDeletePhoneCallHistory;
@@ -13768,12 +13768,12 @@ class PhotosUploadProfilePhoto extends Function {
13768
13768
  writable: true,
13769
13769
  value: void 0
13770
13770
  });
13771
- this.fallback = params.fallback;
13772
- this.bot = params.bot;
13773
- this.file = params.file;
13774
- this.video = params.video;
13775
- this.videoStartTs = params.videoStartTs;
13776
- this.videoEmojiMarkup = params.videoEmojiMarkup;
13771
+ this.fallback = params?.fallback;
13772
+ this.bot = params?.bot;
13773
+ this.file = params?.file;
13774
+ this.video = params?.video;
13775
+ this.videoStartTs = params?.videoStartTs;
13776
+ this.videoEmojiMarkup = params?.videoEmojiMarkup;
13777
13777
  }
13778
13778
  }
13779
13779
  exports.PhotosUploadProfilePhoto = PhotosUploadProfilePhoto;
@@ -15662,8 +15662,8 @@ class ChannelsGetAdminedPublicChannels extends Function {
15662
15662
  writable: true,
15663
15663
  value: void 0
15664
15664
  });
15665
- this.byLocation = params.byLocation;
15666
- this.checkLimit = params.checkLimit;
15665
+ this.byLocation = params?.byLocation;
15666
+ this.checkLimit = params?.checkLimit;
15667
15667
  }
15668
15668
  }
15669
15669
  exports.ChannelsGetAdminedPublicChannels = ChannelsGetAdminedPublicChannels;
@@ -17715,8 +17715,8 @@ class PaymentsClearSavedInfo extends Function {
17715
17715
  writable: true,
17716
17716
  value: void 0
17717
17717
  });
17718
- this.credentials = params.credentials;
17719
- this.info = params.info;
17718
+ this.credentials = params?.credentials;
17719
+ this.info = params?.info;
17720
17720
  }
17721
17721
  }
17722
17722
  exports.PaymentsClearSavedInfo = PaymentsClearSavedInfo;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { TLRawReader } from "./0_tl_raw_reader.js";
2
+ import { TLObject } from "./1_tl_object.js";
3
+ export type ReadObject = TLObject | Array<ReadObject | TLObject>;
4
+ export declare class TLReader extends TLRawReader {
5
+ readObject(id?: number): ReadObject;
6
+ }
@@ -0,0 +1,5 @@
1
+ import { TLRawWriter } from "./0_tl_raw_writer.js";
2
+ import { MaybeVectorTLObject } from "./1_tl_object.js";
3
+ export declare class TLWriter extends TLRawWriter {
4
+ writeObject(object: MaybeVectorTLObject): this;
5
+ }
@@ -0,0 +1,8 @@
1
+ import { id, MaybeVectorTLObject } from "./1_tl_object.js";
2
+ export declare class RPCResult {
3
+ readonly messageId: bigint;
4
+ readonly result: MaybeVectorTLObject;
5
+ static get [id](): number;
6
+ constructor(messageId: bigint, result: MaybeVectorTLObject);
7
+ static deserialize(buffer: Uint8Array): RPCResult;
8
+ }
@@ -0,0 +1,11 @@
1
+ import { MaybeVectorTLObject } from "./1_tl_object.js";
2
+ import { TLReader } from "./3_tl_reader.js";
3
+ import { RPCResult } from "./4_rpc_result.js";
4
+ export declare class Message {
5
+ readonly id: bigint;
6
+ readonly seqNo: number;
7
+ readonly body: MaybeVectorTLObject | RPCResult;
8
+ constructor(id: bigint, seqNo: number, body: MaybeVectorTLObject | RPCResult);
9
+ serialize(): Uint8Array;
10
+ static deserialize(reader: TLReader): Message;
11
+ }
@@ -0,0 +1,9 @@
1
+ import { id } from "./1_tl_object.js";
2
+ import { Message } from "./5_message.js";
3
+ export declare class MessageContainer {
4
+ messages: Message[];
5
+ static get [id](): number;
6
+ constructor(messages: Message[]);
7
+ serialize(): Uint8Array;
8
+ static deserialize(buffer: Uint8Array): MessageContainer;
9
+ }
@@ -0,0 +1,15 @@
1
+ import { MaybePromise } from "../types.js";
2
+ import { CTR } from "../utilities/0_crypto.js";
3
+ export declare abstract class Transport {
4
+ protected initialized: boolean;
5
+ protected obfuscationParameters: {
6
+ encryptionCTR: CTR;
7
+ decryptionCTR: CTR;
8
+ } | null;
9
+ protected encrypt(buffer: Uint8Array): Uint8Array;
10
+ protected decrypt(buffer: Uint8Array): Uint8Array;
11
+ abstract initialize(): MaybePromise<void>;
12
+ abstract receive(): MaybePromise<Uint8Array>;
13
+ abstract send(buffer: Uint8Array): MaybePromise<void>;
14
+ abstract deinitialize(): MaybePromise<void>;
15
+ }
@@ -0,0 +1,11 @@
1
+ import { Connection } from "../connection/connection.js";
2
+ import { Transport } from "./transport.js";
3
+ export declare class TransportAbridged extends Transport implements Transport {
4
+ private readonly connection;
5
+ private readonly obfuscated;
6
+ constructor(connection: Connection, obfuscated?: boolean);
7
+ initialize(): Promise<void>;
8
+ receive(): Promise<Uint8Array>;
9
+ send(buffer: Uint8Array): Promise<void>;
10
+ deinitialize(): void;
11
+ }
@@ -0,0 +1,11 @@
1
+ import { Connection } from "../connection/connection.js";
2
+ import { Transport } from "./transport.js";
3
+ export declare class TransportIntermediate extends Transport implements Transport {
4
+ private readonly connection;
5
+ private readonly obfuscated;
6
+ constructor(connection: Connection, obfuscated?: boolean);
7
+ initialize(): Promise<void>;
8
+ receive(): Promise<Uint8Array>;
9
+ send(buffer: Uint8Array): Promise<void>;
10
+ deinitialize(): void;
11
+ }
@@ -0,0 +1,17 @@
1
+ import { Connection } from "../connection/connection.js";
2
+ import { Transport } from "./transport.js";
3
+ export type DC = "1" | "2" | "3" | "4" | "5" | "1-test" | "2-test" | "3-test";
4
+ export interface TransportProviderParams {
5
+ dc?: DC;
6
+ cdn: boolean;
7
+ }
8
+ export type TransportProvider = (params: TransportProviderParams) => {
9
+ connection: Connection;
10
+ transport: Transport;
11
+ dcId: number;
12
+ };
13
+ export interface TransportProviderCreatorParams {
14
+ initialDc: DC;
15
+ }
16
+ export type TransportProviderCreator = (params: TransportProviderCreatorParams) => TransportProvider;
17
+ export declare const defaultTransportProvider: TransportProviderCreator;
@@ -0,0 +1 @@
1
+ export type MaybePromise<T> = T | Promise<T>;
@@ -0,0 +1,5 @@
1
+ export declare function modExp(a: bigint, b: bigint, n: bigint): bigint;
2
+ export declare function mod(n: bigint, m: bigint): bigint;
3
+ export declare function bigIntFromBuffer(buffer: Uint8Array, little?: boolean, signed?: boolean): bigint;
4
+ export declare function getRandomBigInt(byteLength: number, little?: boolean, signed?: boolean): bigint;
5
+ export declare function getRandomId(): bigint;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function concat(...buffers: [Uint8Array, Uint8Array, ...Uint8Array[]]): Uint8Array;
2
+ export declare function bufferFromBigInt(bigIntVar: bigint | number, bytesNumber: number, little?: boolean, signed?: boolean): Uint8Array;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export declare class CTR {
2
+ readonly key: Uint8Array;
3
+ iv: Uint8Array;
4
+ state: Uint8Array;
5
+ constructor(key: Uint8Array, iv: Uint8Array);
6
+ encrypt(data: Uint8Array): Uint8Array;
7
+ decrypt(data: Uint8Array): Uint8Array;
8
+ }
@@ -0,0 +1,2 @@
1
+ export declare function sha256(payload: Uint8Array): Promise<Uint8Array>;
2
+ export declare function sha1(payload: Uint8Array): Promise<Uint8Array>;
@@ -0,0 +1 @@
1
+ export declare function rsaPad(data: Uint8Array, [serverKey, exponent]: [bigint, bigint]): Promise<Uint8Array>;
@@ -0,0 +1,10 @@
1
+ import { Message } from "../tl/5_message.js";
2
+ import { MessageContainer } from "../tl/6_message_container.js";
3
+ export declare function getMessageId(): bigint;
4
+ export declare function packUnencryptedMessage(data: Uint8Array): Uint8Array;
5
+ export declare function unpackUnencryptedMessage(buffer: Uint8Array): {
6
+ messageId: bigint;
7
+ message: Uint8Array;
8
+ };
9
+ export declare function encryptMessage(message: Message, authKey: Uint8Array, authKeyId: bigint, salt: bigint, sessionId: bigint): Promise<Uint8Array>;
10
+ export declare function decryptMessage(buffer: Uint8Array, authKey: Uint8Array, authKeyId: bigint, _sessionId: bigint): Promise<Message | MessageContainer>;
@@ -0,0 +1,6 @@
1
+ import { Connection } from "../connection/connection.js";
2
+ import { CTR } from "./0_crypto.js";
3
+ export declare function getObfuscationParameters(protocol: number, connection: Connection): Promise<{
4
+ encryptionCTR: CTR;
5
+ decryptionCTR: CTR;
6
+ }>;
@@ -0,0 +1,11 @@
1
+ import * as types from "../tl/2_types.js";
2
+ import { sha256 } from "./0_hash.js";
3
+ export declare function isSafePrime(primeBytes: Uint8Array, g: number): boolean;
4
+ export declare const h: typeof sha256;
5
+ export declare const sh: (data: Uint8Array, salt: Uint8Array) => Promise<Uint8Array>;
6
+ export declare const ph1: (password: Uint8Array, salt1: Uint8Array, salt2: Uint8Array) => Promise<Uint8Array>;
7
+ export declare function pbkdf2(password: Uint8Array, salt: Uint8Array, iterations: number): Promise<Uint8Array>;
8
+ export declare const ph2: (password: Uint8Array, salt1: Uint8Array, salt2: Uint8Array) => Promise<Uint8Array>;
9
+ export declare function isGoodModExpFirst(modexp: bigint, prime: bigint): boolean;
10
+ export declare function pad(bigint: number | bigint | Uint8Array): Uint8Array;
11
+ export declare function checkPassword(password_: string, ap: types.AccountPassword): Promise<types.InputCheckPasswordSRP>;
@@ -102,7 +102,8 @@ function pad(bigint) {
102
102
  }
103
103
  }
104
104
  exports.pad = pad;
105
- async function checkPassword(password, ap) {
105
+ async function checkPassword(password_, ap) {
106
+ const password = new TextEncoder().encode(password_);
106
107
  const algo = ap.currentAlgo;
107
108
  if (!(algo instanceof
108
109
  types.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow)) {
@@ -0,0 +1 @@
1
+ export {};
@@ -1,50 +0,0 @@
1
- import { MaybePromise } from "../types.js";
2
- import * as types from "../tl/2_types.js";
3
- import * as functions from "../tl/3_functions.js";
4
- import { ClientAbstract } from "./client_abstract.js";
5
- import { Session } from "../session/session.js";
6
- import { DC, TransportProvider } from "../transport/transport_provider.js";
7
- export interface AuthorizeUserParams<S = string, N = {
8
- first: S;
9
- last: S;
10
- }> {
11
- phone: S | (() => MaybePromise<S>);
12
- code: S | (() => MaybePromise<S>);
13
- password: S | (() => MaybePromise<S>);
14
- names: N | (() => MaybePromise<N>);
15
- }
16
- export type UpdatesHandler = null | ((client: Client, update: types.Updates) => MaybePromise<void>);
17
- export declare class Client extends ClientAbstract {
18
- readonly session: Session;
19
- readonly apiId: number;
20
- readonly apiHash: string;
21
- private sessionId;
22
- private state;
23
- private promises;
24
- private toAcknowledge;
25
- updatesHandler: UpdatesHandler;
26
- readonly appVersion: string;
27
- readonly deviceModel: string;
28
- readonly langCode: string;
29
- readonly langPack: string;
30
- readonly systemLangCode: string;
31
- readonly systemVersion: string;
32
- constructor(session?: Session, apiId?: number, apiHash?: string, params?: {
33
- transportProvider?: TransportProvider;
34
- appVersion?: string;
35
- deviceModel?: string;
36
- langCode?: string;
37
- langPack?: string;
38
- systemLangCode?: string;
39
- systemVersion?: string;
40
- });
41
- private shouldLoadSession;
42
- setDc(dc: DC): void;
43
- connect(): Promise<void>;
44
- authorize(params: string | types.AuthExportedAuthorization | AuthorizeUserParams): Promise<void>;
45
- private receiveLoop;
46
- private pingLoop;
47
- invoke<T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T): Promise<T extends functions.Function<unknown> ? T["__R"] : void>;
48
- invoke<T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T, noWait: true): Promise<void>;
49
- send<T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T): Promise<void>;
50
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes