@mtkruto/node 0.1.201 → 0.1.300

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 (137) hide show
  1. package/esm/0_deps.d.ts +1 -1
  2. package/esm/0_deps.js +2 -1
  3. package/esm/1_utilities.d.ts +1 -1
  4. package/esm/1_utilities.js +1 -1
  5. package/esm/4_errors.js +3 -3
  6. package/esm/client/0_markdown.js +5 -5
  7. package/esm/client/0_utilities.d.ts +6 -0
  8. package/esm/client/0_utilities.js +35 -4
  9. package/esm/client/1_account_manager.js +4 -4
  10. package/esm/client/1_client_encrypted.js +4 -4
  11. package/esm/client/1_client_plain.js +3 -3
  12. package/esm/client/1_file_manager.js +6 -5
  13. package/esm/client/1_reaction_manager.js +2 -2
  14. package/esm/client/1_update_manager.js +9 -8
  15. package/esm/client/2_message_manager.js +47 -24
  16. package/esm/client/3_callback_query_manager.js +2 -0
  17. package/esm/client/3_chat_list_manager.js +13 -12
  18. package/esm/client/3_inline_query_manager.js +4 -2
  19. package/esm/client/3_story_manager.js +7 -5
  20. package/esm/client/4_client.js +14 -13
  21. package/esm/connection/1_connection_web_socket.js +3 -2
  22. package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.d.ts +0 -1
  23. package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +0 -11
  24. package/esm/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +308 -0
  25. package/esm/mod.d.ts +1 -1
  26. package/esm/mod.js +1 -1
  27. package/esm/storage/0_storage.js +6 -5
  28. package/esm/storage/1_utilities.d.ts +0 -1
  29. package/esm/storage/1_utilities.js +2 -3
  30. package/esm/storage/2_storage_local_storage.js +1 -4
  31. package/esm/storage/2_storage_session_storage.js +1 -4
  32. package/esm/tl/3_utilities.js +5 -4
  33. package/esm/transport/2_transport_provider.js +4 -4
  34. package/esm/types/0_message_entity.js +3 -3
  35. package/esm/types/0_message_search_filter.js +2 -2
  36. package/esm/types/0_reaction.js +2 -2
  37. package/esm/types/1_bot_command_scope.js +3 -3
  38. package/esm/types/1_chat_p.js +3 -2
  39. package/esm/types/1_keyboard_button.js +3 -3
  40. package/esm/types/1_message_reaction.js +2 -2
  41. package/esm/types/1_story_privacy.js +3 -3
  42. package/esm/types/2_chat_member.js +6 -5
  43. package/esm/types/2_chosen_inline_result.js +3 -2
  44. package/esm/types/2_inactive_chat.js +3 -2
  45. package/esm/types/2_inline_keyboard_button.js +3 -3
  46. package/esm/types/2_inline_query.js +3 -3
  47. package/esm/types/2_invite_link.js +3 -2
  48. package/esm/types/2_story_content.js +5 -5
  49. package/esm/types/2_story_interactive_area.js +5 -5
  50. package/esm/types/3_chat_member_updated.js +4 -3
  51. package/esm/types/3_reply_markup.js +4 -3
  52. package/esm/types/3_story.js +3 -2
  53. package/esm/types/4_inline_query_result.js +5 -5
  54. package/esm/types/4_message.js +17 -16
  55. package/esm/types/5_callback_query.js +4 -3
  56. package/esm/types/5_chat.js +8 -7
  57. package/esm/types/_file_id.js +9 -8
  58. package/esm/utilities/0_bigint.d.ts +1 -0
  59. package/esm/utilities/0_bigint.js +25 -0
  60. package/esm/utilities/0_logger.d.ts +8 -0
  61. package/esm/utilities/0_logger.js +9 -5
  62. package/esm/utilities/1_math.d.ts +1 -0
  63. package/esm/utilities/1_math.js +51 -0
  64. package/esm/utilities/1_misc.js +2 -2
  65. package/package.json +1 -1
  66. package/script/0_deps.d.ts +1 -1
  67. package/script/0_deps.js +3 -3
  68. package/script/1_utilities.d.ts +1 -1
  69. package/script/1_utilities.js +1 -1
  70. package/script/4_errors.js +3 -3
  71. package/script/client/0_markdown.js +5 -5
  72. package/script/client/0_utilities.d.ts +6 -0
  73. package/script/client/0_utilities.js +41 -4
  74. package/script/client/1_account_manager.js +4 -4
  75. package/script/client/1_client_encrypted.js +2 -2
  76. package/script/client/1_client_plain.js +2 -2
  77. package/script/client/1_file_manager.js +5 -4
  78. package/script/client/1_reaction_manager.js +2 -2
  79. package/script/client/1_update_manager.js +8 -7
  80. package/script/client/2_message_manager.js +51 -28
  81. package/script/client/3_callback_query_manager.js +2 -0
  82. package/script/client/3_chat_list_manager.js +12 -11
  83. package/script/client/3_inline_query_manager.js +4 -2
  84. package/script/client/3_story_manager.js +4 -2
  85. package/script/client/4_client.js +13 -12
  86. package/script/connection/1_connection_web_socket.js +2 -1
  87. package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.d.ts +0 -1
  88. package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +1 -13
  89. package/script/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +310 -0
  90. package/script/mod.d.ts +1 -1
  91. package/script/mod.js +2 -1
  92. package/script/storage/0_storage.js +5 -4
  93. package/script/storage/1_utilities.d.ts +0 -1
  94. package/script/storage/1_utilities.js +3 -4
  95. package/script/storage/2_storage_local_storage.js +0 -3
  96. package/script/storage/2_storage_session_storage.js +0 -3
  97. package/script/tl/3_utilities.js +4 -3
  98. package/script/transport/2_transport_provider.js +4 -4
  99. package/script/types/0_message_entity.js +3 -3
  100. package/script/types/0_message_search_filter.js +2 -2
  101. package/script/types/0_reaction.js +2 -2
  102. package/script/types/1_bot_command_scope.js +3 -3
  103. package/script/types/1_chat_p.js +2 -1
  104. package/script/types/1_keyboard_button.js +3 -3
  105. package/script/types/1_message_reaction.js +2 -2
  106. package/script/types/1_story_privacy.js +3 -3
  107. package/script/types/2_chat_member.js +5 -4
  108. package/script/types/2_chosen_inline_result.js +2 -1
  109. package/script/types/2_inactive_chat.js +2 -1
  110. package/script/types/2_inline_keyboard_button.js +3 -3
  111. package/script/types/2_inline_query.js +3 -3
  112. package/script/types/2_invite_link.js +2 -1
  113. package/script/types/2_story_content.js +5 -5
  114. package/script/types/2_story_interactive_area.js +5 -5
  115. package/script/types/3_chat_member_updated.js +3 -2
  116. package/script/types/3_reply_markup.js +3 -2
  117. package/script/types/3_story.js +2 -1
  118. package/script/types/4_inline_query_result.js +5 -5
  119. package/script/types/4_message.js +16 -15
  120. package/script/types/5_callback_query.js +3 -2
  121. package/script/types/5_chat.js +7 -6
  122. package/script/types/_file_id.js +8 -7
  123. package/script/utilities/0_bigint.d.ts +1 -0
  124. package/script/utilities/0_bigint.js +27 -1
  125. package/script/utilities/0_logger.d.ts +8 -0
  126. package/script/utilities/0_logger.js +11 -6
  127. package/script/utilities/1_math.d.ts +1 -0
  128. package/script/utilities/1_math.js +55 -0
  129. package/script/utilities/1_misc.js +2 -2
  130. package/esm/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -324
  131. package/esm/utilities/0_control.d.ts +0 -1
  132. package/esm/utilities/0_control.js +0 -3
  133. package/script/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -326
  134. package/script/utilities/0_control.d.ts +0 -1
  135. package/script/utilities/0_control.js +0 -7
  136. /package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
  137. /package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
