@mtkruto/node 0.0.999 → 0.1.100

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 (85) hide show
  1. package/esm/0_deps.d.ts +1 -1
  2. package/esm/0_deps.js +1 -1
  3. package/esm/3_errors.d.ts +1531 -0
  4. package/esm/3_errors.js +1531 -0
  5. package/esm/4_constants.d.ts +1 -1
  6. package/esm/4_constants.js +1 -1
  7. package/esm/4_errors.d.ts +25 -0
  8. package/esm/4_errors.js +64 -0
  9. package/esm/client/2_client_plain.js +1 -1
  10. package/esm/client/4_client.d.ts +2 -1
  11. package/esm/client/4_client.js +24 -41
  12. package/esm/deps/deno.land/x/{tgcrypto@0.1.3 → tgcrypto@0.3.2}/mod.d.ts +2 -6
  13. package/esm/deps/deno.land/x/tgcrypto@0.3.2/mod.js +158 -0
  14. package/esm/deps/deno.land/x/tgcrypto@0.3.2/tgcrypto.d.ts +2 -0
  15. package/esm/deps/deno.land/x/tgcrypto@0.3.2/tgcrypto.js +308 -0
  16. package/esm/mod.d.ts +3 -2
  17. package/esm/mod.js +3 -2
  18. package/esm/tl/2_types.d.ts +1 -1
  19. package/esm/tl/2_types.js +1 -2
  20. package/esm/tl/3_functions.d.ts +1 -1
  21. package/esm/tl/3_functions.js +1 -2
  22. package/esm/transport/0_obfuscation.js +1 -1
  23. package/esm/transport/0_transport.js +2 -2
  24. package/esm/types/0__file_id.js +0 -1
  25. package/esm/types/1_bot_command_scope.d.ts +1 -1
  26. package/esm/types/1_bot_command_scope.js +1 -1
  27. package/esm/types/1_chat.d.ts +1 -1
  28. package/esm/types/1_chat.js +1 -1
  29. package/esm/types/1_sticker.d.ts +1 -1
  30. package/esm/types/1_sticker.js +1 -1
  31. package/esm/types/1_user.d.ts +1 -1
  32. package/esm/types/1_user.js +1 -1
  33. package/esm/types/2_inline_keyboard_button.d.ts +1 -1
  34. package/esm/types/3_message.d.ts +12 -12
  35. package/esm/types/3_message.js +12 -12
  36. package/esm/types/5_inline_query_result.d.ts +1 -1
  37. package/esm/types/5_inline_query_result.js +1 -1
  38. package/esm/utilities/0_crypto.d.ts +1 -2
  39. package/esm/utilities/0_crypto.js +5 -12
  40. package/package.json +1 -1
  41. package/script/0_deps.d.ts +1 -1
  42. package/script/0_deps.js +3 -4
  43. package/script/3_errors.d.ts +1531 -0
  44. package/script/3_errors.js +2053 -0
  45. package/script/4_constants.d.ts +1 -1
  46. package/script/4_constants.js +1 -1
  47. package/script/4_errors.d.ts +25 -0
  48. package/script/4_errors.js +88 -0
  49. package/script/client/2_client_plain.js +1 -1
  50. package/script/client/4_client.d.ts +2 -1
  51. package/script/client/4_client.js +24 -41
  52. package/script/deps/deno.land/x/{tgcrypto@0.1.3 → tgcrypto@0.3.2}/mod.d.ts +2 -6
  53. package/script/deps/deno.land/x/tgcrypto@0.3.2/mod.js +171 -0
  54. package/script/deps/deno.land/x/tgcrypto@0.3.2/tgcrypto.d.ts +2 -0
  55. package/script/deps/deno.land/x/tgcrypto@0.3.2/tgcrypto.js +310 -0
  56. package/script/mod.d.ts +3 -2
  57. package/script/mod.js +16 -3
  58. package/script/tl/2_types.d.ts +1 -1
  59. package/script/tl/2_types.js +0 -1
  60. package/script/tl/3_functions.d.ts +1 -1
  61. package/script/tl/3_functions.js +0 -1
  62. package/script/transport/0_obfuscation.js +1 -1
  63. package/script/transport/0_transport.js +2 -2
  64. package/script/types/0__file_id.js +0 -1
  65. package/script/types/1_bot_command_scope.d.ts +1 -1
  66. package/script/types/1_bot_command_scope.js +1 -1
  67. package/script/types/1_chat.d.ts +1 -1
  68. package/script/types/1_chat.js +1 -1
  69. package/script/types/1_sticker.d.ts +1 -1
  70. package/script/types/1_sticker.js +1 -1
  71. package/script/types/1_user.d.ts +1 -1
  72. package/script/types/1_user.js +1 -1
  73. package/script/types/2_inline_keyboard_button.d.ts +1 -1
  74. package/script/types/3_message.d.ts +12 -12
  75. package/script/types/3_message.js +12 -12
  76. package/script/types/5_inline_query_result.d.ts +1 -1
  77. package/script/types/5_inline_query_result.js +1 -1
  78. package/script/utilities/0_crypto.d.ts +1 -2
  79. package/script/utilities/0_crypto.js +4 -11
  80. package/esm/deps/deno.land/x/tgcrypto@0.1.3/mod.js +0 -68
  81. package/esm/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.d.ts +0 -2
  82. package/esm/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.js +0 -1078
  83. package/script/deps/deno.land/x/tgcrypto@0.1.3/mod.js +0 -82
  84. package/script/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.d.ts +0 -2
  85. package/script/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.js +0 -1080
