@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
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.constructSticker = void 0;
4
4
  const _2_tl_js_1 = require("../2_tl.js");
5
- const _0_thumbnail_js_1 = require("./0_thumbnail.js");
6
5
  const _0_mask_position_js_1 = require("./0_mask_position.js");
6
+ const _0_thumbnail_js_1 = require("./0_thumbnail.js");
7
7
  async function constructSticker(document, fileId, fileUniqueId, getStickerSetName) {
8
8
  const stickerAttribute = document.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeSticker);
9
9
  const imageSizeAttribute = document.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeImageSize);
@@ -1,6 +1,6 @@
1
1
  import { types } from "../2_tl.js";
2
- import { Color } from "./0_color.js";
3
2
  import { ChatPhoto } from "./0_chat_photo.js";
3
+ import { Color } from "./0_color.js";
4
4
  /** This object represents a Telegram user or bot. */
5
5
  export interface User {
6
6
  /** Unique identifier for this user or bot */
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.constructUser = void 0;
4
4
  const _1_utilities_js_1 = require("../1_utilities.js");
5
5
  const _2_tl_js_1 = require("../2_tl.js");
6
- const _0_color_js_1 = require("./0_color.js");
7
6
  const _0_chat_photo_js_1 = require("./0_chat_photo.js");
7
+ const _0_color_js_1 = require("./0_color.js");
8
8
  function constructUser(user_) {
9
9
  const id = Number(user_.id);
10
10
  const user = {
@@ -1,6 +1,6 @@
1
1
  import { types } from "../2_tl.js";
2
- import { WebAppInfo } from "./0_web_app_info.js";
3
2
  import { LoginUrl } from "./0_login_url.js";
3
+ import { WebAppInfo } from "./0_web_app_info.js";
4
4
  import { UsernameResolver } from "./1__getters.js";
5
5
  export declare namespace InlineKeyboardButton {
6
6
  interface Base {
@@ -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 */
@@ -6,27 +6,27 @@ const _1_utilities_js_1 = require("../1_utilities.js");
6
6
  const _2_tl_js_1 = require("../2_tl.js");
7
7
  const _4_constants_js_1 = require("../4_constants.js");
8
8
  const _0__file_id_js_1 = require("./0__file_id.js");
9
- const _0_force_reply_js_1 = require("./0_force_reply.js");
10
- const _0_message_entity_js_1 = require("./0_message_entity.js");
11
9
  const _0_audio_js_1 = require("./0_audio.js");
12
10
  const _0_contact_js_1 = require("./0_contact.js");
13
- const _0_voice_js_1 = require("./0_voice.js");
14
- const _0_venue_js_1 = require("./0_venue.js");
15
- const _0_location_js_1 = require("./0_location.js");
16
11
  const _0_dice_js_1 = require("./0_dice.js");
12
+ const _0_force_reply_js_1 = require("./0_force_reply.js");
13
+ const _0_location_js_1 = require("./0_location.js");
14
+ const _0_message_entity_js_1 = require("./0_message_entity.js");
17
15
  const _0_reply_keyboard_remove_js_1 = require("./0_reply_keyboard_remove.js");
16
+ const _0_venue_js_1 = require("./0_venue.js");
17
+ const _0_voice_js_1 = require("./0_voice.js");
18
+ const _1_animation_js_1 = require("./1_animation.js");
18
19
  const _1_chat_js_1 = require("./1_chat.js");
19
- const _1_photo_js_1 = require("./1_photo.js");
20
20
  const _1_document_js_1 = require("./1_document.js");
21
- const _1_video_js_1 = require("./1_video.js");
22
- const _1_video_note_js_1 = require("./1_video_note.js");
23
- const _1_animation_js_1 = require("./1_animation.js");
24
- const _1_user_js_1 = require("./1_user.js");
21
+ const _1_photo_js_1 = require("./1_photo.js");
25
22
  const _1_poll_js_1 = require("./1_poll.js");
26
23
  const _1_sticker_js_1 = require("./1_sticker.js");
27
- const _3_inline_keyboard_markup_js_1 = require("./3_inline_keyboard_markup.js");
28
- const _2_reply_keyboard_markup_js_1 = require("./2_reply_keyboard_markup.js");
24
+ const _1_user_js_1 = require("./1_user.js");
25
+ const _1_video_note_js_1 = require("./1_video_note.js");
26
+ const _1_video_js_1 = require("./1_video.js");
29
27
  const _2_game_js_1 = require("./2_game.js");
28
+ const _2_reply_keyboard_markup_js_1 = require("./2_reply_keyboard_markup.js");
29
+ const _3_inline_keyboard_markup_js_1 = require("./3_inline_keyboard_markup.js");
30
30
  const d = (0, _0_deps_js_1.debug)("types/Message");
31
31
  async function getSender(message_, getEntity) {
32
32
  if (message_.fromId instanceof _2_tl_js_1.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,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.inlineQueryResultToTlObject = void 0;
4
+ const _1_utilities_js_1 = require("../1_utilities.js");
4
5
  const _2_tl_js_1 = require("../2_tl.js");
5
6
  const _0__file_id_js_1 = require("./0__file_id.js");
6
- const _1_utilities_js_1 = require("../1_utilities.js");
7
7
  const _4_reply_markup_js_1 = require("./4_reply_markup.js");
8
8
  // deno-lint-ignore no-explicit-any
9
9
  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
  }
@@ -23,17 +23,10 @@ class CTR {
23
23
  value: new Uint8Array(1)
24
24
  });
25
25
  }
26
- encrypt(data) {
27
- const [encrypted, iv, state] = (0, _0_deps_js_1.ctr256Encrypt)(data, this.key, this.iv, this.state);
28
- this.iv = iv;
29
- this.state = state;
30
- return new Uint8Array(encrypted);
31
- }
32
- decrypt(data) {
33
- const [decrypted, iv, state] = (0, _0_deps_js_1.ctr256Decrypt)(data, this.key, this.iv, this.state);
34
- this.iv = iv;
35
- this.state = state;
36
- return new Uint8Array(decrypted);
26
+ call(data) {
27
+ const v = new Uint8Array(data); // TODO: don't copy
28
+ (0, _0_deps_js_1.ctr256)(v, this.key, this.iv, this.state);
29
+ return v;
37
30
  }
38
31
  }
39
32
  exports.CTR = CTR;
@@ -1,68 +0,0 @@
1
- import { default as init_ } from "./tgcrypto.js";
2
- // deno-lint-ignore no-explicit-any
3
- let module_;
4
- const promise = init_().then((v) => module_ = v);
5
- export async function init() {
6
- await promise;
7
- }
8
- /**
9
- * Performs IGE-256 encryption.
10
- *
11
- * @param data The unencrypted data, larger than a byte, divisible by 16
12
- * @param key 32-byte encryption key
13
- * @param iv 32-byte initialization vector
14
- */
15
- export function ige256Encrypt(data, key, iv) {
16
- return module_.ige256Encrypt(data, key, iv);
17
- }
18
- /**
19
- * Performs IGE-256 decryption.
20
- *
21
- * @param data The encrypted data, larger than a byte, divisible by 16
22
- * @param key 32-byte encryption key
23
- * @param iv 32-byte initialization vector
24
- */
25
- export function ige256Decrypt(data, key, iv) {
26
- return module_.ige256Decrypt(data, key, iv);
27
- }
28
- /**
29
- * Performs CTR-256 encryption.
30
- *
31
- * @param data The data, larger than a byte
32
- * @param key 32-byte encryption key
33
- * @param iv 16-byte initialization vector
34
- * @param state 1-byte state
35
- */
36
- export function ctr256Encrypt(data, key, iv, state) {
37
- return module_.ctr256Encrypt(data, key, iv, state);
38
- }
39
- /**
40
- * Alias of `ctr256Encrypt`
41
- */
42
- export function ctr256Decrypt(data, key, iv, state) {
43
- return module_.ctr256Decrypt(data, key, iv, state);
44
- }
45
- /**
46
- * Performs CBC-256 encryption.
47
- *
48
- * @param data The unencrypted data, larger than a byte, divisible by 16
49
- * @param key 32-byte encryption key
50
- * @param iv 16-byte initialization vector
51
- */
52
- export function cbc256Encrypt(data, key, iv) {
53
- return module_.cbc256Encrypt(data, key, iv);
54
- }
55
- /**
56
- * Performs CBC-256 decryption.
57
- *
58
- * @param data The encrypted data, larger than a byte, divisible by 16
59
- * @param key 32-byte encryption key
60
- * @param iv 16-byte initialization vector
61
- */
62
- export function cbc256Decrypt(data, key, iv) {
63
- return module_.cbc256Decrypt(data, key, iv);
64
- }
65
- export function factorize(pq) {
66
- const vector = module_.factorize(pq);
67
- return [vector.get(0), vector.get(1)];
68
- }
@@ -1,2 +0,0 @@
1
- export default Module;
2
- declare function Module(Module?: {}): any;