@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 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNativeNitroModules","require","_classes","_utils","_reactNativeBuffer","_ecdh","EcUtils","native","_native","NitroModules","createHybridObject","getSupportedCurves","getCurves","Ec","constructor","curve","setCurve","generateKeyPair","publicKey","getPublicKey","privateKey","getPrivateKey","generateKeyPairSync","exports","ecImportKey","format","keyData","algorithm","extractable","keyUsages","name","namedCurve","kNamedCurveAliases","lazyDOMException","jwk","kty","crv","expectedUse","validateJwkStructure","alg","undefined","expectedAlg","isPublicJwk","d","validUsagesJwk","hasAnyNotIn","handle","keyType","initJwk","err","cause","keyObject","PublicKeyObject","PrivateKeyObject","CryptoKey","expectedKeyType","isPublicKey","validUsages","keyBuffer","bufferLikeToArrayBuffer","curveAlias","initECRaw","KeyObject","createKeyObject","KFormatType","DER","KeyEncoding","SPKI","PKCS8","expectedAlias","keyDetail","checkEcKeyData","ecdsaSignVerify","key","data","hash","signature","isSign","type","hashName","normalizedHashName","normalizeHashName","HashContext","WebCrypto","ec","encoding","exportKey","importKey","usages","dataBuffer","sign","signatureBuffer","verify","ec_generateKeyPair","_options","Object","keys","includes","publicUsages","privateUsages","getUsagesUnion","keyAlgorithm","publicKeyData","privateKeyData","pub","priv","ec_prepareKeyGenParams","options","Error","ec_formatKeyPairOutput","publicFormat","publicType","privateFormat","privateType","cipher","passphrase","Buffer","from","exportECPublicRaw","PEM","keyEncoding","exported","Uint8Array","toString","exportECPrivateRaw","SEC1","ec_generateKeyPairNode","ec_generateKeyPairNodeSync","ecDeriveBits","baseKey","length","public","opensslCurve","ecdh","ECDH","jwkPrivate","exportJwk","privateBytes","setPrivateKey","jwkPublic","x","y","publicBytes","concat","secret","computeSecret","secretBuf","buffer","byteLength","Math","ceil","slice","byteOffset"],"sourceRoot":"../../src","sources":["ec.ts"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AAGA,IAAAC,QAAA,GAAAD,OAAA;AAmBA,IAAAE,MAAA,GAAAF,OAAA;AAYA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,MAAMK,OAAO,CAAC;EAEZ,WAAmBC,MAAMA,CAAA,EAAc;IACrC,IAAI,CAAC,IAAI,CAACC,OAAO,EAAE;MACjB,IAAI,CAACA,OAAO,GAAGC,qCAAY,CAACC,kBAAkB,CAAY,WAAW,CAAC;IACxE;IACA,OAAO,IAAI,CAACF,OAAO;EACrB;EACA,OAAcG,kBAAkBA,CAAA,EAAa;IAC3C,OAAO,IAAI,CAACJ,MAAM,CAACI,kBAAkB,CAAC,CAAC;EACzC;AACF;AAEO,SAASC,SAASA,CAAA,EAAa;EACpC,OAAON,OAAO,CAACK,kBAAkB,CAAC,CAAC;AACrC;AAEO,MAAME,EAAE,CAAC;EAGdC,WAAWA,CAACC,KAAa,EAAE;IACzB,IAAI,CAACR,MAAM,GAAGE,qCAAY,CAACC,kBAAkB,CAAY,WAAW,CAAC;IACrE,IAAI,CAACH,MAAM,CAACS,QAAQ,CAACD,KAAK,CAAC;EAC7B;EAEA,MAAME,eAAeA,CAAA,EAA2B;IAC9C,MAAM,IAAI,CAACV,MAAM,CAACU,eAAe,CAAC,CAAC;IACnC,OAAO;MACLC,SAAS,EAAE,IAAI,CAACX,MAAM,CAACY,YAAY,CAAC,CAAC;MACrCC,UAAU,EAAE,IAAI,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AK,CAC3BL,SAAS,CAACM,UAAU,EACpBN,SAAS,CAACM,UAAU,GAAGJ,UACzB,CAAC;EACH;EAEA,MAAM,IAAIxC,KAAK,CAAC,8CAA8C,CAAC;AACjE","ignoreList":[]}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ECDH = void 0;
|
|
7
|
+
exports.createECDH = createECDH;
|
|
8
|
+
var _reactNativeNitroModules = require("./nitro-node-shim");
|
|
9
|
+
var _reactNativeBuffer = require("@craftzdog/react-native-buffer");
|
|
10
|
+
var _conversion = require("./utils/conversion");
|
|
11
|
+
const POINT_CONVERSION_COMPRESSED = 2;
|
|
12
|
+
const POINT_CONVERSION_UNCOMPRESSED = 4;
|
|
13
|
+
const POINT_CONVERSION_HYBRID = 6;
|
|
14
|
+
class ECDH {
|
|
15
|
+
static get convertKeyHybrid() {
|
|
16
|
+
if (!this._convertKeyHybrid) {
|
|
17
|
+
this._convertKeyHybrid = _reactNativeNitroModules.NitroModules.createHybridObject('ECDH');
|
|
18
|
+
}
|
|
19
|
+
return this._convertKeyHybrid;
|
|
20
|
+
}
|
|
21
|
+
constructor(curveName) {
|
|
22
|
+
this._hybrid = _reactNativeNitroModules.NitroModules.createHybridObject('ECDH');
|
|
23
|
+
this._hybrid.init(curveName);
|
|
24
|
+
}
|
|
25
|
+
generateKeys() {
|
|
26
|
+
const key = this._hybrid.generateKeys();
|
|
27
|
+
return _reactNativeBuffer.Buffer.from(key);
|
|
28
|
+
}
|
|
29
|
+
computeSecret(otherPublicKey, inputEncoding) {
|
|
30
|
+
let keyBuf;
|
|
31
|
+
if (_reactNativeBuffer.Buffer.isBuffer(otherPublicKey)) {
|
|
32
|
+
keyBuf = otherPublicKey;
|
|
33
|
+
} else if (typeof otherPublicKey === 'string') {
|
|
34
|
+
keyBuf = _reactNativeBuffer.Buffer.from(otherPublicKey, inputEncoding);
|
|
35
|
+
} else {
|
|
36
|
+
// Handle array view or other types if necessary, but Node.js typically expects Buffer or string + encoding
|
|
37
|
+
throw new TypeError('Invalid otherPublicKey type');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// ECDH.computeSecret in Node.js returns Buffer
|
|
41
|
+
const secret = this._hybrid.computeSecret((0, _conversion.toArrayBuffer)(keyBuf));
|
|
42
|
+
return _reactNativeBuffer.Buffer.from(secret);
|
|
43
|
+
}
|
|
44
|
+
getPrivateKey() {
|
|
45
|
+
return _reactNativeBuffer.Buffer.from(this._hybrid.getPrivateKey());
|
|
46
|
+
}
|
|
47
|
+
setPrivateKey(privateKey, encoding) {
|
|
48
|
+
let keyBuf;
|
|
49
|
+
if (_reactNativeBuffer.Buffer.isBuffer(privateKey)) {
|
|
50
|
+
keyBuf = privateKey;
|
|
51
|
+
} else {
|
|
52
|
+
keyBuf = _reactNativeBuffer.Buffer.from(privateKey, encoding);
|
|
53
|
+
}
|
|
54
|
+
this._hybrid.setPrivateKey((0, _conversion.toArrayBuffer)(keyBuf));
|
|
55
|
+
}
|
|
56
|
+
getPublicKey(encoding) {
|
|
57
|
+
// Node.js getPublicKey([encoding[, format]])
|
|
58
|
+
// If encoding is provided, returns string. If not, Buffer.
|
|
59
|
+
// Our C++ returns ArrayBuffer (Buffer).
|
|
60
|
+
// We ignore format for now as C++ implementation defaults to uncompressed.
|
|
61
|
+
const pub = _reactNativeBuffer.Buffer.from(this._hybrid.getPublicKey());
|
|
62
|
+
if (encoding) {
|
|
63
|
+
return pub.toString(encoding);
|
|
64
|
+
}
|
|
65
|
+
return pub;
|
|
66
|
+
}
|
|
67
|
+
setPublicKey(publicKey, encoding) {
|
|
68
|
+
let keyBuf;
|
|
69
|
+
if (_reactNativeBuffer.Buffer.isBuffer(publicKey)) {
|
|
70
|
+
keyBuf = publicKey;
|
|
71
|
+
} else {
|
|
72
|
+
keyBuf = _reactNativeBuffer.Buffer.from(publicKey, encoding);
|
|
73
|
+
}
|
|
74
|
+
this._hybrid.setPublicKey((0, _conversion.toArrayBuffer)(keyBuf));
|
|
75
|
+
}
|
|
76
|
+
static convertKey(key, curve, inputEncoding, outputEncoding, format) {
|
|
77
|
+
let keyBuf;
|
|
78
|
+
if (_reactNativeBuffer.Buffer.isBuffer(key)) {
|
|
79
|
+
keyBuf = key;
|
|
80
|
+
} else {
|
|
81
|
+
keyBuf = _reactNativeBuffer.Buffer.from(key, inputEncoding);
|
|
82
|
+
}
|
|
83
|
+
let formatNum;
|
|
84
|
+
switch (format) {
|
|
85
|
+
case 'compressed':
|
|
86
|
+
formatNum = POINT_CONVERSION_COMPRESSED;
|
|
87
|
+
break;
|
|
88
|
+
case 'hybrid':
|
|
89
|
+
formatNum = POINT_CONVERSION_HYBRID;
|
|
90
|
+
break;
|
|
91
|
+
case 'uncompressed':
|
|
92
|
+
case undefined:
|
|
93
|
+
formatNum = POINT_CONVERSION_UNCOMPRESSED;
|
|
94
|
+
break;
|
|
95
|
+
default:
|
|
96
|
+
throw new TypeError(`Invalid point conversion format: ${format}`);
|
|
97
|
+
}
|
|
98
|
+
const result = _reactNativeBuffer.Buffer.from(ECDH.convertKeyHybrid.convertKey((0, _conversion.toArrayBuffer)(keyBuf), curve, formatNum));
|
|
99
|
+
if (outputEncoding) {
|
|
100
|
+
return result.toString(outputEncoding);
|
|
101
|
+
}
|
|
102
|
+
return result;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.ECDH = ECDH;
|
|
106
|
+
function createECDH(curveName) {
|
|
107
|
+
return new ECDH(curveName);
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=ecdh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNativeNitroModules","require","_reactNativeBuffer","_conversion","POINT_CONVERSION_COMPRESSED","POINT_CONVERSION_UNCOMPRESSED","POINT_CONVERSION_HYBRID","ECDH","convertKeyHybrid","_convertKeyHybrid","NitroModules","createHybridObject","constructor","curveName","_hybrid","init","generateKeys","key","Buffer","from","computeSecret","otherPublicKey","inputEncoding","keyBuf","isBuffer","TypeError","secret","toArrayBuffer","getPrivateKey","setPrivateKey","privateKey","encoding","getPublicKey","pub","toString","setPublicKey","publicKey","convertKey","curve","outputEncoding","format","formatNum","undefined","result","exports","createECDH"],"sourceRoot":"../../src","sources":["ecdh.ts"],"mappings":";;;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AAEA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAEA,MAAMG,2BAA2B,GAAG,CAAC;AACrC,MAAMC,6BAA6B,GAAG,CAAC;AACvC,MAAMC,uBAAuB,GAAG,CAAC;AAE1B,MAAMC,IAAI,CAAC;EAEhB,WAAmBC,gBAAgBA,CAAA,EAAkB;IACnD,IAAI,CAAC,IAAI,CAACC,iBAAiB,EAAE;MAC3B,IAAI,CAACA,iBAAiB,GACpBC,qCAAY,CAACC,kBAAkB,CAAgB,MAAM,CAAC;IAC1D;IACA,OAAO,IAAI,CAACF,iBAAiB;EAC/B;EAIAG,WAAWA,CAACC,SAAiB,EAAE;IAC7B,IAAI,CAACC,OAAO,GAAGJ,qCAAY,CAACC,kBAAkB,CAAgB,MAAM,CAAC;IACrE,IAAI,CAACG,OAAO,CAACC,IAAI,CAACF,SAAS,CAAC;EAC9B;EAEAG,YAAYA,CAAA,EAAW;IACrB,MAAMC,GAAG,GAAG,IAAI,CAACH,OAAO,CAACE,YAAY,CAAC,CAAC;IACvC,OAAOE,yBAAM,CAACC,IAAI,CAACF,GAAG,CAAC;EACzB;EAEAG,aAAaA,CACXC,cAAsE,EACtEC,aAA8B,EACtB;IACR,IAAIC,MAAc;IAClB,IAAIL,yBAAM,CAACM,QAAQ,CAACH,cAAc,CAAC,EAAE;MACnCE,MAAM,GAAGF,cAAc;IACzB,CAAC,MAAM,IAAI,OAAOA,cAAc,KAAK,QAAQ,EAAE;MAC7CE,MAAM,GAAGL,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|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Ed = void 0;
|
|
7
|
+
exports.diffieHellman = diffieHellman;
|
|
8
|
+
exports.ed_generateKeyPair = ed_generateKeyPair;
|
|
9
|
+
exports.ed_generateKeyPairWebCrypto = ed_generateKeyPairWebCrypto;
|
|
10
|
+
exports.xDeriveBits = xDeriveBits;
|
|
11
|
+
exports.x_generateKeyPairWebCrypto = x_generateKeyPairWebCrypto;
|
|
12
|
+
var _reactNativeNitroModules = require("./nitro-node-shim");
|
|
13
|
+
var _reactNativeBuffer = require("@craftzdog/react-native-buffer");
|
|
14
|
+
var _classes = require("./keys/classes");
|
|
15
|
+
var _utils = require("./utils");
|
|
16
|
+
var _ecdh = require("./ecdh");
|
|
17
|
+
function coerceToNumeric(value) {
|
|
18
|
+
return typeof value === 'number' ? value : -1;
|
|
19
|
+
}
|
|
20
|
+
class Ed {
|
|
21
|
+
constructor(type, config) {
|
|
22
|
+
this.type = type;
|
|
23
|
+
this.config = config;
|
|
24
|
+
this.native = _reactNativeNitroModules.NitroModules.createHybridObject('EdKeyPair');
|
|
25
|
+
this.native.setCurve(type);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Computes the Diffie-Hellman secret based on a privateKey and a publicKey.
|
|
30
|
+
* Both keys must have the same asymmetricKeyType, which must be one of 'dh'
|
|
31
|
+
* (for Diffie-Hellman), 'ec', 'x448', or 'x25519' (for ECDH).
|
|
32
|
+
*
|
|
33
|
+
* @api nodejs/node
|
|
34
|
+
*
|
|
35
|
+
* @param options `{ privateKey, publicKey }`, both of which are `KeyObject`s
|
|
36
|
+
* @param callback optional `(err, secret) => void`
|
|
37
|
+
* @returns `Buffer` if no callback, or `void` if callback is provided
|
|
38
|
+
*/
|
|
39
|
+
diffieHellman(options, callback) {
|
|
40
|
+
// extract raw key bytes from KeyObject instances
|
|
41
|
+
const privKeyObj = options.privateKey;
|
|
42
|
+
const pubKeyObj = options.publicKey;
|
|
43
|
+
const privateKey = privKeyObj.handle.exportKey();
|
|
44
|
+
const publicKey = pubKeyObj.handle.exportKey();
|
|
45
|
+
try {
|
|
46
|
+
const ret = this.native.diffieHellman(privateKey, publicKey);
|
|
47
|
+
if (!ret) {
|
|
48
|
+
throw new Error('No secret');
|
|
49
|
+
}
|
|
50
|
+
if (callback) {
|
|
51
|
+
callback(null, _reactNativeBuffer.Buffer.from(ret));
|
|
52
|
+
} else {
|
|
53
|
+
return _reactNativeBuffer.Buffer.from(ret);
|
|
54
|
+
}
|
|
55
|
+
} catch (e) {
|
|
56
|
+
const err = e;
|
|
57
|
+
if (callback) {
|
|
58
|
+
callback(err, undefined);
|
|
59
|
+
} else {
|
|
60
|
+
throw err;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async generateKeyPair() {
|
|
65
|
+
await this.native.generateKeyPair(coerceToNumeric(this.config.publicFormat), coerceToNumeric(this.config.publicType), coerceToNumeric(this.config.privateFormat), coerceToNumeric(this.config.privateType), this.config.cipher, this.config.passphrase);
|
|
66
|
+
}
|
|
67
|
+
generateKeyPairSync() {
|
|
68
|
+
this.native.generateKeyPairSync(coerceToNumeric(this.config.publicFormat), coerceToNumeric(this.config.publicType), coerceToNumeric(this.config.privateFormat), coerceToNumeric(this.config.privateType), this.config.cipher, this.config.passphrase);
|
|
69
|
+
}
|
|
70
|
+
getPublicKey() {
|
|
71
|
+
return this.native.getPublicKey();
|
|
72
|
+
}
|
|
73
|
+
getPrivateKey() {
|
|
74
|
+
return this.native.getPrivateKey();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Computes the Diffie-Hellman shared secret based on a privateKey and a
|
|
79
|
+
* publicKey for key exchange
|
|
80
|
+
*
|
|
81
|
+
* @api \@paulmillr/noble-curves/ed25519
|
|
82
|
+
*
|
|
83
|
+
* @param privateKey
|
|
84
|
+
* @param publicKey
|
|
85
|
+
* @returns shared secret key
|
|
86
|
+
*/
|
|
87
|
+
getSharedSecret(privateKey, publicKey) {
|
|
88
|
+
return this.native.diffieHellman((0, _utils.binaryLikeToArrayBuffer)(privateKey), (0, _utils.binaryLikeToArrayBuffer)(publicKey));
|
|
89
|
+
}
|
|
90
|
+
async sign(message, key) {
|
|
91
|
+
return key ? this.native.sign((0, _utils.binaryLikeToArrayBuffer)(message), (0, _utils.binaryLikeToArrayBuffer)(key)) : this.native.sign((0, _utils.binaryLikeToArrayBuffer)(message));
|
|
92
|
+
}
|
|
93
|
+
signSync(message, key) {
|
|
94
|
+
return key ? this.native.signSync((0, _utils.binaryLikeToArrayBuffer)(message), (0, _utils.binaryLikeToArrayBuffer)(key)) : this.native.signSync((0, _utils.binaryLikeToArrayBuffer)(message));
|
|
95
|
+
}
|
|
96
|
+
async verify(signature, message, key) {
|
|
97
|
+
return key ? this.native.verify((0, _utils.binaryLikeToArrayBuffer)(signature), (0, _utils.binaryLikeToArrayBuffer)(message), (0, _utils.binaryLikeToArrayBuffer)(key)) : this.native.verify((0, _utils.binaryLikeToArrayBuffer)(signature), (0, _utils.binaryLikeToArrayBuffer)(message));
|
|
98
|
+
}
|
|
99
|
+
verifySync(signature, message, key) {
|
|
100
|
+
return key ? this.native.verifySync((0, _utils.binaryLikeToArrayBuffer)(signature), (0, _utils.binaryLikeToArrayBuffer)(message), (0, _utils.binaryLikeToArrayBuffer)(key)) : this.native.verifySync((0, _utils.binaryLikeToArrayBuffer)(signature), (0, _utils.binaryLikeToArrayBuffer)(message));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Node API
|
|
105
|
+
exports.Ed = Ed;
|
|
106
|
+
function diffieHellman(options, callback) {
|
|
107
|
+
if (!options || typeof options !== 'object') {
|
|
108
|
+
throw new TypeError('options must be an object');
|
|
109
|
+
}
|
|
110
|
+
if (callback !== undefined && typeof callback !== 'function') {
|
|
111
|
+
throw new TypeError('callback must be a function');
|
|
112
|
+
}
|
|
113
|
+
const resolvedOptions = {
|
|
114
|
+
publicKey: resolveDhKeyInput(options.publicKey, 'publicKey'),
|
|
115
|
+
privateKey: resolveDhKeyInput(options.privateKey, 'privateKey')
|
|
116
|
+
};
|
|
117
|
+
checkDiffieHellmanOptions(resolvedOptions);
|
|
118
|
+
const privateKey = resolvedOptions.privateKey;
|
|
119
|
+
const keyType = privateKey.asymmetricKeyType;
|
|
120
|
+
if (keyType === 'ec') {
|
|
121
|
+
return ecDiffieHellman(resolvedOptions, callback);
|
|
122
|
+
}
|
|
123
|
+
if (keyType === 'dh') {
|
|
124
|
+
throw new Error('crypto.diffieHellman with DH KeyObjects is not supported yet — use the DiffieHellman class for now');
|
|
125
|
+
}
|
|
126
|
+
const type = keyType;
|
|
127
|
+
const ed = new Ed(type, {});
|
|
128
|
+
return ed.diffieHellman(resolvedOptions, callback);
|
|
129
|
+
}
|
|
130
|
+
function isRawKeyInput(value) {
|
|
131
|
+
if (!value || typeof value !== 'object') return false;
|
|
132
|
+
const obj = value;
|
|
133
|
+
return obj.format === 'raw-public' || obj.format === 'raw-private' || obj.format === 'raw-seed';
|
|
134
|
+
}
|
|
135
|
+
function resolveDhKeyInput(input, name) {
|
|
136
|
+
if (isRawKeyInput(input)) {
|
|
137
|
+
const expectedKeyType = name === 'publicKey' ? 'public' : 'private';
|
|
138
|
+
if (input.format === 'raw-public' && expectedKeyType !== 'public') {
|
|
139
|
+
throw new Error(`Invalid format 'raw-public' for ${name}`);
|
|
140
|
+
}
|
|
141
|
+
if ((input.format === 'raw-private' || input.format === 'raw-seed') && expectedKeyType !== 'private') {
|
|
142
|
+
throw new Error(`Invalid format '${input.format}' for ${name}`);
|
|
143
|
+
}
|
|
144
|
+
if (input.asymmetricKeyType === 'ec' && !input.namedCurve) {
|
|
145
|
+
throw new Error(`namedCurve is required for EC raw key in ${name}`);
|
|
146
|
+
}
|
|
147
|
+
const handle = _reactNativeNitroModules.NitroModules.createHybridObject('KeyObjectHandle');
|
|
148
|
+
const keyData = (0, _utils.binaryLikeToArrayBuffer)(input.key);
|
|
149
|
+
if (input.format === 'raw-public') {
|
|
150
|
+
handle.initRawPublic(input.asymmetricKeyType, keyData, input.namedCurve);
|
|
151
|
+
return new _classes.PublicKeyObject(handle);
|
|
152
|
+
}
|
|
153
|
+
if (input.format === 'raw-seed') {
|
|
154
|
+
handle.initRawSeed(input.asymmetricKeyType, keyData);
|
|
155
|
+
return new _classes.PrivateKeyObject(handle);
|
|
156
|
+
}
|
|
157
|
+
handle.initRawPrivate(input.asymmetricKeyType, keyData, input.namedCurve);
|
|
158
|
+
return new _classes.PrivateKeyObject(handle);
|
|
159
|
+
}
|
|
160
|
+
return input;
|
|
161
|
+
}
|
|
162
|
+
function ed_createKeyObjects(ed) {
|
|
163
|
+
const publicKeyData = ed.getPublicKey();
|
|
164
|
+
const privateKeyData = ed.getPrivateKey();
|
|
165
|
+
const pub = _classes.KeyObject.createKeyObject('public', publicKeyData, _utils.KFormatType.DER, _utils.KeyEncoding.SPKI);
|
|
166
|
+
const priv = _classes.KeyObject.createKeyObject('private', privateKeyData, _utils.KFormatType.DER, _utils.KeyEncoding.PKCS8);
|
|
167
|
+
return {
|
|
168
|
+
pub,
|
|
169
|
+
priv
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Node API
|
|
174
|
+
function ed_formatKeyPairOutput(ed, encoding) {
|
|
175
|
+
const {
|
|
176
|
+
publicFormat,
|
|
177
|
+
privateFormat,
|
|
178
|
+
cipher,
|
|
179
|
+
passphrase
|
|
180
|
+
} = encoding;
|
|
181
|
+
const {
|
|
182
|
+
pub,
|
|
183
|
+
priv
|
|
184
|
+
} = ed_createKeyObjects(ed);
|
|
185
|
+
let publicKey;
|
|
186
|
+
let privateKey;
|
|
187
|
+
if (publicFormat == null || publicFormat === -1) {
|
|
188
|
+
publicKey = pub;
|
|
189
|
+
} else if (publicFormat === 'raw-public') {
|
|
190
|
+
publicKey = _reactNativeBuffer.Buffer.from(pub.handle.exportRawPublic());
|
|
191
|
+
} else {
|
|
192
|
+
const format = publicFormat === _utils.KFormatType.PEM ? _utils.KFormatType.PEM : _utils.KFormatType.DER;
|
|
193
|
+
const exported = pub.handle.exportKey(format, _utils.KeyEncoding.SPKI);
|
|
194
|
+
if (format === _utils.KFormatType.PEM) {
|
|
195
|
+
publicKey = _reactNativeBuffer.Buffer.from(new Uint8Array(exported)).toString('utf-8');
|
|
196
|
+
} else {
|
|
197
|
+
publicKey = exported;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (privateFormat == null || privateFormat === -1) {
|
|
201
|
+
privateKey = priv;
|
|
202
|
+
} else if (privateFormat === 'raw-private') {
|
|
203
|
+
privateKey = _reactNativeBuffer.Buffer.from(priv.handle.exportRawPrivate());
|
|
204
|
+
} else if (privateFormat === 'raw-seed') {
|
|
205
|
+
privateKey = _reactNativeBuffer.Buffer.from(priv.handle.exportRawSeed());
|
|
206
|
+
} else {
|
|
207
|
+
const format = privateFormat === _utils.KFormatType.PEM ? _utils.KFormatType.PEM : _utils.KFormatType.DER;
|
|
208
|
+
const exported = priv.handle.exportKey(format, _utils.KeyEncoding.PKCS8, cipher, passphrase);
|
|
209
|
+
if (format === _utils.KFormatType.PEM) {
|
|
210
|
+
privateKey = _reactNativeBuffer.Buffer.from(new Uint8Array(exported)).toString('utf-8');
|
|
211
|
+
} else {
|
|
212
|
+
privateKey = exported;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return {
|
|
216
|
+
publicKey,
|
|
217
|
+
privateKey
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
function ed_generateKeyPair(isAsync, type, encoding, callback) {
|
|
221
|
+
const derConfig = {
|
|
222
|
+
...encoding,
|
|
223
|
+
publicFormat: _utils.KFormatType.DER,
|
|
224
|
+
publicType: _utils.KeyEncoding.SPKI,
|
|
225
|
+
privateFormat: _utils.KFormatType.DER,
|
|
226
|
+
privateType: _utils.KeyEncoding.PKCS8
|
|
227
|
+
};
|
|
228
|
+
const ed = new Ed(type, derConfig);
|
|
229
|
+
if (isAsync) {
|
|
230
|
+
if (!callback) {
|
|
231
|
+
throw new Error('A callback is required for async key generation.');
|
|
232
|
+
}
|
|
233
|
+
ed.generateKeyPair().then(() => {
|
|
234
|
+
const {
|
|
235
|
+
publicKey,
|
|
236
|
+
privateKey
|
|
237
|
+
} = ed_formatKeyPairOutput(ed, encoding);
|
|
238
|
+
callback(undefined, publicKey, privateKey);
|
|
239
|
+
}).catch(err => {
|
|
240
|
+
callback(err, undefined, undefined);
|
|
241
|
+
});
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
let err;
|
|
245
|
+
try {
|
|
246
|
+
ed.generateKeyPairSync();
|
|
247
|
+
} catch (e) {
|
|
248
|
+
err = e instanceof Error ? e : new Error(String(e));
|
|
249
|
+
}
|
|
250
|
+
const {
|
|
251
|
+
publicKey,
|
|
252
|
+
privateKey
|
|
253
|
+
} = err ? {
|
|
254
|
+
publicKey: undefined,
|
|
255
|
+
privateKey: undefined
|
|
256
|
+
} : ed_formatKeyPairOutput(ed, encoding);
|
|
257
|
+
if (callback) {
|
|
258
|
+
callback(err, publicKey, privateKey);
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
return [err, publicKey, privateKey];
|
|
262
|
+
}
|
|
263
|
+
function ecDiffieHellman(options, callback) {
|
|
264
|
+
const privateKey = options.privateKey;
|
|
265
|
+
const publicKey = options.publicKey;
|
|
266
|
+
const curveName = privateKey.namedCurve;
|
|
267
|
+
if (!curveName) {
|
|
268
|
+
throw new Error('Unable to determine EC curve name from private key');
|
|
269
|
+
}
|
|
270
|
+
const ecdh = new _ecdh.ECDH(curveName);
|
|
271
|
+
const jwkPrivate = privateKey.handle.exportJwk({}, false);
|
|
272
|
+
if (!jwkPrivate.d) throw new Error('Invalid private key');
|
|
273
|
+
ecdh.setPrivateKey(_reactNativeBuffer.Buffer.from(jwkPrivate.d, 'base64url'));
|
|
274
|
+
const jwkPublic = publicKey.handle.exportJwk({}, false);
|
|
275
|
+
if (!jwkPublic.x || !jwkPublic.y) throw new Error('Invalid public key');
|
|
276
|
+
const x = _reactNativeBuffer.Buffer.from(jwkPublic.x, 'base64url');
|
|
277
|
+
const y = _reactNativeBuffer.Buffer.from(jwkPublic.y, 'base64url');
|
|
278
|
+
const publicBytes = _reactNativeBuffer.Buffer.concat([_reactNativeBuffer.Buffer.from([0x04]), x, y]);
|
|
279
|
+
try {
|
|
280
|
+
const secret = ecdh.computeSecret(publicBytes);
|
|
281
|
+
if (callback) {
|
|
282
|
+
callback(null, secret);
|
|
283
|
+
} else {
|
|
284
|
+
return secret;
|
|
285
|
+
}
|
|
286
|
+
} catch (e) {
|
|
287
|
+
const err = e;
|
|
288
|
+
if (callback) {
|
|
289
|
+
callback(err, undefined);
|
|
290
|
+
} else {
|
|
291
|
+
throw err;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
function checkDiffieHellmanOptions(options) {
|
|
296
|
+
const {
|
|
297
|
+
privateKey,
|
|
298
|
+
publicKey
|
|
299
|
+
} = options;
|
|
300
|
+
|
|
301
|
+
// Check if keys are KeyObject instances
|
|
302
|
+
if (!privateKey || typeof privateKey !== 'object' || !('type' in privateKey)) {
|
|
303
|
+
throw new Error('privateKey must be a KeyObject');
|
|
304
|
+
}
|
|
305
|
+
if (!publicKey || typeof publicKey !== 'object' || !('type' in publicKey)) {
|
|
306
|
+
throw new Error('publicKey must be a KeyObject');
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// type checks
|
|
310
|
+
if (privateKey.type !== 'private') {
|
|
311
|
+
throw new Error('privateKey must be a private KeyObject');
|
|
312
|
+
}
|
|
313
|
+
if (publicKey.type !== 'public') {
|
|
314
|
+
throw new Error('publicKey must be a public KeyObject');
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// For asymmetric keys, check if they have the asymmetricKeyType property
|
|
318
|
+
const privateKeyAsym = privateKey;
|
|
319
|
+
const publicKeyAsym = publicKey;
|
|
320
|
+
|
|
321
|
+
// key types must match
|
|
322
|
+
if (privateKeyAsym.asymmetricKeyType && publicKeyAsym.asymmetricKeyType && privateKeyAsym.asymmetricKeyType !== publicKeyAsym.asymmetricKeyType) {
|
|
323
|
+
throw new Error('Keys must be asymmetric and their types must match');
|
|
324
|
+
}
|
|
325
|
+
switch (privateKeyAsym.asymmetricKeyType) {
|
|
326
|
+
// case 'dh': // TODO: uncomment when implemented
|
|
327
|
+
case 'ec':
|
|
328
|
+
{
|
|
329
|
+
const privateCurve = privateKeyAsym.namedCurve;
|
|
330
|
+
const publicCurve = publicKeyAsym.namedCurve;
|
|
331
|
+
if (privateCurve && publicCurve && privateCurve !== publicCurve) {
|
|
332
|
+
throw new Error('Private and public key curves do not match');
|
|
333
|
+
}
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
case 'x25519':
|
|
337
|
+
case 'x448':
|
|
338
|
+
break;
|
|
339
|
+
default:
|
|
340
|
+
throw new Error(`Unknown curve type: ${privateKeyAsym.asymmetricKeyType}`);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
async function ed_generateKeyPairWebCrypto(type, extractable, keyUsages) {
|
|
344
|
+
if ((0, _utils.hasAnyNotIn)(keyUsages, ['sign', 'verify'])) {
|
|
345
|
+
throw (0, _utils.lazyDOMException)(`Unsupported key usage for ${type}`, 'SyntaxError');
|
|
346
|
+
}
|
|
347
|
+
const publicUsages = (0, _utils.getUsagesUnion)(keyUsages, 'verify');
|
|
348
|
+
const privateUsages = (0, _utils.getUsagesUnion)(keyUsages, 'sign');
|
|
349
|
+
if (privateUsages.length === 0) {
|
|
350
|
+
throw (0, _utils.lazyDOMException)('Usages cannot be empty', 'SyntaxError');
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// Request DER-encoded SPKI for public key, PKCS8 for private key
|
|
354
|
+
const config = {
|
|
355
|
+
publicFormat: _utils.KFormatType.DER,
|
|
356
|
+
publicType: _utils.KeyEncoding.SPKI,
|
|
357
|
+
privateFormat: _utils.KFormatType.DER,
|
|
358
|
+
privateType: _utils.KeyEncoding.PKCS8
|
|
359
|
+
};
|
|
360
|
+
const ed = new Ed(type, config);
|
|
361
|
+
await ed.generateKeyPair();
|
|
362
|
+
const algorithmName = type === 'ed25519' ? 'Ed25519' : 'Ed448';
|
|
363
|
+
const {
|
|
364
|
+
pub,
|
|
365
|
+
priv
|
|
366
|
+
} = ed_createKeyObjects(ed);
|
|
367
|
+
const publicKey = new _classes.CryptoKey(pub, {
|
|
368
|
+
name: algorithmName
|
|
369
|
+
}, publicUsages, true);
|
|
370
|
+
const privateKey = new _classes.CryptoKey(priv, {
|
|
371
|
+
name: algorithmName
|
|
372
|
+
}, privateUsages, extractable);
|
|
373
|
+
return {
|
|
374
|
+
publicKey,
|
|
375
|
+
privateKey
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
async function x_generateKeyPairWebCrypto(type, extractable, keyUsages) {
|
|
379
|
+
if ((0, _utils.hasAnyNotIn)(keyUsages, ['deriveKey', 'deriveBits'])) {
|
|
380
|
+
throw (0, _utils.lazyDOMException)(`Unsupported key usage for ${type}`, 'SyntaxError');
|
|
381
|
+
}
|
|
382
|
+
const publicUsages = (0, _utils.getUsagesUnion)(keyUsages);
|
|
383
|
+
const privateUsages = (0, _utils.getUsagesUnion)(keyUsages, 'deriveKey', 'deriveBits');
|
|
384
|
+
if (privateUsages.length === 0) {
|
|
385
|
+
throw (0, _utils.lazyDOMException)('Usages cannot be empty', 'SyntaxError');
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// Request DER-encoded SPKI for public key, PKCS8 for private key
|
|
389
|
+
const config = {
|
|
390
|
+
publicFormat: _utils.KFormatType.DER,
|
|
391
|
+
publicType: _utils.KeyEncoding.SPKI,
|
|
392
|
+
privateFormat: _utils.KFormatType.DER,
|
|
393
|
+
privateType: _utils.KeyEncoding.PKCS8
|
|
394
|
+
};
|
|
395
|
+
const ed = new Ed(type, config);
|
|
396
|
+
await ed.generateKeyPair();
|
|
397
|
+
const algorithmName = type === 'x25519' ? 'X25519' : 'X448';
|
|
398
|
+
const {
|
|
399
|
+
pub,
|
|
400
|
+
priv
|
|
401
|
+
} = ed_createKeyObjects(ed);
|
|
402
|
+
const publicKey = new _classes.CryptoKey(pub, {
|
|
403
|
+
name: algorithmName
|
|
404
|
+
}, publicUsages, true);
|
|
405
|
+
const privateKey = new _classes.CryptoKey(priv, {
|
|
406
|
+
name: algorithmName
|
|
407
|
+
}, privateUsages, extractable);
|
|
408
|
+
return {
|
|
409
|
+
publicKey,
|
|
410
|
+
privateKey
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
function xDeriveBits(algorithm, baseKey, length) {
|
|
414
|
+
const publicKey = algorithm.public;
|
|
415
|
+
if (!publicKey) {
|
|
416
|
+
throw new Error('Public key is required for X25519/X448 derivation');
|
|
417
|
+
}
|
|
418
|
+
if (baseKey.algorithm.name !== publicKey.algorithm.name) {
|
|
419
|
+
throw new Error('Keys must be of the same algorithm');
|
|
420
|
+
}
|
|
421
|
+
const type = baseKey.algorithm.name.toLowerCase();
|
|
422
|
+
const ed = new Ed(type, {});
|
|
423
|
+
|
|
424
|
+
// Export raw keys
|
|
425
|
+
const privateKeyBytes = baseKey.keyObject.handle.exportKey();
|
|
426
|
+
const publicKeyBytes = publicKey.keyObject.handle.exportKey();
|
|
427
|
+
const privateKeyTyped = new Uint8Array(privateKeyBytes);
|
|
428
|
+
const publicKeyTyped = new Uint8Array(publicKeyBytes);
|
|
429
|
+
const secret = ed.getSharedSecret(privateKeyTyped, publicKeyTyped);
|
|
430
|
+
|
|
431
|
+
// If length is null, return the full secret
|
|
432
|
+
if (length === null) {
|
|
433
|
+
return secret;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// If length is specified, truncate
|
|
437
|
+
const byteLength = Math.ceil(length / 8);
|
|
438
|
+
if (secret.byteLength >= byteLength) {
|
|
439
|
+
return secret.slice(0, byteLength);
|
|
440
|
+
}
|
|
441
|
+
throw new Error('Derived key is shorter than requested length');
|
|
442
|
+
}
|
|
443
|
+
//# sourceMappingURL=ed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNativeNitroModules","require","_reactNativeBuffer","_classes","_utils","_ecdh","coerceToNumeric","value","Ed","constructor","type","config","native","NitroModules","createHybridObject","setCurve","diffieHellman","options","callback","privKeyObj","privateKey","pubKeyObj","publicKey","handle","exportKey","ret","Error","Buffer","from","e","err","undefined","generateKeyPair","publicFormat","publicType","privateFormat","privateType","cipher","passphrase","generateKeyPairSync","getPublicKey","getPrivateKey","getSharedSecret","toAB","sign","message","key","signSync","verify","signature","verifySync","exports","TypeError","resolvedOptions","resolveDhKeyInput","checkDiffieHellmanOptions","keyType","asymmetricKeyType","ecDiffieHellman","ed","isRawKeyInput","obj","format","input","name","expectedKeyType","namedCurve","keyData","initRawPublic","PublicKeyObject","initRawSeed","PrivateKeyObjectClass","initRawPrivate","ed_createKeyObjects","publicKeyData","privateKeyData","pub","KeyObject","createKeyObject","KFormatType","DER","KeyEncoding","SPKI","priv","PKCS8","ed_formatKeyPairOutput","encoding","exportRawPublic","PEM","exported","Uint8Array","toString","exportRawPrivate","exportRawSeed","ed_generateKeyPair","isAsync","derConfig","then","catch","String","curveName","ecdh","ECDH","jwkPrivate","exportJwk","d","setPrivateKey","jwkPublic","x","y","publicBytes","concat","secret","computeSecret","privateKeyAsym","publicKeyAsym","privateCurve","publicCurve","ed_generateKeyPairWebCrypto","extractable","keyUsages","hasAnyNotIn","lazyDOMException","publicUsages","getUsagesUnion","privateUsages","length","algorithmName","CryptoKey","x_generateKeyPairWebCrypto","xDeriveBits","algorithm","baseKey","public","toLowerCase","privateKeyBytes","keyObject","publicKeyBytes","privateKeyTyped","publicKeyTyped","byteLength","Math","ceil","slice"],"sourceRoot":"../../src","sources":["ed.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEA,I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E;IACd,MAAM,IAAII,KAAK,CAAC,mDAAmD,CAAC;EACtE;EAEA,IAAI0G,OAAO,CAACD,SAAS,CAACnE,IAAI,KAAK1C,SAAS,CAAC6G,SAAS,CAACnE,IAAI,EAAE;IACvD,MAAM,IAAItC,KAAK,CAAC,oCAAoC,CAAC;EACvD;EAEA,MAAMhB,IAAI,GAAG0H,OAAO,CAACD,SAAS,CAACnE,IAAI,CAACsE,WAAW,CAAC,CAAsB;EACtE,MAAM3E,EAAE,GAAG,IAAInD,EAAE,CAACE,IAAI,EAAE,CAAC,CAAC,CAAC;;EAE3B;EACA,MAAM6H,eAAe,GAAGH,OAAO,CAACI,SAAS,CAACjH,MAAM,CAACC,SAAS,CAAC,CAAC;EAC5D,MAAMiH,cAAc,GAAGnH,SAAS,CAACkH,SAAS,CAACjH,MAAM,CAACC,SAAS,CAAC,CAAC;EAE7D,MAAMkH,eAAe,GAAG,IAAIhD,UAAU,CAAC6C,eAAe,CAAC;EACvD,MAAMI,cAAc,GAAG,IAAIjD,UAAU,CAAC+C,cAAc,CAAC;EAErD,MAAMzB,MAAM,GAAGrD,EAAE,CAACjB,eAAe,CAACgG,eAAe,EAAEC,cAAc,CAAC;;EAElE;EACA,IAAIb,MAAM,KAAK,IAAI,EAAE;IACnB,OAAOd,MAAM;EACf;;EAEA;EACA,MAAM4B,UAAU,GAAGC,IAAI,CAACC,IAAI,CAAChB,MAAM,GAAG,CAAC,CAAC;EACxC,IAAId,MAAM,CAAC4B,UAAU,IAAIA,UAAU,EAAE;IACnC,OAAO5B,MAAM,CAAC+B,KAAK,CAAC,CAAC,EAAEH,UAAU,CAAC;EACpC;EAEA,MAAM,IAAIlH,KAAK,CAAC,8CAA8C,CAAC;AACjE","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["expo-plugin/@types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createRNQCPlugin = createRNQCPlugin;
|
|
7
|
+
var _configPlugins = require("expo/config-plugins");
|
|
8
|
+
var _withSodiumIos = require("./withSodiumIos");
|
|
9
|
+
var _withSodiumAndroid = require("./withSodiumAndroid");
|
|
10
|
+
var _withXCode = require("./withXCode");
|
|
11
|
+
const withRNQCInternal = (config, props = {}) => {
|
|
12
|
+
// add XCode workarounds for some 16.x releases that are not RN-friendly
|
|
13
|
+
config = (0, _withXCode.withXCode)(config, props);
|
|
14
|
+
|
|
15
|
+
// enable libsodium algorithms
|
|
16
|
+
if (props.sodiumEnabled) {
|
|
17
|
+
config = (0, _withSodiumIos.withSodiumIos)(config, props);
|
|
18
|
+
config = (0, _withSodiumAndroid.withSodiumAndroid)(config, props);
|
|
19
|
+
}
|
|
20
|
+
return config;
|
|
21
|
+
};
|
|
22
|
+
function createRNQCPlugin(name, version) {
|
|
23
|
+
return (0, _configPlugins.createRunOncePlugin)(withRNQCInternal, name, version);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=withRNQC.js.map
|