@mtkruto/node 0.6.1 → 0.6.3

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 (83) hide show
  1. package/README.md +76 -1
  2. package/esm/0_deps.d.ts +1 -1
  3. package/esm/0_deps.d.ts.map +1 -1
  4. package/esm/0_deps.js +1 -1
  5. package/esm/1_utilities.d.ts +1 -1
  6. package/esm/1_utilities.d.ts.map +1 -1
  7. package/esm/1_utilities.js +1 -1
  8. package/esm/deps/jsr.io/@roj/tgcrypto/1.0.0/dist/mod.d.ts +18 -0
  9. package/esm/deps/jsr.io/@roj/tgcrypto/1.0.0/dist/mod.d.ts.map +1 -0
  10. package/esm/deps/jsr.io/@roj/tgcrypto/1.0.0/dist/mod.js +63 -0
  11. package/esm/deps/jsr.io/@roj/tgcrypto/1.0.0/dist/tgcrypto.d.ts +3 -0
  12. package/esm/deps/jsr.io/@roj/tgcrypto/1.0.0/dist/tgcrypto.d.ts.map +1 -0
  13. package/esm/deps/jsr.io/@roj/tgcrypto/1.0.0/dist/tgcrypto.js +301 -0
  14. package/esm/transport/0_obfuscation.d.ts.map +1 -1
  15. package/esm/transport/0_obfuscation.js +5 -4
  16. package/esm/transport/0_transport.d.ts +2 -2
  17. package/esm/transport/0_transport.d.ts.map +1 -1
  18. package/esm/transport/0_transport.js +10 -6
  19. package/esm/transport/1_transport_abridged.d.ts.map +1 -1
  20. package/esm/transport/1_transport_abridged.js +6 -8
  21. package/esm/transport/1_transport_intermediate.d.ts.map +1 -1
  22. package/esm/transport/1_transport_intermediate.js +4 -6
  23. package/esm/types/0_switch_inline_query_chosen_chats.d.ts +19 -0
  24. package/esm/types/0_switch_inline_query_chosen_chats.d.ts.map +1 -1
  25. package/esm/types/0_switch_inline_query_chosen_chats.js +19 -0
  26. package/esm/types/2_forward_header.d.ts +19 -0
  27. package/esm/types/2_forward_header.d.ts.map +1 -1
  28. package/esm/types/2_forward_header.js +19 -0
  29. package/esm/utilities/0_env.d.ts.map +1 -1
  30. package/esm/utilities/0_env.js +19 -0
  31. package/esm/utilities/0_gunzip.d.ts +19 -0
  32. package/esm/utilities/0_gunzip.d.ts.map +1 -1
  33. package/esm/utilities/0_gunzip.js +19 -0
  34. package/{script/utilities/0_crypto.d.ts → esm/utilities/1_crypto.d.ts} +9 -5
  35. package/esm/utilities/1_crypto.d.ts.map +1 -0
  36. package/esm/utilities/{0_crypto.js → 1_crypto.js} +41 -21
  37. package/esm/utilities/1_crypto_test.d.ts.map +1 -0
  38. package/package.json +1 -1
  39. package/script/0_deps.d.ts +1 -1
  40. package/script/0_deps.d.ts.map +1 -1
  41. package/script/0_deps.js +2 -5
  42. package/script/1_utilities.d.ts +1 -1
  43. package/script/1_utilities.d.ts.map +1 -1
  44. package/script/1_utilities.js +1 -1
  45. package/script/deps/jsr.io/@roj/tgcrypto/1.0.0/dist/mod.d.ts +18 -0
  46. package/script/deps/jsr.io/@roj/tgcrypto/1.0.0/dist/mod.d.ts.map +1 -0
  47. package/script/deps/jsr.io/@roj/tgcrypto/1.0.0/dist/mod.js +71 -0
  48. package/script/deps/jsr.io/@roj/tgcrypto/1.0.0/dist/tgcrypto.d.ts +3 -0
  49. package/script/deps/jsr.io/@roj/tgcrypto/1.0.0/dist/tgcrypto.d.ts.map +1 -0
  50. package/script/deps/jsr.io/@roj/tgcrypto/1.0.0/dist/tgcrypto.js +303 -0
  51. package/script/transport/0_obfuscation.d.ts.map +1 -1
  52. package/script/transport/0_obfuscation.js +5 -4
  53. package/script/transport/0_transport.d.ts +2 -2
  54. package/script/transport/0_transport.d.ts.map +1 -1
  55. package/script/transport/0_transport.js +10 -6
  56. package/script/transport/1_transport_abridged.d.ts.map +1 -1
  57. package/script/transport/1_transport_abridged.js +6 -8
  58. package/script/transport/1_transport_intermediate.d.ts.map +1 -1
  59. package/script/transport/1_transport_intermediate.js +4 -6
  60. package/script/types/0_switch_inline_query_chosen_chats.d.ts +19 -0
  61. package/script/types/0_switch_inline_query_chosen_chats.d.ts.map +1 -1
  62. package/script/types/0_switch_inline_query_chosen_chats.js +19 -0
  63. package/script/types/2_forward_header.d.ts +19 -0
  64. package/script/types/2_forward_header.d.ts.map +1 -1
  65. package/script/types/2_forward_header.js +19 -0
  66. package/script/utilities/0_env.d.ts.map +1 -1
  67. package/script/utilities/0_env.js +19 -0
  68. package/script/utilities/0_gunzip.d.ts +19 -0
  69. package/script/utilities/0_gunzip.d.ts.map +1 -1
  70. package/script/utilities/0_gunzip.js +19 -0
  71. package/{esm/utilities/0_crypto.d.ts → script/utilities/1_crypto.d.ts} +9 -5
  72. package/script/utilities/1_crypto.d.ts.map +1 -0
  73. package/script/utilities/1_crypto.js +95 -0
  74. package/script/utilities/1_crypto_test.d.ts.map +1 -0
  75. package/esm/deps/jsr.io/@roj/tgcrypto/0.4.1/dist/mod.d.ts +0 -55
  76. package/esm/deps/jsr.io/@roj/tgcrypto/0.4.1/dist/mod.js +0 -167
  77. package/esm/deps/jsr.io/@roj/tgcrypto/0.4.1/dist/tgcrypto.js +0 -308
  78. package/esm/utilities/0_crypto.d.ts.map +0 -1
  79. package/script/deps/jsr.io/@roj/tgcrypto/0.4.1/dist/mod.d.ts +0 -55
  80. package/script/deps/jsr.io/@roj/tgcrypto/0.4.1/dist/mod.js +0 -182
  81. package/script/deps/jsr.io/@roj/tgcrypto/0.4.1/dist/tgcrypto.js +0 -310
  82. package/script/utilities/0_crypto.d.ts.map +0 -1
  83. package/script/utilities/0_crypto.js +0 -52
