@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,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DiffieHellman = void 0;
|
|
7
|
+
exports.createDiffieHellman = createDiffieHellman;
|
|
8
|
+
exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman;
|
|
9
|
+
var _reactNativeNitroModules = require("./nitro-node-shim");
|
|
10
|
+
var _reactNativeBuffer = require("@craftzdog/react-native-buffer");
|
|
11
|
+
var _dhGroups = require("./dh-groups");
|
|
12
|
+
var _conversion = require("./utils/conversion");
|
|
13
|
+
class DiffieHellman {
|
|
14
|
+
constructor(sizeOrPrime, generator, encoding) {
|
|
15
|
+
this._hybrid = _reactNativeNitroModules.NitroModules.createHybridObject('DiffieHellman');
|
|
16
|
+
if (typeof sizeOrPrime === 'number') {
|
|
17
|
+
const gen = typeof generator === 'number' ? generator : 2;
|
|
18
|
+
this._hybrid.initWithSize(sizeOrPrime, gen);
|
|
19
|
+
} else {
|
|
20
|
+
let primeBuf;
|
|
21
|
+
if (_reactNativeBuffer.Buffer.isBuffer(sizeOrPrime)) {
|
|
22
|
+
primeBuf = sizeOrPrime;
|
|
23
|
+
} else {
|
|
24
|
+
primeBuf = _reactNativeBuffer.Buffer.from(sizeOrPrime, encoding);
|
|
25
|
+
}
|
|
26
|
+
let genBuf;
|
|
27
|
+
if (generator === undefined) {
|
|
28
|
+
genBuf = _reactNativeBuffer.Buffer.from([2]);
|
|
29
|
+
} else if (typeof generator === 'number') {
|
|
30
|
+
genBuf = _reactNativeBuffer.Buffer.from([generator]);
|
|
31
|
+
} else if (_reactNativeBuffer.Buffer.isBuffer(generator)) {
|
|
32
|
+
genBuf = generator;
|
|
33
|
+
} else {
|
|
34
|
+
genBuf = _reactNativeBuffer.Buffer.from(generator, encoding);
|
|
35
|
+
}
|
|
36
|
+
this._hybrid.init((0, _conversion.toArrayBuffer)(primeBuf), (0, _conversion.toArrayBuffer)(genBuf));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
generateKeys(encoding) {
|
|
40
|
+
const keys = _reactNativeBuffer.Buffer.from(this._hybrid.generateKeys());
|
|
41
|
+
if (encoding) return keys.toString(encoding);
|
|
42
|
+
return keys;
|
|
43
|
+
}
|
|
44
|
+
computeSecret(otherPublicKey, inputEncoding, outputEncoding) {
|
|
45
|
+
let keyBuf;
|
|
46
|
+
if (_reactNativeBuffer.Buffer.isBuffer(otherPublicKey)) {
|
|
47
|
+
keyBuf = otherPublicKey;
|
|
48
|
+
} else {
|
|
49
|
+
keyBuf = _reactNativeBuffer.Buffer.from(otherPublicKey, inputEncoding);
|
|
50
|
+
}
|
|
51
|
+
const secret = _reactNativeBuffer.Buffer.from(this._hybrid.computeSecret((0, _conversion.toArrayBuffer)(keyBuf)));
|
|
52
|
+
if (outputEncoding) return secret.toString(outputEncoding);
|
|
53
|
+
return secret;
|
|
54
|
+
}
|
|
55
|
+
getPrime(encoding) {
|
|
56
|
+
const p = _reactNativeBuffer.Buffer.from(this._hybrid.getPrime());
|
|
57
|
+
if (encoding) return p.toString(encoding);
|
|
58
|
+
return p;
|
|
59
|
+
}
|
|
60
|
+
getGenerator(encoding) {
|
|
61
|
+
const g = _reactNativeBuffer.Buffer.from(this._hybrid.getGenerator());
|
|
62
|
+
if (encoding) return g.toString(encoding);
|
|
63
|
+
return g;
|
|
64
|
+
}
|
|
65
|
+
getPublicKey(encoding) {
|
|
66
|
+
const p = _reactNativeBuffer.Buffer.from(this._hybrid.getPublicKey());
|
|
67
|
+
if (encoding) return p.toString(encoding);
|
|
68
|
+
return p;
|
|
69
|
+
}
|
|
70
|
+
getPrivateKey(encoding) {
|
|
71
|
+
const p = _reactNativeBuffer.Buffer.from(this._hybrid.getPrivateKey());
|
|
72
|
+
if (encoding) return p.toString(encoding);
|
|
73
|
+
return p;
|
|
74
|
+
}
|
|
75
|
+
setPublicKey(publicKey, encoding) {
|
|
76
|
+
let keyBuf;
|
|
77
|
+
if (_reactNativeBuffer.Buffer.isBuffer(publicKey)) {
|
|
78
|
+
keyBuf = publicKey;
|
|
79
|
+
} else {
|
|
80
|
+
keyBuf = _reactNativeBuffer.Buffer.from(publicKey, encoding);
|
|
81
|
+
}
|
|
82
|
+
this._hybrid.setPublicKey((0, _conversion.toArrayBuffer)(keyBuf));
|
|
83
|
+
}
|
|
84
|
+
setPrivateKey(privateKey, encoding) {
|
|
85
|
+
let keyBuf;
|
|
86
|
+
if (_reactNativeBuffer.Buffer.isBuffer(privateKey)) {
|
|
87
|
+
keyBuf = privateKey;
|
|
88
|
+
} else {
|
|
89
|
+
keyBuf = _reactNativeBuffer.Buffer.from(privateKey, encoding);
|
|
90
|
+
}
|
|
91
|
+
this._hybrid.setPrivateKey((0, _conversion.toArrayBuffer)(keyBuf));
|
|
92
|
+
}
|
|
93
|
+
get verifyError() {
|
|
94
|
+
return this._hybrid.getVerifyError();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.DiffieHellman = DiffieHellman;
|
|
98
|
+
function createDiffieHellman(primeOrSize, primeEncodingOrGenerator, generator, _generatorEncoding) {
|
|
99
|
+
if (typeof primeOrSize === 'number') {
|
|
100
|
+
const gen = typeof primeEncodingOrGenerator === 'number' ? primeEncodingOrGenerator : 2;
|
|
101
|
+
return new DiffieHellman(primeOrSize, gen);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Standardize arguments for String/Buffer prime
|
|
105
|
+
// createDiffieHellman(prime, [encoding], [generator], [encoding])
|
|
106
|
+
|
|
107
|
+
let prime;
|
|
108
|
+
let generatorVal;
|
|
109
|
+
if (_reactNativeBuffer.Buffer.isBuffer(primeOrSize)) {
|
|
110
|
+
prime = primeOrSize;
|
|
111
|
+
// 2nd arg is generator if not string (encoding)
|
|
112
|
+
if (primeEncodingOrGenerator !== undefined && typeof primeEncodingOrGenerator !== 'string') {
|
|
113
|
+
generatorVal = primeEncodingOrGenerator;
|
|
114
|
+
} else if (generator !== undefined) {
|
|
115
|
+
generatorVal = generator;
|
|
116
|
+
} else {
|
|
117
|
+
generatorVal = 2;
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
// String prime
|
|
121
|
+
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."
|
|
122
|
+
// We'll trust user passed encoding if it's a string, otherwise handle it.
|
|
123
|
+
prime = _reactNativeBuffer.Buffer.from(primeOrSize, encoding);
|
|
124
|
+
|
|
125
|
+
// Generator handling in this case
|
|
126
|
+
if (generator !== undefined) {
|
|
127
|
+
generatorVal = generator;
|
|
128
|
+
if (typeof generator === 'string' && _generatorEncoding) {
|
|
129
|
+
generatorVal = _reactNativeBuffer.Buffer.from(generator, _generatorEncoding);
|
|
130
|
+
} else if (typeof generator === 'string') {
|
|
131
|
+
// string with no encoding, assume same as prime? or utf8?
|
|
132
|
+
generatorVal = _reactNativeBuffer.Buffer.from(generator, encoding);
|
|
133
|
+
}
|
|
134
|
+
} else if (typeof primeEncodingOrGenerator !== 'string' && primeEncodingOrGenerator !== undefined) {
|
|
135
|
+
// 2nd arg was generator
|
|
136
|
+
generatorVal = primeEncodingOrGenerator;
|
|
137
|
+
} else {
|
|
138
|
+
generatorVal = 2;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return new DiffieHellman(prime, generatorVal);
|
|
142
|
+
}
|
|
143
|
+
function getDiffieHellman(groupName) {
|
|
144
|
+
const group = _dhGroups.DH_GROUPS[groupName];
|
|
145
|
+
if (!group) {
|
|
146
|
+
throw new Error(`Unknown group: ${groupName}`);
|
|
147
|
+
}
|
|
148
|
+
// group.prime and group.generator are hex strings
|
|
149
|
+
return new DiffieHellman(group.prime, group.generator, 'hex');
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=diffie-hellman.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNativeNitroModules","require","_reactNativeBuffer","_dhGroups","_conversion","DiffieHellman","constructor","sizeOrPrime","generator","encoding","_hybrid","NitroModules","createHybridObject","gen","initWithSize","primeBuf","Buffer","isBuffer","from","genBuf","undefined","init","toArrayBuffer","generateKeys","keys","toString","computeSecret","otherPublicKey","inputEncoding","outputEncoding","keyBuf","secret","getPrime","p","getGenerator","g","getPublicKey","getPrivateKey","setPublicKey","publicKey","setPrivateKey","privateKey","verifyError","getVerifyError","exports","createDiffieHellman","primeOrSize","primeEncodingOrGenerator","_generatorEncoding","prime","generatorVal","getDiffieHellman","groupName","group","DH_GROUPS","Error"],"sourceRoot":"../../src","sources":["diffie-hellman.ts"],"mappings":";;;;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AAEA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAEO,MAAMI,aAAa,CAAC;EAGzBC,WAAWA,CACTC,WAAqC,EACrCC,SAAoC,EACpCC,QAAyB,EACzB;IACA,IAAI,CAACC,OAAO,GACVC,qCAAY,CAACC,kBAAkB,CAAyB,eAAe,CAAC;IAE1E,IAAI,OAAOL,WAAW,KAAK,QAAQ,EAAE;MACnC,MAAMM,GAAG,GAAG,OAAOL,SA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SAAiB,EAAiB;EACjE,MAAMC,KAAK,GAAGC,mBAAS,CAACF,SAAS,CAAC;EAClC,IAAI,CAACC,KAAK,EAAE;IACV,MAAM,IAAIE,KAAK,CAAC,kBAAkBH,SAAS,EAAE,CAAC;EAChD;EACA;EACA,OAAO,IAAI/C,aAAa,CAACgD,KAAK,CAACJ,KAAK,EAAEI,KAAK,CAAC7C,SAAS,EAAE,KAAK,CAAC;AAC/D","ignoreList":[]}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Dsa = void 0;
|
|
7
|
+
exports.dsa_generateKeyPairNode = dsa_generateKeyPairNode;
|
|
8
|
+
exports.dsa_generateKeyPairNodeSync = dsa_generateKeyPairNodeSync;
|
|
9
|
+
var _reactNativeNitroModules = require("./nitro-node-shim");
|
|
10
|
+
var _reactNativeBuffer = require("@craftzdog/react-native-buffer");
|
|
11
|
+
var _classes = require("./keys/classes");
|
|
12
|
+
var _utils = require("./utils");
|
|
13
|
+
class Dsa {
|
|
14
|
+
constructor(modulusLength, divisorLength) {
|
|
15
|
+
this.native = _reactNativeNitroModules.NitroModules.createHybridObject('DsaKeyPair');
|
|
16
|
+
this.native.setModulusLength(modulusLength);
|
|
17
|
+
if (divisorLength !== undefined && divisorLength >= 0) {
|
|
18
|
+
this.native.setDivisorLength(divisorLength);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async generateKeyPair() {
|
|
22
|
+
await this.native.generateKeyPair();
|
|
23
|
+
}
|
|
24
|
+
generateKeyPairSync() {
|
|
25
|
+
this.native.generateKeyPairSync();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// FIPS 186-4 §4.2: only L = 1024, 2048, 3072 are sanctioned. NIST has
|
|
30
|
+
// deprecated DSA-1024 for new applications, but we retain it for
|
|
31
|
+
// interop with legacy systems and match Node's permissive default. We
|
|
32
|
+
// reject anything below 1024 outright.
|
|
33
|
+
exports.Dsa = Dsa;
|
|
34
|
+
const DSA_MIN_MODULUS_LENGTH = 1024;
|
|
35
|
+
function dsa_prepareKeyGenParams(options) {
|
|
36
|
+
if (!options) {
|
|
37
|
+
throw new Error('Options are required for DSA key generation');
|
|
38
|
+
}
|
|
39
|
+
const {
|
|
40
|
+
modulusLength,
|
|
41
|
+
divisorLength
|
|
42
|
+
} = options;
|
|
43
|
+
if (!modulusLength || modulusLength < DSA_MIN_MODULUS_LENGTH) {
|
|
44
|
+
throw new RangeError(`DSA modulusLength must be at least ${DSA_MIN_MODULUS_LENGTH} bits ` + `(got ${modulusLength ?? 0})`);
|
|
45
|
+
}
|
|
46
|
+
return new Dsa(modulusLength, divisorLength);
|
|
47
|
+
}
|
|
48
|
+
function dsa_formatKeyPairOutput(dsa, encoding) {
|
|
49
|
+
const {
|
|
50
|
+
publicFormat,
|
|
51
|
+
privateFormat,
|
|
52
|
+
cipher,
|
|
53
|
+
passphrase
|
|
54
|
+
} = encoding;
|
|
55
|
+
const publicKeyData = dsa.native.getPublicKey();
|
|
56
|
+
const privateKeyData = dsa.native.getPrivateKey();
|
|
57
|
+
const pub = _classes.KeyObject.createKeyObject('public', publicKeyData, _utils.KFormatType.DER, _utils.KeyEncoding.SPKI);
|
|
58
|
+
const priv = _classes.KeyObject.createKeyObject('private', privateKeyData, _utils.KFormatType.DER, _utils.KeyEncoding.PKCS8);
|
|
59
|
+
let publicKey;
|
|
60
|
+
let privateKey;
|
|
61
|
+
if (publicFormat === 'raw-public' || privateFormat === 'raw-private' || privateFormat === 'raw-seed') {
|
|
62
|
+
throw new Error('Raw key formats are not supported for DSA keys');
|
|
63
|
+
}
|
|
64
|
+
if (publicFormat === -1) {
|
|
65
|
+
publicKey = pub;
|
|
66
|
+
} else {
|
|
67
|
+
const format = publicFormat === _utils.KFormatType.PEM ? _utils.KFormatType.PEM : _utils.KFormatType.DER;
|
|
68
|
+
const exported = pub.handle.exportKey(format, _utils.KeyEncoding.SPKI);
|
|
69
|
+
if (format === _utils.KFormatType.PEM) {
|
|
70
|
+
publicKey = _reactNativeBuffer.Buffer.from(new Uint8Array(exported)).toString('utf-8');
|
|
71
|
+
} else {
|
|
72
|
+
publicKey = exported;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (privateFormat === -1) {
|
|
76
|
+
privateKey = priv;
|
|
77
|
+
} else {
|
|
78
|
+
const format = privateFormat === _utils.KFormatType.PEM ? _utils.KFormatType.PEM : _utils.KFormatType.DER;
|
|
79
|
+
const exported = priv.handle.exportKey(format, _utils.KeyEncoding.PKCS8, cipher, passphrase);
|
|
80
|
+
if (format === _utils.KFormatType.PEM) {
|
|
81
|
+
privateKey = _reactNativeBuffer.Buffer.from(new Uint8Array(exported)).toString('utf-8');
|
|
82
|
+
} else {
|
|
83
|
+
privateKey = exported;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
publicKey,
|
|
88
|
+
privateKey
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
async function dsa_generateKeyPairNode(options, encoding) {
|
|
92
|
+
const dsa = dsa_prepareKeyGenParams(options);
|
|
93
|
+
await dsa.generateKeyPair();
|
|
94
|
+
return dsa_formatKeyPairOutput(dsa, encoding);
|
|
95
|
+
}
|
|
96
|
+
function dsa_generateKeyPairNodeSync(options, encoding) {
|
|
97
|
+
const dsa = dsa_prepareKeyGenParams(options);
|
|
98
|
+
dsa.generateKeyPairSync();
|
|
99
|
+
return dsa_formatKeyPairOutput(dsa, encoding);
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=dsa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNativeNitroModules","require","_reactNativeBuffer","_classes","_utils","Dsa","constructor","modulusLength","divisorLength","native","NitroModules","createHybridObject","setModulusLength","undefined","setDivisorLength","generateKeyPair","generateKeyPairSync","exports","DSA_MIN_MODULUS_LENGTH","dsa_prepareKeyGenParams","options","Error","RangeError","dsa_formatKeyPairOutput","dsa","encoding","publicFormat","privateFormat","cipher","passphrase","publicKeyData","getPublicKey","privateKeyData","getPrivateKey","pub","KeyObject","createKeyObject","KFormatType","DER","KeyEncoding","SPKI","priv","PKCS8","publicKey","privateKey","format","PEM","exported","handle","exportKey","Buffer","from","Uint8Array","toString","dsa_generateKeyPairNode","dsa_generateKeyPairNodeSync"],"sourceRoot":"../../src","sources":["dsa.ts"],"mappings":";;;;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAGA,IAAAG,MAAA,GAAAH,OAAA;AAEO,MAAMI,GAAG,CAAC;EAGfC,WAAWA,CAACC,aAAqB,EAAEC,aAAsB,EAAE;IACzD,IAAI,CAACC,MAAM,GAAGC,qCAAY,CAACC,kBAAkB,CAAa,YAAY,CAAC;IACvE,IAAI,CAACF,MAAM,CAACG,gBAAgB,CAACL,aAAa,CAAC;IAC3C,IAAIC,aAAa,KAAKK,SAAS,IAAIL,aAAa,IAAI,CAAC,EAAE;MACrD,IAAI,CAACC,MAAM,CAACK,gBAAgB,CAACN,aAAa,CAAC;IAC7C;EACF;EAEA,MAAMO,eAAeA,CAAA,EAAkB;IACrC,MAAM,IAAI,CAACN,MAAM,CAACM,eAAe,CAAC,CAAC;EACrC;EAEAC,mBAAmBA,CAAA,EAAS;IAC1B,IAAI,CAACP,MAAM,CAACO,mBAAmB,CAAC,CAAC;EACnC;AACF;;AAEA;AACA;AACA;AACA;AAAAC,OAAA,CAAAZ,GAAA,GAAAA,GAAA;AACA,MAAMa,sBAAsB,GAAG,IAAI;AAEnC,SAASC,uBAAuBA,CAC9BC,OAA2C,EACtC;EACL,IAAI,CAACA,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,6CAA6C,CAAC;EAChE;EAEA,MAAM;IAAEd,aAAa;IAAEC;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G,CAACR,mBAAmB,CAAC,CAAC;EACzB,OAAOO,uBAAuB,CAACC,GAAG,EAAEC,QAAQ,CAAC;AAC/C","ignoreList":[]}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Ec = void 0;
|
|
7
|
+
exports.ecDeriveBits = ecDeriveBits;
|
|
8
|
+
exports.ecImportKey = ecImportKey;
|
|
9
|
+
exports.ec_generateKeyPair = ec_generateKeyPair;
|
|
10
|
+
exports.ec_generateKeyPairNode = ec_generateKeyPairNode;
|
|
11
|
+
exports.ec_generateKeyPairNodeSync = ec_generateKeyPairNodeSync;
|
|
12
|
+
exports.ecdsaSignVerify = void 0;
|
|
13
|
+
exports.getCurves = getCurves;
|
|
14
|
+
var _reactNativeNitroModules = require("./nitro-node-shim");
|
|
15
|
+
var _classes = require("./keys/classes");
|
|
16
|
+
var _utils = require("./utils");
|
|
17
|
+
var _reactNativeBuffer = require("@craftzdog/react-native-buffer");
|
|
18
|
+
var _ecdh = require("./ecdh");
|
|
19
|
+
class EcUtils {
|
|
20
|
+
static get native() {
|
|
21
|
+
if (!this._native) {
|
|
22
|
+
this._native = _reactNativeNitroModules.NitroModules.createHybridObject('EcKeyPair');
|
|
23
|
+
}
|
|
24
|
+
return this._native;
|
|
25
|
+
}
|
|
26
|
+
static getSupportedCurves() {
|
|
27
|
+
return this.native.getSupportedCurves();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function getCurves() {
|
|
31
|
+
return EcUtils.getSupportedCurves();
|
|
32
|
+
}
|
|
33
|
+
class Ec {
|
|
34
|
+
constructor(curve) {
|
|
35
|
+
this.native = _reactNativeNitroModules.NitroModules.createHybridObject('EcKeyPair');
|
|
36
|
+
this.native.setCurve(curve);
|
|
37
|
+
}
|
|
38
|
+
async generateKeyPair() {
|
|
39
|
+
await this.native.generateKeyPair();
|
|
40
|
+
return {
|
|
41
|
+
publicKey: this.native.getPublicKey(),
|
|
42
|
+
privateKey: this.native.getPrivateKey()
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
generateKeyPairSync() {
|
|
46
|
+
this.native.generateKeyPairSync();
|
|
47
|
+
return {
|
|
48
|
+
publicKey: this.native.getPublicKey(),
|
|
49
|
+
privateKey: this.native.getPrivateKey()
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// WebCrypto API - only P-256, P-384, P-521 allowed per spec
|
|
55
|
+
exports.Ec = Ec;
|
|
56
|
+
function ecImportKey(format, keyData, algorithm, extractable, keyUsages) {
|
|
57
|
+
const {
|
|
58
|
+
name,
|
|
59
|
+
namedCurve
|
|
60
|
+
} = algorithm;
|
|
61
|
+
if (!namedCurve || !_utils.kNamedCurveAliases[namedCurve]) {
|
|
62
|
+
throw (0, _utils.lazyDOMException)('Unrecognized namedCurve', 'NotSupportedError');
|
|
63
|
+
}
|
|
64
|
+
if (format === 'jwk') {
|
|
65
|
+
const jwk = keyData;
|
|
66
|
+
if (!jwk || typeof jwk !== 'object') {
|
|
67
|
+
throw (0, _utils.lazyDOMException)('Invalid keyData', 'DataError');
|
|
68
|
+
}
|
|
69
|
+
if (jwk.kty !== 'EC') {
|
|
70
|
+
throw (0, _utils.lazyDOMException)('Invalid JWK "kty" Parameter', 'DataError');
|
|
71
|
+
}
|
|
72
|
+
if (jwk.crv !== namedCurve) {
|
|
73
|
+
throw (0, _utils.lazyDOMException)('JWK "crv" does not match the requested algorithm', 'DataError');
|
|
74
|
+
}
|
|
75
|
+
const expectedUse = name === 'ECDH' ? 'enc' : 'sig';
|
|
76
|
+
(0, _utils.validateJwkStructure)(jwk, extractable, keyUsages, expectedUse);
|
|
77
|
+
if (jwk.alg !== undefined) {
|
|
78
|
+
let expectedAlg;
|
|
79
|
+
if (name === 'ECDSA') {
|
|
80
|
+
expectedAlg = namedCurve === 'P-256' ? 'ES256' : namedCurve === 'P-384' ? 'ES384' : namedCurve === 'P-521' ? 'ES512' : undefined;
|
|
81
|
+
} else if (name === 'ECDH') {
|
|
82
|
+
expectedAlg = 'ECDH-ES';
|
|
83
|
+
}
|
|
84
|
+
if (expectedAlg && jwk.alg !== expectedAlg) {
|
|
85
|
+
throw (0, _utils.lazyDOMException)('JWK "alg" does not match the requested algorithm', 'DataError');
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const isPublicJwk = jwk.d === undefined;
|
|
89
|
+
const validUsagesJwk = name === 'ECDSA' ? isPublicJwk ? ['verify'] : ['sign'] : isPublicJwk ? [] : ['deriveKey', 'deriveBits'];
|
|
90
|
+
if ((0, _utils.hasAnyNotIn)(keyUsages, validUsagesJwk)) {
|
|
91
|
+
throw (0, _utils.lazyDOMException)(`Unsupported key usage for a ${name} key`, 'SyntaxError');
|
|
92
|
+
}
|
|
93
|
+
const handle = _reactNativeNitroModules.NitroModules.createHybridObject('KeyObjectHandle');
|
|
94
|
+
let keyType;
|
|
95
|
+
try {
|
|
96
|
+
keyType = handle.initJwk(jwk, namedCurve);
|
|
97
|
+
} catch (err) {
|
|
98
|
+
throw (0, _utils.lazyDOMException)('Invalid keyData', {
|
|
99
|
+
name: 'DataError',
|
|
100
|
+
cause: err
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (keyType === undefined) {
|
|
104
|
+
throw (0, _utils.lazyDOMException)('Invalid keyData', 'DataError');
|
|
105
|
+
}
|
|
106
|
+
let keyObject;
|
|
107
|
+
if (keyType === 1) {
|
|
108
|
+
keyObject = new _classes.PublicKeyObject(handle);
|
|
109
|
+
} else if (keyType === 2) {
|
|
110
|
+
keyObject = new _classes.PrivateKeyObject(handle);
|
|
111
|
+
} else {
|
|
112
|
+
throw (0, _utils.lazyDOMException)('Invalid keyData', 'DataError');
|
|
113
|
+
}
|
|
114
|
+
return new _classes.CryptoKey(keyObject, algorithm, keyUsages, extractable);
|
|
115
|
+
}
|
|
116
|
+
if (format !== 'spki' && format !== 'pkcs8' && format !== 'raw') {
|
|
117
|
+
throw (0, _utils.lazyDOMException)(`Unsupported format: ${format}`, 'NotSupportedError');
|
|
118
|
+
}
|
|
119
|
+
const expectedKeyType = format === 'spki' || format === 'raw' ? 'public' : 'private';
|
|
120
|
+
const isPublicKey = expectedKeyType === 'public';
|
|
121
|
+
let validUsages;
|
|
122
|
+
if (name === 'ECDSA') {
|
|
123
|
+
validUsages = isPublicKey ? ['verify'] : ['sign'];
|
|
124
|
+
} else if (name === 'ECDH') {
|
|
125
|
+
validUsages = isPublicKey ? [] : ['deriveKey', 'deriveBits'];
|
|
126
|
+
} else {
|
|
127
|
+
throw (0, _utils.lazyDOMException)('Unsupported algorithm', 'NotSupportedError');
|
|
128
|
+
}
|
|
129
|
+
if ((0, _utils.hasAnyNotIn)(keyUsages, validUsages)) {
|
|
130
|
+
throw (0, _utils.lazyDOMException)(`Unsupported key usage for a ${name} key`, 'SyntaxError');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Convert keyData to ArrayBuffer
|
|
134
|
+
const keyBuffer = (0, _utils.bufferLikeToArrayBuffer)(keyData);
|
|
135
|
+
|
|
136
|
+
// Create KeyObject directly using the appropriate format
|
|
137
|
+
let keyObject;
|
|
138
|
+
if (format === 'raw') {
|
|
139
|
+
// Raw format is only for public keys - use specialized EC raw import
|
|
140
|
+
const handle = _reactNativeNitroModules.NitroModules.createHybridObject('KeyObjectHandle');
|
|
141
|
+
const curveAlias = _utils.kNamedCurveAliases[namedCurve];
|
|
142
|
+
// Only throw if initialization explicitly fails
|
|
143
|
+
if (!handle.initECRaw(curveAlias, keyBuffer)) {
|
|
144
|
+
throw (0, _utils.lazyDOMException)('Failed to import EC raw key', 'DataError');
|
|
145
|
+
}
|
|
146
|
+
keyObject = new _classes.PublicKeyObject(handle);
|
|
147
|
+
} else {
|
|
148
|
+
// Use standard DER import for spki/pkcs8
|
|
149
|
+
keyObject = _classes.KeyObject.createKeyObject(expectedKeyType, keyBuffer, _utils.KFormatType.DER, format === 'spki' ? _utils.KeyEncoding.SPKI : _utils.KeyEncoding.PKCS8);
|
|
150
|
+
|
|
151
|
+
// Validate the imported curve matches the requested algorithm.namedCurve.
|
|
152
|
+
const expectedAlias = _utils.kNamedCurveAliases[namedCurve];
|
|
153
|
+
if (keyObject.handle.keyDetail().namedCurve !== expectedAlias) {
|
|
154
|
+
throw (0, _utils.lazyDOMException)('Named curve mismatch', 'DataError');
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Verify the public/private point lies on the named curve.
|
|
159
|
+
if (!keyObject.handle.checkEcKeyData()) {
|
|
160
|
+
throw (0, _utils.lazyDOMException)('Invalid keyData', 'DataError');
|
|
161
|
+
}
|
|
162
|
+
return new _classes.CryptoKey(keyObject, algorithm, keyUsages, extractable);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Node API
|
|
166
|
+
const ecdsaSignVerify = (key, data, {
|
|
167
|
+
hash
|
|
168
|
+
}, signature) => {
|
|
169
|
+
const isSign = signature === undefined;
|
|
170
|
+
const expectedKeyType = isSign ? 'private' : 'public';
|
|
171
|
+
if (key.type !== expectedKeyType) {
|
|
172
|
+
throw (0, _utils.lazyDOMException)(`Key must be a ${expectedKeyType} key`, 'InvalidAccessError');
|
|
173
|
+
}
|
|
174
|
+
const hashName = typeof hash === 'string' ? hash : hash?.name;
|
|
175
|
+
if (!hashName) {
|
|
176
|
+
throw (0, _utils.lazyDOMException)('Hash algorithm is required for ECDSA', 'InvalidAccessError');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Normalize hash algorithm name to WebCrypto format for C++ layer
|
|
180
|
+
const normalizedHashName = (0, _utils.normalizeHashName)(hashName, _utils.HashContext.WebCrypto);
|
|
181
|
+
|
|
182
|
+
// Create EC instance with the curve from the key
|
|
183
|
+
const namedCurve = key.algorithm.namedCurve;
|
|
184
|
+
const ec = new Ec(namedCurve);
|
|
185
|
+
|
|
186
|
+
// Extract and import the actual key data from the CryptoKey
|
|
187
|
+
// Export in DER format with appropriate encoding
|
|
188
|
+
const encoding = key.type === 'private' ? _utils.KeyEncoding.PKCS8 : _utils.KeyEncoding.SPKI;
|
|
189
|
+
const keyData = key.keyObject.handle.exportKey(_utils.KFormatType.DER, encoding);
|
|
190
|
+
const keyBuffer = (0, _utils.bufferLikeToArrayBuffer)(keyData);
|
|
191
|
+
ec.native.importKey('der', keyBuffer, key.algorithm.name, key.extractable, key.usages);
|
|
192
|
+
const dataBuffer = (0, _utils.bufferLikeToArrayBuffer)(data);
|
|
193
|
+
if (isSign) {
|
|
194
|
+
// Sign operation
|
|
195
|
+
return ec.native.sign(dataBuffer, normalizedHashName);
|
|
196
|
+
} else {
|
|
197
|
+
// Verify operation
|
|
198
|
+
const signatureBuffer = (0, _utils.bufferLikeToArrayBuffer)(signature);
|
|
199
|
+
return ec.native.verify(dataBuffer, signatureBuffer, normalizedHashName);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// WebCrypto API - only P-256, P-384, P-521 allowed per spec
|
|
204
|
+
exports.ecdsaSignVerify = ecdsaSignVerify;
|
|
205
|
+
async function ec_generateKeyPair(name, namedCurve, extractable, keyUsages,
|
|
206
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
207
|
+
_options // TODO: Implement format options support
|
|
208
|
+
) {
|
|
209
|
+
// validation checks
|
|
210
|
+
if (!Object.keys(_utils.kNamedCurveAliases).includes(namedCurve || '')) {
|
|
211
|
+
throw (0, _utils.lazyDOMException)(`Unrecognized namedCurve '${namedCurve}'`, 'NotSupportedError');
|
|
212
|
+
}
|
|
213
|
+
switch (name) {
|
|
214
|
+
case 'ECDSA':
|
|
215
|
+
if ((0, _utils.hasAnyNotIn)(keyUsages, ['sign', 'verify'])) {
|
|
216
|
+
throw (0, _utils.lazyDOMException)('Unsupported key usage for an ECDSA key', 'SyntaxError');
|
|
217
|
+
}
|
|
218
|
+
break;
|
|
219
|
+
case 'ECDH':
|
|
220
|
+
if ((0, _utils.hasAnyNotIn)(keyUsages, ['deriveKey', 'deriveBits'])) {
|
|
221
|
+
throw (0, _utils.lazyDOMException)('Unsupported key usage for an ECDH key', 'SyntaxError');
|
|
222
|
+
}
|
|
223
|
+
// Fall through
|
|
224
|
+
}
|
|
225
|
+
const ec = new Ec(namedCurve);
|
|
226
|
+
await ec.generateKeyPair();
|
|
227
|
+
let publicUsages = [];
|
|
228
|
+
let privateUsages = [];
|
|
229
|
+
switch (name) {
|
|
230
|
+
case 'ECDSA':
|
|
231
|
+
publicUsages = (0, _utils.getUsagesUnion)(keyUsages, 'verify');
|
|
232
|
+
privateUsages = (0, _utils.getUsagesUnion)(keyUsages, 'sign');
|
|
233
|
+
break;
|
|
234
|
+
case 'ECDH':
|
|
235
|
+
publicUsages = [];
|
|
236
|
+
privateUsages = (0, _utils.getUsagesUnion)(keyUsages, 'deriveKey', 'deriveBits');
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
const keyAlgorithm = {
|
|
240
|
+
name,
|
|
241
|
+
namedCurve: namedCurve
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// Export keys directly from the EC key pair using the internal EVP_PKEY
|
|
245
|
+
// These methods export in DER format (SPKI for public, PKCS8 for private)
|
|
246
|
+
const publicKeyData = ec.native.getPublicKey();
|
|
247
|
+
const privateKeyData = ec.native.getPrivateKey();
|
|
248
|
+
const pub = _classes.KeyObject.createKeyObject('public', publicKeyData, _utils.KFormatType.DER, _utils.KeyEncoding.SPKI);
|
|
249
|
+
const publicKey = new _classes.CryptoKey(pub, keyAlgorithm, publicUsages, true);
|
|
250
|
+
|
|
251
|
+
// All keys are now exported in PKCS8 format for consistency
|
|
252
|
+
const priv = _classes.KeyObject.createKeyObject('private', privateKeyData, _utils.KFormatType.DER, _utils.KeyEncoding.PKCS8);
|
|
253
|
+
const privateKey = new _classes.CryptoKey(priv, keyAlgorithm, privateUsages, extractable);
|
|
254
|
+
return {
|
|
255
|
+
publicKey,
|
|
256
|
+
privateKey
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function ec_prepareKeyGenParams(options) {
|
|
260
|
+
if (!options) {
|
|
261
|
+
throw new Error('Options are required for EC key generation');
|
|
262
|
+
}
|
|
263
|
+
const {
|
|
264
|
+
namedCurve
|
|
265
|
+
} = options;
|
|
266
|
+
if (!namedCurve) {
|
|
267
|
+
throw new Error('namedCurve is required for EC key generation');
|
|
268
|
+
}
|
|
269
|
+
return new Ec(namedCurve);
|
|
270
|
+
}
|
|
271
|
+
function ec_formatKeyPairOutput(ec, encoding) {
|
|
272
|
+
const {
|
|
273
|
+
publicFormat,
|
|
274
|
+
publicType,
|
|
275
|
+
privateFormat,
|
|
276
|
+
privateType,
|
|
277
|
+
cipher,
|
|
278
|
+
passphrase
|
|
279
|
+
} = encoding;
|
|
280
|
+
const publicKeyData = ec.native.getPublicKey();
|
|
281
|
+
const privateKeyData = ec.native.getPrivateKey();
|
|
282
|
+
const pub = _classes.KeyObject.createKeyObject('public', publicKeyData, _utils.KFormatType.DER, _utils.KeyEncoding.SPKI);
|
|
283
|
+
const priv = _classes.KeyObject.createKeyObject('private', privateKeyData, _utils.KFormatType.DER, _utils.KeyEncoding.PKCS8);
|
|
284
|
+
let publicKey;
|
|
285
|
+
let privateKey;
|
|
286
|
+
if (publicFormat === -1) {
|
|
287
|
+
publicKey = pub;
|
|
288
|
+
} else if (publicFormat === 'raw-public') {
|
|
289
|
+
publicKey = _reactNativeBuffer.Buffer.from(pub.handle.exportECPublicRaw(publicType === 'compressed'));
|
|
290
|
+
} else {
|
|
291
|
+
const format = publicFormat === _utils.KFormatType.PEM ? _utils.KFormatType.PEM : _utils.KFormatType.DER;
|
|
292
|
+
const keyEncoding = publicType === _utils.KeyEncoding.SPKI ? _utils.KeyEncoding.SPKI : _utils.KeyEncoding.SPKI;
|
|
293
|
+
const exported = pub.handle.exportKey(format, keyEncoding);
|
|
294
|
+
if (format === _utils.KFormatType.PEM) {
|
|
295
|
+
publicKey = _reactNativeBuffer.Buffer.from(new Uint8Array(exported)).toString('utf-8');
|
|
296
|
+
} else {
|
|
297
|
+
publicKey = exported;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (privateFormat === -1) {
|
|
301
|
+
privateKey = priv;
|
|
302
|
+
} else if (privateFormat === 'raw-private') {
|
|
303
|
+
privateKey = _reactNativeBuffer.Buffer.from(priv.handle.exportECPrivateRaw());
|
|
304
|
+
} else {
|
|
305
|
+
const format = privateFormat === _utils.KFormatType.PEM ? _utils.KFormatType.PEM : _utils.KFormatType.DER;
|
|
306
|
+
const keyEncoding = privateType === _utils.KeyEncoding.PKCS8 ? _utils.KeyEncoding.PKCS8 : privateType === _utils.KeyEncoding.SEC1 ? _utils.KeyEncoding.SEC1 : _utils.KeyEncoding.PKCS8;
|
|
307
|
+
const exported = priv.handle.exportKey(format, keyEncoding, cipher, passphrase);
|
|
308
|
+
if (format === _utils.KFormatType.PEM) {
|
|
309
|
+
privateKey = _reactNativeBuffer.Buffer.from(new Uint8Array(exported)).toString('utf-8');
|
|
310
|
+
} else {
|
|
311
|
+
privateKey = exported;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return {
|
|
315
|
+
publicKey,
|
|
316
|
+
privateKey
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
async function ec_generateKeyPairNode(options, encoding) {
|
|
320
|
+
const ec = ec_prepareKeyGenParams(options);
|
|
321
|
+
await ec.generateKeyPair();
|
|
322
|
+
return ec_formatKeyPairOutput(ec, encoding);
|
|
323
|
+
}
|
|
324
|
+
function ec_generateKeyPairNodeSync(options, encoding) {
|
|
325
|
+
const ec = ec_prepareKeyGenParams(options);
|
|
326
|
+
ec.generateKeyPairSync();
|
|
327
|
+
return ec_formatKeyPairOutput(ec, encoding);
|
|
328
|
+
}
|
|
329
|
+
function ecDeriveBits(algorithm, baseKey, length) {
|
|
330
|
+
const publicKey = algorithm.public;
|
|
331
|
+
if (!publicKey) {
|
|
332
|
+
throw new Error('Public key is required for ECDH derivation');
|
|
333
|
+
}
|
|
334
|
+
if (baseKey.algorithm.name !== publicKey.algorithm.name) {
|
|
335
|
+
throw new Error('Keys must be of the same algorithm');
|
|
336
|
+
}
|
|
337
|
+
if (baseKey.algorithm.namedCurve !== publicKey.algorithm.namedCurve) {
|
|
338
|
+
throw new Error('Keys must use the same curve');
|
|
339
|
+
}
|
|
340
|
+
const namedCurve = baseKey.algorithm.namedCurve;
|
|
341
|
+
if (!namedCurve) {
|
|
342
|
+
throw new Error('Curve name is missing');
|
|
343
|
+
}
|
|
344
|
+
const opensslCurve = _utils.kNamedCurveAliases[namedCurve];
|
|
345
|
+
const ecdh = new _ecdh.ECDH(opensslCurve);
|
|
346
|
+
const jwkPrivate = baseKey.keyObject.handle.exportJwk({}, false);
|
|
347
|
+
if (!jwkPrivate.d) throw new Error('Invalid private key');
|
|
348
|
+
const privateBytes = _reactNativeBuffer.Buffer.from(jwkPrivate.d, 'base64url');
|
|
349
|
+
ecdh.setPrivateKey(privateBytes);
|
|
350
|
+
const jwkPublic = publicKey.keyObject.handle.exportJwk({}, false);
|
|
351
|
+
if (!jwkPublic.x || !jwkPublic.y) throw new Error('Invalid public key');
|
|
352
|
+
const x = _reactNativeBuffer.Buffer.from(jwkPublic.x, 'base64url');
|
|
353
|
+
const y = _reactNativeBuffer.Buffer.from(jwkPublic.y, 'base64url');
|
|
354
|
+
const publicBytes = _reactNativeBuffer.Buffer.concat([_reactNativeBuffer.Buffer.from([0x04]), x, y]);
|
|
355
|
+
const secret = ecdh.computeSecret(publicBytes);
|
|
356
|
+
const secretBuf = _reactNativeBuffer.Buffer.from(secret);
|
|
357
|
+
|
|
358
|
+
// If length is null, return full secret
|
|
359
|
+
if (length === null) {
|
|
360
|
+
return secretBuf.buffer;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// If length is specified, truncate
|
|
364
|
+
const byteLength = Math.ceil(length / 8);
|
|
365
|
+
if (secretBuf.byteLength >= byteLength) {
|
|
366
|
+
return secretBuf.buffer.slice(secretBuf.byteOffset, secretBuf.byteOffset + byteLength);
|
|
367
|
+
}
|
|
368
|
+
throw new Error('Derived key is shorter than requested length');
|
|
369
|
+
}
|
|
370
|
+
//# sourceMappingURL=ec.js.map
|