@@ -10,15 +10,17 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _MessageManager_instances, _MessageManager_c, _MessageManager_LresolveFileId, _MessageManager_updatesToMessages, _MessageManager_constructReplyMarkup, _MessageManager_resolveSendAs, _MessageManager_constructReplyTo, _MessageManager_sendDocumentInner, _MessageManager_sendMedia, _MessageManager_sendReaction, _MessageManager_toggleJoinRequests;
13
- import { contentType } from "../0_deps.js";
13
+ import { contentType, unreachable } from "../0_deps.js";
14
14
  import { InputError } from "../0_errors.js";
15
- import { getLogger, getRandomId, toUnixTimestamp, UNREACHABLE } from "../1_utilities.js";
15
+ import { getLogger, getRandomId, toUnixTimestamp } from "../1_utilities.js";
16
16
  import { as, functions, getChannelChatId, peerToChatId, types } from "../2_tl.js";
17
17
  import { constructChatMemberUpdated, constructInviteLink, deserializeFileId } from "../3_types.js";
18
18
  import { assertMessageType, chatMemberRightsToTlObject, constructChatMember, constructMessage as constructMessage_, deserializeInlineMessageId, FileType, messageEntityToTlObject, reactionEqual, reactionToTlObject, replyMarkupToTlObject } from "../3_types.js";
19
19
  import { messageSearchFilterToTlObject } from "../types/0_message_search_filter.js";
20
20
  import { parseHtml } from "./0_html.js";
21
21
  import { parseMarkdown } from "./0_markdown.js";
22
+ import { checkMessageId } from "./0_utilities.js";
23
+ import { checkArray } from "./0_utilities.js";
22
24
  import { getFileContents, isHttpUrl } from "./0_utilities.js";
23
25
  const FALLBACK_MIME_TYPE = "application/octet-stream";
24
26
  const STICKER_MIME_TYPES = ["image/webp", "video/webm", "application/x-tgsticker"];
@@ -41,6 +43,7 @@ export class MessageManager {
41
43
  __classPrivateFieldSet(this, _MessageManager_LresolveFileId, L.branch("resolveFileId"), "f");
42
44
  }
43
45
  async getMessages(chatId, messageIds) {
46
+ checkArray(messageIds, checkMessageId);
44
47
  const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
45
48
  let messages_ = new Array();
46
49
  const chatId_ = peerToChatId(peer);
@@ -111,7 +114,7 @@ export class MessageManager {
111
114
  break;
112
115
  }
113
116
  default:
114
- UNREACHABLE();
117
+ unreachable();
115
118
  }
116
119
  text = text.trimEnd();
117
120
  for (const entity of entities) {
@@ -119,6 +122,9 @@ export class MessageManager {
119
122
  --entity.length;
120
123
  }
121
124
  }
125
+ if (!text.length) {
126
+ throw new InputError("Text must not be empty.");
127
+ }
122
128
  return [text, entities];
123
129
  }