@@ -40,13 +40,14 @@ export async function getObfuscationParameters(protocol, connection) {
40
40
  }
41
41
  const encryptKey = init.slice(8, 8 + 32);
42
42
  const encryptIv = init.slice(40, 40 + 16);
43
- const encryptionCTR = new CTR(encryptKey, encryptIv);
44
- const encryptedInit = new Uint8Array(init);
45
- encryptionCTR.call(encryptedInit);
43
+ const importedEncryptedKey = await CTR.importKey(encryptKey);
44
+ const encryptionCTR = new CTR(importedEncryptedKey, encryptIv);
45
+ const encryptedInit = await encryptionCTR.call(init);
46
46
  const initRev = new Uint8Array(init).reverse();
47
47
  const decryptKey = initRev.slice(8, 8 + 32);
48
48
  const decryptIv = initRev.slice(40, 40 + 16);
49
- const decryptionCTR = new CTR(decryptKey, decryptIv);
49
+ const importedDecryptKey = await CTR.importKey(decryptKey);
50
+ const decryptionCTR = new CTR(importedDecryptKey, decryptIv);
50
51
  await connection.write(concat([init.subarray(0, 56), encryptedInit.subarray(56, 56 + 8)]));
51
52
  return { encryptionCTR, decryptionCTR };
52
53
  }
@@ -23,8 +23,8 @@ export declare abstract class Transport {
23
23
  encryptionCTR: CTR;
24
24
  decryptionCTR: CTR;
25
25
  } | null;
26
- protected encrypt(buffer: Uint8Array): void;
27
- protected decrypt(buffer: Uint8Array): void;
26
+ protected encrypt(buffer: Uint8Array): Promise<Uint8Array>;
27
+ protected decrypt(buffer: Uint8Array): Promise<Uint8Array>;
28
28
  abstract get initialized(): boolean;
29
29
  abstract initialize(): MaybePromise<void>;
30
30
  abstract receive(): MaybePromise<Uint8Array>;
