@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,246 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { AsymmetricKeyObject, CryptoKey, KeyObject, SecretKeyObject, PublicKeyObject, PrivateKeyObject } from './classes';
|
|
4
|
+
import { generateKeyPair, generateKeyPairSync } from './generateKeyPair';
|
|
5
|
+
import { createSign, createVerify, sign, verify, Sign, Verify } from './signVerify';
|
|
6
|
+
import { publicEncrypt, publicDecrypt, privateEncrypt, privateDecrypt } from './publicCipher';
|
|
7
|
+
import { isCryptoKey, parseKeyEncoding, parsePrivateKeyEncoding, parsePublicKeyEncoding } from './utils';
|
|
8
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
9
|
+
import { binaryLikeToArrayBuffer as toAB, isStringOrBuffer, KFormatType, KeyEncoding, KeyType } from '../utils';
|
|
10
|
+
import { randomBytes } from '../random';
|
|
11
|
+
function isRawFormat(format) {
|
|
12
|
+
return format === 'raw-public' || format === 'raw-private' || format === 'raw-seed';
|
|
13
|
+
}
|
|
14
|
+
function createPublicKeyFromRaw(input) {
|
|
15
|
+
if (input.format !== 'raw-public') {
|
|
16
|
+
throw new Error('Invalid format for createPublicKey raw import');
|
|
17
|
+
}
|
|
18
|
+
if (typeof input.asymmetricKeyType !== 'string') {
|
|
19
|
+
throw new Error('options.asymmetricKeyType is required for raw key import');
|
|
20
|
+
}
|
|
21
|
+
if (input.asymmetricKeyType === 'ec' && !input.namedCurve) {
|
|
22
|
+
throw new Error('options.namedCurve is required for EC raw key import');
|
|
23
|
+
}
|
|
24
|
+
const handle = NitroModules.createHybridObject('KeyObjectHandle');
|
|
25
|
+
handle.initRawPublic(input.asymmetricKeyType, toAB(input.key), input.namedCurve);
|
|
26
|
+
return new PublicKeyObject(handle);
|
|
27
|
+
}
|
|
28
|
+
function createPrivateKeyFromRaw(input) {
|
|
29
|
+
if (input.format !== 'raw-private' && input.format !== 'raw-seed') {
|
|
30
|
+
throw new Error('Invalid format for createPrivateKey raw import');
|
|
31
|
+
}
|
|
32
|
+
if (typeof input.asymmetricKeyType !== 'string') {
|
|
33
|
+
throw new Error('options.asymmetricKeyType is required for raw key import');
|
|
34
|
+
}
|
|
35
|
+
if (input.asymmetricKeyType === 'ec' && !input.namedCurve) {
|
|
36
|
+
throw new Error('options.namedCurve is required for EC raw key import');
|
|
37
|
+
}
|
|
38
|
+
const handle = NitroModules.createHybridObject('KeyObjectHandle');
|
|
39
|
+
if (input.format === 'raw-seed') {
|
|
40
|
+
handle.initRawSeed(input.asymmetricKeyType, toAB(input.key));
|
|
41
|
+
} else {
|
|
42
|
+
handle.initRawPrivate(input.asymmetricKeyType, toAB(input.key), input.namedCurve);
|
|
43
|
+
}
|
|
44
|
+
return new PrivateKeyObject(handle);
|
|
45
|
+
}
|
|
46
|
+
function createSecretKey(key) {
|
|
47
|
+
const keyBuffer = toAB(key);
|
|
48
|
+
return KeyObject.createKeyObject('secret', keyBuffer);
|
|
49
|
+
}
|
|
50
|
+
function prepareAsymmetricKey(key, isPublic) {
|
|
51
|
+
if (key instanceof KeyObject) {
|
|
52
|
+
if (isPublic) {
|
|
53
|
+
// createPublicKey can accept either a public key or extract public from private
|
|
54
|
+
if (key.type === 'secret') {
|
|
55
|
+
throw new Error('Cannot create public key from secret key');
|
|
56
|
+
}
|
|
57
|
+
// Export as SPKI (public key format) - works for both public and private keys
|
|
58
|
+
const exported = key.handle.exportKey(KFormatType.DER, KeyEncoding.SPKI);
|
|
59
|
+
return {
|
|
60
|
+
data: exported,
|
|
61
|
+
format: 'der',
|
|
62
|
+
type: 'spki'
|
|
63
|
+
};
|
|
64
|
+
} else {
|
|
65
|
+
// createPrivateKey requires a private key
|
|
66
|
+
if (key.type !== 'private') {
|
|
67
|
+
throw new Error('Key must be a private key');
|
|
68
|
+
}
|
|
69
|
+
const exported = key.handle.exportKey(KFormatType.DER, KeyEncoding.PKCS8);
|
|
70
|
+
return {
|
|
71
|
+
data: exported,
|
|
72
|
+
format: 'der',
|
|
73
|
+
type: 'pkcs8'
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (isCryptoKey(key)) {
|
|
78
|
+
const cryptoKey = key;
|
|
79
|
+
return prepareAsymmetricKey(cryptoKey.keyObject, isPublic);
|
|
80
|
+
}
|
|
81
|
+
if (isStringOrBuffer(key)) {
|
|
82
|
+
// Detect PEM format from string content
|
|
83
|
+
const isPem = typeof key === 'string' && key.includes('-----BEGIN');
|
|
84
|
+
return {
|
|
85
|
+
data: toAB(key),
|
|
86
|
+
format: isPem ? 'pem' : undefined
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (typeof key === 'object' && 'key' in key) {
|
|
90
|
+
const keyObj = key;
|
|
91
|
+
const {
|
|
92
|
+
key: data,
|
|
93
|
+
format,
|
|
94
|
+
type,
|
|
95
|
+
passphrase
|
|
96
|
+
} = keyObj;
|
|
97
|
+
const passphraseAB = passphrase !== undefined ? toAB(passphrase) : undefined;
|
|
98
|
+
if (data instanceof KeyObject) {
|
|
99
|
+
return prepareAsymmetricKey(data, isPublic);
|
|
100
|
+
}
|
|
101
|
+
if (isCryptoKey(data)) {
|
|
102
|
+
return prepareAsymmetricKey(data.keyObject, isPublic);
|
|
103
|
+
}
|
|
104
|
+
if (!isStringOrBuffer(data)) {
|
|
105
|
+
throw new Error('Invalid key data type');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// For PEM format with string data, convert to ArrayBuffer
|
|
109
|
+
if ((format === 'pem' || typeof data === 'string' && data.includes('-----BEGIN')) && typeof data === 'string') {
|
|
110
|
+
return {
|
|
111
|
+
data: toAB(data),
|
|
112
|
+
format: 'pem',
|
|
113
|
+
type,
|
|
114
|
+
passphrase: passphraseAB
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Filter to only 'pem' or 'der' — JWK and raw formats are handled
|
|
119
|
+
// separately via dedicated paths.
|
|
120
|
+
const filteredFormat = format === 'pem' || format === 'der' ? format : undefined;
|
|
121
|
+
return {
|
|
122
|
+
data: toAB(data),
|
|
123
|
+
format: filteredFormat,
|
|
124
|
+
type,
|
|
125
|
+
passphrase: passphraseAB
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
throw new Error('Invalid key input');
|
|
129
|
+
}
|
|
130
|
+
function createPublicKey(key) {
|
|
131
|
+
if (typeof key === 'object' && 'key' in key && isRawFormat(key.format)) {
|
|
132
|
+
if (key.format !== 'raw-public') {
|
|
133
|
+
throw new Error(`Invalid format ${key.format} for createPublicKey — only 'raw-public' is allowed`);
|
|
134
|
+
}
|
|
135
|
+
return createPublicKeyFromRaw(key);
|
|
136
|
+
}
|
|
137
|
+
if (typeof key === 'object' && 'key' in key && key.format === 'jwk') {
|
|
138
|
+
const handle = NitroModules.createHybridObject('KeyObjectHandle');
|
|
139
|
+
const keyType = handle.initJwk(key.key);
|
|
140
|
+
if (keyType === undefined) {
|
|
141
|
+
throw new Error('Failed to import JWK');
|
|
142
|
+
}
|
|
143
|
+
if (keyType === KeyType.PRIVATE) {
|
|
144
|
+
// Extract public from private
|
|
145
|
+
const exported = handle.exportKey(KFormatType.DER, KeyEncoding.SPKI);
|
|
146
|
+
const pubHandle = NitroModules.createHybridObject('KeyObjectHandle');
|
|
147
|
+
pubHandle.init(KeyType.PUBLIC, exported, KFormatType.DER, KeyEncoding.SPKI);
|
|
148
|
+
return new PublicKeyObject(pubHandle);
|
|
149
|
+
}
|
|
150
|
+
return new PublicKeyObject(handle);
|
|
151
|
+
}
|
|
152
|
+
const {
|
|
153
|
+
data,
|
|
154
|
+
format,
|
|
155
|
+
type,
|
|
156
|
+
passphrase
|
|
157
|
+
} = prepareAsymmetricKey(key, true);
|
|
158
|
+
|
|
159
|
+
// Map format string to KFormatType enum
|
|
160
|
+
let kFormat;
|
|
161
|
+
if (format === 'pem') kFormat = KFormatType.PEM;else if (format === 'der') kFormat = KFormatType.DER;
|
|
162
|
+
|
|
163
|
+
// Map type string to KeyEncoding enum
|
|
164
|
+
let kType;
|
|
165
|
+
if (type === 'spki') kType = KeyEncoding.SPKI;else if (type === 'pkcs1') kType = KeyEncoding.PKCS1;
|
|
166
|
+
return KeyObject.createKeyObject('public', data, kFormat, kType, passphrase);
|
|
167
|
+
}
|
|
168
|
+
function createPrivateKey(key) {
|
|
169
|
+
if (typeof key === 'object' && 'key' in key && isRawFormat(key.format)) {
|
|
170
|
+
if (key.format === 'raw-public') {
|
|
171
|
+
throw new Error("Invalid format 'raw-public' for createPrivateKey");
|
|
172
|
+
}
|
|
173
|
+
return createPrivateKeyFromRaw(key);
|
|
174
|
+
}
|
|
175
|
+
if (typeof key === 'object' && 'key' in key && key.format === 'jwk') {
|
|
176
|
+
const handle = NitroModules.createHybridObject('KeyObjectHandle');
|
|
177
|
+
const keyType = handle.initJwk(key.key);
|
|
178
|
+
if (keyType === undefined || keyType !== KeyType.PRIVATE) {
|
|
179
|
+
throw new Error('Failed to import private key from JWK');
|
|
180
|
+
}
|
|
181
|
+
return new PrivateKeyObject(handle);
|
|
182
|
+
}
|
|
183
|
+
const {
|
|
184
|
+
data,
|
|
185
|
+
format,
|
|
186
|
+
type,
|
|
187
|
+
passphrase
|
|
188
|
+
} = prepareAsymmetricKey(key, false);
|
|
189
|
+
|
|
190
|
+
// Map format string to KFormatType enum
|
|
191
|
+
let kFormat;
|
|
192
|
+
if (format === 'pem') kFormat = KFormatType.PEM;else if (format === 'der') kFormat = KFormatType.DER;
|
|
193
|
+
|
|
194
|
+
// Map type string to KeyEncoding enum
|
|
195
|
+
let kType;
|
|
196
|
+
if (type === 'pkcs8') kType = KeyEncoding.PKCS8;else if (type === 'pkcs1') kType = KeyEncoding.PKCS1;else if (type === 'sec1') kType = KeyEncoding.SEC1;
|
|
197
|
+
return KeyObject.createKeyObject('private', data, kFormat, kType, passphrase);
|
|
198
|
+
}
|
|
199
|
+
function generateKeySync(type, options) {
|
|
200
|
+
if (typeof type !== 'string') {
|
|
201
|
+
throw new TypeError('The "type" argument must be a string');
|
|
202
|
+
}
|
|
203
|
+
if (typeof options !== 'object' || options === null) {
|
|
204
|
+
throw new TypeError('The "options" argument must be an object');
|
|
205
|
+
}
|
|
206
|
+
const {
|
|
207
|
+
length
|
|
208
|
+
} = options;
|
|
209
|
+
if (typeof length !== 'number' || !Number.isInteger(length)) {
|
|
210
|
+
throw new TypeError('The "options.length" property must be an integer');
|
|
211
|
+
}
|
|
212
|
+
switch (type) {
|
|
213
|
+
case 'hmac':
|
|
214
|
+
if (length < 8 || length > 2 ** 31 - 1) {
|
|
215
|
+
throw new RangeError('The "options.length" property must be >= 8 and <= 2147483647');
|
|
216
|
+
}
|
|
217
|
+
break;
|
|
218
|
+
case 'aes':
|
|
219
|
+
if (length !== 128 && length !== 192 && length !== 256) {
|
|
220
|
+
throw new RangeError('The "options.length" property must be 128, 192, or 256');
|
|
221
|
+
}
|
|
222
|
+
break;
|
|
223
|
+
default:
|
|
224
|
+
throw new TypeError(`The "type" argument must be 'aes' or 'hmac'. Received '${type}'`);
|
|
225
|
+
}
|
|
226
|
+
const keyBytes = length / 8;
|
|
227
|
+
const keyMaterial = randomBytes(keyBytes);
|
|
228
|
+
return createSecretKey(keyMaterial);
|
|
229
|
+
}
|
|
230
|
+
function generateKey(type, options, callback) {
|
|
231
|
+
if (typeof callback !== 'function') {
|
|
232
|
+
throw new TypeError('The "callback" argument must be a function');
|
|
233
|
+
}
|
|
234
|
+
try {
|
|
235
|
+
const key = generateKeySync(type, options);
|
|
236
|
+
process.nextTick(callback, null, key);
|
|
237
|
+
} catch (err) {
|
|
238
|
+
process.nextTick(callback, err);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
export {
|
|
242
|
+
// Node Public API
|
|
243
|
+
createSecretKey, createPublicKey, createPrivateKey, CryptoKey, generateKey, generateKeySync, generateKeyPair, generateKeyPairSync, AsymmetricKeyObject, KeyObject, createSign, createVerify, sign, verify, Sign, Verify, publicEncrypt, publicDecrypt, privateEncrypt, privateDecrypt,
|
|
244
|
+
// Node Internal API
|
|
245
|
+
parsePublicKeyEncoding, parsePrivateKeyEncoding, parseKeyEncoding, SecretKeyObject, PublicKeyObject, PrivateKeyObject, isCryptoKey };
|
|
246
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AsymmetricKeyObject","CryptoKey","KeyObject","SecretKeyObject","PublicKeyObject","PrivateKeyObject","generateKeyPair","generateKeyPairSync","createSign","createVerify","sign","verify","Sign","Verify","publicEncrypt","publicDecrypt","privateEncrypt","privateDecrypt","isCryptoKey","parseKeyEncoding","parsePrivateKeyEncoding","parsePublicKeyEncoding","NitroModules","binaryLikeToArrayBuffer","toAB","isStringOrBuffer","KFormatType","KeyEncoding","KeyType","randomBytes","isRawFormat","format","createPublicKeyFromRaw","input","Error","asymmetricKeyType","namedCurve","handle","createHybridObject","initRawPublic","key","createPrivateKeyFromRaw","initRawSeed","initRawPrivate","createSecretKey","keyBuffer","createKeyObject","prepareAsymmetricKey","isPublic","type","exported","exportKey","DER","SPKI","data","PKCS8","cryptoKey","keyObject","isPem","includes","undefined","keyObj","passphrase","passphraseAB","filteredFormat","createPublicKey","keyType","initJwk","PRIVATE","pubHandle","init","PUBLIC","kFormat","PEM","kType","PKCS1","createPrivateKey","SEC1","generateKeySync","options","TypeError","length","Number","isInteger","RangeError","keyBytes","keyMaterial","generateKey","callback","process","nextTick","err"],"sourceRo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 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
4
|
+
import { Buffer } from '@craftzdog/react-native-buffer';
|
|
5
|
+
import { binaryLikeToArrayBuffer as toAB, isStringOrBuffer, KFormatType, KeyEncoding } from '../utils';
|
|
6
|
+
import { isCryptoKey } from './utils';
|
|
7
|
+
import { KeyObject } from './classes';
|
|
8
|
+
import { constants } from '../constants';
|
|
9
|
+
function preparePublicCipherKey(key, isEncrypt) {
|
|
10
|
+
let keyObj;
|
|
11
|
+
let padding;
|
|
12
|
+
let oaepHash;
|
|
13
|
+
let oaepLabel;
|
|
14
|
+
if (key instanceof KeyObject) {
|
|
15
|
+
if (isEncrypt && key.type !== 'public') {
|
|
16
|
+
throw new Error('publicEncrypt requires a public key');
|
|
17
|
+
}
|
|
18
|
+
// publicDecrypt accepts both public and private keys (Node.js behavior)
|
|
19
|
+
// A private key contains the public components needed for verify_recover
|
|
20
|
+
keyObj = key;
|
|
21
|
+
} else if (isCryptoKey(key)) {
|
|
22
|
+
const cryptoKey = key;
|
|
23
|
+
keyObj = cryptoKey.keyObject;
|
|
24
|
+
} else if (isStringOrBuffer(key)) {
|
|
25
|
+
const data = toAB(key);
|
|
26
|
+
const isPem = typeof key === 'string' && key.includes('-----BEGIN');
|
|
27
|
+
const isPrivatePem = typeof key === 'string' && key.includes('-----BEGIN PRIVATE');
|
|
28
|
+
// publicDecrypt accepts both public and private keys (Node.js behavior)
|
|
29
|
+
if (!isEncrypt && isPrivatePem) {
|
|
30
|
+
keyObj = KeyObject.createKeyObject('private', data, KFormatType.PEM, KeyEncoding.PKCS8);
|
|
31
|
+
} else {
|
|
32
|
+
keyObj = KeyObject.createKeyObject('public', data, isPem ? KFormatType.PEM : KFormatType.DER, KeyEncoding.SPKI);
|
|
33
|
+
}
|
|
34
|
+
} else if (typeof key === 'object' && 'key' in key) {
|
|
35
|
+
const options = key;
|
|
36
|
+
const result = preparePublicCipherKey(options.key, isEncrypt);
|
|
37
|
+
keyObj = result.keyHandle;
|
|
38
|
+
padding = options.padding;
|
|
39
|
+
oaepHash = options.oaepHash;
|
|
40
|
+
if (options.oaepLabel) {
|
|
41
|
+
oaepLabel = toAB(options.oaepLabel);
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
throw new Error('Invalid key input');
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
keyHandle: keyObj,
|
|
48
|
+
padding,
|
|
49
|
+
oaepHash,
|
|
50
|
+
oaepLabel
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export function publicEncrypt(key, buffer) {
|
|
54
|
+
const {
|
|
55
|
+
keyHandle,
|
|
56
|
+
padding,
|
|
57
|
+
oaepHash,
|
|
58
|
+
oaepLabel
|
|
59
|
+
} = preparePublicCipherKey(key, true);
|
|
60
|
+
const rsaCipher = NitroModules.createHybridObject('RsaCipher');
|
|
61
|
+
const data = toAB(buffer);
|
|
62
|
+
const paddingMode = padding ?? constants.RSA_PKCS1_OAEP_PADDING;
|
|
63
|
+
const hashAlgorithm = oaepHash || 'sha1';
|
|
64
|
+
try {
|
|
65
|
+
const encrypted = rsaCipher.encrypt(keyHandle.handle, data, paddingMode, hashAlgorithm, oaepLabel);
|
|
66
|
+
return Buffer.from(encrypted);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
throw new Error(`publicEncrypt failed: ${error.message}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export function publicDecrypt(key, buffer) {
|
|
72
|
+
const {
|
|
73
|
+
keyHandle,
|
|
74
|
+
padding
|
|
75
|
+
} = preparePublicCipherKey(key, false);
|
|
76
|
+
const rsaCipher = NitroModules.createHybridObject('RsaCipher');
|
|
77
|
+
const data = toAB(buffer);
|
|
78
|
+
const paddingMode = padding ?? constants.RSA_PKCS1_PADDING;
|
|
79
|
+
try {
|
|
80
|
+
const decrypted = rsaCipher.publicDecrypt(keyHandle.handle, data, paddingMode);
|
|
81
|
+
return Buffer.from(decrypted);
|
|
82
|
+
} catch {
|
|
83
|
+
// Bleichenbacher mitigation: surface a single, content-independent error
|
|
84
|
+
// for every decrypt failure so an attacker cannot use error-message
|
|
85
|
+
// differences as a padding oracle. The native side already collapses its
|
|
86
|
+
// OpenSSL error codes to the same opaque message; we drop it here too
|
|
87
|
+
// rather than re-leaking it via string interpolation.
|
|
88
|
+
throw new Error('publicDecrypt failed');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function preparePrivateCipherKey(key, isEncrypt) {
|
|
92
|
+
let keyObj;
|
|
93
|
+
let padding;
|
|
94
|
+
let oaepHash;
|
|
95
|
+
let oaepLabel;
|
|
96
|
+
if (key instanceof KeyObject) {
|
|
97
|
+
if (isEncrypt && key.type !== 'private') {
|
|
98
|
+
throw new Error('privateEncrypt requires a private key');
|
|
99
|
+
}
|
|
100
|
+
if (!isEncrypt && key.type !== 'private') {
|
|
101
|
+
throw new Error('privateDecrypt requires a private key');
|
|
102
|
+
}
|
|
103
|
+
keyObj = key;
|
|
104
|
+
} else if (isCryptoKey(key)) {
|
|
105
|
+
const cryptoKey = key;
|
|
106
|
+
keyObj = cryptoKey.keyObject;
|
|
107
|
+
} else if (isStringOrBuffer(key)) {
|
|
108
|
+
const data = toAB(key);
|
|
109
|
+
const isPem = typeof key === 'string' && key.includes('-----BEGIN');
|
|
110
|
+
keyObj = KeyObject.createKeyObject('private', data, isPem ? KFormatType.PEM : KFormatType.DER, KeyEncoding.PKCS8);
|
|
111
|
+
} else if (typeof key === 'object' && 'key' in key) {
|
|
112
|
+
const options = key;
|
|
113
|
+
const result = preparePrivateCipherKey(options.key, isEncrypt);
|
|
114
|
+
keyObj = result.keyHandle;
|
|
115
|
+
padding = options.padding;
|
|
116
|
+
oaepHash = options.oaepHash;
|
|
117
|
+
if (options.oaepLabel) {
|
|
118
|
+
oaepLabel = toAB(options.oaepLabel);
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
throw new Error('Invalid key input');
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
keyHandle: keyObj,
|
|
125
|
+
padding,
|
|
126
|
+
oaepHash,
|
|
127
|
+
oaepLabel
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
export function privateEncrypt(key, buffer) {
|
|
131
|
+
const {
|
|
132
|
+
keyHandle,
|
|
133
|
+
padding
|
|
134
|
+
} = preparePrivateCipherKey(key, true);
|
|
135
|
+
const rsaCipher = NitroModules.createHybridObject('RsaCipher');
|
|
136
|
+
const data = toAB(buffer);
|
|
137
|
+
const paddingMode = padding ?? constants.RSA_PKCS1_PADDING;
|
|
138
|
+
try {
|
|
139
|
+
const encrypted = rsaCipher.privateEncrypt(keyHandle.handle, data, paddingMode);
|
|
140
|
+
return Buffer.from(encrypted);
|
|
141
|
+
} catch (error) {
|
|
142
|
+
throw new Error(`privateEncrypt failed: ${error.message}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
export function privateDecrypt(key, buffer) {
|
|
146
|
+
const {
|
|
147
|
+
keyHandle,
|
|
148
|
+
padding,
|
|
149
|
+
oaepHash,
|
|
150
|
+
oaepLabel
|
|
151
|
+
} = preparePrivateCipherKey(key, false);
|
|
152
|
+
const rsaCipher = NitroModules.createHybridObject('RsaCipher');
|
|
153
|
+
const data = toAB(buffer);
|
|
154
|
+
const paddingMode = padding ?? constants.RSA_PKCS1_OAEP_PADDING;
|
|
155
|
+
const hashAlgorithm = oaepHash || 'sha1';
|
|
156
|
+
try {
|
|
157
|
+
const decrypted = rsaCipher.privateDecrypt(keyHandle.handle, data, paddingMode, hashAlgorithm, oaepLabel);
|
|
158
|
+
return Buffer.from(decrypted);
|
|
159
|
+
} catch {
|
|
160
|
+
// Bleichenbacher mitigation — see publicDecrypt above.
|
|
161
|
+
throw new Error('privateDecrypt failed');
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=publicCipher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NitroModules","Buffer","binaryLikeToArrayBuffer","toAB","isStringOrBuffer","KFormatType","KeyEncoding","isCryptoKey","KeyObject","constants","preparePublicCipherKey","key","isEncrypt","keyObj","padding","oaepHash","oaepLabel","type","Error","cryptoKey","keyObject","data","isPem","includes","isPrivatePem","createKeyObject","PEM","PKCS8","DER","SPKI","options","result","keyHandle","publicEncrypt","buffer","rsaCipher","createHybridObject","paddingMode","RSA_PKCS1_OAEP_PADDING","hashAlgorithm","encrypted","encrypt","handle","from","error","message","publicDecrypt","RSA_PKCS1_PADDING","decrypted","preparePrivateCipherKey","privateEncrypt","privateDecrypt"],"sourceRoot":"../../../src","sources":["keys/publicCipher.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AACzD,SAASC,MAAM,QAAQ,gCAAgC;AAGvD,SACEC,uBAAuB,IAAIC,IAAI,EAC/BC,gBAAgB,EAChBC,WAAW,EACXC,WAAW,QACN,UAAU;AACjB,SAASC,WAAW,QAAQ,SAAS;AACrC,SAASC,SAAS,QAAmB,WAAW;AAChD,SAASC,SAAS,QAAQ,cAAc;AA4BxC,SAASC,sBAAsBA,CAC7BC,GAAsB,EACtBC,SAAkB,EAMlB;EACA,IAAIC,MAAiB;EACrB,IAAIC,OAA2B;EAC/B,IAAIC,QAA4B;EAChC,IAAIC,SAAkC;EAEtC,IAAIL,GAAG,YAAYH,SAAS,EAAE;IAC5B,IAAII,SAAS,IAAID,GAAG,CAACM,IAAI,KAAK,QAAQ,EAAE;MACtC,MAAM,IAAIC,KAAK,CAAC,qCAAqC,CAAC;IACxD;IACA;IACA;IACAL,MAAM,GAAGF,GAAG;EACd,CAAC,MAAM,IAAIJ,WAAW,CAACI,GAAG,CAAC,EAAE;IAC3B,MAAMQ,SAAS,GAAGR,GAAgB;IAClCE,MAAM,GAAGM,SAAS,CAACC,SAAS;EAC9B,CAAC,MAAM,IAAIhB,gBAAgB,CAACO,GAAG,CAAC,EAAE;IAChC,MAAMU,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AC,WAAW,CAAC;EACzE,MAAMf,IAAI,GAAGlB,IAAI,CAAC+B,MAAM,CAAC;EACzB,MAAMG,WAAW,GAAGvB,OAAO,IAAIL,SAAS,CAAC6B,sBAAsB;EAC/D,MAAMC,aAAa,GAAGxB,QAAQ,IAAI,MAAM;EAExC,IAAI;IACF,MAAMiC,SAAS,GAAGb,SAAS,CAACgB,cAAc,CACxCnB,SAAS,CAACU,MAAM,EAChBrB,IAAI,EACJgB,WAAW,EACXE,aAAa,EACbvB,SACF,CAAC;IACD,OAAOf,MAAM,CAAC0C,IAAI,CAACK,SAAS,CAAC;EAC/B,CAAC,CAAC,MAAM;IACN;IACA,MAAM,IAAI9B,KAAK,CAAC,uBAAuB,CAAC;EAC1C;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Buffer } from '@craftzdog/react-native-buffer';
|
|
4
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
5
|
+
import { KeyObject } from './classes';
|
|
6
|
+
import { isCryptoKey } from './utils';
|
|
7
|
+
import { binaryLikeToArrayBuffer as toAB, isStringOrBuffer, KFormatType, KeyEncoding } from '../utils';
|
|
8
|
+
import { constants } from '../constants';
|
|
9
|
+
function prepareKey(key, isPublic) {
|
|
10
|
+
// Already a KeyObject
|
|
11
|
+
if (key instanceof KeyObject) {
|
|
12
|
+
if (isPublic) {
|
|
13
|
+
if (key.type === 'secret') {
|
|
14
|
+
throw new Error('Cannot use secret key for signature verification');
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
if (key.type !== 'private') {
|
|
18
|
+
throw new Error('Key must be a private key for signing');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
keyObject: key
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// CryptoKey - extract KeyObject
|
|
27
|
+
if (isCryptoKey(key)) {
|
|
28
|
+
const cryptoKey = key;
|
|
29
|
+
return prepareKey(cryptoKey.keyObject, isPublic);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Raw string or buffer - create KeyObject
|
|
33
|
+
if (isStringOrBuffer(key)) {
|
|
34
|
+
const isPem = typeof key === 'string' && key.includes('-----BEGIN');
|
|
35
|
+
const format = isPem ? KFormatType.PEM : undefined;
|
|
36
|
+
const type = isPublic ? 'public' : 'private';
|
|
37
|
+
const keyData = toAB(key);
|
|
38
|
+
const keyObject = KeyObject.createKeyObject(type, keyData, format);
|
|
39
|
+
return {
|
|
40
|
+
keyObject
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// KeyInputObject with options
|
|
45
|
+
if (typeof key === 'object' && 'key' in key) {
|
|
46
|
+
const keyObj = key;
|
|
47
|
+
const {
|
|
48
|
+
key: data,
|
|
49
|
+
format,
|
|
50
|
+
type,
|
|
51
|
+
padding,
|
|
52
|
+
saltLength,
|
|
53
|
+
dsaEncoding
|
|
54
|
+
} = keyObj;
|
|
55
|
+
|
|
56
|
+
// Nested KeyObject
|
|
57
|
+
if (data instanceof KeyObject) {
|
|
58
|
+
return {
|
|
59
|
+
keyObject: data,
|
|
60
|
+
options: {
|
|
61
|
+
padding,
|
|
62
|
+
saltLength,
|
|
63
|
+
dsaEncoding
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Nested CryptoKey
|
|
69
|
+
if (isCryptoKey(data)) {
|
|
70
|
+
return {
|
|
71
|
+
keyObject: data.keyObject,
|
|
72
|
+
options: {
|
|
73
|
+
padding,
|
|
74
|
+
saltLength,
|
|
75
|
+
dsaEncoding
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (!isStringOrBuffer(data)) {
|
|
80
|
+
throw new Error('Invalid key data type');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Determine format
|
|
84
|
+
const isPem = format === 'pem' || typeof data === 'string' && data.includes('-----BEGIN');
|
|
85
|
+
const kFormat = isPem ? KFormatType.PEM : format === 'der' ? KFormatType.DER : undefined;
|
|
86
|
+
|
|
87
|
+
// Determine encoding type
|
|
88
|
+
let kType;
|
|
89
|
+
if (type === 'pkcs8') kType = KeyEncoding.PKCS8;else if (type === 'pkcs1') kType = KeyEncoding.PKCS1;else if (type === 'sec1') kType = KeyEncoding.SEC1;else if (type === 'spki') kType = KeyEncoding.SPKI;
|
|
90
|
+
const keyType = isPublic ? 'public' : 'private';
|
|
91
|
+
// Always convert to ArrayBuffer to avoid Nitro bridge string truncation bug
|
|
92
|
+
const keyData = toAB(data);
|
|
93
|
+
const keyObject = KeyObject.createKeyObject(keyType, keyData, kFormat, kType);
|
|
94
|
+
return {
|
|
95
|
+
keyObject,
|
|
96
|
+
options: {
|
|
97
|
+
padding,
|
|
98
|
+
saltLength,
|
|
99
|
+
dsaEncoding
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
throw new Error('Invalid key input');
|
|
104
|
+
}
|
|
105
|
+
function dsaEncodingToNumber(dsaEncoding) {
|
|
106
|
+
if (dsaEncoding === 'der') return 0;
|
|
107
|
+
if (dsaEncoding === 'ieee-p1363') return 1;
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
function getSaltLength(options) {
|
|
111
|
+
if (options?.padding === constants.RSA_PKCS1_PSS_PADDING && options?.saltLength === undefined) {
|
|
112
|
+
return constants.RSA_PSS_SALTLEN_MAX_SIGN;
|
|
113
|
+
}
|
|
114
|
+
return options?.saltLength;
|
|
115
|
+
}
|
|
116
|
+
export class Sign {
|
|
117
|
+
constructor(algorithm) {
|
|
118
|
+
this.handle = NitroModules.createHybridObject('SignHandle');
|
|
119
|
+
this.handle.init(algorithm);
|
|
120
|
+
}
|
|
121
|
+
update(data) {
|
|
122
|
+
const dataBuffer = toAB(data);
|
|
123
|
+
this.handle.update(dataBuffer);
|
|
124
|
+
return this;
|
|
125
|
+
}
|
|
126
|
+
sign(privateKey, outputEncoding) {
|
|
127
|
+
if (privateKey === null || privateKey === undefined) {
|
|
128
|
+
throw new Error('Private key is required');
|
|
129
|
+
}
|
|
130
|
+
const {
|
|
131
|
+
keyObject,
|
|
132
|
+
options
|
|
133
|
+
} = prepareKey(privateKey, false);
|
|
134
|
+
const signature = this.handle.sign(keyObject.handle, options?.padding, getSaltLength(options), dsaEncodingToNumber(options?.dsaEncoding));
|
|
135
|
+
const buf = Buffer.from(signature);
|
|
136
|
+
if (outputEncoding) {
|
|
137
|
+
return buf.toString(outputEncoding);
|
|
138
|
+
}
|
|
139
|
+
return buf;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
export class Verify {
|
|
143
|
+
constructor(algorithm) {
|
|
144
|
+
this.handle = NitroModules.createHybridObject('VerifyHandle');
|
|
145
|
+
this.handle.init(algorithm);
|
|
146
|
+
}
|
|
147
|
+
update(data) {
|
|
148
|
+
const dataBuffer = toAB(data);
|
|
149
|
+
this.handle.update(dataBuffer);
|
|
150
|
+
return this;
|
|
151
|
+
}
|
|
152
|
+
verify(publicKey, signature, signatureEncoding) {
|
|
153
|
+
if (publicKey === null || publicKey === undefined) {
|
|
154
|
+
throw new Error('Public key is required');
|
|
155
|
+
}
|
|
156
|
+
const {
|
|
157
|
+
keyObject,
|
|
158
|
+
options
|
|
159
|
+
} = prepareKey(publicKey, true);
|
|
160
|
+
|
|
161
|
+
// Convert signature to ArrayBuffer
|
|
162
|
+
let sigBuffer;
|
|
163
|
+
if (signatureEncoding && typeof signature === 'string') {
|
|
164
|
+
sigBuffer = toAB(Buffer.from(signature, signatureEncoding));
|
|
165
|
+
} else {
|
|
166
|
+
sigBuffer = toAB(signature);
|
|
167
|
+
}
|
|
168
|
+
return this.handle.verify(keyObject.handle, sigBuffer, options?.padding, getSaltLength(options), dsaEncodingToNumber(options?.dsaEncoding));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
export function createSign(algorithm) {
|
|
172
|
+
return new Sign(algorithm);
|
|
173
|
+
}
|
|
174
|
+
export function createVerify(algorithm) {
|
|
175
|
+
return new Verify(algorithm);
|
|
176
|
+
}
|
|
177
|
+
export function sign(algorithm, data, key, callback) {
|
|
178
|
+
const doSign = () => {
|
|
179
|
+
if (key === null || key === undefined) {
|
|
180
|
+
throw new Error('Private key is required');
|
|
181
|
+
}
|
|
182
|
+
const signer = new Sign(algorithm ?? '');
|
|
183
|
+
signer.update(data);
|
|
184
|
+
return signer.sign(key);
|
|
185
|
+
};
|
|
186
|
+
if (callback) {
|
|
187
|
+
try {
|
|
188
|
+
const signature = doSign();
|
|
189
|
+
process.nextTick(callback, null, signature);
|
|
190
|
+
} catch (err) {
|
|
191
|
+
process.nextTick(callback, err);
|
|
192
|
+
}
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
return doSign();
|
|
196
|
+
}
|
|
197
|
+
export function verify(algorithm, data, key, signature, callback) {
|
|
198
|
+
const doVerify = () => {
|
|
199
|
+
if (key === null || key === undefined) {
|
|
200
|
+
throw new Error('Key is required');
|
|
201
|
+
}
|
|
202
|
+
const verifier = new Verify(algorithm ?? '');
|
|
203
|
+
verifier.update(data);
|
|
204
|
+
return verifier.verify(key, signature);
|
|
205
|
+
};
|
|
206
|
+
if (callback) {
|
|
207
|
+
try {
|
|
208
|
+
const result = doVerify();
|
|
209
|
+
process.nextTick(callback, null, result);
|
|
210
|
+
} catch (err) {
|
|
211
|
+
process.nextTick(callback, err);
|
|
212
|
+
}
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
return doVerify();
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=signVerify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Buffer","NitroModules","KeyObject","isCryptoKey","binaryLikeToArrayBuffer","toAB","isStringOrBuffer","KFormatType","KeyEncoding","constants","prepareKey","key","isPublic","type","Error","keyObject","cryptoKey","isPem","includes","format","PEM","undefined","keyData","createKeyObject","keyObj","data","padding","saltLength","dsaEncoding","options","kFormat","DER","kType","PKCS8","PKCS1","SEC1","SPKI","keyType","dsaEncodingToNumber","getSaltLength","RSA_PKCS1_PSS_PADDING","RSA_PSS_SALTLEN_MAX_SIGN","Sign","constructor","algorithm","handle","createHybridObject","init","update","dataBuffer","sign","privateKey","outputEncoding","signature","buf","from","toString","Verify","verify","publicKey","signatureEncoding","sigBuffer","createSign","createVerify","callback","doSign","signer","process","nextTick","err","doVerify","verifier","result"],"sourceRoot":"../../../src","sources":["keys/signVerify.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,gCAAgC;AACvD,SAASC,YAAY,QAAQ,4BAA4B;AAKzD,SAASC,SAAS,QAAmB,WAAW;AAChD,SAASC,WAAW,QAAQ,SAAS;AAErC,SACEC,uBAAuB,IAAIC,IAAI,EAC/BC,gBAAgB,EAChBC,WAAW,EACXC,WAAW,QACN,UAAU;AACjB,SAASC,SAAS,QAAQ,cAAc;AAyBxC,SAASC,UAAUA,CAACC,GAAa,EAAEC,QAAiB,EAAe;EACjE;EACA,IAAID,GAAG,YAAYT,SAAS,EAAE;IAC5B,IAAIU,QAAQ,EAAE;MACZ,IAAID,GAAG,CAACE,IAAI,KAAK,QAAQ,EAAE;QACzB,MAAM,IAAIC,KAAK,CAAC,kDAAkD,CAAC;MACrE;IACF,CAAC,MAAM;MACL,IAAIH,GAAG,CAACE,IAAI,KAAK,SAAS,EAAE;QAC1B,MAAM,IAAIC,KAAK,CAAC,uCAAuC,CAAC;MAC1D;IACF;IACA,OAAO;MAAEC,SAAS,EAAEJ;IAAI,CAAC;EAC3B;;EAEA;EACA,IAAIR,WAAW,CAACQ,GAAG,CAAC,EAAE;IACpB,MAAMK,SAAS,GAAGL,GAAgB;IAClC,OAAOD,UAAU,CAACM,SAAS,CAACD,SAAS,EAAEH,QAAQ,CAAC;EAClD;;EAEA;EACA,IAAIN,gBAAgB,CAACK,GAAG,CAAC,EAAE;IACzB,MAAMM,KAAK,GAAG,OAAON,GA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