124
130
  async parseText(text_, params) {
@@ -130,6 +136,7 @@ export class MessageManager {
130
136
  return await constructMessage_(message_, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity, this.getMessage.bind(this), __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.getStickerSetName.bind(__classPrivateFieldGet(this, _MessageManager_c, "f").fileManager), r, business);
131
137
  }
132
138
  async forwardMessages(from, to, messageIds, params) {
139
+ checkArray(messageIds, checkMessageId);
133
140
  const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.forwardMessages({
134
141
  from_peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(from),
135
142
  to_peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(to),
@@ -173,7 +180,7 @@ export class MessageManager {
173
180
  hash: 0n,
174
181
  });
175
182
  if (!("messages" in result)) {
176
- UNREACHABLE();
183
+ unreachable();
177
184
  }
178
185
  for (const message_ of result.messages) {
179
186
  const message = await this.constructMessage(message_, false);
@@ -445,10 +452,10 @@ export class MessageManager {
445
452
  }
446
453
  if (fileId != null) {
447
454
  if (!expectedFileType.includes(fileId.type)) {
448
- UNREACHABLE();
455
+ unreachable();
449
456
  }
450
457
  return {
451
- id: "id" in fileId.location ? fileId.location.id : UNREACHABLE(),
458
+ id: "id" in fileId.location ? fileId.location.id : unreachable(),
452
459
  access_hash: fileId.location.accessHash,
453
460
  file_reference: fileId.fileReference ?? new Uint8Array(),
454
461
  };
@@ -456,6 +463,13 @@ export class MessageManager {
456
463
  return null;
457
464
  }
458
465
  async sendPoll(chatId, question, options, params) {
466
+ question = question?.trim();
467
+ if (!question) {
468
+ throw new Error("Question must not be empty.");
469
+ }
470
+ if (!Array.isArray(options) || options.length < 2) {
471
+ throw new Error("There must be at least two options.");
472
+ }
459
473
  const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
460
474
  const randomId = getRandomId();
461
475
  const silent = params?.disableNotification ? true : undefined;
@@ -500,7 +514,7 @@ export class MessageManager {
500
514
  }
501
515
  async editMessageReplyMarkup(chatId, messageId, params) {
502
516
  const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.editMessage({
503
- id: messageId,
517
+ id: checkMessageId(messageId),
504
518
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
505
519
  reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
506
520
  });
@@ -528,7 +542,7 @@ export class MessageManager {
528
542
  });
529
543
  }
530
544
  const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.editMessage({
531
- id: messageId,
545
+ id: checkMessageId(messageId),
532
546
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
533
547
  entities,
534
548
  message,
@@ -565,6 +579,7 @@ export class MessageManager {
565
579
  });
566
580
  }
567
581
  async deleteMessages(chatId, messageIds, params) {
582
+ checkArray(messageIds, checkMessageId);
568
583
  const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
569
584
  if (peer instanceof types.InputPeerChannel) {
570
585
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.channels.deleteMessages({ channel: new types.InputChannel(peer), id: messageIds });
@@ -581,7 +596,7 @@ export class MessageManager {
581
596
  async pinMessage(chatId, messageId, params) {
582
597
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.updatePinnedMessage({
583
598
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
584
- id: messageId,
599
+ id: checkMessageId(messageId),
585
600
  silent: params?.disableNotification ? true : undefined,
586
601
  pm_oneside: params?.bothSides ? undefined : true,
587
602
  });
@@ -589,7 +604,7 @@ export class MessageManager {
589
604
  async unpinMessage(chatId, messageId) {
590
605
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.updatePinnedMessage({
591
606
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
592
- id: messageId,
607
+ id: checkMessageId(messageId),
593
608
  unpin: true,
594
609
  });
595
610
  }
@@ -600,14 +615,18 @@ export class MessageManager {
600
615
  // TODO: sync with storage
601
616
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.setChatAvailableReactions({
602
617
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
603
- available_reactions: availableReactions == "none" ? new types.ChatReactionsNone() : availableReactions == "all" ? new types.ChatReactionsAll() : Array.isArray(availableReactions) ? new types.ChatReactionsSome({ reactions: availableReactions.map((v) => v.type == "emoji" ? new types.ReactionEmoji({ emoticon: v.emoji }) : new types.ReactionCustomEmoji({ document_id: BigInt(v.id) })) }) : UNREACHABLE(),
618
+ available_reactions: availableReactions == "none" ? new types.ChatReactionsNone() : availableReactions == "all" ? new types.ChatReactionsAll() : Array.isArray(availableReactions) ? new types.ChatReactionsSome({ reactions: availableReactions.map((v) => v.type == "emoji" ? new types.ReactionEmoji({ emoticon: v.emoji }) : new types.ReactionCustomEmoji({ document_id: BigInt(v.id) })) }) : unreachable(),
604
619
  });
605
620
  }
606
621
  async setReactions(chatId, messageId, reactions, params) {
607
622
  await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendReaction).call(this, chatId, messageId, reactions, params);
608
623
  }
609
624
  async addReaction(chatId, messageId, reaction, params) {
610
- const chosenReactions = await this.getMessage(chatId, messageId).then((v) => v?.reactions ?? []).then((v) => v.filter((v) => v.chosen));
625
+ const message = await this.getMessage(chatId, messageId);
626
+ if (!message) {
627
+ throw new InputError("Message not found.");
628
+ }
629
+ const chosenReactions = (message.reactions ?? []).filter((v) => v.chosen);
611
630
  for (const r of chosenReactions) {
612
631
  if (reactionEqual(r.reaction, reaction)) {
613
632
  return;
@@ -617,7 +636,11 @@ export class MessageManager {
617
636
  await this.setReactions(chatId, messageId, reactions, params);
618
637
  }
619
638
  async removeReaction(chatId, messageId, reaction) {
620
- const chosenReactions = await this.getMessage(chatId, messageId).then((v) => v?.reactions ?? []).then((v) => v.filter((v) => v.chosen));
639
+ const message = await this.getMessage(chatId, messageId);
640
+ if (!message) {
641
+ throw new InputError("Message not found.");
642
+ }
643
+ const chosenReactions = (message.reactions ?? []).filter((v) => v.chosen);
621
644
  for (const r of chosenReactions) {
622
645
  if (reactionEqual(r.reaction, reaction)) {
623
646
  const reactions = chosenReactions.filter((v) => v != r).map((v) => v.reaction);
@@ -754,7 +777,7 @@ export class MessageManager {
754
777
  async deleteChatPhoto(chatId) {
755
778
  const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
756
779
  if (!(peer instanceof types.InputPeerChannel) && !(peer instanceof types.InputPeerChat)) {
757
- UNREACHABLE();
780
+ unreachable();
758
781
  }
759
782
  if (peer instanceof types.InputPeerChannel) {
760
783
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.channels.editPhoto({ channel: new types.InputChannel(peer), photo: new types.InputChatPhotoEmpty() });
@@ -766,7 +789,7 @@ export class MessageManager {
766
789
  async setChatPhoto(chatId, photo, params) {
767
790
  const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
768
791
  if (!(peer instanceof types.InputPeerChannel) && !(peer instanceof types.InputPeerChat)) {
769
- UNREACHABLE();
792
+ unreachable();
770
793
  }
771
794
  const [contents, fileName] = await getFileContents(photo);
772
795
  const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(contents, { fileName: params?.fileName ?? fileName, chunkSize: params?.chunkSize, signal: params?.signal });
@@ -850,7 +873,7 @@ export class MessageManager {
850
873
  hash: 0n,
851
874
  });
852
875
  if (participants instanceof types.channels.ChannelParticipantsNotModified) {
853
- UNREACHABLE();
876
+ unreachable();
854
877
  }
855
878
  const chatMembers = new Array();
856
879
  for (const p of participants.participants) {
@@ -861,7 +884,7 @@ export class MessageManager {
861
884
  else if (peer instanceof types.InputPeerChat) {
862
885
  const fullChat = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.getFullChat(peer); // TODO: full chat cache
863
886
  if (!(fullChat.full_chat instanceof types.ChatFull) || !(fullChat.full_chat.participants instanceof types.ChatParticipants)) {
864
- UNREACHABLE();
887
+ unreachable();
865
888
  }
866
889
  const chatMembers = new Array();
867
890
  for (const p of fullChat.full_chat.participants.participants) {
@@ -870,7 +893,7 @@ export class MessageManager {
870
893
  return chatMembers;
871
894
  }
872
895
  else {
873
- UNREACHABLE();
896
+ unreachable();
874
897
  }
875
898
  }
876
899
  async enableJoinRequests(chatId) {
@@ -897,7 +920,7 @@ export class MessageManager {
897
920
  from_id: params?.from ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.from) : undefined,
898
921
  });
899
922
  if (!("messages" in result)) {
900
- UNREACHABLE();
923
+ unreachable();
901
924
  }
902
925
  const messages = new Array();
903
926
  for (const message_ of result.messages) {
@@ -948,7 +971,7 @@ export class MessageManager {
948
971
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.addChatUser({ chat_id: peer.chat_id, user_id: new types.InputUserSelf(), fwd_limit: 0 }); // TODO: use potential high-level method for adding participants to chats
949
972
  }
950
973
  else {
951
- UNREACHABLE();
974
+ unreachable();
952
975
  }
953
976
  }
954
977
  async leaveChat(chatId) {
@@ -963,7 +986,7 @@ export class MessageManager {
963
986
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.deleteChatUser({ chat_id: peer.chat_id, user_id: new types.InputUserSelf() }); // TODO: use potential high-level method for adding participants to chats
964
987
  }
965
988
  else {
966
- UNREACHABLE();
989
+ unreachable();
967
990
  }
968
991
  }
969
992
  async blockUser(userId) {
@@ -1056,7 +1079,7 @@ export class MessageManager {
1056
1079
  const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result).then((v) => v[0]);
1057
1080
  return assertMessageType(message, "location");
1058
1081
  }
1059
- UNREACHABLE();
1082
+ unreachable();
1060
1083
  }
1061
1084
  async editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params) {
1062
1085
  await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertBot("editInlineMessageLiveLocation");
@@ -1144,7 +1167,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
1144
1167
  let fileName = params?.fileName ?? fileName_;
1145
1168
  const mimeType = params?.mimeType ?? contentType(fileName.split(".").slice(-1)[0]) ?? FALLBACK_MIME_TYPE;
1146
1169
  if (expectedMimeTypes && !expectedMimeTypes.includes(mimeType)) {
1147
- UNREACHABLE();
1170
+ unreachable();
1148
1171
  }
1149
1172
  if (fileName.endsWith(".tgs") && fileType == FileType.Document) {
1150
1173
  fileName += "-";
@@ -1194,7 +1217,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
1194
1217
  }, _MessageManager_sendReaction = async function _MessageManager_sendReaction(chatId, messageId, reactions, params) {
1195
1218
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.sendReaction({
1196
1219
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
1197
- msg_id: messageId,
1220
+ msg_id: checkMessageId(messageId),
1198
1221
  reaction: reactions.map((v) => reactionToTlObject(v)),
1199
1222
  big: params?.big ? true : undefined,
1200
1223
  add_to_recent: params?.addToRecents ? true : undefined,
@@ -12,6 +12,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
12
12
  var _CallbackQueryManager_c;
13
13
  import { types } from "../2_tl.js";
14
14
  import { constructCallbackQuery } from "../3_types.js";
15
+ import { checkCallbackQueryId } from "./0_utilities.js";
15
16
  export class CallbackQueryManager {
16
17
  constructor(c) {
17
18
  _CallbackQueryManager_c.set(this, void 0);
@@ -19,6 +20,7 @@ export class CallbackQueryManager {
19
20
  }
20
21
  async answerCallbackQuery(id, params) {
21
22
  await __classPrivateFieldGet(this, _CallbackQueryManager_c, "f").storage.assertBot("answerCallbackQuery");
23
+ checkCallbackQueryId(id);
22
24
  await __classPrivateFieldGet(this, _CallbackQueryManager_c, "f").api.messages.setBotCallbackAnswer({
23
25
  query_id: BigInt(id),
24
26
  cache_time: params?.cacheTime ?? 0,
@@ -10,8 +10,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _ChatListManager_instances, _ChatListManager_c, _ChatListManager_LgetChats, _ChatListManager_sendChatUpdate, _ChatListManager_chats, _ChatListManager_archivedChats, _ChatListManager_chatsLoadedFromStorage, _ChatListManager_tryGetChatId, _ChatListManager_getChatAnywhere, _ChatListManager_getChatList, _ChatListManager_loadChatsFromStorage, _ChatListManager_getLoadedChats, _ChatListManager_pinnedChats, _ChatListManager_pinnedArchiveChats, _ChatListManager_storageHadPinnedChats, _ChatListManager_pinnedChatsLoaded, _ChatListManager_loadPinnedChats, _ChatListManager_fetchPinnedChats, _ChatListManager_getPinnedChats, _ChatListManager_updateOrAddChat, _ChatListManager_removeChat, _ChatListManager_handleUpdateFolderPeers, _ChatListManager_handleUpdatePinnedDialogs, _ChatListManager_handleUpdateChannel, _ChatListManager_handleUpdateChat, _ChatListManager_handleUpdateUser, _ChatListManager_fetchChats;
13
+ import { unreachable } from "../0_deps.js";
13
14
  import { InputError } from "../0_errors.js";
14
- import { getLogger, toUnixTimestamp, UNREACHABLE } from "../1_utilities.js";
15
+ import { getLogger, toUnixTimestamp } from "../1_utilities.js";
15
16
  import { as, peerToChatId, types } from "../2_tl.js";
16
17
  import { constructChat, constructChat2, constructChat3, constructChat4, getChatOrder } from "../3_types.js";
17
18
  import { getChatListId, getUsername } from "./0_utilities.js";
@@ -54,7 +55,7 @@ export class ChatListManager {
54
55
  const pinnedChats = await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getPinnedChats).call(this, listId);
55
56
  const chat = await constructChat3(chatId, pinnedChats.indexOf(chatId), message, __classPrivateFieldGet(this, _ChatListManager_c, "f").getEntity);
56
57
  if (chat == null) {
57
- UNREACHABLE();
58
+ unreachable();
58
59
  }
59
60
  __classPrivateFieldGet(this, _ChatListManager_chats, "f").set(chatId, chat);
60
61
  await __classPrivateFieldGet(this, _ChatListManager_c, "f").storage.setChat(listId, chatId, chat.pinned, chat.lastMessage?.id ?? 0, chat.lastMessage?.date ?? new Date(0));
@@ -75,7 +76,7 @@ export class ChatListManager {
75
76
  const pinnedChats = await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getPinnedChats).call(this, listId);
76
77
  const chat = await constructChat3(chatId, pinnedChats.indexOf(chatId), message, __classPrivateFieldGet(this, _ChatListManager_c, "f").getEntity);
77
78
  if (chat == null) {
78
- UNREACHABLE();
79
+ unreachable();
79
80
  }
80
81
  __classPrivateFieldGet(this, _ChatListManager_chats, "f").set(chatId, chat);
81
82
  }
@@ -146,7 +147,7 @@ export class ChatListManager {
146
147
  await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_handleUpdateUser).call(this, update);
147
148
  }
148
149
  else {
149
- UNREACHABLE();
150
+ unreachable();
150
151
  }
151
152
  }
152
153
  async getChat(chatId) {
@@ -159,7 +160,7 @@ export class ChatListManager {
159
160
  maybeChatId = __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_tryGetChatId).call(this, getUsername(chatId));
160
161
  }
161
162
  else {
162
- UNREACHABLE();
163
+ unreachable();
163
164
  }
164
165
  if (maybeChatId != null) {
165
166
  const [chat] = __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getChatAnywhere).call(this, maybeChatId);
@@ -190,7 +191,7 @@ export class ChatListManager {
190
191
  const chats = await __classPrivateFieldGet(this, _ChatListManager_c, "f").api.messages.getChats({ id: [inputPeer.chat_id] }).then((v) => v[as](types.messages.Chats));
191
192
  const chat = chats.chats[0];
192
193
  if (chat instanceof types.ChatEmpty) {
193
- UNREACHABLE();
194
+ unreachable();
194
195
  }
195
196
  return constructChat2(chat, -1, undefined);
196
197
  }
@@ -198,7 +199,7 @@ export class ChatListManager {
198
199
  const channels = await __classPrivateFieldGet(this, _ChatListManager_c, "f").api.channels.getChannels({ id: [new types.InputChannel(inputPeer)] });
199
200
  const channel = channels.chats[0];
200
201
  if (channel instanceof types.ChatEmpty) {
201
- UNREACHABLE();
202
+ unreachable();
202
203
  }
203
204
  return constructChat2(channel, -1, undefined);
204
205
  }
@@ -206,12 +207,12 @@ export class ChatListManager {
206
207
  const users = await __classPrivateFieldGet(this, _ChatListManager_c, "f").api.users.getUsers({ id: [new types.InputUser(inputPeer)] });
207
208
  const user = users[0];
208
209
  if (user instanceof types.UserEmpty) {
209
- UNREACHABLE();
210
+ unreachable();
210
211
  }
211
212
  return constructChat2(user, -1, undefined);
212
213
  }
213
214
  else {
214
- UNREACHABLE();
215
+ unreachable();
215
216
  }
216
217
  }
217
218
  }
@@ -316,7 +317,7 @@ _ChatListManager_c = new WeakMap(), _ChatListManager_LgetChats = new WeakMap(),
316
317
  await __classPrivateFieldGet(this, _ChatListManager_c, "f").storage.setPinnedChats(1, __classPrivateFieldGet(this, _ChatListManager_pinnedArchiveChats, "f"));
317
318
  }
318
319
  if (listId != null && listId != 0 && listId != 1) {
319
- UNREACHABLE();
320
+ unreachable();
320
321
  }
321
322
  }, _ChatListManager_getPinnedChats = async function _ChatListManager_getPinnedChats(listId) {
322
323
  if (!__classPrivateFieldGet(this, _ChatListManager_pinnedChatsLoaded, "f")) {
@@ -331,7 +332,7 @@ _ChatListManager_c = new WeakMap(), _ChatListManager_LgetChats = new WeakMap(),
331
332
  case 1:
332
333
  return __classPrivateFieldGet(this, _ChatListManager_pinnedArchiveChats, "f");
333
334
  default:
334
- UNREACHABLE();
335
+ unreachable();
335
336
  }
336
337
  }, _ChatListManager_updateOrAddChat = async function _ChatListManager_updateOrAddChat(chatId) {
337
338
  const [chat, listId] = __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getChatAnywhere).call(this, chatId);
@@ -428,7 +429,7 @@ _ChatListManager_c = new WeakMap(), _ChatListManager_LgetChats = new WeakMap(),
428
429
  });
429
430
  const pinnedChats = await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getPinnedChats).call(this, listId);
430
431
  if (!(dialogs instanceof types.messages.Dialogs) && !(dialogs instanceof types.messages.DialogsSlice)) {
431
- UNREACHABLE();
432
+ unreachable();
432
433
  }
433
434
  if (dialogs.dialogs.length < limit) {
434
435
  await __classPrivateFieldGet(this, _ChatListManager_c, "f").storage.setHasAllChats(listId, true);
@@ -10,9 +10,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _InlineQueryManager_c;
13
- import { UNREACHABLE } from "../1_utilities.js";
13
+ import { unreachable } from "../0_deps.js";
14
14
  import { types } from "../2_tl.js";
15
15
  import { constructChosenInlineResult, constructInlineQuery, inlineQueryResultToTlObject } from "../3_types.js";
16
+ import { checkInlineQueryId } from "./0_utilities.js";
16
17
  export class InlineQueryManager {
17
18
  constructor(c) {
18
19
  _InlineQueryManager_c.set(this, void 0);
@@ -20,6 +21,7 @@ export class InlineQueryManager {
20
21
  }
21
22
  async answerInlineQuery(id, results, params) {
22
23
  await __classPrivateFieldGet(this, _InlineQueryManager_c, "f").storage.assertBot("answerInlineQuery");
24
+ checkInlineQueryId(id);
23
25
  await __classPrivateFieldGet(this, _InlineQueryManager_c, "f").api.messages.setInlineBotResults({
24
26
  query_id: BigInt(id),
25
27
  results: await Promise.all(results.map((v) => inlineQueryResultToTlObject(v, __classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager.parseText.bind(__classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager), __classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager.usernameResolver.bind(__classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager)))),
@@ -42,7 +44,7 @@ export class InlineQueryManager {
42
44
  return { chosenInlineResult: await constructChosenInlineResult(update, __classPrivateFieldGet(this, _InlineQueryManager_c, "f").getEntity) };
43
45
  }
44
46
  else {
45
- UNREACHABLE();
47
+ unreachable();
46
48
  }
47
49
  }
48
50
  }
@@ -10,12 +10,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _StoryManager_instances, _StoryManager_c, _StoryManager_updatesToStory, _StoryManager_togglePinned;
13
- import { contentType } from "../0_deps.js";
13
+ import { contentType, unreachable } from "../0_deps.js";
14
14
  import { InputError } from "../0_errors.js";
15
- import { getRandomId, UNREACHABLE } from "../1_utilities.js";
15
+ import { getRandomId } from "../1_utilities.js";
16
16
  import { as, inputPeerToPeer, peerToChatId, types } from "../2_tl.js";
17
17
  import { constructStory, FileType, storyInteractiveAreaToTlObject, storyPrivacyToTlObject } from "../3_types.js";
18
- import { getFileContents, isHttpUrl } from "./0_utilities.js";
18
+ import { checkArray, checkStoryId, getFileContents, isHttpUrl } from "./0_utilities.js";
19
19
  export class StoryManager {
20
20
  constructor(c) {
21
21
  _StoryManager_instances.add(this);
@@ -25,7 +25,7 @@ export class StoryManager {
25
25
  async createStory(chatId, content, params) {
26
26
  await __classPrivateFieldGet(this, _StoryManager_c, "f").storage.assertUser("createStory");
27
27
  let media = null;
28
- const source = "video" in content ? content.video : "photo" in content ? content.photo : UNREACHABLE();
28
+ const source = "video" in content ? content.video : "photo" in content ? content.photo : unreachable();
29
29
  if (typeof source === "string") {
30
30
  const fileId = __classPrivateFieldGet(this, _StoryManager_c, "f").messageManager.resolveFileId(source, FileType.Photo);
31
31
  if (fileId != null) {
@@ -84,6 +84,7 @@ export class StoryManager {
84
84
  }
85
85
  async getStories(chatId, storyIds) {
86
86
  await __classPrivateFieldGet(this, _StoryManager_c, "f").storage.assertUser("getStories");
87
+ checkArray(storyIds, checkStoryId);
87
88
  const peer = await __classPrivateFieldGet(this, _StoryManager_c, "f").getInputPeer(chatId);
88
89
  const stories_ = await __classPrivateFieldGet(this, _StoryManager_c, "f").api.stories.getStoriesByID({ peer, id: storyIds });
89
90
  const stories = new Array();
@@ -146,8 +147,9 @@ _StoryManager_c = new WeakMap(), _StoryManager_instances = new WeakSet(), _Story
146
147
  return await constructStory(updateStory.story, updateStory.peer, __classPrivateFieldGet(this, _StoryManager_c, "f").getEntity);
147
148
  }
148
149
  }
149
- UNREACHABLE();
150
+ unreachable();
150
151
  }, _StoryManager_togglePinned = async function _StoryManager_togglePinned(chatId, storyIds, pinned) {
152
+ checkArray(storyIds, checkStoryId);
151
153
  const peer = await __classPrivateFieldGet(this, _StoryManager_c, "f").getInputPeer(chatId);
152
154
  await __classPrivateFieldGet(this, _StoryManager_c, "f").api.stories.togglePinned({ peer, id: storyIds, pinned });
153
155
  };
@@ -10,8 +10,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _Client_instances, _Client_client, _Client_guaranteeUpdateDelivery, _Client_updateManager, _Client_networkStatisticsManager, _Client_botInfoManager, _Client_fileManager, _Client_reactionManager, _Client_businessConnectionManager, _Client_messageManager, _Client_storyManager, _Client_callbackQueryManager, _Client_inlineQueryManager, _Client_chatListManager, _Client_accountManager, _Client_parseMode, _Client_publicKeys, _Client_ignoreOutgoing, _Client_storeMessages, _Client_Lauthorize, _Client_LpingLoop, _Client_LhandleMigrationError, _Client_L$initConncetion, _Client_namespaceProxies, _Client_getApiId, _Client_constructContext, _Client_propagateConnectionState, _Client_lastPropagatedConnectionState, _Client_stateChangeHandler, _Client_storageInited, _Client_initStorage, _Client_connectionInited, _Client_lastPropagatedAuthorizationState, _Client_propagateAuthorizationState, _Client_getSelfId, _Client_pingLoopStarted, _Client_pingLoopAbortController, _Client_pingInterval, _Client_lastUpdates, _Client_startPingLoop, _Client_pingLoop, _Client_invoke, _Client_handleInvokeError, _Client_getUserAccessHash, _Client_getChannelAccessHash, _Client_getInputPeerInner, _Client_handleCtxUpdate, _Client_queueHandleCtxUpdate, _Client_handleUpdate, _Client_lastGetMe, _Client_getMe;
13
+ import { unreachable } from "../0_deps.js";
13
14
  import { AccessError, InputError } from "../0_errors.js";
14
- import { cleanObject, drop, getLogger, getRandomId, mustPrompt, mustPromptOneOf, UNREACHABLE, ZERO_CHANNEL_ID } from "../1_utilities.js";
15
+ import { cleanObject, drop, getLogger, getRandomId, mustPrompt, mustPromptOneOf, ZERO_CHANNEL_ID } from "../1_utilities.js";
15
16
  import { as, chatIdToPeerId, functions, getChatIdPeerType, name, peerToChatId, types } from "../2_tl.js";
16
17
  import { StorageMemory } from "../3_storage.js";
17
18
  import { constructUser } from "../3_types.js";
@@ -160,7 +161,7 @@ export class Client extends Composer {
160
161
  };
161
162
  }
162
163
  else {
163
- UNREACHABLE();
164
+ unreachable();
164
165
  }
165
166
  }
166
167
  },
@@ -208,7 +209,7 @@ export class Client extends Composer {
208
209
  return { chatId: reactions.chatId, messageId: reactions.messageId };
209
210
  }
210
211
  else {
211
- UNREACHABLE();
212
+ unreachable();
212
213
  }
213
214
  };
214
215
  const mustGetUserId = () => {
@@ -222,7 +223,7 @@ export class Client extends Composer {
222
223
  return update.chosenInlineResult.from.id;
223
224
  }
224
225
  else {
225
- UNREACHABLE();
226
+ unreachable();
226
227
  }
227
228
  };
228
229
  const mustGetInlineMsgId = () => {
@@ -236,7 +237,7 @@ export class Client extends Composer {
236
237
  return update.callbackQuery.inlineMessageId;
237
238
  }
238
239
  }
239
- UNREACHABLE();
240
+ unreachable();
240
241
  };
241
242
  const chat_ = "messageReactions" in update ? update.messageReactions.chat : "messageReactionCount" in update ? update.messageReactionCount.chat : undefined;
242
243
  const chat = chat_ ?? msg?.chat;
@@ -349,21 +350,21 @@ export class Client extends Composer {
349
350
  banSender: (params) => {
350
351
  const { chatId, senderId } = mustGetMsg();
351
352
  if (!senderId) {
352
- UNREACHABLE();
353
+ unreachable();
353
354
  }
354
355
  return this.banChatMember(chatId, senderId, params);
355
356
  },
356
357
  kickSender: () => {
357
358
  const { chatId, senderId } = mustGetMsg();
358
359
  if (!senderId) {
359
- UNREACHABLE();
360
+ unreachable();
360
361
  }
361
362
  return this.kickChatMember(chatId, senderId);
362
363
  },
363
364
  setSenderRights: (params) => {
364
365
  const { chatId, senderId } = mustGetMsg();
365
366
  if (!senderId) {
366
- UNREACHABLE();
367
+ unreachable();
367
368
  }
368
369
  return this.setChatMemberRights(chatId, senderId, params);
369
370
  },
@@ -377,13 +378,13 @@ export class Client extends Composer {
377
378
  },
378
379
  answerCallbackQuery: (params) => {
379
380
  if (!("callbackQuery" in update)) {
380
- UNREACHABLE();
381
+ unreachable();
381
382
  }
382
383
  return this.answerCallbackQuery(update.callbackQuery.id, params);
383
384
  },
384
385
  answerInlineQuery: (results, params) => {
385
386
  if (!("inlineQuery" in update)) {
386
- UNREACHABLE();
387
+ unreachable();
387
388
  }
388
389
  return this.answerInlineQuery(update.inlineQuery.id, results, params);
389
390
  },
@@ -536,7 +537,7 @@ export class Client extends Composer {
536
537
  getBusinessConnection: () => {
537
538
  const { businessConnectionId } = mustGetMsg();
538
539
  if (!businessConnectionId) {
539
- UNREACHABLE();
540
+ unreachable();
540
541
  }
541
542
  return this.getBusinessConnection(businessConnectionId);
542
543
  },
@@ -1217,7 +1218,7 @@ export class Client extends Composer {
1217
1218
  resolvedId = peerToChatId(resolved.peer);
1218
1219
  }
1219
1220
  else {
1220
- UNREACHABLE();
1221
+ unreachable();
1221
1222
  }
1222
1223
  }
1223
1224
  const resolvedIdType = getChatIdPeerType(resolvedId);
@@ -1230,7 +1231,7 @@ export class Client extends Composer {
1230
1231
  return new types.InputPeerChannel({ channel_id: chatIdToPeerId(resolvedId), access_hash: accessHash ?? 0n });
1231
1232
  }
1232
1233
  else {
1233
- UNREACHABLE();
1234
+ unreachable();
1234
1235
  }
1235
1236
  }
1236
1237
  else if (id > 0) {
@@ -11,7 +11,8 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
11
11
  };
12
12
  var _ConnectionWebSocket_instances, _ConnectionWebSocket_webSocket, _ConnectionWebSocket_rMutex, _ConnectionWebSocket_wMutex, _ConnectionWebSocket_buffer, _ConnectionWebSocket_nextResolve, _ConnectionWebSocket_initWs, _ConnectionWebSocket_wasConnected, _ConnectionWebSocket_isConnecting, _ConnectionWebSocket_connectionError, _ConnectionWebSocket_assertConnected, _ConnectionWebSocket_rejectRead;
13
13
  import * as dntShim from "../_dnt.shims.js";
14
- import { concat, getLogger, Mutex, UNREACHABLE } from "../1_utilities.js";
14
+ import { unreachable } from "../0_deps.js";
15
+ import { concat, getLogger, Mutex } from "../1_utilities.js";
15
16
  import { ConnectionUnframed } from "./0_connection.js";
16
17
  const L = getLogger("ConnectionWebSocket");
17
18
  const errConnectionNotOpen = new Error("Connection not open");
@@ -115,7 +116,7 @@ _ConnectionWebSocket_webSocket = new WeakMap(), _ConnectionWebSocket_rMutex = ne
115
116
  return;
116
117
  }
117
118
  const unlock = await mutex.lock();
118
- const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob || v instanceof Uint8Array ? v : v instanceof ArrayBuffer ? v : UNREACHABLE())).arrayBuffer());
119
+ const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob || v instanceof Uint8Array ? v : v instanceof ArrayBuffer ? v : unreachable())).arrayBuffer());
119
120
  __classPrivateFieldSet(this, _ConnectionWebSocket_buffer, concat(__classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f"), data), "f");
120
121
  if (__classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f") != null && __classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f").length >= __classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f")[0]) {
121
122
  __classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f")[1].resolve();
@@ -40,4 +40,3 @@ export declare function cbc256Encrypt(data: Uint8Array, key: Uint8Array, iv: Uin
40
40
  * @param iv 16-byte initialization vector
41
41
  */
42
42
  export declare function cbc256Decrypt(data: Uint8Array, key: Uint8Array, iv: Uint8Array): Uint8Array;
43
- export declare function factorize(pq: bigint): [bigint, bigint];
@@ -151,14 +151,3 @@ export function cbc256Decrypt(data, key, iv) {
151
151
  module_._free(datap);
152
152
  }
153
153
  }
154
- export function factorize(pq) {
155
- const pqp = module_._malloc(16);
156
- module_.ccall("factorize", "void", ["number", "pointer"], [pq, pqp]);
157
- try {
158
- const pqp_ = module_.HEAP64.slice(pqp / 8, pqp / 8 + 2);
159
- return [pqp_[0], pqp_[1]];
160
- }
161
- finally {
162
- module_._free(pqp);
163
- }
164
- }