@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,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
4
|
+
import Stream from 'readable-stream';
|
|
5
|
+
import { StringDecoder } from 'string_decoder';
|
|
6
|
+
import { Buffer } from '@craftzdog/react-native-buffer';
|
|
7
|
+
|
|
8
|
+
// @types/node
|
|
9
|
+
|
|
10
|
+
import { binaryLikeToArrayBuffer } from './utils';
|
|
11
|
+
import { getDefaultEncoding, getUIntOption, normalizeEncoding, validateEncoding } from './utils/cipher';
|
|
12
|
+
class CipherUtils {
|
|
13
|
+
static native = NitroModules.createHybridObject('Cipher');
|
|
14
|
+
static getSupportedCiphers() {
|
|
15
|
+
return this.native.getSupportedCiphers();
|
|
16
|
+
}
|
|
17
|
+
static getCipherInfo(name, keyLength, ivLength) {
|
|
18
|
+
return this.native.getCipherInfo(name, keyLength, ivLength);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function getCiphers() {
|
|
22
|
+
return CipherUtils.getSupportedCiphers();
|
|
23
|
+
}
|
|
24
|
+
export function getCipherInfo(name, options) {
|
|
25
|
+
if (typeof name !== 'string' || name.length === 0) return undefined;
|
|
26
|
+
return CipherUtils.getCipherInfo(name, options?.keyLength, options?.ivLength);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// libsodium ciphers aren't visible to OpenSSL's EVP_CIPHER_fetch, so
|
|
30
|
+
// getCipherInfo() returns undefined for them. Hard-code the (key, iv)
|
|
31
|
+
// byte-lengths the C++ factory will accept.
|
|
32
|
+
const LIBSODIUM_CIPHER_PARAMS = {
|
|
33
|
+
xsalsa20: {
|
|
34
|
+
keyLength: 32,
|
|
35
|
+
ivLength: 24
|
|
36
|
+
},
|
|
37
|
+
'xsalsa20-poly1305': {
|
|
38
|
+
keyLength: 32,
|
|
39
|
+
ivLength: 24
|
|
40
|
+
},
|
|
41
|
+
'xchacha20-poly1305': {
|
|
42
|
+
keyLength: 32,
|
|
43
|
+
ivLength: 24
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
function validateCipherParams(cipherType, keyByteLength, ivByteLength) {
|
|
47
|
+
if (typeof cipherType !== 'string' || cipherType.length === 0) {
|
|
48
|
+
throw new TypeError('cipher algorithm must be a non-empty string');
|
|
49
|
+
}
|
|
50
|
+
// ArrayBuffer.byteLength is always a non-negative integer, so the only
|
|
51
|
+
// out-of-range value we need to guard is 0 — empty key buffers must not
|
|
52
|
+
// reach OpenSSL's EVP_CipherInit_ex.
|
|
53
|
+
if (keyByteLength === 0) {
|
|
54
|
+
throw new RangeError(`Invalid key length 0 for cipher ${cipherType}`);
|
|
55
|
+
}
|
|
56
|
+
const lower = cipherType.toLowerCase();
|
|
57
|
+
const sodium = LIBSODIUM_CIPHER_PARAMS[lower];
|
|
58
|
+
if (sodium) {
|
|
59
|
+
// libsodium parlance: "nonce" rather than "iv". Phrase the expected
|
|
60
|
+
// size as a natural-language clause so callers asserting on either
|
|
61
|
+
// `key must be N bytes` or `Invalid key length N` both match.
|
|
62
|
+
if (keyByteLength !== sodium.keyLength) {
|
|
63
|
+
throw new RangeError(`Invalid key length ${keyByteLength} for cipher ${cipherType} ` + `(key must be ${sodium.keyLength} bytes)`);
|
|
64
|
+
}
|
|
65
|
+
if (ivByteLength !== sodium.ivLength) {
|
|
66
|
+
throw new RangeError(`Invalid nonce length ${ivByteLength} for cipher ${cipherType} ` + `(nonce must be ${sodium.ivLength} bytes)`);
|
|
67
|
+
}
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// OpenSSL path. Look up the cipher's defaults once. Most callers pass
|
|
72
|
+
// exactly the cipher's default key/iv lengths (e.g. AES-128-CBC always
|
|
73
|
+
// wants 16/16) — short-circuit those to a single native round-trip.
|
|
74
|
+
// Variable-length ciphers (GCM, CCM, OCB, ChaCha20-Poly1305) fall through
|
|
75
|
+
// to per-parameter validation calls so the error message can name which
|
|
76
|
+
// of {key, iv} is wrong.
|
|
77
|
+
const info = CipherUtils.getCipherInfo(cipherType);
|
|
78
|
+
if (info === undefined) {
|
|
79
|
+
throw new TypeError(`Unsupported or unknown cipher type: ${cipherType}`);
|
|
80
|
+
}
|
|
81
|
+
const expectedIv = info.ivLength ?? 0;
|
|
82
|
+
if (expectedIv === 0 && ivByteLength > 0) {
|
|
83
|
+
throw new RangeError(`Cipher ${cipherType} does not use an iv (got ${ivByteLength} bytes)`);
|
|
84
|
+
}
|
|
85
|
+
if (expectedIv > 0 && ivByteLength === 0) {
|
|
86
|
+
throw new RangeError(`Cipher ${cipherType} requires an iv but none was provided`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Fast path: lengths match the cipher's defaults exactly.
|
|
90
|
+
if (info.keyLength === keyByteLength && expectedIv === ivByteLength) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Variable-length: verify against native one parameter at a time.
|
|
95
|
+
if (CipherUtils.getCipherInfo(cipherType, keyByteLength, undefined) === undefined) {
|
|
96
|
+
throw new RangeError(`Invalid key length ${keyByteLength} for cipher ${cipherType}`);
|
|
97
|
+
}
|
|
98
|
+
if (expectedIv > 0 && CipherUtils.getCipherInfo(cipherType, undefined, ivByteLength) === undefined) {
|
|
99
|
+
throw new RangeError(`Invalid iv length ${ivByteLength} for cipher ${cipherType}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
class CipherCommon extends Stream.Transform {
|
|
103
|
+
_decoder = null;
|
|
104
|
+
_decoderEncoding = undefined;
|
|
105
|
+
constructor({
|
|
106
|
+
isCipher,
|
|
107
|
+
cipherType,
|
|
108
|
+
cipherKey,
|
|
109
|
+
iv,
|
|
110
|
+
options
|
|
111
|
+
}) {
|
|
112
|
+
// Explicitly create TransformOptions for super()
|
|
113
|
+
const streamOptions = {};
|
|
114
|
+
if (options) {
|
|
115
|
+
// List known TransformOptions keys (adjust if needed)
|
|
116
|
+
const transformKeys = ['readableHighWaterMark', 'writableHighWaterMark', 'decodeStrings', 'defaultEncoding', 'objectMode', 'destroy', 'read', 'write', 'writev', 'final', 'transform', 'flush'
|
|
117
|
+
// Add any other relevant keys from readable-stream's TransformOptions
|
|
118
|
+
];
|
|
119
|
+
for (const key of transformKeys) {
|
|
120
|
+
if (key in options) {
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
122
|
+
streamOptions[key] = options[key];
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
super(streamOptions); // Pass filtered options
|
|
127
|
+
|
|
128
|
+
// defaults to 16 bytes for AEAD modes; non-AEAD callers ignore it.
|
|
129
|
+
const authTagLen = getUIntOption(options, 'authTagLength') ?? 16;
|
|
130
|
+
const cipherKeyAB = binaryLikeToArrayBuffer(cipherKey);
|
|
131
|
+
const ivAB = binaryLikeToArrayBuffer(iv);
|
|
132
|
+
validateCipherParams(cipherType, cipherKeyAB.byteLength, ivAB.byteLength);
|
|
133
|
+
const factory = NitroModules.createHybridObject('CipherFactory');
|
|
134
|
+
this.native = factory.createCipher({
|
|
135
|
+
isCipher,
|
|
136
|
+
cipherType,
|
|
137
|
+
cipherKey: cipherKeyAB,
|
|
138
|
+
iv: ivAB,
|
|
139
|
+
authTagLen
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
getDecoder(encoding) {
|
|
143
|
+
const normalized = normalizeEncoding(encoding);
|
|
144
|
+
if (!this._decoder) {
|
|
145
|
+
this._decoder = new StringDecoder(encoding);
|
|
146
|
+
this._decoderEncoding = normalized;
|
|
147
|
+
} else if (this._decoderEncoding !== normalized) {
|
|
148
|
+
throw new Error('Cannot change encoding');
|
|
149
|
+
}
|
|
150
|
+
return this._decoder;
|
|
151
|
+
}
|
|
152
|
+
update(data, inputEncoding, outputEncoding) {
|
|
153
|
+
const defaultEncoding = getDefaultEncoding();
|
|
154
|
+
inputEncoding = inputEncoding ?? defaultEncoding;
|
|
155
|
+
outputEncoding = outputEncoding ?? defaultEncoding;
|
|
156
|
+
if (typeof data === 'string') {
|
|
157
|
+
validateEncoding(data, inputEncoding);
|
|
158
|
+
} else if (!ArrayBuffer.isView(data)) {
|
|
159
|
+
throw new Error('Invalid data argument');
|
|
160
|
+
}
|
|
161
|
+
const ret = this.native.update(binaryLikeToArrayBuffer(data, inputEncoding));
|
|
162
|
+
if (outputEncoding && outputEncoding !== 'buffer') {
|
|
163
|
+
return this.getDecoder(outputEncoding).write(Buffer.from(ret));
|
|
164
|
+
}
|
|
165
|
+
return Buffer.from(ret);
|
|
166
|
+
}
|
|
167
|
+
final(outputEncoding) {
|
|
168
|
+
const ret = this.native.final();
|
|
169
|
+
if (outputEncoding && outputEncoding !== 'buffer') {
|
|
170
|
+
return this.getDecoder(outputEncoding).end(Buffer.from(ret));
|
|
171
|
+
}
|
|
172
|
+
return Buffer.from(ret);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Stream interface — surface synchronous errors (bad encoding,
|
|
176
|
+
// OpenSSL EVP failures, AEAD tag mismatch in `final()`, etc.) via
|
|
177
|
+
// the callback so they emit as stream 'error' events instead of
|
|
178
|
+
// throwing out of the Transform plumbing and crashing the host
|
|
179
|
+
// pipeline.
|
|
180
|
+
_transform(chunk, encoding, callback) {
|
|
181
|
+
try {
|
|
182
|
+
this.push(this.update(chunk, normalizeEncoding(encoding)));
|
|
183
|
+
callback();
|
|
184
|
+
} catch (err) {
|
|
185
|
+
callback(err);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
_flush(callback) {
|
|
189
|
+
try {
|
|
190
|
+
this.push(this.final());
|
|
191
|
+
callback();
|
|
192
|
+
} catch (err) {
|
|
193
|
+
callback(err);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
setAutoPadding(autoPadding) {
|
|
197
|
+
const res = this.native.setAutoPadding(!!autoPadding);
|
|
198
|
+
if (!res) {
|
|
199
|
+
throw new Error('setAutoPadding failed');
|
|
200
|
+
}
|
|
201
|
+
return this;
|
|
202
|
+
}
|
|
203
|
+
setAAD(buffer, options) {
|
|
204
|
+
// Check if native parts are initialized
|
|
205
|
+
if (!this.native || typeof this.native.setAAD !== 'function') {
|
|
206
|
+
throw new Error('Cipher native object or setAAD method not initialized.');
|
|
207
|
+
}
|
|
208
|
+
// Use binaryLikeToArrayBuffer (not `buffer.buffer`) so that sliced /
|
|
209
|
+
// offset views send only the AAD bytes the caller intended. Passing the
|
|
210
|
+
// raw backing ArrayBuffer authenticates the wrong data and silently
|
|
211
|
+
// breaks the AEAD integrity guarantee.
|
|
212
|
+
const res = this.native.setAAD(binaryLikeToArrayBuffer(buffer), options?.plaintextLength);
|
|
213
|
+
if (!res) {
|
|
214
|
+
throw new Error('setAAD failed (native call returned false)');
|
|
215
|
+
}
|
|
216
|
+
return this;
|
|
217
|
+
}
|
|
218
|
+
getAuthTag() {
|
|
219
|
+
return Buffer.from(this.native.getAuthTag());
|
|
220
|
+
}
|
|
221
|
+
setAuthTag(tag) {
|
|
222
|
+
const res = this.native.setAuthTag(binaryLikeToArrayBuffer(tag));
|
|
223
|
+
if (!res) {
|
|
224
|
+
throw new Error('setAuthTag failed');
|
|
225
|
+
}
|
|
226
|
+
return this;
|
|
227
|
+
}
|
|
228
|
+
getSupportedCiphers() {
|
|
229
|
+
return this.native.getSupportedCiphers();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
class Cipheriv extends CipherCommon {
|
|
233
|
+
constructor(cipherType, cipherKey, iv, options) {
|
|
234
|
+
super({
|
|
235
|
+
isCipher: true,
|
|
236
|
+
cipherType,
|
|
237
|
+
cipherKey: binaryLikeToArrayBuffer(cipherKey),
|
|
238
|
+
iv: binaryLikeToArrayBuffer(iv),
|
|
239
|
+
options
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
class Decipheriv extends CipherCommon {
|
|
244
|
+
constructor(cipherType, cipherKey, iv, options) {
|
|
245
|
+
super({
|
|
246
|
+
isCipher: false,
|
|
247
|
+
cipherType,
|
|
248
|
+
cipherKey: binaryLikeToArrayBuffer(cipherKey),
|
|
249
|
+
iv: binaryLikeToArrayBuffer(iv),
|
|
250
|
+
options
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
export function createDecipheriv(algorithm, key, iv, options) {
|
|
255
|
+
return new Decipheriv(algorithm, key, iv, options);
|
|
256
|
+
}
|
|
257
|
+
export function createCipheriv(algorithm, key, iv, options) {
|
|
258
|
+
return new Cipheriv(algorithm, key, iv, options);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* xsalsa20 stream encryption with @noble/ciphers compatible API
|
|
263
|
+
*
|
|
264
|
+
* @param key - 32 bytes
|
|
265
|
+
* @param nonce - 24 bytes
|
|
266
|
+
* @param data - data to encrypt
|
|
267
|
+
* @param output - unused
|
|
268
|
+
* @param counter - unused
|
|
269
|
+
* @returns encrypted data
|
|
270
|
+
*/
|
|
271
|
+
export function xsalsa20(key, nonce, data,
|
|
272
|
+
// @ts-expect-error haven't implemented this part of @noble/ciphers API
|
|
273
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
274
|
+
output,
|
|
275
|
+
// @ts-expect-error haven't implemented this part of @noble/ciphers API
|
|
276
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
277
|
+
counter) {
|
|
278
|
+
const cipherKeyAB = binaryLikeToArrayBuffer(key);
|
|
279
|
+
const ivAB = binaryLikeToArrayBuffer(nonce);
|
|
280
|
+
validateCipherParams('xsalsa20', cipherKeyAB.byteLength, ivAB.byteLength);
|
|
281
|
+
const factory = NitroModules.createHybridObject('CipherFactory');
|
|
282
|
+
const native = factory.createCipher({
|
|
283
|
+
isCipher: true,
|
|
284
|
+
cipherType: 'xsalsa20',
|
|
285
|
+
cipherKey: cipherKeyAB,
|
|
286
|
+
iv: ivAB
|
|
287
|
+
});
|
|
288
|
+
const result = native.update(binaryLikeToArrayBuffer(data));
|
|
289
|
+
return new Uint8Array(result);
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=cipher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NitroModules","Stream","StringDecoder","Buffer","binaryLikeToArrayBuffer","getDefaultEncoding","getUIntOption","normalizeEncoding","validateEncoding","CipherUtils","native","createHybridObject","getSupportedCiphers","getCipherInfo","name","keyLength","ivLength","getCiphers","options","length","undefined","LIBSODIUM_CIPHER_PARAMS","xsalsa20","validateCipherParams","cipherType","keyByteLength","ivByteLength","TypeError","RangeError","lower","toLowerCase","sodium","info","expectedIv","CipherCommon","Transform","_decoder","_decoderEncoding","constructor","isCipher","cipherKey","iv","streamOptions","transformKeys","key","authTagLen","cipherKeyAB","ivAB","byteLength","factory","createCipher","getDecoder","encoding","normalized","Error","update","data","inputEncoding","outputEncoding","defaultEncoding","ArrayBuffer","isView","ret","write","from","final","end","_transform","chunk","callback","push","err","_flush","setAutoPadding","autoPadding","res","setAAD","buffer","plaintextLength","getAuthTag","setAuthTag","tag","Cipheriv","Decipheriv","createDecipheriv","algorithm","createCipheriv","nonce","output","counter","result","Uint8Array"],"sourceRoot":"../../src","sources":["cipher.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AACzD,OAAOC,MAAM,MAAiC,iBAAiB;AAC/D,SAASC,aAAa,QAAQ,gBAAgB;AAC9C,SAASC,MAA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AAoB,CAAC,UAAU,EAAEuB,WAAW,CAACE,UAAU,EAAED,IAAI,CAACC,UAAU,CAAC;EAEzE,MAAMC,OAAO,GACXjD,YAAY,CAACW,kBAAkB,CAAgB,eAAe,CAAC;EACjE,MAAMD,MAAM,GAAGuC,OAAO,CAACC,YAAY,CAAC;IAClCX,QAAQ,EAAE,IAAI;IACdf,UAAU,EAAE,UAAU;IACtBgB,SAAS,EAAEM,WAAW;IACtBL,EAAE,EAAEM;EACN,CAAC,CAAC;EACF,MAAM2C,MAAM,GAAGhF,MAAM,CAAC6C,MAAM,CAACnD,uBAAuB,CAACoD,IAAI,CAAC,CAAC;EAC3D,OAAO,IAAImC,UAAU,CAACD,MAAM,CAAC;AAC/B","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const constants = {
|
|
4
|
+
// RSA Padding
|
|
5
|
+
RSA_PKCS1_PADDING: 1,
|
|
6
|
+
RSA_NO_PADDING: 3,
|
|
7
|
+
RSA_PKCS1_OAEP_PADDING: 4,
|
|
8
|
+
RSA_X931_PADDING: 5,
|
|
9
|
+
RSA_PKCS1_PSS_PADDING: 6,
|
|
10
|
+
// RSA PSS Salt Length
|
|
11
|
+
RSA_PSS_SALTLEN_DIGEST: -1,
|
|
12
|
+
RSA_PSS_SALTLEN_MAX_SIGN: -2,
|
|
13
|
+
RSA_PSS_SALTLEN_AUTO: -2,
|
|
14
|
+
// Point Conversion
|
|
15
|
+
POINT_CONVERSION_COMPRESSED: 2,
|
|
16
|
+
POINT_CONVERSION_UNCOMPRESSED: 4,
|
|
17
|
+
POINT_CONVERSION_HYBRID: 6,
|
|
18
|
+
// DH Check
|
|
19
|
+
DH_CHECK_P_NOT_PRIME: 1,
|
|
20
|
+
DH_CHECK_P_NOT_SAFE_PRIME: 2,
|
|
21
|
+
DH_UNABLE_TO_CHECK_GENERATOR: 4,
|
|
22
|
+
DH_NOT_SUITABLE_GENERATOR: 8,
|
|
23
|
+
// OpenSSL Version (3.0.0 = 0x30000000)
|
|
24
|
+
OPENSSL_VERSION_NUMBER: 0x30000000
|
|
25
|
+
};
|
|
26
|
+
export const defaultCoreCipherList = 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256';
|
|
27
|
+
export const defaultCipherList = 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256';
|
|
28
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["constants","RSA_PKCS1_PADDING","RSA_NO_PADDING","RSA_PKCS1_OAEP_PADDING","RSA_X931_PADDING","RSA_PKCS1_PSS_PADDING","RSA_PSS_SALTLEN_DIGEST","RSA_PSS_SALTLEN_MAX_SIGN","RSA_PSS_SALTLEN_AUTO","POINT_CONVERSION_COMPRESSED","POINT_CONVERSION_UNCOMPRESSED","POINT_CONVERSION_HYBRID","DH_CHECK_P_NOT_PRIME","DH_CHECK_P_NOT_SAFE_PRIME","DH_UNABLE_TO_CHECK_GENERATOR","DH_NOT_SUITABLE_GENERATOR","OPENSSL_VERSION_NUMBER","defaultCoreCipherList","defaultCipherList"],"sourceRoot":"../../src","sources":["constants.ts"],"mappings":";;AAAA,OAAO,MAAMA,SAAS,GAAG;EACvB;EACAC,iBAAiB,EAAE,CAAC;EACpBC,cAAc,EAAE,CAAC;EACjBC,sBAAsB,EAAE,CAAC;EACzBC,gBAAgB,EAAE,CAAC;EACnBC,qBAAqB,EAAE,CAAC;EAExB;EACAC,sBAAsB,EAAE,CAAC,CAAC;EAC1BC,wBAAwB,EAAE,CAAC,CAAC;EAC5BC,oBAAoB,EAAE,CAAC,CAAC;EAExB;EACAC,2BAA2B,EAAE,CAAC;EAC9BC,6BAA6B,EAAE,CAAC;EAChCC,uBAAuB,EAAE,CAAC;EAE1B;EACAC,oBAAoB,EAAE,CAAC;EACvBC,yBAAyB,EAAE,CAAC;EAC5BC,4BAA4B,EAAE,CAAC;EAC/BC,yBAAyB,EAAE,CAAC;EAE5B;EACAC,sBAAsB,EAAE;AAC1B,CAAU;AAEV,OAAO,MAAMC,qBAAqB,GAChC,4EAA4E;AAC9E,OAAO,MAAMC,iBAAiB,GAC5B,4EAA4E","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const DH_GROUPS = {
|
|
4
|
+
modp14: {
|
|
5
|
+
prime: 'ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff',
|
|
6
|
+
generator: '02'
|
|
7
|
+
},
|
|
8
|
+
modp15: {
|
|
9
|
+
prime: 'ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff',
|
|
10
|
+
generator: '02'
|
|
11
|
+
},
|
|
12
|
+
modp16: {
|
|
13
|
+
prime: 'ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff',
|
|
14
|
+
generator: '02'
|
|
15
|
+
},
|
|
16
|
+
modp17: {
|
|
17
|
+
prime: 'ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff',
|
|
18
|
+
generator: '02'
|
|
19
|
+
},
|
|
20
|
+
modp18: {
|
|
21
|
+
prime: 'ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff',
|
|
22
|
+
generator: '02'
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=dh-groups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DH_GROUPS","modp14","prime","generator","modp15","modp16","modp17","modp18"],"sourceRoot":"../../src","sources":["dh-groups.ts"],"mappings":";;AAAA,OAAO,MAAMA,SAA+D,GAAG;EAC7EC,MAAM,EAAE;IACNC,KAAK,EACH,kgBAAkgB;IACpgBC,SAAS,EAAE;EACb,CAAC;EACDC,MAAM,EAAE;IACNF,KAAK,EACH,kwBAAkwB;IACpwBC,SAAS,EAAE;EACb,CAAC;EACDE,MAAM,EAAE;IACNH,KAAK,EACH,kgCAAkgC;IACpgCC,SAAS,EAAE;EACb,CAAC;EACDG,MAAM,EAAE;IACNJ,KAAK,EACH,kgDAAkgD;IACpgDC,SAAS,EAAE;EACb,CAAC;EACDI,MAAM,EAAE;IACNL,KAAK,EACH,kgEAAkgE;IACpgEC,SAAS,EAAE;EACb;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
4
|
+
import { Buffer } from '@craftzdog/react-native-buffer';
|
|
5
|
+
import { KeyObject } from './keys/classes';
|
|
6
|
+
import { KFormatType, KeyEncoding } from './utils';
|
|
7
|
+
import { DH_GROUPS } from './dh-groups';
|
|
8
|
+
export class DhKeyPairGen {
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.native = NitroModules.createHybridObject('DhKeyPair');
|
|
11
|
+
const {
|
|
12
|
+
groupName,
|
|
13
|
+
prime,
|
|
14
|
+
primeLength,
|
|
15
|
+
generator
|
|
16
|
+
} = options;
|
|
17
|
+
if (groupName) {
|
|
18
|
+
// Resolve named group to prime + generator
|
|
19
|
+
const group = DH_GROUPS[groupName];
|
|
20
|
+
if (!group) {
|
|
21
|
+
throw new Error(`Unknown DH group: ${groupName}`);
|
|
22
|
+
}
|
|
23
|
+
const primeBuf = Buffer.from(group.prime, 'hex');
|
|
24
|
+
this.native.setPrime(primeBuf.buffer.slice(primeBuf.byteOffset, primeBuf.byteOffset + primeBuf.byteLength));
|
|
25
|
+
const gen = parseInt(group.generator, 16);
|
|
26
|
+
this.native.setGenerator(gen);
|
|
27
|
+
} else if (prime) {
|
|
28
|
+
// Custom prime as Buffer
|
|
29
|
+
const primeBuf = Buffer.from(prime);
|
|
30
|
+
this.native.setPrime(primeBuf.buffer.slice(primeBuf.byteOffset, primeBuf.byteOffset + primeBuf.byteLength));
|
|
31
|
+
this.native.setGenerator(generator ?? 2);
|
|
32
|
+
} else if (primeLength) {
|
|
33
|
+
this.native.setPrimeLength(primeLength);
|
|
34
|
+
this.native.setGenerator(generator ?? 2);
|
|
35
|
+
} else {
|
|
36
|
+
throw new Error('DH key generation requires one of: groupName, prime, or primeLength');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async generateKeyPair() {
|
|
40
|
+
await this.native.generateKeyPair();
|
|
41
|
+
}
|
|
42
|
+
generateKeyPairSync() {
|
|
43
|
+
this.native.generateKeyPairSync();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function dh_prepareKeyGenParams(options) {
|
|
47
|
+
if (!options) {
|
|
48
|
+
throw new Error('Options are required for DH key generation');
|
|
49
|
+
}
|
|
50
|
+
return new DhKeyPairGen(options);
|
|
51
|
+
}
|
|
52
|
+
function dh_formatKeyPairOutput(dh, encoding) {
|
|
53
|
+
const {
|
|
54
|
+
publicFormat,
|
|
55
|
+
privateFormat,
|
|
56
|
+
cipher,
|
|
57
|
+
passphrase
|
|
58
|
+
} = encoding;
|
|
59
|
+
const publicKeyData = dh.native.getPublicKey();
|
|
60
|
+
const privateKeyData = dh.native.getPrivateKey();
|
|
61
|
+
const pub = KeyObject.createKeyObject('public', publicKeyData, KFormatType.DER, KeyEncoding.SPKI);
|
|
62
|
+
const priv = KeyObject.createKeyObject('private', privateKeyData, KFormatType.DER, KeyEncoding.PKCS8);
|
|
63
|
+
let publicKey;
|
|
64
|
+
let privateKey;
|
|
65
|
+
if (publicFormat === 'raw-public' || privateFormat === 'raw-private' || privateFormat === 'raw-seed') {
|
|
66
|
+
throw new Error('Raw key formats are not supported for DH keys');
|
|
67
|
+
}
|
|
68
|
+
if (publicFormat === -1) {
|
|
69
|
+
publicKey = pub;
|
|
70
|
+
} else {
|
|
71
|
+
const format = publicFormat === KFormatType.PEM ? KFormatType.PEM : KFormatType.DER;
|
|
72
|
+
const exported = pub.handle.exportKey(format, KeyEncoding.SPKI);
|
|
73
|
+
if (format === KFormatType.PEM) {
|
|
74
|
+
publicKey = Buffer.from(new Uint8Array(exported)).toString('utf-8');
|
|
75
|
+
} else {
|
|
76
|
+
publicKey = exported;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (privateFormat === -1) {
|
|
80
|
+
privateKey = priv;
|
|
81
|
+
} else {
|
|
82
|
+
const format = privateFormat === KFormatType.PEM ? KFormatType.PEM : KFormatType.DER;
|
|
83
|
+
const exported = priv.handle.exportKey(format, KeyEncoding.PKCS8, cipher, passphrase);
|
|
84
|
+
if (format === KFormatType.PEM) {
|
|
85
|
+
privateKey = Buffer.from(new Uint8Array(exported)).toString('utf-8');
|
|
86
|
+
} else {
|
|
87
|
+
privateKey = exported;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
publicKey,
|
|
92
|
+
privateKey
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export async function dh_generateKeyPairNode(options, encoding) {
|
|
96
|
+
const dh = dh_prepareKeyGenParams(options);
|
|
97
|
+
await dh.generateKeyPair();
|
|
98
|
+
return dh_formatKeyPairOutput(dh, encoding);
|
|
99
|
+
}
|
|
100
|
+
export function dh_generateKeyPairNodeSync(options, encoding) {
|
|
101
|
+
const dh = dh_prepareKeyGenParams(options);
|
|
102
|
+
dh.generateKeyPairSync();
|
|
103
|
+
return dh_formatKeyPairOutput(dh, encoding);
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=dhKeyPair.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NitroModules","Buffer","KeyObject","KFormatType","KeyEncoding","DH_GROUPS","DhKeyPairGen","constructor","options","native","createHybridObject","groupName","prime","primeLength","generator","group","Error","primeBuf","from","setPrime","buffer","slice","byteOffset","byteLength","gen","parseInt","setGenerator","setPrimeLength","generateKeyPair","generateKeyPairSync","dh_prepareKeyGenParams","dh_formatKeyPairOutput","dh","encoding","publicFormat","privateFormat","cipher","passphrase","publicKeyData","getPublicKey","privateKeyData","getPrivateKey","pub","createKeyObject","DER","SPKI","priv","PKCS8","publicKey","privateKey","format","PEM","exported","handle","exportKey","Uint8Array","toString","dh_generateKeyPairNode","dh_generateKeyPairNodeSync"],"sourceRoot":"../../src","sources":["dhKeyPair.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AACzD,SAASC,MAAM,QAAQ,gCAAgC;AACvD,SAASC,SAAS,QAA2C,gBAAgB;AAG7E,SAASC,WAAW,EAAEC,WAAW,QAAQ,SAAS;AAClD,SAASC,SAAS,QAAQ,aAAa;AAEvC,OAAO,MAAMC,YAAY,CAAC;EAGxBC,WAAWA,CAACC,OAA+B,EAAE;IAC3C,IAAI,CAACC,MAAM,GAAGT,YAAY,CAACU,kBAAkB,CAAY,WAAW,CAAC;IAErE,MAAM;MAAEC,SAAS;MAAEC,KAAK;MAAEC,WAAW;MAAEC;IAAU,CAAC,GAAGN,OAAO;IA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EACA,MAAMD,EAAE,GAAGF,sBAAsB,CAACtB,OAAO,CAAC;EAC1CwB,EAAE,CAACH,mBAAmB,CAAC,CAAC;EACxB,OAAOE,sBAAsB,CAACC,EAAE,EAAEC,QAAQ,CAAC;AAC7C","ignoreList":[]}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
4
|
+
import { Buffer } from '@craftzdog/react-native-buffer';
|
|
5
|
+
import { DH_GROUPS } from './dh-groups';
|
|
6
|
+
import { toArrayBuffer } from './utils/conversion';
|
|
7
|
+
export class DiffieHellman {
|
|
8
|
+
constructor(sizeOrPrime, generator, encoding) {
|
|
9
|
+
this._hybrid = NitroModules.createHybridObject('DiffieHellman');
|
|
10
|
+
if (typeof sizeOrPrime === 'number') {
|
|
11
|
+
const gen = typeof generator === 'number' ? generator : 2;
|
|
12
|
+
this._hybrid.initWithSize(sizeOrPrime, gen);
|
|
13
|
+
} else {
|
|
14
|
+
let primeBuf;
|
|
15
|
+
if (Buffer.isBuffer(sizeOrPrime)) {
|
|
16
|
+
primeBuf = sizeOrPrime;
|
|
17
|
+
} else {
|
|
18
|
+
primeBuf = Buffer.from(sizeOrPrime, encoding);
|
|
19
|
+
}
|
|
20
|
+
let genBuf;
|
|
21
|
+
if (generator === undefined) {
|
|
22
|
+
genBuf = Buffer.from([2]);
|
|
23
|
+
} else if (typeof generator === 'number') {
|
|
24
|
+
genBuf = Buffer.from([generator]);
|
|
25
|
+
} else if (Buffer.isBuffer(generator)) {
|
|
26
|
+
genBuf = generator;
|
|
27
|
+
} else {
|
|
28
|
+
genBuf = Buffer.from(generator, encoding);
|
|
29
|
+
}
|
|
30
|
+
this._hybrid.init(toArrayBuffer(primeBuf), toArrayBuffer(genBuf));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
generateKeys(encoding) {
|
|
34
|
+
const keys = Buffer.from(this._hybrid.generateKeys());
|
|
35
|
+
if (encoding) return keys.toString(encoding);
|
|
36
|
+
return keys;
|
|
37
|
+
}
|
|
38
|
+
computeSecret(otherPublicKey, inputEncoding, outputEncoding) {
|
|
39
|
+
let keyBuf;
|
|
40
|
+
if (Buffer.isBuffer(otherPublicKey)) {
|
|
41
|
+
keyBuf = otherPublicKey;
|
|
42
|
+
} else {
|
|
43
|
+
keyBuf = Buffer.from(otherPublicKey, inputEncoding);
|
|
44
|
+
}
|
|
45
|
+
const secret = Buffer.from(this._hybrid.computeSecret(toArrayBuffer(keyBuf)));
|
|
46
|
+
if (outputEncoding) return secret.toString(outputEncoding);
|
|
47
|
+
return secret;
|
|
48
|
+
}
|
|
49
|
+
getPrime(encoding) {
|
|
50
|
+
const p = Buffer.from(this._hybrid.getPrime());
|
|
51
|
+
if (encoding) return p.toString(encoding);
|
|
52
|
+
return p;
|
|
53
|
+
}
|
|
54
|
+
getGenerator(encoding) {
|
|
55
|
+
const g = Buffer.from(this._hybrid.getGenerator());
|
|
56
|
+
if (encoding) return g.toString(encoding);
|
|
57
|
+
return g;
|
|
58
|
+
}
|
|
59
|
+
getPublicKey(encoding) {
|
|
60
|
+
const p = Buffer.from(this._hybrid.getPublicKey());
|
|
61
|
+
if (encoding) return p.toString(encoding);
|
|
62
|
+
return p;
|
|
63
|
+
}
|
|
64
|
+
getPrivateKey(encoding) {
|
|
65
|
+
const p = Buffer.from(this._hybrid.getPrivateKey());
|
|
66
|
+
if (encoding) return p.toString(encoding);
|
|
67
|
+
return p;
|
|
68
|
+
}
|
|
69
|
+
setPublicKey(publicKey, encoding) {
|
|
70
|
+
let keyBuf;
|
|
71
|
+
if (Buffer.isBuffer(publicKey)) {
|
|
72
|
+
keyBuf = publicKey;
|
|
73
|
+
} else {
|
|
74
|
+
keyBuf = Buffer.from(publicKey, encoding);
|
|
75
|
+
}
|
|
76
|
+
this._hybrid.setPublicKey(toArrayBuffer(keyBuf));
|
|
77
|
+
}
|
|
78
|
+
setPrivateKey(privateKey, encoding) {
|
|
79
|
+
let keyBuf;
|
|
80
|
+
if (Buffer.isBuffer(privateKey)) {
|
|
81
|
+
keyBuf = privateKey;
|
|
82
|
+
} else {
|
|
83
|
+
keyBuf = Buffer.from(privateKey, encoding);
|
|
84
|
+
}
|
|
85
|
+
this._hybrid.setPrivateKey(toArrayBuffer(keyBuf));
|
|
86
|
+
}
|
|
87
|
+
get verifyError() {
|
|
88
|
+
return this._hybrid.getVerifyError();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export function createDiffieHellman(primeOrSize, primeEncodingOrGenerator, generator, _generatorEncoding) {
|
|
92
|
+
if (typeof primeOrSize === 'number') {
|
|
93
|
+
const gen = typeof primeEncodingOrGenerator === 'number' ? primeEncodingOrGenerator : 2;
|
|
94
|
+
return new DiffieHellman(primeOrSize, gen);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Standardize arguments for String/Buffer prime
|
|
98
|
+
// createDiffieHellman(prime, [encoding], [generator], [encoding])
|
|
99
|
+
|
|
100
|
+
let prime;
|
|
101
|
+
let generatorVal;
|
|
102
|
+
if (Buffer.isBuffer(primeOrSize)) {
|
|
103
|
+
prime = primeOrSize;
|
|
104
|
+
// 2nd arg is generator if not string (encoding)
|
|
105
|
+
if (primeEncodingOrGenerator !== undefined && typeof primeEncodingOrGenerator !== 'string') {
|
|
106
|
+
generatorVal = primeEncodingOrGenerator;
|
|
107
|
+
} else if (generator !== undefined) {
|
|
108
|
+
generatorVal = generator;
|
|
109
|
+
} else {
|
|
110
|
+
generatorVal = 2;
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
// String prime
|
|
114
|
+
const encoding = typeof primeEncodingOrGenerator === 'string' ? primeEncodingOrGenerator : 'utf8'; // Defaulting to utf8 or hex? Node default is 'binary' usually but utf8 safer for TS. Node docs say: "If no encoding is specified, 'binary' is used."
|
|
115
|
+
// We'll trust user passed encoding if it's a string, otherwise handle it.
|
|
116
|
+
prime = Buffer.from(primeOrSize, encoding);
|
|
117
|
+
|
|
118
|
+
// Generator handling in this case
|
|
119
|
+
if (generator !== undefined) {
|
|
120
|
+
generatorVal = generator;
|
|
121
|
+
if (typeof generator === 'string' && _generatorEncoding) {
|
|
122
|
+
generatorVal = Buffer.from(generator, _generatorEncoding);
|
|
123
|
+
} else if (typeof generator === 'string') {
|
|
124
|
+
// string with no encoding, assume same as prime? or utf8?
|
|
125
|
+
generatorVal = Buffer.from(generator, encoding);
|
|
126
|
+
}
|
|
127
|
+
} else if (typeof primeEncodingOrGenerator !== 'string' && primeEncodingOrGenerator !== undefined) {
|
|
128
|
+
// 2nd arg was generator
|
|
129
|
+
generatorVal = primeEncodingOrGenerator;
|
|
130
|
+
} else {
|
|
131
|
+
generatorVal = 2;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return new DiffieHellman(prime, generatorVal);
|
|
135
|
+
}
|
|
136
|
+
export function getDiffieHellman(groupName) {
|
|
137
|
+
const group = DH_GROUPS[groupName];
|
|
138
|
+
if (!group) {
|
|
139
|
+
throw new Error(`Unknown group: ${groupName}`);
|
|
140
|
+
}
|
|
141
|
+
// group.prime and group.generator are hex strings
|
|
142
|
+
return new DiffieHellman(group.prime, group.generator, 'hex');
|
|
143
|
+
}
|
|
144
|
+
export { getDiffieHellman as createDiffieHellmanGroup };
|
|
145
|
+
//# sourceMappingURL=diffie-hellman.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NitroModules","Buffer","DH_GROUPS","toArrayBuffer","DiffieHellman","constructor","sizeOrPrime","generator","encoding","_hybrid","createHybridObject","gen","initWithSize","primeBuf","isBuffer","from","genBuf","undefined","init","generateKeys","keys","toString","computeSecret","otherPublicKey","inputEncoding","outputEncoding","keyBuf","secret","getPrime","p","getGenerator","g","getPublicKey","getPrivateKey","setPublicKey","publicKey","setPrivateKey","privateKey","verifyError","getVerifyError","createDiffieHellman","primeOrSize","primeEncodingOrGenerator","_generatorEncoding","prime","generatorVal","getDiffieHellman","groupName","group","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