@mtkruto/node 0.171.0 → 0.180.1
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.
- package/esm/0_deps.d.ts +1 -0
- package/esm/0_deps.d.ts.map +1 -1
- package/esm/0_deps.js +1 -0
- package/esm/client/0_params.d.ts +54 -8
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/1_client_generic.d.ts +72 -1
- package/esm/client/1_client_generic.d.ts.map +1 -1
- package/esm/client/2_file_manager.d.ts +9 -1
- package/esm/client/2_file_manager.d.ts.map +1 -1
- package/esm/client/2_file_manager.js +93 -37
- package/esm/client/3_secret_chat_manager.d.ts +11 -2
- package/esm/client/3_secret_chat_manager.d.ts.map +1 -1
- package/esm/client/3_secret_chat_manager.js +322 -11
- package/esm/client/4_context.d.ts +24 -6
- package/esm/client/4_context.d.ts.map +1 -1
- package/esm/client/4_context.js +53 -0
- package/esm/client/6_client.d.ts +72 -1
- package/esm/client/6_client.d.ts.map +1 -1
- package/esm/client/6_client.js +89 -0
- package/esm/client/6_client_dispatcher.d.ts +72 -1
- package/esm/client/6_client_dispatcher.d.ts.map +1 -1
- package/esm/client/6_client_dispatcher.js +89 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/_types.d.ts +9 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/_types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/_types.js +2 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.d.ts +2 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.d.ts +69 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.js +237 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.js +2277 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.d.ts +13 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.js +46 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.d.ts +76 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.js +132 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/crypto.d.ts +149 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/crypto.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/crypto.js +270 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/mod.d.ts +22 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/mod.js +23 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts +40 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.js +61 -0
- package/esm/tl/0_utilities.d.ts.map +1 -1
- package/esm/tl/0_utilities.js +44 -2
- package/esm/tl/1_tl_writer.d.ts.map +1 -1
- package/esm/tl/1_tl_writer.js +6 -1
- package/esm/types/1_sticker.d.ts +7 -9
- package/esm/types/1_sticker.d.ts.map +1 -1
- package/esm/types/1_sticker.js +1 -6
- package/package.json +1 -1
- package/script/0_deps.d.ts +1 -0
- package/script/0_deps.d.ts.map +1 -1
- package/script/0_deps.js +7 -5
- package/script/client/0_params.d.ts +54 -8
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/1_client_generic.d.ts +72 -1
- package/script/client/1_client_generic.d.ts.map +1 -1
- package/script/client/2_file_manager.d.ts +9 -1
- package/script/client/2_file_manager.d.ts.map +1 -1
- package/script/client/2_file_manager.js +90 -34
- package/script/client/3_secret_chat_manager.d.ts +11 -2
- package/script/client/3_secret_chat_manager.d.ts.map +1 -1
- package/script/client/3_secret_chat_manager.js +319 -8
- package/script/client/4_context.d.ts +24 -6
- package/script/client/4_context.d.ts.map +1 -1
- package/script/client/4_context.js +53 -0
- package/script/client/6_client.d.ts +72 -1
- package/script/client/6_client.d.ts.map +1 -1
- package/script/client/6_client.js +89 -0
- package/script/client/6_client_dispatcher.d.ts +72 -1
- package/script/client/6_client_dispatcher.d.ts.map +1 -1
- package/script/client/6_client_dispatcher.js +89 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/_types.d.ts +9 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/_types.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/_types.js +3 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.d.ts +2 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.d.ts +69 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.js +255 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.js +2315 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.d.ts +13 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.js +51 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.d.ts +76 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.js +169 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/crypto.d.ts +149 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/crypto.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/crypto.js +306 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/mod.d.ts +22 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/mod.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/mod.js +39 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts +40 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.js +64 -0
- package/script/tl/0_utilities.d.ts.map +1 -1
- package/script/tl/0_utilities.js +43 -1
- package/script/tl/1_tl_writer.d.ts.map +1 -1
- package/script/tl/1_tl_writer.js +6 -1
- package/script/types/1_sticker.d.ts +7 -9
- package/script/types/1_sticker.d.ts.map +1 -1
- package/script/types/1_sticker.js +1 -6
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
/**
|
|
4
|
+
* Extensions to the
|
|
5
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API | Web Crypto API}
|
|
6
|
+
* supporting additional encryption APIs, but also delegating to the built-in
|
|
7
|
+
* APIs when possible.
|
|
8
|
+
*
|
|
9
|
+
* Provides additional digest algorithms that are not part of the WebCrypto
|
|
10
|
+
* standard as well as a `subtle.digest` and `subtle.digestSync` methods.
|
|
11
|
+
*
|
|
12
|
+
* The {@linkcode KeyStack} export implements the {@linkcode KeyRing} interface
|
|
13
|
+
* for managing rotatable keys for signing data to prevent tampering, like with
|
|
14
|
+
* HTTP cookies.
|
|
15
|
+
*
|
|
16
|
+
* ## Supported algorithms
|
|
17
|
+
*
|
|
18
|
+
* Here is a list of supported algorithms. If the algorithm name in WebCrypto
|
|
19
|
+
* and Wasm/Rust is the same, this library prefers to use the implementation
|
|
20
|
+
* provided by WebCrypto.
|
|
21
|
+
*
|
|
22
|
+
* Length-adjustable algorithms support the
|
|
23
|
+
* {@linkcode DigestAlgorithmObject.length} option.
|
|
24
|
+
*
|
|
25
|
+
* WebCrypto:
|
|
26
|
+
* - `SHA-384`
|
|
27
|
+
* - `SHA-256` (length-extendable)
|
|
28
|
+
* - `SHA-512` (length-extendable)
|
|
29
|
+
*
|
|
30
|
+
* Wasm/Rust:
|
|
31
|
+
* - `BLAKE2B`
|
|
32
|
+
* - `BLAKE2B-128`
|
|
33
|
+
* - `BLAKE2B-160`
|
|
34
|
+
* - `BLAKE2B-224`
|
|
35
|
+
* - `BLAKE2B-256`
|
|
36
|
+
* - `BLAKE2B-384`
|
|
37
|
+
* - `BLAKE2S`
|
|
38
|
+
* - `BLAKE3` (length-adjustable)
|
|
39
|
+
* - `KECCAK-224`
|
|
40
|
+
* - `KECCAK-256`
|
|
41
|
+
* - `KECCAK-384`
|
|
42
|
+
* - `KECCAK-512`
|
|
43
|
+
* - `SHA-384`
|
|
44
|
+
* - `SHA3-224`
|
|
45
|
+
* - `SHA3-256`
|
|
46
|
+
* - `SHA3-384`
|
|
47
|
+
* - `SHA3-512`
|
|
48
|
+
* - `SHAKE128` (length-adjustable)
|
|
49
|
+
* - `SHAKE256` (length-adjustable)
|
|
50
|
+
* - `TIGER`
|
|
51
|
+
* - `RIPEMD-160` (length-extendable)
|
|
52
|
+
* - `SHA-224` (length-extendable)
|
|
53
|
+
* - `SHA-256` (length-extendable)
|
|
54
|
+
* - `SHA-512` (length-extendable)
|
|
55
|
+
* - `MD4` (length-extendable and collidable)
|
|
56
|
+
* - `MD5` (length-extendable and collidable)
|
|
57
|
+
* - `SHA-1` (length-extendable and collidable)
|
|
58
|
+
* - `FNV32` (non-cryptographic)
|
|
59
|
+
* - `FNV32A` (non-cryptographic)
|
|
60
|
+
* - `FNV64` (non-cryptographic)
|
|
61
|
+
* - `FNV64A` (non-cryptographic)
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* import { crypto } from "@std/crypto";
|
|
66
|
+
*
|
|
67
|
+
* // This will delegate to the runtime's WebCrypto implementation.
|
|
68
|
+
* console.log(
|
|
69
|
+
* new Uint8Array(
|
|
70
|
+
* await crypto.subtle.digest(
|
|
71
|
+
* "SHA-384",
|
|
72
|
+
* new TextEncoder().encode("hello world"),
|
|
73
|
+
* ),
|
|
74
|
+
* ),
|
|
75
|
+
* );
|
|
76
|
+
*
|
|
77
|
+
* // This will use a bundled Wasm/Rust implementation.
|
|
78
|
+
* console.log(
|
|
79
|
+
* new Uint8Array(
|
|
80
|
+
* await crypto.subtle.digest(
|
|
81
|
+
* "BLAKE3",
|
|
82
|
+
* new TextEncoder().encode("hello world"),
|
|
83
|
+
* ),
|
|
84
|
+
* ),
|
|
85
|
+
* );
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @example Convert hash to a string
|
|
89
|
+
*
|
|
90
|
+
* ```ts
|
|
91
|
+
* import {
|
|
92
|
+
* crypto,
|
|
93
|
+
* } from "@std/crypto";
|
|
94
|
+
* import { encodeHex } from "@std/encoding/hex"
|
|
95
|
+
* import { encodeBase64 } from "@std/encoding/base64"
|
|
96
|
+
*
|
|
97
|
+
* const hash = await crypto.subtle.digest(
|
|
98
|
+
* "SHA-384",
|
|
99
|
+
* new TextEncoder().encode("You hear that Mr. Anderson?"),
|
|
100
|
+
* );
|
|
101
|
+
*
|
|
102
|
+
* // Hex encoding
|
|
103
|
+
* console.log(encodeHex(hash));
|
|
104
|
+
*
|
|
105
|
+
* // Or with base64 encoding
|
|
106
|
+
* console.log(encodeBase64(hash));
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @module
|
|
110
|
+
*/
|
|
111
|
+
import * as dntShim from "../../../../../_dnt.shims.js";
|
|
112
|
+
import { digest, DIGEST_ALGORITHM_NAMES, DigestContext, } from "./_wasm/mod.js";
|
|
113
|
+
export { DIGEST_ALGORITHM_NAMES };
|
|
114
|
+
/** Digest algorithms supported by WebCrypto. */
|
|
115
|
+
const WEB_CRYPTO_DIGEST_ALGORITHM_NAMES = [
|
|
116
|
+
"SHA-384",
|
|
117
|
+
"SHA-256",
|
|
118
|
+
"SHA-512",
|
|
119
|
+
// insecure (length-extendable and collidable):
|
|
120
|
+
"SHA-1",
|
|
121
|
+
];
|
|
122
|
+
/**
|
|
123
|
+
* A copy of the global WebCrypto interface, with methods bound so they're
|
|
124
|
+
* safe to re-export.
|
|
125
|
+
*/
|
|
126
|
+
const webCrypto = ((crypto) => ({
|
|
127
|
+
getRandomValues: crypto.getRandomValues?.bind(crypto),
|
|
128
|
+
randomUUID: crypto.randomUUID?.bind(crypto),
|
|
129
|
+
subtle: {
|
|
130
|
+
decrypt: crypto.subtle?.decrypt?.bind(crypto.subtle),
|
|
131
|
+
deriveBits: crypto.subtle?.deriveBits?.bind(crypto.subtle),
|
|
132
|
+
deriveKey: crypto.subtle?.deriveKey?.bind(crypto.subtle),
|
|
133
|
+
digest: crypto.subtle?.digest?.bind(crypto.subtle),
|
|
134
|
+
encrypt: crypto.subtle?.encrypt?.bind(crypto.subtle),
|
|
135
|
+
exportKey: crypto.subtle?.exportKey?.bind(crypto.subtle),
|
|
136
|
+
generateKey: crypto.subtle?.generateKey?.bind(crypto.subtle),
|
|
137
|
+
importKey: crypto.subtle?.importKey?.bind(crypto.subtle),
|
|
138
|
+
sign: crypto.subtle?.sign?.bind(crypto.subtle),
|
|
139
|
+
unwrapKey: crypto.subtle?.unwrapKey?.bind(crypto.subtle),
|
|
140
|
+
verify: crypto.subtle?.verify?.bind(crypto.subtle),
|
|
141
|
+
wrapKey: crypto.subtle?.wrapKey?.bind(crypto.subtle),
|
|
142
|
+
},
|
|
143
|
+
}))(dntShim.dntGlobalThis.crypto);
|
|
144
|
+
function toUint8Array(data) {
|
|
145
|
+
if (data instanceof Uint8Array) {
|
|
146
|
+
return data;
|
|
147
|
+
}
|
|
148
|
+
else if (ArrayBuffer.isView(data)) {
|
|
149
|
+
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
150
|
+
}
|
|
151
|
+
else if (data instanceof ArrayBuffer) {
|
|
152
|
+
return new Uint8Array(data);
|
|
153
|
+
}
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* A wrapper for WebCrypto which adds support for additional non-standard
|
|
158
|
+
* algorithms, but delegates to the runtime WebCrypto implementation whenever
|
|
159
|
+
* possible.
|
|
160
|
+
*/
|
|
161
|
+
const stdCrypto = ((x) => x)({
|
|
162
|
+
...webCrypto,
|
|
163
|
+
subtle: {
|
|
164
|
+
...webCrypto.subtle,
|
|
165
|
+
/**
|
|
166
|
+
* Polyfills stream support until the Web Crypto API does so:
|
|
167
|
+
* @see {@link https://github.com/wintercg/proposal-webcrypto-streams}
|
|
168
|
+
*/
|
|
169
|
+
async digest(algorithm, data) {
|
|
170
|
+
const { name, length } = normalizeAlgorithm(algorithm);
|
|
171
|
+
assertValidDigestLength(length);
|
|
172
|
+
// We delegate to WebCrypto whenever possible,
|
|
173
|
+
if (
|
|
174
|
+
// if the algorithm is supported by the WebCrypto standard,
|
|
175
|
+
WEB_CRYPTO_DIGEST_ALGORITHM_NAMES.includes(name) &&
|
|
176
|
+
// and the data is a single buffer,
|
|
177
|
+
isBufferSource(data)) {
|
|
178
|
+
return await webCrypto.subtle.digest(algorithm, data);
|
|
179
|
+
}
|
|
180
|
+
else if (DIGEST_ALGORITHM_NAMES.includes(name)) {
|
|
181
|
+
if (isBufferSource(data)) {
|
|
182
|
+
// Otherwise, we use our bundled Wasm implementation via digestSync
|
|
183
|
+
// if it supports the algorithm.
|
|
184
|
+
return stdCrypto.subtle.digestSync(algorithm, data);
|
|
185
|
+
}
|
|
186
|
+
else if (isIterable(data)) {
|
|
187
|
+
return stdCrypto.subtle.digestSync(algorithm, data);
|
|
188
|
+
}
|
|
189
|
+
else if (isAsyncIterable(data)) {
|
|
190
|
+
const context = new DigestContext(name);
|
|
191
|
+
for await (const chunk of data) {
|
|
192
|
+
const chunkBytes = toUint8Array(chunk);
|
|
193
|
+
if (!chunkBytes) {
|
|
194
|
+
throw new TypeError("Cannot digest the data: A chunk is not ArrayBuffer nor ArrayBufferView");
|
|
195
|
+
}
|
|
196
|
+
context.update(chunkBytes);
|
|
197
|
+
}
|
|
198
|
+
return context.digestAndDrop(length).buffer;
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
throw new TypeError(
|
|
202
|
+
// deno-lint-ignore deno-style-guide/error-message
|
|
203
|
+
"data must be a BufferSource or [Async]Iterable<BufferSource>");
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// (TypeScript type definitions prohibit this case.) If they're trying
|
|
207
|
+
// to call an algorithm we don't recognize, pass it along to WebCrypto
|
|
208
|
+
// in case it's a non-standard algorithm supported by the the runtime
|
|
209
|
+
// they're using.
|
|
210
|
+
return await webCrypto.subtle.digest(algorithm, data);
|
|
211
|
+
},
|
|
212
|
+
digestSync(algorithm, data) {
|
|
213
|
+
const { name, length } = normalizeAlgorithm(algorithm);
|
|
214
|
+
assertValidDigestLength(length);
|
|
215
|
+
if (isBufferSource(data)) {
|
|
216
|
+
const bytes = toUint8Array(data);
|
|
217
|
+
return digest(name, bytes, length).buffer;
|
|
218
|
+
}
|
|
219
|
+
if (isIterable(data)) {
|
|
220
|
+
const context = new DigestContext(name);
|
|
221
|
+
for (const chunk of data) {
|
|
222
|
+
const chunkBytes = toUint8Array(chunk);
|
|
223
|
+
if (!chunkBytes) {
|
|
224
|
+
throw new TypeError("Cannot digest the data: A chunk is not ArrayBuffer nor ArrayBufferView");
|
|
225
|
+
}
|
|
226
|
+
context.update(chunkBytes);
|
|
227
|
+
}
|
|
228
|
+
return context.digestAndDrop(length).buffer;
|
|
229
|
+
}
|
|
230
|
+
throw new TypeError(
|
|
231
|
+
// deno-lint-ignore deno-style-guide/error-message
|
|
232
|
+
"data must be a BufferSource or Iterable<BufferSource>");
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
});
|
|
236
|
+
/*
|
|
237
|
+
* The largest digest length the current Wasm implementation can support. This
|
|
238
|
+
* is the value of `isize::MAX` on 32-bit platforms like Wasm, which is the
|
|
239
|
+
* maximum allowed capacity of a Rust `Vec<u8>`.
|
|
240
|
+
*/
|
|
241
|
+
const MAX_DIGEST_LENGTH = 0x7FFF_FFFF;
|
|
242
|
+
/**
|
|
243
|
+
* Asserts that a number is a valid length for a digest, which must be an
|
|
244
|
+
* integer that fits in a Rust `Vec<u8>`, or be undefined.
|
|
245
|
+
*/
|
|
246
|
+
function assertValidDigestLength(value) {
|
|
247
|
+
if (value !== undefined &&
|
|
248
|
+
(value < 0 || value > MAX_DIGEST_LENGTH ||
|
|
249
|
+
!Number.isInteger(value))) {
|
|
250
|
+
throw new RangeError(`length must be an integer between 0 and ${MAX_DIGEST_LENGTH}, inclusive`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
function normalizeAlgorithm(algorithm) {
|
|
254
|
+
return ((typeof algorithm === "string")
|
|
255
|
+
? { name: algorithm.toUpperCase() }
|
|
256
|
+
: {
|
|
257
|
+
...algorithm,
|
|
258
|
+
name: algorithm.name.toUpperCase(),
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
function isBufferSource(obj) {
|
|
262
|
+
return obj instanceof ArrayBuffer || ArrayBuffer.isView(obj);
|
|
263
|
+
}
|
|
264
|
+
function isIterable(obj) {
|
|
265
|
+
return typeof obj[Symbol.iterator] === "function";
|
|
266
|
+
}
|
|
267
|
+
function isAsyncIterable(obj) {
|
|
268
|
+
return typeof obj[Symbol.asyncIterator] === "function";
|
|
269
|
+
}
|
|
270
|
+
export { stdCrypto as crypto };
|
|
@@ -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,23 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
/**
|
|
4
|
+
* Extensions to the
|
|
5
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API | Web Crypto}
|
|
6
|
+
* supporting additional encryption APIs, but also delegating to the built-in
|
|
7
|
+
* APIs when possible.
|
|
8
|
+
*
|
|
9
|
+
* ```ts no-assert
|
|
10
|
+
* import { crypto } from "@std/crypto/crypto";
|
|
11
|
+
*
|
|
12
|
+
* const message = "Hello, Deno!";
|
|
13
|
+
* const encoder = new TextEncoder();
|
|
14
|
+
* const data = encoder.encode(message);
|
|
15
|
+
*
|
|
16
|
+
* await crypto.subtle.digest("BLAKE3", data);
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @module
|
|
20
|
+
*/
|
|
21
|
+
export * from "./aes_gcm.js";
|
|
22
|
+
export * from "./crypto.js";
|
|
23
|
+
export * from "./timing_safe_equal.js";
|
|
@@ -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,61 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
function toUint8Array(value) {
|
|
4
|
+
if (value instanceof Uint8Array) {
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
return ArrayBuffer.isView(value)
|
|
8
|
+
? new Uint8Array(value.buffer, value.byteOffset, value.byteLength)
|
|
9
|
+
: new Uint8Array(value);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* When checking the values of cryptographic hashes are equal, default
|
|
13
|
+
* comparisons can be susceptible to timing based attacks, where attacker is
|
|
14
|
+
* able to find out information about the host system by repeatedly checking
|
|
15
|
+
* response times to equality comparisons of values.
|
|
16
|
+
*
|
|
17
|
+
* It is likely some form of timing safe equality will make its way to the
|
|
18
|
+
* WebCrypto standard (see:
|
|
19
|
+
* {@link https://github.com/w3c/webcrypto/issues/270 | w3c/webcrypto#270}), but until
|
|
20
|
+
* that time, `timingSafeEqual()` is provided.
|
|
21
|
+
*
|
|
22
|
+
* Note: This is a best-effort constant-time comparison implemented in
|
|
23
|
+
* JavaScript. The V8 JIT compiler does not provide formal constant-time
|
|
24
|
+
* guarantees, and inputs backed by `SharedArrayBuffer` are susceptible to
|
|
25
|
+
* concurrent modification during comparison.
|
|
26
|
+
*
|
|
27
|
+
* @example Usage
|
|
28
|
+
* ```ts
|
|
29
|
+
* import { timingSafeEqual } from "@std/crypto/timing-safe-equal";
|
|
30
|
+
* import { assert } from "@std/assert";
|
|
31
|
+
*
|
|
32
|
+
* const a = await crypto.subtle.digest(
|
|
33
|
+
* "SHA-384",
|
|
34
|
+
* new TextEncoder().encode("hello world"),
|
|
35
|
+
* );
|
|
36
|
+
* const b = await crypto.subtle.digest(
|
|
37
|
+
* "SHA-384",
|
|
38
|
+
* new TextEncoder().encode("hello world"),
|
|
39
|
+
* );
|
|
40
|
+
*
|
|
41
|
+
* assert(timingSafeEqual(a, b));
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @param a The first value to compare.
|
|
45
|
+
* @param b The second value to compare.
|
|
46
|
+
* @returns `true` if the values are equal, otherwise `false`.
|
|
47
|
+
* @throws {TypeError} If the byte lengths of the two buffers are not equal.
|
|
48
|
+
*/
|
|
49
|
+
export function timingSafeEqual(a, b) {
|
|
50
|
+
if (a.byteLength !== b.byteLength) {
|
|
51
|
+
throw new TypeError(`Cannot compare buffers of different byte lengths (${a.byteLength} vs ${b.byteLength})`);
|
|
52
|
+
}
|
|
53
|
+
const ua = toUint8Array(a);
|
|
54
|
+
const ub = toUint8Array(b);
|
|
55
|
+
const length = ua.length;
|
|
56
|
+
let out = 0;
|
|
57
|
+
for (let i = 0; i < length; i++) {
|
|
58
|
+
out |= ua[i] ^ ub[i];
|
|
59
|
+
}
|
|
60
|
+
return out === 0;
|
|
61
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_utilities.d.ts","sourceRoot":"","sources":["../../src/tl/0_utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AACD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/D;AACD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAY3F;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"0_utilities.d.ts","sourceRoot":"","sources":["../../src/tl/0_utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AACD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/D;AACD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAY3F;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAgClD;AAOD,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,GAAG,CAkB3C;AAED,wBAAgB,iBAAiB,CAAC,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"}
|
package/esm/tl/0_utilities.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
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 { assertEquals, assertFalse, encodeHex } from "../0_deps.js";
|
|
20
|
+
import { assertEquals, assertFalse, encodeBase64, encodeHex } from "../0_deps.js";
|
|
21
21
|
export function isOptionalParam(ntype) {
|
|
22
22
|
return ntype.includes("?");
|
|
23
23
|
}
|
|
@@ -35,7 +35,49 @@ export function analyzeOptionalParam(ntype) {
|
|
|
35
35
|
return { flagField, bitIndex };
|
|
36
36
|
}
|
|
37
37
|
export function repr(value) {
|
|
38
|
-
|
|
38
|
+
if (typeof value === "bigint") {
|
|
39
|
+
return `${value}n`;
|
|
40
|
+
}
|
|
41
|
+
else if (typeof value === "string") {
|
|
42
|
+
return `"${value}"`;
|
|
43
|
+
}
|
|
44
|
+
else if (typeof value === "number" || typeof value === "boolean") {
|
|
45
|
+
return `${value}`;
|
|
46
|
+
}
|
|
47
|
+
else if (value === undefined) {
|
|
48
|
+
return "undefined";
|
|
49
|
+
}
|
|
50
|
+
else if (value instanceof Uint8Array) {
|
|
51
|
+
if (value.byteLength > 1024) {
|
|
52
|
+
return `${value.byteLength} bytes`;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
return `Uint8Array.fromBase64("${encodeBase64(value)}")`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else if (Array.isArray(value)) {
|
|
59
|
+
if (value.length === 0) {
|
|
60
|
+
return "[]";
|
|
61
|
+
}
|
|
62
|
+
return `[\n ${value.map((value) => indentRepr(value)).join(",\n ")}\n]`;
|
|
63
|
+
}
|
|
64
|
+
else if (value === null) {
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
else if (typeof value === "object" && "_" in value) {
|
|
68
|
+
let s = "{\n";
|
|
69
|
+
for (const [k, v] of Object.entries(value)) {
|
|
70
|
+
s += ` ${k}: ${indentRepr(v)},\n`;
|
|
71
|
+
}
|
|
72
|
+
s += "}";
|
|
73
|
+
return s;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
return value.constructor.name;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function indentRepr(value) {
|
|
80
|
+
return `${repr(value)}`.replaceAll("\n", "\n ");
|
|
39
81
|
}
|
|
40
82
|
// deno-lint-ignore no-explicit-any
|
|
41
83
|
export function toJSON(object) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1_tl_writer.d.ts","sourceRoot":"","sources":["../../src/tl/1_tl_writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,qBAAa,QAAQ;;IACnB,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,CAAoB;;
|
|
1
|
+
{"version":3,"file":"1_tl_writer.d.ts","sourceRoot":"","sources":["../../src/tl/1_tl_writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,qBAAa,QAAQ;;IACnB,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,CAAoB;;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"}
|
package/esm/tl/1_tl_writer.js
CHANGED
|
@@ -25,14 +25,19 @@ import { intToBytes } from "../utilities/0_int.js";
|
|
|
25
25
|
import { encodeText } from "../1_utilities.js";
|
|
26
26
|
export class TLWriter {
|
|
27
27
|
_buffer = new Uint8Array();
|
|
28
|
+
#chunks = new Array();
|
|
28
29
|
#path = new Array();
|
|
29
30
|
constructor() {
|
|
30
31
|
}
|
|
31
32
|
get buffer() {
|
|
33
|
+
if (this.#chunks.length > 0) {
|
|
34
|
+
this._buffer = concat([this._buffer, ...this.#chunks]);
|
|
35
|
+
this.#chunks.length = 0;
|
|
36
|
+
}
|
|
32
37
|
return this._buffer;
|
|
33
38
|
}
|
|
34
39
|
write(buffer) {
|
|
35
|
-
this.
|
|
40
|
+
this.#chunks.push(buffer);
|
|
36
41
|
return this;
|
|
37
42
|
}
|
|
38
43
|
writeInt24(int, isSigned = true) {
|
package/esm/types/1_sticker.d.ts
CHANGED
|
@@ -33,24 +33,22 @@ export interface Sticker {
|
|
|
33
33
|
width: number;
|
|
34
34
|
/** The height of the sticker. */
|
|
35
35
|
height: number;
|
|
36
|
-
/**
|
|
36
|
+
/** Whether the sticker is animated. */
|
|
37
37
|
isAnimated: boolean;
|
|
38
|
-
/**
|
|
38
|
+
/** Whether the sticker is a video. */
|
|
39
39
|
isVideo: boolean;
|
|
40
|
-
/**
|
|
40
|
+
/** Thumbnails of the sticker in the WebP or JPG. */
|
|
41
41
|
thumbnails: Thumbnail[];
|
|
42
|
-
/**
|
|
42
|
+
/** The emoji associated with the sticker. */
|
|
43
43
|
emoji?: string;
|
|
44
|
-
/** Name of the sticker set
|
|
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
|
-
/**
|
|
53
|
-
|
|
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,gMAAgM;IAChM,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,aAAa,CAAC;IACzC,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,iC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AC,MAAM,GAAG,SAAS,CAAC,CAAC;AAEhH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,aAAa,SAAK,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"}
|
package/esm/types/1_sticker.js
CHANGED
|
@@ -42,10 +42,9 @@ export function constructSticker2(document, fileId, fileUniqueId, setName, custo
|
|
|
42
42
|
thumbnails: document.thumbs ? document.thumbs.map((v) => Api.is("photoSize", v) ? constructThumbnail(v, document) : null).filter((v) => v) : [],
|
|
43
43
|
emoji: (customEmojiAttribute ? customEmojiAttribute.alt : stickerAttribute.alt) || undefined,
|
|
44
44
|
setName,
|
|
45
|
-
premiumAnimation: undefined, // TODO
|
|
46
45
|
maskPosition: stickerAttribute ? stickerAttribute.mask_coords ? constructMaskPosition(stickerAttribute.mask_coords) : undefined : undefined,
|
|
47
46
|
customEmojiId: customEmojiAttribute ? customEmojiId : undefined,
|
|
48
|
-
|
|
47
|
+
isRepaintingNeeded: customEmojiAttribute ? !!customEmojiAttribute.text_color : undefined,
|
|
49
48
|
fileSize: Number(document.size),
|
|
50
49
|
});
|
|
51
50
|
}
|
|
@@ -64,10 +63,6 @@ export function constructSticker3(document, fileId, fileUniqueId) {
|
|
|
64
63
|
thumbnails: [],
|
|
65
64
|
emoji: stickerAttribute.alt || undefined,
|
|
66
65
|
setName: Api.is("inputStickerSetShortName", stickerAttribute.stickerset) ? stickerAttribute.stickerset.short_name : undefined,
|
|
67
|
-
premiumAnimation: undefined, // TODO
|
|
68
|
-
maskPosition: undefined,
|
|
69
|
-
customEmojiId: undefined,
|
|
70
|
-
needsRepainting: undefined,
|
|
71
66
|
fileSize: Number(document.size),
|
|
72
67
|
});
|
|
73
68
|
}
|
package/package.json
CHANGED
package/script/0_deps.d.ts
CHANGED
|
@@ -43,5 +43,6 @@ export { decodeBase64, encodeBase64 } from "./deps/jsr.io/@std/encoding/1.0.10/b
|
|
|
43
43
|
import { contentType as contentType_ } from "./deps/jsr.io/@std/media-types/1.1.0/content_type.js";
|
|
44
44
|
export declare const contentType: typeof contentType_;
|
|
45
45
|
export declare function extension(mimeType: string): string;
|
|
46
|
+
export { crypto } from "./deps/jsr.io/@std/crypto/1.1.0/mod.js";
|
|
46
47
|
export { ige256Decrypt, ige256Encrypt, init as initTgCrypto } from "./deps/jsr.io/@roj/tgcrypto/1.0.1/dist/mod.js";
|
|
47
48
|
//# sourceMappingURL=0_deps.d.ts.map
|
package/script/0_deps.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_deps.d.ts","sourceRoot":"","sources":["../src/0_deps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4CAA4C,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;AAErF,OAAO,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAA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EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAE1F,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,MAAM,EAAE,MAAM,wCAAwC,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,+CAA+C,CAAC"}
|
package/script/0_deps.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.initTgCrypto = exports.ige256Encrypt = exports.ige256Decrypt = exports.contentType = exports.encodeBase64 = exports.decodeBase64 = exports.encodeHex = exports.decodeHex = exports.toArrayBuffer = exports.WEEK = exports.SECOND = exports.MINUTE = exports.format = exports.writeAll = exports.LruCache = exports.isIPv6 = exports.isIPv4 = exports.startsWith = exports.equals = exports.concat = exports.pooledMap = exports.delay = exports.isAbsolute = exports.toFileUrl = exports.basename = exports.extname = exports.join = exports.AssertionError = exports.unreachable = exports.assertEquals = exports.assertFalse = exports.assert = void 0;
|
|
22
|
+
exports.initTgCrypto = exports.ige256Encrypt = exports.ige256Decrypt = exports.crypto = exports.contentType = exports.encodeBase64 = exports.decodeBase64 = exports.encodeHex = exports.decodeHex = exports.toArrayBuffer = exports.WEEK = exports.SECOND = exports.MINUTE = exports.format = exports.writeAll = exports.LruCache = exports.isIPv6 = exports.isIPv4 = exports.startsWith = exports.equals = exports.concat = exports.pooledMap = exports.delay = exports.isAbsolute = exports.toFileUrl = exports.basename = exports.extname = exports.join = exports.AssertionError = exports.unreachable = exports.assertEquals = exports.assertFalse = exports.assert = void 0;
|
|
23
23
|
exports.extension = extension;
|
|
24
24
|
var assert_js_1 = require("./deps/jsr.io/@std/assert/1.0.19/assert.js");
|
|
25
25
|
Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return assert_js_1.assert; } });
|
|
@@ -91,7 +91,9 @@ function extension(mimeType) {
|
|
|
91
91
|
return (0, extension_js_1.extension)(mimeType) || "unknown";
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
var mod_js_1 = require("./deps/jsr.io/@
|
|
95
|
-
Object.defineProperty(exports, "
|
|
96
|
-
|
|
97
|
-
Object.defineProperty(exports, "
|
|
94
|
+
var mod_js_1 = require("./deps/jsr.io/@std/crypto/1.1.0/mod.js");
|
|
95
|
+
Object.defineProperty(exports, "crypto", { enumerable: true, get: function () { return mod_js_1.crypto; } });
|
|
96
|
+
var mod_js_2 = require("./deps/jsr.io/@roj/tgcrypto/1.0.1/dist/mod.js");
|
|
97
|
+
Object.defineProperty(exports, "ige256Decrypt", { enumerable: true, get: function () { return mod_js_2.ige256Decrypt; } });
|
|
98
|
+
Object.defineProperty(exports, "ige256Encrypt", { enumerable: true, get: function () { return mod_js_2.ige256Encrypt; } });
|
|
99
|
+
Object.defineProperty(exports, "initTgCrypto", { enumerable: true, get: function () { return mod_js_2.init; } });
|