@mtkruto/node 0.170.0 → 0.180.0

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 (143) hide show
  1. package/esm/0_deps.d.ts +1 -0
  2. package/esm/0_deps.d.ts.map +1 -1
  3. package/esm/0_deps.js +1 -0
  4. package/esm/client/0_params.d.ts +53 -1
  5. package/esm/client/0_params.d.ts.map +1 -1
  6. package/esm/client/0_utilities.d.ts +2 -2
  7. package/esm/client/0_utilities.js +2 -2
  8. package/esm/client/1_client_generic.d.ts +65 -2
  9. package/esm/client/1_client_generic.d.ts.map +1 -1
  10. package/esm/client/2_file_manager.d.ts +9 -1
  11. package/esm/client/2_file_manager.d.ts.map +1 -1
  12. package/esm/client/2_file_manager.js +77 -27
  13. package/esm/client/3_filters.d.ts +6 -0
  14. package/esm/client/3_filters.d.ts.map +1 -1
  15. package/esm/client/3_secret_chat_manager.d.ts +10 -2
  16. package/esm/client/3_secret_chat_manager.d.ts.map +1 -1
  17. package/esm/client/3_secret_chat_manager.js +274 -6
  18. package/esm/client/4_context.d.ts +20 -3
  19. package/esm/client/4_context.d.ts.map +1 -1
  20. package/esm/client/4_context.js +70 -10
  21. package/esm/client/6_client.d.ts +65 -2
  22. package/esm/client/6_client.d.ts.map +1 -1
  23. package/esm/client/6_client.js +80 -1
  24. package/esm/client/6_client_dispatcher.d.ts +65 -2
  25. package/esm/client/6_client_dispatcher.d.ts.map +1 -1
  26. package/esm/client/6_client_dispatcher.js +80 -1
  27. package/esm/deps/jsr.io/@std/crypto/1.1.0/_types.d.ts +9 -0
  28. package/esm/deps/jsr.io/@std/crypto/1.1.0/_types.d.ts.map +1 -0
  29. package/esm/deps/jsr.io/@std/crypto/1.1.0/_types.js +2 -0
  30. package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.d.ts +2 -0
  31. package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.d.ts.map +1 -0
  32. package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.d.ts +69 -0
  33. package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.d.ts.map +1 -0
  34. package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.js +237 -0
  35. package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.js +2277 -0
  36. package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.d.ts +13 -0
  37. package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.d.ts.map +1 -0
  38. package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.js +46 -0
  39. package/esm/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.d.ts +76 -0
  40. package/esm/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.d.ts.map +1 -0
  41. package/esm/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.js +132 -0
  42. package/esm/deps/jsr.io/@std/crypto/1.1.0/crypto.d.ts +149 -0
  43. package/esm/deps/jsr.io/@std/crypto/1.1.0/crypto.d.ts.map +1 -0
  44. package/esm/deps/jsr.io/@std/crypto/1.1.0/crypto.js +270 -0
  45. package/esm/deps/jsr.io/@std/crypto/1.1.0/mod.d.ts +22 -0
  46. package/esm/deps/jsr.io/@std/crypto/1.1.0/mod.d.ts.map +1 -0
  47. package/esm/deps/jsr.io/@std/crypto/1.1.0/mod.js +23 -0
  48. package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts +40 -0
  49. package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts.map +1 -0
  50. package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.js +61 -0
  51. package/esm/tl/0_utilities.d.ts.map +1 -1
  52. package/esm/tl/0_utilities.js +44 -2
  53. package/esm/tl/1_tl_writer.d.ts.map +1 -1
  54. package/esm/tl/1_tl_writer.js +6 -1
  55. package/esm/types/1_photo.d.ts +3 -2
  56. package/esm/types/1_photo.d.ts.map +1 -1
  57. package/esm/types/1_sticker.d.ts +10 -12
  58. package/esm/types/1_sticker.d.ts.map +1 -1
  59. package/esm/types/1_sticker.js +1 -6
  60. package/esm/types/1_video.d.ts +2 -2
  61. package/esm/types/1_video.d.ts.map +1 -1
  62. package/esm/types/1_video_note.d.ts +1 -1
  63. package/esm/types/1_video_note.d.ts.map +1 -1
  64. package/esm/types/2_left_channel_list.d.ts +1 -1
  65. package/esm/types/2_left_channel_list.d.ts.map +1 -1
  66. package/esm/types/2_user.d.ts +1 -1
  67. package/esm/types/2_user.d.ts.map +1 -1
  68. package/esm/types/9_message.d.ts +1 -1
  69. package/esm/types/9_message.d.ts.map +1 -1
  70. package/esm/types/B_update.d.ts +1 -1
  71. package/esm/types/B_update.d.ts.map +1 -1
  72. package/package.json +1 -1
  73. package/script/0_deps.d.ts +1 -0
  74. package/script/0_deps.d.ts.map +1 -1
  75. package/script/0_deps.js +7 -5
  76. package/script/client/0_params.d.ts +53 -1
  77. package/script/client/0_params.d.ts.map +1 -1
  78. package/script/client/0_utilities.d.ts +2 -2
  79. package/script/client/0_utilities.js +2 -2
  80. package/script/client/1_client_generic.d.ts +65 -2
  81. package/script/client/1_client_generic.d.ts.map +1 -1
  82. package/script/client/2_file_manager.d.ts +9 -1
  83. package/script/client/2_file_manager.d.ts.map +1 -1
  84. package/script/client/2_file_manager.js +74 -24
  85. package/script/client/3_filters.d.ts +6 -0
  86. package/script/client/3_filters.d.ts.map +1 -1
  87. package/script/client/3_secret_chat_manager.d.ts +10 -2
  88. package/script/client/3_secret_chat_manager.d.ts.map +1 -1
  89. package/script/client/3_secret_chat_manager.js +274 -6
  90. package/script/client/4_context.d.ts +20 -3
  91. package/script/client/4_context.d.ts.map +1 -1
  92. package/script/client/4_context.js +70 -10
  93. package/script/client/6_client.d.ts +65 -2
  94. package/script/client/6_client.d.ts.map +1 -1
  95. package/script/client/6_client.js +80 -1
  96. package/script/client/6_client_dispatcher.d.ts +65 -2
  97. package/script/client/6_client_dispatcher.d.ts.map +1 -1
  98. package/script/client/6_client_dispatcher.js +80 -1
  99. package/script/deps/jsr.io/@std/crypto/1.1.0/_types.d.ts +9 -0
  100. package/script/deps/jsr.io/@std/crypto/1.1.0/_types.d.ts.map +1 -0
  101. package/script/deps/jsr.io/@std/crypto/1.1.0/_types.js +3 -0
  102. package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.d.ts +2 -0
  103. package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.d.ts.map +1 -0
  104. package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.d.ts +69 -0
  105. package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.d.ts.map +1 -0
  106. package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.js +255 -0
  107. package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.js +2315 -0
  108. package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.d.ts +13 -0
  109. package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.d.ts.map +1 -0
  110. package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.js +51 -0
  111. package/script/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.d.ts +76 -0
  112. package/script/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.d.ts.map +1 -0
  113. package/script/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.js +169 -0
  114. package/script/deps/jsr.io/@std/crypto/1.1.0/crypto.d.ts +149 -0
  115. package/script/deps/jsr.io/@std/crypto/1.1.0/crypto.d.ts.map +1 -0
  116. package/script/deps/jsr.io/@std/crypto/1.1.0/crypto.js +306 -0
  117. package/script/deps/jsr.io/@std/crypto/1.1.0/mod.d.ts +22 -0
  118. package/script/deps/jsr.io/@std/crypto/1.1.0/mod.d.ts.map +1 -0
  119. package/script/deps/jsr.io/@std/crypto/1.1.0/mod.js +39 -0
  120. package/script/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts +40 -0
  121. package/script/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts.map +1 -0
  122. package/script/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.js +64 -0
  123. package/script/tl/0_utilities.d.ts.map +1 -1
  124. package/script/tl/0_utilities.js +43 -1
  125. package/script/tl/1_tl_writer.d.ts.map +1 -1
  126. package/script/tl/1_tl_writer.js +6 -1
  127. package/script/types/1_photo.d.ts +3 -2
  128. package/script/types/1_photo.d.ts.map +1 -1
  129. package/script/types/1_sticker.d.ts +10 -12
  130. package/script/types/1_sticker.d.ts.map +1 -1
  131. package/script/types/1_sticker.js +1 -6
  132. package/script/types/1_video.d.ts +2 -2
  133. package/script/types/1_video.d.ts.map +1 -1
  134. package/script/types/1_video_note.d.ts +1 -1
  135. package/script/types/1_video_note.d.ts.map +1 -1
  136. package/script/types/2_left_channel_list.d.ts +1 -1
  137. package/script/types/2_left_channel_list.d.ts.map +1 -1
  138. package/script/types/2_user.d.ts +1 -1
  139. package/script/types/2_user.d.ts.map +1 -1
  140. package/script/types/9_message.d.ts +1 -1
  141. package/script/types/9_message.d.ts.map +1 -1
  142. package/script/types/B_update.d.ts +1 -1
  143. package/script/types/B_update.d.ts.map +1 -1
