@mtkruto/node 0.1.100 → 0.1.101
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 +4 -3
- package/esm/0_deps.js +4 -3
- package/esm/4_constants.d.ts +1 -1
- package/esm/4_constants.js +1 -1
- package/esm/client/0_message.js +3 -9
- package/esm/client/3_types.d.ts +2 -0
- package/esm/client/4_client.d.ts +19 -3
- package/esm/client/4_client.js +209 -68
- package/esm/connection/1_connection_web_socket.js +5 -2
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_false.js +1 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.d.ts +2 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.js +24 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.d.ts +2 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.js +27 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/mod.d.ts +1 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/mod.js +21 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/util.d.ts +13 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/util.js +48 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.d.ts +125 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.js +3337 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/mod.d.ts +12 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/mod.js +39 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/crypto.d.ts +157 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/crypto.js +266 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/keystack.d.ts +4 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/keystack.js +6 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/mod.d.ts +12 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/mod.js +14 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.d.ts +28 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.js +54 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/to_hash_string.d.ts +19 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/to_hash_string.js +31 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/unstable/keystack.d.ts +46 -0
- package/esm/deps/deno.land/std@0.203.0/crypto/unstable/keystack.js +149 -0
- package/esm/deps/deno.land/std@0.203.0/encoding/_util.d.ts +1 -0
- package/esm/deps/deno.land/std@0.203.0/encoding/_util.js +26 -0
- package/esm/deps/deno.land/std@0.203.0/encoding/base64.d.ts +23 -0
- package/{script/deps/deno.land/std@0.201.0 → esm/deps/deno.land/std@0.203.0}/encoding/base64.js +23 -18
- package/esm/deps/deno.land/std@0.203.0/encoding/base64url.d.ts +24 -0
- package/esm/deps/deno.land/std@0.203.0/encoding/base64url.js +80 -0
- package/esm/deps/deno.land/std@0.203.0/encoding/hex.d.ts +18 -0
- package/esm/deps/deno.land/std@0.203.0/encoding/hex.js +115 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/fmt/colors.js +1 -1
- package/esm/deps/deno.land/x/{tgcrypto@0.3.2 → tgcrypto@0.3.3}/mod.js +10 -4
- package/esm/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +324 -0
- package/esm/types/3_message.js +1 -1
- package/esm/utilities/0_bigint.d.ts +1 -0
- package/esm/utilities/0_bigint.js +1 -0
- package/esm/utilities/0_queue.js +1 -1
- package/package.json +1 -1
- package/script/0_deps.d.ts +4 -3
- package/script/0_deps.js +6 -4
- package/script/4_constants.d.ts +1 -1
- package/script/4_constants.js +1 -1
- package/script/client/0_message.js +2 -8
- package/script/client/3_types.d.ts +2 -0
- package/script/client/4_client.d.ts +19 -3
- package/script/client/4_client.js +208 -66
- package/script/connection/1_connection_web_socket.js +5 -2
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_false.js +1 -0
- package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.d.ts +2 -0
- package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.js +29 -0
- package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.d.ts +2 -0
- package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.js +32 -0
- package/script/deps/deno.land/std@0.203.0/crypto/_fnv/mod.d.ts +1 -0
- package/script/deps/deno.land/std@0.203.0/crypto/_fnv/mod.js +25 -0
- package/script/deps/deno.land/std@0.203.0/crypto/_fnv/util.d.ts +13 -0
- package/script/deps/deno.land/std@0.203.0/crypto/_fnv/util.js +54 -0
- package/script/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.d.ts +125 -0
- package/script/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.js +3345 -0
- package/script/deps/deno.land/std@0.203.0/crypto/_wasm/mod.d.ts +12 -0
- package/script/deps/deno.land/std@0.203.0/crypto/_wasm/mod.js +44 -0
- package/script/deps/deno.land/std@0.203.0/crypto/crypto.d.ts +157 -0
- package/script/deps/deno.land/std@0.203.0/crypto/crypto.js +292 -0
- package/script/deps/deno.land/std@0.203.0/crypto/keystack.d.ts +4 -0
- package/script/deps/deno.land/std@0.203.0/crypto/keystack.js +22 -0
- package/script/deps/deno.land/std@0.203.0/crypto/mod.d.ts +12 -0
- package/script/deps/deno.land/std@0.203.0/crypto/mod.js +30 -0
- package/script/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.d.ts +28 -0
- package/script/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.js +58 -0
- package/script/deps/deno.land/std@0.203.0/crypto/to_hash_string.d.ts +19 -0
- package/script/deps/deno.land/std@0.203.0/crypto/to_hash_string.js +35 -0
- package/script/deps/deno.land/std@0.203.0/crypto/unstable/keystack.d.ts +46 -0
- package/script/deps/deno.land/std@0.203.0/crypto/unstable/keystack.js +176 -0
- package/script/deps/deno.land/std@0.203.0/encoding/_util.d.ts +1 -0
- package/script/deps/deno.land/std@0.203.0/encoding/_util.js +30 -0
- package/script/deps/deno.land/std@0.203.0/encoding/base64.d.ts +23 -0
- package/{esm/deps/deno.land/std@0.201.0 → script/deps/deno.land/std@0.203.0}/encoding/base64.js +28 -13
- package/script/deps/deno.land/std@0.203.0/encoding/base64url.d.ts +24 -0
- package/script/deps/deno.land/std@0.203.0/encoding/base64url.js +108 -0
- package/script/deps/deno.land/std@0.203.0/encoding/hex.d.ts +18 -0
- package/script/deps/deno.land/std@0.203.0/encoding/hex.js +122 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/fmt/colors.js +1 -1
- package/script/deps/deno.land/x/{tgcrypto@0.3.2 → tgcrypto@0.3.3}/mod.js +10 -4
- package/script/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +326 -0
- package/script/types/3_message.js +1 -1
- package/script/utilities/0_bigint.d.ts +1 -0
- package/script/utilities/0_bigint.js +1 -0
- package/script/utilities/0_queue.js +1 -1
- package/esm/deps/deno.land/std@0.201.0/encoding/base64.d.ts +0 -11
- package/esm/deps/deno.land/x/tgcrypto@0.3.2/tgcrypto.js +0 -308
- package/script/deps/deno.land/std@0.201.0/encoding/base64.d.ts +0 -11
- package/script/deps/deno.land/x/tgcrypto@0.3.2/tgcrypto.js +0 -310
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_constants.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_constants.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_diff.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_diff.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_format.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_format.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_almost_equals.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_almost_equals.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_array_includes.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_array_includes.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_equals.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_equals.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_exists.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_exists.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_false.d.ts +1 -1
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_greater.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_greater.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_greater_or_equal.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_greater_or_equal.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_instance_of.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_instance_of.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_is_error.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_is_error.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_less.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_less.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_less_or_equal.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_less_or_equal.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_match.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_match.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_equals.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_equals.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_instance_of.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_instance_of.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_match.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_match.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_strict_equals.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_strict_equals.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_object_match.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_object_match.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_rejects.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_rejects.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_strict_equals.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_strict_equals.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_string_includes.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_string_includes.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_throws.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_throws.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assertion_error.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assertion_error.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/equal.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/equal.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/fail.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/fail.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/mod.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/mod.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/unimplemented.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/unimplemented.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/unreachable.d.ts +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/unreachable.js +0 -0
- package/esm/deps/deno.land/{std@0.201.0 → std@0.203.0}/fmt/colors.d.ts +0 -0
- package/esm/deps/deno.land/x/{tgcrypto@0.3.2 → tgcrypto@0.3.3}/mod.d.ts +0 -0
- package/esm/deps/deno.land/x/{tgcrypto@0.3.2 → tgcrypto@0.3.3}/tgcrypto.d.ts +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_constants.d.ts +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_constants.js +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_diff.d.ts +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_diff.js +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_format.d.ts +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/_format.js +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert.d.ts +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert.js +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_almost_equals.d.ts +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_almost_equals.js +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_array_includes.d.ts +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_array_includes.js +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_equals.d.ts +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_equals.js +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_exists.d.ts +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_exists.js +0 -0
- package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_false.d.ts +1 -1
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_greater.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_greater.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_greater_or_equal.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_greater_or_equal.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_instance_of.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_instance_of.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_is_error.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_is_error.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_less.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_less.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_less_or_equal.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_less_or_equal.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_match.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_match.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_equals.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_equals.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_instance_of.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_instance_of.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_match.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_match.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_strict_equals.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_not_strict_equals.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_object_match.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_object_match.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_rejects.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_rejects.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_strict_equals.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_strict_equals.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_string_includes.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_string_includes.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_throws.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assert_throws.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assertion_error.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/assertion_error.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/equal.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/equal.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/fail.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/fail.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/mod.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/mod.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/unimplemented.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/unimplemented.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/unreachable.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/assert/unreachable.js +0 -0
- /package/script/deps/deno.land/{std@0.201.0 → std@0.203.0}/fmt/colors.d.ts +0 -0
- /package/script/deps/deno.land/x/{tgcrypto@0.3.2 → tgcrypto@0.3.3}/mod.d.ts +0 -0
- /package/script/deps/deno.land/x/{tgcrypto@0.3.2 → tgcrypto@0.3.3}/tgcrypto.d.ts +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function validateBinaryLike(source: unknown): Uint8Array;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
const encoder = new TextEncoder();
|
|
3
|
+
function getTypeName(value) {
|
|
4
|
+
const type = typeof value;
|
|
5
|
+
if (type !== "object") {
|
|
6
|
+
return type;
|
|
7
|
+
}
|
|
8
|
+
else if (value === null) {
|
|
9
|
+
return "null";
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return value?.constructor?.name ?? "object";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function validateBinaryLike(source) {
|
|
16
|
+
if (typeof source === "string") {
|
|
17
|
+
return encoder.encode(source);
|
|
18
|
+
}
|
|
19
|
+
else if (source instanceof Uint8Array) {
|
|
20
|
+
return source;
|
|
21
|
+
}
|
|
22
|
+
else if (source instanceof ArrayBuffer) {
|
|
23
|
+
return new Uint8Array(source);
|
|
24
|
+
}
|
|
25
|
+
throw new TypeError(`The input must be a Uint8Array, a string, or an ArrayBuffer. Received a value of the type ${getTypeName(source)}.`);
|
|
26
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated (will be removed in 0.210.0) Use a `encodeBase64` instead.
|
|
3
|
+
*
|
|
4
|
+
* CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727
|
|
5
|
+
* Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation
|
|
6
|
+
* @param data
|
|
7
|
+
*/
|
|
8
|
+
export declare const encode: typeof encodeBase64;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated (will be removed in 0.210.0) Use a `decodeBase64` instead.
|
|
11
|
+
*
|
|
12
|
+
* Decodes a given RFC4648 base64 encoded string
|
|
13
|
+
* @param b64
|
|
14
|
+
*/
|
|
15
|
+
export declare const decode: typeof decodeBase64;
|
|
16
|
+
/**
|
|
17
|
+
* Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation
|
|
18
|
+
*/
|
|
19
|
+
export declare function encodeBase64(data: ArrayBuffer | Uint8Array | string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Decodes a given RFC4648 base64 encoded string
|
|
22
|
+
*/
|
|
23
|
+
export declare function decodeBase64(b64: string): Uint8Array;
|
package/{script/deps/deno.land/std@0.201.0 → esm/deps/deno.land/std@0.203.0}/encoding/base64.js
RENAMED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
3
2
|
// This module is browser compatible.
|
|
4
|
-
|
|
5
|
-
exports.decode = exports.encode = void 0;
|
|
3
|
+
import { validateBinaryLike } from "./_util.js";
|
|
6
4
|
/**
|
|
7
|
-
* {@linkcode
|
|
5
|
+
* {@linkcode encodeBase64} and {@linkcode decodeBase64} for
|
|
8
6
|
* [base64](https://en.wikipedia.org/wiki/Base64) encoding.
|
|
9
7
|
*
|
|
10
8
|
* This module is browser compatible.
|
|
@@ -12,17 +10,17 @@ exports.decode = exports.encode = void 0;
|
|
|
12
10
|
* @example
|
|
13
11
|
* ```ts
|
|
14
12
|
* import {
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* decodeBase64,
|
|
14
|
+
* encodeBase64,
|
|
17
15
|
* } from "https://deno.land/std@$STD_VERSION/encoding/base64.ts";
|
|
18
16
|
*
|
|
19
17
|
* const b64Repr = "Zm9vYg==";
|
|
20
18
|
*
|
|
21
|
-
* const binaryData =
|
|
19
|
+
* const binaryData = decodeBase64(b64Repr);
|
|
22
20
|
* console.log(binaryData);
|
|
23
21
|
* // => Uint8Array [ 102, 111, 111, 98 ]
|
|
24
22
|
*
|
|
25
|
-
* console.log(
|
|
23
|
+
* console.log(encodeBase64(binaryData));
|
|
26
24
|
* // => Zm9vYg==
|
|
27
25
|
* ```
|
|
28
26
|
*
|
|
@@ -95,16 +93,26 @@ const base64abc = [
|
|
|
95
93
|
"/",
|
|
96
94
|
];
|
|
97
95
|
/**
|
|
96
|
+
* @deprecated (will be removed in 0.210.0) Use a `encodeBase64` instead.
|
|
97
|
+
*
|
|
98
98
|
* CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727
|
|
99
99
|
* Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation
|
|
100
100
|
* @param data
|
|
101
101
|
*/
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
export const encode = encodeBase64;
|
|
103
|
+
/**
|
|
104
|
+
* @deprecated (will be removed in 0.210.0) Use a `decodeBase64` instead.
|
|
105
|
+
*
|
|
106
|
+
* Decodes a given RFC4648 base64 encoded string
|
|
107
|
+
* @param b64
|
|
108
|
+
*/
|
|
109
|
+
export const decode = decodeBase64;
|
|
110
|
+
/**
|
|
111
|
+
* Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation
|
|
112
|
+
*/
|
|
113
|
+
export function encodeBase64(data) {
|
|
114
|
+
// CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727
|
|
115
|
+
const uint8 = validateBinaryLike(data);
|
|
108
116
|
let result = "", i;
|
|
109
117
|
const l = uint8.length;
|
|
110
118
|
for (i = 2; i < l; i += 3) {
|
|
@@ -128,12 +136,10 @@ function encode(data) {
|
|
|
128
136
|
}
|
|
129
137
|
return result;
|
|
130
138
|
}
|
|
131
|
-
exports.encode = encode;
|
|
132
139
|
/**
|
|
133
140
|
* Decodes a given RFC4648 base64 encoded string
|
|
134
|
-
* @param b64
|
|
135
141
|
*/
|
|
136
|
-
function
|
|
142
|
+
export function decodeBase64(b64) {
|
|
137
143
|
const binString = atob(b64);
|
|
138
144
|
const size = binString.length;
|
|
139
145
|
const bytes = new Uint8Array(size);
|
|
@@ -142,4 +148,3 @@ function decode(b64) {
|
|
|
142
148
|
}
|
|
143
149
|
return bytes;
|
|
144
150
|
}
|
|
145
|
-
exports.decode = decode;
|
|
@@ -0,0 +1,24 @@
|
|
|
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;
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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;
|
|
@@ -0,0 +1,115 @@
|
|
|
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
|
+
}
|
|
@@ -463,7 +463,7 @@ export function bgRgb24(str, color) {
|
|
|
463
463
|
// https://github.com/chalk/ansi-regex/blob/02fa893d619d3da85411acc8fd4e2eea0e95a9d9/index.js
|
|
464
464
|
const ANSI_PATTERN = new RegExp([
|
|
465
465
|
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
|
466
|
-
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-
|
|
466
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TXZcf-nq-uy=><~]))",
|
|
467
467
|
].join("|"), "g");
|
|
468
468
|
/**
|
|
469
469
|
* @deprecated (will be removed in 1.0.0) Use `stripAnsiCode` instead.
|
|
@@ -28,13 +28,16 @@ function checkIgeParams(data, key, iv) {
|
|
|
28
28
|
*/
|
|
29
29
|
export function ige256Encrypt(data, key, iv) {
|
|
30
30
|
checkIgeParams(data, key, iv);
|
|
31
|
-
const out = module_._malloc(
|
|
32
|
-
module_.
|
|
31
|
+
const out = module_._malloc(data.length);
|
|
32
|
+
const datap = module_._malloc(data.length);
|
|
33
|
+
module_.HEAPU8.set(data, datap);
|
|
34
|
+
module_.ccall("ige256_encrypt", "void", ["pointer", "pointer", "number", "array", "array"], [datap, out, data.length, key, iv]);
|
|
33
35
|
try {
|
|
34
36
|
return module_.HEAPU8.slice(out, out + data.length);
|
|
35
37
|
}
|
|
36
38
|
finally {
|
|
37
39
|
module_._free(out);
|
|
40
|
+
module_._free(datap);
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
/**
|
|
@@ -46,13 +49,16 @@ export function ige256Encrypt(data, key, iv) {
|
|
|
46
49
|
*/
|
|
47
50
|
export function ige256Decrypt(data, key, iv) {
|
|
48
51
|
checkIgeParams(data, key, iv);
|
|
49
|
-
const out = module_._malloc(
|
|
50
|
-
module_.
|
|
52
|
+
const out = module_._malloc(data.length);
|
|
53
|
+
const datap = module_._malloc(data.length);
|
|
54
|
+
module_.HEAPU8.set(data, datap);
|
|
55
|
+
module_.ccall("ige256_decrypt", "void", ["pointer", "pointer", "number", "array", "array"], [datap, out, data.length, key, iv]);
|
|
51
56
|
try {
|
|
52
57
|
return module_.HEAPU8.slice(out, out + data.length);
|
|
53
58
|
}
|
|
54
59
|
finally {
|
|
55
60
|
module_._free(out);
|
|
61
|
+
module_._free(datap);
|
|
56
62
|
}
|
|
57
63
|
}
|
|
58
64
|
function checkCtrParams(data, key, iv, state) {
|