@ohos-ports/react-native-quick-crypto 0.0.0-stage → 1.1.8-beta.0
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 +259 -0
- package/README.md +170 -2
- package/android/CMakeLists.txt +155 -0
- package/android/build.gradle +176 -0
- package/android/gradle.properties +6 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/cpp/cpp-adapter.cpp +8 -0
- package/android/src/main/java/com/margelo/nitro/quickcrypto/QuickCryptoPackage.java +41 -0
- package/app.plugin.js +3 -0
- package/cpp/argon2/HybridArgon2.cpp +110 -0
- package/cpp/argon2/HybridArgon2.hpp +32 -0
- package/cpp/blake3/HybridBlake3.cpp +120 -0
- package/cpp/blake3/HybridBlake3.hpp +35 -0
- package/cpp/certificate/HybridCertificate.cpp +42 -0
- package/cpp/certificate/HybridCertificate.hpp +16 -0
- package/cpp/cipher/CCMCipher.cpp +211 -0
- package/cpp/cipher/CCMCipher.hpp +24 -0
- package/cpp/cipher/ChaCha20Cipher.cpp +91 -0
- package/cpp/cipher/ChaCha20Cipher.hpp +23 -0
- package/cpp/cipher/ChaCha20Poly1305Cipher.cpp +175 -0
- package/cpp/cipher/ChaCha20Poly1305Cipher.hpp +27 -0
- package/cpp/cipher/GCMCipher.cpp +65 -0
- package/cpp/cipher/GCMCipher.hpp +14 -0
- package/cpp/cipher/HybridCipher.cpp +403 -0
- package/cpp/cipher/HybridCipher.hpp +90 -0
- package/cpp/cipher/HybridCipherFactory.hpp +119 -0
- package/cpp/cipher/HybridRsaCipher.cpp +477 -0
- package/cpp/cipher/HybridRsaCipher.hpp +33 -0
- package/cpp/cipher/OCBCipher.cpp +55 -0
- package/cpp/cipher/OCBCipher.hpp +19 -0
- package/cpp/cipher/XChaCha20Poly1305Cipher.cpp +158 -0
- package/cpp/cipher/XChaCha20Poly1305Cipher.hpp +42 -0
- package/cpp/cipher/XSalsa20Cipher.cpp +127 -0
- package/cpp/cipher/XSalsa20Cipher.hpp +55 -0
- package/cpp/cipher/XSalsa20Poly1305Cipher.cpp +138 -0
- package/cpp/cipher/XSalsa20Poly1305Cipher.hpp +41 -0
- package/cpp/dh/HybridDhKeyPair.cpp +179 -0
- package/cpp/dh/HybridDhKeyPair.hpp +37 -0
- package/cpp/dh/HybridDiffieHellman.cpp +482 -0
- package/cpp/dh/HybridDiffieHellman.hpp +42 -0
- package/cpp/dsa/HybridDsaKeyPair.cpp +128 -0
- package/cpp/dsa/HybridDsaKeyPair.hpp +32 -0
- package/cpp/ec/HybridEcKeyPair.cpp +481 -0
- package/cpp/ec/HybridEcKeyPair.hpp +45 -0
- package/cpp/ecdh/HybridECDH.cpp +251 -0
- package/cpp/ecdh/HybridECDH.hpp +43 -0
- package/cpp/ed25519/HybridEdKeyPair.cpp +360 -0
- package/cpp/ed25519/HybridEdKeyPair.hpp +67 -0
- package/cpp/hash/HybridHash.cpp +190 -0
- package/cpp/hash/HybridHash.hpp +43 -0
- package/cpp/hkdf/HybridHkdf.cpp +115 -0
- package/cpp/hkdf/HybridHkdf.hpp +29 -0
- package/cpp/hmac/HybridHmac.cpp +102 -0
- package/cpp/hmac/HybridHmac.hpp +32 -0
- package/cpp/keys/HybridKeyObjectHandle.cpp +1519 -0
- package/cpp/keys/HybridKeyObjectHandle.hpp +78 -0
- package/cpp/keys/KeyObjectData.cpp +298 -0
- package/cpp/keys/KeyObjectData.hpp +73 -0
- package/cpp/keys/node.h +5 -0
- package/cpp/kmac/HybridKmac.cpp +83 -0
- package/cpp/kmac/HybridKmac.hpp +31 -0
- package/cpp/mldsa/HybridMlDsaKeyPair.cpp +243 -0
- package/cpp/mldsa/HybridMlDsaKeyPair.hpp +49 -0
- package/cpp/mlkem/HybridMlKemKeyPair.cpp +315 -0
- package/cpp/mlkem/HybridMlKemKeyPair.hpp +48 -0
- package/cpp/pbkdf2/HybridPbkdf2.cpp +50 -0
- package/cpp/pbkdf2/HybridPbkdf2.hpp +24 -0
- package/cpp/prime/HybridPrime.cpp +81 -0
- package/cpp/prime/HybridPrime.hpp +20 -0
- package/cpp/random/HybridRandom.cpp +48 -0
- package/cpp/random/HybridRandom.hpp +32 -0
- package/cpp/rsa/HybridRsaKeyPair.cpp +151 -0
- package/cpp/rsa/HybridRsaKeyPair.hpp +40 -0
- package/cpp/scrypt/HybridScrypt.cpp +64 -0
- package/cpp/scrypt/HybridScrypt.hpp +28 -0
- package/cpp/sign/HybridSignHandle.cpp +241 -0
- package/cpp/sign/HybridSignHandle.hpp +36 -0
- package/cpp/sign/HybridVerifyHandle.cpp +207 -0
- package/cpp/sign/HybridVerifyHandle.hpp +36 -0
- package/cpp/sign/SignUtils.hpp +91 -0
- 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 +399 -0
- package/cpp/utils/HybridUtils.hpp +28 -0
- package/cpp/utils/Macros.hpp +68 -0
- package/cpp/utils/QuickCryptoUtils.cpp +44 -0
- package/cpp/utils/QuickCryptoUtils.hpp +186 -0
- package/cpp/utils/base64.h +309 -0
- package/cpp/x509/HybridX509Certificate.cpp +174 -0
- package/cpp/x509/HybridX509Certificate.hpp +51 -0
- package/deps/blake3/LICENSE_A2 +202 -0
- package/deps/blake3/LICENSE_A2LLVM +219 -0
- package/deps/blake3/LICENSE_CC0 +121 -0
- package/deps/blake3/README.md +228 -0
- package/deps/blake3/c/README.md +403 -0
- package/deps/blake3/c/blake3.c +651 -0
- package/deps/blake3/c/blake3.h +86 -0
- package/deps/blake3/c/blake3_dispatch.c +332 -0
- package/deps/blake3/c/blake3_impl.h +333 -0
- package/deps/blake3/c/blake3_neon.c +367 -0
- package/deps/blake3/c/blake3_portable.c +160 -0
- package/deps/fastpbkdf2/fastpbkdf2.c +356 -0
- package/deps/fastpbkdf2/fastpbkdf2.h +68 -0
- package/deps/ncrypto/LICENSE +21 -0
- package/deps/ncrypto/README.md +18 -0
- package/deps/ncrypto/include/dh-primes.h +67 -0
- package/deps/ncrypto/include/ncrypto/aead.h +137 -0
- package/deps/ncrypto/include/ncrypto/version.h +14 -0
- package/deps/ncrypto/include/ncrypto.h +1759 -0
- package/deps/ncrypto/src/aead.cpp +302 -0
- package/deps/ncrypto/src/engine.cpp +93 -0
- package/deps/ncrypto/src/ncrypto.cpp +5426 -0
- package/deps/simdutf/LICENSE-APACHE +201 -0
- package/deps/simdutf/LICENSE-MIT +18 -0
- package/deps/simdutf/README.md +2782 -0
- package/deps/simdutf/include/simdutf/avx512.h +79 -0
- package/deps/simdutf/include/simdutf/base64_implementation.h +158 -0
- package/deps/simdutf/include/simdutf/base64_tables.h +887 -0
- package/deps/simdutf/include/simdutf/common_defs.h +186 -0
- package/deps/simdutf/include/simdutf/compiler_check.h +50 -0
- package/deps/simdutf/include/simdutf/constexpr_ptr.h +138 -0
- package/deps/simdutf/include/simdutf/encoding_types.h +189 -0
- package/deps/simdutf/include/simdutf/error.h +126 -0
- package/deps/simdutf/include/simdutf/implementation.h +7081 -0
- package/deps/simdutf/include/simdutf/internal/isadetection.h +325 -0
- package/deps/simdutf/include/simdutf/portability.h +285 -0
- package/deps/simdutf/include/simdutf/scalar/ascii.h +86 -0
- package/deps/simdutf/include/simdutf/scalar/atomic_util.h +105 -0
- package/deps/simdutf/include/simdutf/scalar/base64.h +911 -0
- package/deps/simdutf/include/simdutf/scalar/latin1.h +26 -0
- package/deps/simdutf/include/simdutf/scalar/latin1_to_utf16/latin1_to_utf16.h +52 -0
- package/deps/simdutf/include/simdutf/scalar/latin1_to_utf32/latin1_to_utf32.h +27 -0
- package/deps/simdutf/include/simdutf/scalar/latin1_to_utf8/latin1_to_utf8.h +191 -0
- package/deps/simdutf/include/simdutf/scalar/swap_bytes.h +35 -0
- package/deps/simdutf/include/simdutf/scalar/utf16.h +226 -0
- package/deps/simdutf/include/simdutf/scalar/utf16_to_latin1/utf16_to_latin1.h +108 -0
- package/deps/simdutf/include/simdutf/scalar/utf16_to_latin1/valid_utf16_to_latin1.h +40 -0
- package/deps/simdutf/include/simdutf/scalar/utf16_to_utf32/utf16_to_utf32.h +86 -0
- package/deps/simdutf/include/simdutf/scalar/utf16_to_utf32/valid_utf16_to_utf32.h +44 -0
- package/deps/simdutf/include/simdutf/scalar/utf16_to_utf8/utf16_to_utf8.h +295 -0
- package/deps/simdutf/include/simdutf/scalar/utf16_to_utf8/valid_utf16_to_utf8.h +91 -0
- package/deps/simdutf/include/simdutf/scalar/utf32.h +82 -0
- package/deps/simdutf/include/simdutf/scalar/utf32_to_latin1/utf32_to_latin1.h +68 -0
- package/deps/simdutf/include/simdutf/scalar/utf32_to_latin1/valid_utf32_to_latin1.h +67 -0
- package/deps/simdutf/include/simdutf/scalar/utf32_to_utf16/utf32_to_utf16.h +84 -0
- package/deps/simdutf/include/simdutf/scalar/utf32_to_utf16/valid_utf32_to_utf16.h +44 -0
- package/deps/simdutf/include/simdutf/scalar/utf32_to_utf8/utf32_to_utf8.h +142 -0
- package/deps/simdutf/include/simdutf/scalar/utf32_to_utf8/valid_utf32_to_utf8.h +72 -0
- package/deps/simdutf/include/simdutf/scalar/utf8.h +326 -0
- package/deps/simdutf/include/simdutf/scalar/utf8_to_latin1/utf8_to_latin1.h +225 -0
- package/deps/simdutf/include/simdutf/scalar/utf8_to_latin1/valid_utf8_to_latin1.h +87 -0
- package/deps/simdutf/include/simdutf/scalar/utf8_to_utf16/utf8_to_utf16.h +342 -0
- package/deps/simdutf/include/simdutf/scalar/utf8_to_utf16/valid_utf8_to_utf16.h +106 -0
- package/deps/simdutf/include/simdutf/scalar/utf8_to_utf32/utf8_to_utf32.h +299 -0
- package/deps/simdutf/include/simdutf/scalar/utf8_to_utf32/valid_utf8_to_utf32.h +83 -0
- package/deps/simdutf/include/simdutf/simdutf_version.h +26 -0
- package/deps/simdutf/include/simdutf.h +26 -0
- package/deps/simdutf/include/simdutf_c.h +342 -0
- package/deps/simdutf/src/arm64/arm_base64.cpp +791 -0
- package/deps/simdutf/src/arm64/arm_convert_latin1_to_utf16.cpp +24 -0
- package/deps/simdutf/src/arm64/arm_convert_latin1_to_utf32.cpp +24 -0
- package/deps/simdutf/src/arm64/arm_convert_latin1_to_utf8.cpp +70 -0
- package/deps/simdutf/src/arm64/arm_convert_utf16_to_latin1.cpp +61 -0
- package/deps/simdutf/src/arm64/arm_convert_utf16_to_utf32.cpp +185 -0
- package/deps/simdutf/src/arm64/arm_convert_utf16_to_utf8.cpp +780 -0
- package/deps/simdutf/src/arm64/arm_convert_utf32_to_latin1.cpp +60 -0
- package/deps/simdutf/src/arm64/arm_convert_utf32_to_utf16.cpp +208 -0
- package/deps/simdutf/src/arm64/arm_convert_utf32_to_utf8.cpp +505 -0
- package/deps/simdutf/src/arm64/arm_convert_utf8_to_latin1.cpp +69 -0
- package/deps/simdutf/src/arm64/arm_convert_utf8_to_utf16.cpp +313 -0
- package/deps/simdutf/src/arm64/arm_convert_utf8_to_utf32.cpp +179 -0
- package/deps/simdutf/src/arm64/arm_find.cpp +199 -0
- package/deps/simdutf/src/arm64/arm_utf16fix.cpp +185 -0
- package/deps/simdutf/src/arm64/arm_validate_utf16.cpp +165 -0
- package/deps/simdutf/src/arm64/arm_validate_utf32le.cpp +65 -0
- package/deps/simdutf/src/arm64/implementation.cpp +1442 -0
- package/deps/simdutf/src/encoding_types.cpp +67 -0
- package/deps/simdutf/src/error.cpp +3 -0
- package/deps/simdutf/src/fallback/implementation.cpp +589 -0
- package/deps/simdutf/src/generic/ascii_validation.h +50 -0
- package/deps/simdutf/src/generic/base64.h +233 -0
- package/deps/simdutf/src/generic/base64lengths.h +63 -0
- package/deps/simdutf/src/generic/buf_block_reader.h +109 -0
- package/deps/simdutf/src/generic/find.h +75 -0
- package/deps/simdutf/src/generic/utf16/change_endianness.h +24 -0
- package/deps/simdutf/src/generic/utf16/count_code_points_bytemask.h +58 -0
- package/deps/simdutf/src/generic/utf16/to_well_formed.h +93 -0
- package/deps/simdutf/src/generic/utf16/utf32_length_from_utf16.h +15 -0
- package/deps/simdutf/src/generic/utf16/utf8_length_from_utf16.h +35 -0
- package/deps/simdutf/src/generic/utf16/utf8_length_from_utf16_bytemask.h +199 -0
- package/deps/simdutf/src/generic/utf16.h +73 -0
- package/deps/simdutf/src/generic/utf32.h +136 -0
- package/deps/simdutf/src/generic/utf8/utf16_length_from_utf8_bytemask.h +53 -0
- package/deps/simdutf/src/generic/utf8.h +92 -0
- package/deps/simdutf/src/generic/utf8_to_latin1/utf8_to_latin1.h +316 -0
- package/deps/simdutf/src/generic/utf8_to_latin1/valid_utf8_to_latin1.h +78 -0
- package/deps/simdutf/src/generic/utf8_to_utf16/utf8_to_utf16.h +332 -0
- package/deps/simdutf/src/generic/utf8_to_utf16/valid_utf8_to_utf16.h +74 -0
- package/deps/simdutf/src/generic/utf8_to_utf32/utf8_to_utf32.h +318 -0
- package/deps/simdutf/src/generic/utf8_to_utf32/valid_utf8_to_utf32.h +42 -0
- package/deps/simdutf/src/generic/utf8_validation/utf8_lookup4_algorithm.h +223 -0
- package/deps/simdutf/src/generic/utf8_validation/utf8_validator.h +84 -0
- package/deps/simdutf/src/generic/validate_utf16.h +164 -0
- package/deps/simdutf/src/generic/validate_utf32.h +99 -0
- package/deps/simdutf/src/haswell/avx2_base64.cpp +837 -0
- package/deps/simdutf/src/haswell/avx2_convert_latin1_to_utf16.cpp +28 -0
- package/deps/simdutf/src/haswell/avx2_convert_latin1_to_utf32.cpp +20 -0
- package/deps/simdutf/src/haswell/avx2_convert_latin1_to_utf8.cpp +83 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf16_to_latin1.cpp +83 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf16_to_utf32.cpp +210 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf16_to_utf8.cpp +602 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf32_to_latin1.cpp +116 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf32_to_utf16.cpp +164 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf32_to_utf8.cpp +569 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf8_to_latin1.cpp +60 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf8_to_utf16.cpp +195 -0
- package/deps/simdutf/src/haswell/avx2_convert_utf8_to_utf32.cpp +135 -0
- package/deps/simdutf/src/haswell/avx2_utf16fix.cpp +173 -0
- package/deps/simdutf/src/haswell/avx2_validate_utf16.cpp +17 -0
- package/deps/simdutf/src/haswell/implementation.cpp +1447 -0
- package/deps/simdutf/src/icelake/icelake_ascii_validation.inl.cpp +19 -0
- package/deps/simdutf/src/icelake/icelake_base64.inl.cpp +630 -0
- package/deps/simdutf/src/icelake/icelake_common.inl.cpp +37 -0
- package/deps/simdutf/src/icelake/icelake_convert_latin1_to_utf16.inl.cpp +36 -0
- package/deps/simdutf/src/icelake/icelake_convert_latin1_to_utf32.inl.cpp +23 -0
- package/deps/simdutf/src/icelake/icelake_convert_latin1_to_utf8.inl.cpp +107 -0
- package/deps/simdutf/src/icelake/icelake_convert_utf16_to_latin1.inl.cpp +103 -0
- package/deps/simdutf/src/icelake/icelake_convert_utf16_to_utf32.inl.cpp +136 -0
- package/deps/simdutf/src/icelake/icelake_convert_utf16_to_utf8.inl.cpp +206 -0
- package/deps/simdutf/src/icelake/icelake_convert_utf32_to_latin1.inl.cpp +74 -0
- package/deps/simdutf/src/icelake/icelake_convert_utf32_to_utf16.inl.cpp +338 -0
- package/deps/simdutf/src/icelake/icelake_convert_utf32_to_utf8.inl.cpp +574 -0
- package/deps/simdutf/src/icelake/icelake_convert_utf8_to_latin1.inl.cpp +104 -0
- package/deps/simdutf/src/icelake/icelake_convert_utf8_to_utf16.inl.cpp +75 -0
- package/deps/simdutf/src/icelake/icelake_convert_valid_utf8_to_latin1.inl.cpp +69 -0
- package/deps/simdutf/src/icelake/icelake_find.inl.cpp +146 -0
- package/deps/simdutf/src/icelake/icelake_from_utf8.inl.cpp +266 -0
- package/deps/simdutf/src/icelake/icelake_from_valid_utf8.inl.cpp +136 -0
- package/deps/simdutf/src/icelake/icelake_macros.inl.cpp +143 -0
- package/deps/simdutf/src/icelake/icelake_utf16fix.cpp +138 -0
- package/deps/simdutf/src/icelake/icelake_utf32_validation.inl.cpp +63 -0
- package/deps/simdutf/src/icelake/icelake_utf8_common.inl.cpp +753 -0
- package/deps/simdutf/src/icelake/icelake_utf8_length_from_utf16.inl.cpp +269 -0
- package/deps/simdutf/src/icelake/icelake_utf8_validation.inl.cpp +116 -0
- package/deps/simdutf/src/icelake/implementation.cpp +1903 -0
- package/deps/simdutf/src/implementation.cpp +2526 -0
- package/deps/simdutf/src/lasx/implementation.cpp +1531 -0
- package/deps/simdutf/src/lasx/lasx_base64.cpp +695 -0
- package/deps/simdutf/src/lasx/lasx_convert_latin1_to_utf16.cpp +76 -0
- package/deps/simdutf/src/lasx/lasx_convert_latin1_to_utf32.cpp +55 -0
- package/deps/simdutf/src/lasx/lasx_convert_latin1_to_utf8.cpp +65 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf16_to_latin1.cpp +64 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf16_to_utf32.cpp +183 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf16_to_utf8.cpp +550 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf32_to_latin1.cpp +73 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf32_to_utf16.cpp +218 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf32_to_utf8.cpp +589 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf8_to_latin1.cpp +72 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf8_to_utf16.cpp +296 -0
- package/deps/simdutf/src/lasx/lasx_convert_utf8_to_utf32.cpp +190 -0
- package/deps/simdutf/src/lasx/lasx_find.cpp +64 -0
- package/deps/simdutf/src/lasx/lasx_validate_utf16.cpp +13 -0
- package/deps/simdutf/src/lasx/lasx_validate_utf32le.cpp +84 -0
- package/deps/simdutf/src/lsx/implementation.cpp +1417 -0
- package/deps/simdutf/src/lsx/lsx_base64.cpp +675 -0
- package/deps/simdutf/src/lsx/lsx_convert_latin1_to_utf16.cpp +39 -0
- package/deps/simdutf/src/lsx/lsx_convert_latin1_to_utf32.cpp +27 -0
- package/deps/simdutf/src/lsx/lsx_convert_latin1_to_utf8.cpp +56 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf16_to_latin1.cpp +64 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf16_to_utf32.cpp +133 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf16_to_utf8.cpp +518 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf32_to_latin1.cpp +66 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf32_to_utf16.cpp +155 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf32_to_utf8.cpp +459 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf8_to_latin1.cpp +75 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf8_to_utf16.cpp +291 -0
- package/deps/simdutf/src/lsx/lsx_convert_utf8_to_utf32.cpp +179 -0
- package/deps/simdutf/src/lsx/lsx_find.cpp +60 -0
- package/deps/simdutf/src/lsx/lsx_validate_utf16.cpp +13 -0
- package/deps/simdutf/src/lsx/lsx_validate_utf32le.cpp +68 -0
- package/deps/simdutf/src/ppc64/implementation.cpp +992 -0
- package/deps/simdutf/src/ppc64/ppc64_base64.cpp +480 -0
- package/deps/simdutf/src/ppc64/ppc64_base64_internal_tests.cpp +401 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_latin1_to_utf16.cpp +12 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_latin1_to_utf32.cpp +12 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_latin1_to_utf8.cpp +149 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf16_to_latin1.cpp +67 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf16_to_utf32.cpp +87 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf16_to_utf8.cpp +296 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf32_to_latin1.cpp +57 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf32_to_utf16.cpp +117 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf32_to_utf8.cpp +166 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf8_to_latin1.cpp +69 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf8_to_utf16.cpp +211 -0
- package/deps/simdutf/src/ppc64/ppc64_convert_utf8_to_utf32.cpp +153 -0
- package/deps/simdutf/src/ppc64/ppc64_utf16_to_utf8_tables.h +1011 -0
- package/deps/simdutf/src/ppc64/ppc64_utf8_length_from_latin1.cpp +37 -0
- package/deps/simdutf/src/ppc64/ppc64_validate_utf16.cpp +19 -0
- package/deps/simdutf/src/ppc64/templates.cpp +91 -0
- package/deps/simdutf/src/rvv/implementation.cpp +138 -0
- package/deps/simdutf/src/rvv/rvv_find.cpp +27 -0
- package/deps/simdutf/src/rvv/rvv_helpers.inl.cpp +23 -0
- package/deps/simdutf/src/rvv/rvv_latin1_to.inl.cpp +71 -0
- package/deps/simdutf/src/rvv/rvv_length_from.inl.cpp +164 -0
- package/deps/simdutf/src/rvv/rvv_utf16_to.inl.cpp +399 -0
- package/deps/simdutf/src/rvv/rvv_utf16fix.cpp +110 -0
- package/deps/simdutf/src/rvv/rvv_utf32_to.inl.cpp +307 -0
- package/deps/simdutf/src/rvv/rvv_utf8_to.inl.cpp +435 -0
- package/deps/simdutf/src/rvv/rvv_validate.inl.cpp +275 -0
- package/deps/simdutf/src/simdutf/arm64/begin.h +2 -0
- package/deps/simdutf/src/simdutf/arm64/bitmanipulation.h +34 -0
- package/deps/simdutf/src/simdutf/arm64/end.h +2 -0
- package/deps/simdutf/src/simdutf/arm64/implementation.h +307 -0
- package/deps/simdutf/src/simdutf/arm64/intrinsics.h +10 -0
- package/deps/simdutf/src/simdutf/arm64/simd.h +547 -0
- package/deps/simdutf/src/simdutf/arm64/simd16-inl.h +403 -0
- package/deps/simdutf/src/simdutf/arm64/simd32-inl.h +129 -0
- package/deps/simdutf/src/simdutf/arm64/simd64-inl.h +28 -0
- package/deps/simdutf/src/simdutf/arm64.h +43 -0
- package/deps/simdutf/src/simdutf/fallback/begin.h +1 -0
- package/deps/simdutf/src/simdutf/fallback/bitmanipulation.h +13 -0
- package/deps/simdutf/src/simdutf/fallback/end.h +1 -0
- package/deps/simdutf/src/simdutf/fallback/implementation.h +331 -0
- package/deps/simdutf/src/simdutf/fallback.h +42 -0
- package/deps/simdutf/src/simdutf/haswell/begin.h +15 -0
- package/deps/simdutf/src/simdutf/haswell/bitmanipulation.h +35 -0
- package/deps/simdutf/src/simdutf/haswell/end.h +13 -0
- package/deps/simdutf/src/simdutf/haswell/implementation.h +338 -0
- package/deps/simdutf/src/simdutf/haswell/intrinsics.h +67 -0
- package/deps/simdutf/src/simdutf/haswell/simd.h +363 -0
- package/deps/simdutf/src/simdutf/haswell/simd16-inl.h +261 -0
- package/deps/simdutf/src/simdutf/haswell/simd32-inl.h +111 -0
- package/deps/simdutf/src/simdutf/haswell/simd64-inl.h +34 -0
- package/deps/simdutf/src/simdutf/haswell.h +63 -0
- package/deps/simdutf/src/simdutf/icelake/begin.h +14 -0
- package/deps/simdutf/src/simdutf/icelake/bitmanipulation.h +44 -0
- package/deps/simdutf/src/simdutf/icelake/end.h +12 -0
- package/deps/simdutf/src/simdutf/icelake/implementation.h +346 -0
- package/deps/simdutf/src/simdutf/icelake/intrinsics.h +138 -0
- package/deps/simdutf/src/simdutf/icelake/simd.h +17 -0
- package/deps/simdutf/src/simdutf/icelake/simd16-inl.h +90 -0
- package/deps/simdutf/src/simdutf/icelake/simd32-inl.h +47 -0
- package/deps/simdutf/src/simdutf/icelake.h +81 -0
- package/deps/simdutf/src/simdutf/lasx/begin.h +8 -0
- package/deps/simdutf/src/simdutf/lasx/bitmanipulation.h +25 -0
- package/deps/simdutf/src/simdutf/lasx/end.h +8 -0
- package/deps/simdutf/src/simdutf/lasx/implementation.h +310 -0
- package/deps/simdutf/src/simdutf/lasx/intrinsics.h +319 -0
- package/deps/simdutf/src/simdutf/lasx/simd.h +551 -0
- package/deps/simdutf/src/simdutf/lasx/simd16-inl.h +234 -0
- package/deps/simdutf/src/simdutf/lasx/simd32-inl.h +74 -0
- package/deps/simdutf/src/simdutf/lasx/simd64-inl.h +52 -0
- package/deps/simdutf/src/simdutf/lasx.h +49 -0
- package/deps/simdutf/src/simdutf/lsx/begin.h +2 -0
- package/deps/simdutf/src/simdutf/lsx/bitmanipulation.h +25 -0
- package/deps/simdutf/src/simdutf/lsx/end.h +2 -0
- package/deps/simdutf/src/simdutf/lsx/implementation.h +309 -0
- package/deps/simdutf/src/simdutf/lsx/intrinsics.h +196 -0
- package/deps/simdutf/src/simdutf/lsx/simd.h +421 -0
- package/deps/simdutf/src/simdutf/lsx/simd16-inl.h +242 -0
- package/deps/simdutf/src/simdutf/lsx/simd32-inl.h +69 -0
- package/deps/simdutf/src/simdutf/lsx/simd64-inl.h +50 -0
- package/deps/simdutf/src/simdutf/lsx.h +52 -0
- package/deps/simdutf/src/simdutf/ppc64/begin.h +1 -0
- package/deps/simdutf/src/simdutf/ppc64/bitmanipulation.h +29 -0
- package/deps/simdutf/src/simdutf/ppc64/end.h +1 -0
- package/deps/simdutf/src/simdutf/ppc64/implementation.h +348 -0
- package/deps/simdutf/src/simdutf/ppc64/intrinsics.h +19 -0
- package/deps/simdutf/src/simdutf/ppc64/simd.h +177 -0
- package/deps/simdutf/src/simdutf/ppc64/simd16-inl.h +327 -0
- package/deps/simdutf/src/simdutf/ppc64/simd32-inl.h +247 -0
- package/deps/simdutf/src/simdutf/ppc64/simd8-inl.h +618 -0
- package/deps/simdutf/src/simdutf/ppc64.h +40 -0
- package/deps/simdutf/src/simdutf/rvv/begin.h +7 -0
- package/deps/simdutf/src/simdutf/rvv/end.h +7 -0
- package/deps/simdutf/src/simdutf/rvv/implementation.h +321 -0
- package/deps/simdutf/src/simdutf/rvv/intrinsics.h +131 -0
- package/deps/simdutf/src/simdutf/rvv.h +41 -0
- package/deps/simdutf/src/simdutf/westmere/begin.h +8 -0
- package/deps/simdutf/src/simdutf/westmere/bitmanipulation.h +37 -0
- package/deps/simdutf/src/simdutf/westmere/end.h +8 -0
- package/deps/simdutf/src/simdutf/westmere/implementation.h +338 -0
- package/deps/simdutf/src/simdutf/westmere/intrinsics.h +38 -0
- package/deps/simdutf/src/simdutf/westmere/simd.h +379 -0
- package/deps/simdutf/src/simdutf/westmere/simd16-inl.h +242 -0
- package/deps/simdutf/src/simdutf/westmere/simd32-inl.h +151 -0
- package/deps/simdutf/src/simdutf/westmere/simd64-inl.h +33 -0
- package/deps/simdutf/src/simdutf/westmere.h +59 -0
- package/deps/simdutf/src/simdutf.cpp +152 -0
- package/deps/simdutf/src/simdutf_c.cpp +525 -0
- package/deps/simdutf/src/tables/utf16_to_utf8_tables.h +768 -0
- package/deps/simdutf/src/tables/utf32_to_utf16_tables.h +53 -0
- package/deps/simdutf/src/tables/utf8_to_utf16_tables.h +826 -0
- package/deps/simdutf/src/westmere/implementation.cpp +1479 -0
- package/deps/simdutf/src/westmere/internal/loader.cpp +7 -0
- package/deps/simdutf/src/westmere/internal/write_v_u16_11bits_to_utf8.cpp +66 -0
- package/deps/simdutf/src/westmere/sse_base64.cpp +672 -0
- package/deps/simdutf/src/westmere/sse_convert_latin1_to_utf16.cpp +21 -0
- package/deps/simdutf/src/westmere/sse_convert_latin1_to_utf32.cpp +31 -0
- package/deps/simdutf/src/westmere/sse_convert_latin1_to_utf8.cpp +71 -0
- package/deps/simdutf/src/westmere/sse_convert_utf16_to_latin1.cpp +70 -0
- package/deps/simdutf/src/westmere/sse_convert_utf16_to_utf32.cpp +206 -0
- package/deps/simdutf/src/westmere/sse_convert_utf16_to_utf8.cpp +504 -0
- package/deps/simdutf/src/westmere/sse_convert_utf32_to_latin1.cpp +82 -0
- package/deps/simdutf/src/westmere/sse_convert_utf32_to_utf16.cpp +209 -0
- package/deps/simdutf/src/westmere/sse_convert_utf32_to_utf8.cpp +589 -0
- package/deps/simdutf/src/westmere/sse_convert_utf8_to_latin1.cpp +58 -0
- package/deps/simdutf/src/westmere/sse_convert_utf8_to_utf16.cpp +197 -0
- package/deps/simdutf/src/westmere/sse_convert_utf8_to_utf32.cpp +141 -0
- package/deps/simdutf/src/westmere/sse_utf16fix.cpp +82 -0
- package/deps/simdutf/src/westmere/sse_validate_utf16.cpp +17 -0
- package/jest/index.js +16 -0
- package/lib/commonjs/argon2.js +88 -0
- package/lib/commonjs/argon2.js.map +1 -0
- package/lib/commonjs/blake3.js +99 -0
- package/lib/commonjs/blake3.js.map +1 -0
- package/lib/commonjs/certificate.js +35 -0
- package/lib/commonjs/certificate.js.map +1 -0
- package/lib/commonjs/cipher.js +299 -0
- package/lib/commonjs/cipher.js.map +1 -0
- package/lib/commonjs/constants.js +32 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/dh-groups.js +29 -0
- package/lib/commonjs/dh-groups.js.map +1 -0
- package/lib/commonjs/dhKeyPair.js +112 -0
- package/lib/commonjs/dhKeyPair.js.map +1 -0
- package/lib/commonjs/diffie-hellman.js +151 -0
- package/lib/commonjs/diffie-hellman.js.map +1 -0
- package/lib/commonjs/dsa.js +101 -0
- package/lib/commonjs/dsa.js.map +1 -0
- package/lib/commonjs/ec.js +370 -0
- package/lib/commonjs/ec.js.map +1 -0
- package/lib/commonjs/ecdh.js +109 -0
- package/lib/commonjs/ecdh.js.map +1 -0
- package/lib/commonjs/ed.js +443 -0
- package/lib/commonjs/ed.js.map +1 -0
- package/lib/commonjs/expo-plugin/@types.js +2 -0
- package/lib/commonjs/expo-plugin/@types.js.map +1 -0
- package/lib/commonjs/expo-plugin/withRNQC.js +25 -0
- package/lib/commonjs/expo-plugin/withRNQC.js.map +1 -0
- package/lib/commonjs/expo-plugin/withSodiumAndroid.js +25 -0
- package/lib/commonjs/expo-plugin/withSodiumAndroid.js.map +1 -0
- package/lib/commonjs/expo-plugin/withSodiumIos.js +23 -0
- package/lib/commonjs/expo-plugin/withSodiumIos.js.map +1 -0
- package/lib/commonjs/expo-plugin/withXCode.js +109 -0
- package/lib/commonjs/expo-plugin/withXCode.js.map +1 -0
- package/lib/commonjs/hash.js +291 -0
- package/lib/commonjs/hash.js.map +1 -0
- package/lib/commonjs/hkdf.js +178 -0
- package/lib/commonjs/hkdf.js.map +1 -0
- package/lib/commonjs/hmac.js +125 -0
- package/lib/commonjs/hmac.js.map +1 -0
- package/lib/commonjs/index.js +356 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/keys/classes.js +280 -0
- package/lib/commonjs/keys/classes.js.map +1 -0
- package/lib/commonjs/keys/generateKeyPair.js +237 -0
- package/lib/commonjs/keys/generateKeyPair.js.map +1 -0
- package/lib/commonjs/keys/index.js +381 -0
- package/lib/commonjs/keys/index.js.map +1 -0
- package/lib/commonjs/keys/publicCipher.js +171 -0
- package/lib/commonjs/keys/publicCipher.js.map +1 -0
- package/lib/commonjs/keys/signVerify.js +227 -0
- package/lib/commonjs/keys/signVerify.js.map +1 -0
- package/lib/commonjs/keys/utils.js +181 -0
- package/lib/commonjs/keys/utils.js.map +1 -0
- package/lib/commonjs/mldsa.js +69 -0
- package/lib/commonjs/mldsa.js.map +1 -0
- package/lib/commonjs/mlkem.js +219 -0
- package/lib/commonjs/mlkem.js.map +1 -0
- package/lib/commonjs/native-nitro-bridge.js +344 -0
- package/lib/commonjs/nitro-node-shim.js +23 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/pbkdf2.js +106 -0
- package/lib/commonjs/pbkdf2.js.map +1 -0
- package/lib/commonjs/prime.js +84 -0
- package/lib/commonjs/prime.js.map +1 -0
- package/lib/commonjs/random.js +296 -0
- package/lib/commonjs/random.js.map +1 -0
- package/lib/commonjs/rsa.js +213 -0
- package/lib/commonjs/rsa.js.map +1 -0
- package/lib/commonjs/scrypt.js +139 -0
- package/lib/commonjs/scrypt.js.map +1 -0
- package/lib/commonjs/slhdsa.js +70 -0
- package/lib/commonjs/slhdsa.js.map +1 -0
- package/lib/commonjs/specs/argon2.nitro.js +6 -0
- package/lib/commonjs/specs/argon2.nitro.js.map +1 -0
- package/lib/commonjs/specs/blake3.nitro.js +6 -0
- package/lib/commonjs/specs/blake3.nitro.js.map +1 -0
- package/lib/commonjs/specs/certificate.nitro.js +6 -0
- package/lib/commonjs/specs/certificate.nitro.js.map +1 -0
- package/lib/commonjs/specs/cipher.nitro.js +6 -0
- package/lib/commonjs/specs/cipher.nitro.js.map +1 -0
- package/lib/commonjs/specs/dhKeyPair.nitro.js +6 -0
- package/lib/commonjs/specs/dhKeyPair.nitro.js.map +1 -0
- package/lib/commonjs/specs/diffie-hellman.nitro.js +6 -0
- package/lib/commonjs/specs/diffie-hellman.nitro.js.map +1 -0
- package/lib/commonjs/specs/dsaKeyPair.nitro.js +6 -0
- package/lib/commonjs/specs/dsaKeyPair.nitro.js.map +1 -0
- package/lib/commonjs/specs/ecKeyPair.nitro.js +6 -0
- package/lib/commonjs/specs/ecKeyPair.nitro.js.map +1 -0
- package/lib/commonjs/specs/ecdh.nitro.js +6 -0
- package/lib/commonjs/specs/ecdh.nitro.js.map +1 -0
- package/lib/commonjs/specs/edKeyPair.nitro.js +6 -0
- package/lib/commonjs/specs/edKeyPair.nitro.js.map +1 -0
- package/lib/commonjs/specs/hash.nitro.js +6 -0
- package/lib/commonjs/specs/hash.nitro.js.map +1 -0
- package/lib/commonjs/specs/hkdf.nitro.js +6 -0
- package/lib/commonjs/specs/hkdf.nitro.js.map +1 -0
- package/lib/commonjs/specs/hmac.nitro.js +6 -0
- package/lib/commonjs/specs/hmac.nitro.js.map +1 -0
- package/lib/commonjs/specs/keyObjectHandle.nitro.js +6 -0
- package/lib/commonjs/specs/keyObjectHandle.nitro.js.map +1 -0
- package/lib/commonjs/specs/kmac.nitro.js +6 -0
- package/lib/commonjs/specs/kmac.nitro.js.map +1 -0
- package/lib/commonjs/specs/mlDsaKeyPair.nitro.js +6 -0
- package/lib/commonjs/specs/mlDsaKeyPair.nitro.js.map +1 -0
- package/lib/commonjs/specs/mlKemKeyPair.nitro.js +6 -0
- package/lib/commonjs/specs/mlKemKeyPair.nitro.js.map +1 -0
- package/lib/commonjs/specs/pbkdf2.nitro.js +6 -0
- package/lib/commonjs/specs/pbkdf2.nitro.js.map +1 -0
- package/lib/commonjs/specs/prime.nitro.js +6 -0
- package/lib/commonjs/specs/prime.nitro.js.map +1 -0
- package/lib/commonjs/specs/random.nitro.js +6 -0
- package/lib/commonjs/specs/random.nitro.js.map +1 -0
- package/lib/commonjs/specs/rsaCipher.nitro.js +6 -0
- package/lib/commonjs/specs/rsaCipher.nitro.js.map +1 -0
- package/lib/commonjs/specs/rsaKeyPair.nitro.js +6 -0
- package/lib/commonjs/specs/rsaKeyPair.nitro.js.map +1 -0
- package/lib/commonjs/specs/scrypt.nitro.js +6 -0
- package/lib/commonjs/specs/scrypt.nitro.js.map +1 -0
- package/lib/commonjs/specs/sign.nitro.js +6 -0
- package/lib/commonjs/specs/sign.nitro.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/specs/utils.nitro.js +6 -0
- package/lib/commonjs/specs/utils.nitro.js.map +1 -0
- package/lib/commonjs/specs/x509certificate.nitro.js +6 -0
- package/lib/commonjs/specs/x509certificate.nitro.js.map +1 -0
- package/lib/commonjs/subtle.js +3211 -0
- package/lib/commonjs/subtle.js.map +1 -0
- package/lib/commonjs/utils/cipher.js +75 -0
- package/lib/commonjs/utils/cipher.js.map +1 -0
- package/lib/commonjs/utils/conversion.js +249 -0
- package/lib/commonjs/utils/conversion.js.map +1 -0
- package/lib/commonjs/utils/errors.js +73 -0
- package/lib/commonjs/utils/errors.js.map +1 -0
- package/lib/commonjs/utils/hashnames.js +122 -0
- package/lib/commonjs/utils/hashnames.js.map +1 -0
- package/lib/commonjs/utils/index.js +83 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/commonjs/utils/noble.js +82 -0
- package/lib/commonjs/utils/noble.js.map +1 -0
- package/lib/commonjs/utils/timingSafeEqual.js +29 -0
- package/lib/commonjs/utils/timingSafeEqual.js.map +1 -0
- package/lib/commonjs/utils/types.js +55 -0
- package/lib/commonjs/utils/types.js.map +1 -0
- package/lib/commonjs/utils/validation.js +144 -0
- package/lib/commonjs/utils/validation.js.map +1 -0
- package/lib/commonjs/x509certificate.js +189 -0
- package/lib/commonjs/x509certificate.js.map +1 -0
- package/lib/module/argon2.js +83 -0
- package/lib/module/argon2.js.map +1 -0
- package/lib/module/blake3.js +91 -0
- package/lib/module/blake3.js.map +1 -0
- package/lib/module/certificate.js +30 -0
- package/lib/module/certificate.js.map +1 -0
- package/lib/module/cipher.js +291 -0
- package/lib/module/cipher.js.map +1 -0
- package/lib/module/constants.js +28 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/dh-groups.js +25 -0
- package/lib/module/dh-groups.js.map +1 -0
- package/lib/module/dhKeyPair.js +105 -0
- package/lib/module/dhKeyPair.js.map +1 -0
- package/lib/module/diffie-hellman.js +145 -0
- package/lib/module/diffie-hellman.js.map +1 -0
- package/lib/module/dsa.js +94 -0
- package/lib/module/dsa.js.map +1 -0
- package/lib/module/ec.js +358 -0
- package/lib/module/ec.js.map +1 -0
- package/lib/module/ecdh.js +103 -0
- package/lib/module/ecdh.js.map +1 -0
- package/lib/module/ed.js +433 -0
- package/lib/module/ed.js.map +1 -0
- package/lib/module/expo-plugin/@types.js +2 -0
- package/lib/module/expo-plugin/@types.js.map +1 -0
- package/lib/module/expo-plugin/withRNQC.js +21 -0
- package/lib/module/expo-plugin/withRNQC.js.map +1 -0
- package/lib/module/expo-plugin/withSodiumAndroid.js +20 -0
- package/lib/module/expo-plugin/withSodiumAndroid.js.map +1 -0
- package/lib/module/expo-plugin/withSodiumIos.js +17 -0
- package/lib/module/expo-plugin/withSodiumIos.js.map +1 -0
- package/lib/module/expo-plugin/withXCode.js +101 -0
- package/lib/module/expo-plugin/withXCode.js.map +1 -0
- package/lib/module/hash.js +282 -0
- package/lib/module/hash.js.map +1 -0
- package/lib/module/hkdf.js +168 -0
- package/lib/module/hkdf.js.map +1 -0
- package/lib/module/hmac.js +120 -0
- package/lib/module/hmac.js.map +1 -0
- package/lib/module/index.js +115 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/keys/classes.js +271 -0
- package/lib/module/keys/classes.js.map +1 -0
- package/lib/module/keys/generateKeyPair.js +231 -0
- package/lib/module/keys/generateKeyPair.js.map +1 -0
- package/lib/module/keys/index.js +246 -0
- package/lib/module/keys/index.js.map +1 -0
- package/lib/module/keys/publicCipher.js +164 -0
- package/lib/module/keys/publicCipher.js.map +1 -0
- package/lib/module/keys/signVerify.js +217 -0
- package/lib/module/keys/signVerify.js.map +1 -0
- package/lib/module/keys/utils.js +170 -0
- package/lib/module/keys/utils.js.map +1 -0
- package/lib/module/mldsa.js +63 -0
- package/lib/module/mldsa.js.map +1 -0
- package/lib/module/mlkem.js +211 -0
- package/lib/module/mlkem.js.map +1 -0
- package/lib/module/pbkdf2.js +100 -0
- package/lib/module/pbkdf2.js.map +1 -0
- package/lib/module/prime.js +77 -0
- package/lib/module/prime.js.map +1 -0
- package/lib/module/random.js +284 -0
- package/lib/module/random.js.map +1 -0
- package/lib/module/rsa.js +205 -0
- package/lib/module/rsa.js.map +1 -0
- package/lib/module/scrypt.js +134 -0
- package/lib/module/scrypt.js.map +1 -0
- package/lib/module/slhdsa.js +64 -0
- package/lib/module/slhdsa.js.map +1 -0
- package/lib/module/specs/argon2.nitro.js +4 -0
- package/lib/module/specs/argon2.nitro.js.map +1 -0
- package/lib/module/specs/blake3.nitro.js +4 -0
- package/lib/module/specs/blake3.nitro.js.map +1 -0
- package/lib/module/specs/certificate.nitro.js +4 -0
- package/lib/module/specs/certificate.nitro.js.map +1 -0
- package/lib/module/specs/cipher.nitro.js +4 -0
- package/lib/module/specs/cipher.nitro.js.map +1 -0
- package/lib/module/specs/dhKeyPair.nitro.js +4 -0
- package/lib/module/specs/dhKeyPair.nitro.js.map +1 -0
- package/lib/module/specs/diffie-hellman.nitro.js +4 -0
- package/lib/module/specs/diffie-hellman.nitro.js.map +1 -0
- package/lib/module/specs/dsaKeyPair.nitro.js +4 -0
- package/lib/module/specs/dsaKeyPair.nitro.js.map +1 -0
- package/lib/module/specs/ecKeyPair.nitro.js +4 -0
- package/lib/module/specs/ecKeyPair.nitro.js.map +1 -0
- package/lib/module/specs/ecdh.nitro.js +4 -0
- package/lib/module/specs/ecdh.nitro.js.map +1 -0
- package/lib/module/specs/edKeyPair.nitro.js +4 -0
- package/lib/module/specs/edKeyPair.nitro.js.map +1 -0
- package/lib/module/specs/hash.nitro.js +4 -0
- package/lib/module/specs/hash.nitro.js.map +1 -0
- package/lib/module/specs/hkdf.nitro.js +4 -0
- package/lib/module/specs/hkdf.nitro.js.map +1 -0
- package/lib/module/specs/hmac.nitro.js +4 -0
- package/lib/module/specs/hmac.nitro.js.map +1 -0
- package/lib/module/specs/keyObjectHandle.nitro.js +4 -0
- package/lib/module/specs/keyObjectHandle.nitro.js.map +1 -0
- package/lib/module/specs/kmac.nitro.js +4 -0
- package/lib/module/specs/kmac.nitro.js.map +1 -0
- package/lib/module/specs/mlDsaKeyPair.nitro.js +4 -0
- package/lib/module/specs/mlDsaKeyPair.nitro.js.map +1 -0
- package/lib/module/specs/mlKemKeyPair.nitro.js +4 -0
- package/lib/module/specs/mlKemKeyPair.nitro.js.map +1 -0
- package/lib/module/specs/pbkdf2.nitro.js +4 -0
- package/lib/module/specs/pbkdf2.nitro.js.map +1 -0
- package/lib/module/specs/prime.nitro.js +4 -0
- package/lib/module/specs/prime.nitro.js.map +1 -0
- package/lib/module/specs/random.nitro.js +4 -0
- package/lib/module/specs/random.nitro.js.map +1 -0
- package/lib/module/specs/rsaCipher.nitro.js +4 -0
- package/lib/module/specs/rsaCipher.nitro.js.map +1 -0
- package/lib/module/specs/rsaKeyPair.nitro.js +4 -0
- package/lib/module/specs/rsaKeyPair.nitro.js.map +1 -0
- package/lib/module/specs/scrypt.nitro.js +4 -0
- package/lib/module/specs/scrypt.nitro.js.map +1 -0
- package/lib/module/specs/sign.nitro.js +4 -0
- package/lib/module/specs/sign.nitro.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/specs/utils.nitro.js +4 -0
- package/lib/module/specs/utils.nitro.js.map +1 -0
- package/lib/module/specs/x509certificate.nitro.js +4 -0
- package/lib/module/specs/x509certificate.nitro.js.map +1 -0
- package/lib/module/subtle.js +3205 -0
- package/lib/module/subtle.js.map +1 -0
- package/lib/module/utils/cipher.js +67 -0
- package/lib/module/utils/cipher.js.map +1 -0
- package/lib/module/utils/conversion.js +205 -0
- package/lib/module/utils/conversion.js.map +1 -0
- package/lib/module/utils/errors.js +67 -0
- package/lib/module/utils/errors.js.map +1 -0
- package/lib/module/utils/hashnames.js +120 -0
- package/lib/module/utils/hashnames.js.map +1 -0
- package/lib/module/utils/index.js +10 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/module/utils/noble.js +76 -0
- package/lib/module/utils/noble.js.map +1 -0
- package/lib/module/utils/timingSafeEqual.js +25 -0
- package/lib/module/utils/timingSafeEqual.js.map +1 -0
- package/lib/module/utils/types.js +57 -0
- package/lib/module/utils/types.js.map +1 -0
- package/lib/module/utils/validation.js +131 -0
- package/lib/module/utils/validation.js.map +1 -0
- package/lib/module/x509certificate.js +184 -0
- package/lib/module/x509certificate.js.map +1 -0
- package/lib/typescript/argon2.d.ts +16 -0
- package/lib/typescript/argon2.d.ts.map +1 -0
- package/lib/typescript/blake3.d.ts +33 -0
- package/lib/typescript/blake3.d.ts.map +1 -0
- package/lib/typescript/certificate.d.ts +8 -0
- package/lib/typescript/certificate.d.ts.map +1 -0
- package/lib/typescript/cipher.d.ts +75 -0
- package/lib/typescript/cipher.d.ts.map +1 -0
- package/lib/typescript/constants.d.ts +21 -0
- package/lib/typescript/constants.d.ts.map +1 -0
- package/lib/typescript/dh-groups.d.ts +5 -0
- package/lib/typescript/dh-groups.d.ts.map +1 -0
- package/lib/typescript/dhKeyPair.d.ts +19 -0
- package/lib/typescript/dhKeyPair.d.ts.map +1 -0
- package/lib/typescript/diffie-hellman.d.ts +18 -0
- package/lib/typescript/diffie-hellman.d.ts.map +1 -0
- package/lib/typescript/dsa.d.ts +19 -0
- package/lib/typescript/dsa.d.ts.map +1 -0
- package/lib/typescript/ec.d.ts +24 -0
- package/lib/typescript/ec.d.ts.map +1 -0
- package/lib/typescript/ecdh.d.ts +19 -0
- package/lib/typescript/ecdh.d.ts.map +1 -0
- package/lib/typescript/ed.d.ts +47 -0
- package/lib/typescript/ed.d.ts.map +1 -0
- package/lib/typescript/expo-plugin/@types.d.ts +8 -0
- package/lib/typescript/expo-plugin/@types.d.ts.map +1 -0
- package/lib/typescript/expo-plugin/withRNQC.d.ts +4 -0
- package/lib/typescript/expo-plugin/withRNQC.d.ts.map +1 -0
- package/lib/typescript/expo-plugin/withSodiumAndroid.d.ts +4 -0
- package/lib/typescript/expo-plugin/withSodiumAndroid.d.ts.map +1 -0
- package/lib/typescript/expo-plugin/withSodiumIos.d.ts +4 -0
- package/lib/typescript/expo-plugin/withSodiumIos.d.ts.map +1 -0
- package/lib/typescript/expo-plugin/withXCode.d.ts +23 -0
- package/lib/typescript/expo-plugin/withXCode.d.ts.map +1 -0
- package/lib/typescript/hash.d.ts +126 -0
- package/lib/typescript/hash.d.ts.map +1 -0
- package/lib/typescript/hkdf.d.ts +26 -0
- package/lib/typescript/hkdf.d.ts.map +1 -0
- package/lib/typescript/hmac.d.ts +66 -0
- package/lib/typescript/hmac.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +240 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/keys/classes.d.ts +95 -0
- package/lib/typescript/keys/classes.d.ts.map +1 -0
- package/lib/typescript/keys/generateKeyPair.d.ts +17 -0
- package/lib/typescript/keys/generateKeyPair.d.ts.map +1 -0
- package/lib/typescript/keys/index.d.ts +26 -0
- package/lib/typescript/keys/index.d.ts.map +1 -0
- package/lib/typescript/keys/publicCipher.d.ts +23 -0
- package/lib/typescript/keys/publicCipher.d.ts.map +1 -0
- package/lib/typescript/keys/signVerify.d.ts +35 -0
- package/lib/typescript/keys/signVerify.d.ts.map +1 -0
- package/lib/typescript/keys/utils.d.ts +51 -0
- package/lib/typescript/keys/utils.d.ts.map +1 -0
- package/lib/typescript/mldsa.d.ts +18 -0
- package/lib/typescript/mldsa.d.ts.map +1 -0
- package/lib/typescript/mlkem.d.ts +30 -0
- package/lib/typescript/mlkem.d.ts.map +1 -0
- package/lib/typescript/pbkdf2.d.ts +12 -0
- package/lib/typescript/pbkdf2.d.ts.map +1 -0
- package/lib/typescript/prime.d.ts +19 -0
- package/lib/typescript/prime.d.ts.map +1 -0
- package/lib/typescript/random.d.ts +31 -0
- package/lib/typescript/random.d.ts.map +1 -0
- package/lib/typescript/rsa.d.ts +20 -0
- package/lib/typescript/rsa.d.ts.map +1 -0
- package/lib/typescript/scrypt.d.ts +18 -0
- package/lib/typescript/scrypt.d.ts.map +1 -0
- package/lib/typescript/slhdsa.d.ts +19 -0
- package/lib/typescript/slhdsa.d.ts.map +1 -0
- package/lib/typescript/specs/argon2.nitro.d.ts +9 -0
- package/lib/typescript/specs/argon2.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/blake3.nitro.d.ts +15 -0
- package/lib/typescript/specs/blake3.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/certificate.nitro.d.ts +10 -0
- package/lib/typescript/specs/certificate.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/cipher.nitro.d.ts +38 -0
- package/lib/typescript/specs/cipher.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/dhKeyPair.nitro.d.ts +14 -0
- package/lib/typescript/specs/dhKeyPair.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/diffie-hellman.nitro.d.ts +18 -0
- package/lib/typescript/specs/diffie-hellman.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/dsaKeyPair.nitro.d.ts +13 -0
- package/lib/typescript/specs/dsaKeyPair.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/ecKeyPair.nitro.d.ts +21 -0
- package/lib/typescript/specs/ecKeyPair.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/ecdh.nitro.d.ts +15 -0
- package/lib/typescript/specs/ecdh.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/edKeyPair.nitro.d.ts +17 -0
- package/lib/typescript/specs/edKeyPair.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/hash.nitro.d.ts +13 -0
- package/lib/typescript/specs/hash.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/hkdf.nitro.d.ts +10 -0
- package/lib/typescript/specs/hkdf.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/hmac.nitro.d.ts +10 -0
- package/lib/typescript/specs/hmac.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/keyObjectHandle.nitro.d.ts +27 -0
- package/lib/typescript/specs/keyObjectHandle.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/kmac.nitro.d.ts +10 -0
- package/lib/typescript/specs/kmac.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/mlDsaKeyPair.nitro.d.ts +16 -0
- package/lib/typescript/specs/mlDsaKeyPair.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/mlKemKeyPair.nitro.d.ts +18 -0
- package/lib/typescript/specs/mlKemKeyPair.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/pbkdf2.nitro.d.ts +9 -0
- package/lib/typescript/specs/pbkdf2.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/prime.nitro.d.ts +11 -0
- package/lib/typescript/specs/prime.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/random.nitro.d.ts +9 -0
- package/lib/typescript/specs/random.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/rsaCipher.nitro.d.ts +54 -0
- package/lib/typescript/specs/rsaCipher.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/rsaKeyPair.nitro.d.ts +20 -0
- package/lib/typescript/specs/rsaKeyPair.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/scrypt.nitro.d.ts +9 -0
- package/lib/typescript/specs/scrypt.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/sign.nitro.d.ts +19 -0
- package/lib/typescript/specs/sign.nitro.d.ts.map +1 -0
- 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 +8 -0
- package/lib/typescript/specs/utils.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/x509certificate.nitro.d.ts +34 -0
- package/lib/typescript/specs/x509certificate.nitro.d.ts.map +1 -0
- package/lib/typescript/subtle.d.ts +33 -0
- package/lib/typescript/subtle.d.ts.map +1 -0
- package/lib/typescript/utils/cipher.d.ts +19 -0
- package/lib/typescript/utils/cipher.d.ts.map +1 -0
- package/lib/typescript/utils/conversion.d.ts +36 -0
- package/lib/typescript/utils/conversion.d.ts.map +1 -0
- package/lib/typescript/utils/errors.d.ts +19 -0
- package/lib/typescript/utils/errors.d.ts.map +1 -0
- package/lib/typescript/utils/hashnames.d.ts +13 -0
- package/lib/typescript/utils/hashnames.d.ts.map +1 -0
- package/lib/typescript/utils/index.d.ts +8 -0
- package/lib/typescript/utils/index.d.ts.map +1 -0
- package/lib/typescript/utils/noble.d.ts +19 -0
- package/lib/typescript/utils/noble.d.ts.map +1 -0
- package/lib/typescript/utils/timingSafeEqual.d.ts +3 -0
- package/lib/typescript/utils/timingSafeEqual.d.ts.map +1 -0
- package/lib/typescript/utils/types.d.ts +314 -0
- package/lib/typescript/utils/types.d.ts.map +1 -0
- package/lib/typescript/utils/validation.d.ts +15 -0
- package/lib/typescript/utils/validation.d.ts.map +1 -0
- package/lib/typescript/x509certificate.d.ts +64 -0
- package/lib/typescript/x509certificate.d.ts.map +1 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/QuickCrypto+autolinking.cmake +110 -0
- package/nitrogen/generated/android/QuickCrypto+autolinking.gradle +27 -0
- package/nitrogen/generated/android/QuickCryptoOnLoad.cpp +334 -0
- package/nitrogen/generated/android/QuickCryptoOnLoad.hpp +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/crypto/QuickCryptoOnLoad.kt +35 -0
- package/nitrogen/generated/ios/QuickCrypto+autolinking.rb +60 -0
- package/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Bridge.hpp +27 -0
- package/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Umbrella.hpp +38 -0
- package/nitrogen/generated/ios/QuickCryptoAutolinking.mm +325 -0
- package/nitrogen/generated/ios/QuickCryptoAutolinking.swift +16 -0
- package/nitrogen/generated/shared/c++/AsymmetricKeyType.hpp +176 -0
- package/nitrogen/generated/shared/c++/CipherArgs.hpp +101 -0
- package/nitrogen/generated/shared/c++/CipherInfo.hpp +104 -0
- package/nitrogen/generated/shared/c++/HkdfMode.hpp +80 -0
- package/nitrogen/generated/shared/c++/HybridArgon2Spec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridArgon2Spec.hpp +66 -0
- package/nitrogen/generated/shared/c++/HybridBlake3Spec.cpp +28 -0
- package/nitrogen/generated/shared/c++/HybridBlake3Spec.hpp +74 -0
- package/nitrogen/generated/shared/c++/HybridCertificateSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridCertificateSpec.hpp +64 -0
- package/nitrogen/generated/shared/c++/HybridCipherFactorySpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridCipherFactorySpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/HybridCipherSpec.cpp +29 -0
- package/nitrogen/generated/shared/c++/HybridCipherSpec.hpp +78 -0
- package/nitrogen/generated/shared/c++/HybridDhKeyPairSpec.cpp +27 -0
- package/nitrogen/generated/shared/c++/HybridDhKeyPairSpec.hpp +69 -0
- package/nitrogen/generated/shared/c++/HybridDiffieHellmanSpec.cpp +31 -0
- package/nitrogen/generated/shared/c++/HybridDiffieHellmanSpec.hpp +72 -0
- package/nitrogen/generated/shared/c++/HybridDsaKeyPairSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridDsaKeyPairSpec.hpp +68 -0
- package/nitrogen/generated/shared/c++/HybridECDHSpec.cpp +28 -0
- package/nitrogen/generated/shared/c++/HybridECDHSpec.hpp +70 -0
- package/nitrogen/generated/shared/c++/HybridEcKeyPairSpec.cpp +30 -0
- package/nitrogen/generated/shared/c++/HybridEcKeyPairSpec.hpp +76 -0
- package/nitrogen/generated/shared/c++/HybridEdKeyPairSpec.cpp +30 -0
- package/nitrogen/generated/shared/c++/HybridEdKeyPairSpec.hpp +74 -0
- package/nitrogen/generated/shared/c++/HybridHashSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridHashSpec.hpp +74 -0
- package/nitrogen/generated/shared/c++/HybridHkdfSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridHkdfSpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/HybridHmacSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridHmacSpec.hpp +66 -0
- package/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.cpp +39 -0
- package/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.hpp +107 -0
- package/nitrogen/generated/shared/c++/HybridKmacSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridKmacSpec.hpp +66 -0
- package/nitrogen/generated/shared/c++/HybridMlDsaKeyPairSpec.cpp +29 -0
- package/nitrogen/generated/shared/c++/HybridMlDsaKeyPairSpec.hpp +72 -0
- package/nitrogen/generated/shared/c++/HybridMlKemKeyPairSpec.cpp +31 -0
- package/nitrogen/generated/shared/c++/HybridMlKemKeyPairSpec.hpp +74 -0
- package/nitrogen/generated/shared/c++/HybridPbkdf2Spec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridPbkdf2Spec.hpp +65 -0
- package/nitrogen/generated/shared/c++/HybridPrimeSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridPrimeSpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/HybridRandomSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridRandomSpec.hpp +64 -0
- package/nitrogen/generated/shared/c++/HybridRsaCipherSpec.cpp +25 -0
- package/nitrogen/generated/shared/c++/HybridRsaCipherSpec.hpp +71 -0
- package/nitrogen/generated/shared/c++/HybridRsaKeyPairSpec.cpp +29 -0
- package/nitrogen/generated/shared/c++/HybridRsaKeyPairSpec.hpp +75 -0
- package/nitrogen/generated/shared/c++/HybridScryptSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridScryptSpec.hpp +64 -0
- package/nitrogen/generated/shared/c++/HybridSignHandleSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridSignHandleSpec.hpp +69 -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 +21 -0
- package/nitrogen/generated/shared/c++/HybridUtilsSpec.hpp +62 -0
- package/nitrogen/generated/shared/c++/HybridVerifyHandleSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridVerifyHandleSpec.hpp +69 -0
- package/nitrogen/generated/shared/c++/HybridX509CertificateHandleSpec.cpp +46 -0
- package/nitrogen/generated/shared/c++/HybridX509CertificateHandleSpec.hpp +96 -0
- package/nitrogen/generated/shared/c++/JWK.hpp +185 -0
- package/nitrogen/generated/shared/c++/JWKkty.hpp +92 -0
- package/nitrogen/generated/shared/c++/JWKuse.hpp +76 -0
- package/nitrogen/generated/shared/c++/KFormatType.hpp +63 -0
- package/nitrogen/generated/shared/c++/KangarooTwelveVariant.hpp +76 -0
- package/nitrogen/generated/shared/c++/KeyDetail.hpp +108 -0
- package/nitrogen/generated/shared/c++/KeyEncoding.hpp +64 -0
- package/nitrogen/generated/shared/c++/KeyObject.hpp +83 -0
- package/nitrogen/generated/shared/c++/KeyType.hpp +63 -0
- package/nitrogen/generated/shared/c++/KeyUsage.hpp +116 -0
- package/nitrogen/generated/shared/c++/NamedCurve.hpp +80 -0
- package/nitrogen/generated/shared/c++/TurboShakeVariant.hpp +76 -0
- package/ohos/binding.gyp +33 -0
- package/ohos/build/Release/quick_crypto.node +0 -0
- package/ohos/quick_crypto_napi.cpp +1316 -0
- package/package.json +158 -4
- package/src/argon2.ts +161 -0
- package/src/blake3.ts +124 -0
- package/src/certificate.ts +41 -0
- package/src/cipher.ts +497 -0
- package/src/constants.ts +32 -0
- package/src/dh-groups.ts +27 -0
- package/src/dhKeyPair.ts +164 -0
- package/src/diffie-hellman.ts +195 -0
- package/src/dsa.ts +146 -0
- package/src/ec.ts +580 -0
- package/src/ecdh.ts +132 -0
- package/src/ed.ts +605 -0
- package/src/expo-plugin/@types.ts +7 -0
- package/src/expo-plugin/withRNQC.ts +23 -0
- package/src/expo-plugin/withSodiumAndroid.ts +24 -0
- package/src/expo-plugin/withSodiumIos.ts +25 -0
- package/src/expo-plugin/withXCode.ts +134 -0
- package/src/hash.ts +433 -0
- package/src/hkdf.ts +327 -0
- package/src/hmac.ts +150 -0
- package/src/index.ts +126 -0
- package/src/keys/classes.ts +369 -0
- package/src/keys/generateKeyPair.ts +358 -0
- package/src/keys/index.ts +383 -0
- package/src/keys/publicCipher.ts +256 -0
- package/src/keys/signVerify.ts +329 -0
- package/src/keys/utils.ts +263 -0
- package/src/mldsa.ts +125 -0
- package/src/mlkem.ts +350 -0
- package/src/pbkdf2.ts +183 -0
- package/src/prime.ts +134 -0
- package/src/random.ts +427 -0
- package/src/rsa.ts +333 -0
- package/src/scrypt.ts +201 -0
- package/src/slhdsa.ts +146 -0
- package/src/specs/argon2.nitro.ts +29 -0
- package/src/specs/blake3.nitro.ts +12 -0
- package/src/specs/certificate.nitro.ts +8 -0
- package/src/specs/cipher.nitro.ts +39 -0
- package/src/specs/dhKeyPair.nitro.ts +14 -0
- package/src/specs/diffie-hellman.nitro.ts +16 -0
- package/src/specs/dsaKeyPair.nitro.ts +13 -0
- package/src/specs/ecKeyPair.nitro.ts +40 -0
- package/src/specs/ecdh.nitro.ts +12 -0
- package/src/specs/edKeyPair.nitro.ts +43 -0
- package/src/specs/hash.nitro.ts +10 -0
- package/src/specs/hkdf.nitro.ts +25 -0
- package/src/specs/hmac.nitro.ts +7 -0
- package/src/specs/keyObjectHandle.nitro.ts +56 -0
- package/src/specs/kmac.nitro.ts +12 -0
- package/src/specs/mlDsaKeyPair.nitro.ts +29 -0
- package/src/specs/mlKemKeyPair.nitro.ts +32 -0
- package/src/specs/pbkdf2.nitro.ts +18 -0
- package/src/specs/prime.nitro.ts +18 -0
- package/src/specs/random.nitro.ts +14 -0
- package/src/specs/rsaCipher.nitro.ts +82 -0
- package/src/specs/rsaKeyPair.nitro.ts +33 -0
- package/src/specs/scrypt.nitro.ts +23 -0
- package/src/specs/sign.nitro.ts +31 -0
- package/src/specs/slhDsaKeyPair.nitro.ts +29 -0
- package/src/specs/turboshake.nitro.ts +21 -0
- package/src/specs/utils.nitro.ts +5 -0
- package/src/specs/x509certificate.nitro.ts +38 -0
- package/src/subtle.ts +4545 -0
- package/src/utils/cipher.ts +82 -0
- package/src/utils/conversion.ts +285 -0
- package/src/utils/errors.ts +83 -0
- package/src/utils/hashnames.ts +129 -0
- package/src/utils/index.ts +7 -0
- package/src/utils/noble.ts +85 -0
- package/src/utils/timingSafeEqual.ts +28 -0
- package/src/utils/types.ts +617 -0
- package/src/utils/validation.ts +199 -0
- package/src/x509certificate.ts +276 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
4
|
+
import { Buffer } from '@craftzdog/react-native-buffer';
|
|
5
|
+
import { binaryLikeToArrayBuffer } from './utils';
|
|
6
|
+
let native;
|
|
7
|
+
function getNative() {
|
|
8
|
+
if (native == null) {
|
|
9
|
+
native = NitroModules.createHybridObject('Prime');
|
|
10
|
+
}
|
|
11
|
+
return native;
|
|
12
|
+
}
|
|
13
|
+
function toOptionalArrayBuffer(value) {
|
|
14
|
+
if (value == null) return undefined;
|
|
15
|
+
if (value instanceof ArrayBuffer) return value;
|
|
16
|
+
return binaryLikeToArrayBuffer(value);
|
|
17
|
+
}
|
|
18
|
+
function bufferToBigInt(buf) {
|
|
19
|
+
let result = 0n;
|
|
20
|
+
for (let i = 0; i < buf.length; i++) {
|
|
21
|
+
result = result << 8n | BigInt(buf[i]);
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
function bigIntToBuffer(value) {
|
|
26
|
+
if (value === 0n) return new Uint8Array([0]).buffer;
|
|
27
|
+
const hex = value.toString(16);
|
|
28
|
+
const paddedHex = hex.length % 2 ? '0' + hex : hex;
|
|
29
|
+
const bytes = new Uint8Array(paddedHex.length / 2);
|
|
30
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
31
|
+
bytes[i] = parseInt(paddedHex.substring(i * 2, i * 2 + 2), 16);
|
|
32
|
+
}
|
|
33
|
+
return bytes.buffer;
|
|
34
|
+
}
|
|
35
|
+
export function generatePrimeSync(size, options) {
|
|
36
|
+
const safe = options?.safe ?? false;
|
|
37
|
+
const add = toOptionalArrayBuffer(options?.add);
|
|
38
|
+
const rem = toOptionalArrayBuffer(options?.rem);
|
|
39
|
+
const result = Buffer.from(getNative().generatePrimeSync(size, safe, add, rem));
|
|
40
|
+
if (options?.bigint) {
|
|
41
|
+
return bufferToBigInt(result);
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
export function generatePrime(size, options, callback) {
|
|
46
|
+
if (typeof options === 'function') {
|
|
47
|
+
callback = options;
|
|
48
|
+
options = {};
|
|
49
|
+
}
|
|
50
|
+
const safe = options?.safe ?? false;
|
|
51
|
+
const add = toOptionalArrayBuffer(options?.add);
|
|
52
|
+
const rem = toOptionalArrayBuffer(options?.rem);
|
|
53
|
+
const wantBigint = options?.bigint ?? false;
|
|
54
|
+
getNative().generatePrime(size, safe, add, rem).then(ab => {
|
|
55
|
+
const result = Buffer.from(ab);
|
|
56
|
+
if (wantBigint) {
|
|
57
|
+
callback?.(null, bufferToBigInt(result));
|
|
58
|
+
} else {
|
|
59
|
+
callback?.(null, result);
|
|
60
|
+
}
|
|
61
|
+
}).catch(err => callback?.(err, Buffer.alloc(0)));
|
|
62
|
+
}
|
|
63
|
+
export function checkPrimeSync(candidate, options) {
|
|
64
|
+
const checks = options?.checks ?? 0;
|
|
65
|
+
const buf = typeof candidate === 'bigint' ? bigIntToBuffer(candidate) : binaryLikeToArrayBuffer(candidate);
|
|
66
|
+
return getNative().checkPrimeSync(buf, checks);
|
|
67
|
+
}
|
|
68
|
+
export function checkPrime(candidate, options, callback) {
|
|
69
|
+
if (typeof options === 'function') {
|
|
70
|
+
callback = options;
|
|
71
|
+
options = {};
|
|
72
|
+
}
|
|
73
|
+
const checks = options.checks ?? 0;
|
|
74
|
+
const buf = typeof candidate === 'bigint' ? bigIntToBuffer(candidate) : binaryLikeToArrayBuffer(candidate);
|
|
75
|
+
getNative().checkPrime(buf, checks).then(result => callback?.(null, result)).catch(err => callback?.(err, false));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=prime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NitroModules","Buffer","binaryLikeToArrayBuffer","native","getNative","createHybridObject","toOptionalArrayBuffer","value","undefined","ArrayBuffer","bufferToBigInt","buf","result","i","length","BigInt","bigIntToBuffer","Uint8Array","buffer","hex","toString","paddedHex","bytes","parseInt","substring","generatePrimeSync","size","options","safe","add","rem","from","bigint","generatePrime","callback","wantBigint","then","ab","catch","err","alloc","checkPrimeSync","candidate","checks","checkPrime"],"sourceRoot":"../../src","sources":["prime.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AACzD,SAASC,MAAM,QAAQ,gCAAgC;AAGvD,SAASC,uBAAuB,QAAQ,SAAS;AAEjD,IAAIC,MAAmB;AACvB,SAASC,SAASA,CAAA,EAAgB;EAChC,IAAID,MAAM,IAAI,IAAI,EAAE;IAClBA,MAAM,GAAGH,YAAY,CAACK,kBAAkB,CAAc,OAAO,CAAC;EAChE;EACA,OAAOF,MAAM;AACf;AAaA,SAASG,qBAAqBA,CAC5BC,KAAyC,EAChB;EACzB,IAAIA,KAAK,IAAI,IAAI,EAAE,OAAOC,SAAS;EACnC,IAAID,KAAK,YAAYE,WAAW,EAAE,OAAOF,KAAK;EAC9C,OAAOL,uBAAuB,CAACK,KAAK,CAAC;AACvC;AAEA,SAASG,cAAcA,CAACC,GAAW,EAAU;EAC3C,IAAIC,MAAM,GAAG,EAAE;EACf,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,GAAG,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;IACnCD,MAAM,GAAIA,MAAM,IAAI,EAAE,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SAAS,CAAC,CAAC,CAACqC,cAAc,CAAC9B,GAAG,EAAEgC,MAAM,CAAC;AAChD;AAIA,OAAO,SAASC,UAAUA,CACxBF,SAA8B,EAC9Bf,OAA+C,EAC/CO,QAA6B,EACvB;EACN,IAAI,OAAOP,OAAO,KAAK,UAAU,EAAE;IACjCO,QAAQ,GAAGP,OAAO;IAClBA,OAAO,GAAG,CAAC,CAAC;EACd;EACA,MAAMgB,MAAM,GAAGhB,OAAO,CAACgB,MAAM,IAAI,CAAC;EAClC,MAAMhC,GAAG,GACP,OAAO+B,SAAS,KAAK,QAAQ,GACzB1B,cAAc,CAAC0B,SAAS,CAAC,GACzBxC,uBAAuB,CAACwC,SAAS,CAAC;EAExCtC,SAAS,CAAC,CAAC,CACRwC,UAAU,CAACjC,GAAG,EAAEgC,MAAM,CAAC,CACvBP,IAAI,CAACxB,MAAM,IAAIsB,QAAQ,GAAG,IAAI,EAAEtB,MAAM,CAAC,CAAC,CACxC0B,KAAK,CAAEC,GAAU,IAAKL,QAAQ,GAAGK,GAAG,EAAE,KAAK,CAAC,CAAC;AAClD","ignoreList":[]}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Buffer } from '@craftzdog/react-native-buffer';
|
|
4
|
+
import { abvToArrayBuffer, lazyDOMException, QuotaExceededError, rejectSharedArrayBuffer } from './utils';
|
|
5
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
6
|
+
// to use native bits in sub-functions, use getNative(). don't call it at top-level!
|
|
7
|
+
let random;
|
|
8
|
+
function getNative() {
|
|
9
|
+
if (random == null) {
|
|
10
|
+
// lazy-load the Nitro HybridObject
|
|
11
|
+
random = NitroModules.createHybridObject('Random');
|
|
12
|
+
}
|
|
13
|
+
return random;
|
|
14
|
+
}
|
|
15
|
+
export function randomFill(buffer, ...rest) {
|
|
16
|
+
if (typeof rest[rest.length - 1] !== 'function') {
|
|
17
|
+
throw new Error('No callback provided to randomFill');
|
|
18
|
+
}
|
|
19
|
+
const callback = rest[rest.length - 1];
|
|
20
|
+
const viewOffset = ArrayBuffer.isView(buffer) ? buffer.byteOffset : 0;
|
|
21
|
+
const viewLength = buffer.byteLength;
|
|
22
|
+
let offset = 0;
|
|
23
|
+
let size = viewLength;
|
|
24
|
+
if (typeof rest[2] === 'function') {
|
|
25
|
+
offset = rest[0];
|
|
26
|
+
size = rest[1];
|
|
27
|
+
}
|
|
28
|
+
if (typeof rest[1] === 'function') {
|
|
29
|
+
offset = rest[0];
|
|
30
|
+
size = viewLength - offset;
|
|
31
|
+
}
|
|
32
|
+
getNative();
|
|
33
|
+
const ab = abvToArrayBuffer(buffer);
|
|
34
|
+
const start = viewOffset + offset;
|
|
35
|
+
random.randomFill(ab, start, size).then(res => {
|
|
36
|
+
// The native async path operates on a copy of the underlying buffer to
|
|
37
|
+
// avoid races with JS-owned memory on the worker thread, so the
|
|
38
|
+
// randomized bytes live in `res`, not in the caller's buffer. Copy them
|
|
39
|
+
// back to preserve Node's in-place randomFill semantics.
|
|
40
|
+
if (res !== ab) {
|
|
41
|
+
new Uint8Array(ab, start, size).set(new Uint8Array(res, start, size));
|
|
42
|
+
}
|
|
43
|
+
callback(null, res);
|
|
44
|
+
}, e => {
|
|
45
|
+
callback(e);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export function randomFillSync(buffer, offset = 0, size) {
|
|
49
|
+
getNative();
|
|
50
|
+
const viewOffset = ArrayBuffer.isView(buffer) ? buffer.byteOffset : 0;
|
|
51
|
+
const viewLength = buffer.byteLength;
|
|
52
|
+
const arrayBuffer = abvToArrayBuffer(buffer);
|
|
53
|
+
random.randomFillSync(arrayBuffer, viewOffset + offset, size ?? viewLength - offset);
|
|
54
|
+
return buffer;
|
|
55
|
+
}
|
|
56
|
+
export function randomBytes(size, callback) {
|
|
57
|
+
const buf = new Buffer(size);
|
|
58
|
+
if (callback === undefined) {
|
|
59
|
+
randomFillSync(buf.buffer, 0, size);
|
|
60
|
+
return buf;
|
|
61
|
+
}
|
|
62
|
+
randomFill(buf.buffer, 0, size, (error, res) => {
|
|
63
|
+
if (error) {
|
|
64
|
+
callback(error);
|
|
65
|
+
}
|
|
66
|
+
callback(null, Buffer.from(res));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export const rng = randomBytes;
|
|
70
|
+
export const pseudoRandomBytes = randomBytes;
|
|
71
|
+
export const prng = randomBytes;
|
|
72
|
+
// The rest of the file is taken from https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js
|
|
73
|
+
|
|
74
|
+
// Largest integer we can read from a buffer.
|
|
75
|
+
// e.g.: Buffer.from("ff".repeat(6), "hex").readUIntBE(0, 6);
|
|
76
|
+
const RAND_MAX = 0xffffffffffff;
|
|
77
|
+
|
|
78
|
+
// Cache random data to use in randomInt. The cache size must be evenly
|
|
79
|
+
// divisible by 6 because each attempt to obtain a random int uses 6 bytes.
|
|
80
|
+
let randomCache = new Buffer(6 * 1024);
|
|
81
|
+
let randomCacheOffset = randomCache.length;
|
|
82
|
+
let asyncCacheFillInProgress = false;
|
|
83
|
+
const asyncCachePendingTasks = [];
|
|
84
|
+
|
|
85
|
+
// Generates an integer in [min, max) range where min is inclusive and max is
|
|
86
|
+
// exclusive.
|
|
87
|
+
|
|
88
|
+
export function randomInt(arg1, arg2, callback) {
|
|
89
|
+
// Detect optional min syntax
|
|
90
|
+
// randomInt(max)
|
|
91
|
+
// randomInt(max, callback)
|
|
92
|
+
let max;
|
|
93
|
+
let min;
|
|
94
|
+
const minNotSpecified = typeof arg2 === 'undefined' || typeof arg2 === 'function';
|
|
95
|
+
if (minNotSpecified) {
|
|
96
|
+
callback = arg2;
|
|
97
|
+
max = arg1;
|
|
98
|
+
min = 0;
|
|
99
|
+
} else {
|
|
100
|
+
min = arg1;
|
|
101
|
+
max = arg2;
|
|
102
|
+
}
|
|
103
|
+
if (typeof callback !== 'undefined' && typeof callback !== 'function') {
|
|
104
|
+
throw new TypeError('callback must be a function or undefined');
|
|
105
|
+
}
|
|
106
|
+
const isSync = typeof callback === 'undefined';
|
|
107
|
+
if (!Number.isSafeInteger(min)) {
|
|
108
|
+
// todo throw new ERR_INVALID_ARG_TYPE('min', 'a safe integer', min);
|
|
109
|
+
throw 'ERR_INVALID_ARG_TYPE';
|
|
110
|
+
}
|
|
111
|
+
if (!Number.isSafeInteger(max)) {
|
|
112
|
+
// todo throw new ERR_INVALID_ARG_TYPE('max', 'a safe integer', max);
|
|
113
|
+
throw 'ERR_INVALID_ARG_TYPE';
|
|
114
|
+
}
|
|
115
|
+
if (max <= min) {
|
|
116
|
+
/* todo throw new ERR_OUT_OF_RANGE(
|
|
117
|
+
'max',
|
|
118
|
+
`greater than the value of "min" (${min})`,
|
|
119
|
+
max
|
|
120
|
+
);*/
|
|
121
|
+
throw 'ERR_OUT_OF_RANGE';
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// First we generate a random int between [0..range)
|
|
125
|
+
const range = max - min;
|
|
126
|
+
if (!(range <= RAND_MAX)) {
|
|
127
|
+
/* todo throw new ERR_OUT_OF_RANGE(
|
|
128
|
+
`max${minNotSpecified ? '' : ' - min'}`,
|
|
129
|
+
`<= ${RAND_MAX}`,
|
|
130
|
+
range
|
|
131
|
+
);*/
|
|
132
|
+
throw 'ERR_OUT_OF_RANGE';
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// For (x % range) to produce an unbiased value greater than or equal to 0 and
|
|
136
|
+
// less than range, x must be drawn randomly from the set of integers greater
|
|
137
|
+
// than or equal to 0 and less than randLimit.
|
|
138
|
+
const randLimit = RAND_MAX - RAND_MAX % range;
|
|
139
|
+
|
|
140
|
+
// If we don't have a callback, or if there is still data in the cache, we can
|
|
141
|
+
// do this synchronously, which is super fast.
|
|
142
|
+
while (isSync || randomCacheOffset < randomCache.length) {
|
|
143
|
+
if (randomCacheOffset === randomCache.length) {
|
|
144
|
+
// This might block the thread for a bit, but we are in sync mode.
|
|
145
|
+
randomFillSync(randomCache);
|
|
146
|
+
randomCacheOffset = 0;
|
|
147
|
+
}
|
|
148
|
+
const x = randomCache.readUIntBE(randomCacheOffset, 6);
|
|
149
|
+
randomCacheOffset += 6;
|
|
150
|
+
if (x < randLimit) {
|
|
151
|
+
const n = x % range + min;
|
|
152
|
+
if (isSync) return n;
|
|
153
|
+
process.nextTick(callback, null, n);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// At this point, we are in async mode with no data in the cache. We cannot
|
|
159
|
+
// simply refill the cache, because another async call to randomInt might
|
|
160
|
+
// already be doing that. Instead, queue this call for when the cache has
|
|
161
|
+
// been refilled.
|
|
162
|
+
if (callback !== undefined) {
|
|
163
|
+
// it is (typescript doesn't know it)
|
|
164
|
+
asyncCachePendingTasks.push({
|
|
165
|
+
min,
|
|
166
|
+
max,
|
|
167
|
+
callback
|
|
168
|
+
});
|
|
169
|
+
asyncRefillRandomIntCache();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function asyncRefillRandomIntCache() {
|
|
173
|
+
if (asyncCacheFillInProgress) return;
|
|
174
|
+
asyncCacheFillInProgress = true;
|
|
175
|
+
randomFill(randomCache, (err, res) => {
|
|
176
|
+
asyncCacheFillInProgress = false;
|
|
177
|
+
const tasks = asyncCachePendingTasks;
|
|
178
|
+
const errorReceiver = err && tasks.shift();
|
|
179
|
+
if (!err) {
|
|
180
|
+
randomCache = Buffer.from(res);
|
|
181
|
+
randomCacheOffset = 0;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Restart all pending tasks. If an error occurred, we only notify a single
|
|
185
|
+
// callback (errorReceiver) about it. This way, every async call to
|
|
186
|
+
// randomInt has a chance of being successful, and it avoids complex
|
|
187
|
+
// exception handling here.
|
|
188
|
+
tasks.splice(0).forEach(task => {
|
|
189
|
+
randomInt(task.min, task.max, task.callback);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// This is the only call that might throw, and is therefore done at the end.
|
|
193
|
+
if (errorReceiver) errorReceiver.callback(err, 0);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// to require('crypto').randomFillSync() with an
|
|
198
|
+
// additional limitation that the input buffer is
|
|
199
|
+
// not allowed to exceed 65536 bytes, and can only
|
|
200
|
+
// be an integer-type TypedArray.
|
|
201
|
+
|
|
202
|
+
// WebCrypto §getRandomValues only accepts integer-typed views. Float and
|
|
203
|
+
// non-TypedArray ABVs (DataView) must be rejected with a TypeMismatchError
|
|
204
|
+
// DOMException — see https://w3c.github.io/webcrypto/#Crypto-method-getRandomValues
|
|
205
|
+
const INTEGER_TYPED_ARRAY_TAGS = new Set(['Int8Array', 'Int16Array', 'Int32Array', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'BigInt64Array', 'BigUint64Array']);
|
|
206
|
+
function isIntegerTypedArray(value) {
|
|
207
|
+
if (!ArrayBuffer.isView(value)) return false;
|
|
208
|
+
const tag = value[Symbol.toStringTag];
|
|
209
|
+
return tag !== undefined && INTEGER_TYPED_ARRAY_TAGS.has(tag);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Fills the provided typed array with cryptographically strong random values.
|
|
214
|
+
*
|
|
215
|
+
* @param data The data to fill with random values
|
|
216
|
+
* @returns The filled data
|
|
217
|
+
*/
|
|
218
|
+
export function getRandomValues(data) {
|
|
219
|
+
// WebIDL BufferSource conversion (TypeError) must run before the
|
|
220
|
+
// WebCrypto-specific integer-type / size checks (TypeMismatchError /
|
|
221
|
+
// QuotaExceededError). `randomFillSync` below also rejects SAB via
|
|
222
|
+
// `abvToArrayBuffer`, but by then we'd already have thrown the wrong
|
|
223
|
+
// error type for a non-integer SAB-view, so the explicit early call is
|
|
224
|
+
// load-bearing for spec compliance — not redundant.
|
|
225
|
+
rejectSharedArrayBuffer(data);
|
|
226
|
+
if (!isIntegerTypedArray(data)) {
|
|
227
|
+
throw lazyDOMException('The data argument must be an integer-type TypedArray', 'TypeMismatchError');
|
|
228
|
+
}
|
|
229
|
+
if (data.byteLength > 65536) {
|
|
230
|
+
throw new QuotaExceededError('The requested length exceeds 65,536 bytes', {
|
|
231
|
+
quota: 65536,
|
|
232
|
+
requested: data.byteLength
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
randomFillSync(data, 0);
|
|
236
|
+
return data;
|
|
237
|
+
}
|
|
238
|
+
const byteToHex = [];
|
|
239
|
+
for (let i = 0; i < 256; ++i) {
|
|
240
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
241
|
+
}
|
|
242
|
+
function validateRandomUUIDOptions(options) {
|
|
243
|
+
if (options === undefined) return;
|
|
244
|
+
if (typeof options !== 'object' || options === null) {
|
|
245
|
+
throw new TypeError('options must be an object');
|
|
246
|
+
}
|
|
247
|
+
if (options.disableEntropyCache !== undefined && typeof options.disableEntropyCache !== 'boolean') {
|
|
248
|
+
throw new TypeError('options.disableEntropyCache must be a boolean');
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// RFC 9562 variant 10xx is shared by v4 and v7.
|
|
253
|
+
function serializeUUID(buffer, version) {
|
|
254
|
+
buffer[6] = buffer[6] & 0x0f | version << 4;
|
|
255
|
+
buffer[8] = buffer[8] & 0x3f | 0x80;
|
|
256
|
+
return (byteToHex[buffer[0]] + byteToHex[buffer[1]] + byteToHex[buffer[2]] + byteToHex[buffer[3]] + '-' + byteToHex[buffer[4]] + byteToHex[buffer[5]] + '-' + byteToHex[buffer[6]] + byteToHex[buffer[7]] + '-' + byteToHex[buffer[8]] + byteToHex[buffer[9]] + '-' + byteToHex[buffer[10]] + byteToHex[buffer[11]] + byteToHex[buffer[12]] + byteToHex[buffer[13]] + byteToHex[buffer[14]] + byteToHex[buffer[15]]).toLowerCase();
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// RFC 9562 §5.4 — random UUID (v4).
|
|
260
|
+
export function randomUUID(options) {
|
|
261
|
+
validateRandomUUIDOptions(options);
|
|
262
|
+
const buffer = new Buffer(16);
|
|
263
|
+
randomFillSync(buffer, 0, 16);
|
|
264
|
+
return serializeUUID(buffer, 4);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// RFC 9562 §5.7 — Unix-ms timestamped UUID (v7).
|
|
268
|
+
// Layout: 48-bit big-endian Unix-ms timestamp | 4-bit version (7) |
|
|
269
|
+
// 12 bits random | 2-bit variant (10) | 62 bits random.
|
|
270
|
+
export function randomUUIDv7(options) {
|
|
271
|
+
validateRandomUUIDOptions(options);
|
|
272
|
+
const buffer = new Buffer(16);
|
|
273
|
+
randomFillSync(buffer, 6, 10);
|
|
274
|
+
const now = Date.now();
|
|
275
|
+
const msb = Math.floor(now / 0x100000000);
|
|
276
|
+
buffer[0] = msb >>> 8 & 0xff;
|
|
277
|
+
buffer[1] = msb & 0xff;
|
|
278
|
+
buffer[2] = now >>> 24 & 0xff;
|
|
279
|
+
buffer[3] = now >>> 16 & 0xff;
|
|
280
|
+
buffer[4] = now >>> 8 & 0xff;
|
|
281
|
+
buffer[5] = now & 0xff;
|
|
282
|
+
return serializeUUID(buffer, 7);
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=random.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Buffer","abvToArrayBuffer","lazyDOMException","QuotaExceededError","rejectSharedArrayBuffer","NitroModules","random","getNative","createHybridObject","randomFill","buffer","rest","length","Error","callback","viewOffset","ArrayBuffer","isView","byteOffset","viewLength","byteLength","offset","size","ab","start","then","res","Uint8Array","set","e","randomFillSync","arrayBuffer","randomBytes","buf","undefined","error","from","rng","pseudoRandomBytes","prng","RAND_MAX","randomCache","randomCacheOffset","asyncCacheFillInProgress","asyncCachePendingTasks","randomInt","arg1","arg2","max","min","minNotSpecified","TypeError","isSync","Number","isSafeInteger","range","randLimit","x","readUIntBE","n","process","nextTick","push","asyncRefillRandomIntCache","err","tasks","errorReceiver","shift","splice","forEach","task","INTEGER_TYPED_ARRAY_TAGS","Set","isIntegerTypedArray","value","tag","Symbol","toStringTag","has","getRandomValues","data","quota","requested","byteToHex","i","toString","slice","validateRandomUUIDOptions","options","disableEntropyCache","serializeUUID","version","toLowerCase","randomUUID","randomUUIDv7","now","Date","msb","Math","floor"],"sourceRoot":"../../src","sources":["random.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,gCAAgC;AAEvD,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,kBAAkB,EAClBC,uBAAuB,QAClB,SAAS;AAChB,SAASC,YAAY,QAAQ,4BAA4B;AAGzD;AACA,IAAIC,MAAc;AAClB,SAASC,SAASA,CAAA,EAAW;EAC3B,IAAID,MAAM,IAAI,IAAI,EAAE;IAClB;IACAA,MAAM,GAAGD,YAAY,CAACG,kBAAkB,CAAS,QAAQ,CAAC;EAC5D;EACA,OAAOF,MAAM;AACf;AAoBA,OAAO,SAASG,UAAUA,CAACC,MAAW,EAAE,GAAGC,IAAe,EAAQ;EAChE,IAAI,OAAOA,IAAI,CAACA,IAAI,CAACC,MAAM,GAAG,CAAC,CAAC,KAAK,UAAU,EAAE;IAC/C,MAAM,IAAIC,KAAK,CAAC,oCAAoC,CAAC;EACvD;EAEA,MAAMC,QAAQ,GAAGH,IAAI,CAACA,IAAI,CAACC,MAAM,GAAG,CAAC,CAG5B;EAET,MAAMG,UAAU,GAAGC,WAAW,CAACC,MAAM,CAACP,MAAM,CAAC,GAAGA,MAAM,CAACQ,UAAU,GAAG,CAAC;EACrE,MAAMC,UAAU,GAAGT,MAAM,CAACU,UAAU;EAEpC,IAAIC,MAAc,GAAG,CAAC;EACtB,IAAIC,IAAY,GAAGH,UAAU;EAE7B,IAAI,OAAOR,IAAI,CAAC,CAAC,CAAC,KAAK,UAAU,EAAE;IACjCU,MAAM,GAAGV,IAAI,CAAC,CAAC,CAAW;IAC1BW,IAAI,GAAGX,IAAI,CAAC,CAAC,CAAW;EAC1B;EAEA,IAAI,OAAOA,IAAI,CAA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OAAO,SAASC,UAAUA,CAACL,OAA2B,EAAU;EAC9DD,yBAAyB,CAACC,OAAO,CAAC;EAClC,MAAM9E,MAAM,GAAG,IAAIV,MAAM,CAAC,EAAE,CAAC;EAC7B8B,cAAc,CAACpB,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;EAC7B,OAAOgF,aAAa,CAAChF,MAAM,EAAE,CAAC,CAAC;AACjC;;AAEA;AACA;AACA;AACA,OAAO,SAASoF,YAAYA,CAACN,OAA2B,EAAU;EAChED,yBAAyB,CAACC,OAAO,CAAC;EAClC,MAAM9E,MAAM,GAAG,IAAIV,MAAM,CAAC,EAAE,CAAC;EAC7B8B,cAAc,CAACpB,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;EAE7B,MAAMqF,GAAG,GAAGC,IAAI,CAACD,GAAG,CAAC,CAAC;EACtB,MAAME,GAAG,GAAGC,IAAI,CAACC,KAAK,CAACJ,GAAG,GAAG,WAAW,CAAC;EACzCrF,MAAM,CAAC,CAAC,CAAC,GAAIuF,GAAG,KAAK,CAAC,GAAI,IAAI;EAC9BvF,MAAM,CAAC,CAAC,CAAC,GAAGuF,GAAG,GAAG,IAAI;EACtBvF,MAAM,CAAC,CAAC,CAAC,GAAIqF,GAAG,KAAK,EAAE,GAAI,IAAI;EAC/BrF,MAAM,CAAC,CAAC,CAAC,GAAIqF,GAAG,KAAK,EAAE,GAAI,IAAI;EAC/BrF,MAAM,CAAC,CAAC,CAAC,GAAIqF,GAAG,KAAK,CAAC,GAAI,IAAI;EAC9BrF,MAAM,CAAC,CAAC,CAAC,GAAGqF,GAAG,GAAG,IAAI;EAEtB,OAAOL,aAAa,CAAChF,MAAM,EAAE,CAAC,CAAC;AACjC","ignoreList":[]}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
4
|
+
import { Buffer } from '@craftzdog/react-native-buffer';
|
|
5
|
+
import { CryptoKey, KeyObject } from './keys/classes';
|
|
6
|
+
import { getUsagesUnion, hasAnyNotIn, lazyDOMException, normalizeHashName, KFormatType, KeyEncoding } from './utils';
|
|
7
|
+
export class Rsa {
|
|
8
|
+
constructor(modulusLength, publicExponent, hashAlgorithm) {
|
|
9
|
+
this.native = NitroModules.createHybridObject('RsaKeyPair');
|
|
10
|
+
this.native.setModulusLength(modulusLength);
|
|
11
|
+
this.native.setPublicExponent(publicExponent.buffer.slice(publicExponent.byteOffset, publicExponent.byteOffset + publicExponent.byteLength));
|
|
12
|
+
this.native.setHashAlgorithm(hashAlgorithm);
|
|
13
|
+
}
|
|
14
|
+
async generateKeyPair() {
|
|
15
|
+
await this.native.generateKeyPair();
|
|
16
|
+
return {
|
|
17
|
+
publicKey: this.native.getPublicKey(),
|
|
18
|
+
privateKey: this.native.getPrivateKey()
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
generateKeyPairSync() {
|
|
22
|
+
this.native.generateKeyPairSync();
|
|
23
|
+
return {
|
|
24
|
+
publicKey: this.native.getPublicKey(),
|
|
25
|
+
privateKey: this.native.getPrivateKey()
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Modern best practice (NIST SP 800-131A Rev. 2, IETF RFC 8017): RSA keys
|
|
31
|
+
// shorter than 2048 bits are deprecated for both signing and encryption.
|
|
32
|
+
// 1024-bit moduli have been factored in academic settings; 768-bit keys
|
|
33
|
+
// have been factored on commodity hardware. Reject anything below 2048
|
|
34
|
+
// at the JS boundary so callers can't accidentally generate weak keys.
|
|
35
|
+
const RSA_MIN_MODULUS_LENGTH = 2048;
|
|
36
|
+
|
|
37
|
+
// Node API
|
|
38
|
+
export async function rsa_generateKeyPair(algorithm, extractable, keyUsages) {
|
|
39
|
+
const {
|
|
40
|
+
name,
|
|
41
|
+
modulusLength,
|
|
42
|
+
publicExponent,
|
|
43
|
+
hash
|
|
44
|
+
} = algorithm;
|
|
45
|
+
|
|
46
|
+
// Validate parameters first
|
|
47
|
+
if (!modulusLength || modulusLength < RSA_MIN_MODULUS_LENGTH) {
|
|
48
|
+
throw lazyDOMException(`RSA modulusLength must be at least ${RSA_MIN_MODULUS_LENGTH} bits ` + `(got ${modulusLength ?? 0})`, 'OperationError');
|
|
49
|
+
}
|
|
50
|
+
if (!publicExponent || publicExponent.length === 0) {
|
|
51
|
+
throw lazyDOMException('Invalid public exponent', 'OperationError');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Validate hash algorithm using existing validation function
|
|
55
|
+
let hashName;
|
|
56
|
+
try {
|
|
57
|
+
const normalizedHash = normalizeHashName(hash);
|
|
58
|
+
hashName = typeof hash === 'string' ? hash : hash?.name || normalizedHash;
|
|
59
|
+
} catch {
|
|
60
|
+
throw lazyDOMException('Invalid Hash Algorithm', 'NotSupportedError');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Validate usages are not empty
|
|
64
|
+
if (keyUsages.length === 0) {
|
|
65
|
+
throw lazyDOMException('Usages cannot be empty', 'SyntaxError');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Usage validation based on algorithm type
|
|
69
|
+
switch (name) {
|
|
70
|
+
case 'RSASSA-PKCS1-v1_5':
|
|
71
|
+
if (hasAnyNotIn(keyUsages, ['sign', 'verify'])) {
|
|
72
|
+
throw lazyDOMException(`Unsupported key usage for a ${name} key`, 'SyntaxError');
|
|
73
|
+
}
|
|
74
|
+
break;
|
|
75
|
+
case 'RSA-PSS':
|
|
76
|
+
if (hasAnyNotIn(keyUsages, ['sign', 'verify'])) {
|
|
77
|
+
throw lazyDOMException(`Unsupported key usage for a ${name} key`, 'SyntaxError');
|
|
78
|
+
}
|
|
79
|
+
break;
|
|
80
|
+
case 'RSA-OAEP':
|
|
81
|
+
if (hasAnyNotIn(keyUsages, ['encrypt', 'decrypt', 'wrapKey', 'unwrapKey'])) {
|
|
82
|
+
throw lazyDOMException(`Unsupported key usage for a ${name} key`, 'SyntaxError');
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
default:
|
|
86
|
+
throw lazyDOMException('The algorithm is not supported', 'NotSupportedError');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Split usages between public and private keys
|
|
90
|
+
let publicUsages = [];
|
|
91
|
+
let privateUsages = [];
|
|
92
|
+
switch (name) {
|
|
93
|
+
case 'RSASSA-PKCS1-v1_5':
|
|
94
|
+
case 'RSA-PSS':
|
|
95
|
+
publicUsages = getUsagesUnion(keyUsages, 'verify');
|
|
96
|
+
privateUsages = getUsagesUnion(keyUsages, 'sign');
|
|
97
|
+
break;
|
|
98
|
+
case 'RSA-OAEP':
|
|
99
|
+
publicUsages = getUsagesUnion(keyUsages, 'encrypt', 'wrapKey');
|
|
100
|
+
privateUsages = getUsagesUnion(keyUsages, 'decrypt', 'unwrapKey');
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Validate that private key has usages for CryptoKeyPair
|
|
105
|
+
if (privateUsages.length === 0) {
|
|
106
|
+
throw lazyDOMException('Usages cannot be empty', 'SyntaxError');
|
|
107
|
+
}
|
|
108
|
+
const rsa = new Rsa(modulusLength, publicExponent, hashName);
|
|
109
|
+
await rsa.generateKeyPair();
|
|
110
|
+
const keyAlgorithm = {
|
|
111
|
+
name,
|
|
112
|
+
modulusLength,
|
|
113
|
+
publicExponent,
|
|
114
|
+
hash: {
|
|
115
|
+
name: hashName
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// Create KeyObject instances using the standard createKeyObject method
|
|
120
|
+
const publicKeyData = rsa.native.getPublicKey();
|
|
121
|
+
const pub = KeyObject.createKeyObject('public', publicKeyData);
|
|
122
|
+
const publicKey = new CryptoKey(pub, keyAlgorithm, publicUsages, true);
|
|
123
|
+
const privateKeyData = rsa.native.getPrivateKey();
|
|
124
|
+
const priv = KeyObject.createKeyObject('private', privateKeyData);
|
|
125
|
+
const privateKey = new CryptoKey(priv, keyAlgorithm, privateUsages, extractable);
|
|
126
|
+
return {
|
|
127
|
+
publicKey,
|
|
128
|
+
privateKey
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function rsa_prepareKeyGenParams(_type, options) {
|
|
132
|
+
if (!options) {
|
|
133
|
+
throw new Error('Options are required for RSA key generation');
|
|
134
|
+
}
|
|
135
|
+
const {
|
|
136
|
+
modulusLength,
|
|
137
|
+
publicExponent,
|
|
138
|
+
hash = 'sha256'
|
|
139
|
+
} = options;
|
|
140
|
+
if (!modulusLength || modulusLength < RSA_MIN_MODULUS_LENGTH) {
|
|
141
|
+
throw new RangeError(`RSA modulusLength must be at least ${RSA_MIN_MODULUS_LENGTH} bits ` + `(got ${modulusLength ?? 0})`);
|
|
142
|
+
}
|
|
143
|
+
const pubExp = publicExponent || 65537;
|
|
144
|
+
const pubExpBytes = new Uint8Array([pubExp >> 16 & 0xff, pubExp >> 8 & 0xff, pubExp & 0xff]);
|
|
145
|
+
const hashName = typeof hash === 'string' ? hash : hash;
|
|
146
|
+
return new Rsa(modulusLength, pubExpBytes, hashName);
|
|
147
|
+
}
|
|
148
|
+
function rsa_formatKeyPairOutput(rsa, encoding) {
|
|
149
|
+
const {
|
|
150
|
+
publicFormat,
|
|
151
|
+
publicType,
|
|
152
|
+
privateFormat,
|
|
153
|
+
privateType,
|
|
154
|
+
cipher,
|
|
155
|
+
passphrase
|
|
156
|
+
} = encoding;
|
|
157
|
+
const publicKeyData = rsa.native.getPublicKey();
|
|
158
|
+
const privateKeyData = rsa.native.getPrivateKey();
|
|
159
|
+
const pub = KeyObject.createKeyObject('public', publicKeyData);
|
|
160
|
+
const priv = KeyObject.createKeyObject('private', privateKeyData);
|
|
161
|
+
let publicKey;
|
|
162
|
+
let privateKey;
|
|
163
|
+
if (publicFormat === 'raw-public' || privateFormat === 'raw-private' || privateFormat === 'raw-seed') {
|
|
164
|
+
throw new Error('Raw key formats are not supported for RSA keys');
|
|
165
|
+
}
|
|
166
|
+
if (publicFormat === -1) {
|
|
167
|
+
publicKey = pub;
|
|
168
|
+
} else {
|
|
169
|
+
const format = publicFormat === KFormatType.PEM ? KFormatType.PEM : KFormatType.DER;
|
|
170
|
+
const keyEncoding = publicType === KeyEncoding.SPKI ? KeyEncoding.SPKI : KeyEncoding.PKCS1;
|
|
171
|
+
const exported = pub.handle.exportKey(format, keyEncoding);
|
|
172
|
+
if (format === KFormatType.PEM) {
|
|
173
|
+
publicKey = Buffer.from(new Uint8Array(exported)).toString('utf-8');
|
|
174
|
+
} else {
|
|
175
|
+
publicKey = exported;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (privateFormat === -1) {
|
|
179
|
+
privateKey = priv;
|
|
180
|
+
} else {
|
|
181
|
+
const format = privateFormat === KFormatType.PEM ? KFormatType.PEM : KFormatType.DER;
|
|
182
|
+
const keyEncoding = privateType === KeyEncoding.PKCS8 ? KeyEncoding.PKCS8 : KeyEncoding.PKCS1;
|
|
183
|
+
const exported = priv.handle.exportKey(format, keyEncoding, cipher, passphrase);
|
|
184
|
+
if (format === KFormatType.PEM) {
|
|
185
|
+
privateKey = Buffer.from(new Uint8Array(exported)).toString('utf-8');
|
|
186
|
+
} else {
|
|
187
|
+
privateKey = exported;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
publicKey,
|
|
192
|
+
privateKey
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
export async function rsa_generateKeyPairNode(type, options, encoding) {
|
|
196
|
+
const rsa = rsa_prepareKeyGenParams(type, options);
|
|
197
|
+
await rsa.generateKeyPair();
|
|
198
|
+
return rsa_formatKeyPairOutput(rsa, encoding);
|
|
199
|
+
}
|
|
200
|
+
export function rsa_generateKeyPairNodeSync(type, options, encoding) {
|
|
201
|
+
const rsa = rsa_prepareKeyGenParams(type, options);
|
|
202
|
+
rsa.generateKeyPairSync();
|
|
203
|
+
return rsa_formatKeyPairOutput(rsa, encoding);
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=rsa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NitroModules","Buffer","CryptoKey","KeyObject","getUsagesUnion","hasAnyNotIn","lazyDOMException","normalizeHashName","KFormatType","KeyEncoding","Rsa","constructor","modulusLength","publicExponent","hashAlgorithm","native","createHybridObject","setModulusLength","setPublicExponent","buffer","slice","byteOffset","byteLength","setHashAlgorithm","generateKeyPair","publicKey","getPublicKey","privateKey","getPrivateKey","generateKeyPairSync","RSA_MIN_MODULUS_LENGTH","rsa_generateKeyPair","algorithm","extractable","keyUsages","name","hash","length","hashName","normalizedHash","publicUsages","privateUsages","rsa","keyAlgorithm","publicKeyData","pub","createKeyObject","privateKeyData","priv","rsa_prepareKeyGenParams","_type","options","Error","RangeError","pubExp","pubExpBytes","Uint8Array","rsa_formatKeyPairOutput","encoding","publicFormat","publicType","privateFormat","privateType","cipher","passphrase","format","PEM","DER","keyEncoding","SPKI","PKCS1","exported","handle","exportKey","from","toString","PKCS8","rsa_generateKeyPairNode","type","rsa_generateKeyPairNodeSync"],"sourceRoot":"../../src","sources":["rsa.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AACzD,SAASC,MAAM,QAAQ,gCAAgC;AACvD,SACEC,SAAS,EACTC,SAAS,QAGJ,gBAAgB;AACvB,SACEC,cAAc,EACdC,WAAW,EACXC,gBAAgB,EAChBC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,QACN,SAAS;AAWhB,OAAO,MAAMC,GAAG,CAAC;EAGfC,WAAWA,CACTC,aAAqB,EACrBC,cAA0B,EAC1BC,aAAqB,EACrB;IACA,IAAI,CAACC,MAAM,GAAGf,YAAY,CAACgB,kBAAkB,CAAa,YAAY,CAAC;IACvE,IAAI,CAACD,MAAM,CAACE,gBAAgB,CAACL,aAAa,CAAC;IAC3C,IAAI,CAACG,MAAM,CAACG,iBAAiB,CAC3BL,cAAc,CAACM,MAAM,CAACC,KAAK,CACzBP,cAAc,CAACQ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