react-native-quick-crypto 1.1.0 → 1.1.2
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/QuickCrypto.podspec +1 -0
- package/android/CMakeLists.txt +4 -0
- package/android/build.gradle +5 -1
- package/cpp/argon2/HybridArgon2.cpp +10 -3
- package/cpp/blake3/HybridBlake3.cpp +5 -3
- package/cpp/cipher/CCMCipher.cpp +35 -26
- package/cpp/cipher/CCMCipher.hpp +2 -4
- package/cpp/cipher/ChaCha20Cipher.cpp +19 -27
- package/cpp/cipher/ChaCha20Cipher.hpp +2 -4
- package/cpp/cipher/ChaCha20Poly1305Cipher.cpp +41 -36
- package/cpp/cipher/ChaCha20Poly1305Cipher.hpp +2 -4
- package/cpp/cipher/GCMCipher.cpp +17 -20
- package/cpp/cipher/HybridCipher.cpp +44 -47
- package/cpp/cipher/HybridCipher.hpp +17 -1
- package/cpp/cipher/HybridRsaCipher.cpp +93 -56
- package/cpp/cipher/OCBCipher.cpp +5 -5
- package/cpp/cipher/XChaCha20Poly1305Cipher.cpp +27 -32
- package/cpp/cipher/XSalsa20Cipher.cpp +78 -16
- package/cpp/cipher/XSalsa20Cipher.hpp +25 -3
- package/cpp/cipher/XSalsa20Poly1305Cipher.cpp +32 -41
- package/cpp/dh/HybridDiffieHellman.cpp +29 -0
- package/cpp/ec/HybridEcKeyPair.cpp +35 -33
- package/cpp/ec/HybridEcKeyPair.hpp +3 -7
- package/cpp/ecdh/HybridECDH.cpp +23 -0
- package/cpp/ed25519/HybridEdKeyPair.cpp +73 -117
- package/cpp/ed25519/HybridEdKeyPair.hpp +5 -9
- package/cpp/hash/HybridHash.cpp +5 -7
- package/cpp/hkdf/HybridHkdf.cpp +6 -4
- package/cpp/hmac/HybridHmac.cpp +4 -6
- package/cpp/keys/HybridKeyObjectHandle.cpp +630 -2
- package/cpp/keys/HybridKeyObjectHandle.hpp +21 -1
- package/cpp/kmac/HybridKmac.cpp +4 -4
- package/cpp/mldsa/HybridMlDsaKeyPair.cpp +37 -49
- package/cpp/mlkem/HybridMlKemKeyPair.cpp +39 -43
- package/cpp/pbkdf2/HybridPbkdf2.cpp +7 -8
- package/cpp/rsa/HybridRsaKeyPair.cpp +5 -8
- package/cpp/rsa/HybridRsaKeyPair.hpp +4 -7
- package/cpp/scrypt/HybridScrypt.cpp +6 -4
- package/cpp/sign/HybridSignHandle.cpp +47 -72
- package/cpp/sign/HybridVerifyHandle.cpp +47 -67
- package/cpp/slhdsa/HybridSlhDsaKeyPair.cpp +245 -0
- package/cpp/slhdsa/HybridSlhDsaKeyPair.hpp +48 -0
- package/cpp/turboshake/HybridTurboShake.cpp +379 -0
- package/cpp/turboshake/HybridTurboShake.hpp +28 -0
- package/cpp/utils/HybridUtils.cpp +195 -43
- package/cpp/utils/HybridUtils.hpp +9 -2
- package/cpp/utils/QuickCryptoUtils.hpp +72 -0
- package/deps/blake3/README.md +6 -7
- package/deps/blake3/c/blake3.c +3 -2
- package/deps/blake3/c/blake3.h +2 -2
- package/deps/blake3/c/blake3_dispatch.c +2 -2
- package/deps/blake3/c/blake3_impl.h +1 -1
- package/deps/blake3/c/blake3_neon.c +5 -4
- package/deps/ncrypto/include/ncrypto/version.h +2 -2
- package/deps/ncrypto/include/ncrypto.h +9 -2
- package/deps/ncrypto/src/ncrypto.cpp +130 -35
- package/lib/commonjs/argon2.js +51 -2
- package/lib/commonjs/argon2.js.map +1 -1
- package/lib/commonjs/cipher.js +109 -11
- package/lib/commonjs/cipher.js.map +1 -1
- package/lib/commonjs/dhKeyPair.js +3 -0
- package/lib/commonjs/dhKeyPair.js.map +1 -1
- package/lib/commonjs/dsa.js +11 -2
- package/lib/commonjs/dsa.js.map +1 -1
- package/lib/commonjs/ec.js +37 -30
- package/lib/commonjs/ec.js.map +1 -1
- package/lib/commonjs/ed.js +60 -6
- package/lib/commonjs/ed.js.map +1 -1
- package/lib/commonjs/hash.js +67 -10
- package/lib/commonjs/hash.js.map +1 -1
- package/lib/commonjs/hkdf.js +33 -6
- package/lib/commonjs/hkdf.js.map +1 -1
- package/lib/commonjs/hmac.js +15 -5
- package/lib/commonjs/hmac.js.map +1 -1
- package/lib/commonjs/keys/classes.js +33 -7
- package/lib/commonjs/keys/classes.js.map +1 -1
- package/lib/commonjs/keys/generateKeyPair.js +85 -4
- package/lib/commonjs/keys/generateKeyPair.js.map +1 -1
- package/lib/commonjs/keys/index.js +50 -2
- package/lib/commonjs/keys/index.js.map +1 -1
- package/lib/commonjs/keys/publicCipher.js +10 -4
- package/lib/commonjs/keys/publicCipher.js.map +1 -1
- package/lib/commonjs/keys/signVerify.js +9 -2
- package/lib/commonjs/keys/signVerify.js.map +1 -1
- package/lib/commonjs/keys/utils.js +59 -1
- package/lib/commonjs/keys/utils.js.map +1 -1
- package/lib/commonjs/random.js +74 -11
- package/lib/commonjs/random.js.map +1 -1
- package/lib/commonjs/rsa.js +15 -5
- package/lib/commonjs/rsa.js.map +1 -1
- package/lib/commonjs/scrypt.js +47 -6
- package/lib/commonjs/scrypt.js.map +1 -1
- package/lib/commonjs/slhdsa.js +70 -0
- package/lib/commonjs/slhdsa.js.map +1 -0
- package/lib/commonjs/specs/slhDsaKeyPair.nitro.js +6 -0
- package/lib/commonjs/specs/slhDsaKeyPair.nitro.js.map +1 -0
- package/lib/commonjs/specs/turboshake.nitro.js +6 -0
- package/lib/commonjs/specs/turboshake.nitro.js.map +1 -0
- package/lib/commonjs/subtle.js +975 -253
- package/lib/commonjs/subtle.js.map +1 -1
- package/lib/commonjs/utils/cipher.js +18 -7
- package/lib/commonjs/utils/cipher.js.map +1 -1
- package/lib/commonjs/utils/conversion.js +86 -28
- package/lib/commonjs/utils/conversion.js.map +1 -1
- package/lib/commonjs/utils/errors.js +63 -4
- package/lib/commonjs/utils/errors.js.map +1 -1
- package/lib/commonjs/utils/timingSafeEqual.js +7 -2
- package/lib/commonjs/utils/timingSafeEqual.js.map +1 -1
- package/lib/commonjs/utils/types.js.map +1 -1
- package/lib/commonjs/utils/validation.js +46 -0
- package/lib/commonjs/utils/validation.js.map +1 -1
- package/lib/commonjs/x509certificate.js +6 -6
- package/lib/commonjs/x509certificate.js.map +1 -1
- package/lib/module/argon2.js +51 -2
- package/lib/module/argon2.js.map +1 -1
- package/lib/module/cipher.js +109 -11
- package/lib/module/cipher.js.map +1 -1
- package/lib/module/dhKeyPair.js +3 -0
- package/lib/module/dhKeyPair.js.map +1 -1
- package/lib/module/dsa.js +11 -2
- package/lib/module/dsa.js.map +1 -1
- package/lib/module/ec.js +38 -31
- package/lib/module/ec.js.map +1 -1
- package/lib/module/ed.js +61 -7
- package/lib/module/ed.js.map +1 -1
- package/lib/module/hash.js +67 -10
- package/lib/module/hash.js.map +1 -1
- package/lib/module/hkdf.js +33 -6
- package/lib/module/hkdf.js.map +1 -1
- package/lib/module/hmac.js +15 -5
- package/lib/module/hmac.js.map +1 -1
- package/lib/module/keys/classes.js +31 -5
- package/lib/module/keys/classes.js.map +1 -1
- package/lib/module/keys/generateKeyPair.js +86 -5
- package/lib/module/keys/generateKeyPair.js.map +1 -1
- package/lib/module/keys/index.js +50 -2
- package/lib/module/keys/index.js.map +1 -1
- package/lib/module/keys/publicCipher.js +10 -4
- package/lib/module/keys/publicCipher.js.map +1 -1
- package/lib/module/keys/signVerify.js +9 -2
- package/lib/module/keys/signVerify.js.map +1 -1
- package/lib/module/keys/utils.js +57 -1
- package/lib/module/keys/utils.js.map +1 -1
- package/lib/module/random.js +74 -12
- package/lib/module/random.js.map +1 -1
- package/lib/module/rsa.js +14 -4
- package/lib/module/rsa.js.map +1 -1
- package/lib/module/scrypt.js +47 -6
- package/lib/module/scrypt.js.map +1 -1
- package/lib/module/slhdsa.js +64 -0
- package/lib/module/slhdsa.js.map +1 -0
- package/lib/module/specs/slhDsaKeyPair.nitro.js +4 -0
- package/lib/module/specs/slhDsaKeyPair.nitro.js.map +1 -0
- package/lib/module/specs/turboshake.nitro.js +4 -0
- package/lib/module/specs/turboshake.nitro.js.map +1 -0
- package/lib/module/subtle.js +976 -254
- package/lib/module/subtle.js.map +1 -1
- package/lib/module/utils/cipher.js +18 -7
- package/lib/module/utils/cipher.js.map +1 -1
- package/lib/module/utils/conversion.js +84 -28
- package/lib/module/utils/conversion.js.map +1 -1
- package/lib/module/utils/errors.js +61 -4
- package/lib/module/utils/errors.js.map +1 -1
- package/lib/module/utils/timingSafeEqual.js +8 -3
- package/lib/module/utils/timingSafeEqual.js.map +1 -1
- package/lib/module/utils/types.js.map +1 -1
- package/lib/module/utils/validation.js +44 -0
- package/lib/module/utils/validation.js.map +1 -1
- package/lib/module/x509certificate.js +6 -6
- package/lib/module/x509certificate.js.map +1 -1
- package/lib/typescript/argon2.d.ts.map +1 -1
- package/lib/typescript/cipher.d.ts +2 -2
- package/lib/typescript/cipher.d.ts.map +1 -1
- package/lib/typescript/dhKeyPair.d.ts.map +1 -1
- package/lib/typescript/dsa.d.ts.map +1 -1
- package/lib/typescript/ec.d.ts.map +1 -1
- package/lib/typescript/ed.d.ts.map +1 -1
- package/lib/typescript/hash.d.ts +2 -2
- package/lib/typescript/hash.d.ts.map +1 -1
- package/lib/typescript/hkdf.d.ts.map +1 -1
- package/lib/typescript/hmac.d.ts +2 -2
- package/lib/typescript/hmac.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +13 -8
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/keys/classes.d.ts +10 -1
- package/lib/typescript/keys/classes.d.ts.map +1 -1
- package/lib/typescript/keys/generateKeyPair.d.ts +12 -1
- package/lib/typescript/keys/generateKeyPair.d.ts.map +1 -1
- package/lib/typescript/keys/index.d.ts +3 -1
- package/lib/typescript/keys/index.d.ts.map +1 -1
- package/lib/typescript/keys/publicCipher.d.ts.map +1 -1
- package/lib/typescript/keys/signVerify.d.ts.map +1 -1
- package/lib/typescript/keys/utils.d.ts +21 -4
- package/lib/typescript/keys/utils.d.ts.map +1 -1
- package/lib/typescript/random.d.ts +5 -1
- package/lib/typescript/random.d.ts.map +1 -1
- package/lib/typescript/rsa.d.ts.map +1 -1
- package/lib/typescript/scrypt.d.ts.map +1 -1
- package/lib/typescript/slhdsa.d.ts +19 -0
- package/lib/typescript/slhdsa.d.ts.map +1 -0
- package/lib/typescript/specs/keyObjectHandle.nitro.d.ts +9 -0
- package/lib/typescript/specs/keyObjectHandle.nitro.d.ts.map +1 -1
- package/lib/typescript/specs/slhDsaKeyPair.nitro.d.ts +16 -0
- package/lib/typescript/specs/slhDsaKeyPair.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/turboshake.nitro.d.ts +11 -0
- package/lib/typescript/specs/turboshake.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/utils.nitro.d.ts +0 -2
- package/lib/typescript/specs/utils.nitro.d.ts.map +1 -1
- package/lib/typescript/subtle.d.ts +3 -2
- package/lib/typescript/subtle.d.ts.map +1 -1
- package/lib/typescript/utils/cipher.d.ts +13 -1
- package/lib/typescript/utils/cipher.d.ts.map +1 -1
- package/lib/typescript/utils/conversion.d.ts +13 -9
- package/lib/typescript/utils/conversion.d.ts.map +1 -1
- package/lib/typescript/utils/errors.d.ts +12 -0
- package/lib/typescript/utils/errors.d.ts.map +1 -1
- package/lib/typescript/utils/timingSafeEqual.d.ts.map +1 -1
- package/lib/typescript/utils/types.d.ts +32 -15
- package/lib/typescript/utils/types.d.ts.map +1 -1
- package/lib/typescript/utils/validation.d.ts +3 -1
- package/lib/typescript/utils/validation.d.ts.map +1 -1
- package/lib/typescript/x509certificate.d.ts.map +1 -1
- package/nitrogen/generated/android/QuickCrypto+autolinking.cmake +2 -0
- package/nitrogen/generated/android/QuickCryptoOnLoad.cpp +20 -0
- package/nitrogen/generated/ios/QuickCryptoAutolinking.mm +20 -0
- package/nitrogen/generated/shared/c++/AsymmetricKeyType.hpp +48 -0
- package/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.cpp +9 -0
- package/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.hpp +9 -0
- package/nitrogen/generated/shared/c++/HybridSlhDsaKeyPairSpec.cpp +29 -0
- package/nitrogen/generated/shared/c++/HybridSlhDsaKeyPairSpec.hpp +72 -0
- package/nitrogen/generated/shared/c++/HybridTurboShakeSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridTurboShakeSpec.hpp +70 -0
- package/nitrogen/generated/shared/c++/HybridUtilsSpec.cpp +0 -2
- package/nitrogen/generated/shared/c++/HybridUtilsSpec.hpp +0 -3
- package/nitrogen/generated/shared/c++/JWK.hpp +9 -1
- package/nitrogen/generated/shared/c++/JWKkty.hpp +4 -0
- package/nitrogen/generated/shared/c++/KangarooTwelveVariant.hpp +76 -0
- package/nitrogen/generated/shared/c++/TurboShakeVariant.hpp +76 -0
- package/package.json +38 -7
- package/src/argon2.ts +80 -2
- package/src/cipher.ts +139 -15
- package/src/dhKeyPair.ts +8 -0
- package/src/dsa.ts +19 -2
- package/src/ec.ts +52 -29
- package/src/ed.ts +95 -16
- package/src/hash.ts +125 -12
- package/src/hkdf.ts +44 -6
- package/src/hmac.ts +17 -7
- package/src/keys/classes.ts +46 -5
- package/src/keys/generateKeyPair.ts +151 -5
- package/src/keys/index.ts +73 -3
- package/src/keys/publicCipher.ts +10 -4
- package/src/keys/signVerify.ts +13 -2
- package/src/keys/utils.ts +78 -5
- package/src/random.ts +104 -11
- package/src/rsa.ts +26 -4
- package/src/scrypt.ts +73 -6
- package/src/slhdsa.ts +146 -0
- package/src/specs/keyObjectHandle.nitro.ts +17 -0
- package/src/specs/slhDsaKeyPair.nitro.ts +29 -0
- package/src/specs/turboshake.nitro.ts +21 -0
- package/src/specs/utils.nitro.ts +0 -2
- package/src/subtle.ts +1246 -333
- package/src/utils/cipher.ts +30 -8
- package/src/utils/conversion.ts +129 -40
- package/src/utils/errors.ts +72 -4
- package/src/utils/timingSafeEqual.ts +8 -3
- package/src/utils/types.ts +80 -15
- package/src/utils/validation.ts +70 -1
- package/src/x509certificate.ts +5 -6
- package/deps/blake3/.cargo/config.toml +0 -2
- package/deps/blake3/.git-blame-ignore-revs +0 -2
- package/deps/blake3/.github/workflows/build_b3sum.py +0 -38
- package/deps/blake3/.github/workflows/ci.yml +0 -491
- package/deps/blake3/.github/workflows/tag.yml +0 -43
- package/deps/blake3/.github/workflows/upload_github_release_asset.py +0 -73
- package/deps/blake3/CONTRIBUTING.md +0 -31
- package/deps/blake3/Cargo.toml +0 -135
- package/deps/blake3/b3sum/Cargo.lock +0 -513
- package/deps/blake3/b3sum/Cargo.toml +0 -26
- package/deps/blake3/b3sum/README.md +0 -72
- package/deps/blake3/b3sum/src/main.rs +0 -564
- package/deps/blake3/b3sum/src/unit_tests.rs +0 -235
- package/deps/blake3/b3sum/tests/cli_tests.rs +0 -680
- package/deps/blake3/b3sum/what_does_check_do.md +0 -176
- package/deps/blake3/benches/bench.rs +0 -623
- package/deps/blake3/build.rs +0 -389
- package/deps/blake3/c/CMakeLists.txt +0 -383
- package/deps/blake3/c/CMakePresets.json +0 -73
- package/deps/blake3/c/Makefile.testing +0 -82
- package/deps/blake3/c/blake3-config.cmake.in +0 -14
- package/deps/blake3/c/blake3_avx2.c +0 -326
- package/deps/blake3/c/blake3_avx2_x86-64_unix.S +0 -1815
- package/deps/blake3/c/blake3_avx2_x86-64_windows_gnu.S +0 -1817
- package/deps/blake3/c/blake3_avx2_x86-64_windows_msvc.asm +0 -1828
- package/deps/blake3/c/blake3_avx512.c +0 -1388
- package/deps/blake3/c/blake3_avx512_x86-64_unix.S +0 -4824
- package/deps/blake3/c/blake3_avx512_x86-64_windows_gnu.S +0 -2615
- package/deps/blake3/c/blake3_avx512_x86-64_windows_msvc.asm +0 -2634
- package/deps/blake3/c/blake3_c_rust_bindings/Cargo.toml +0 -32
- package/deps/blake3/c/blake3_c_rust_bindings/README.md +0 -4
- package/deps/blake3/c/blake3_c_rust_bindings/benches/bench.rs +0 -477
- package/deps/blake3/c/blake3_c_rust_bindings/build.rs +0 -253
- package/deps/blake3/c/blake3_c_rust_bindings/cross_test.sh +0 -31
- package/deps/blake3/c/blake3_c_rust_bindings/src/lib.rs +0 -333
- package/deps/blake3/c/blake3_c_rust_bindings/src/test.rs +0 -696
- package/deps/blake3/c/blake3_sse2.c +0 -566
- package/deps/blake3/c/blake3_sse2_x86-64_unix.S +0 -2291
- package/deps/blake3/c/blake3_sse2_x86-64_windows_gnu.S +0 -2332
- package/deps/blake3/c/blake3_sse2_x86-64_windows_msvc.asm +0 -2350
- package/deps/blake3/c/blake3_sse41.c +0 -560
- package/deps/blake3/c/blake3_sse41_x86-64_unix.S +0 -2028
- package/deps/blake3/c/blake3_sse41_x86-64_windows_gnu.S +0 -2069
- package/deps/blake3/c/blake3_sse41_x86-64_windows_msvc.asm +0 -2089
- package/deps/blake3/c/blake3_tbb.cpp +0 -37
- package/deps/blake3/c/dependencies/CMakeLists.txt +0 -3
- package/deps/blake3/c/dependencies/tbb/CMakeLists.txt +0 -28
- package/deps/blake3/c/example.c +0 -36
- package/deps/blake3/c/example_tbb.c +0 -57
- package/deps/blake3/c/libblake3.pc.in +0 -12
- package/deps/blake3/c/main.c +0 -166
- package/deps/blake3/c/test.py +0 -97
- package/deps/blake3/media/B3.svg +0 -70
- package/deps/blake3/media/BLAKE3.svg +0 -85
- package/deps/blake3/media/speed.svg +0 -1474
- package/deps/blake3/reference_impl/Cargo.toml +0 -8
- package/deps/blake3/reference_impl/README.md +0 -14
- package/deps/blake3/reference_impl/reference_impl.rs +0 -374
- package/deps/blake3/src/ffi_avx2.rs +0 -65
- package/deps/blake3/src/ffi_avx512.rs +0 -169
- package/deps/blake3/src/ffi_neon.rs +0 -82
- package/deps/blake3/src/ffi_sse2.rs +0 -126
- package/deps/blake3/src/ffi_sse41.rs +0 -126
- package/deps/blake3/src/guts.rs +0 -60
- package/deps/blake3/src/hazmat.rs +0 -704
- package/deps/blake3/src/io.rs +0 -64
- package/deps/blake3/src/join.rs +0 -92
- package/deps/blake3/src/lib.rs +0 -1835
- package/deps/blake3/src/platform.rs +0 -587
- package/deps/blake3/src/portable.rs +0 -198
- package/deps/blake3/src/rust_avx2.rs +0 -474
- package/deps/blake3/src/rust_sse2.rs +0 -775
- package/deps/blake3/src/rust_sse41.rs +0 -766
- package/deps/blake3/src/test.rs +0 -1049
- package/deps/blake3/src/traits.rs +0 -227
- package/deps/blake3/src/wasm32_simd.rs +0 -794
- package/deps/blake3/test_vectors/Cargo.toml +0 -19
- package/deps/blake3/test_vectors/cross_test.sh +0 -25
- package/deps/blake3/test_vectors/src/bin/generate.rs +0 -4
- package/deps/blake3/test_vectors/src/lib.rs +0 -350
- package/deps/blake3/test_vectors/test_vectors.json +0 -217
- package/deps/blake3/tools/compiler_version/Cargo.toml +0 -7
- package/deps/blake3/tools/compiler_version/build.rs +0 -6
- package/deps/blake3/tools/compiler_version/src/main.rs +0 -27
- package/deps/blake3/tools/instruction_set_support/Cargo.toml +0 -6
- package/deps/blake3/tools/instruction_set_support/src/main.rs +0 -10
- package/deps/blake3/tools/release.md +0 -16
- package/deps/ncrypto/.bazelignore +0 -4
- package/deps/ncrypto/.bazelrc +0 -1
- package/deps/ncrypto/.bazelversion +0 -1
- package/deps/ncrypto/.clang-format +0 -111
- package/deps/ncrypto/.github/workflows/bazel.yml +0 -58
- package/deps/ncrypto/.github/workflows/commitlint.yml +0 -16
- package/deps/ncrypto/.github/workflows/linter.yml +0 -38
- package/deps/ncrypto/.github/workflows/macos.yml +0 -43
- package/deps/ncrypto/.github/workflows/release-please.yml +0 -16
- package/deps/ncrypto/.github/workflows/ubuntu.yml +0 -128
- package/deps/ncrypto/.github/workflows/visual-studio.yml +0 -49
- package/deps/ncrypto/.python-version +0 -1
- package/deps/ncrypto/.release-please-manifest.json +0 -3
- package/deps/ncrypto/BUILD.bazel +0 -44
- package/deps/ncrypto/CHANGELOG.md +0 -37
- package/deps/ncrypto/CMakeLists.txt +0 -79
- package/deps/ncrypto/MODULE.bazel +0 -16
- package/deps/ncrypto/MODULE.bazel.lock +0 -461
- package/deps/ncrypto/cmake/CPM.cmake +0 -1225
- package/deps/ncrypto/cmake/ncrypto-flags.cmake +0 -17
- package/deps/ncrypto/ncrypto.pc.in +0 -10
- package/deps/ncrypto/patches/0001-Expose-libdecrepit-so-NodeJS-can-use-it-for-ncrypto.patch +0 -28
- package/deps/ncrypto/pyproject.toml +0 -38
- package/deps/ncrypto/release-please-config.json +0 -11
- package/deps/ncrypto/src/CMakeLists.txt +0 -40
- package/deps/ncrypto/tests/BUILD.bazel +0 -11
- package/deps/ncrypto/tests/CMakeLists.txt +0 -7
- package/deps/ncrypto/tests/basic.cpp +0 -856
- package/deps/ncrypto/tools/run-clang-format.sh +0 -42
- package/deps/simdutf/.clang-format +0 -4
- package/deps/simdutf/.github/ISSUE_TEMPLATE/bug_report.md +0 -62
- package/deps/simdutf/.github/ISSUE_TEMPLATE/config.yml +0 -1
- package/deps/simdutf/.github/ISSUE_TEMPLATE/feature_request.md +0 -35
- package/deps/simdutf/.github/ISSUE_TEMPLATE/standard-issue-template.md +0 -29
- package/deps/simdutf/.github/pull_request_template.md +0 -51
- package/deps/simdutf/.github/workflows/aarch64.yml +0 -39
- package/deps/simdutf/.github/workflows/alpine.yml +0 -27
- package/deps/simdutf/.github/workflows/amalgamation_demos.yml +0 -34
- package/deps/simdutf/.github/workflows/armv7.yml +0 -32
- package/deps/simdutf/.github/workflows/atomic_fuzz.yml +0 -25
- package/deps/simdutf/.github/workflows/cifuzz.yml +0 -37
- package/deps/simdutf/.github/workflows/clangformat.yml +0 -36
- package/deps/simdutf/.github/workflows/debian-latestcxxstandards.yml +0 -40
- package/deps/simdutf/.github/workflows/debian.yml +0 -33
- package/deps/simdutf/.github/workflows/documentation.yml +0 -36
- package/deps/simdutf/.github/workflows/emscripten.yml +0 -19
- package/deps/simdutf/.github/workflows/loongarch64-gcc-14.2.yml +0 -39
- package/deps/simdutf/.github/workflows/macos-latest.yml +0 -29
- package/deps/simdutf/.github/workflows/msys2-clang.yml +0 -48
- package/deps/simdutf/.github/workflows/msys2.yml +0 -50
- package/deps/simdutf/.github/workflows/ppc64le.yml +0 -29
- package/deps/simdutf/.github/workflows/rvv-1024-clang-18.yml +0 -35
- package/deps/simdutf/.github/workflows/rvv-128-clang-17.yml +0 -35
- package/deps/simdutf/.github/workflows/rvv-256-gcc-14.yml +0 -31
- package/deps/simdutf/.github/workflows/s390x.yml +0 -29
- package/deps/simdutf/.github/workflows/selective-amalgamation.yml +0 -29
- package/deps/simdutf/.github/workflows/typos.yml +0 -19
- package/deps/simdutf/.github/workflows/ubuntu22-cxx20.yml +0 -30
- package/deps/simdutf/.github/workflows/ubuntu22.yml +0 -32
- package/deps/simdutf/.github/workflows/ubuntu22_gcc12.yml +0 -27
- package/deps/simdutf/.github/workflows/ubuntu22sani.yml +0 -29
- package/deps/simdutf/.github/workflows/ubuntu24-cxxstandards.yml +0 -34
- package/deps/simdutf/.github/workflows/ubuntu24-unsignedchar.yml +0 -34
- package/deps/simdutf/.github/workflows/ubuntu24.yml +0 -32
- package/deps/simdutf/.github/workflows/ubuntu24sani.yml +0 -36
- package/deps/simdutf/.github/workflows/ubuntu24sani_clang.yml +0 -29
- package/deps/simdutf/.github/workflows/vs17-arm-ci.yml +0 -21
- package/deps/simdutf/.github/workflows/vs17-ci-cxx20.yml +0 -41
- package/deps/simdutf/.github/workflows/vs17-ci.yml +0 -41
- package/deps/simdutf/.github/workflows/vs17-clang-ci.yml +0 -41
- package/deps/simdutf/.github/workflows/vs17-cxxstandards.yml +0 -36
- package/deps/simdutf/AI_USAGE_POLICY.md +0 -56
- package/deps/simdutf/AUTHORS +0 -6
- package/deps/simdutf/CMakeLists.txt +0 -231
- package/deps/simdutf/CONTRIBUTING.md +0 -214
- package/deps/simdutf/CONTRIBUTORS +0 -1
- package/deps/simdutf/Doxyfile +0 -2584
- package/deps/simdutf/Makefile.crosscompile +0 -54
- package/deps/simdutf/README-RVV.md +0 -16
- package/deps/simdutf/SECURITY.md +0 -8
- package/deps/simdutf/benchmarks/CMakeLists.txt +0 -101
- package/deps/simdutf/benchmarks/alignment.cpp +0 -150
- package/deps/simdutf/benchmarks/base64/CMakeLists.txt +0 -30
- package/deps/simdutf/benchmarks/base64/benchmark_base64.cpp +0 -875
- package/deps/simdutf/benchmarks/base64/libbase64_spaces.h +0 -49
- package/deps/simdutf/benchmarks/base64/node_base64.h +0 -227
- package/deps/simdutf/benchmarks/base64/openssl3_base64.h +0 -334
- package/deps/simdutf/benchmarks/benchmark.cpp +0 -65
- package/deps/simdutf/benchmarks/benchmark_to_well_formed_utf16.cpp +0 -347
- package/deps/simdutf/benchmarks/competition/.clang-format-ignore +0 -5
- package/deps/simdutf/benchmarks/competition/CppCon2018/utf_utils.cpp +0 -1276
- package/deps/simdutf/benchmarks/competition/CppCon2018/utf_utils.h +0 -595
- package/deps/simdutf/benchmarks/competition/README.md +0 -7
- package/deps/simdutf/benchmarks/competition/hoehrmann/hoehrmann.h +0 -91
- package/deps/simdutf/benchmarks/competition/inoue2008/inoue_utf8_to_utf16.h +0 -444
- package/deps/simdutf/benchmarks/competition/inoue2008/inoue_utf8_to_utf16_tables.h +0 -13183
- package/deps/simdutf/benchmarks/competition/inoue2008/script.py +0 -73
- package/deps/simdutf/benchmarks/competition/llvm/ConvertUTF.cpp +0 -738
- package/deps/simdutf/benchmarks/competition/llvm/ConvertUTF.h +0 -293
- package/deps/simdutf/benchmarks/competition/u8u16/COPYRIGHT +0 -8
- package/deps/simdutf/benchmarks/competition/u8u16/Makefile +0 -44
- package/deps/simdutf/benchmarks/competition/u8u16/OSL3.0.txt +0 -169
- package/deps/simdutf/benchmarks/competition/u8u16/Profiling/BOM_Profiler.h +0 -148
- package/deps/simdutf/benchmarks/competition/u8u16/Profiling/i386_timer.h +0 -45
- package/deps/simdutf/benchmarks/competition/u8u16/Profiling/ppc_timer.c +0 -34
- package/deps/simdutf/benchmarks/competition/u8u16/README +0 -56
- package/deps/simdutf/benchmarks/competition/u8u16/config/config_defs.h +0 -43
- package/deps/simdutf/benchmarks/competition/u8u16/config/g4_config.h +0 -27
- package/deps/simdutf/benchmarks/competition/u8u16/config/mmx_config.h +0 -16
- package/deps/simdutf/benchmarks/competition/u8u16/config/p4_config.h +0 -18
- package/deps/simdutf/benchmarks/competition/u8u16/config/p4_ideal_config.h +0 -16
- package/deps/simdutf/benchmarks/competition/u8u16/config/spu_config.h +0 -28
- package/deps/simdutf/benchmarks/competition/u8u16/config/ssse3_config.h +0 -20
- package/deps/simdutf/benchmarks/competition/u8u16/iconv_u8u16.c +0 -2
- package/deps/simdutf/benchmarks/competition/u8u16/lib/altivec_simd.h +0 -440
- package/deps/simdutf/benchmarks/competition/u8u16/lib/libgen/make_basic_ops.py +0 -121
- package/deps/simdutf/benchmarks/competition/u8u16/lib/libgen/make_half_operand_versions.py +0 -158
- package/deps/simdutf/benchmarks/competition/u8u16/lib/libgen/make_test.py +0 -270
- package/deps/simdutf/benchmarks/competition/u8u16/lib/mmx_simd.h +0 -141
- package/deps/simdutf/benchmarks/competition/u8u16/lib/mmx_simd_basic.h +0 -216
- package/deps/simdutf/benchmarks/competition/u8u16/lib/mmx_simd_built_in.h +0 -119
- package/deps/simdutf/benchmarks/competition/u8u16/lib/mmx_simd_modified.h +0 -2430
- package/deps/simdutf/benchmarks/competition/u8u16/lib/outline.txt +0 -39
- package/deps/simdutf/benchmarks/competition/u8u16/lib/spu_simd.h +0 -421
- package/deps/simdutf/benchmarks/competition/u8u16/lib/sse_simd.h +0 -836
- package/deps/simdutf/benchmarks/competition/u8u16/lib/stdint.h +0 -222
- package/deps/simdutf/benchmarks/competition/u8u16/libu8u16_BE.c +0 -4
- package/deps/simdutf/benchmarks/competition/u8u16/libu8u16_LE.c +0 -5
- package/deps/simdutf/benchmarks/competition/u8u16/proto/u8u16.py +0 -390
- package/deps/simdutf/benchmarks/competition/u8u16/src/Makefile +0 -18
- package/deps/simdutf/benchmarks/competition/u8u16/src/bytelex.h +0 -448
- package/deps/simdutf/benchmarks/competition/u8u16/src/charsets/ASCII_EBCDIC.h +0 -284
- package/deps/simdutf/benchmarks/competition/u8u16/src/libu8u16.c +0 -1975
- package/deps/simdutf/benchmarks/competition/u8u16/src/libu8u16.pdf +0 -0
- package/deps/simdutf/benchmarks/competition/u8u16/src/libu8u16.w +0 -2263
- package/deps/simdutf/benchmarks/competition/u8u16/src/multiliteral.h +0 -239
- package/deps/simdutf/benchmarks/competition/u8u16/src/u8u16.c +0 -232
- package/deps/simdutf/benchmarks/competition/u8u16/src/x8x16.c +0 -194
- package/deps/simdutf/benchmarks/competition/u8u16/src/xml_error.c +0 -193
- package/deps/simdutf/benchmarks/competition/u8u16/src/xml_error.h +0 -167
- package/deps/simdutf/benchmarks/competition/u8u16/src/xmldecl.c +0 -288
- package/deps/simdutf/benchmarks/competition/u8u16/src/xmldecl.h +0 -117
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_g4.c +0 -2
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_mmx.c +0 -2
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_p4.c +0 -3
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_p4_ideal.c +0 -2
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_spu.c +0 -2
- package/deps/simdutf/benchmarks/competition/u8u16/u8u16_ssse3.c +0 -3
- package/deps/simdutf/benchmarks/competition/u8u16/x8x16_p4.c +0 -2
- package/deps/simdutf/benchmarks/competition/utf8lut/LICENSE +0 -23
- package/deps/simdutf/benchmarks/competition/utf8lut/data/test_minimal.txt +0 -44
- package/deps/simdutf/benchmarks/competition/utf8lut/readme.md +0 -106
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_clang_corr_tests.cmd +0 -11
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_clang_corr_tests.sh +0 -13
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_gcc_corr_tests.sh +0 -13
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_gcc_example.sh +0 -13
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_gcc_file_conv.sh +0 -14
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_gcc_iconv_lib.sh +0 -11
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_gcc_iconv_sample.sh +0 -8
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_mingw_corr_tests.cmd +0 -12
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_mingw_example.cmd +0 -13
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_mingw_file_conv.cmd +0 -14
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_mingw_iconv_lib.cmd +0 -11
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_mingw_iconv_sample.cmd +0 -8
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_msvc_corr_tests.cmd +0 -11
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_msvc_example.cmd +0 -12
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_msvc_file_conv.cmd +0 -13
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_msvc_iconv_lib.cmd +0 -10
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/build_msvc_iconv_sample.cmd +0 -9
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/html_table.py +0 -25
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/measure.py +0 -94
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/resize.py +0 -20
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/wipe_all.cmd +0 -2
- package/deps/simdutf/benchmarks/competition/utf8lut/scripts/wipe_interm.cmd +0 -1
- package/deps/simdutf/benchmarks/competition/utf8lut/src/base/CustomMemcpy.h +0 -75
- package/deps/simdutf/benchmarks/competition/utf8lut/src/base/PerfDefs.h +0 -47
- package/deps/simdutf/benchmarks/competition/utf8lut/src/base/Timing.cpp +0 -17
- package/deps/simdutf/benchmarks/competition/utf8lut/src/base/Timing.h +0 -76
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/AllProcessors.cpp +0 -35
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/BaseBufferProcessor.cpp +0 -117
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/BaseBufferProcessor.h +0 -210
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/BufferDecoder.h +0 -158
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/BufferEncoder.h +0 -104
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/ProcessorPlugins.h +0 -334
- package/deps/simdutf/benchmarks/competition/utf8lut/src/buffer/ProcessorSelector.h +0 -186
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/DecoderLut.cpp +0 -140
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/DecoderLut.h +0 -42
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/DecoderProcess.h +0 -100
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/Dfa.h +0 -57
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/EncoderLut.cpp +0 -85
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/EncoderLut.h +0 -27
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/EncoderProcess.h +0 -126
- package/deps/simdutf/benchmarks/competition/utf8lut/src/core/ProcessTrivial.h +0 -108
- package/deps/simdutf/benchmarks/competition/utf8lut/src/iconv/iconv.cpp +0 -139
- package/deps/simdutf/benchmarks/competition/utf8lut/src/iconv/iconv.h +0 -74
- package/deps/simdutf/benchmarks/competition/utf8lut/src/message/MessageConverter.cpp +0 -65
- package/deps/simdutf/benchmarks/competition/utf8lut/src/message/MessageConverter.h +0 -91
- package/deps/simdutf/benchmarks/competition/utf8lut/src/tests/CorrectnessTests.cpp +0 -772
- package/deps/simdutf/benchmarks/competition/utf8lut/src/tests/Example.cpp +0 -12
- package/deps/simdutf/benchmarks/competition/utf8lut/src/tests/FileConverter.cpp +0 -486
- package/deps/simdutf/benchmarks/competition/utf8lut/src/tests/iconv_sample.c +0 -162
- package/deps/simdutf/benchmarks/competition/utf8lut/src/utf8lut.h +0 -15
- package/deps/simdutf/benchmarks/competition/utf8sse4/fromutf8-sse.cpp +0 -292
- package/deps/simdutf/benchmarks/competition/utfcpp/LICENSE +0 -23
- package/deps/simdutf/benchmarks/competition/utfcpp/README.md +0 -1503
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8/checked.h +0 -335
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8/core.h +0 -338
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8/cpp11.h +0 -103
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8/cpp17.h +0 -103
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8/unchecked.h +0 -274
- package/deps/simdutf/benchmarks/competition/utfcpp/source/utf8.h +0 -34
- package/deps/simdutf/benchmarks/dataset/README.md +0 -155
- package/deps/simdutf/benchmarks/dataset/emoji.txt +0 -204
- package/deps/simdutf/benchmarks/dataset/scripts/utf8type.py +0 -40
- package/deps/simdutf/benchmarks/dataset/wikipedia_mars/Makefile +0 -80
- package/deps/simdutf/benchmarks/dataset/wikipedia_mars/convert_to_utf6.py +0 -20
- package/deps/simdutf/benchmarks/find/CMakeLists.txt +0 -6
- package/deps/simdutf/benchmarks/find/findbenchmark.cpp +0 -63
- package/deps/simdutf/benchmarks/find/findbenchmarker.h +0 -46
- package/deps/simdutf/benchmarks/shortbench.cpp +0 -555
- package/deps/simdutf/benchmarks/src/CMakeLists.txt +0 -52
- package/deps/simdutf/benchmarks/src/apple_arm_events.h +0 -1104
- package/deps/simdutf/benchmarks/src/benchmark.cpp +0 -3899
- package/deps/simdutf/benchmarks/src/benchmark.h +0 -317
- package/deps/simdutf/benchmarks/src/benchmark_base.cpp +0 -144
- package/deps/simdutf/benchmarks/src/benchmark_base.h +0 -98
- package/deps/simdutf/benchmarks/src/cmdline.cpp +0 -176
- package/deps/simdutf/benchmarks/src/cmdline.h +0 -35
- package/deps/simdutf/benchmarks/src/event_counter.h +0 -162
- package/deps/simdutf/benchmarks/src/linux-perf-events.h +0 -104
- package/deps/simdutf/benchmarks/stream.cpp +0 -209
- package/deps/simdutf/benchmarks/threaded.cpp +0 -123
- package/deps/simdutf/cmake/CPM.cmake +0 -1363
- package/deps/simdutf/cmake/JoinPaths.cmake +0 -23
- package/deps/simdutf/cmake/add_cpp_test.cmake +0 -68
- package/deps/simdutf/cmake/simdutf-config.cmake.in +0 -2
- package/deps/simdutf/cmake/simdutf-flags.cmake +0 -26
- package/deps/simdutf/cmake/toolchains-ci/riscv64-linux-gnu.cmake +0 -4
- package/deps/simdutf/cmake/toolchains-dev/README.md +0 -32
- package/deps/simdutf/cmake/toolchains-dev/aarch64.cmake +0 -14
- package/deps/simdutf/cmake/toolchains-dev/loongarch64.cmake +0 -22
- package/deps/simdutf/cmake/toolchains-dev/powerpc64.cmake +0 -16
- package/deps/simdutf/cmake/toolchains-dev/powerpc64le.cmake +0 -16
- package/deps/simdutf/cmake/toolchains-dev/riscv64.cmake +0 -16
- package/deps/simdutf/cmake/toolchains-dev/rvv-spike.cmake +0 -38
- package/deps/simdutf/doc/avx512.png +0 -0
- package/deps/simdutf/doc/logo.png +0 -0
- package/deps/simdutf/doc/logo.svg +0 -165
- package/deps/simdutf/doc/node2023.png +0 -0
- package/deps/simdutf/doc/shortinput.md +0 -78
- package/deps/simdutf/doc/utf16utf8.png +0 -0
- package/deps/simdutf/doc/utf8utf16.png +0 -0
- package/deps/simdutf/doc/widelogo.png +0 -0
- package/deps/simdutf/doxygen.py +0 -50
- package/deps/simdutf/fuzz/.clang-format +0 -9
- package/deps/simdutf/fuzz/CMakeLists.txt +0 -45
- package/deps/simdutf/fuzz/README.md +0 -168
- package/deps/simdutf/fuzz/atomic_base64.cpp +0 -448
- package/deps/simdutf/fuzz/base64.cpp +0 -278
- package/deps/simdutf/fuzz/build.sh +0 -83
- package/deps/simdutf/fuzz/conversion.cpp +0 -669
- package/deps/simdutf/fuzz/helpers/.clang-format-ignore +0 -1
- package/deps/simdutf/fuzz/helpers/common.h +0 -135
- package/deps/simdutf/fuzz/helpers/nameof.hpp +0 -1258
- package/deps/simdutf/fuzz/main.cpp +0 -72
- package/deps/simdutf/fuzz/minimize_and_cleanse.sh +0 -87
- package/deps/simdutf/fuzz/misc.cpp +0 -216
- package/deps/simdutf/fuzz/random_fuzz.sh +0 -154
- package/deps/simdutf/fuzz/roundtrip.cpp +0 -588
- package/deps/simdutf/fuzz/safe_conversion.cpp +0 -104
- package/deps/simdutf/riscv/Dockerfile +0 -16
- package/deps/simdutf/riscv/README.md +0 -24
- package/deps/simdutf/riscv/remove-docker-station +0 -8
- package/deps/simdutf/riscv/run-docker-station +0 -31
- package/deps/simdutf/scripts/.flake8 +0 -2
- package/deps/simdutf/scripts/Makefile +0 -2
- package/deps/simdutf/scripts/README_ADD_FUNCTION.md +0 -49
- package/deps/simdutf/scripts/add_function.py +0 -330
- package/deps/simdutf/scripts/amalgamation_tests.py +0 -156
- package/deps/simdutf/scripts/base64/Makefile +0 -2
- package/deps/simdutf/scripts/base64/README.md +0 -2
- package/deps/simdutf/scripts/base64/avx512.py +0 -76
- package/deps/simdutf/scripts/base64/neon_decode.py +0 -143
- package/deps/simdutf/scripts/base64/neon_generate_lut.py +0 -101
- package/deps/simdutf/scripts/base64/sse.py +0 -252
- package/deps/simdutf/scripts/base64/sseregular.py +0 -160
- package/deps/simdutf/scripts/base64/sseurl.py +0 -283
- package/deps/simdutf/scripts/base64/table.py +0 -59
- package/deps/simdutf/scripts/base64bench_print.py +0 -145
- package/deps/simdutf/scripts/benchmark-all.py +0 -119
- package/deps/simdutf/scripts/benchmark_print.py +0 -324
- package/deps/simdutf/scripts/check_feature_macros.py +0 -156
- package/deps/simdutf/scripts/check_typos.sh +0 -13
- package/deps/simdutf/scripts/clang_format.sh +0 -35
- package/deps/simdutf/scripts/clang_format_docker.sh +0 -38
- package/deps/simdutf/scripts/common.py +0 -24
- package/deps/simdutf/scripts/compilation_benchmark.py +0 -55
- package/deps/simdutf/scripts/compile_many_variations.sh +0 -64
- package/deps/simdutf/scripts/create_latex_table.py +0 -62
- package/deps/simdutf/scripts/docker/Dockerfile +0 -14
- package/deps/simdutf/scripts/docker/Makefile +0 -9
- package/deps/simdutf/scripts/docker/README.md +0 -30
- package/deps/simdutf/scripts/docker/llvm.gpg +0 -0
- package/deps/simdutf/scripts/ppc64_convert_utf16_to_utf8.py +0 -155
- package/deps/simdutf/scripts/prepare_doxygen.sh +0 -21
- package/deps/simdutf/scripts/release.py +0 -197
- package/deps/simdutf/scripts/shortinputplots.py +0 -97
- package/deps/simdutf/scripts/sse_convert_utf16_to_utf8.py +0 -422
- package/deps/simdutf/scripts/sse_convert_utf32_to_utf16.py +0 -105
- package/deps/simdutf/scripts/sse_utf8_utf16_decode.py +0 -186
- package/deps/simdutf/scripts/sse_validate_utf16le_proof.py +0 -137
- package/deps/simdutf/scripts/sse_validate_utf16le_testcases.py +0 -129
- package/deps/simdutf/scripts/table.py +0 -207
- package/deps/simdutf/scripts/tests/new.txt +0 -33
- package/deps/simdutf/scripts/tests/old.txt +0 -33
- package/deps/simdutf/scripts/tests/results.txt +0 -272
- package/deps/simdutf/simdutf.pc.in +0 -11
- package/deps/simdutf/singleheader/.flake8 +0 -2
- package/deps/simdutf/singleheader/CMakeLists.txt +0 -64
- package/deps/simdutf/singleheader/README-dev.md +0 -81
- package/deps/simdutf/singleheader/README.md +0 -19
- package/deps/simdutf/singleheader/amalgamate.py +0 -513
- package/deps/simdutf/singleheader/amalgamation_demo.c +0 -59
- package/deps/simdutf/singleheader/amalgamation_demo.cpp +0 -54
- package/deps/simdutf/singleheader/test-features.py +0 -262
- package/deps/simdutf/src/CMakeLists.txt +0 -78
- package/deps/simdutf/tests/CMakeLists.txt +0 -483
- package/deps/simdutf/tests/atomic_base64_tests.cpp +0 -2845
- package/deps/simdutf/tests/base64_tests.cpp +0 -3617
- package/deps/simdutf/tests/basic_fuzzer.cpp +0 -805
- package/deps/simdutf/tests/bele_tests.cpp +0 -182
- package/deps/simdutf/tests/constexpr_base64_tests.cpp +0 -387
- package/deps/simdutf/tests/convert_latin1_to_utf16be_tests.cpp +0 -52
- package/deps/simdutf/tests/convert_latin1_to_utf16le_tests.cpp +0 -80
- package/deps/simdutf/tests/convert_latin1_to_utf32_tests.cpp +0 -66
- package/deps/simdutf/tests/convert_latin1_to_utf8_tests.cpp +0 -120
- package/deps/simdutf/tests/convert_utf16_to_utf8_safe_tests.cpp +0 -203
- package/deps/simdutf/tests/convert_utf16_to_utf8_with_replacement_tests.cpp +0 -276
- package/deps/simdutf/tests/convert_utf16be_to_latin1_tests.cpp +0 -109
- package/deps/simdutf/tests/convert_utf16be_to_latin1_tests_with_errors.cpp +0 -136
- package/deps/simdutf/tests/convert_utf16be_to_utf32_tests.cpp +0 -193
- package/deps/simdutf/tests/convert_utf16be_to_utf32_with_errors_tests.cpp +0 -381
- package/deps/simdutf/tests/convert_utf16be_to_utf8_tests.cpp +0 -259
- package/deps/simdutf/tests/convert_utf16be_to_utf8_with_errors_tests.cpp +0 -266
- package/deps/simdutf/tests/convert_utf16le_to_latin1_tests.cpp +0 -148
- package/deps/simdutf/tests/convert_utf16le_to_latin1_tests_with_errors.cpp +0 -176
- package/deps/simdutf/tests/convert_utf16le_to_utf32_tests.cpp +0 -213
- package/deps/simdutf/tests/convert_utf16le_to_utf32_with_errors_tests.cpp +0 -318
- package/deps/simdutf/tests/convert_utf16le_to_utf8_tests.cpp +0 -343
- package/deps/simdutf/tests/convert_utf16le_to_utf8_with_errors_tests.cpp +0 -271
- package/deps/simdutf/tests/convert_utf32_to_latin1_tests.cpp +0 -111
- package/deps/simdutf/tests/convert_utf32_to_latin1_with_errors_tests.cpp +0 -96
- package/deps/simdutf/tests/convert_utf32_to_utf16be_tests.cpp +0 -148
- package/deps/simdutf/tests/convert_utf32_to_utf16be_with_errors_tests.cpp +0 -192
- package/deps/simdutf/tests/convert_utf32_to_utf16le_tests.cpp +0 -166
- package/deps/simdutf/tests/convert_utf32_to_utf16le_with_errors_tests.cpp +0 -215
- package/deps/simdutf/tests/convert_utf32_to_utf8_tests.cpp +0 -181
- package/deps/simdutf/tests/convert_utf32_to_utf8_with_errors_tests.cpp +0 -261
- package/deps/simdutf/tests/convert_utf8_to_latin1_tests.cpp +0 -516
- package/deps/simdutf/tests/convert_utf8_to_latin1_with_errors_tests.cpp +0 -579
- package/deps/simdutf/tests/convert_utf8_to_utf16be_tests.cpp +0 -412
- package/deps/simdutf/tests/convert_utf8_to_utf16be_with_errors_tests.cpp +0 -480
- package/deps/simdutf/tests/convert_utf8_to_utf16le_tests.cpp +0 -671
- package/deps/simdutf/tests/convert_utf8_to_utf16le_with_errors_tests.cpp +0 -455
- package/deps/simdutf/tests/convert_utf8_to_utf32_tests.cpp +0 -1204
- package/deps/simdutf/tests/convert_utf8_to_utf32_with_errors_tests.cpp +0 -337
- package/deps/simdutf/tests/convert_valid_utf16be_to_latin1_tests.cpp +0 -37
- package/deps/simdutf/tests/convert_valid_utf16be_to_utf32_tests.cpp +0 -97
- package/deps/simdutf/tests/convert_valid_utf16be_to_utf8_tests.cpp +0 -126
- package/deps/simdutf/tests/convert_valid_utf16le_to_latin1_tests.cpp +0 -71
- package/deps/simdutf/tests/convert_valid_utf16le_to_utf32_tests.cpp +0 -122
- package/deps/simdutf/tests/convert_valid_utf16le_to_utf8_tests.cpp +0 -244
- package/deps/simdutf/tests/convert_valid_utf32_to_latin1_tests.cpp +0 -49
- package/deps/simdutf/tests/convert_valid_utf32_to_utf16be_tests.cpp +0 -92
- package/deps/simdutf/tests/convert_valid_utf32_to_utf16le_tests.cpp +0 -114
- package/deps/simdutf/tests/convert_valid_utf32_to_utf8_tests.cpp +0 -109
- package/deps/simdutf/tests/convert_valid_utf8_to_latin1_tests.cpp +0 -84
- package/deps/simdutf/tests/convert_valid_utf8_to_utf16be_tests.cpp +0 -124
- package/deps/simdutf/tests/convert_valid_utf8_to_utf16le_tests.cpp +0 -221
- package/deps/simdutf/tests/convert_valid_utf8_to_utf32_tests.cpp +0 -155
- package/deps/simdutf/tests/count_utf16be.cpp +0 -64
- package/deps/simdutf/tests/count_utf16le.cpp +0 -61
- package/deps/simdutf/tests/count_utf8.cpp +0 -87
- package/deps/simdutf/tests/detect_encodings_tests.cpp +0 -312
- package/deps/simdutf/tests/embed/valid_utf8.txt +0 -1
- package/deps/simdutf/tests/embed_tests.cpp +0 -22
- package/deps/simdutf/tests/find_tests.cpp +0 -77
- package/deps/simdutf/tests/fixed_string_tests.cpp +0 -153
- package/deps/simdutf/tests/helpers/CMakeLists.txt +0 -25
- package/deps/simdutf/tests/helpers/compiletime_conversions.h +0 -222
- package/deps/simdutf/tests/helpers/fixed_string.h +0 -267
- package/deps/simdutf/tests/helpers/random_int.cpp +0 -30
- package/deps/simdutf/tests/helpers/random_int.h +0 -39
- package/deps/simdutf/tests/helpers/random_utf16.cpp +0 -123
- package/deps/simdutf/tests/helpers/random_utf16.h +0 -52
- package/deps/simdutf/tests/helpers/random_utf32.cpp +0 -41
- package/deps/simdutf/tests/helpers/random_utf32.h +0 -40
- package/deps/simdutf/tests/helpers/random_utf8.cpp +0 -93
- package/deps/simdutf/tests/helpers/random_utf8.h +0 -36
- package/deps/simdutf/tests/helpers/test.cpp +0 -231
- package/deps/simdutf/tests/helpers/test.h +0 -193
- package/deps/simdutf/tests/helpers/transcode_test_base.cpp +0 -1257
- package/deps/simdutf/tests/helpers/transcode_test_base.h +0 -683
- package/deps/simdutf/tests/helpers/utf16.h +0 -27
- package/deps/simdutf/tests/installation_tests/find/CMakeLists.txt +0 -43
- package/deps/simdutf/tests/installation_tests/from_fetch/CMakeLists.txt +0 -47
- package/deps/simdutf/tests/internal_tests.cpp +0 -27
- package/deps/simdutf/tests/null_safety_tests.cpp +0 -94
- package/deps/simdutf/tests/random_fuzzer.cpp +0 -779
- package/deps/simdutf/tests/readme_tests.cpp +0 -274
- package/deps/simdutf/tests/reference/CMakeLists.txt +0 -23
- package/deps/simdutf/tests/reference/decode_utf16.h +0 -81
- package/deps/simdutf/tests/reference/decode_utf32.h +0 -47
- package/deps/simdutf/tests/reference/encode_latin1.cpp +0 -1
- package/deps/simdutf/tests/reference/encode_latin1.h +0 -32
- package/deps/simdutf/tests/reference/encode_utf16.cpp +0 -49
- package/deps/simdutf/tests/reference/encode_utf16.h +0 -20
- package/deps/simdutf/tests/reference/encode_utf32.cpp +0 -1
- package/deps/simdutf/tests/reference/encode_utf32.h +0 -36
- package/deps/simdutf/tests/reference/encode_utf8.cpp +0 -1
- package/deps/simdutf/tests/reference/encode_utf8.h +0 -40
- package/deps/simdutf/tests/reference/validate_utf16.cpp +0 -60
- package/deps/simdutf/tests/reference/validate_utf16.h +0 -14
- package/deps/simdutf/tests/reference/validate_utf16_to_latin1.cpp +0 -35
- package/deps/simdutf/tests/reference/validate_utf16_to_latin1.h +0 -13
- package/deps/simdutf/tests/reference/validate_utf32.cpp +0 -27
- package/deps/simdutf/tests/reference/validate_utf32.h +0 -12
- package/deps/simdutf/tests/reference/validate_utf32_to_latin1.cpp +0 -27
- package/deps/simdutf/tests/reference/validate_utf32_to_latin1.h +0 -12
- package/deps/simdutf/tests/reference/validate_utf8.cpp +0 -82
- package/deps/simdutf/tests/reference/validate_utf8.h +0 -11
- package/deps/simdutf/tests/reference/validate_utf8_to_latin1.cpp +0 -43
- package/deps/simdutf/tests/reference/validate_utf8_to_latin1.h +0 -12
- package/deps/simdutf/tests/select_implementation.cpp +0 -43
- package/deps/simdutf/tests/simdutf_c_tests.cpp +0 -244
- package/deps/simdutf/tests/span_tests.cpp +0 -401
- package/deps/simdutf/tests/special_tests.cpp +0 -559
- package/deps/simdutf/tests/straight_c_test.c +0 -187
- package/deps/simdutf/tests/text_encoding_tests.cpp +0 -77
- package/deps/simdutf/tests/to_well_formed_utf16_tests.cpp +0 -377
- package/deps/simdutf/tests/utf8_length_from_utf16_tests.cpp +0 -202
- package/deps/simdutf/tests/validate_ascii_basic_tests.cpp +0 -165
- package/deps/simdutf/tests/validate_ascii_with_errors_tests.cpp +0 -77
- package/deps/simdutf/tests/validate_utf16be_basic_tests.cpp +0 -175
- package/deps/simdutf/tests/validate_utf16be_with_errors_tests.cpp +0 -188
- package/deps/simdutf/tests/validate_utf16le_basic_tests.cpp +0 -268
- package/deps/simdutf/tests/validate_utf16le_with_errors_tests.cpp +0 -274
- package/deps/simdutf/tests/validate_utf32_basic_tests.cpp +0 -92
- package/deps/simdutf/tests/validate_utf32_with_errors_tests.cpp +0 -114
- package/deps/simdutf/tests/validate_utf8_basic_tests.cpp +0 -178
- package/deps/simdutf/tests/validate_utf8_brute_force_tests.cpp +0 -88
- package/deps/simdutf/tests/validate_utf8_puzzler_tests.cpp +0 -33
- package/deps/simdutf/tests/validate_utf8_with_errors_tests.cpp +0 -228
- package/deps/simdutf/tools/CMakeLists.txt +0 -85
- package/deps/simdutf/tools/fastbase64.cpp +0 -250
- package/deps/simdutf/tools/sutf.cpp +0 -556
- package/deps/simdutf/tools/sutf.h +0 -40
- package/lib/tsconfig.tsbuildinfo +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeBuffer","require","_safeBuffer","_reactNativeNitroModules","_noble","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","utils","NitroModules","createHybridObject","
|
|
1
|
+
{"version":3,"names":["_reactNativeBuffer","require","_safeBuffer","_reactNativeNitroModules","_reactNative","_noble","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","utils","NitroModules","createHybridObject","isHermes","global","HermesInternal","canGetU16StringFromJsiString","Platform","constants","reactNativeVersion","major","minor","canCreateJsiStringFromUtf16","baseNativeEncodings","nativeStringToBufferEncodings","Set","nativeBufferToStringEncodings","add","rejectSharedArrayBuffer","buf","SharedArrayBuffer","TypeError","ArrayBuffer","isView","buffer","abvToArrayBuffer","CraftzdogBuffer","isBuffer","toArrayBuffer","slice","byteOffset","byteLength","ab","length","view","Uint8Array","i","SafeBuffer","readUInt8","bufferLikeToArrayBuffer","binaryLikeToArrayBuffer","input","encoding","Error","has","stringToBuffer","from","toString","handle","exportKey","ab2str","start","end","bufferToString","undefined","Math","trunc","str","kEmptyObject","freeze","create"],"sourceRoot":"../../../src","sources":["utils/conversion.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAGA,IAAAG,YAAA,GAAAH,OAAA;AAqRA,IAAAI,MAAA,GAAAJ,OAAA;AAAAK,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,MAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,MAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAzQA,MAAMS,KAAK,GACTC,qCAAY,CAACC,kBAAkB,CAA2B,OAAO,CAAC;AAEpE,MAAMC,QAAQ,GACXC,MAAM,CAAkCC,cAAc,IAAI,IAAI;;AAEjE;AACA;AACA,MAAMC,4BAA4B,GAAG,EACnCC,qBAAQ,CAACC,SAAS,CAACC,kBAAkB,CAACC,KAAK,IAAI,CAAC,IAChDH,qBAAQ,CAACC,SAAS,CAACC,kBAAkB,CAACE,KAAK,GAAG,EAAE,CACjD;;AAED;AACA,MAAMC,2BAA2B,GAAG,EAClCL,qBAAQ,CAACC,SAAS,CAACC,kBAAkB,CAACC,KAAK,IAAI,CAAC,IAChDH,qBAAQ,CAACC,SAAS,CAACC,kBAAkB,CAAC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AAEA;AACO,SAASP,cAAcA,CAC5BY,GAAW,EACXf,QAAgB,GAAG,OAAO,EACb;EACb,OAAO1C,KAAK,CAAC6C,cAAc,CAACY,GAAG,EAAEf,QAAQ,CAAC;AAC5C;AAEO,MAAMgB,YAAY,GAAA9D,OAAA,CAAA8D,YAAA,GAAGtE,MAAM,CAACuE,MAAM,CAACvE,MAAM,CAACwE,MAAM,CAAC,IAAI,CAAC,CAAC","ignoreList":[]}
|
|
@@ -3,12 +3,71 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.QuotaExceededError = void 0;
|
|
6
7
|
exports.lazyDOMException = lazyDOMException;
|
|
8
|
+
// Hermes (React Native) does not implement DOMException natively. Use it when
|
|
9
|
+
// the host provides one; otherwise fall back to an Error subclass that exposes
|
|
10
|
+
// the WebCrypto-relevant surface (.name, .message, .code) so consumers that
|
|
11
|
+
// branch on `err.name === 'InvalidAccessError'` see the spec-correct value.
|
|
12
|
+
const DOM_EXCEPTION_CODES = {
|
|
13
|
+
IndexSizeError: 1,
|
|
14
|
+
HierarchyRequestError: 3,
|
|
15
|
+
WrongDocumentError: 4,
|
|
16
|
+
InvalidCharacterError: 5,
|
|
17
|
+
NoModificationAllowedError: 7,
|
|
18
|
+
NotFoundError: 8,
|
|
19
|
+
NotSupportedError: 9,
|
|
20
|
+
InUseAttributeError: 10,
|
|
21
|
+
InvalidStateError: 11,
|
|
22
|
+
SyntaxError: 12,
|
|
23
|
+
InvalidModificationError: 13,
|
|
24
|
+
NamespaceError: 14,
|
|
25
|
+
InvalidAccessError: 15,
|
|
26
|
+
TypeMismatchError: 17,
|
|
27
|
+
SecurityError: 18,
|
|
28
|
+
NetworkError: 19,
|
|
29
|
+
AbortError: 20,
|
|
30
|
+
URLMismatchError: 21,
|
|
31
|
+
QuotaExceededError: 22,
|
|
32
|
+
TimeoutError: 23,
|
|
33
|
+
InvalidNodeTypeError: 24,
|
|
34
|
+
DataCloneError: 25
|
|
35
|
+
};
|
|
36
|
+
const HostDOMException = globalThis.DOMException;
|
|
37
|
+
class FallbackDOMException extends Error {
|
|
38
|
+
constructor(message, name) {
|
|
39
|
+
super(message);
|
|
40
|
+
this.name = name;
|
|
41
|
+
this.code = DOM_EXCEPTION_CODES[name] ?? 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
7
44
|
function lazyDOMException(message, domName) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
45
|
+
const name = typeof domName === 'string' ? domName : domName.name;
|
|
46
|
+
const cause = typeof domName === 'string' ? undefined : domName.cause;
|
|
47
|
+
let err;
|
|
48
|
+
if (HostDOMException) {
|
|
49
|
+
err = cause !== undefined ? new HostDOMException(message, {
|
|
50
|
+
name,
|
|
51
|
+
cause
|
|
52
|
+
}) : new HostDOMException(message, name);
|
|
53
|
+
} else {
|
|
54
|
+
err = new FallbackDOMException(message, name);
|
|
55
|
+
if (cause !== undefined) {
|
|
56
|
+
err.cause = cause;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return err;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// QuotaExceededError carries `quota` and `requested` numeric fields per the
|
|
63
|
+
// WebIDL spec (https://webidl.spec.whatwg.org/#quotaexceedederror). DOMException
|
|
64
|
+
// in legacy hosts does not expose these, so always use our subclass.
|
|
65
|
+
class QuotaExceededError extends FallbackDOMException {
|
|
66
|
+
constructor(message, options = {}) {
|
|
67
|
+
super(message, 'QuotaExceededError');
|
|
68
|
+
this.quota = options.quota ?? null;
|
|
69
|
+
this.requested = options.requested ?? null;
|
|
11
70
|
}
|
|
12
|
-
return new Error(`[${domName}]: ${message}${cause}`);
|
|
13
71
|
}
|
|
72
|
+
exports.QuotaExceededError = QuotaExceededError;
|
|
14
73
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["DOM_EXCEPTION_CODES","IndexSizeError","HierarchyRequestError","WrongDocumentError","InvalidCharacterError","NoModificationAllowedError","NotFoundError","NotSupportedError","InUseAttributeError","InvalidStateError","SyntaxError","InvalidModificationError","NamespaceError","InvalidAccessError","TypeMismatchError","SecurityError","NetworkError","AbortError","URLMismatchError","QuotaExceededError","TimeoutError","InvalidNodeTypeError","DataCloneError","HostDOMException","globalThis","DOMException","FallbackDOMException","Error","constructor","message","name","code","lazyDOMException","domName","cause","undefined","err","options","quota","requested","exports"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":";;;;;;;AAOA;AACA;AACA;AACA;AACA,MAAMA,mBAA2C,GAAG;EAClDC,cAAc,EAAE,CAAC;EACjBC,qBAAqB,EAAE,CAAC;EACxBC,kBAAkB,EAAE,CAAC;EACrBC,qBAAqB,EAAE,CAAC;EACxBC,0BAA0B,EAAE,CAAC;EAC7BC,aAAa,EAAE,CAAC;EAChBC,iBAAiB,EAAE,CAAC;EACpBC,mBAAmB,EAAE,EAAE;EACvBC,iBAAiB,EAAE,EAAE;EACrBC,WAAW,EAAE,EAAE;EACfC,wBAAwB,EAAE,EAAE;EAC5BC,cAAc,EAAE,EAAE;EAClBC,kBAAkB,EAAE,EAAE;EACtBC,iBAAiB,EAAE,EAAE;EACrBC,aAAa,EAAE,EAAE;EACjBC,YAAY,EAAE,EAAE;EAChBC,UAAU,EAAE,EAAE;EACdC,gBAAgB,EAAE,EAAE;EACpBC,kBAAkB,EAAE,EAAE;EACtBC,YAAY,EAAE,EAAE;EAChBC,oBAAoB,EAAE,EAAE;EACxBC,cAAc,EAAE;AAClB,CAAC;AAED,MAAMC,gBAA4D,GAChEC,UAAU,CACVC,YAAY;AAEd,MAAMC,oBAAoB,SAASC,KAAK,CAAC;EAEvCC,WAAWA,CAACC,OAAe,EAAEC,IAAY,EAAE;IACzC,KAAK,CAACD,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,IAAI,GAAG/B,mBAAmB,CAAC8B,IAAI,CAAC,IAAI,CAAC;EAC5C;AACF;AAEO,SAASE,gBAAgBA,CAACH,OAAe,EAAEI,OAAgB,EAAS;EACzE,MAAMH,IAAI,GAAG,OAAOG,OAAO,KAAK,QAAQ,GAAGA,OAAO,GAAGA,OAAO,CAACH,IAAI;EACjE,MAAMI,KAAK,GAAG,OAAOD,OAAO,KAAK,QAAQ,GAAGE,SAAS,GAAGF,OAAO,CAACC,KAAK;EAErE,IAAIE,GAAU;EACd,IAAIb,gBAAgB,EAAE;IACpBa,GAAG,GACDF,KAAK,KAAKC,SAAS,GACf,IAAIZ,gBAAgB,CAACM,OAAO,EAAE;MAAEC,IAAI;MAAEI;IAAM,CAAU,CAAC,GACvD,IAAIX,gBAAgB,CAACM,OAAO,EAAEC,IAAI,CAAC;EAC3C,CAAC,MAAM;IACLM,GAAG,GAAG,IAAIV,oBAAoB,CAACG,OAAO,EAAEC,IAAI,CAAC;IAC7C,IAAII,KAAK,KAAKC,SAAS,EAAE;MACtBC,GAAG,CAAiCF,KAAK,GAAGA,KAAK;IACpD;EACF;EACA,OAAOE,GAAG;AACZ;;AAEA;AACA;AACA;AACO,MAAMjB,kBAAkB,SAASO,oBAAoB,CAAC;EAG3DE,WAAWA,CACTC,OAAe,EACfQ,OAA+C,GAAG,CAAC,CAAC,EACpD;IACA,KAAK,CAACR,OAAO,EAAE,oBAAoB,CAAC;IACpC,IAAI,CAACS,KAAK,GAAGD,OAAO,CAACC,KAAK,IAAI,IAAI;IAClC,IAAI,CAACC,SAAS,GAAGF,OAAO,CAACE,SAAS,IAAI,IAAI;EAC5C;AACF;AAACC,OAAA,CAAArB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -14,8 +14,13 @@ function getNative() {
|
|
|
14
14
|
return utils;
|
|
15
15
|
}
|
|
16
16
|
function timingSafeEqual(a, b) {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
// Use binaryLikeToArrayBuffer (not abvToArrayBuffer) so that TypedArray /
|
|
18
|
+
// Buffer views are sliced to their `byteOffset`/`byteLength` window. The
|
|
19
|
+
// zero-copy `abvToArrayBuffer` returns the entire backing buffer, which
|
|
20
|
+
// would (a) compare unrelated bytes and (b) silently fail the byte-length
|
|
21
|
+
// check for any view smaller than its backing.
|
|
22
|
+
const bufA = (0, _conversion.binaryLikeToArrayBuffer)(a);
|
|
23
|
+
const bufB = (0, _conversion.binaryLikeToArrayBuffer)(b);
|
|
19
24
|
if (bufA.byteLength !== bufB.byteLength) {
|
|
20
25
|
throw new RangeError('Input buffers must have the same byte length');
|
|
21
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeNitroModules","require","_conversion","utils","getNative","NitroModules","createHybridObject","timingSafeEqual","a","b","bufA","
|
|
1
|
+
{"version":3,"names":["_reactNativeNitroModules","require","_conversion","utils","getNative","NitroModules","createHybridObject","timingSafeEqual","a","b","bufA","binaryLikeToArrayBuffer","bufB","byteLength","RangeError"],"sourceRoot":"../../../src","sources":["utils/timingSafeEqual.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AAGA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAIE,KAAY;AAChB,SAASC,SAASA,CAAA,EAAU;EAC1B,IAAID,KAAK,IAAI,IAAI,EAAE;IACjBA,KAAK,GAAGE,qCAAY,CAACC,kBAAkB,CAAQ,OAAO,CAAC;EACzD;EACA,OAAOH,KAAK;AACd;AAEO,SAASI,eAAeA,CAACC,CAAM,EAAEC,CAAM,EAAW;EACvD;EACA;EACA;EACA;EACA;EACA,MAAMC,IAAI,GAAG,IAAAC,mCAAuB,EAACH,CAAC,CAAC;EACvC,MAAMI,IAAI,GAAG,IAAAD,mCAAuB,EAACF,CAAC,CAAC;EAEvC,IAAIC,IAAI,CAACG,UAAU,KAAKD,IAAI,CAACC,UAAU,EAAE;IACvC,MAAM,IAAIC,UAAU,CAAC,8CAA8C,CAAC;EACtE;EAEA,OAAOV,SAAS,CAAC,CAAC,CAACG,eAAe,CAACG,IAAI,EAAEE,IAAI,CAAC;AAChD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["KFormatType","exports","KeyType","KeyEncoding","KeyFormat","kNamedCurveAliases","KeyVariant"],"sourceRoot":"../../../src","sources":["utils/types.ts"],"mappings":";;;;;;AAE8C;
|
|
1
|
+
{"version":3,"names":["KFormatType","exports","KeyType","KeyEncoding","KeyFormat","kNamedCurveAliases","KeyVariant"],"sourceRoot":"../../../src","sources":["utils/types.ts"],"mappings":";;;;;;AAE8C;AAkI9C;AAqLA;AAAA,IACYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AAAA,IAMXE,OAAO,GAAAD,OAAA,CAAAC,OAAA,0BAAPA,OAAO;EAAPA,OAAO,CAAPA,OAAO;EAAPA,OAAO,CAAPA,OAAO;EAAPA,OAAO,CAAPA,OAAO;EAAA,OAAPA,OAAO;AAAA;AAAA,IAMPC,WAAW,GAAAF,OAAA,CAAAE,WAAA,0BAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AAAA,IAOXC,SAAS,GAAAH,OAAA,CAAAG,SAAA,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AASd,MAAMC,kBAAkB,GAAAJ,OAAA,CAAAI,kBAAA,GAAG;EAChC,OAAO,EAAE,YAAY;EACrB,OAAO,EAAE,WAAW;EACpB,OAAO,EAAE;AACX,CAAU;AACV;AAAA,IA0JYC,UAAU,GAAAL,OAAA,CAAAK,UAAA,0BAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA,OAuBtB;AACA;AACA;AA4CA","ignoreList":[]}
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.getSortedUsages = getSortedUsages;
|
|
6
7
|
exports.getUsagesUnion = void 0;
|
|
7
8
|
exports.hasAnyNotIn = hasAnyNotIn;
|
|
8
9
|
exports.isStringOrBuffer = isStringOrBuffer;
|
|
9
10
|
exports.validateFunction = validateFunction;
|
|
11
|
+
exports.validateJwkStructure = validateJwkStructure;
|
|
10
12
|
exports.validateMaxBufferLength = exports.validateKeyOps = void 0;
|
|
11
13
|
exports.validateObject = validateObject;
|
|
12
14
|
var _safeBuffer = require("safe-buffer");
|
|
@@ -35,6 +37,10 @@ const validateMaxBufferLength = (data, name) => {
|
|
|
35
37
|
throw (0, _errors.lazyDOMException)(`${name} must be less than ${kMaxBufferLength + 1} bits`, 'OperationError');
|
|
36
38
|
}
|
|
37
39
|
};
|
|
40
|
+
|
|
41
|
+
// Returns the intersection of `usageSet` and the spread `usages`, preserving
|
|
42
|
+
// the spread order. Dedup and canonical ordering are not performed here —
|
|
43
|
+
// the `CryptoKey` constructor runs `getSortedUsages` on every input.
|
|
38
44
|
exports.validateMaxBufferLength = validateMaxBufferLength;
|
|
39
45
|
const getUsagesUnion = (usageSet, ...usages) => {
|
|
40
46
|
const newset = [];
|
|
@@ -45,6 +51,11 @@ const getUsagesUnion = (usageSet, ...usages) => {
|
|
|
45
51
|
return newset;
|
|
46
52
|
};
|
|
47
53
|
exports.getUsagesUnion = getUsagesUnion;
|
|
54
|
+
const kCanonicalUsageOrder = ['encrypt', 'decrypt', 'sign', 'verify', 'deriveKey', 'deriveBits', 'wrapKey', 'unwrapKey', 'encapsulateKey', 'encapsulateBits', 'decapsulateKey', 'decapsulateBits'];
|
|
55
|
+
function getSortedUsages(usages) {
|
|
56
|
+
const set = new Set(usages);
|
|
57
|
+
return kCanonicalUsageOrder.filter(usage => set.has(usage));
|
|
58
|
+
}
|
|
48
59
|
const kKeyOps = {
|
|
49
60
|
sign: 1,
|
|
50
61
|
verify: 2,
|
|
@@ -86,7 +97,42 @@ const validateKeyOps = (keyOps, usagesSet) => {
|
|
|
86
97
|
}
|
|
87
98
|
}
|
|
88
99
|
};
|
|
100
|
+
|
|
101
|
+
// WebCrypto JWK import structural validation, mirroring Node's
|
|
102
|
+
// `internal/crypto/webcrypto_util.validateJwk` + `validateKeyOps`:
|
|
103
|
+
// - `ext`: if present and false, `extractable` must also be false
|
|
104
|
+
// - `use`: if `keyUsages` is non-empty and `use` is present, must equal
|
|
105
|
+
// the algorithm's expected use ('sig' or 'enc')
|
|
106
|
+
// - `key_ops`: must be an array, must not contain duplicates, and every
|
|
107
|
+
// requested usage must appear in it
|
|
89
108
|
exports.validateKeyOps = validateKeyOps;
|
|
109
|
+
function validateJwkStructure(jwk, extractable, keyUsages, expectedUse) {
|
|
110
|
+
if (jwk.ext === false && extractable) {
|
|
111
|
+
throw (0, _errors.lazyDOMException)('JWK "ext" is false but extractable was requested', 'DataError');
|
|
112
|
+
}
|
|
113
|
+
if (keyUsages.length > 0 && jwk.use !== undefined) {
|
|
114
|
+
if (jwk.use !== expectedUse) {
|
|
115
|
+
throw (0, _errors.lazyDOMException)('Invalid JWK "use" Parameter', 'DataError');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (jwk.key_ops !== undefined) {
|
|
119
|
+
if (!Array.isArray(jwk.key_ops)) {
|
|
120
|
+
throw (0, _errors.lazyDOMException)('JWK "key_ops" must be an array', 'DataError');
|
|
121
|
+
}
|
|
122
|
+
const seen = new Set();
|
|
123
|
+
for (const op of jwk.key_ops) {
|
|
124
|
+
if (seen.has(op)) {
|
|
125
|
+
throw (0, _errors.lazyDOMException)('Duplicate key operation', 'DataError');
|
|
126
|
+
}
|
|
127
|
+
seen.add(op);
|
|
128
|
+
}
|
|
129
|
+
for (const usage of keyUsages) {
|
|
130
|
+
if (!jwk.key_ops.includes(usage)) {
|
|
131
|
+
throw (0, _errors.lazyDOMException)(`JWK "key_ops" does not include requested usage "${usage}"`, 'DataError');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
90
136
|
function hasAnyNotIn(set, checks) {
|
|
91
137
|
for (const s of set) {
|
|
92
138
|
if (!checks.includes(s)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_safeBuffer","require","_errors","kMaxBufferLength","validateFunction","f","isStringOrBuffer","val","ArrayBuffer","isView","validateObject","value","name","options","useDefaultOptions","allowArray","allowFunction","nullable","Array","isArray","Error","validateMaxBufferLength","data","length","SBuffer","byteLength","lazyDOMException","exports","getUsagesUnion","usageSet","usages","newset","n","undefined","includes","push","kKeyOps","sign","verify","encrypt","decrypt","wrapKey","unwrapKey","deriveKey","deriveBits","encapsulateBits","decapsulateBits","encapsulateKey","decapsulateKey","validateKeyOps","keyOps","usagesSet","flags","op","op_flag","use","
|
|
1
|
+
{"version":3,"names":["_safeBuffer","require","_errors","kMaxBufferLength","validateFunction","f","isStringOrBuffer","val","ArrayBuffer","isView","validateObject","value","name","options","useDefaultOptions","allowArray","allowFunction","nullable","Array","isArray","Error","validateMaxBufferLength","data","length","SBuffer","byteLength","lazyDOMException","exports","getUsagesUnion","usageSet","usages","newset","n","undefined","includes","push","kCanonicalUsageOrder","getSortedUsages","set","Set","filter","usage","has","kKeyOps","sign","verify","encrypt","decrypt","wrapKey","unwrapKey","deriveKey","deriveBits","encapsulateBits","decapsulateBits","encapsulateKey","decapsulateKey","validateKeyOps","keyOps","usagesSet","flags","op","op_flag","use","validateJwkStructure","jwk","extractable","keyUsages","expectedUse","ext","key_ops","seen","add","hasAnyNotIn","checks","s"],"sourceRoot":"../../../src","sources":["utils/validation.ts"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAEA;AACA,MAAME,gBAAgB,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC;AAE7B,SAASC,gBAAgBA,CAACC,CAAU,EAAW;EACpD,OAAOA,CAAC,KAAK,IAAI,IAAI,OAAOA,CAAC,KAAK,UAAU;AAC9C;AAEO,SAASC,gBAAgBA,CAACC,GAAY,EAA+B;EAC1E,OACE,OAAOA,GAAG,KAAK,QAAQ,IACvBC,WAAW,CAACC,MAAM,CAACF,GAAG,CAAC,IACvBA,GAAG,YAAYC,WAAW;AAE9B;AAEO,SAASE,cAAcA,CAC5BC,KAAc,EACdC,IAAY,EACZC,OAIQ,EACI;EACZ,MAAMC,iBAAiB,GAAGD,OAAO,IAAI,IAAI;EACzC,MAAME,UAAU,GAAGD,iBAAiB,GAAG,KAAK,GAAGD,OAAO,CAACE,UAAU;EACjE,MAAMC,aAAa,GAAGF,iBAAiB,GAAG,KAAK,GAAGD,OAAO,CAACG,aAAa;EACvE,MAAMC,QAAQ,GAAGH,iBAAiB,GAAG,KAAK,GAAGD,OAAO,CAACI,QAAQ;EAC7D,IACG,CAACA,QAAQ,IAAIN,KAAK,KAAK,IAAI,IAC3B,CAACI,UAAU,IAAIG,KAAK,CAACC,OAAO,CAACR,KAAK,CAAE,IACpC,OAAOA,KAAK,KAAK,QAAQ,KACvB,CAACK,aAAa,IAAI,OAAOL,KAAK,KAAK,UAAU,CAAE,EAClD;IACA,MAAM,IAAIS,KAAK,CAAC,GAAGR,IAAI,0BAA0BD,KAAK,EAAE,CAAC;EAC3D;EACA,OAAO,IAAI;AACb;AAEO,MAAMU,uBAAuB,GAAGA,CACr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CAAC;MACH;IACF;EACF;AACF;AAEO,SAAS+B,WAAWA,CAAClC,GAAa,EAAEmC,MAAgB,EAAE;EAC3D,KAAK,MAAMC,CAAC,IAAIpC,GAAG,EAAE;IACnB,IAAI,CAACmC,MAAM,CAACvC,QAAQ,CAACwC,CAAC,CAAC,EAAE;MACvB,OAAO,IAAI;IACb;EACF;EACA,OAAO,KAAK;AACd","ignoreList":[]}
|
|
@@ -40,12 +40,12 @@ class X509Certificate {
|
|
|
40
40
|
cache = new Map();
|
|
41
41
|
constructor(buffer) {
|
|
42
42
|
this.handle = _reactNativeNitroModules.NitroModules.createHybridObject('X509CertificateHandle');
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
|
|
44
|
+
// For string input, route through binaryLikeToArrayBuffer so the result
|
|
45
|
+
// is a tight ArrayBuffer of just the encoded bytes. `Buffer.from(str).buffer`
|
|
46
|
+
// can return a pool-backed ArrayBuffer with byteOffset > 0, exposing
|
|
47
|
+
// unrelated bytes (and giving the wrong byteLength) to native.
|
|
48
|
+
const ab = (0, _utils.binaryLikeToArrayBuffer)(buffer);
|
|
49
49
|
this.handle.init(ab);
|
|
50
50
|
}
|
|
51
51
|
cached(key, compute) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeNitroModules","require","_reactNativeBuffer","_keys","_utils","X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT","X509_CHECK_FLAG_NO_WILDCARDS","X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS","X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS","X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS","X509_CHECK_FLAG_NEVER_CHECK_SUBJECT","getFlags","options","flags","subject","wildcards","partialWildcards","multiLabelWildcards","singleLabelSubdomains","X509Certificate","cache","Map","constructor","buffer","handle","NitroModules","createHybridObject","ab","
|
|
1
|
+
{"version":3,"names":["_reactNativeNitroModules","require","_reactNativeBuffer","_keys","_utils","X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT","X509_CHECK_FLAG_NO_WILDCARDS","X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS","X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS","X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS","X509_CHECK_FLAG_NEVER_CHECK_SUBJECT","getFlags","options","flags","subject","wildcards","partialWildcards","multiLabelWildcards","singleLabelSubdomains","X509Certificate","cache","Map","constructor","buffer","handle","NitroModules","createHybridObject","ab","binaryLikeToArrayBuffer","init","cached","key","compute","has","get","value","set","subjectAltName","issuer","infoAccess","validFrom","validTo","validFromDate","Date","validToDate","fingerprint","fingerprint256","fingerprint512","extKeyUsage","keyUsage","serialNumber","signatureAlgorithm","signatureAlgorithmOid","ca","raw","Buffer","from","publicKey","PublicKeyObject","issuerCertificate","undefined","checkHost","name","TypeError","checkEmail","email","checkIP","ip","checkIssued","otherCert","checkPrivateKey","pkey","KeyObject","type","verify","toString","pem","toJSON","toLegacyObject","subjectaltname","modulus","bits","exponent","valid_from","valid_to","ext_key_usage","exports"],"sourceRoot":"../../src","sources":["x509certificate.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAEA,MAAMI,oCAAoC,GAAG,GAAG;AAChD,MAAMC,4BAA4B,GAAG,GAAG;AACxC,MAAMC,oCAAoC,GAAG,GAAG;AAChD,MAAMC,qCAAqC,GAAG,GAAG;AACjD,MAAMC,uCAAuC,GAAG,IAAI;AACpD,MAAMC,mCAAmC,GAAG,IAAI;AA6BhD,SAASC,QAAQA,CAACC,OAAsB,EAAU;EAChD,IAAI,CAACA,OAAO,EAAE,OAAO,CAAC;EAEtB,IAAIC,KAAK,GAAG,CAAC;EAEb,IAAID,OAAO,CAACE,OAAO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,SAAS;MAC1B4C,QAAQ,EAAE,IAAI,CAAC3C,OAAO;MACtBI,WAAW,EAAE,IAAI,CAACA,WAAW;MAC7BC,cAAc,EAAE,IAAI,CAACA,cAAc;MACnCC,cAAc,EAAE,IAAI,CAACA,cAAc;MACnCsC,aAAa,EAAE,IAAI,CAACpC,QAAQ;MAC5BC,YAAY,EAAE,IAAI,CAACA,YAAY;MAC/BI,GAAG,EAAE,IAAI,CAACA;IACZ,CAAC;EACH;AACF;AAACgC,OAAA,CAAAnE,eAAA,GAAAA,eAAA","ignoreList":[]}
|
package/lib/module/argon2.js
CHANGED
|
@@ -12,23 +12,72 @@ function getNative() {
|
|
|
12
12
|
}
|
|
13
13
|
const ARGON2_VERSION = 0x13; // v1.3
|
|
14
14
|
|
|
15
|
+
// RFC 9106 § 3.1: Argon2 input/parameter constraints.
|
|
16
|
+
// p (parallelism) 1 ≤ p ≤ 2^24 - 1
|
|
17
|
+
// T (tag length) 4 ≤ T ≤ 2^32 - 1
|
|
18
|
+
// m (memory in KiB) 8*p ≤ m ≤ 2^32 - 1
|
|
19
|
+
// t (passes) 1 ≤ t ≤ 2^32 - 1
|
|
20
|
+
// |salt| (nonce) 8 ≤ |s| ≤ 2^32 - 1
|
|
21
|
+
// v (version) 0x10 (v1.0) or 0x13 (v1.3)
|
|
22
|
+
const ARGON2_MAX_U24 = 0xff_ffff;
|
|
23
|
+
const ARGON2_MAX_U32 = 0xffff_ffff;
|
|
24
|
+
function isUInt(value, max) {
|
|
25
|
+
return typeof value === 'number' && Number.isFinite(value) && Number.isInteger(value) && value >= 0 && value <= max;
|
|
26
|
+
}
|
|
15
27
|
function validateAlgorithm(algorithm) {
|
|
16
28
|
if (algorithm !== 'argon2d' && algorithm !== 'argon2i' && algorithm !== 'argon2id') {
|
|
17
29
|
throw new TypeError(`Unknown argon2 algorithm: ${algorithm}`);
|
|
18
30
|
}
|
|
19
31
|
}
|
|
32
|
+
|
|
33
|
+
// Returns the resolved nonce ArrayBuffer so the caller can pass it
|
|
34
|
+
// straight to native without re-resolving `params.nonce`.
|
|
35
|
+
function validateArgon2Params(params, version) {
|
|
36
|
+
if (!isUInt(params.parallelism, ARGON2_MAX_U24) || params.parallelism < 1) {
|
|
37
|
+
throw new RangeError(`Invalid Argon2 parallelism: ${params.parallelism} ` + `(RFC 9106: 1 ≤ p ≤ 2^24 - 1)`);
|
|
38
|
+
}
|
|
39
|
+
if (!isUInt(params.tagLength, ARGON2_MAX_U32) || params.tagLength < 4) {
|
|
40
|
+
throw new RangeError(`Invalid Argon2 tagLength: ${params.tagLength} ` + `(RFC 9106: 4 ≤ T ≤ 2^32 - 1)`);
|
|
41
|
+
}
|
|
42
|
+
const minMemory = 8 * params.parallelism;
|
|
43
|
+
if (!isUInt(params.memory, ARGON2_MAX_U32) || params.memory < minMemory) {
|
|
44
|
+
throw new RangeError(`Invalid Argon2 memory: ${params.memory} KiB ` + `(RFC 9106: 8 * p (= ${minMemory}) ≤ m ≤ 2^32 - 1)`);
|
|
45
|
+
}
|
|
46
|
+
if (!isUInt(params.passes, ARGON2_MAX_U32) || params.passes < 1) {
|
|
47
|
+
throw new RangeError(`Invalid Argon2 passes: ${params.passes} ` + `(RFC 9106: 1 ≤ t ≤ 2^32 - 1)`);
|
|
48
|
+
}
|
|
49
|
+
if (version !== 0x10 && version !== 0x13) {
|
|
50
|
+
throw new RangeError(`Invalid Argon2 version: 0x${version.toString(16)} ` + `(RFC 9106: 0x10 or 0x13)`);
|
|
51
|
+
}
|
|
52
|
+
// Salt (nonce) must be 8..2^32 - 1 bytes — measured against the resolved
|
|
53
|
+
// ArrayBuffer because BinaryLike accepts strings whose UTF-8 length is
|
|
54
|
+
// what actually reaches OpenSSL.
|
|
55
|
+
const nonceAB = binaryLikeToArrayBuffer(params.nonce);
|
|
56
|
+
if (nonceAB.byteLength < 8 || nonceAB.byteLength > ARGON2_MAX_U32) {
|
|
57
|
+
throw new RangeError(`Invalid Argon2 nonce length: ${nonceAB.byteLength} bytes ` + `(RFC 9106: 8 ≤ |s| ≤ 2^32 - 1)`);
|
|
58
|
+
}
|
|
59
|
+
return nonceAB;
|
|
60
|
+
}
|
|
20
61
|
function toAB(value) {
|
|
21
62
|
return binaryLikeToArrayBuffer(value);
|
|
22
63
|
}
|
|
23
64
|
export function argon2Sync(algorithm, params) {
|
|
24
65
|
validateAlgorithm(algorithm);
|
|
25
66
|
const version = params.version ?? ARGON2_VERSION;
|
|
26
|
-
const
|
|
67
|
+
const nonceAB = validateArgon2Params(params, version);
|
|
68
|
+
const result = getNative().hashSync(algorithm, toAB(params.message), nonceAB, params.parallelism, params.tagLength, params.memory, params.passes, version, params.secret ? toAB(params.secret) : undefined, params.associatedData ? toAB(params.associatedData) : undefined);
|
|
27
69
|
return Buffer.from(result);
|
|
28
70
|
}
|
|
29
71
|
export function argon2(algorithm, params, callback) {
|
|
30
72
|
validateAlgorithm(algorithm);
|
|
31
73
|
const version = params.version ?? ARGON2_VERSION;
|
|
32
|
-
|
|
74
|
+
let nonceAB;
|
|
75
|
+
try {
|
|
76
|
+
nonceAB = validateArgon2Params(params, version);
|
|
77
|
+
} catch (err) {
|
|
78
|
+
callback(err, Buffer.alloc(0));
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
getNative().hash(algorithm, toAB(params.message), nonceAB, params.parallelism, params.tagLength, params.memory, params.passes, version, params.secret ? toAB(params.secret) : undefined, params.associatedData ? toAB(params.associatedData) : undefined).then(ab => callback(null, Buffer.from(ab))).catch(err => callback(err, Buffer.alloc(0)));
|
|
33
82
|
}
|
|
34
83
|
//# sourceMappingURL=argon2.js.map
|
package/lib/module/argon2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Buffer","NitroModules","binaryLikeToArrayBuffer","native","getNative","createHybridObject","ARGON2_VERSION","
|
|
1
|
+
{"version":3,"names":["Buffer","NitroModules","binaryLikeToArrayBuffer","native","getNative","createHybridObject","ARGON2_VERSION","ARGON2_MAX_U24","ARGON2_MAX_U32","isUInt","value","max","Number","isFinite","isInteger","validateAlgorithm","algorithm","TypeError","validateArgon2Params","params","version","parallelism","RangeError","tagLength","minMemory","memory","passes","toString","nonceAB","nonce","byteLength","toAB","argon2Sync","result","hashSync","message","secret","undefined","associatedData","from","argon2","callback","err","alloc","hash","then","ab","catch"],"sourceRoot":"../../src","sources":["argon2.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,gCAAgC;AACvD,SAASC,YAAY,QAAQ,4BAA4B;AAEzD,SAASC,uBAAuB,QAAQ,SAAS;AAGjD,IAAIC,MAAoB;AACxB,SAASC,SAASA,CAAA,EAAiB;EACjC,IAAID,MAAM,IAAI,IAAI,EAAE;IAClBA,MAAM,GAAGF,YAAY,CAACI,kBAAkB,CAAe,QAAQ,CAAC;EAClE;EACA,OAAOF,MAAM;AACf;AAcA,MAAMG,cAAc,GAAG,IAAI,CAAC,CAAC;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAG,SAAS;AAChC,MAAMC,cAAc,GAAG,WAAW;AAElC,SAASC,MAAMA,CAACC,KAAc,EAAEC,GAAW,EAAmB;EAC5D,OACE,OAAOD,KAAK,KAAK,QAAQ,IACzBE,MAAM,CAACC,QAAQ,CAACH,KAAK,CAAC,IACtBE,MAAM,CAACE,SAAS,CAACJ,KAAK,CAAC,IACvBA,KAAK,IAAI,CAAC,IACVA,KAAK,IAAIC,GAAG;AAEhB;AAEA,SAASI,iBAAiBA,CAACC,SAAiB,EAAQ;EAClD,IACEA,SAAS,KAAK,SAAS,IACvBA,SAAS,KAAK,SAAS,IACvBA,SAAS,KAAK,UAAU,EACxB;IACA,MAAM,IAAIC,SAAS,CAAC,6BAA6BD,SAAS,EAAE,CAAC;EAC/D;AACF;;AAEA;AACA;AACA,SAASE,oBAAoBA,CAC3BC,MAAoB,EACpBC,OAAe,EACF;EACb,IAAI,CAACX,MAAM,CAACU,MAAM,CAACE,WAAW,EAAEd,cAAc,CAAC,IAAIY,MAAM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I,CACH5B,SAAS,EACTe,IAAI,CAACZ,MAAM,CAACgB,OAAO,CAAC,EACpBP,OAAO,EACPT,MAAM,CAACE,WAAW,EAClBF,MAAM,CAACI,SAAS,EAChBJ,MAAM,CAACM,MAAM,EACbN,MAAM,CAACO,MAAM,EACbN,OAAO,EACPD,MAAM,CAACiB,MAAM,GAAGL,IAAI,CAACZ,MAAM,CAACiB,MAAM,CAAC,GAAGC,SAAS,EAC/ClB,MAAM,CAACmB,cAAc,GAAGP,IAAI,CAACZ,MAAM,CAACmB,cAAc,CAAC,GAAGD,SACxD,CAAC,CACAQ,IAAI,CAACC,EAAE,IAAIL,QAAQ,CAAC,IAAI,EAAEzC,MAAM,CAACuC,IAAI,CAACO,EAAE,CAAC,CAAC,CAAC,CAC3CC,KAAK,CAAEL,GAAU,IAAKD,QAAQ,CAACC,GAAG,EAAE1C,MAAM,CAAC2C,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1D","ignoreList":[]}
|
package/lib/module/cipher.js
CHANGED
|
@@ -25,6 +25,80 @@ export function getCipherInfo(name, options) {
|
|
|
25
25
|
if (typeof name !== 'string' || name.length === 0) return undefined;
|
|
26
26
|
return CipherUtils.getCipherInfo(name, options?.keyLength, options?.ivLength);
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
// libsodium ciphers aren't visible to OpenSSL's EVP_CIPHER_fetch, so
|
|
30
|
+
// getCipherInfo() returns undefined for them. Hard-code the (key, iv)
|
|
31
|
+
// byte-lengths the C++ factory will accept.
|
|
32
|
+
const LIBSODIUM_CIPHER_PARAMS = {
|
|
33
|
+
xsalsa20: {
|
|
34
|
+
keyLength: 32,
|
|
35
|
+
ivLength: 24
|
|
36
|
+
},
|
|
37
|
+
'xsalsa20-poly1305': {
|
|
38
|
+
keyLength: 32,
|
|
39
|
+
ivLength: 24
|
|
40
|
+
},
|
|
41
|
+
'xchacha20-poly1305': {
|
|
42
|
+
keyLength: 32,
|
|
43
|
+
ivLength: 24
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
function validateCipherParams(cipherType, keyByteLength, ivByteLength) {
|
|
47
|
+
if (typeof cipherType !== 'string' || cipherType.length === 0) {
|
|
48
|
+
throw new TypeError('cipher algorithm must be a non-empty string');
|
|
49
|
+
}
|
|
50
|
+
// ArrayBuffer.byteLength is always a non-negative integer, so the only
|
|
51
|
+
// out-of-range value we need to guard is 0 — empty key buffers must not
|
|
52
|
+
// reach OpenSSL's EVP_CipherInit_ex.
|
|
53
|
+
if (keyByteLength === 0) {
|
|
54
|
+
throw new RangeError(`Invalid key length 0 for cipher ${cipherType}`);
|
|
55
|
+
}
|
|
56
|
+
const lower = cipherType.toLowerCase();
|
|
57
|
+
const sodium = LIBSODIUM_CIPHER_PARAMS[lower];
|
|
58
|
+
if (sodium) {
|
|
59
|
+
// libsodium parlance: "nonce" rather than "iv". Phrase the expected
|
|
60
|
+
// size as a natural-language clause so callers asserting on either
|
|
61
|
+
// `key must be N bytes` or `Invalid key length N` both match.
|
|
62
|
+
if (keyByteLength !== sodium.keyLength) {
|
|
63
|
+
throw new RangeError(`Invalid key length ${keyByteLength} for cipher ${cipherType} ` + `(key must be ${sodium.keyLength} bytes)`);
|
|
64
|
+
}
|
|
65
|
+
if (ivByteLength !== sodium.ivLength) {
|
|
66
|
+
throw new RangeError(`Invalid nonce length ${ivByteLength} for cipher ${cipherType} ` + `(nonce must be ${sodium.ivLength} bytes)`);
|
|
67
|
+
}
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// OpenSSL path. Look up the cipher's defaults once. Most callers pass
|
|
72
|
+
// exactly the cipher's default key/iv lengths (e.g. AES-128-CBC always
|
|
73
|
+
// wants 16/16) — short-circuit those to a single native round-trip.
|
|
74
|
+
// Variable-length ciphers (GCM, CCM, OCB, ChaCha20-Poly1305) fall through
|
|
75
|
+
// to per-parameter validation calls so the error message can name which
|
|
76
|
+
// of {key, iv} is wrong.
|
|
77
|
+
const info = CipherUtils.getCipherInfo(cipherType);
|
|
78
|
+
if (info === undefined) {
|
|
79
|
+
throw new TypeError(`Unsupported or unknown cipher type: ${cipherType}`);
|
|
80
|
+
}
|
|
81
|
+
const expectedIv = info.ivLength ?? 0;
|
|
82
|
+
if (expectedIv === 0 && ivByteLength > 0) {
|
|
83
|
+
throw new RangeError(`Cipher ${cipherType} does not use an iv (got ${ivByteLength} bytes)`);
|
|
84
|
+
}
|
|
85
|
+
if (expectedIv > 0 && ivByteLength === 0) {
|
|
86
|
+
throw new RangeError(`Cipher ${cipherType} requires an iv but none was provided`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Fast path: lengths match the cipher's defaults exactly.
|
|
90
|
+
if (info.keyLength === keyByteLength && expectedIv === ivByteLength) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Variable-length: verify against native one parameter at a time.
|
|
95
|
+
if (CipherUtils.getCipherInfo(cipherType, keyByteLength, undefined) === undefined) {
|
|
96
|
+
throw new RangeError(`Invalid key length ${keyByteLength} for cipher ${cipherType}`);
|
|
97
|
+
}
|
|
98
|
+
if (expectedIv > 0 && CipherUtils.getCipherInfo(cipherType, undefined, ivByteLength) === undefined) {
|
|
99
|
+
throw new RangeError(`Invalid iv length ${ivByteLength} for cipher ${cipherType}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
28
102
|
class CipherCommon extends Stream.Transform {
|
|
29
103
|
_decoder = null;
|
|
30
104
|
_decoderEncoding = undefined;
|
|
@@ -51,14 +125,17 @@ class CipherCommon extends Stream.Transform {
|
|
|
51
125
|
}
|
|
52
126
|
super(streamOptions); // Pass filtered options
|
|
53
127
|
|
|
54
|
-
|
|
55
|
-
|
|
128
|
+
// defaults to 16 bytes for AEAD modes; non-AEAD callers ignore it.
|
|
129
|
+
const authTagLen = getUIntOption(options, 'authTagLength') ?? 16;
|
|
130
|
+
const cipherKeyAB = binaryLikeToArrayBuffer(cipherKey);
|
|
131
|
+
const ivAB = binaryLikeToArrayBuffer(iv);
|
|
132
|
+
validateCipherParams(cipherType, cipherKeyAB.byteLength, ivAB.byteLength);
|
|
56
133
|
const factory = NitroModules.createHybridObject('CipherFactory');
|
|
57
134
|
this.native = factory.createCipher({
|
|
58
135
|
isCipher,
|
|
59
136
|
cipherType,
|
|
60
|
-
cipherKey:
|
|
61
|
-
iv:
|
|
137
|
+
cipherKey: cipherKeyAB,
|
|
138
|
+
iv: ivAB,
|
|
62
139
|
authTagLen
|
|
63
140
|
});
|
|
64
141
|
}
|
|
@@ -94,13 +171,27 @@ class CipherCommon extends Stream.Transform {
|
|
|
94
171
|
}
|
|
95
172
|
return Buffer.from(ret);
|
|
96
173
|
}
|
|
174
|
+
|
|
175
|
+
// Stream interface — surface synchronous errors (bad encoding,
|
|
176
|
+
// OpenSSL EVP failures, AEAD tag mismatch in `final()`, etc.) via
|
|
177
|
+
// the callback so they emit as stream 'error' events instead of
|
|
178
|
+
// throwing out of the Transform plumbing and crashing the host
|
|
179
|
+
// pipeline.
|
|
97
180
|
_transform(chunk, encoding, callback) {
|
|
98
|
-
|
|
99
|
-
|
|
181
|
+
try {
|
|
182
|
+
this.push(this.update(chunk, normalizeEncoding(encoding)));
|
|
183
|
+
callback();
|
|
184
|
+
} catch (err) {
|
|
185
|
+
callback(err);
|
|
186
|
+
}
|
|
100
187
|
}
|
|
101
188
|
_flush(callback) {
|
|
102
|
-
|
|
103
|
-
|
|
189
|
+
try {
|
|
190
|
+
this.push(this.final());
|
|
191
|
+
callback();
|
|
192
|
+
} catch (err) {
|
|
193
|
+
callback(err);
|
|
194
|
+
}
|
|
104
195
|
}
|
|
105
196
|
setAutoPadding(autoPadding) {
|
|
106
197
|
const res = this.native.setAutoPadding(!!autoPadding);
|
|
@@ -114,7 +205,11 @@ class CipherCommon extends Stream.Transform {
|
|
|
114
205
|
if (!this.native || typeof this.native.setAAD !== 'function') {
|
|
115
206
|
throw new Error('Cipher native object or setAAD method not initialized.');
|
|
116
207
|
}
|
|
117
|
-
|
|
208
|
+
// Use binaryLikeToArrayBuffer (not `buffer.buffer`) so that sliced /
|
|
209
|
+
// offset views send only the AAD bytes the caller intended. Passing the
|
|
210
|
+
// raw backing ArrayBuffer authenticates the wrong data and silently
|
|
211
|
+
// breaks the AEAD integrity guarantee.
|
|
212
|
+
const res = this.native.setAAD(binaryLikeToArrayBuffer(buffer), options?.plaintextLength);
|
|
118
213
|
if (!res) {
|
|
119
214
|
throw new Error('setAAD failed (native call returned false)');
|
|
120
215
|
}
|
|
@@ -180,12 +275,15 @@ output,
|
|
|
180
275
|
// @ts-expect-error haven't implemented this part of @noble/ciphers API
|
|
181
276
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
182
277
|
counter) {
|
|
278
|
+
const cipherKeyAB = binaryLikeToArrayBuffer(key);
|
|
279
|
+
const ivAB = binaryLikeToArrayBuffer(nonce);
|
|
280
|
+
validateCipherParams('xsalsa20', cipherKeyAB.byteLength, ivAB.byteLength);
|
|
183
281
|
const factory = NitroModules.createHybridObject('CipherFactory');
|
|
184
282
|
const native = factory.createCipher({
|
|
185
283
|
isCipher: true,
|
|
186
284
|
cipherType: 'xsalsa20',
|
|
187
|
-
cipherKey:
|
|
188
|
-
iv:
|
|
285
|
+
cipherKey: cipherKeyAB,
|
|
286
|
+
iv: ivAB
|
|
189
287
|
});
|
|
190
288
|
const result = native.update(binaryLikeToArrayBuffer(data));
|
|
191
289
|
return new Uint8Array(result);
|