@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,46 +0,0 @@
|
|
|
1
|
-
/** Types of data that can be signed cryptographically. */
|
|
2
|
-
export type Data = string | number[] | ArrayBuffer | Uint8Array;
|
|
3
|
-
/** Types of keys that can be used to sign data. */
|
|
4
|
-
export type Key = string | number[] | ArrayBuffer | Uint8Array;
|
|
5
|
-
/** A cryptographic key chain which allows signing of data to prevent tampering,
|
|
6
|
-
* but also allows for easy key rotation without needing to re-sign the data.
|
|
7
|
-
*
|
|
8
|
-
* Data is signed as SHA256 HMAC.
|
|
9
|
-
*
|
|
10
|
-
* This was inspired by [keygrip](https://github.com/crypto-utils/keygrip/).
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* import { KeyStack } from "https://deno.land/std@$STD_VERSION/crypto/keystack.ts";
|
|
15
|
-
*
|
|
16
|
-
* const keyStack = new KeyStack(["hello", "world"]);
|
|
17
|
-
* const digest = await keyStack.sign("some data");
|
|
18
|
-
*
|
|
19
|
-
* const rotatedStack = new KeyStack(["deno", "says", "hello", "world"]);
|
|
20
|
-
* await rotatedStack.verify("some data", digest); // true
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare class KeyStack {
|
|
24
|
-
#private;
|
|
25
|
-
get length(): number;
|
|
26
|
-
/** A class which accepts an array of keys that are used to sign and verify
|
|
27
|
-
* data and allows easy key rotation without invalidation of previously signed
|
|
28
|
-
* data.
|
|
29
|
-
*
|
|
30
|
-
* @param keys An iterable of keys, of which the index 0 will be used to sign
|
|
31
|
-
* data, but verification can happen against any key.
|
|
32
|
-
*/
|
|
33
|
-
constructor(keys: Iterable<Key>);
|
|
34
|
-
/** Take `data` and return a SHA256 HMAC digest that uses the current 0 index
|
|
35
|
-
* of the `keys` passed to the constructor. This digest is in the form of a
|
|
36
|
-
* URL safe base64 encoded string. */
|
|
37
|
-
sign(data: Data): Promise<string>;
|
|
38
|
-
/** Given `data` and a `digest`, verify that one of the `keys` provided the
|
|
39
|
-
* constructor was used to generate the `digest`. Returns `true` if one of
|
|
40
|
-
* the keys was used, otherwise `false`. */
|
|
41
|
-
verify(data: Data, digest: string): Promise<boolean>;
|
|
42
|
-
/** Given `data` and a `digest`, return the current index of the key in the
|
|
43
|
-
* `keys` passed the constructor that was used to generate the digest. If no
|
|
44
|
-
* key can be found, the method returns `-1`. */
|
|
45
|
-
indexOf(data: Data, digest: string): Promise<number>;
|
|
46
|
-
}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
-
// This module is browser compatible.
|
|
3
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
6
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
9
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
10
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
11
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
12
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
13
|
-
};
|
|
14
|
-
var _KeyStack_instances, _KeyStack_cryptoKeys, _KeyStack_keys, _KeyStack_toCryptoKey;
|
|
15
|
-
/**
|
|
16
|
-
* Provides the {@linkcode KeyStack} class which implements the
|
|
17
|
-
* {@linkcode KeyRing} interface for managing rotatable keys.
|
|
18
|
-
*
|
|
19
|
-
* @module
|
|
20
|
-
*/
|
|
21
|
-
import * as dntShim from "../../../../../_dnt.shims.js";
|
|
22
|
-
import { timingSafeEqual } from "../timing_safe_equal.js";
|
|
23
|
-
import * as base64url from "../../encoding/base64url.js";
|
|
24
|
-
const encoder = new TextEncoder();
|
|
25
|
-
function importKey(key) {
|
|
26
|
-
if (typeof key === "string") {
|
|
27
|
-
key = encoder.encode(key);
|
|
28
|
-
}
|
|
29
|
-
else if (Array.isArray(key)) {
|
|
30
|
-
key = new Uint8Array(key);
|
|
31
|
-
}
|
|
32
|
-
return dntShim.crypto.subtle.importKey("raw", key, {
|
|
33
|
-
name: "HMAC",
|
|
34
|
-
hash: { name: "SHA-256" },
|
|
35
|
-
}, true, ["sign", "verify"]);
|
|
36
|
-
}
|
|
37
|
-
function sign(data, key) {
|
|
38
|
-
if (typeof data === "string") {
|
|
39
|
-
data = encoder.encode(data);
|
|
40
|
-
}
|
|
41
|
-
else if (Array.isArray(data)) {
|
|
42
|
-
data = Uint8Array.from(data);
|
|
43
|
-
}
|
|
44
|
-
return dntShim.crypto.subtle.sign("HMAC", key, data);
|
|
45
|
-
}
|
|
46
|
-
/** Compare two strings, Uint8Arrays, ArrayBuffers, or arrays of numbers in a
|
|
47
|
-
* way that avoids timing based attacks on the comparisons on the values.
|
|
48
|
-
*
|
|
49
|
-
* The function will return `true` if the values match, or `false`, if they
|
|
50
|
-
* do not match.
|
|
51
|
-
*
|
|
52
|
-
* This was inspired by https://github.com/suryagh/tsscmp which provides a
|
|
53
|
-
* timing safe string comparison to avoid timing attacks as described in
|
|
54
|
-
* https://codahale.com/a-lesson-in-timing-attacks/.
|
|
55
|
-
*/
|
|
56
|
-
async function compare(a, b) {
|
|
57
|
-
const key = new Uint8Array(32);
|
|
58
|
-
dntShim.dntGlobalThis.crypto.getRandomValues(key);
|
|
59
|
-
const cryptoKey = await importKey(key);
|
|
60
|
-
const ah = await sign(a, cryptoKey);
|
|
61
|
-
const bh = await sign(b, cryptoKey);
|
|
62
|
-
return timingSafeEqual(ah, bh);
|
|
63
|
-
}
|
|
64
|
-
/** A cryptographic key chain which allows signing of data to prevent tampering,
|
|
65
|
-
* but also allows for easy key rotation without needing to re-sign the data.
|
|
66
|
-
*
|
|
67
|
-
* Data is signed as SHA256 HMAC.
|
|
68
|
-
*
|
|
69
|
-
* This was inspired by [keygrip](https://github.com/crypto-utils/keygrip/).
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* ```ts
|
|
73
|
-
* import { KeyStack } from "https://deno.land/std@$STD_VERSION/crypto/keystack.ts";
|
|
74
|
-
*
|
|
75
|
-
* const keyStack = new KeyStack(["hello", "world"]);
|
|
76
|
-
* const digest = await keyStack.sign("some data");
|
|
77
|
-
*
|
|
78
|
-
* const rotatedStack = new KeyStack(["deno", "says", "hello", "world"]);
|
|
79
|
-
* await rotatedStack.verify("some data", digest); // true
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
export class KeyStack {
|
|
83
|
-
get length() {
|
|
84
|
-
return __classPrivateFieldGet(this, _KeyStack_keys, "f").length;
|
|
85
|
-
}
|
|
86
|
-
/** A class which accepts an array of keys that are used to sign and verify
|
|
87
|
-
* data and allows easy key rotation without invalidation of previously signed
|
|
88
|
-
* data.
|
|
89
|
-
*
|
|
90
|
-
* @param keys An iterable of keys, of which the index 0 will be used to sign
|
|
91
|
-
* data, but verification can happen against any key.
|
|
92
|
-
*/
|
|
93
|
-
constructor(keys) {
|
|
94
|
-
_KeyStack_instances.add(this);
|
|
95
|
-
_KeyStack_cryptoKeys.set(this, new Map());
|
|
96
|
-
_KeyStack_keys.set(this, void 0);
|
|
97
|
-
const values = Array.isArray(keys) ? keys : [...keys];
|
|
98
|
-
if (!(values.length)) {
|
|
99
|
-
throw new TypeError("keys must contain at least one value");
|
|
100
|
-
}
|
|
101
|
-
__classPrivateFieldSet(this, _KeyStack_keys, values, "f");
|
|
102
|
-
}
|
|
103
|
-
/** Take `data` and return a SHA256 HMAC digest that uses the current 0 index
|
|
104
|
-
* of the `keys` passed to the constructor. This digest is in the form of a
|
|
105
|
-
* URL safe base64 encoded string. */
|
|
106
|
-
async sign(data) {
|
|
107
|
-
const key = await __classPrivateFieldGet(this, _KeyStack_instances, "m", _KeyStack_toCryptoKey).call(this, __classPrivateFieldGet(this, _KeyStack_keys, "f")[0]);
|
|
108
|
-
return base64url.encode(await sign(data, key));
|
|
109
|
-
}
|
|
110
|
-
/** Given `data` and a `digest`, verify that one of the `keys` provided the
|
|
111
|
-
* constructor was used to generate the `digest`. Returns `true` if one of
|
|
112
|
-
* the keys was used, otherwise `false`. */
|
|
113
|
-
async verify(data, digest) {
|
|
114
|
-
return (await this.indexOf(data, digest)) > -1;
|
|
115
|
-
}
|
|
116
|
-
/** Given `data` and a `digest`, return the current index of the key in the
|
|
117
|
-
* `keys` passed the constructor that was used to generate the digest. If no
|
|
118
|
-
* key can be found, the method returns `-1`. */
|
|
119
|
-
async indexOf(data, digest) {
|
|
120
|
-
for (let i = 0; i < __classPrivateFieldGet(this, _KeyStack_keys, "f").length; i++) {
|
|
121
|
-
const cryptoKey = await __classPrivateFieldGet(this, _KeyStack_instances, "m", _KeyStack_toCryptoKey).call(this, __classPrivateFieldGet(this, _KeyStack_keys, "f")[i]);
|
|
122
|
-
if (await compare(digest, base64url.encode(await sign(data, cryptoKey)))) {
|
|
123
|
-
return i;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return -1;
|
|
127
|
-
}
|
|
128
|
-
[(_KeyStack_cryptoKeys = new WeakMap(), _KeyStack_keys = new WeakMap(), _KeyStack_instances = new WeakSet(), _KeyStack_toCryptoKey = async function _KeyStack_toCryptoKey(key) {
|
|
129
|
-
if (!__classPrivateFieldGet(this, _KeyStack_cryptoKeys, "f").has(key)) {
|
|
130
|
-
__classPrivateFieldGet(this, _KeyStack_cryptoKeys, "f").set(key, await importKey(key));
|
|
131
|
-
}
|
|
132
|
-
return __classPrivateFieldGet(this, _KeyStack_cryptoKeys, "f").get(key);
|
|
133
|
-
}, Symbol.for("Deno.customInspect"))](inspect) {
|
|
134
|
-
const { length } = this;
|
|
135
|
-
return `${this.constructor.name} ${inspect({ length })}`;
|
|
136
|
-
}
|
|
137
|
-
[Symbol.for("nodejs.util.inspect.custom")](depth,
|
|
138
|
-
// deno-lint-ignore no-explicit-any
|
|
139
|
-
options, inspect) {
|
|
140
|
-
if (depth < 0) {
|
|
141
|
-
return options.stylize(`[${this.constructor.name}]`, "special");
|
|
142
|
-
}
|
|
143
|
-
const newOptions = Object.assign({}, options, {
|
|
144
|
-
depth: options.depth === null ? null : options.depth - 1,
|
|
145
|
-
});
|
|
146
|
-
const { length } = this;
|
|
147
|
-
return `${options.stylize(this.constructor.name, "special")} ${inspect({ length }, newOptions)}`;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated (will be removed in 0.210.0) Use a `encodeBase64Url` instead.
|
|
3
|
-
*
|
|
4
|
-
* Encodes a given ArrayBuffer or string into a base64url representation
|
|
5
|
-
* @param data
|
|
6
|
-
*/
|
|
7
|
-
export declare const encode: typeof encodeBase64Url;
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated (will be removed in 0.210.0) Use a `decodeBase64Url` instead.
|
|
10
|
-
*
|
|
11
|
-
* Converts given base64url encoded data back to original
|
|
12
|
-
* @param b64url
|
|
13
|
-
*/
|
|
14
|
-
export declare const decode: typeof decodeBase64Url;
|
|
15
|
-
/**
|
|
16
|
-
* Encodes a given ArrayBuffer or string into a base64url representation
|
|
17
|
-
* @param data
|
|
18
|
-
*/
|
|
19
|
-
export declare function encodeBase64Url(data: ArrayBuffer | Uint8Array | string): string;
|
|
20
|
-
/**
|
|
21
|
-
* Converts given base64url encoded data back to original
|
|
22
|
-
* @param b64url
|
|
23
|
-
*/
|
|
24
|
-
export declare function decodeBase64Url(b64url: string): Uint8Array;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
-
// This module is browser compatible.
|
|
3
|
-
/**
|
|
4
|
-
* {@linkcode encodeBase64Url} and {@linkcode decodeBase64Url} for
|
|
5
|
-
* [base64 URL safe](https://en.wikipedia.org/wiki/Base64#URL_applications) encoding.
|
|
6
|
-
*
|
|
7
|
-
* This module is browser compatible.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* import {
|
|
12
|
-
* decodeBase64Url,
|
|
13
|
-
* encodeBase64Url,
|
|
14
|
-
* } from "https://deno.land/std@$STD_VERSION/encoding/base64url.ts";
|
|
15
|
-
*
|
|
16
|
-
* const binary = new TextEncoder().encode("foobar");
|
|
17
|
-
* const encoded = encodeBase64Url(binary);
|
|
18
|
-
* console.log(encoded);
|
|
19
|
-
* // => "Zm9vYmFy"
|
|
20
|
-
*
|
|
21
|
-
* console.log(decodeBase64Url(encoded));
|
|
22
|
-
* // => Uint8Array(6) [ 102, 111, 111, 98, 97, 114 ]
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* @module
|
|
26
|
-
*/
|
|
27
|
-
import * as base64 from "./base64.js";
|
|
28
|
-
/*
|
|
29
|
-
* Some variants allow or require omitting the padding '=' signs:
|
|
30
|
-
* https://en.wikipedia.org/wiki/Base64#The_URL_applications
|
|
31
|
-
* @param base64url
|
|
32
|
-
*/
|
|
33
|
-
function addPaddingToBase64url(base64url) {
|
|
34
|
-
if (base64url.length % 4 === 2)
|
|
35
|
-
return base64url + "==";
|
|
36
|
-
if (base64url.length % 4 === 3)
|
|
37
|
-
return base64url + "=";
|
|
38
|
-
if (base64url.length % 4 === 1) {
|
|
39
|
-
throw new TypeError("Illegal base64url string!");
|
|
40
|
-
}
|
|
41
|
-
return base64url;
|
|
42
|
-
}
|
|
43
|
-
function convertBase64urlToBase64(b64url) {
|
|
44
|
-
if (!/^[-_A-Z0-9]*?={0,2}$/i.test(b64url)) {
|
|
45
|
-
// Contains characters not part of base64url spec.
|
|
46
|
-
throw new TypeError("Failed to decode base64url: invalid character");
|
|
47
|
-
}
|
|
48
|
-
return addPaddingToBase64url(b64url).replace(/\-/g, "+").replace(/_/g, "/");
|
|
49
|
-
}
|
|
50
|
-
function convertBase64ToBase64url(b64) {
|
|
51
|
-
return b64.replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* @deprecated (will be removed in 0.210.0) Use a `encodeBase64Url` instead.
|
|
55
|
-
*
|
|
56
|
-
* Encodes a given ArrayBuffer or string into a base64url representation
|
|
57
|
-
* @param data
|
|
58
|
-
*/
|
|
59
|
-
export const encode = encodeBase64Url;
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated (will be removed in 0.210.0) Use a `decodeBase64Url` instead.
|
|
62
|
-
*
|
|
63
|
-
* Converts given base64url encoded data back to original
|
|
64
|
-
* @param b64url
|
|
65
|
-
*/
|
|
66
|
-
export const decode = decodeBase64Url;
|
|
67
|
-
/**
|
|
68
|
-
* Encodes a given ArrayBuffer or string into a base64url representation
|
|
69
|
-
* @param data
|
|
70
|
-
*/
|
|
71
|
-
export function encodeBase64Url(data) {
|
|
72
|
-
return convertBase64ToBase64url(base64.encodeBase64(data));
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Converts given base64url encoded data back to original
|
|
76
|
-
* @param b64url
|
|
77
|
-
*/
|
|
78
|
-
export function decodeBase64Url(b64url) {
|
|
79
|
-
return base64.decodeBase64(convertBase64urlToBase64(b64url));
|
|
80
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated (will be removed in 0.210.0) Use a `encodeHex` instead.
|
|
3
|
-
*
|
|
4
|
-
* Encodes `src` into `src.length * 2` bytes.
|
|
5
|
-
*/
|
|
6
|
-
export declare function encode(src: Uint8Array): Uint8Array;
|
|
7
|
-
/** Encodes the source into hex string. */
|
|
8
|
-
export declare function encodeHex(src: string | Uint8Array | ArrayBuffer): string;
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated (will be removed in 0.210.0) Use a `decodeHex` instead.
|
|
11
|
-
*
|
|
12
|
-
* Decodes `src` into `src.length / 2` bytes.
|
|
13
|
-
* If the input is malformed, an error will be thrown.
|
|
14
|
-
*/
|
|
15
|
-
export declare function decode(src: Uint8Array): Uint8Array;
|
|
16
|
-
/** Decodes the given hex string to Uint8Array.
|
|
17
|
-
* If the input is malformed, an error will be thrown. */
|
|
18
|
-
export declare function decodeHex(src: string): Uint8Array;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
// Copyright 2009 The Go Authors. All rights reserved.
|
|
2
|
-
// https://github.com/golang/go/blob/master/LICENSE
|
|
3
|
-
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
4
|
-
// This module is browser compatible.
|
|
5
|
-
import { validateBinaryLike } from "./_util.js";
|
|
6
|
-
/** Port of the Go
|
|
7
|
-
* [encoding/hex](https://github.com/golang/go/blob/go1.12.5/src/encoding/hex/hex.go)
|
|
8
|
-
* library.
|
|
9
|
-
*
|
|
10
|
-
* This module is browser compatible.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* import {
|
|
15
|
-
* decodeHex,
|
|
16
|
-
* encodeHex,
|
|
17
|
-
* } from "https://deno.land/std@$STD_VERSION/encoding/hex.ts";
|
|
18
|
-
*
|
|
19
|
-
* const binary = new TextEncoder().encode("abc");
|
|
20
|
-
* const encoded = encodeHex(binary);
|
|
21
|
-
* console.log(encoded);
|
|
22
|
-
* // => "616263"
|
|
23
|
-
*
|
|
24
|
-
* console.log(decodeHex(encoded));
|
|
25
|
-
* // => Uint8Array(3) [ 97, 98, 99 ]
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @module
|
|
29
|
-
*/
|
|
30
|
-
const hexTable = new TextEncoder().encode("0123456789abcdef");
|
|
31
|
-
const textEncoder = new TextEncoder();
|
|
32
|
-
const textDecoder = new TextDecoder();
|
|
33
|
-
function errInvalidByte(byte) {
|
|
34
|
-
return new TypeError(`Invalid byte '${String.fromCharCode(byte)}'`);
|
|
35
|
-
}
|
|
36
|
-
function errLength() {
|
|
37
|
-
return new RangeError("Odd length hex string");
|
|
38
|
-
}
|
|
39
|
-
/** Converts a hex character into its value. */
|
|
40
|
-
function fromHexChar(byte) {
|
|
41
|
-
// '0' <= byte && byte <= '9'
|
|
42
|
-
if (48 <= byte && byte <= 57)
|
|
43
|
-
return byte - 48;
|
|
44
|
-
// 'a' <= byte && byte <= 'f'
|
|
45
|
-
if (97 <= byte && byte <= 102)
|
|
46
|
-
return byte - 97 + 10;
|
|
47
|
-
// 'A' <= byte && byte <= 'F'
|
|
48
|
-
if (65 <= byte && byte <= 70)
|
|
49
|
-
return byte - 65 + 10;
|
|
50
|
-
throw errInvalidByte(byte);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* @deprecated (will be removed in 0.210.0) Use a `encodeHex` instead.
|
|
54
|
-
*
|
|
55
|
-
* Encodes `src` into `src.length * 2` bytes.
|
|
56
|
-
*/
|
|
57
|
-
export function encode(src) {
|
|
58
|
-
const dst = new Uint8Array(src.length * 2);
|
|
59
|
-
for (let i = 0; i < dst.length; i++) {
|
|
60
|
-
const v = src[i];
|
|
61
|
-
dst[i * 2] = hexTable[v >> 4];
|
|
62
|
-
dst[i * 2 + 1] = hexTable[v & 0x0f];
|
|
63
|
-
}
|
|
64
|
-
return dst;
|
|
65
|
-
}
|
|
66
|
-
/** Encodes the source into hex string. */
|
|
67
|
-
export function encodeHex(src) {
|
|
68
|
-
const u8 = validateBinaryLike(src);
|
|
69
|
-
const dst = new Uint8Array(u8.length * 2);
|
|
70
|
-
for (let i = 0; i < dst.length; i++) {
|
|
71
|
-
const v = u8[i];
|
|
72
|
-
dst[i * 2] = hexTable[v >> 4];
|
|
73
|
-
dst[i * 2 + 1] = hexTable[v & 0x0f];
|
|
74
|
-
}
|
|
75
|
-
return textDecoder.decode(dst);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* @deprecated (will be removed in 0.210.0) Use a `decodeHex` instead.
|
|
79
|
-
*
|
|
80
|
-
* Decodes `src` into `src.length / 2` bytes.
|
|
81
|
-
* If the input is malformed, an error will be thrown.
|
|
82
|
-
*/
|
|
83
|
-
export function decode(src) {
|
|
84
|
-
const dst = new Uint8Array(src.length / 2);
|
|
85
|
-
for (let i = 0; i < dst.length; i++) {
|
|
86
|
-
const a = fromHexChar(src[i * 2]);
|
|
87
|
-
const b = fromHexChar(src[i * 2 + 1]);
|
|
88
|
-
dst[i] = (a << 4) | b;
|
|
89
|
-
}
|
|
90
|
-
if (src.length % 2 === 1) {
|
|
91
|
-
// Check for invalid char before reporting bad length,
|
|
92
|
-
// since the invalid char (if present) is an earlier problem.
|
|
93
|
-
fromHexChar(src[dst.length * 2]);
|
|
94
|
-
throw errLength();
|
|
95
|
-
}
|
|
96
|
-
return dst;
|
|
97
|
-
}
|
|
98
|
-
/** Decodes the given hex string to Uint8Array.
|
|
99
|
-
* If the input is malformed, an error will be thrown. */
|
|
100
|
-
export function decodeHex(src) {
|
|
101
|
-
const u8 = textEncoder.encode(src);
|
|
102
|
-
const dst = new Uint8Array(u8.length / 2);
|
|
103
|
-
for (let i = 0; i < dst.length; i++) {
|
|
104
|
-
const a = fromHexChar(u8[i * 2]);
|
|
105
|
-
const b = fromHexChar(u8[i * 2 + 1]);
|
|
106
|
-
dst[i] = (a << 4) | b;
|
|
107
|
-
}
|
|
108
|
-
if (u8.length % 2 === 1) {
|
|
109
|
-
// Check for invalid char before reporting bad length,
|
|
110
|
-
// since the invalid char (if present) is an earlier problem.
|
|
111
|
-
fromHexChar(u8[dst.length * 2]);
|
|
112
|
-
throw errLength();
|
|
113
|
-
}
|
|
114
|
-
return dst;
|
|
115
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Ported from Go:
|
|
3
|
-
// https://github.com/golang/go/tree/go1.13.10/src/hash/fnv/fnv.go
|
|
4
|
-
// Copyright 2011 The Go Authors. All rights reserved. BSD license.
|
|
5
|
-
// https://github.com/golang/go/blob/master/LICENSE
|
|
6
|
-
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
7
|
-
// This module is browser compatible.
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.fnv32a = exports.fnv32 = void 0;
|
|
10
|
-
const util_js_1 = require("./util.js");
|
|
11
|
-
const prime32 = 16777619;
|
|
12
|
-
const fnv32 = (data) => {
|
|
13
|
-
let hash = 2166136261;
|
|
14
|
-
data.forEach((c) => {
|
|
15
|
-
hash = (0, util_js_1.mul32)(hash, prime32);
|
|
16
|
-
hash ^= c;
|
|
17
|
-
});
|
|
18
|
-
return Uint32Array.from([(0, util_js_1.swap32)(hash)]).buffer;
|
|
19
|
-
};
|
|
20
|
-
exports.fnv32 = fnv32;
|
|
21
|
-
const fnv32a = (data) => {
|
|
22
|
-
let hash = 2166136261;
|
|
23
|
-
data.forEach((c) => {
|
|
24
|
-
hash ^= c;
|
|
25
|
-
hash = (0, util_js_1.mul32)(hash, prime32);
|
|
26
|
-
});
|
|
27
|
-
return Uint32Array.from([(0, util_js_1.swap32)(hash)]).buffer;
|
|
28
|
-
};
|
|
29
|
-
exports.fnv32a = fnv32a;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Ported from Go:
|
|
3
|
-
// https://github.com/golang/go/tree/go1.13.10/src/hash/fnv/fnv.go
|
|
4
|
-
// Copyright 2011 The Go Authors. All rights reserved. BSD license.
|
|
5
|
-
// https://github.com/golang/go/blob/master/LICENSE
|
|
6
|
-
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
7
|
-
// This module is browser compatible.
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.fnv64a = exports.fnv64 = void 0;
|
|
10
|
-
const util_js_1 = require("./util.js");
|
|
11
|
-
const prime64Lo = 435;
|
|
12
|
-
const prime64Hi = 256;
|
|
13
|
-
const fnv64 = (data) => {
|
|
14
|
-
let hashLo = 2216829733;
|
|
15
|
-
let hashHi = 3421674724;
|
|
16
|
-
data.forEach((c) => {
|
|
17
|
-
[hashHi, hashLo] = (0, util_js_1.mul64)([hashHi, hashLo], [prime64Hi, prime64Lo]);
|
|
18
|
-
hashLo ^= c;
|
|
19
|
-
});
|
|
20
|
-
return new Uint32Array([(0, util_js_1.swap32)(hashHi >>> 0), (0, util_js_1.swap32)(hashLo >>> 0)]).buffer;
|
|
21
|
-
};
|
|
22
|
-
exports.fnv64 = fnv64;
|
|
23
|
-
const fnv64a = (data) => {
|
|
24
|
-
let hashLo = 2216829733;
|
|
25
|
-
let hashHi = 3421674724;
|
|
26
|
-
data.forEach((c) => {
|
|
27
|
-
hashLo ^= c;
|
|
28
|
-
[hashHi, hashLo] = (0, util_js_1.mul64)([hashHi, hashLo], [prime64Hi, prime64Lo]);
|
|
29
|
-
});
|
|
30
|
-
return new Uint32Array([(0, util_js_1.swap32)(hashHi >>> 0), (0, util_js_1.swap32)(hashLo >>> 0)]).buffer;
|
|
31
|
-
};
|
|
32
|
-
exports.fnv64a = fnv64a;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function fnv(name: string, buf?: Uint8Array): ArrayBuffer;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
3
|
-
// This module is browser compatible.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.fnv = void 0;
|
|
6
|
-
const fnv32_js_1 = require("./fnv32.js");
|
|
7
|
-
const fnv64_js_1 = require("./fnv64.js");
|
|
8
|
-
function fnv(name, buf) {
|
|
9
|
-
if (!buf) {
|
|
10
|
-
throw new TypeError("no data provided for hashing");
|
|
11
|
-
}
|
|
12
|
-
switch (name) {
|
|
13
|
-
case "FNV32":
|
|
14
|
-
return (0, fnv32_js_1.fnv32)(buf);
|
|
15
|
-
case "FNV64":
|
|
16
|
-
return (0, fnv64_js_1.fnv64)(buf);
|
|
17
|
-
case "FNV32A":
|
|
18
|
-
return (0, fnv32_js_1.fnv32a)(buf);
|
|
19
|
-
case "FNV64A":
|
|
20
|
-
return (0, fnv64_js_1.fnv64a)(buf);
|
|
21
|
-
default:
|
|
22
|
-
throw new TypeError(`unsupported fnv digest: ${name}`);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.fnv = fnv;
|
|
@@ -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,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
3
|
-
// This module is browser compatible.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.mul64 = exports.mul32 = exports.swap32 = void 0;
|
|
6
|
-
function swap32(val) {
|
|
7
|
-
return (((val & 0xff) << 24) |
|
|
8
|
-
((val & 0xff00) << 8) |
|
|
9
|
-
((val >> 8) & 0xff00) |
|
|
10
|
-
((val >> 24) & 0xff));
|
|
11
|
-
}
|
|
12
|
-
exports.swap32 = swap32;
|
|
13
|
-
function n16(n) {
|
|
14
|
-
return n & 0xffff;
|
|
15
|
-
}
|
|
16
|
-
function n32(n) {
|
|
17
|
-
return n >>> 0;
|
|
18
|
-
}
|
|
19
|
-
function add32WithCarry(a, b) {
|
|
20
|
-
const added = n32(a) + n32(b);
|
|
21
|
-
return [n32(added), added > 0xffffffff ? 1 : 0];
|
|
22
|
-
}
|
|
23
|
-
function mul32WithCarry(a, b) {
|
|
24
|
-
const al = n16(a);
|
|
25
|
-
const ah = n16(a >>> 16);
|
|
26
|
-
const bl = n16(b);
|
|
27
|
-
const bh = n16(b >>> 16);
|
|
28
|
-
const [t, tc] = add32WithCarry(al * bh, ah * bl);
|
|
29
|
-
const [n, nc] = add32WithCarry(al * bl, n32(t << 16));
|
|
30
|
-
const carry = nc + (tc << 16) + n16(t >>> 16) + ah * bh;
|
|
31
|
-
return [n, carry];
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* mul32 performs 32-bit multiplication, a * b
|
|
35
|
-
* @param a
|
|
36
|
-
* @param b
|
|
37
|
-
*/
|
|
38
|
-
function mul32(a, b) {
|
|
39
|
-
// https://stackoverflow.com/a/28151933
|
|
40
|
-
const al = n16(a);
|
|
41
|
-
const ah = a - al;
|
|
42
|
-
return n32(n32(ah * b) + al * b);
|
|
43
|
-
}
|
|
44
|
-
exports.mul32 = mul32;
|
|
45
|
-
/**
|
|
46
|
-
* mul64 performs 64-bit multiplication with two 32-bit words
|
|
47
|
-
* @param [ah, al]
|
|
48
|
-
* @param [bh, bl]
|
|
49
|
-
*/
|
|
50
|
-
function mul64([ah, al], [bh, bl]) {
|
|
51
|
-
const [n, c] = mul32WithCarry(al, bl);
|
|
52
|
-
return [n32(mul32(al, bh) + mul32(ah, bl) + c), n];
|
|
53
|
-
}
|
|
54
|
-
exports.mul64 = mul64;
|