@@ -1 +1 @@
1
- {"version":3,"file":"0_transport.d.ts","sourceRoot":"","sources":["../../src/transport/0_transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,8BAAsB,SAAS;IAC7B,SAAS,CAAC,qBAAqB,EAAE;QAAE,aAAa,EAAE,GAAG,CAAC;QAAC,aAAa,EAAE,GAAG,CAAA;KAAE,GAAG,IAAI,CAAQ;IAE1F,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU;IAMpC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU;IAMpC,QAAQ,KAAK,WAAW,IAAI,OAAO,CAAC;IACpC,QAAQ,CAAC,UAAU,IAAI,YAAY,CAAC,IAAI,CAAC;IACzC,QAAQ,CAAC,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC;IAC5C,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC;IACrD,YAAY,IAAI,YAAY,CAAC,IAAI,CAAC;CAOnC"}
1
+ {"version":3,"file":"0_transport.d.ts","sourceRoot":"","sources":["../../src/transport/0_transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,8BAAsB,SAAS;IAC7B,SAAS,CAAC,qBAAqB,EAAE;QAAE,aAAa,EAAE,GAAG,CAAC;QAAC,aAAa,EAAE,GAAG,CAAA;KAAE,GAAG,IAAI,CAAQ;cAE1E,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;cAQhD,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAQhE,QAAQ,KAAK,WAAW,IAAI,OAAO,CAAC;IACpC,QAAQ,CAAC,UAAU,IAAI,YAAY,CAAC,IAAI,CAAC;IACzC,QAAQ,CAAC,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC;IAC5C,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC;IACrD,YAAY,IAAI,YAAY,CAAC,IAAI,CAAC;CAKnC"}
@@ -26,20 +26,24 @@ export class Transport {
26
26
  value: null
27
27
  });
28
28
  }
