@mtkruto/node 0.1.101 → 0.1.102
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 +2 -3
- package/esm/0_deps.js +2 -3
- package/esm/4_constants.d.ts +1 -1
- package/esm/4_constants.js +1 -1
- package/esm/client/4_client.d.ts +36 -1
- package/esm/client/4_client.js +57 -10
- package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_diff.js +10 -3
- package/esm/tl/6_message.d.ts +1 -0
- package/esm/tl/6_message.js +1 -2
- package/esm/tl/6_message_test.d.ts +1 -0
- package/esm/transport/0_obfuscation.js +3 -3
- package/esm/transport/0_transport.d.ts +2 -2
- package/esm/transport/0_transport.js +2 -8
- package/esm/transport/1_transport_abridged.js +9 -7
- package/esm/transport/1_transport_intermediate.js +7 -3
- package/esm/types/3_message.d.ts +4 -0
- package/esm/types/3_message.js +3 -0
- package/esm/utilities/0_bigint.js +2 -1
- package/esm/utilities/0_crypto.d.ts +1 -1
- package/esm/utilities/0_crypto.js +1 -3
- package/package.json +1 -1
- package/script/0_deps.d.ts +2 -3
- package/script/0_deps.js +3 -5
- package/script/4_constants.d.ts +1 -1
- package/script/4_constants.js +1 -1
- package/script/client/4_client.d.ts +36 -1
- package/script/client/4_client.js +56 -9
- package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_diff.js +10 -3
- package/script/tl/6_message.d.ts +1 -0
- package/script/tl/6_message.js +2 -2
- package/script/tl/6_message_test.d.ts +1 -0
- package/script/transport/0_obfuscation.js +3 -3
- package/script/transport/0_transport.d.ts +2 -2
- package/script/transport/0_transport.js +2 -8
- package/script/transport/1_transport_abridged.js +9 -7
- package/script/transport/1_transport_intermediate.js +7 -3
- package/script/types/3_message.d.ts +4 -0
- package/script/types/3_message.js +3 -0
- package/script/utilities/0_bigint.js +2 -1
- package/script/utilities/0_crypto.d.ts +1 -1
- package/script/utilities/0_crypto.js +1 -3
- package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.d.ts +0 -2
- package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.js +0 -24
- package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.d.ts +0 -2
- package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.js +0 -27
- package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/mod.d.ts +0 -1
- package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/mod.js +0 -21
- package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/util.d.ts +0 -13
- package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/util.js +0 -48
- package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.d.ts +0 -125
- package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.js +0 -3337
- package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/mod.d.ts +0 -12
- package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/mod.js +0 -39
- package/esm/deps/deno.land/std@0.203.0/crypto/crypto.d.ts +0 -157
- package/esm/deps/deno.land/std@0.203.0/crypto/crypto.js +0 -266
- package/esm/deps/deno.land/std@0.203.0/crypto/keystack.d.ts +0 -4
- package/esm/deps/deno.land/std@0.203.0/crypto/keystack.js +0 -6
- package/esm/deps/deno.land/std@0.203.0/crypto/mod.d.ts +0 -12
- package/esm/deps/deno.land/std@0.203.0/crypto/mod.js +0 -14
- package/esm/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.d.ts +0 -28
- package/esm/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.js +0 -54
- package/esm/deps/deno.land/std@0.203.0/crypto/to_hash_string.d.ts +0 -19
- package/esm/deps/deno.land/std@0.203.0/crypto/to_hash_string.js +0 -31
- package/esm/deps/deno.land/std@0.203.0/crypto/unstable/keystack.d.ts +0 -46
- package/esm/deps/deno.land/std@0.203.0/crypto/unstable/keystack.js +0 -149
- package/esm/deps/deno.land/std@0.203.0/encoding/base64url.d.ts +0 -24
- package/esm/deps/deno.land/std@0.203.0/encoding/base64url.js +0 -80
- package/esm/deps/deno.land/std@0.203.0/encoding/hex.d.ts +0 -18
- package/esm/deps/deno.land/std@0.203.0/encoding/hex.js +0 -115
- package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.d.ts +0 -2
- package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.js +0 -29
- package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.d.ts +0 -2
- package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.js +0 -32
- package/script/deps/deno.land/std@0.203.0/crypto/_fnv/mod.d.ts +0 -1
- package/script/deps/deno.land/std@0.203.0/crypto/_fnv/mod.js +0 -25
- package/script/deps/deno.land/std@0.203.0/crypto/_fnv/util.d.ts +0 -13
- package/script/deps/deno.land/std@0.203.0/crypto/_fnv/util.js +0 -54
- package/script/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.d.ts +0 -125
- package/script/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.js +0 -3345
- package/script/deps/deno.land/std@0.203.0/crypto/_wasm/mod.d.ts +0 -12
- package/script/deps/deno.land/std@0.203.0/crypto/_wasm/mod.js +0 -44
- package/script/deps/deno.land/std@0.203.0/crypto/crypto.d.ts +0 -157
- package/script/deps/deno.land/std@0.203.0/crypto/crypto.js +0 -292
- package/script/deps/deno.land/std@0.203.0/crypto/keystack.d.ts +0 -4
- package/script/deps/deno.land/std@0.203.0/crypto/keystack.js +0 -22
- package/script/deps/deno.land/std@0.203.0/crypto/mod.d.ts +0 -12
- package/script/deps/deno.land/std@0.203.0/crypto/mod.js +0 -30
- package/script/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.d.ts +0 -28
- package/script/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.js +0 -58
- package/script/deps/deno.land/std@0.203.0/crypto/to_hash_string.d.ts +0 -19
- package/script/deps/deno.land/std@0.203.0/crypto/to_hash_string.js +0 -35
- package/script/deps/deno.land/std@0.203.0/crypto/unstable/keystack.d.ts +0 -46
- package/script/deps/deno.land/std@0.203.0/crypto/unstable/keystack.js +0 -176
- package/script/deps/deno.land/std@0.203.0/encoding/base64url.d.ts +0 -24
- package/script/deps/deno.land/std@0.203.0/encoding/base64url.js +0 -108
- package/script/deps/deno.land/std@0.203.0/encoding/hex.d.ts +0 -18
- package/script/deps/deno.land/std@0.203.0/encoding/hex.js +0 -122
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_constants.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_constants.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_diff.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_format.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_format.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_almost_equals.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_almost_equals.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_array_includes.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_array_includes.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_equals.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_equals.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_exists.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_exists.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_false.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_false.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater_or_equal.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater_or_equal.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_instance_of.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_instance_of.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_is_error.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_is_error.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less_or_equal.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less_or_equal.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_match.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_match.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_equals.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_equals.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_instance_of.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_instance_of.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_match.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_match.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_strict_equals.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_strict_equals.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_object_match.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_object_match.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_rejects.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_rejects.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_strict_equals.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_strict_equals.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_string_includes.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_string_includes.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_throws.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_throws.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assertion_error.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assertion_error.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/equal.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/equal.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/fail.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/fail.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/mod.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/mod.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unimplemented.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unimplemented.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unreachable.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unreachable.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/_util.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/_util.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/base64.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/base64.js +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/fmt/colors.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/fmt/colors.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_constants.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_constants.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_diff.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_format.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_format.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_almost_equals.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_almost_equals.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_array_includes.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_array_includes.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_equals.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_equals.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_exists.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_exists.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_false.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_false.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater_or_equal.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater_or_equal.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_instance_of.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_instance_of.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_is_error.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_is_error.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less_or_equal.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less_or_equal.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_match.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_match.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_equals.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_equals.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_instance_of.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_instance_of.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_match.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_match.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_strict_equals.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_strict_equals.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_object_match.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_object_match.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_rejects.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_rejects.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_strict_equals.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_strict_equals.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_string_includes.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_string_includes.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_throws.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_throws.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assertion_error.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assertion_error.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/equal.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/equal.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/fail.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/fail.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/mod.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/mod.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unimplemented.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unimplemented.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unreachable.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unreachable.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/_util.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/_util.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/base64.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/base64.js +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/fmt/colors.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/fmt/colors.js +0 -0
|
@@ -1203,10 +1203,10 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1203
1203
|
const messages = new Array();
|
|
1204
1204
|
if (updates instanceof _2_tl_js_1.types.Updates) {
|
|
1205
1205
|
for (const update of updates.updates) {
|
|
1206
|
-
if (update instanceof _2_tl_js_1.types.UpdateNewMessage) {
|
|
1206
|
+
if (update instanceof _2_tl_js_1.types.UpdateNewMessage || update instanceof _2_tl_js_1.types.UpdateEditMessage) {
|
|
1207
1207
|
messages.push(await (0, _3_types_js_1.constructMessage)(update.message, this[exports.getEntity].bind(this), this.getMessage.bind(this), this[exports.getStickerSetName].bind(this)));
|
|
1208
1208
|
}
|
|
1209
|
-
else if (update instanceof _2_tl_js_1.types.UpdateNewChannelMessage) {
|
|
1209
|
+
else if (update instanceof _2_tl_js_1.types.UpdateNewChannelMessage || update instanceof _2_tl_js_1.types.UpdateEditChannelMessage) {
|
|
1210
1210
|
messages.push(await (0, _3_types_js_1.constructMessage)(update.message, this[exports.getEntity].bind(this), this.getMessage.bind(this), this[exports.getStickerSetName].bind(this)));
|
|
1211
1211
|
}
|
|
1212
1212
|
}
|
|
@@ -1287,7 +1287,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1287
1287
|
*/
|
|
1288
1288
|
async editMessageText(chatId, messageId, text, params) {
|
|
1289
1289
|
const [message, entities] = this.parseText(text, params);
|
|
1290
|
-
await this.invoke(new _2_tl_js_1.functions.MessagesEditMessage({
|
|
1290
|
+
const result = await this.invoke(new _2_tl_js_1.functions.MessagesEditMessage({
|
|
1291
1291
|
id: messageId,
|
|
1292
1292
|
peer: await this.getInputPeer(chatId),
|
|
1293
1293
|
entities,
|
|
@@ -1295,6 +1295,8 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1295
1295
|
noWebpage: params?.disableWebPagePreview ? true : undefined,
|
|
1296
1296
|
replyMarkup: await this.constructReplyMarkup(params),
|
|
1297
1297
|
}));
|
|
1298
|
+
const message_ = await this.updatesToMessages(chatId, result).then((v) => v[0]);
|
|
1299
|
+
return Client.assertMsgHas(message_, "text");
|
|
1298
1300
|
}
|
|
1299
1301
|
async getMessagesInner(chatId_, messageIds) {
|
|
1300
1302
|
const peer = await this.getInputPeer(chatId_);
|
|
@@ -1690,9 +1692,6 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1690
1692
|
client.state.salt = this.state.salt;
|
|
1691
1693
|
await client.connect();
|
|
1692
1694
|
let part = 0;
|
|
1693
|
-
const md5sum = await _0_deps_js_1.crypto.subtle.digest("MD5", contents).then((v) => [...new Uint8Array(v)]
|
|
1694
|
-
.map((b) => b.toString(16).padStart(2, "0"))
|
|
1695
|
-
.join(""));
|
|
1696
1695
|
const partCount = Math.ceil(contents.length / chunkSize);
|
|
1697
1696
|
try {
|
|
1698
1697
|
main: for (; part < partCount; part++) {
|
|
@@ -1749,20 +1748,20 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1749
1748
|
return new _2_tl_js_1.types.InputFileBig({ id: fileId, parts: contents.length / chunkSize, name });
|
|
1750
1749
|
}
|
|
1751
1750
|
else {
|
|
1752
|
-
return new _2_tl_js_1.types.InputFile({ id: fileId, name, parts: part, md5Checksum:
|
|
1751
|
+
return new _2_tl_js_1.types.InputFile({ id: fileId, name, parts: part, md5Checksum: "" });
|
|
1753
1752
|
}
|
|
1754
1753
|
}
|
|
1755
1754
|
async setMyCommands(commands, params) {
|
|
1756
1755
|
await this.invoke(new _2_tl_js_1.functions.BotsSetBotCommands({
|
|
1757
1756
|
commands: commands.map((v) => new _2_tl_js_1.types.BotCommand(v)),
|
|
1758
1757
|
langCode: params?.languageCode ?? "",
|
|
1759
|
-
scope: await (0, _3_types_js_1.botCommandScopeToTlObject)(params?.scope ?? { type: "default" }, this.getInputPeer.bind(this)),
|
|
1758
|
+
scope: await (0, _3_types_js_1.botCommandScopeToTlObject)(params?.scope ?? { type: "default" }, this.getInputPeer.bind(this)),
|
|
1760
1759
|
}));
|
|
1761
1760
|
}
|
|
1762
1761
|
async getMyCommands(params) {
|
|
1763
1762
|
const commands_ = await this.invoke(new _2_tl_js_1.functions.BotsGetBotCommands({
|
|
1764
1763
|
langCode: params?.languageCode ?? "",
|
|
1765
|
-
scope: await (0, _3_types_js_1.botCommandScopeToTlObject)(params?.scope ?? { type: "default" }, this.getInputPeer.bind(this)),
|
|
1764
|
+
scope: await (0, _3_types_js_1.botCommandScopeToTlObject)(params?.scope ?? { type: "default" }, this.getInputPeer.bind(this)),
|
|
1766
1765
|
}));
|
|
1767
1766
|
return commands_.map((v) => ({ command: v.command, description: v.description }));
|
|
1768
1767
|
}
|
|
@@ -1824,5 +1823,53 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1824
1823
|
}
|
|
1825
1824
|
}, handler);
|
|
1826
1825
|
}
|
|
1826
|
+
async setMyInfo(info) {
|
|
1827
|
+
await this.invoke(new _2_tl_js_1.functions.BotsSetBotInfo({ bot: new _2_tl_js_1.types.InputUserSelf(), ...info }));
|
|
1828
|
+
}
|
|
1829
|
+
/**
|
|
1830
|
+
* Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty.
|
|
1831
|
+
*/
|
|
1832
|
+
async setMyDescription({ description, languageCode }) {
|
|
1833
|
+
await this.assertBot("setMyDescription");
|
|
1834
|
+
await this.setMyInfo({ description, langCode: languageCode ?? "" });
|
|
1835
|
+
}
|
|
1836
|
+
/**
|
|
1837
|
+
* Use this method to change the bot's name.
|
|
1838
|
+
*/
|
|
1839
|
+
async setMyName({ name, languageCode }) {
|
|
1840
|
+
await this.assertBot("setMyName");
|
|
1841
|
+
await this.setMyInfo({ name, langCode: languageCode ?? "" });
|
|
1842
|
+
}
|
|
1843
|
+
/**
|
|
1844
|
+
* Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot.
|
|
1845
|
+
*/
|
|
1846
|
+
async setMyShortDescription({ shortDescription: about, languageCode }) {
|
|
1847
|
+
await this.assertBot("setMyShortDescription");
|
|
1848
|
+
await this.setMyInfo({ about, langCode: languageCode ?? "" });
|
|
1849
|
+
}
|
|
1850
|
+
getMyInfo(languageCode) {
|
|
1851
|
+
return this.invoke(new _2_tl_js_1.functions.BotsGetBotInfo({ bot: new _2_tl_js_1.types.InputUserSelf(), langCode: languageCode ?? "" }));
|
|
1852
|
+
}
|
|
1853
|
+
/**
|
|
1854
|
+
* Use this method to get the current bot description for the given user language.
|
|
1855
|
+
*/
|
|
1856
|
+
async getMyDescription(languageCode) {
|
|
1857
|
+
await this.assertBot("getMyDescription");
|
|
1858
|
+
return await this.getMyInfo(languageCode).then((v) => v.description);
|
|
1859
|
+
}
|
|
1860
|
+
/**
|
|
1861
|
+
* Use this method to get the current bot name for the given user language.
|
|
1862
|
+
*/
|
|
1863
|
+
async getMyName(languageCode) {
|
|
1864
|
+
await this.assertBot("getMyName");
|
|
1865
|
+
return await this.getMyInfo(languageCode).then((v) => v.description);
|
|
1866
|
+
}
|
|
1867
|
+
/**
|
|
1868
|
+
* Use this method to get the current bot short description for the given user language.
|
|
1869
|
+
*/
|
|
1870
|
+
async getMyShortDescription(languageCode) {
|
|
1871
|
+
await this.assertBot("getMyShortDescription");
|
|
1872
|
+
return await this.getMyInfo(languageCode).then((v) => v.about);
|
|
1873
|
+
}
|
|
1827
1874
|
}
|
|
1828
1875
|
exports.Client = Client;
|
|
@@ -243,14 +243,21 @@ function diffstr(A, B) {
|
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
// Compute word-diff
|
|
246
|
-
const
|
|
247
|
-
const
|
|
246
|
+
const hasMoreRemovedLines = added.length < removed.length;
|
|
247
|
+
const aLines = hasMoreRemovedLines ? added : removed;
|
|
248
|
+
const bLines = hasMoreRemovedLines ? removed : added;
|
|
248
249
|
for (const a of aLines) {
|
|
249
250
|
let tokens = [], b;
|
|
250
251
|
// Search another diff line with at least one common token
|
|
251
252
|
while (bLines.length) {
|
|
252
253
|
b = bLines.shift();
|
|
253
|
-
|
|
254
|
+
const tokenized = [
|
|
255
|
+
tokenize(a.value, { wordDiff: true }),
|
|
256
|
+
tokenize(b?.value ?? "", { wordDiff: true }),
|
|
257
|
+
];
|
|
258
|
+
if (hasMoreRemovedLines)
|
|
259
|
+
tokenized.reverse();
|
|
260
|
+
tokens = diff(tokenized[0], tokenized[1]);
|
|
254
261
|
if (tokens.some(({ type, value }) => type === DiffType.common && value.trim().length)) {
|
|
255
262
|
break;
|
|
256
263
|
}
|
package/script/tl/6_message.d.ts
CHANGED
package/script/tl/6_message.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Message_ = void 0;
|
|
3
|
+
exports.Message_ = exports.calculateLength = void 0;
|
|
4
4
|
const _1_tl_object_js_1 = require("./1_tl_object.js");
|
|
5
5
|
const _3_tl_reader_js_1 = require("./3_tl_reader.js");
|
|
6
6
|
const _4_tl_writer_js_1 = require("./4_tl_writer.js");
|
|
7
7
|
const _5_rpc_result_js_1 = require("./5_rpc_result.js");
|
|
8
|
-
// TODO: test
|
|
9
8
|
function calculateLength(object) {
|
|
10
9
|
let length = 0;
|
|
11
10
|
if (Array.isArray(object)) {
|
|
@@ -23,6 +22,7 @@ function calculateLength(object) {
|
|
|
23
22
|
}
|
|
24
23
|
return length;
|
|
25
24
|
}
|
|
25
|
+
exports.calculateLength = calculateLength;
|
|
26
26
|
class Message_ {
|
|
27
27
|
constructor(id, seqNo, body) {
|
|
28
28
|
Object.defineProperty(this, "id", {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -27,10 +27,9 @@ exports.getObfuscationParameters = void 0;
|
|
|
27
27
|
const dntShim = __importStar(require("../_dnt.shims.js"));
|
|
28
28
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
29
29
|
async function getObfuscationParameters(protocol, connection) {
|
|
30
|
-
const dc = 0xFCFF;
|
|
31
30
|
let init;
|
|
32
31
|
while (true) {
|
|
33
|
-
init = (0, _1_utilities_js_1.concat)(dntShim.crypto.getRandomValues(new Uint8Array(56)), (0, _1_utilities_js_1.bufferFromBigInt)(protocol, 4, false),
|
|
32
|
+
init = (0, _1_utilities_js_1.concat)(dntShim.crypto.getRandomValues(new Uint8Array(56)), (0, _1_utilities_js_1.bufferFromBigInt)(protocol, 4, false), dntShim.crypto.getRandomValues(new Uint8Array(4)));
|
|
34
33
|
if (init[0] == 0xEF) {
|
|
35
34
|
continue;
|
|
36
35
|
}
|
|
@@ -48,7 +47,8 @@ async function getObfuscationParameters(protocol, connection) {
|
|
|
48
47
|
const encryptKey = init.slice(8, 8 + 32);
|
|
49
48
|
const encryptIv = init.slice(40, 40 + 16);
|
|
50
49
|
const encryptionCTR = new _1_utilities_js_1.CTR(encryptKey, encryptIv);
|
|
51
|
-
const encryptedInit =
|
|
50
|
+
const encryptedInit = new Uint8Array(init);
|
|
51
|
+
encryptionCTR.call(encryptedInit);
|
|
52
52
|
const initRev = new Uint8Array(init).reverse();
|
|
53
53
|
const decryptKey = initRev.slice(8, 8 + 32);
|
|
54
54
|
const decryptIv = initRev.slice(40, 40 + 16);
|
|
@@ -5,8 +5,8 @@ export declare abstract class Transport {
|
|
|
5
5
|
encryptionCTR: CTR;
|
|
6
6
|
decryptionCTR: CTR;
|
|
7
7
|
} | null;
|
|
8
|
-
protected encrypt(buffer: Uint8Array):
|
|
9
|
-
protected decrypt(buffer: Uint8Array):
|
|
8
|
+
protected encrypt(buffer: Uint8Array): void;
|
|
9
|
+
protected decrypt(buffer: Uint8Array): void;
|
|
10
10
|
abstract initialize(): MaybePromise<void>;
|
|
11
11
|
abstract receive(): MaybePromise<Uint8Array>;
|
|
12
12
|
abstract send(buffer: Uint8Array): MaybePromise<void>;
|
|
@@ -18,18 +18,12 @@ class Transport {
|
|
|
18
18
|
}
|
|
19
19
|
encrypt(buffer) {
|
|
20
20
|
if (this.obfuscationParameters) {
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
return buffer;
|
|
21
|
+
this.obfuscationParameters.encryptionCTR.call(buffer);
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
24
|
decrypt(buffer) {
|
|
28
25
|
if (this.obfuscationParameters) {
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
return buffer;
|
|
26
|
+
this.obfuscationParameters.decryptionCTR.call(buffer);
|
|
33
27
|
}
|
|
34
28
|
}
|
|
35
29
|
}
|
|
@@ -37,24 +37,24 @@ class TransportAbridged extends _0_transport_js_1.Transport {
|
|
|
37
37
|
async receive() {
|
|
38
38
|
let length;
|
|
39
39
|
{
|
|
40
|
-
|
|
40
|
+
const buffer = new Uint8Array(1);
|
|
41
41
|
await this.connection.read(buffer);
|
|
42
|
-
|
|
42
|
+
this.decrypt(buffer);
|
|
43
43
|
if (buffer[0] < 0x7F) {
|
|
44
44
|
length = buffer[0];
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
|
-
|
|
47
|
+
const buffer = new Uint8Array(3);
|
|
48
48
|
await this.connection.read(buffer);
|
|
49
|
-
|
|
49
|
+
this.decrypt(buffer);
|
|
50
50
|
const dataView = new DataView(buffer.buffer);
|
|
51
51
|
length = dataView.getUint16(0, true);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
length *= 4;
|
|
55
|
-
|
|
55
|
+
const buffer = new Uint8Array(length);
|
|
56
56
|
await this.connection.read(buffer);
|
|
57
|
-
|
|
57
|
+
this.decrypt(buffer);
|
|
58
58
|
return buffer;
|
|
59
59
|
}
|
|
60
60
|
async send(buffer) {
|
|
@@ -64,7 +64,9 @@ class TransportAbridged extends _0_transport_js_1.Transport {
|
|
|
64
64
|
const bufferLength = buffer.length / 4;
|
|
65
65
|
const header = new Uint8Array([bufferLength >= 0x7F ? 0x7F : bufferLength]);
|
|
66
66
|
const length = bufferLength >= 0x7F ? (0, _1_utilities_js_1.bufferFromBigInt)(bufferLength, 3) : new Uint8Array();
|
|
67
|
-
|
|
67
|
+
const data = (0, _1_utilities_js_1.concat)(header, length, buffer);
|
|
68
|
+
this.encrypt(data);
|
|
69
|
+
await this.connection.write(data);
|
|
68
70
|
}
|
|
69
71
|
deinitialize() {
|
|
70
72
|
this.initialized = false;
|
|
@@ -39,19 +39,23 @@ class TransportIntermediate extends _0_transport_js_1.Transport {
|
|
|
39
39
|
{
|
|
40
40
|
const buffer = new Uint8Array(4);
|
|
41
41
|
await this.connection.read(buffer);
|
|
42
|
-
|
|
42
|
+
this.decrypt(buffer);
|
|
43
|
+
const dataView = new DataView(buffer.buffer);
|
|
43
44
|
length = dataView.getUint32(0, true);
|
|
44
45
|
}
|
|
45
46
|
const buffer = new Uint8Array(length);
|
|
46
47
|
await this.connection.read(buffer);
|
|
47
|
-
|
|
48
|
+
this.decrypt(buffer);
|
|
49
|
+
return buffer;
|
|
48
50
|
}
|
|
49
51
|
async send(buffer) {
|
|
50
52
|
if (!this.initialized) {
|
|
51
53
|
throw new Error("Transport not initialized");
|
|
52
54
|
}
|
|
53
55
|
const length = (0, _1_utilities_js_1.bufferFromBigInt)(buffer.length, 4);
|
|
54
|
-
|
|
56
|
+
const data = (0, _1_utilities_js_1.concat)(length, buffer);
|
|
57
|
+
this.encrypt(data);
|
|
58
|
+
await this.connection.write(data);
|
|
55
59
|
}
|
|
56
60
|
deinitialize() {
|
|
57
61
|
this.initialized = false;
|
|
@@ -126,6 +126,10 @@ export interface Message {
|
|
|
126
126
|
supergroupCreated?: true;
|
|
127
127
|
/** Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel. */
|
|
128
128
|
channelCreated?: true;
|
|
129
|
+
/** Service message: auto-delete timer settings changed in the chat */
|
|
130
|
+
messageAutoDeleteTimerChanged?: {
|
|
131
|
+
messageAutoDeleteTime: number;
|
|
132
|
+
};
|
|
129
133
|
/** The group has been migrated to a supergroup with the specified identifier */
|
|
130
134
|
chatMigratedTo?: number;
|
|
131
135
|
/** The supergroup has been migrated from a group with the specified identifier */
|
|
@@ -180,6 +180,9 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
|
|
|
180
180
|
message.videoChatStarted = {};
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
+
else if (message_.action instanceof _2_tl_js_1.types.MessageActionSetMessagesTTL) {
|
|
184
|
+
message.messageAutoDeleteTimerChanged = { messageAutoDeleteTime: message_.action.period || 0 };
|
|
185
|
+
}
|
|
183
186
|
return (0, _1_utilities_js_1.cleanObject)(message);
|
|
184
187
|
}
|
|
185
188
|
async function constructMessage(message_, getEntity, getMessage, getStickerSetName) {
|
|
@@ -24,9 +24,7 @@ class CTR {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
call(data) {
|
|
27
|
-
|
|
28
|
-
(0, _0_deps_js_1.ctr256)(v, this.key, this.iv, this.state);
|
|
29
|
-
return v;
|
|
27
|
+
(0, _0_deps_js_1.ctr256)(data, this.key, this.iv, this.state);
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
30
|
exports.CTR = CTR;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// Ported from Go:
|
|
2
|
-
// https://github.com/golang/go/tree/go1.13.10/src/hash/fnv/fnv.go
|
|
3
|
-
// Copyright 2011 The Go Authors. All rights reserved. BSD license.
|
|
4
|
-
// https://github.com/golang/go/blob/master/LICENSE
|
|
5
|
-
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
6
|
-
// This module is browser compatible.
|
|
7
|
-
import { mul32, swap32 } from "./util.js";
|
|
8
|
-
const prime32 = 16777619;
|
|
9
|
-
export const fnv32 = (data) => {
|
|
10
|
-
let hash = 2166136261;
|
|
11
|
-
data.forEach((c) => {
|
|
12
|
-
hash = mul32(hash, prime32);
|
|
13
|
-
hash ^= c;
|
|
14
|
-
});
|
|
15
|
-
return Uint32Array.from([swap32(hash)]).buffer;
|
|
16
|
-
};
|
|
17
|
-
export const fnv32a = (data) => {
|
|
18
|
-
let hash = 2166136261;
|
|
19
|
-
data.forEach((c) => {
|
|
20
|
-
hash ^= c;
|
|
21
|
-
hash = mul32(hash, prime32);
|
|
22
|
-
});
|
|
23
|
-
return Uint32Array.from([swap32(hash)]).buffer;
|
|
24
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Ported from Go:
|
|
2
|
-
// https://github.com/golang/go/tree/go1.13.10/src/hash/fnv/fnv.go
|
|
3
|
-
// Copyright 2011 The Go Authors. All rights reserved. BSD license.
|
|
4
|
-
// https://github.com/golang/go/blob/master/LICENSE
|
|
5
|
-
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
6
|
-
// This module is browser compatible.
|
|
7
|
-
import { mul64, swap32 } from "./util.js";
|
|
8
|
-
const prime64Lo = 435;
|
|
9
|
-
const prime64Hi = 256;
|
|
10
|
-
export const fnv64 = (data) => {
|
|
11
|
-
let hashLo = 2216829733;
|
|
12
|
-
let hashHi = 3421674724;
|
|
13
|
-
data.forEach((c) => {
|
|
14
|
-
[hashHi, hashLo] = mul64([hashHi, hashLo], [prime64Hi, prime64Lo]);
|
|
15
|
-
hashLo ^= c;
|
|
16
|
-
});
|
|
17
|
-
return new Uint32Array([swap32(hashHi >>> 0), swap32(hashLo >>> 0)]).buffer;
|
|
18
|
-
};
|
|
19
|
-
export const fnv64a = (data) => {
|
|
20
|
-
let hashLo = 2216829733;
|
|
21
|
-
let hashHi = 3421674724;
|
|
22
|
-
data.forEach((c) => {
|
|
23
|
-
hashLo ^= c;
|
|
24
|
-
[hashHi, hashLo] = mul64([hashHi, hashLo], [prime64Hi, prime64Lo]);
|
|
25
|
-
});
|
|
26
|
-
return new Uint32Array([swap32(hashHi >>> 0), swap32(hashLo >>> 0)]).buffer;
|
|
27
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function fnv(name: string, buf?: Uint8Array): ArrayBuffer;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
-
// This module is browser compatible.
|
|
3
|
-
import { fnv32, fnv32a } from "./fnv32.js";
|
|
4
|
-
import { fnv64, fnv64a } from "./fnv64.js";
|
|
5
|
-
export function fnv(name, buf) {
|
|
6
|
-
if (!buf) {
|
|
7
|
-
throw new TypeError("no data provided for hashing");
|
|
8
|
-
}
|
|
9
|
-
switch (name) {
|
|
10
|
-
case "FNV32":
|
|
11
|
-
return fnv32(buf);
|
|
12
|
-
case "FNV64":
|
|
13
|
-
return fnv64(buf);
|
|
14
|
-
case "FNV32A":
|
|
15
|
-
return fnv32a(buf);
|
|
16
|
-
case "FNV64A":
|
|
17
|
-
return fnv64a(buf);
|
|
18
|
-
default:
|
|
19
|
-
throw new TypeError(`unsupported fnv digest: ${name}`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare function swap32(val: number): number;
|
|
2
|
-
/**
|
|
3
|
-
* mul32 performs 32-bit multiplication, a * b
|
|
4
|
-
* @param a
|
|
5
|
-
* @param b
|
|
6
|
-
*/
|
|
7
|
-
export declare function mul32(a: number, b: number): number;
|
|
8
|
-
/**
|
|
9
|
-
* mul64 performs 64-bit multiplication with two 32-bit words
|
|
10
|
-
* @param [ah, al]
|
|
11
|
-
* @param [bh, bl]
|
|
12
|
-
*/
|
|
13
|
-
export declare function mul64([ah, al]: [number, number], [bh, bl]: [number, number]): [number, number];
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
-
// This module is browser compatible.
|
|
3
|
-
export function swap32(val) {
|
|
4
|
-
return (((val & 0xff) << 24) |
|
|
5
|
-
((val & 0xff00) << 8) |
|
|
6
|
-
((val >> 8) & 0xff00) |
|
|
7
|
-
((val >> 24) & 0xff));
|
|
8
|
-
}
|
|
9
|
-
function n16(n) {
|
|
10
|
-
return n & 0xffff;
|
|
11
|
-
}
|
|
12
|
-
function n32(n) {
|
|
13
|
-
return n >>> 0;
|
|
14
|
-
}
|
|
15
|
-
function add32WithCarry(a, b) {
|
|
16
|
-
const added = n32(a) + n32(b);
|
|
17
|
-
return [n32(added), added > 0xffffffff ? 1 : 0];
|
|
18
|
-
}
|
|
19
|
-
function mul32WithCarry(a, b) {
|
|
20
|
-
const al = n16(a);
|
|
21
|
-
const ah = n16(a >>> 16);
|
|
22
|
-
const bl = n16(b);
|
|
23
|
-
const bh = n16(b >>> 16);
|
|
24
|
-
const [t, tc] = add32WithCarry(al * bh, ah * bl);
|
|
25
|
-
const [n, nc] = add32WithCarry(al * bl, n32(t << 16));
|
|
26
|
-
const carry = nc + (tc << 16) + n16(t >>> 16) + ah * bh;
|
|
27
|
-
return [n, carry];
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* mul32 performs 32-bit multiplication, a * b
|
|
31
|
-
* @param a
|
|
32
|
-
* @param b
|
|
33
|
-
*/
|
|
34
|
-
export function mul32(a, b) {
|
|
35
|
-
// https://stackoverflow.com/a/28151933
|
|
36
|
-
const al = n16(a);
|
|
37
|
-
const ah = a - al;
|
|
38
|
-
return n32(n32(ah * b) + al * b);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* mul64 performs 64-bit multiplication with two 32-bit words
|
|
42
|
-
* @param [ah, al]
|
|
43
|
-
* @param [bh, bl]
|
|
44
|
-
*/
|
|
45
|
-
export function mul64([ah, al], [bh, bl]) {
|
|
46
|
-
const [n, c] = mul32WithCarry(al, bl);
|
|
47
|
-
return [n32(mul32(al, bh) + mul32(ah, bl) + c), n];
|
|
48
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the digest of the given `data` using the given hash `algorithm`.
|
|
3
|
-
*
|
|
4
|
-
* `length` will usually be left `undefined` to use the default length for
|
|
5
|
-
* the algorithm. For algorithms with variable-length output, it can be used
|
|
6
|
-
* to specify a non-negative integer number of bytes.
|
|
7
|
-
*
|
|
8
|
-
* An error will be thrown if `algorithm` is not a supported hash algorithm or
|
|
9
|
-
* `length` is not a supported length for the algorithm.
|
|
10
|
-
* @param {string} algorithm
|
|
11
|
-
* @param {Uint8Array} data
|
|
12
|
-
* @param {number | undefined} length
|
|
13
|
-
* @returns {Uint8Array}
|
|
14
|
-
*/
|
|
15
|
-
export function digest(algorithm: string, data: Uint8Array, length: number | undefined): Uint8Array;
|
|
16
|
-
/** Instantiates an instance of the Wasm module returning its functions.
|
|
17
|
-
* @remarks It is safe to call this multiple times and once successfully
|
|
18
|
-
* loaded it will always return a reference to the same object.
|
|
19
|
-
*/
|
|
20
|
-
export function instantiate(): {
|
|
21
|
-
digest: typeof digest;
|
|
22
|
-
DigestContext: typeof DigestContext;
|
|
23
|
-
};
|
|
24
|
-
/** Instantiates an instance of the Wasm module along with its exports.
|
|
25
|
-
* @remarks It is safe to call this multiple times and once successfully
|
|
26
|
-
* loaded it will always return a reference to the same object.
|
|
27
|
-
* @returns {{
|
|
28
|
-
* instance: WebAssembly.Instance;
|
|
29
|
-
* exports: { digest: typeof digest; DigestContext : typeof DigestContext }
|
|
30
|
-
* }}
|
|
31
|
-
*/
|
|
32
|
-
export function instantiateWithInstance(): {
|
|
33
|
-
instance: WebAssembly.Instance;
|
|
34
|
-
exports: {
|
|
35
|
-
digest: typeof digest;
|
|
36
|
-
DigestContext: typeof DigestContext;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
/** Gets if the Wasm module has been instantiated. */
|
|
40
|
-
export function isInstantiated(): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* A context for incrementally computing a digest using a given hash algorithm.
|
|
43
|
-
*/
|
|
44
|
-
export class DigestContext {
|
|
45
|
-
static __wrap(ptr: any): any;
|
|
46
|
-
/**
|
|
47
|
-
* Creates a new context incrementally computing a digest using the given
|
|
48
|
-
* hash algorithm.
|
|
49
|
-
*
|
|
50
|
-
* An error will be thrown if `algorithm` is not a supported hash algorithm.
|
|
51
|
-
* @param {string} algorithm
|
|
52
|
-
*/
|
|
53
|
-
constructor(algorithm: string);
|
|
54
|
-
__destroy_into_raw(): number | undefined;
|
|
55
|
-
ptr: number | undefined;
|
|
56
|
-
free(): void;
|
|
57
|
-
/**
|
|
58
|
-
* Update the digest's internal state with the additional input `data`.
|
|
59
|
-
*
|
|
60
|
-
* If the `data` array view is large, it will be split into subarrays (via
|
|
61
|
-
* JavaScript bindings) which will be processed sequentially in order to
|
|
62
|
-
* limit the amount of memory that needs to be allocated in the Wasm heap.
|
|
63
|
-
* @param {Uint8Array} data
|
|
64
|
-
*/
|
|
65
|
-
update(data: Uint8Array): void;
|
|
66
|
-
/**
|
|
67
|
-
* Returns the digest of the input data so far. This may be called repeatedly
|
|
68
|
-
* without side effects.
|
|
69
|
-
*
|
|
70
|
-
* `length` will usually be left `undefined` to use the default length for
|
|
71
|
-
* the algorithm. For algorithms with variable-length output, it can be used
|
|
72
|
-
* to specify a non-negative integer number of bytes.
|
|
73
|
-
*
|
|
74
|
-
* An error will be thrown if `algorithm` is not a supported hash algorithm or
|
|
75
|
-
* `length` is not a supported length for the algorithm.
|
|
76
|
-
* @param {number | undefined} length
|
|
77
|
-
* @returns {Uint8Array}
|
|
78
|
-
*/
|
|
79
|
-
digest(length: number | undefined): Uint8Array;
|
|
80
|
-
/**
|
|
81
|
-
* Returns the digest of the input data so far, and resets this context to
|
|
82
|
-
* its initial state, as though it has not yet been provided with any input
|
|
83
|
-
* data. (It will still use the same algorithm.)
|
|
84
|
-
*
|
|
85
|
-
* `length` will usually be left `undefined` to use the default length for
|
|
86
|
-
* the algorithm. For algorithms with variable-length output, it can be used
|
|
87
|
-
* to specify a non-negative integer number of bytes.
|
|
88
|
-
*
|
|
89
|
-
* An error will be thrown if `algorithm` is not a supported hash algorithm or
|
|
90
|
-
* `length` is not a supported length for the algorithm.
|
|
91
|
-
* @param {number | undefined} length
|
|
92
|
-
* @returns {Uint8Array}
|
|
93
|
-
*/
|
|
94
|
-
digestAndReset(length: number | undefined): Uint8Array;
|
|
95
|
-
/**
|
|
96
|
-
* Returns the digest of the input data so far, and then drops the context
|
|
97
|
-
* from memory on the Wasm side. This context must no longer be used, and any
|
|
98
|
-
* further method calls will result in null pointer errors being thrown.
|
|
99
|
-
* https://github.com/rustwasm/wasm-bindgen/blob/bf39cfd8/crates/backend/src/codegen.rs#L186
|
|
100
|
-
*
|
|
101
|
-
* `length` will usually be left `undefined` to use the default length for
|
|
102
|
-
* the algorithm. For algorithms with variable-length output, it can be used
|
|
103
|
-
* to specify a non-negative integer number of bytes.
|
|
104
|
-
*
|
|
105
|
-
* An error will be thrown if `algorithm` is not a supported hash algorithm or
|
|
106
|
-
* `length` is not a supported length for the algorithm.
|
|
107
|
-
* @param {number | undefined} length
|
|
108
|
-
* @returns {Uint8Array}
|
|
109
|
-
*/
|
|
110
|
-
digestAndDrop(length: number | undefined): Uint8Array;
|
|
111
|
-
/**
|
|
112
|
-
* Resets this context to its initial state, as though it has not yet been
|
|
113
|
-
* provided with any input data. (It will still use the same algorithm.)
|
|
114
|
-
*/
|
|
115
|
-
reset(): void;
|
|
116
|
-
/**
|
|
117
|
-
* Returns a new `DigestContext` that is a copy of this one, i.e., using the
|
|
118
|
-
* same algorithm and with a copy of the same internal state.
|
|
119
|
-
*
|
|
120
|
-
* This may be a more efficient option for computing multiple digests that
|
|
121
|
-
* start with a common prefix.
|
|
122
|
-
* @returns {DigestContext}
|
|
123
|
-
*/
|
|
124
|
-
clone(): DigestContext;
|
|
125
|
-
}
|