@@ -0,0 +1,306 @@
1
+ "use strict";
2
+ // Copyright 2018-2026 the Deno authors. MIT license.
3
+ // This module is browser compatible.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function(o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
+ return ar;
26
+ };
27
+ return ownKeys(o);
28
+ };
29
+ return function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ })();
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.crypto = exports.DIGEST_ALGORITHM_NAMES = void 0;
39
+ /**
40
+ * Extensions to the
41
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API | Web Crypto API}
42
+ * supporting additional encryption APIs, but also delegating to the built-in
43
+ * APIs when possible.
44
+ *
45
+ * Provides additional digest algorithms that are not part of the WebCrypto
46
+ * standard as well as a `subtle.digest` and `subtle.digestSync` methods.
47
+ *
48
+ * The {@linkcode KeyStack} export implements the {@linkcode KeyRing} interface
49
+ * for managing rotatable keys for signing data to prevent tampering, like with
50
+ * HTTP cookies.
51
+ *
52
+ * ## Supported algorithms
53
+ *
54
+ * Here is a list of supported algorithms. If the algorithm name in WebCrypto
55
+ * and Wasm/Rust is the same, this library prefers to use the implementation
56
+ * provided by WebCrypto.
57
+ *
58
+ * Length-adjustable algorithms support the
59
+ * {@linkcode DigestAlgorithmObject.length} option.
60
+ *
61
+ * WebCrypto:
62
+ * - `SHA-384`
63
+ * - `SHA-256` (length-extendable)
64
+ * - `SHA-512` (length-extendable)
65
+ *
66
+ * Wasm/Rust:
67
+ * - `BLAKE2B`
68
+ * - `BLAKE2B-128`
69
+ * - `BLAKE2B-160`
70
+ * - `BLAKE2B-224`
71
+ * - `BLAKE2B-256`
72
+ * - `BLAKE2B-384`
73
+ * - `BLAKE2S`
74
+ * - `BLAKE3` (length-adjustable)
75
+ * - `KECCAK-224`
76
+ * - `KECCAK-256`
77
+ * - `KECCAK-384`
78
+ * - `KECCAK-512`
79
+ * - `SHA-384`
80
+ * - `SHA3-224`
81
+ * - `SHA3-256`
82
+ * - `SHA3-384`
83
+ * - `SHA3-512`
84
+ * - `SHAKE128` (length-adjustable)
85
+ * - `SHAKE256` (length-adjustable)
86
+ * - `TIGER`
87
+ * - `RIPEMD-160` (length-extendable)
88
+ * - `SHA-224` (length-extendable)
89
+ * - `SHA-256` (length-extendable)
90
+ * - `SHA-512` (length-extendable)
91
+ * - `MD4` (length-extendable and collidable)
92
+ * - `MD5` (length-extendable and collidable)
93
+ * - `SHA-1` (length-extendable and collidable)
94
+ * - `FNV32` (non-cryptographic)
95
+ * - `FNV32A` (non-cryptographic)
96
+ * - `FNV64` (non-cryptographic)
97
+ * - `FNV64A` (non-cryptographic)
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * import { crypto } from "@std/crypto";
102
+ *
103
+ * // This will delegate to the runtime's WebCrypto implementation.
104
+ * console.log(
105
+ * new Uint8Array(
106
+ * await crypto.subtle.digest(
107
+ * "SHA-384",
108
+ * new TextEncoder().encode("hello world"),
109
+ * ),
110
+ * ),
111
+ * );
112
+ *
113
+ * // This will use a bundled Wasm/Rust implementation.
114
+ * console.log(
115
+ * new Uint8Array(
116
+ * await crypto.subtle.digest(
117
+ * "BLAKE3",
118
+ * new TextEncoder().encode("hello world"),
119
+ * ),
120
+ * ),
121
+ * );
122
+ * ```
123
+ *
124
+ * @example Convert hash to a string
125
+ *
126
+ * ```ts
127
+ * import {
128
+ * crypto,
129
+ * } from "@std/crypto";
130
+ * import { encodeHex } from "@std/encoding/hex"
131
+ * import { encodeBase64 } from "@std/encoding/base64"
132
+ *
133
+ * const hash = await crypto.subtle.digest(
134
+ * "SHA-384",
135
+ * new TextEncoder().encode("You hear that Mr. Anderson?"),
136
+ * );
137
+ *
138
+ * // Hex encoding
139
+ * console.log(encodeHex(hash));
140
+ *
141
+ * // Or with base64 encoding
142
+ * console.log(encodeBase64(hash));
143
+ * ```
144
+ *
145
+ * @module
146
+ */
147
+ const dntShim = __importStar(require("../../../../../_dnt.shims.js"));
148
+ const mod_js_1 = require("./_wasm/mod.js");
149
+ Object.defineProperty(exports, "DIGEST_ALGORITHM_NAMES", { enumerable: true, get: function () { return mod_js_1.DIGEST_ALGORITHM_NAMES; } });
150
+ /** Digest algorithms supported by WebCrypto. */
151
+ const WEB_CRYPTO_DIGEST_ALGORITHM_NAMES = [
152
+ "SHA-384",
153
+ "SHA-256",
154
+ "SHA-512",
155
+ // insecure (length-extendable and collidable):
156
+ "SHA-1",
157
+ ];
158
+ /**
159
+ * A copy of the global WebCrypto interface, with methods bound so they're
160
+ * safe to re-export.
161
+ */
162
+ const webCrypto = ((crypto) => ({
163
+ getRandomValues: crypto.getRandomValues?.bind(crypto),
164
+ randomUUID: crypto.randomUUID?.bind(crypto),
165
+ subtle: {
166
+ decrypt: crypto.subtle?.decrypt?.bind(crypto.subtle),
167
+ deriveBits: crypto.subtle?.deriveBits?.bind(crypto.subtle),
168
+ deriveKey: crypto.subtle?.deriveKey?.bind(crypto.subtle),
169
+ digest: crypto.subtle?.digest?.bind(crypto.subtle),
170
+ encrypt: crypto.subtle?.encrypt?.bind(crypto.subtle),
171
+ exportKey: crypto.subtle?.exportKey?.bind(crypto.subtle),
172
+ generateKey: crypto.subtle?.generateKey?.bind(crypto.subtle),
173
+ importKey: crypto.subtle?.importKey?.bind(crypto.subtle),
174
+ sign: crypto.subtle?.sign?.bind(crypto.subtle),
175
+ unwrapKey: crypto.subtle?.unwrapKey?.bind(crypto.subtle),
176
+ verify: crypto.subtle?.verify?.bind(crypto.subtle),
177
+ wrapKey: crypto.subtle?.wrapKey?.bind(crypto.subtle),
178
+ },
179
+ }))(dntShim.dntGlobalThis.crypto);
180
+ function toUint8Array(data) {
181
+ if (data instanceof Uint8Array) {
182
+ return data;
183
+ }
184
+ else if (ArrayBuffer.isView(data)) {
185
+ return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
186
+ }
187
+ else if (data instanceof ArrayBuffer) {
188
+ return new Uint8Array(data);
189
+ }
190
+ return undefined;
191
+ }
192
+ /**
193
+ * A wrapper for WebCrypto which adds support for additional non-standard
194
+ * algorithms, but delegates to the runtime WebCrypto implementation whenever
195
+ * possible.
196
+ */
197
+ const stdCrypto = ((x) => x)({
198
+ ...webCrypto,
199
+ subtle: {
200
+ ...webCrypto.subtle,
201
+ /**
202
+ * Polyfills stream support until the Web Crypto API does so:
203
+ * @see {@link https://github.com/wintercg/proposal-webcrypto-streams}
204
+ */
205
+ async digest(algorithm, data) {
206
+ const { name, length } = normalizeAlgorithm(algorithm);
207
+ assertValidDigestLength(length);
208
+ // We delegate to WebCrypto whenever possible,
209
+ if (
210
+ // if the algorithm is supported by the WebCrypto standard,
211
+ WEB_CRYPTO_DIGEST_ALGORITHM_NAMES.includes(name) &&
212
+ // and the data is a single buffer,
213
+ isBufferSource(data)) {
214
+ return await webCrypto.subtle.digest(algorithm, data);
215
+ }
216
+ else if (mod_js_1.DIGEST_ALGORITHM_NAMES.includes(name)) {
217
+ if (isBufferSource(data)) {
218
+ // Otherwise, we use our bundled Wasm implementation via digestSync
219
+ // if it supports the algorithm.
220
+ return stdCrypto.subtle.digestSync(algorithm, data);
221
+ }
222
+ else if (isIterable(data)) {
223
+ return stdCrypto.subtle.digestSync(algorithm, data);
224
+ }
225
+ else if (isAsyncIterable(data)) {
226
+ const context = new mod_js_1.DigestContext(name);
227
+ for await (const chunk of data) {
228
+ const chunkBytes = toUint8Array(chunk);
229
+ if (!chunkBytes) {
230
+ throw new TypeError("Cannot digest the data: A chunk is not ArrayBuffer nor ArrayBufferView");
231
+ }
232
+ context.update(chunkBytes);
233
+ }
234
+ return context.digestAndDrop(length).buffer;
235
+ }
236
+ else {
237
+ throw new TypeError(
238
+ // deno-lint-ignore deno-style-guide/error-message
239
+ "data must be a BufferSource or [Async]Iterable<BufferSource>");
240
+ }
241
+ }
242
+ // (TypeScript type definitions prohibit this case.) If they're trying
243
+ // to call an algorithm we don't recognize, pass it along to WebCrypto
244
+ // in case it's a non-standard algorithm supported by the the runtime
245
+ // they're using.
246
+ return await webCrypto.subtle.digest(algorithm, data);
247
+ },
248
+ digestSync(algorithm, data) {
249
+ const { name, length } = normalizeAlgorithm(algorithm);
250
+ assertValidDigestLength(length);
251
+ if (isBufferSource(data)) {
252
+ const bytes = toUint8Array(data);
253
+ return (0, mod_js_1.digest)(name, bytes, length).buffer;
254
+ }
255
+ if (isIterable(data)) {
256
+ const context = new mod_js_1.DigestContext(name);
257
+ for (const chunk of data) {
258
+ const chunkBytes = toUint8Array(chunk);
259
+ if (!chunkBytes) {
260
+ throw new TypeError("Cannot digest the data: A chunk is not ArrayBuffer nor ArrayBufferView");
261
+ }
262
+ context.update(chunkBytes);
263
+ }
264
+ return context.digestAndDrop(length).buffer;
265
+ }
266
+ throw new TypeError(
267
+ // deno-lint-ignore deno-style-guide/error-message
268
+ "data must be a BufferSource or Iterable<BufferSource>");
269
+ },
270
+ },
271
+ });
272
+ exports.crypto = stdCrypto;
273
+ /*
274
+ * The largest digest length the current Wasm implementation can support. This
275
+ * is the value of `isize::MAX` on 32-bit platforms like Wasm, which is the
276
+ * maximum allowed capacity of a Rust `Vec<u8>`.
277
+ */
278
+ const MAX_DIGEST_LENGTH = 0x7FFF_FFFF;
279
+ /**
280
+ * Asserts that a number is a valid length for a digest, which must be an
281
+ * integer that fits in a Rust `Vec<u8>`, or be undefined.
282
+ */
283
+ function assertValidDigestLength(value) {
284
+ if (value !== undefined &&
285
+ (value < 0 || value > MAX_DIGEST_LENGTH ||
286
+ !Number.isInteger(value))) {
287
+ throw new RangeError(`length must be an integer between 0 and ${MAX_DIGEST_LENGTH}, inclusive`);
288
+ }
289
+ }
290
+ function normalizeAlgorithm(algorithm) {
291
+ return ((typeof algorithm === "string")
292
+ ? { name: algorithm.toUpperCase() }
293
+ : {
294
+ ...algorithm,
295
+ name: algorithm.name.toUpperCase(),
296
+ });
297
+ }
298
+ function isBufferSource(obj) {
299
+ return obj instanceof ArrayBuffer || ArrayBuffer.isView(obj);
300
+ }
301
+ function isIterable(obj) {
302
+ return typeof obj[Symbol.iterator] === "function";
303
+ }
304
+ function isAsyncIterable(obj) {
305
+ return typeof obj[Symbol.asyncIterator] === "function";
306
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Extensions to the
3
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API | Web Crypto}
4
+ * supporting additional encryption APIs, but also delegating to the built-in
5
+ * APIs when possible.
6
+ *
7
+ * ```ts no-assert
8
+ * import { crypto } from "@std/crypto/crypto";
9
+ *
10
+ * const message = "Hello, Deno!";
11
+ * const encoder = new TextEncoder();
12
+ * const data = encoder.encode(message);
13
+ *
14
+ * await crypto.subtle.digest("BLAKE3", data);
15
+ * ```
16
+ *
17
+ * @module
18
+ */
19
+ export * from "./aes_gcm.js";
20
+ export * from "./crypto.js";
21
+ export * from "./timing_safe_equal.js";
22
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/crypto/1.1.0/mod.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ // Copyright 2018-2026 the Deno authors. MIT license.
3
+ // This module is browser compatible.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ /**
20
+ * Extensions to the
21
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API | Web Crypto}
22
+ * supporting additional encryption APIs, but also delegating to the built-in
23
+ * APIs when possible.
24
+ *
25
+ * ```ts no-assert
26
+ * import { crypto } from "@std/crypto/crypto";
27
+ *
28
+ * const message = "Hello, Deno!";
29
+ * const encoder = new TextEncoder();
30
+ * const data = encoder.encode(message);
31
+ *
32
+ * await crypto.subtle.digest("BLAKE3", data);
33
+ * ```
34
+ *
35
+ * @module
36
+ */
37
+ __exportStar(require("./aes_gcm.js"), exports);
38
+ __exportStar(require("./crypto.js"), exports);
39
+ __exportStar(require("./timing_safe_equal.js"), exports);
@@ -0,0 +1,40 @@
1
+ /**
2
+ * When checking the values of cryptographic hashes are equal, default
3
+ * comparisons can be susceptible to timing based attacks, where attacker is
4
+ * able to find out information about the host system by repeatedly checking
5
+ * response times to equality comparisons of values.
6
+ *
7
+ * It is likely some form of timing safe equality will make its way to the
8
+ * WebCrypto standard (see:
9
+ * {@link https://github.com/w3c/webcrypto/issues/270 | w3c/webcrypto#270}), but until
10
+ * that time, `timingSafeEqual()` is provided.
11
+ *
12
+ * Note: This is a best-effort constant-time comparison implemented in
13
+ * JavaScript. The V8 JIT compiler does not provide formal constant-time
14
+ * guarantees, and inputs backed by `SharedArrayBuffer` are susceptible to
15
+ * concurrent modification during comparison.
16
+ *
17
+ * @example Usage
18
+ * ```ts
19
+ * import { timingSafeEqual } from "@std/crypto/timing-safe-equal";
20
+ * import { assert } from "@std/assert";
21
+ *
22
+ * const a = await crypto.subtle.digest(
23
+ * "SHA-384",
24
+ * new TextEncoder().encode("hello world"),
25
+ * );
26
+ * const b = await crypto.subtle.digest(
27
+ * "SHA-384",
28
+ * new TextEncoder().encode("hello world"),
29
+ * );
30
+ *
31
+ * assert(timingSafeEqual(a, b));
32
+ * ```
33
+ *
34
+ * @param a The first value to compare.
35
+ * @param b The second value to compare.
36
+ * @returns `true` if the values are equal, otherwise `false`.
37
+ * @throws {TypeError} If the byte lengths of the two buffers are not equal.
38
+ */
39
+ export declare function timingSafeEqual(a: ArrayBufferView | ArrayBufferLike, b: ArrayBufferView | ArrayBufferLike): boolean;
40
+ //# sourceMappingURL=timing_safe_equal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timing_safe_equal.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,eAAe,CAC7B,CAAC,EAAE,eAAe,GAAG,eAAe,EACpC,CAAC,EAAE,eAAe,GAAG,eAAe,GACnC,OAAO,CAcT"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ // Copyright 2018-2026 the Deno authors. MIT license.
3
+ // This module is browser compatible.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.timingSafeEqual = timingSafeEqual;
6
+ function toUint8Array(value) {
7
+ if (value instanceof Uint8Array) {
8
+ return value;
9
+ }
10
+ return ArrayBuffer.isView(value)
11
+ ? new Uint8Array(value.buffer, value.byteOffset, value.byteLength)
12
+ : new Uint8Array(value);
13
+ }
14
+ /**
15
+ * When checking the values of cryptographic hashes are equal, default
16
+ * comparisons can be susceptible to timing based attacks, where attacker is
17
+ * able to find out information about the host system by repeatedly checking
18
+ * response times to equality comparisons of values.
19
+ *
20
+ * It is likely some form of timing safe equality will make its way to the
21
+ * WebCrypto standard (see:
22
+ * {@link https://github.com/w3c/webcrypto/issues/270 | w3c/webcrypto#270}), but until
23
+ * that time, `timingSafeEqual()` is provided.
24
+ *
25
+ * Note: This is a best-effort constant-time comparison implemented in
26
+ * JavaScript. The V8 JIT compiler does not provide formal constant-time
27
+ * guarantees, and inputs backed by `SharedArrayBuffer` are susceptible to
28
+ * concurrent modification during comparison.
29
+ *
30
+ * @example Usage
31
+ * ```ts
32
+ * import { timingSafeEqual } from "@std/crypto/timing-safe-equal";
33
+ * import { assert } from "@std/assert";
34
+ *
35
+ * const a = await crypto.subtle.digest(
36
+ * "SHA-384",
37
+ * new TextEncoder().encode("hello world"),
38
+ * );
39
+ * const b = await crypto.subtle.digest(
40
+ * "SHA-384",
41
+ * new TextEncoder().encode("hello world"),
42
+ * );
43
+ *
44
+ * assert(timingSafeEqual(a, b));
45
+ * ```
46
+ *
47
+ * @param a The first value to compare.
48
+ * @param b The second value to compare.
49
+ * @returns `true` if the values are equal, otherwise `false`.
50
+ * @throws {TypeError} If the byte lengths of the two buffers are not equal.
51
+ */
52
+ function timingSafeEqual(a, b) {
53
+ if (a.byteLength !== b.byteLength) {
54
+ throw new TypeError(`Cannot compare buffers of different byte lengths (${a.byteLength} vs ${b.byteLength})`);
55
+ }
56
+ const ua = toUint8Array(a);
57
+ const ub = toUint8Array(b);
58
+ const length = ua.length;
59
+ let out = 0;
60
+ for (let i = 0; i < length; i++) {
61
+ out |= ua[i] ^ ub[i];
62
+ }
63
+ return out === 0;
64
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"0_utilities.d.ts","sourceRoot":"","sources":["../../src/tl/0_utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;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,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK7D;AAID,eAAO,MAAM,CAAC,MAAM,CAAC;AACrB,eAAO,MAAM,MAAM,YAAa,CAAC;AACjC,eAAO,MAAM,SAAS,aAAa,CAAC;AACpC,eAAO,MAAM,UAAU,aAAa,CAAC;AAErC,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEhE"}
@@ -45,7 +45,49 @@ function analyzeOptionalParam(ntype) {
45
45
  return { flagField, bitIndex };
46
46
  }
47
47
  function repr(value) {
48
- return value === undefined ? "undefined" : value === null ? null : (typeof value === "object" && "_" in value) ? value._ : value.constructor.name;
48
+ if (typeof value === "bigint") {
49
+ return `${value}n`;
50
+ }
51
+ else if (typeof value === "string") {
52
+ return `"${value}"`;
53
+ }
54
+ else if (typeof value === "number" || typeof value === "boolean") {
55
+ return `${value}`;
56
+ }
57
+ else if (value === undefined) {
58
+ return "undefined";
59
+ }
60
+ else if (value instanceof Uint8Array) {
61
+ if (value.byteLength > 1024) {
62
+ return `${value.byteLength} bytes`;
63
+ }
64
+ else {
65
+ return `Uint8Array.fromBase64("${(0, _0_deps_js_1.encodeBase64)(value)}")`;
66
+ }
67
+ }
68
+ else if (Array.isArray(value)) {
69
+ if (value.length === 0) {
70
+ return "[]";
71
+ }
72
+ return `[\n ${value.map((value) => indentRepr(value)).join(",\n ")}\n]`;
73
+ }
74
+ else if (value === null) {
75
+ return value;
76
+ }
77
+ else if (typeof value === "object" && "_" in value) {
78
+ let s = "{\n";
79
+ for (const [k, v] of Object.entries(value)) {
80
+ s += ` ${k}: ${indentRepr(v)},\n`;
81
+ }
82
+ s += "}";
83
+ return s;
84
+ }
85
+ else {
86
+ return value.constructor.name;
87
+ }
88
+ }
89
+ function indentRepr(value) {
90
+ return `${repr(value)}`.replaceAll("\n", "\n ");
49
91
  }
50
92
  // deno-lint-ignore no-explicit-any
51
93
  function toJSON(object) {
@@ -1 +1 @@
1
- {"version":3,"file":"1_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B;;IAO9D,IAAI,MAAM,IAAI,UAAU,CAAC,WAAW,CAAC,CAMpC;IAED,KAAK,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,IAAI;IAKtC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,UAAO,GAAG,OAAO,IAAI;IAKrD,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,UAAO,GAAG,OAAO,IAAI;IAKrD,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,UAAO,GAAG,OAAO,IAAI;IAKrD,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,IAAI;IAOxC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,UAAO,GAAG,OAAO,IAAI;IAKtD,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,UAAO,GAAG,OAAO,IAAI;IAKtD,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,IAAI;IAkB1C,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,IAAI;IAKxC,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,IAAI;CAyLrD"}
@@ -28,14 +28,19 @@ const _0_int_js_1 = require("../utilities/0_int.js");
28
28
  const _1_utilities_js_1 = require("../1_utilities.js");
29
29
  class TLWriter {
30
30
  _buffer = new Uint8Array();
31
+ #chunks = new Array();
31
32
  #path = new Array();
32
33
  constructor() {
33
34
  }
34
35
  get buffer() {
36
+ if (this.#chunks.length > 0) {
37
+ this._buffer = (0, _0_deps_js_1.concat)([this._buffer, ...this.#chunks]);
38
+ this.#chunks.length = 0;
39
+ }
35
40
  return this._buffer;
36
41
  }
37
42
  write(buffer) {
38
- this._buffer = (0, _0_deps_js_1.concat)([this._buffer, buffer]);
43
+ this.#chunks.push(buffer);
39
44
  return this;
40
45
  }
41
46
  writeInt24(int, isSigned = true) {
@@ -25,12 +25,13 @@ export interface Photo {
25
25
  fileId: string;
26
26
  /** A file identifier that can be used to identify this file. */
27
27
  fileUniqueId: string;
28
- /** Photo width */
28
+ /** The width of the photo. */
29
29
  width: number;
30
- /** Photo height */
30
+ /** The height of the photo. */
31
31
  height: number;
32
32
  /** Size of the file in bytes. */
33
33
  fileSize: number;
34
+ /** The photo's thumbnails. */
34
35
  thumbnails: Thumbnail[];
35
36
  }
36
37
  export declare function constructPhoto(photo: Api.photo): Photo;
@@ -1 +1 @@
1
- {"version":3,"file":"1_photo.d.ts","sourceRoot":"","sources":["../../src/types/1_photo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEtE,eAAe;AACf,MAAM,WAAW,KAAK;IACpB,yEAAyE;IACzE,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,KAAK,CAStD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG;IAAE,KAAK,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC;IAAC,OAAO,EAAE,GAAG,CAAC,SAAS,CAAA;CAAE,CAalG"}
1
+ {"version":3,"file":"1_photo.d.ts","sourceRoot":"","sources":["../../src/types/1_photo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEtE,eAAe;AACf,MAAM,WAAW,KAAK;IACpB,yEAAyE;IACzE,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,KAAK,CAStD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG;IAAE,KAAK,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC;IAAC,OAAO,EAAE,GAAG,CAAC,SAAS,CAAA;CAAE,CAalG"}
@@ -27,30 +27,28 @@ export interface Sticker {
27
27
  fileId: string;
28
28
  /** A file identifier that can be used to identify this file. */
29
29
  fileUniqueId: string;
30
- /** Type of the sticker, currently one of "regular", "mask", "customEmoji". The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video. */
30
+ /** Type of the sticker, currently one of "regular", "mask", "customEmoji". The type of the sticker is independent from its format, which is determined by the fields isAnimated and isVideo. */
31
31
  type: "regular" | "mask" | "customEmoji";
32
- /** Sticker width */
32
+ /** The width of the sticker. */
33
33
  width: number;
34
- /** Sticker height */
34
+ /** The height of the sticker. */
35
35
  height: number;
36
- /** True, if the sticker is [animated](https://telegram.org/blog/animated-stickers) */
36
+ /** Whether the sticker is animated. */
37
37
  isAnimated: boolean;
38
- /** True, if the sticker is a [video sticker](https://telegram.org/blog/video-stickers-better-reactions) */
38
+ /** Whether the sticker is a video. */
39
39
  isVideo: boolean;
40
- /** Sticker thumbnail in the .WEBP or .JPG format */
40
+ /** Thumbnails of the sticker in the WebP or JPG. */
41
41
  thumbnails: Thumbnail[];
42
- /** Emoji associated with the sticker */
42
+ /** The emoji associated with the sticker. */
43
43
  emoji?: string;
44
- /** Name of the sticker set to which the sticker belongs */
44
+ /** Name of the sticker set where the sticker belongs. */
45
45
  setName?: string;
46
- /** For premium regular stickers, premium animation for the sticker */
47
- premiumAnimation?: File;
48
46
  /** For mask stickers, the position where the mask should be placed */
49
47
  maskPosition?: MaskPosition;
50
48
  /** For custom emoji stickers, unique identifier of the custom emoji */
51
49
  customEmojiId?: string;
52
- /** True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places */
53
- needsRepainting?: boolean;
50
+ /** Whether the sticker needs repainting. */
51
+ isRepaintingNeeded?: boolean;
54
52
  /** File size in bytes */
55
53
  fileSize?: number;
56
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"1_sticker.d.ts","sourceRoot":"","sources":["../../src/types/1_sticker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEtE,iBAAiB;AACjB,MAAM,WAAW,OAAO;IACtB,yEAAyE;IACzE,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;IACrB,kMAAkM;IAClM,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,aAAa,CAAC;IACzC,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,sFAAsF;IACtF,UAAU,EAAE,OAAO,CAAC;IACpB,2GAA2G;IAC3G,OAAO,EAAE,OAAO,CAAC;IACjB,oDAAoD;IACpD,U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K,GAAG,OAAO,CAAC,OAAO,CAAC,CAKlL;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,aAAa,SAAK,GAAG,OAAO,CAsBxJ;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,WAAW,CAAC,qCAAqC,GAAG,WAAW,CAAC,+BAA+B,GAAG,WAAW,CAAC,6BAA6B,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAkBtO"}
@@ -47,10 +47,9 @@ function constructSticker2(document, fileId, fileUniqueId, setName, customEmojiI
47
47
  thumbnails: document.thumbs ? document.thumbs.map((v) => _2_tl_js_1.Api.is("photoSize", v) ? (0, _0_thumbnail_js_1.constructThumbnail)(v, document) : null).filter((v) => v) : [],
48
48
  emoji: (customEmojiAttribute ? customEmojiAttribute.alt : stickerAttribute.alt) || undefined,
49
49
  setName,
50
- premiumAnimation: undefined, // TODO
51
50
  maskPosition: stickerAttribute ? stickerAttribute.mask_coords ? (0, _0_mask_position_js_1.constructMaskPosition)(stickerAttribute.mask_coords) : undefined : undefined,
52
51
  customEmojiId: customEmojiAttribute ? customEmojiId : undefined,
53
- needsRepainting: customEmojiAttribute ? !!customEmojiAttribute.text_color : undefined,
52
+ isRepaintingNeeded: customEmojiAttribute ? !!customEmojiAttribute.text_color : undefined,
54
53
  fileSize: Number(document.size),
55
54
  });
56
55
  }
@@ -69,10 +68,6 @@ function constructSticker3(document, fileId, fileUniqueId) {
69
68
  thumbnails: [],
70
69
  emoji: stickerAttribute.alt || undefined,
71
70
  setName: _2_tl_js_1.Api.is("inputStickerSetShortName", stickerAttribute.stickerset) ? stickerAttribute.stickerset.short_name : undefined,
72
- premiumAnimation: undefined, // TODO
73
- maskPosition: undefined,
74
- customEmojiId: undefined,
75
- needsRepainting: undefined,
76
71
  fileSize: Number(document.size),
77
72
  });
78
73
  }