29
- encrypt(buffer) {
29
+ async encrypt(buffer) {
30
30
  if (this.obfuscationParameters) {
31
- this.obfuscationParameters.encryptionCTR.call(buffer);
31
+ return await this.obfuscationParameters.encryptionCTR.call(buffer);
32
+ }
33
+ else {
34
+ return buffer;
32
35
  }
33
36
  }
34
- decrypt(buffer) {
37
+ async decrypt(buffer) {
35
38
  if (this.obfuscationParameters) {
36
- this.obfuscationParameters.decryptionCTR.call(buffer);
39
+ return await this.obfuscationParameters.decryptionCTR.call(buffer);
40
+ }
41
+ else {
42
+ return buffer;
37
43
  }
38
44
  }
39
45
  deinitialize() {
40
46
  if (this.obfuscationParameters) {
41
- this.obfuscationParameters.encryptionCTR.destroy();
42
- this.obfuscationParameters.decryptionCTR.destroy();
43
47
  this.obfuscationParameters = null;
44
48
  }
45
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"1_transport_abridged.d.ts","sourceRoot":"","sources":["../../src/transport/1_transport_abridged.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBAAa,iBAAkB,SAAQ,SAAU,YAAW,SAAS;;gBAKvD,UAAU,EAAE,UAAU,EAAE,UAAU,UAAQ;IAMhD,UAAU;IAWV,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC;IA2B9B,IAAI,CAAC,MAAM,EAAE,UAAU;IAepB,YAAY;IAKrB,IAAI,WAAW,IAAI,OAAO,CAEzB;CACF"}
1
+ {"version":3,"file":"1_transport_abridged.d.ts","sourceRoot":"","sources":["../../src/transport/1_transport_abridged.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBAAa,iBAAkB,SAAQ,SAAU,YAAW,SAAS;;gBAKvD,UAAU,EAAE,UAAU,EAAE,UAAU,UAAQ;IAMhD,UAAU;IAWV,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC;IA0B9B,IAAI,CAAC,MAAM,EAAE,UAAU;IAcpB,YAAY;IAKrB,IAAI,WAAW,IAAI,OAAO,CAEzB;CACF"}
@@ -57,24 +57,23 @@ export class TransportAbridged extends Transport {
57
57
  async receive() {
58
58
  let length;
59
59
  {
60
- const buffer = new Uint8Array(1);
60
+ let buffer = new Uint8Array(1);
61
61
  await __classPrivateFieldGet(this, _TransportAbridged_connection, "f").read(buffer);
62
- this.decrypt(buffer);
62
+ buffer = await this.decrypt(buffer);
63
63
  if (buffer[0] < 0x7F) {
64
64
  length = buffer[0];
65
65
  }
66
66
  else {
67
- const buffer = new Uint8Array(3);
67
+ let buffer = new Uint8Array(3);
68
68
  await __classPrivateFieldGet(this, _TransportAbridged_connection, "f").read(buffer);
69
- this.decrypt(buffer);
69
+ buffer = await this.decrypt(buffer);
70
70
  length = Number(bigIntFromBuffer(buffer, true, true));
71
71
  }
72
72
  }
73
73
  length *= 4;
74
74
  const buffer = new Uint8Array(length);
75
75
  await __classPrivateFieldGet(this, _TransportAbridged_connection, "f").read(buffer);
76
- this.decrypt(buffer);
77
- return buffer;
76
+ return await this.decrypt(buffer);
78
77
  }
79
78
  async send(buffer) {
80
79
  if (!this.initialized) {
@@ -84,8 +83,7 @@ export class TransportAbridged extends Transport {
84
83
  const header = new Uint8Array([bufferLength >= 0x7F ? 0x7F : bufferLength]);
85
84
  const length = bufferLength >= 0x7F ? bufferFromBigInt(bufferLength, 3) : new Uint8Array();
86
85
  const data = concat([header, length, buffer]);
87
- this.encrypt(data);
88
- await __classPrivateFieldGet(this, _TransportAbridged_connection, "f").write(data);
86
+ await __classPrivateFieldGet(this, _TransportAbridged_connection, "f").write(await this.encrypt(data));
89
87
  }
90
88
  deinitialize() {
91
89
  super.deinitialize();
@@ -1 +1 @@
1
- {"version":3,"file":"1_transport_intermediate.d.ts","sourceRoot":"","sources":["../../src/transport/1_transport_intermediate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBAAa,qBAAsB,SAAQ,SAAU,YAAW,SAAS;;gBAK3D,UAAU,EAAE,UAAU,EAAE,UAAU,UAAQ;IAMhD,UAAU;IAaV,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC;IAiB9B,IAAI,CAAC,MAAM,EAAE,UAAU;IAYpB,YAAY;IAKrB,IAAI,WAAW,IAAI,OAAO,CAEzB;CACF"}
1
+ {"version":3,"file":"1_transport_intermediate.d.ts","sourceRoot":"","sources":["../../src/transport/1_transport_intermediate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBAAa,qBAAsB,SAAQ,SAAU,YAAW,SAAS;;gBAK3D,UAAU,EAAE,UAAU,EAAE,UAAU,UAAQ;IAMhD,UAAU;IAaV,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC;IAiB9B,IAAI,CAAC,MAAM,EAAE,UAAU;IAWpB,YAAY;IAKrB,IAAI,WAAW,IAAI,OAAO,CAEzB;CACF"}
@@ -59,16 +59,15 @@ export class TransportIntermediate extends Transport {
59
59
  async receive() {
60
60
  let length;
61
61
  {
62
- const buffer = new Uint8Array(4);
62
+ let buffer = new Uint8Array(4);
63
63
  await __classPrivateFieldGet(this, _TransportIntermediate_connection, "f").read(buffer);
64
- this.decrypt(buffer);
64
+ buffer = await this.decrypt(buffer);
65
65
  const dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
66
66
  length = dataView.getUint32(0, true);
67
67
  }
68
68
  const buffer = new Uint8Array(length);
69
69
  await __classPrivateFieldGet(this, _TransportIntermediate_connection, "f").read(buffer);
70
- this.decrypt(buffer);
71
- return buffer;
70
+ return await this.decrypt(buffer);
72
71
  }
73
72
  async send(buffer) {
74
73
  if (!this.initialized) {
@@ -76,8 +75,7 @@ export class TransportIntermediate extends Transport {
76
75
  }
77
76
  const length = bufferFromBigInt(buffer.length, 4);
78
77
  const data = concat([length, buffer]);
79
- this.encrypt(data);
80
- await __classPrivateFieldGet(this, _TransportIntermediate_connection, "f").write(data);
78
+ await __classPrivateFieldGet(this, _TransportIntermediate_connection, "f").write(await this.encrypt(data));
81
79
  }
82
80
  deinitialize() {
83
81
  super.deinitialize();
@@ -1,3 +1,22 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2024 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
1
20
  export interface SwitchInlineQueryChosenChats {
2
21
  /** The query to type into the user's message box once switched to inline. */
3
22
  query: string;
@@ -1 +1 @@
1
- {"version":3,"file":"0_switch_inline_query_chosen_chats.d.ts","sourceRoot":"","sources":["../../src/types/0_switch_inline_query_chosen_chats.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,4BAA4B;IAC3C,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kEAAkE;IAClE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
1
+ {"version":3,"file":"0_switch_inline_query_chosen_chats.d.ts","sourceRoot":"","sources":["../../src/types/0_switch_inline_query_chosen_chats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,4BAA4B;IAC3C,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kEAAkE;IAClE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
@@ -1 +1,20 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2024 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
1
20
  export {};
@@ -1,3 +1,22 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2024 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
1
20
  import { Api } from "../2_tl.js";
2
21
  import { EntityGetter } from "./_getters.js";
3
22
  import { ChatPChannel, ChatPSupergroup } from "./1_chat_p.js";
@@ -1 +1 @@
1
- {"version":3,"file":"2_forward_header.d.ts","sourceRoot":"","sources":["../../src/types/2_forward_header.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAkB,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAiB,IAAI,EAAE,MAAM,aAAa,CAAC;AAElD,gBAAgB;AAChB,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,gBAAgB;AAChB,MAAM,WAAW,iBAAkB,SAAQ,oBAAoB;IAC7D,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,gBAAgB;AAChB,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IAChE,qBAAqB;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,gBAAgB;AAChB,MAAM,WAAW,uBAAwB,SAAQ,oBAAoB;IACnE,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,gBAAgB;AAChB,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAC/D,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gBAAgB;AAChB,MAAM,WAAW,wBAAyB,SAAQ,oBAAoB;IACpE,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,oBAAoB,GAAG,uBAAuB,GAAG,mBAAmB,GAAG,wBAAwB,CAAC;AAEhJ,wBAAsB,sBAAsB,CAAC,SAAS,EAAE,GAAG,CAAC,gBAAgB,EAAE,SAAS,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CA8C7H"}
1
+ {"version":3,"file":"2_forward_header.d.ts","sourceRoot":"","sources":["../../src/types/2_forward_header.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAkB,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAiB,IAAI,EAAE,MAAM,aAAa,CAAC;AAElD,gBAAgB;AAChB,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,gBAAgB;AAChB,MAAM,WAAW,iBAAkB,SAAQ,oBAAoB;IAC7D,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,gBAAgB;AAChB,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IAChE,qBAAqB;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,gBAAgB;AAChB,MAAM,WAAW,uBAAwB,SAAQ,oBAAoB;IACnE,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,gBAAgB;AAChB,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAC/D,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gBAAgB;AAChB,MAAM,WAAW,wBAAyB,SAAQ,oBAAoB;IACpE,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,oBAAoB,GAAG,uBAAuB,GAAG,mBAAmB,GAAG,wBAAwB,CAAC;AAEhJ,wBAAsB,sBAAsB,CAAC,SAAS,EAAE,GAAG,CAAC,gBAAgB,EAAE,SAAS,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CA8C7H"}
@@ -1,3 +1,22 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2024 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
1
20
  import { unreachable } from "../0_deps.js";
2
21
  import { cleanObject, fromUnixTimestamp } from "../1_utilities.js";
3
22
  import { constructChatP } from "./1_chat_p.js";
@@ -1 +1 @@
1
- {"version":3,"file":"0_env.d.ts","sourceRoot":"","sources":["../../src/utilities/0_env.ts"],"names":[],"mappings":"AAKA,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkBrD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,iBAWrC"}
1
+ {"version":3,"file":"0_env.d.ts","sourceRoot":"","sources":["../../src/utilities/0_env.ts"],"names":[],"mappings":"AA0BA,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkBrD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,iBAWrC"}
@@ -1,3 +1,22 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2024 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
1
20
  import * as dntShim from "../_dnt.shims.js";
2
21
  const prefix = "MTKRUTO__";
3
22
  // deno-lint-ignore no-explicit-any
@@ -1,2 +1,21 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2024 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
1
20
  export declare function gunzip(buffer: Uint8Array): Promise<Uint8Array>;
2
21
  //# sourceMappingURL=0_gunzip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"0_gunzip.d.ts","sourceRoot":"","sources":["../../src/utilities/0_gunzip.ts"],"names":[],"mappings":"AAEA,wBAAsB,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAcpE"}
1
+ {"version":3,"file":"0_gunzip.d.ts","sourceRoot":"","sources":["../../src/utilities/0_gunzip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,wBAAsB,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAcpE"}
@@ -1,3 +1,22 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2024 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
1
20
  import { toArrayBuffer } from "../0_deps.js";
2
21
  export async function gunzip(buffer) {
3
22
  let readable;
@@ -17,11 +17,15 @@
17
17
  * You should have received a copy of the GNU Lesser General Public License
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
+ import * as dntShim from "../_dnt.shims.js";
20
21
  export declare class CTR {
21
22
  #private;
22
- constructor(key: Uint8Array, iv: Uint8Array);
23
- /** This must not be called after destroying. */
24
- call(data: Uint8Array): void;
25
- destroy(): void;
23
+ get _state(): {
24
+ iv: Uint8Array;
25
+ state: number;
26
+ };
27
+ constructor(key: dntShim.CryptoKey, iv: Uint8Array);
28
+ static importKey(key: Uint8Array): Promise<dntShim.CryptoKey>;
29
+ call(data: Uint8Array): Promise<Uint8Array>;
26
30
  }
27
- //# sourceMappingURL=0_crypto.d.ts.map
31
+ //# sourceMappingURL=1_crypto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1_crypto.d.ts","sourceRoot":"","sources":["../../src/utilities/1_crypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAM5C,qBAAa,GAAG;;IAKd,IAAI,MAAM,IAAI;QAAE,EAAE,EAAE,UAAU,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAE9C;gBAEW,GAAG,EAAE,OAAO,CAAC,SAAS,EAAE,EAAE,EAAE,UAAU;WAKrC,SAAS,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;IAI7D,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAuBlD"}
@@ -1,3 +1,15 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7
+ if (kind === "m") throw new TypeError("Private method is not writable");
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
+ };
12
+ var _CTR_key, _CTR_iv, _CTR_incrementPending;
1
13
  /**
2
14
  * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
15
  * Copyright (C) 2023-2024 Roj <https://roj.im/>
@@ -17,32 +29,40 @@
17
29
  * You should have received a copy of the GNU Lesser General Public License
18
30
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
31
  */
20
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
21
- if (kind === "m") throw new TypeError("Private method is not writable");
22
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
23
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
24
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
25
- };
26
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
27
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
28
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
29
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
30
- };
31
- var _CTR_key, _CTR_state;
32
- import { createCtr256State, ctr256, destroyCtr256State } from "../0_deps.js";
32
+ import * as dntShim from "../_dnt.shims.js";
33
+ import { bigIntFromBuffer } from "./0_bigint.js";
34
+ import { bufferFromBigInt } from "./0_buffer.js";
33
35
  export class CTR {
36
+ get _state() {
37
+ return { iv: new Uint8Array(__classPrivateFieldGet(this, _CTR_iv, "f")), state: __classPrivateFieldGet(this, _CTR_incrementPending, "f") };
38
+ }
34
39
  constructor(key, iv) {
35
40
  _CTR_key.set(this, void 0);
36
- _CTR_state.set(this, void 0);
37
- __classPrivateFieldSet(this, _CTR_state, createCtr256State(iv), "f");
41
+ _CTR_iv.set(this, void 0);
42
+ _CTR_incrementPending.set(this, 0);
38
43
  __classPrivateFieldSet(this, _CTR_key, key, "f");
44
+ __classPrivateFieldSet(this, _CTR_iv, iv, "f");
39
45
  }
40
- /** This must not be called after destroying. */
41
- call(data) {
42
- ctr256(data, __classPrivateFieldGet(this, _CTR_key, "f"), __classPrivateFieldGet(this, _CTR_state, "f"));
46
+ static async importKey(key) {
47
+ return await dntShim.crypto.subtle.importKey("raw", key, "AES-CTR", false, ["encrypt"]);
43
48
  }
44
- destroy() {
45
- destroyCtr256State(__classPrivateFieldGet(this, _CTR_state, "f"));
49
+ async call(data) {
50
+ const promise = dntShim.crypto.subtle.encrypt({
51
+ name: "AES-CTR",
52
+ counter: new Uint8Array(__classPrivateFieldGet(this, _CTR_iv, "f")),
53
+ length: __classPrivateFieldGet(this, _CTR_iv, "f").length * 8,
54
+ }, __classPrivateFieldGet(this, _CTR_key, "f"), data);
55
+ const incrementPending = data.length % __classPrivateFieldGet(this, _CTR_iv, "f").length;
56
+ let incrementBy = (data.length - incrementPending) / __classPrivateFieldGet(this, _CTR_iv, "f").length;
57
+ __classPrivateFieldSet(this, _CTR_incrementPending, __classPrivateFieldGet(this, _CTR_incrementPending, "f") + incrementPending, "f");
58
+ while (__classPrivateFieldGet(this, _CTR_incrementPending, "f") >= __classPrivateFieldGet(this, _CTR_iv, "f").length) {
59
+ __classPrivateFieldSet(this, _CTR_incrementPending, __classPrivateFieldGet(this, _CTR_incrementPending, "f") - __classPrivateFieldGet(this, _CTR_iv, "f").length, "f");
60
+ incrementBy += 1;
61
+ }
62
+ if (incrementBy) {
63
+ __classPrivateFieldSet(this, _CTR_iv, bufferFromBigInt(bigIntFromBuffer(__classPrivateFieldGet(this, _CTR_iv, "f"), false, false) + BigInt(incrementBy), 16, false, false), "f");
64
+ }
65
+ return new Uint8Array(await promise);
46
66
  }
47
67
  }
48
- _CTR_key = new WeakMap(), _CTR_state = new WeakMap();
68
+ _CTR_key = new WeakMap(), _CTR_iv = new WeakMap(), _CTR_incrementPending = new WeakMap();
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1_crypto_test.d.ts","sourceRoot":"","sources":["../../src/utilities/1_crypto_test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mtkruto/node",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "MTKruto for Node.js",
5
5
  "author": "Roj <rojvv@icloud.com>",
6
6
  "repository": {
@@ -30,6 +30,6 @@ export { decodeBase64, encodeBase64 } from "./deps/jsr.io/@std/encoding/1.0.5/ba
30
30
  import { contentType as contentType_ } from "./deps/jsr.io/@std/media-types/1.1.0/content_type.js";
31
31
  export declare const contentType: typeof contentType_;
32
32
  export declare function extension(mimeType: string): string;
33
- export { createCtr256State, ctr256, type Ctr256State, destroyCtr256State, ige256Decrypt, ige256Encrypt, init as initTgCrypto } from "./deps/jsr.io/@roj/tgcrypto/0.4.1/dist/mod.js";
33
+ export { ige256Decrypt, ige256Encrypt, init as initTgCrypto } from "./deps/jsr.io/@roj/tgcrypto/1.0.0/dist/mod.js";
34
34
  export { Parser } from "htmlparser2";
35
35
  //# sourceMappingURL=0_deps.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"0_deps.d.ts","sourceRoot":"","sources":["../src/0_deps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,cAAc,wCAAwC,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,0CAA0C,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,qDAAqD,CAAC;AAEpF,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAEzF,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,sDAAsD,CAAC;AACnG,eAAO,MAAM,WAAW,EAAE,OAAO,YAMhC,CAAC;AAEF,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,UAMzC;AAED,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,kBAAkB,EAAE,aAAa,EAAE,aAAa,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAEpL,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"0_deps.d.ts","sourceRoot":"","sources":["../src/0_deps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,cAAc,wCAAwC,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,0CAA0C,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,qDAAqD,CAAC;AAEpF,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAEzF,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,sDAAsD,CAAC;AACnG,eAAO,MAAM,WAAW,EAAE,OAAO,YAMhC,CAAC;AAEF,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,UAMzC;AAED,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAEnH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
package/script/0_deps.js CHANGED
@@ -33,7 +33,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
33
33
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
34
34
  };
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.Parser = exports.initTgCrypto = exports.ige256Encrypt = exports.ige256Decrypt = exports.destroyCtr256State = exports.ctr256 = exports.createCtr256State = exports.contentType = exports.encodeBase64 = exports.decodeBase64 = exports.iterateReader = exports.toArrayBuffer = exports.concat = exports.toFileUrl = exports.join = exports.isAbsolute = exports.extname = exports.basename = void 0;
36
+ exports.Parser = exports.initTgCrypto = exports.ige256Encrypt = exports.ige256Decrypt = exports.contentType = exports.encodeBase64 = exports.decodeBase64 = exports.iterateReader = exports.toArrayBuffer = exports.concat = exports.toFileUrl = exports.join = exports.isAbsolute = exports.extname = exports.basename = void 0;
37
37
  exports.extension = extension;
38
38
  __exportStar(require("./deps/jsr.io/@std/assert/1.0.8/mod.js"), exports);
39
39
  var basename_js_1 = require("./deps/jsr.io/@std/path/1.0.8/basename.js");
@@ -74,10 +74,7 @@ function extension(mimeType) {
74
74
  return (0, extension_js_1.extension)(mimeType) || "unknown";
75
75
  }
76
76
  }
77
- var mod_js_1 = require("./deps/jsr.io/@roj/tgcrypto/0.4.1/dist/mod.js");
78
- Object.defineProperty(exports, "createCtr256State", { enumerable: true, get: function () { return mod_js_1.createCtr256State; } });
79
- Object.defineProperty(exports, "ctr256", { enumerable: true, get: function () { return mod_js_1.ctr256; } });
80
- Object.defineProperty(exports, "destroyCtr256State", { enumerable: true, get: function () { return mod_js_1.destroyCtr256State; } });
77
+ var mod_js_1 = require("./deps/jsr.io/@roj/tgcrypto/1.0.0/dist/mod.js");
81
78
  Object.defineProperty(exports, "ige256Decrypt", { enumerable: true, get: function () { return mod_js_1.ige256Decrypt; } });
82
79
  Object.defineProperty(exports, "ige256Encrypt", { enumerable: true, get: function () { return mod_js_1.ige256Encrypt; } });
83
80
  Object.defineProperty(exports, "initTgCrypto", { enumerable: true, get: function () { return mod_js_1.init; } });
@@ -22,7 +22,6 @@ export * from "./utilities/0_bigint.js";
22
22
  export * from "./utilities/0_buffer.js";
23
23
  export * from "./utilities/0_cache_map.js";
24
24
  export * from "./utilities/0_color.js";
25
- export * from "./utilities/0_crypto.js";
26
25
  export * from "./utilities/0_gunzip.js";
27
26
  export * from "./utilities/0_hash.js";
28
27
  export * from "./utilities/0_mutex.js";
@@ -33,6 +32,7 @@ export * from "./utilities/0_types.js";
33
32
  export * from "./utilities/0_units.js";
34
33
  export * from "./utilities/1_auth.js";
35
34
  export * from "./utilities/1_base64.js";
35
+ export * from "./utilities/1_crypto.js";
36
36
  export * from "./utilities/1_logger.js";
37
37
  export * from "./utilities/1_math.js";
38
38
  export * from "./utilities/1_misc.js";
@@ -1 +1 @@
1
- {"version":3,"file":"1_utilities.d.ts","sourceRoot":"","sources":["../src/1_utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,qBAAqB,CAAC;AAG7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"1_utilities.d.ts","sourceRoot":"","sources":["../src/1_utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,qBAAqB,CAAC;AAG7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
@@ -38,7 +38,6 @@ __exportStar(require("./utilities/0_bigint.js"), exports);
38
38
  __exportStar(require("./utilities/0_buffer.js"), exports);
39
39
  __exportStar(require("./utilities/0_cache_map.js"), exports);
40
40
  __exportStar(require("./utilities/0_color.js"), exports);
41
- __exportStar(require("./utilities/0_crypto.js"), exports);
42
41
  __exportStar(require("./utilities/0_gunzip.js"), exports);
43
42
  __exportStar(require("./utilities/0_hash.js"), exports);
44
43
  __exportStar(require("./utilities/0_mutex.js"), exports);
@@ -49,6 +48,7 @@ __exportStar(require("./utilities/0_types.js"), exports);
49
48
  __exportStar(require("./utilities/0_units.js"), exports);
50
49
  __exportStar(require("./utilities/1_auth.js"), exports);
51
50
  __exportStar(require("./utilities/1_base64.js"), exports);
51
+ __exportStar(require("./utilities/1_crypto.js"), exports);
52
52
  __exportStar(require("./utilities/1_logger.js"), exports);
53
53
  __exportStar(require("./utilities/1_math.js"), exports);
54
54
  __exportStar(require("./utilities/1_misc.js"), exports);
@@ -0,0 +1,18 @@
1
+ export declare function init(): Promise<void>;
2
+ /**
3
+ * Performs IGE-256 encryption.
4
+ *
5
+ * @param data The unencrypted data, larger than a byte, divisible by 16
6
+ * @param key 32-byte encryption key
7
+ * @param iv 32-byte initialization vector
8
+ */
9
+ export declare function ige256Encrypt(data: Uint8Array, key: Uint8Array, iv: Uint8Array): Uint8Array;
10
+ /**
11
+ * Performs IGE-256 decryption.
12
+ *
13
+ * @param data The encrypted data, larger than a byte, divisible by 16
14
+ * @param key 32-byte encryption key
15
+ * @param iv 32-byte initialization vector
16
+ */
17
+ export declare function ige256Decrypt(data: Uint8Array, key: Uint8Array, iv: Uint8Array): Uint8Array;
18
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@roj/tgcrypto/1.0.0/dist/mod.ts"],"names":[],"mappings":"AAMA,wBAAsB,IAAI,kBAEzB;AAgBD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,UAAU,EACf,EAAE,EAAE,UAAU,GACb,UAAU,CAiBZ;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,UAAU,EACf,EAAE,EAAE,UAAU,GACb,UAAU,CAiBZ"}