@mtkruto/node 0.1.101 → 0.1.103
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/3_types.d.ts +25 -1
- package/esm/client/4_client.d.ts +57 -26
- package/esm/client/4_client.js +72 -12
- package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_diff.js +10 -3
- package/esm/storage/0_storage.d.ts +3 -1
- package/esm/storage/0_storage.js +7 -0
- package/esm/storage/0_utilities.d.ts +2 -1
- package/esm/storage/0_utilities.js +63 -0
- package/esm/storage/1_storage_indexed_db.d.ts +2 -1
- package/esm/storage/1_storage_indexed_db.js +18 -1
- package/esm/storage/1_storage_local_storage.d.ts +1 -0
- package/esm/storage/1_storage_local_storage.js +16 -0
- package/esm/storage/1_storage_memory.d.ts +1 -0
- package/esm/storage/1_storage_memory.js +14 -1
- package/esm/storage/1_storage_session_storage.d.ts +1 -0
- package/esm/storage/1_storage_session_storage.js +16 -0
- 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/3_types.d.ts +25 -1
- package/script/client/4_client.d.ts +57 -26
- package/script/client/4_client.js +71 -11
- package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_diff.js +10 -3
- package/script/storage/0_storage.d.ts +3 -1
- package/script/storage/0_storage.js +7 -0
- package/script/storage/0_utilities.d.ts +2 -1
- package/script/storage/0_utilities.js +65 -1
- package/script/storage/1_storage_indexed_db.d.ts +2 -1
- package/script/storage/1_storage_indexed_db.js +17 -0
- package/script/storage/1_storage_local_storage.d.ts +1 -0
- package/script/storage/1_storage_local_storage.js +16 -0
- package/script/storage/1_storage_memory.d.ts +1 -0
- package/script/storage/1_storage_memory.js +13 -0
- package/script/storage/1_storage_session_storage.d.ts +1 -0
- package/script/storage/1_storage_session_storage.js +16 -0
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fixKey = exports.fromString = exports.toString = exports.ValueType = void 0;
|
|
3
|
+
exports.getPrefixKeyRange = exports.fixKey = exports.fromString = exports.toString = exports.ValueType = void 0;
|
|
4
4
|
const _0_deps_js_1 = require("../0_deps.js");
|
|
5
5
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
6
6
|
var ValueType;
|
|
@@ -66,3 +66,67 @@ function fixKey(key) {
|
|
|
66
66
|
return key.map((v) => typeof v === "bigint" ? String(v) : v);
|
|
67
67
|
}
|
|
68
68
|
exports.fixKey = fixKey;
|
|
69
|
+
// Source: https://gist.github.com/inexorabletash/5462871
|
|
70
|
+
// deno-lint-ignore no-explicit-any
|
|
71
|
+
function getPrefixKeyRange(prefix) {
|
|
72
|
+
// Ensure prefix is a valid key itself:
|
|
73
|
+
if (indexedDB.cmp(prefix, prefix) !== 0)
|
|
74
|
+
throw new TypeError();
|
|
75
|
+
const upperKey = successor(prefix);
|
|
76
|
+
if (upperKey === undefined)
|
|
77
|
+
return IDBKeyRange.lowerBound(prefix);
|
|
78
|
+
return IDBKeyRange.bound(prefix, upperKey, false, true);
|
|
79
|
+
}
|
|
80
|
+
exports.getPrefixKeyRange = getPrefixKeyRange;
|
|
81
|
+
const MAX_DATE_VALUE = 8640000000000000;
|
|
82
|
+
const UPPER_BOUND = {
|
|
83
|
+
NUMBER: new Date(-MAX_DATE_VALUE),
|
|
84
|
+
DATE: "",
|
|
85
|
+
STRING: [],
|
|
86
|
+
ARRAY: undefined,
|
|
87
|
+
};
|
|
88
|
+
// deno-lint-ignore no-explicit-any
|
|
89
|
+
function successor(key) {
|
|
90
|
+
if (typeof key === "number") {
|
|
91
|
+
if (key === Infinity)
|
|
92
|
+
return UPPER_BOUND.NUMBER;
|
|
93
|
+
if (key === -Infinity)
|
|
94
|
+
return -Number.MAX_VALUE;
|
|
95
|
+
if (key === 0)
|
|
96
|
+
return Number.MIN_VALUE;
|
|
97
|
+
let epsilon = Math.abs(key);
|
|
98
|
+
while (key + epsilon / 2 !== key)
|
|
99
|
+
epsilon = epsilon / 2;
|
|
100
|
+
return key + epsilon;
|
|
101
|
+
}
|
|
102
|
+
if (key instanceof Date) {
|
|
103
|
+
if (key.valueOf() + 1 > MAX_DATE_VALUE)
|
|
104
|
+
return UPPER_BOUND.DATE;
|
|
105
|
+
return new Date(key.valueOf() + 1);
|
|
106
|
+
}
|
|
107
|
+
if (typeof key === "string") {
|
|
108
|
+
let len = key.length;
|
|
109
|
+
while (len > 0) {
|
|
110
|
+
const head = key.substring(0, len - 1), tail = key.charCodeAt(len - 1);
|
|
111
|
+
if (tail !== 0xffff)
|
|
112
|
+
return head + String.fromCharCode(tail + 1);
|
|
113
|
+
key = head;
|
|
114
|
+
--len;
|
|
115
|
+
}
|
|
116
|
+
return UPPER_BOUND.STRING;
|
|
117
|
+
}
|
|
118
|
+
if (Array.isArray(key)) {
|
|
119
|
+
key = key.slice(); // Operate on a copy.
|
|
120
|
+
let len = key.length;
|
|
121
|
+
while (len > 0) {
|
|
122
|
+
const tail = successor(key.pop());
|
|
123
|
+
if (tail !== undefined) {
|
|
124
|
+
key.push(tail);
|
|
125
|
+
return key;
|
|
126
|
+
}
|
|
127
|
+
--len;
|
|
128
|
+
}
|
|
129
|
+
return UPPER_BOUND.ARRAY;
|
|
130
|
+
}
|
|
131
|
+
throw new TypeError();
|
|
132
|
+
}
|
|
@@ -5,5 +5,6 @@ export declare class StorageIndexedDB extends Storage {
|
|
|
5
5
|
constructor(name: string);
|
|
6
6
|
init(): Promise<void>;
|
|
7
7
|
set(k: StorageKeyPart[], v: unknown): Promise<void>;
|
|
8
|
-
get<T>(k: StorageKeyPart[]): Promise<T | null>;
|
|
8
|
+
get<T>(k: readonly StorageKeyPart[]): Promise<T | null>;
|
|
9
|
+
getMany<T>(prefix: readonly StorageKeyPart[]): AsyncGenerator<[readonly StorageKeyPart[], T], void, unknown>;
|
|
9
10
|
}
|
|
@@ -75,5 +75,22 @@ class StorageIndexedDB extends _0_storage_js_1.Storage {
|
|
|
75
75
|
};
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
+
async *getMany(prefix) {
|
|
79
|
+
if (!this.database) {
|
|
80
|
+
throw new Error("Not initialized");
|
|
81
|
+
}
|
|
82
|
+
const keys = await new Promise((res, rej) => {
|
|
83
|
+
const tx = this.database.transaction(KV_OBJECT_STORE, "readonly")
|
|
84
|
+
.objectStore(KV_OBJECT_STORE)
|
|
85
|
+
.getAllKeys((0, _0_utilities_js_1.getPrefixKeyRange)(prefix));
|
|
86
|
+
tx.onerror = rej;
|
|
87
|
+
tx.onsuccess = () => {
|
|
88
|
+
res(tx.result);
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
for (const key of keys) {
|
|
92
|
+
yield [key, await this.get(key)];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
78
95
|
}
|
|
79
96
|
exports.StorageIndexedDB = StorageIndexedDB;
|
|
@@ -5,5 +5,6 @@ export declare class StorageLocalStorage extends Storage implements Storage {
|
|
|
5
5
|
constructor(prefix: string);
|
|
6
6
|
init(): void;
|
|
7
7
|
get(key_: readonly StorageKeyPart[]): any;
|
|
8
|
+
getMany<T>(prefix: readonly StorageKeyPart[]): Generator<[readonly StorageKeyPart[], T], void, unknown>;
|
|
8
9
|
set(key_: readonly StorageKeyPart[], value: unknown): MaybePromise<void>;
|
|
9
10
|
}
|
|
@@ -34,6 +34,22 @@ class StorageLocalStorage extends _0_storage_js_1.Storage {
|
|
|
34
34
|
return null;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
+
*getMany(prefix) {
|
|
38
|
+
for (let [key, value] of Object.entries(localStorage)) {
|
|
39
|
+
if (key.startsWith(this.prefix)) {
|
|
40
|
+
key = key.slice(this.prefix.length);
|
|
41
|
+
}
|
|
42
|
+
const parts = (0, _0_utilities_js_1.fromString)(key);
|
|
43
|
+
if (Array.isArray(parts)) {
|
|
44
|
+
for (const [i, p] of prefix.entries()) {
|
|
45
|
+
if ((0, _0_utilities_js_1.toString)(p) != (0, _0_utilities_js_1.toString)(parts[i])) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
yield [parts, (0, _0_utilities_js_1.fromString)(value)];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
37
53
|
set(key_, value) {
|
|
38
54
|
const key = this.prefix + (0, _0_utilities_js_1.toString)(key_);
|
|
39
55
|
if (value != null) {
|
|
@@ -4,5 +4,6 @@ export declare class StorageMemory extends Storage implements Storage {
|
|
|
4
4
|
protected map: Map<string, unknown>;
|
|
5
5
|
init(): void;
|
|
6
6
|
get<T>(key: readonly StorageKeyPart[]): NonNullable<T> | null;
|
|
7
|
+
getMany<T>(prefix: readonly StorageKeyPart[]): Generator<[readonly StorageKeyPart[], T], void, unknown>;
|
|
7
8
|
set(key_: readonly StorageKeyPart[], value: unknown): MaybePromise<void>;
|
|
8
9
|
}
|
|
@@ -18,6 +18,19 @@ class StorageMemory extends _0_storage_js_1.Storage {
|
|
|
18
18
|
get(key) {
|
|
19
19
|
return this.map.get((0, _0_utilities_js_1.toString)(key)) ?? null;
|
|
20
20
|
}
|
|
21
|
+
*getMany(prefix) {
|
|
22
|
+
for (const [key, value] of this.map.entries()) {
|
|
23
|
+
const parts = (0, _0_utilities_js_1.fromString)(key);
|
|
24
|
+
if (Array.isArray(parts)) {
|
|
25
|
+
for (const [i, p] of prefix.entries()) {
|
|
26
|
+
if ((0, _0_utilities_js_1.toString)(p) != (0, _0_utilities_js_1.toString)(parts[i])) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
yield [parts, value];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
21
34
|
set(key_, value) {
|
|
22
35
|
const key = (0, _0_utilities_js_1.toString)(key_);
|
|
23
36
|
if (value != null) {
|
|
@@ -5,5 +5,6 @@ export declare class StorageSessionStorage extends Storage implements Storage {
|
|
|
5
5
|
constructor(prefix: string);
|
|
6
6
|
init(): void;
|
|
7
7
|
get(key_: readonly StorageKeyPart[]): any;
|
|
8
|
+
getMany<T>(prefix: readonly StorageKeyPart[]): Generator<[readonly StorageKeyPart[], T], void, unknown>;
|
|
8
9
|
set(key_: readonly StorageKeyPart[], value: unknown): MaybePromise<void>;
|
|
9
10
|
}
|
|
@@ -34,6 +34,22 @@ class StorageSessionStorage extends _0_storage_js_1.Storage {
|
|
|
34
34
|
return null;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
+
*getMany(prefix) {
|
|
38
|
+
for (let [key, value] of Object.entries(localStorage)) {
|
|
39
|
+
if (key.startsWith(this.prefix)) {
|
|
40
|
+
key = key.slice(this.prefix.length);
|
|
41
|
+
}
|
|
42
|
+
const parts = (0, _0_utilities_js_1.fromString)(key);
|
|
43
|
+
if (Array.isArray(parts)) {
|
|
44
|
+
for (const [i, p] of prefix.entries()) {
|
|
45
|
+
if ((0, _0_utilities_js_1.toString)(p) != (0, _0_utilities_js_1.toString)(parts[i])) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
yield [parts, (0, _0_utilities_js_1.fromString)(value)];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
37
53
|
set(key_, value) {
|
|
38
54
|
const key = this.prefix + (0, _0_utilities_js_1.toString)(key_);
|
|
39
55
|
if (value != null) {
|
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
|
-
}
|