@@ -1,27 +1,27 @@
1
1
  import { MaybePromise } from "../1_utilities.js";
2
2
  import { types } from "../2_tl.js";
3
- import { ForceReply } from "./0_force_reply.js";
4
- import { MessageEntity } from "./0_message_entity.js";
5
3
  import { Audio } from "./0_audio.js";
6
4
  import { Contact } from "./0_contact.js";
7
- import { Voice } from "./0_voice.js";
8
- import { Venue } from "./0_venue.js";
9
- import { Location } from "./0_location.js";
10
5
  import { Dice } from "./0_dice.js";
6
+ import { ForceReply } from "./0_force_reply.js";
7
+ import { Location } from "./0_location.js";
8
+ import { MessageEntity } from "./0_message_entity.js";
11
9
  import { ReplyKeyboardRemove } from "./0_reply_keyboard_remove.js";
10
+ import { Venue } from "./0_venue.js";
11
+ import { Voice } from "./0_voice.js";
12
12
  import { EntityGetter } from "./1__getters.js";
13
+ import { Animation } from "./1_animation.js";
13
14
  import { Chat } from "./1_chat.js";
14
- import { Photo } from "./1_photo.js";
15
15
  import { Document } from "./1_document.js";
16
- import { Video } from "./1_video.js";
17
- import { VideoNote } from "./1_video_note.js";
18
- import { Animation } from "./1_animation.js";
19
- import { User } from "./1_user.js";
16
+ import { Photo } from "./1_photo.js";
20
17
  import { Poll } from "./1_poll.js";
21
18
  import { Sticker, StickerSetNameGetter } from "./1_sticker.js";
22
- import { InlineKeyboardMarkup } from "./3_inline_keyboard_markup.js";
23
- import { ReplyKeyboardMarkup } from "./2_reply_keyboard_markup.js";
19
+ import { User } from "./1_user.js";
20
+ import { VideoNote } from "./1_video_note.js";
21
+ import { Video } from "./1_video.js";
24
22
  import { Game } from "./2_game.js";
23
+ import { ReplyKeyboardMarkup } from "./2_reply_keyboard_markup.js";
24
+ import { InlineKeyboardMarkup } from "./3_inline_keyboard_markup.js";
25
25
  /** This object represents a message. */
26
26
  export interface Message {
27
27
  /** Whether the message is outgoing */
@@ -3,27 +3,27 @@ import { cleanObject, UNREACHABLE } from "../1_utilities.js";
3
3
  import { as, types } from "../2_tl.js";
4
4
  import { ZERO_CHANNEL_ID } from "../4_constants.js";
5
5
  import { FileID, FileType, FileUniqueID, FileUniqueType } from "./0__file_id.js";
6
- import { constructForceReply } from "./0_force_reply.js";
7
- import { constructMessageEntity } from "./0_message_entity.js";
8
6
  import { constructAudio } from "./0_audio.js";
9
7
  import { constructContact } from "./0_contact.js";
10
- import { constructVoice } from "./0_voice.js";
11
- import { constructVenue } from "./0_venue.js";
12
- import { constructLocation } from "./0_location.js";
13
8
  import { constructDice } from "./0_dice.js";
9
+ import { constructForceReply } from "./0_force_reply.js";
10
+ import { constructLocation } from "./0_location.js";
11
+ import { constructMessageEntity } from "./0_message_entity.js";
14
12
  import { constructReplyKeyboardRemove } from "./0_reply_keyboard_remove.js";
13
+ import { constructVenue } from "./0_venue.js";
14
+ import { constructVoice } from "./0_voice.js";
15
+ import { constructAnimation } from "./1_animation.js";
15
16
  import { constructChat } from "./1_chat.js";
16
- import { constructPhoto } from "./1_photo.js";
17
17
  import { constructDocument } from "./1_document.js";
18
- import { constructVideo } from "./1_video.js";
19
- import { constructVideoNote } from "./1_video_note.js";
20
- import { constructAnimation } from "./1_animation.js";
21
- import { constructUser } from "./1_user.js";
18
+ import { constructPhoto } from "./1_photo.js";
22
19
  import { constructPoll } from "./1_poll.js";
23
20
  import { constructSticker } from "./1_sticker.js";
24
- import { constructInlineKeyboardMarkup } from "./3_inline_keyboard_markup.js";
25
- import { constructReplyKeyboardMarkup } from "./2_reply_keyboard_markup.js";
21
+ import { constructUser } from "./1_user.js";
22
+ import { constructVideoNote } from "./1_video_note.js";
23
+ import { constructVideo } from "./1_video.js";
26
24
  import { constructGame } from "./2_game.js";
25
+ import { constructReplyKeyboardMarkup } from "./2_reply_keyboard_markup.js";
26
+ import { constructInlineKeyboardMarkup } from "./3_inline_keyboard_markup.js";
27
27
  const d = debug("types/Message");
28
28
  async function getSender(message_, getEntity) {
29
29
  if (message_.fromId instanceof types.PeerUser) {
@@ -1,6 +1,7 @@
1
1
  import { types } from "../2_tl.js";
2
2
  import { MessageEntity } from "./0_message_entity.js";
3
3
  import { ParseMode } from "./0_parse_mode.js";
4
+ import { UsernameResolver } from "./1__getters.js";
4
5
  import { InlineQueryResultArticle } from "./4_inline_query_result_article.js";
5
6
  import { InlineQueryResultAudio } from "./4_inline_query_result_audio.js";
6
7
  import { InlineQueryResultCachedAudio } from "./4_inline_query_result_cached_audio.js";
@@ -21,7 +22,6 @@ import { InlineQueryResultPhoto } from "./4_inline_query_result_photo.js";
21
22
  import { InlineQueryResultVenue } from "./4_inline_query_result_venue.js";
22
23
  import { InlineQueryResultVideo } from "./4_inline_query_result_video.js";
23
24
  import { InlineQueryResultVoice } from "./4_inline_query_result_voice.js";
24
- import { UsernameResolver } from "./1__getters.js";
25
25
  export type InlineQueryResult = InlineQueryResultCachedAudio | InlineQueryResultCachedDocument | InlineQueryResultCachedGif | InlineQueryResultCachedMpeg4Gif | InlineQueryResultCachedPhoto | InlineQueryResultCachedSticker | InlineQueryResultCachedVideo | InlineQueryResultCachedVoice | InlineQueryResultArticle | InlineQueryResultAudio | InlineQueryResultContact | InlineQueryResultGame | InlineQueryResultDocument | InlineQueryResultGif | InlineQueryResultLocation | InlineQueryResultMpeg4Gif | InlineQueryResultPhoto | InlineQueryResultVenue | InlineQueryResultVideo | InlineQueryResultVoice;
26
26
  export declare function inlineQueryResultToTlObject(result_: InlineQueryResult, parseText: (text: string, params?: {
27
27
  parseMode?: ParseMode;
@@ -1,6 +1,6 @@
1
+ import { UNREACHABLE } from "../1_utilities.js";
1
2
  import { types } from "../2_tl.js";
2
3
  import { FileID } from "./0__file_id.js";
3
- import { UNREACHABLE } from "../1_utilities.js";
4
4
  import { replyMarkupToTlObject } from "./4_reply_markup.js";
5
5
  // deno-lint-ignore no-explicit-any
6
6
  export async function inlineQueryResultToTlObject(result_, parseText, usernameResolver) {
@@ -3,6 +3,5 @@ export declare class CTR {
3
3
  iv: Uint8Array;
4
4
  state: Uint8Array;
5
5
  constructor(key: Uint8Array, iv: Uint8Array);
6
- encrypt(data: Uint8Array): Uint8Array;
7
- decrypt(data: Uint8Array): Uint8Array;
6
+ call(data: Uint8Array): Uint8Array;
8
7
  }
@@ -1,4 +1,4 @@
1
- import { ctr256Decrypt, ctr256Encrypt } from "../0_deps.js";
1
+ import { ctr256 } from "../0_deps.js";
2
2
  export class CTR {
3
3
  constructor(key, iv) {
4
4
  Object.defineProperty(this, "key", {
@@ -20,16 +20,9 @@ export class CTR {
20
20
  value: new Uint8Array(1)
21
21
  });
22
22
  }
23
- encrypt(data) {
24
- const [encrypted, iv, state] = ctr256Encrypt(data, this.key, this.iv, this.state);
25
- this.iv = iv;
26
- this.state = state;
27
- return new Uint8Array(encrypted);
28
- }
29
- decrypt(data) {
30
- const [decrypted, iv, state] = ctr256Decrypt(data, this.key, this.iv, this.state);
31
- this.iv = iv;
32
- this.state = state;
33
- return new Uint8Array(decrypted);
23
+ call(data) {
24
+ const v = new Uint8Array(data); // TODO: don't copy
25
+ ctr256(v, this.key, this.iv, this.state);
26
+ return v;
34
27
  }
35
28
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "module": "./esm/mod.js",
3
3
  "main": "./script/mod.js",
4
4
  "name": "@mtkruto/node",
5
- "version": "0.0.999",
5
+ "version": "0.1.100",
6
6
  "description": "MTKruto for Node.js",
7
7
  "author": "Roj <rojvv@icloud.com>",
8
8
  "license": "LGPL-3.0-or-later",
@@ -1,5 +1,5 @@
1
1
  export * from "./deps/deno.land/std@0.201.0/assert/mod.js";
2
- export { ctr256Decrypt, ctr256Encrypt, factorize, ige256Decrypt, ige256Encrypt, init as initTgCrypto } from "./deps/deno.land/x/tgcrypto@0.1.3/mod.js";
2
+ export { ctr256, factorize, ige256Decrypt, ige256Encrypt, init as initTgCrypto } from "./deps/deno.land/x/tgcrypto@0.3.2/mod.js";
3
3
  export { gunzip, gzip } from "./deps/raw.githubusercontent.com/MTKruto/compress/main/gzip/gzip.js";
4
4
  export { Mutex, type MutexInterface } from "async-mutex";
5
5
  export { Parser } from "./deps/deno.land/x/html_parser@v0.1.3/src/mod.js";
package/script/0_deps.js CHANGED
@@ -14,11 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.base64Encode = exports.base64Decode = exports.debug = exports.Parser = exports.Mutex = exports.gzip = exports.gunzip = exports.initTgCrypto = exports.ige256Encrypt = exports.ige256Decrypt = exports.factorize = exports.ctr256Encrypt = exports.ctr256Decrypt = void 0;
17
+ exports.base64Encode = exports.base64Decode = exports.debug = exports.Parser = exports.Mutex = exports.gzip = exports.gunzip = exports.initTgCrypto = exports.ige256Encrypt = exports.ige256Decrypt = exports.factorize = exports.ctr256 = void 0;
18
18
  __exportStar(require("./deps/deno.land/std@0.201.0/assert/mod.js"), exports);
19
- var mod_js_1 = require("./deps/deno.land/x/tgcrypto@0.1.3/mod.js");
20
- Object.defineProperty(exports, "ctr256Decrypt", { enumerable: true, get: function () { return mod_js_1.ctr256Decrypt; } });
21
- Object.defineProperty(exports, "ctr256Encrypt", { enumerable: true, get: function () { return mod_js_1.ctr256Encrypt; } });
19
+ var mod_js_1 = require("./deps/deno.land/x/tgcrypto@0.3.2/mod.js");
20
+ Object.defineProperty(exports, "ctr256", { enumerable: true, get: function () { return mod_js_1.ctr256; } });
22
21
  Object.defineProperty(exports, "factorize", { enumerable: true, get: function () { return mod_js_1.factorize; } });
23
22
  Object.defineProperty(exports, "ige256Decrypt", { enumerable: true, get: function () { return mod_js_1.ige256Decrypt; } });
24
23
  Object.defineProperty(exports, "ige256Encrypt", { enumerable: true, get: function () { return mod_js_1.ige256Encrypt; } });