@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.
Files changed (1027) hide show
  1. package/QuickCrypto.podspec +259 -0
  2. package/README.md +170 -2
  3. package/android/CMakeLists.txt +155 -0
  4. package/android/build.gradle +176 -0
  5. package/android/gradle.properties +6 -0
  6. package/android/src/main/AndroidManifest.xml +3 -0
  7. package/android/src/main/cpp/cpp-adapter.cpp +8 -0
  8. package/android/src/main/java/com/margelo/nitro/quickcrypto/QuickCryptoPackage.java +41 -0
  9. package/app.plugin.js +3 -0
  10. package/cpp/argon2/HybridArgon2.cpp +110 -0
  11. package/cpp/argon2/HybridArgon2.hpp +32 -0
  12. package/cpp/blake3/HybridBlake3.cpp +120 -0
  13. package/cpp/blake3/HybridBlake3.hpp +35 -0
  14. package/cpp/certificate/HybridCertificate.cpp +42 -0
  15. package/cpp/certificate/HybridCertificate.hpp +16 -0
  16. package/cpp/cipher/CCMCipher.cpp +211 -0
  17. package/cpp/cipher/CCMCipher.hpp +24 -0
  18. package/cpp/cipher/ChaCha20Cipher.cpp +91 -0
  19. package/cpp/cipher/ChaCha20Cipher.hpp +23 -0
  20. package/cpp/cipher/ChaCha20Poly1305Cipher.cpp +175 -0
  21. package/cpp/cipher/ChaCha20Poly1305Cipher.hpp +27 -0
  22. package/cpp/cipher/GCMCipher.cpp +65 -0
  23. package/cpp/cipher/GCMCipher.hpp +14 -0
  24. package/cpp/cipher/HybridCipher.cpp +403 -0
  25. package/cpp/cipher/HybridCipher.hpp +90 -0
  26. package/cpp/cipher/HybridCipherFactory.hpp +119 -0
  27. package/cpp/cipher/HybridRsaCipher.cpp +477 -0
  28. package/cpp/cipher/HybridRsaCipher.hpp +33 -0
  29. package/cpp/cipher/OCBCipher.cpp +55 -0
  30. package/cpp/cipher/OCBCipher.hpp +19 -0
  31. package/cpp/cipher/XChaCha20Poly1305Cipher.cpp +158 -0
  32. package/cpp/cipher/XChaCha20Poly1305Cipher.hpp +42 -0
  33. package/cpp/cipher/XSalsa20Cipher.cpp +127 -0
  34. package/cpp/cipher/XSalsa20Cipher.hpp +55 -0
  35. package/cpp/cipher/XSalsa20Poly1305Cipher.cpp +138 -0
  36. package/cpp/cipher/XSalsa20Poly1305Cipher.hpp +41 -0
  37. package/cpp/dh/HybridDhKeyPair.cpp +179 -0
  38. package/cpp/dh/HybridDhKeyPair.hpp +37 -0
  39. package/cpp/dh/HybridDiffieHellman.cpp +482 -0
  40. package/cpp/dh/HybridDiffieHellman.hpp +42 -0
  41. package/cpp/dsa/HybridDsaKeyPair.cpp +128 -0
  42. package/cpp/dsa/HybridDsaKeyPair.hpp +32 -0
  43. package/cpp/ec/HybridEcKeyPair.cpp +481 -0
  44. package/cpp/ec/HybridEcKeyPair.hpp +45 -0
  45. package/cpp/ecdh/HybridECDH.cpp +251 -0
  46. package/cpp/ecdh/HybridECDH.hpp +43 -0
  47. package/cpp/ed25519/HybridEdKeyPair.cpp +360 -0
  48. package/cpp/ed25519/HybridEdKeyPair.hpp +67 -0
  49. package/cpp/hash/HybridHash.cpp +190 -0
  50. package/cpp/hash/HybridHash.hpp +43 -0
  51. package/cpp/hkdf/HybridHkdf.cpp +115 -0
  52. package/cpp/hkdf/HybridHkdf.hpp +29 -0
  53. package/cpp/hmac/HybridHmac.cpp +102 -0
  54. package/cpp/hmac/HybridHmac.hpp +32 -0
  55. package/cpp/keys/HybridKeyObjectHandle.cpp +1519 -0
  56. package/cpp/keys/HybridKeyObjectHandle.hpp +78 -0
  57. package/cpp/keys/KeyObjectData.cpp +298 -0
  58. package/cpp/keys/KeyObjectData.hpp +73 -0
  59. package/cpp/keys/node.h +5 -0
  60. package/cpp/kmac/HybridKmac.cpp +83 -0
  61. package/cpp/kmac/HybridKmac.hpp +31 -0
  62. package/cpp/mldsa/HybridMlDsaKeyPair.cpp +243 -0
  63. package/cpp/mldsa/HybridMlDsaKeyPair.hpp +49 -0
  64. package/cpp/mlkem/HybridMlKemKeyPair.cpp +315 -0
  65. package/cpp/mlkem/HybridMlKemKeyPair.hpp +48 -0
  66. package/cpp/pbkdf2/HybridPbkdf2.cpp +50 -0
  67. package/cpp/pbkdf2/HybridPbkdf2.hpp +24 -0
  68. package/cpp/prime/HybridPrime.cpp +81 -0
  69. package/cpp/prime/HybridPrime.hpp +20 -0
  70. package/cpp/random/HybridRandom.cpp +48 -0
  71. package/cpp/random/HybridRandom.hpp +32 -0
  72. package/cpp/rsa/HybridRsaKeyPair.cpp +151 -0
  73. package/cpp/rsa/HybridRsaKeyPair.hpp +40 -0
  74. package/cpp/scrypt/HybridScrypt.cpp +64 -0
  75. package/cpp/scrypt/HybridScrypt.hpp +28 -0
  76. package/cpp/sign/HybridSignHandle.cpp +241 -0
  77. package/cpp/sign/HybridSignHandle.hpp +36 -0
  78. package/cpp/sign/HybridVerifyHandle.cpp +207 -0
  79. package/cpp/sign/HybridVerifyHandle.hpp +36 -0
  80. package/cpp/sign/SignUtils.hpp +91 -0
  81. package/cpp/slhdsa/HybridSlhDsaKeyPair.cpp +245 -0
  82. package/cpp/slhdsa/HybridSlhDsaKeyPair.hpp +48 -0
  83. package/cpp/turboshake/HybridTurboShake.cpp +379 -0
  84. package/cpp/turboshake/HybridTurboShake.hpp +28 -0
  85. package/cpp/utils/HybridUtils.cpp +399 -0
  86. package/cpp/utils/HybridUtils.hpp +28 -0
  87. package/cpp/utils/Macros.hpp +68 -0
  88. package/cpp/utils/QuickCryptoUtils.cpp +44 -0
  89. package/cpp/utils/QuickCryptoUtils.hpp +186 -0
  90. package/cpp/utils/base64.h +309 -0
  91. package/cpp/x509/HybridX509Certificate.cpp +174 -0
  92. package/cpp/x509/HybridX509Certificate.hpp +51 -0
  93. package/deps/blake3/LICENSE_A2 +202 -0
  94. package/deps/blake3/LICENSE_A2LLVM +219 -0
  95. package/deps/blake3/LICENSE_CC0 +121 -0
  96. package/deps/blake3/README.md +228 -0
  97. package/deps/blake3/c/README.md +403 -0
  98. package/deps/blake3/c/blake3.c +651 -0
  99. package/deps/blake3/c/blake3.h +86 -0
  100. package/deps/blake3/c/blake3_dispatch.c +332 -0
  101. package/deps/blake3/c/blake3_impl.h +333 -0
  102. package/deps/blake3/c/blake3_neon.c +367 -0
  103. package/deps/blake3/c/blake3_portable.c +160 -0
  104. package/deps/fastpbkdf2/fastpbkdf2.c +356 -0
  105. package/deps/fastpbkdf2/fastpbkdf2.h +68 -0
  106. package/deps/ncrypto/LICENSE +21 -0
  107. package/deps/ncrypto/README.md +18 -0
  108. package/deps/ncrypto/include/dh-primes.h +67 -0
  109. package/deps/ncrypto/include/ncrypto/aead.h +137 -0
  110. package/deps/ncrypto/include/ncrypto/version.h +14 -0
  111. package/deps/ncrypto/include/ncrypto.h +1759 -0
  112. package/deps/ncrypto/src/aead.cpp +302 -0
  113. package/deps/ncrypto/src/engine.cpp +93 -0
  114. package/deps/ncrypto/src/ncrypto.cpp +5426 -0
  115. package/deps/simdutf/LICENSE-APACHE +201 -0
  116. package/deps/simdutf/LICENSE-MIT +18 -0
  117. package/deps/simdutf/README.md +2782 -0
  118. package/deps/simdutf/include/simdutf/avx512.h +79 -0
  119. package/deps/simdutf/include/simdutf/base64_implementation.h +158 -0
  120. package/deps/simdutf/include/simdutf/base64_tables.h +887 -0
  121. package/deps/simdutf/include/simdutf/common_defs.h +186 -0
  122. package/deps/simdutf/include/simdutf/compiler_check.h +50 -0
  123. package/deps/simdutf/include/simdutf/constexpr_ptr.h +138 -0
  124. package/deps/simdutf/include/simdutf/encoding_types.h +189 -0
  125. package/deps/simdutf/include/simdutf/error.h +126 -0
  126. package/deps/simdutf/include/simdutf/implementation.h +7081 -0
  127. package/deps/simdutf/include/simdutf/internal/isadetection.h +325 -0
  128. package/deps/simdutf/include/simdutf/portability.h +285 -0
  129. package/deps/simdutf/include/simdutf/scalar/ascii.h +86 -0
  130. package/deps/simdutf/include/simdutf/scalar/atomic_util.h +105 -0
  131. package/deps/simdutf/include/simdutf/scalar/base64.h +911 -0
  132. package/deps/simdutf/include/simdutf/scalar/latin1.h +26 -0
  133. package/deps/simdutf/include/simdutf/scalar/latin1_to_utf16/latin1_to_utf16.h +52 -0
  134. package/deps/simdutf/include/simdutf/scalar/latin1_to_utf32/latin1_to_utf32.h +27 -0
  135. package/deps/simdutf/include/simdutf/scalar/latin1_to_utf8/latin1_to_utf8.h +191 -0
  136. package/deps/simdutf/include/simdutf/scalar/swap_bytes.h +35 -0
  137. package/deps/simdutf/include/simdutf/scalar/utf16.h +226 -0
  138. package/deps/simdutf/include/simdutf/scalar/utf16_to_latin1/utf16_to_latin1.h +108 -0
  139. package/deps/simdutf/include/simdutf/scalar/utf16_to_latin1/valid_utf16_to_latin1.h +40 -0
  140. package/deps/simdutf/include/simdutf/scalar/utf16_to_utf32/utf16_to_utf32.h +86 -0
  141. package/deps/simdutf/include/simdutf/scalar/utf16_to_utf32/valid_utf16_to_utf32.h +44 -0
  142. package/deps/simdutf/include/simdutf/scalar/utf16_to_utf8/utf16_to_utf8.h +295 -0
  143. package/deps/simdutf/include/simdutf/scalar/utf16_to_utf8/valid_utf16_to_utf8.h +91 -0
  144. package/deps/simdutf/include/simdutf/scalar/utf32.h +82 -0
  145. package/deps/simdutf/include/simdutf/scalar/utf32_to_latin1/utf32_to_latin1.h +68 -0
  146. package/deps/simdutf/include/simdutf/scalar/utf32_to_latin1/valid_utf32_to_latin1.h +67 -0
  147. package/deps/simdutf/include/simdutf/scalar/utf32_to_utf16/utf32_to_utf16.h +84 -0
  148. package/deps/simdutf/include/simdutf/scalar/utf32_to_utf16/valid_utf32_to_utf16.h +44 -0
  149. package/deps/simdutf/include/simdutf/scalar/utf32_to_utf8/utf32_to_utf8.h +142 -0
  150. package/deps/simdutf/include/simdutf/scalar/utf32_to_utf8/valid_utf32_to_utf8.h +72 -0
  151. package/deps/simdutf/include/simdutf/scalar/utf8.h +326 -0
  152. package/deps/simdutf/include/simdutf/scalar/utf8_to_latin1/utf8_to_latin1.h +225 -0
  153. package/deps/simdutf/include/simdutf/scalar/utf8_to_latin1/valid_utf8_to_latin1.h +87 -0
  154. package/deps/simdutf/include/simdutf/scalar/utf8_to_utf16/utf8_to_utf16.h +342 -0
  155. package/deps/simdutf/include/simdutf/scalar/utf8_to_utf16/valid_utf8_to_utf16.h +106 -0
  156. package/deps/simdutf/include/simdutf/scalar/utf8_to_utf32/utf8_to_utf32.h +299 -0
  157. package/deps/simdutf/include/simdutf/scalar/utf8_to_utf32/valid_utf8_to_utf32.h +83 -0
  158. package/deps/simdutf/include/simdutf/simdutf_version.h +26 -0
  159. package/deps/simdutf/include/simdutf.h +26 -0
  160. package/deps/simdutf/include/simdutf_c.h +342 -0
  161. package/deps/simdutf/src/arm64/arm_base64.cpp +791 -0
  162. package/deps/simdutf/src/arm64/arm_convert_latin1_to_utf16.cpp +24 -0
  163. package/deps/simdutf/src/arm64/arm_convert_latin1_to_utf32.cpp +24 -0
  164. package/deps/simdutf/src/arm64/arm_convert_latin1_to_utf8.cpp +70 -0
  165. package/deps/simdutf/src/arm64/arm_convert_utf16_to_latin1.cpp +61 -0
  166. package/deps/simdutf/src/arm64/arm_convert_utf16_to_utf32.cpp +185 -0
  167. package/deps/simdutf/src/arm64/arm_convert_utf16_to_utf8.cpp +780 -0
  168. package/deps/simdutf/src/arm64/arm_convert_utf32_to_latin1.cpp +60 -0
  169. package/deps/simdutf/src/arm64/arm_convert_utf32_to_utf16.cpp +208 -0
  170. package/deps/simdutf/src/arm64/arm_convert_utf32_to_utf8.cpp +505 -0
  171. package/deps/simdutf/src/arm64/arm_convert_utf8_to_latin1.cpp +69 -0
  172. package/deps/simdutf/src/arm64/arm_convert_utf8_to_utf16.cpp +313 -0
  173. package/deps/simdutf/src/arm64/arm_convert_utf8_to_utf32.cpp +179 -0
  174. package/deps/simdutf/src/arm64/arm_find.cpp +199 -0
  175. package/deps/simdutf/src/arm64/arm_utf16fix.cpp +185 -0
  176. package/deps/simdutf/src/arm64/arm_validate_utf16.cpp +165 -0
  177. package/deps/simdutf/src/arm64/arm_validate_utf32le.cpp +65 -0
  178. package/deps/simdutf/src/arm64/implementation.cpp +1442 -0
  179. package/deps/simdutf/src/encoding_types.cpp +67 -0
  180. package/deps/simdutf/src/error.cpp +3 -0
  181. package/deps/simdutf/src/fallback/implementation.cpp +589 -0
  182. package/deps/simdutf/src/generic/ascii_validation.h +50 -0
  183. package/deps/simdutf/src/generic/base64.h +233 -0
  184. package/deps/simdutf/src/generic/base64lengths.h +63 -0
  185. package/deps/simdutf/src/generic/buf_block_reader.h +109 -0
  186. package/deps/simdutf/src/generic/find.h +75 -0
  187. package/deps/simdutf/src/generic/utf16/change_endianness.h +24 -0
  188. package/deps/simdutf/src/generic/utf16/count_code_points_bytemask.h +58 -0
  189. package/deps/simdutf/src/generic/utf16/to_well_formed.h +93 -0
  190. package/deps/simdutf/src/generic/utf16/utf32_length_from_utf16.h +15 -0
  191. package/deps/simdutf/src/generic/utf16/utf8_length_from_utf16.h +35 -0
  192. package/deps/simdutf/src/generic/utf16/utf8_length_from_utf16_bytemask.h +199 -0
  193. package/deps/simdutf/src/generic/utf16.h +73 -0
  194. package/deps/simdutf/src/generic/utf32.h +136 -0
  195. package/deps/simdutf/src/generic/utf8/utf16_length_from_utf8_bytemask.h +53 -0
  196. package/deps/simdutf/src/generic/utf8.h +92 -0
  197. package/deps/simdutf/src/generic/utf8_to_latin1/utf8_to_latin1.h +316 -0
  198. package/deps/simdutf/src/generic/utf8_to_latin1/valid_utf8_to_latin1.h +78 -0
  199. package/deps/simdutf/src/generic/utf8_to_utf16/utf8_to_utf16.h +332 -0
  200. package/deps/simdutf/src/generic/utf8_to_utf16/valid_utf8_to_utf16.h +74 -0
  201. package/deps/simdutf/src/generic/utf8_to_utf32/utf8_to_utf32.h +318 -0
  202. package/deps/simdutf/src/generic/utf8_to_utf32/valid_utf8_to_utf32.h +42 -0
  203. package/deps/simdutf/src/generic/utf8_validation/utf8_lookup4_algorithm.h +223 -0
  204. package/deps/simdutf/src/generic/utf8_validation/utf8_validator.h +84 -0
  205. package/deps/simdutf/src/generic/validate_utf16.h +164 -0
  206. package/deps/simdutf/src/generic/validate_utf32.h +99 -0
  207. package/deps/simdutf/src/haswell/avx2_base64.cpp +837 -0
  208. package/deps/simdutf/src/haswell/avx2_convert_latin1_to_utf16.cpp +28 -0
  209. package/deps/simdutf/src/haswell/avx2_convert_latin1_to_utf32.cpp +20 -0
  210. package/deps/simdutf/src/haswell/avx2_convert_latin1_to_utf8.cpp +83 -0
  211. package/deps/simdutf/src/haswell/avx2_convert_utf16_to_latin1.cpp +83 -0
  212. package/deps/simdutf/src/haswell/avx2_convert_utf16_to_utf32.cpp +210 -0
  213. package/deps/simdutf/src/haswell/avx2_convert_utf16_to_utf8.cpp +602 -0
  214. package/deps/simdutf/src/haswell/avx2_convert_utf32_to_latin1.cpp +116 -0
  215. package/deps/simdutf/src/haswell/avx2_convert_utf32_to_utf16.cpp +164 -0
  216. package/deps/simdutf/src/haswell/avx2_convert_utf32_to_utf8.cpp +569 -0
  217. package/deps/simdutf/src/haswell/avx2_convert_utf8_to_latin1.cpp +60 -0
  218. package/deps/simdutf/src/haswell/avx2_convert_utf8_to_utf16.cpp +195 -0
  219. package/deps/simdutf/src/haswell/avx2_convert_utf8_to_utf32.cpp +135 -0
  220. package/deps/simdutf/src/haswell/avx2_utf16fix.cpp +173 -0
  221. package/deps/simdutf/src/haswell/avx2_validate_utf16.cpp +17 -0
  222. package/deps/simdutf/src/haswell/implementation.cpp +1447 -0
  223. package/deps/simdutf/src/icelake/icelake_ascii_validation.inl.cpp +19 -0
  224. package/deps/simdutf/src/icelake/icelake_base64.inl.cpp +630 -0
  225. package/deps/simdutf/src/icelake/icelake_common.inl.cpp +37 -0
  226. package/deps/simdutf/src/icelake/icelake_convert_latin1_to_utf16.inl.cpp +36 -0
  227. package/deps/simdutf/src/icelake/icelake_convert_latin1_to_utf32.inl.cpp +23 -0
  228. package/deps/simdutf/src/icelake/icelake_convert_latin1_to_utf8.inl.cpp +107 -0
  229. package/deps/simdutf/src/icelake/icelake_convert_utf16_to_latin1.inl.cpp +103 -0
  230. package/deps/simdutf/src/icelake/icelake_convert_utf16_to_utf32.inl.cpp +136 -0
  231. package/deps/simdutf/src/icelake/icelake_convert_utf16_to_utf8.inl.cpp +206 -0
  232. package/deps/simdutf/src/icelake/icelake_convert_utf32_to_latin1.inl.cpp +74 -0
  233. package/deps/simdutf/src/icelake/icelake_convert_utf32_to_utf16.inl.cpp +338 -0
  234. package/deps/simdutf/src/icelake/icelake_convert_utf32_to_utf8.inl.cpp +574 -0
  235. package/deps/simdutf/src/icelake/icelake_convert_utf8_to_latin1.inl.cpp +104 -0
  236. package/deps/simdutf/src/icelake/icelake_convert_utf8_to_utf16.inl.cpp +75 -0
  237. package/deps/simdutf/src/icelake/icelake_convert_valid_utf8_to_latin1.inl.cpp +69 -0
  238. package/deps/simdutf/src/icelake/icelake_find.inl.cpp +146 -0
  239. package/deps/simdutf/src/icelake/icelake_from_utf8.inl.cpp +266 -0
  240. package/deps/simdutf/src/icelake/icelake_from_valid_utf8.inl.cpp +136 -0
  241. package/deps/simdutf/src/icelake/icelake_macros.inl.cpp +143 -0
  242. package/deps/simdutf/src/icelake/icelake_utf16fix.cpp +138 -0
  243. package/deps/simdutf/src/icelake/icelake_utf32_validation.inl.cpp +63 -0
  244. package/deps/simdutf/src/icelake/icelake_utf8_common.inl.cpp +753 -0
  245. package/deps/simdutf/src/icelake/icelake_utf8_length_from_utf16.inl.cpp +269 -0
  246. package/deps/simdutf/src/icelake/icelake_utf8_validation.inl.cpp +116 -0
  247. package/deps/simdutf/src/icelake/implementation.cpp +1903 -0
  248. package/deps/simdutf/src/implementation.cpp +2526 -0
  249. package/deps/simdutf/src/lasx/implementation.cpp +1531 -0
  250. package/deps/simdutf/src/lasx/lasx_base64.cpp +695 -0
  251. package/deps/simdutf/src/lasx/lasx_convert_latin1_to_utf16.cpp +76 -0
  252. package/deps/simdutf/src/lasx/lasx_convert_latin1_to_utf32.cpp +55 -0
  253. package/deps/simdutf/src/lasx/lasx_convert_latin1_to_utf8.cpp +65 -0
  254. package/deps/simdutf/src/lasx/lasx_convert_utf16_to_latin1.cpp +64 -0
  255. package/deps/simdutf/src/lasx/lasx_convert_utf16_to_utf32.cpp +183 -0
  256. package/deps/simdutf/src/lasx/lasx_convert_utf16_to_utf8.cpp +550 -0
  257. package/deps/simdutf/src/lasx/lasx_convert_utf32_to_latin1.cpp +73 -0
  258. package/deps/simdutf/src/lasx/lasx_convert_utf32_to_utf16.cpp +218 -0
  259. package/deps/simdutf/src/lasx/lasx_convert_utf32_to_utf8.cpp +589 -0
  260. package/deps/simdutf/src/lasx/lasx_convert_utf8_to_latin1.cpp +72 -0
  261. package/deps/simdutf/src/lasx/lasx_convert_utf8_to_utf16.cpp +296 -0
  262. package/deps/simdutf/src/lasx/lasx_convert_utf8_to_utf32.cpp +190 -0
  263. package/deps/simdutf/src/lasx/lasx_find.cpp +64 -0
  264. package/deps/simdutf/src/lasx/lasx_validate_utf16.cpp +13 -0
  265. package/deps/simdutf/src/lasx/lasx_validate_utf32le.cpp +84 -0
  266. package/deps/simdutf/src/lsx/implementation.cpp +1417 -0
  267. package/deps/simdutf/src/lsx/lsx_base64.cpp +675 -0
  268. package/deps/simdutf/src/lsx/lsx_convert_latin1_to_utf16.cpp +39 -0
  269. package/deps/simdutf/src/lsx/lsx_convert_latin1_to_utf32.cpp +27 -0
  270. package/deps/simdutf/src/lsx/lsx_convert_latin1_to_utf8.cpp +56 -0
  271. package/deps/simdutf/src/lsx/lsx_convert_utf16_to_latin1.cpp +64 -0
  272. package/deps/simdutf/src/lsx/lsx_convert_utf16_to_utf32.cpp +133 -0
  273. package/deps/simdutf/src/lsx/lsx_convert_utf16_to_utf8.cpp +518 -0
  274. package/deps/simdutf/src/lsx/lsx_convert_utf32_to_latin1.cpp +66 -0
  275. package/deps/simdutf/src/lsx/lsx_convert_utf32_to_utf16.cpp +155 -0
  276. package/deps/simdutf/src/lsx/lsx_convert_utf32_to_utf8.cpp +459 -0
  277. package/deps/simdutf/src/lsx/lsx_convert_utf8_to_latin1.cpp +75 -0
  278. package/deps/simdutf/src/lsx/lsx_convert_utf8_to_utf16.cpp +291 -0
  279. package/deps/simdutf/src/lsx/lsx_convert_utf8_to_utf32.cpp +179 -0
  280. package/deps/simdutf/src/lsx/lsx_find.cpp +60 -0
  281. package/deps/simdutf/src/lsx/lsx_validate_utf16.cpp +13 -0
  282. package/deps/simdutf/src/lsx/lsx_validate_utf32le.cpp +68 -0
  283. package/deps/simdutf/src/ppc64/implementation.cpp +992 -0
  284. package/deps/simdutf/src/ppc64/ppc64_base64.cpp +480 -0
  285. package/deps/simdutf/src/ppc64/ppc64_base64_internal_tests.cpp +401 -0
  286. package/deps/simdutf/src/ppc64/ppc64_convert_latin1_to_utf16.cpp +12 -0
  287. package/deps/simdutf/src/ppc64/ppc64_convert_latin1_to_utf32.cpp +12 -0
  288. package/deps/simdutf/src/ppc64/ppc64_convert_latin1_to_utf8.cpp +149 -0
  289. package/deps/simdutf/src/ppc64/ppc64_convert_utf16_to_latin1.cpp +67 -0
  290. package/deps/simdutf/src/ppc64/ppc64_convert_utf16_to_utf32.cpp +87 -0
  291. package/deps/simdutf/src/ppc64/ppc64_convert_utf16_to_utf8.cpp +296 -0
  292. package/deps/simdutf/src/ppc64/ppc64_convert_utf32_to_latin1.cpp +57 -0
  293. package/deps/simdutf/src/ppc64/ppc64_convert_utf32_to_utf16.cpp +117 -0
  294. package/deps/simdutf/src/ppc64/ppc64_convert_utf32_to_utf8.cpp +166 -0
  295. package/deps/simdutf/src/ppc64/ppc64_convert_utf8_to_latin1.cpp +69 -0
  296. package/deps/simdutf/src/ppc64/ppc64_convert_utf8_to_utf16.cpp +211 -0
  297. package/deps/simdutf/src/ppc64/ppc64_convert_utf8_to_utf32.cpp +153 -0
  298. package/deps/simdutf/src/ppc64/ppc64_utf16_to_utf8_tables.h +1011 -0
  299. package/deps/simdutf/src/ppc64/ppc64_utf8_length_from_latin1.cpp +37 -0
  300. package/deps/simdutf/src/ppc64/ppc64_validate_utf16.cpp +19 -0
  301. package/deps/simdutf/src/ppc64/templates.cpp +91 -0
  302. package/deps/simdutf/src/rvv/implementation.cpp +138 -0
  303. package/deps/simdutf/src/rvv/rvv_find.cpp +27 -0
  304. package/deps/simdutf/src/rvv/rvv_helpers.inl.cpp +23 -0
  305. package/deps/simdutf/src/rvv/rvv_latin1_to.inl.cpp +71 -0
  306. package/deps/simdutf/src/rvv/rvv_length_from.inl.cpp +164 -0
  307. package/deps/simdutf/src/rvv/rvv_utf16_to.inl.cpp +399 -0
  308. package/deps/simdutf/src/rvv/rvv_utf16fix.cpp +110 -0
  309. package/deps/simdutf/src/rvv/rvv_utf32_to.inl.cpp +307 -0
  310. package/deps/simdutf/src/rvv/rvv_utf8_to.inl.cpp +435 -0
  311. package/deps/simdutf/src/rvv/rvv_validate.inl.cpp +275 -0
  312. package/deps/simdutf/src/simdutf/arm64/begin.h +2 -0
  313. package/deps/simdutf/src/simdutf/arm64/bitmanipulation.h +34 -0
  314. package/deps/simdutf/src/simdutf/arm64/end.h +2 -0
  315. package/deps/simdutf/src/simdutf/arm64/implementation.h +307 -0
  316. package/deps/simdutf/src/simdutf/arm64/intrinsics.h +10 -0
  317. package/deps/simdutf/src/simdutf/arm64/simd.h +547 -0
  318. package/deps/simdutf/src/simdutf/arm64/simd16-inl.h +403 -0
  319. package/deps/simdutf/src/simdutf/arm64/simd32-inl.h +129 -0
  320. package/deps/simdutf/src/simdutf/arm64/simd64-inl.h +28 -0
  321. package/deps/simdutf/src/simdutf/arm64.h +43 -0
  322. package/deps/simdutf/src/simdutf/fallback/begin.h +1 -0
  323. package/deps/simdutf/src/simdutf/fallback/bitmanipulation.h +13 -0
  324. package/deps/simdutf/src/simdutf/fallback/end.h +1 -0
  325. package/deps/simdutf/src/simdutf/fallback/implementation.h +331 -0
  326. package/deps/simdutf/src/simdutf/fallback.h +42 -0
  327. package/deps/simdutf/src/simdutf/haswell/begin.h +15 -0
  328. package/deps/simdutf/src/simdutf/haswell/bitmanipulation.h +35 -0
  329. package/deps/simdutf/src/simdutf/haswell/end.h +13 -0
  330. package/deps/simdutf/src/simdutf/haswell/implementation.h +338 -0
  331. package/deps/simdutf/src/simdutf/haswell/intrinsics.h +67 -0
  332. package/deps/simdutf/src/simdutf/haswell/simd.h +363 -0
  333. package/deps/simdutf/src/simdutf/haswell/simd16-inl.h +261 -0
  334. package/deps/simdutf/src/simdutf/haswell/simd32-inl.h +111 -0
  335. package/deps/simdutf/src/simdutf/haswell/simd64-inl.h +34 -0
  336. package/deps/simdutf/src/simdutf/haswell.h +63 -0
  337. package/deps/simdutf/src/simdutf/icelake/begin.h +14 -0
  338. package/deps/simdutf/src/simdutf/icelake/bitmanipulation.h +44 -0
  339. package/deps/simdutf/src/simdutf/icelake/end.h +12 -0
  340. package/deps/simdutf/src/simdutf/icelake/implementation.h +346 -0
  341. package/deps/simdutf/src/simdutf/icelake/intrinsics.h +138 -0
  342. package/deps/simdutf/src/simdutf/icelake/simd.h +17 -0
  343. package/deps/simdutf/src/simdutf/icelake/simd16-inl.h +90 -0
  344. package/deps/simdutf/src/simdutf/icelake/simd32-inl.h +47 -0
  345. package/deps/simdutf/src/simdutf/icelake.h +81 -0
  346. package/deps/simdutf/src/simdutf/lasx/begin.h +8 -0
  347. package/deps/simdutf/src/simdutf/lasx/bitmanipulation.h +25 -0
  348. package/deps/simdutf/src/simdutf/lasx/end.h +8 -0
  349. package/deps/simdutf/src/simdutf/lasx/implementation.h +310 -0
  350. package/deps/simdutf/src/simdutf/lasx/intrinsics.h +319 -0
  351. package/deps/simdutf/src/simdutf/lasx/simd.h +551 -0
  352. package/deps/simdutf/src/simdutf/lasx/simd16-inl.h +234 -0
  353. package/deps/simdutf/src/simdutf/lasx/simd32-inl.h +74 -0
  354. package/deps/simdutf/src/simdutf/lasx/simd64-inl.h +52 -0
  355. package/deps/simdutf/src/simdutf/lasx.h +49 -0
  356. package/deps/simdutf/src/simdutf/lsx/begin.h +2 -0
  357. package/deps/simdutf/src/simdutf/lsx/bitmanipulation.h +25 -0
  358. package/deps/simdutf/src/simdutf/lsx/end.h +2 -0
  359. package/deps/simdutf/src/simdutf/lsx/implementation.h +309 -0
  360. package/deps/simdutf/src/simdutf/lsx/intrinsics.h +196 -0
  361. package/deps/simdutf/src/simdutf/lsx/simd.h +421 -0
  362. package/deps/simdutf/src/simdutf/lsx/simd16-inl.h +242 -0
  363. package/deps/simdutf/src/simdutf/lsx/simd32-inl.h +69 -0
  364. package/deps/simdutf/src/simdutf/lsx/simd64-inl.h +50 -0
  365. package/deps/simdutf/src/simdutf/lsx.h +52 -0
  366. package/deps/simdutf/src/simdutf/ppc64/begin.h +1 -0
  367. package/deps/simdutf/src/simdutf/ppc64/bitmanipulation.h +29 -0
  368. package/deps/simdutf/src/simdutf/ppc64/end.h +1 -0
  369. package/deps/simdutf/src/simdutf/ppc64/implementation.h +348 -0
  370. package/deps/simdutf/src/simdutf/ppc64/intrinsics.h +19 -0
  371. package/deps/simdutf/src/simdutf/ppc64/simd.h +177 -0
  372. package/deps/simdutf/src/simdutf/ppc64/simd16-inl.h +327 -0
  373. package/deps/simdutf/src/simdutf/ppc64/simd32-inl.h +247 -0
  374. package/deps/simdutf/src/simdutf/ppc64/simd8-inl.h +618 -0
  375. package/deps/simdutf/src/simdutf/ppc64.h +40 -0
  376. package/deps/simdutf/src/simdutf/rvv/begin.h +7 -0
  377. package/deps/simdutf/src/simdutf/rvv/end.h +7 -0
  378. package/deps/simdutf/src/simdutf/rvv/implementation.h +321 -0
  379. package/deps/simdutf/src/simdutf/rvv/intrinsics.h +131 -0
  380. package/deps/simdutf/src/simdutf/rvv.h +41 -0
  381. package/deps/simdutf/src/simdutf/westmere/begin.h +8 -0
  382. package/deps/simdutf/src/simdutf/westmere/bitmanipulation.h +37 -0
  383. package/deps/simdutf/src/simdutf/westmere/end.h +8 -0
  384. package/deps/simdutf/src/simdutf/westmere/implementation.h +338 -0
  385. package/deps/simdutf/src/simdutf/westmere/intrinsics.h +38 -0
  386. package/deps/simdutf/src/simdutf/westmere/simd.h +379 -0
  387. package/deps/simdutf/src/simdutf/westmere/simd16-inl.h +242 -0
  388. package/deps/simdutf/src/simdutf/westmere/simd32-inl.h +151 -0
  389. package/deps/simdutf/src/simdutf/westmere/simd64-inl.h +33 -0
  390. package/deps/simdutf/src/simdutf/westmere.h +59 -0
  391. package/deps/simdutf/src/simdutf.cpp +152 -0
  392. package/deps/simdutf/src/simdutf_c.cpp +525 -0
  393. package/deps/simdutf/src/tables/utf16_to_utf8_tables.h +768 -0
  394. package/deps/simdutf/src/tables/utf32_to_utf16_tables.h +53 -0
  395. package/deps/simdutf/src/tables/utf8_to_utf16_tables.h +826 -0
  396. package/deps/simdutf/src/westmere/implementation.cpp +1479 -0
  397. package/deps/simdutf/src/westmere/internal/loader.cpp +7 -0
  398. package/deps/simdutf/src/westmere/internal/write_v_u16_11bits_to_utf8.cpp +66 -0
  399. package/deps/simdutf/src/westmere/sse_base64.cpp +672 -0
  400. package/deps/simdutf/src/westmere/sse_convert_latin1_to_utf16.cpp +21 -0
  401. package/deps/simdutf/src/westmere/sse_convert_latin1_to_utf32.cpp +31 -0
  402. package/deps/simdutf/src/westmere/sse_convert_latin1_to_utf8.cpp +71 -0
  403. package/deps/simdutf/src/westmere/sse_convert_utf16_to_latin1.cpp +70 -0
  404. package/deps/simdutf/src/westmere/sse_convert_utf16_to_utf32.cpp +206 -0
  405. package/deps/simdutf/src/westmere/sse_convert_utf16_to_utf8.cpp +504 -0
  406. package/deps/simdutf/src/westmere/sse_convert_utf32_to_latin1.cpp +82 -0
  407. package/deps/simdutf/src/westmere/sse_convert_utf32_to_utf16.cpp +209 -0
  408. package/deps/simdutf/src/westmere/sse_convert_utf32_to_utf8.cpp +589 -0
  409. package/deps/simdutf/src/westmere/sse_convert_utf8_to_latin1.cpp +58 -0
  410. package/deps/simdutf/src/westmere/sse_convert_utf8_to_utf16.cpp +197 -0
  411. package/deps/simdutf/src/westmere/sse_convert_utf8_to_utf32.cpp +141 -0
  412. package/deps/simdutf/src/westmere/sse_utf16fix.cpp +82 -0
  413. package/deps/simdutf/src/westmere/sse_validate_utf16.cpp +17 -0
  414. package/jest/index.js +16 -0
  415. package/lib/commonjs/argon2.js +88 -0
  416. package/lib/commonjs/argon2.js.map +1 -0
  417. package/lib/commonjs/blake3.js +99 -0
  418. package/lib/commonjs/blake3.js.map +1 -0
  419. package/lib/commonjs/certificate.js +35 -0
  420. package/lib/commonjs/certificate.js.map +1 -0
  421. package/lib/commonjs/cipher.js +299 -0
  422. package/lib/commonjs/cipher.js.map +1 -0
  423. package/lib/commonjs/constants.js +32 -0
  424. package/lib/commonjs/constants.js.map +1 -0
  425. package/lib/commonjs/dh-groups.js +29 -0
  426. package/lib/commonjs/dh-groups.js.map +1 -0
  427. package/lib/commonjs/dhKeyPair.js +112 -0
  428. package/lib/commonjs/dhKeyPair.js.map +1 -0
  429. package/lib/commonjs/diffie-hellman.js +151 -0
  430. package/lib/commonjs/diffie-hellman.js.map +1 -0
  431. package/lib/commonjs/dsa.js +101 -0
  432. package/lib/commonjs/dsa.js.map +1 -0
  433. package/lib/commonjs/ec.js +370 -0
  434. package/lib/commonjs/ec.js.map +1 -0
  435. package/lib/commonjs/ecdh.js +109 -0
  436. package/lib/commonjs/ecdh.js.map +1 -0
  437. package/lib/commonjs/ed.js +443 -0
  438. package/lib/commonjs/ed.js.map +1 -0
  439. package/lib/commonjs/expo-plugin/@types.js +2 -0
  440. package/lib/commonjs/expo-plugin/@types.js.map +1 -0
  441. package/lib/commonjs/expo-plugin/withRNQC.js +25 -0
  442. package/lib/commonjs/expo-plugin/withRNQC.js.map +1 -0
  443. package/lib/commonjs/expo-plugin/withSodiumAndroid.js +25 -0
  444. package/lib/commonjs/expo-plugin/withSodiumAndroid.js.map +1 -0
  445. package/lib/commonjs/expo-plugin/withSodiumIos.js +23 -0
  446. package/lib/commonjs/expo-plugin/withSodiumIos.js.map +1 -0
  447. package/lib/commonjs/expo-plugin/withXCode.js +109 -0
  448. package/lib/commonjs/expo-plugin/withXCode.js.map +1 -0
  449. package/lib/commonjs/hash.js +291 -0
  450. package/lib/commonjs/hash.js.map +1 -0
  451. package/lib/commonjs/hkdf.js +178 -0
  452. package/lib/commonjs/hkdf.js.map +1 -0
  453. package/lib/commonjs/hmac.js +125 -0
  454. package/lib/commonjs/hmac.js.map +1 -0
  455. package/lib/commonjs/index.js +356 -0
  456. package/lib/commonjs/index.js.map +1 -0
  457. package/lib/commonjs/keys/classes.js +280 -0
  458. package/lib/commonjs/keys/classes.js.map +1 -0
  459. package/lib/commonjs/keys/generateKeyPair.js +237 -0
  460. package/lib/commonjs/keys/generateKeyPair.js.map +1 -0
  461. package/lib/commonjs/keys/index.js +381 -0
  462. package/lib/commonjs/keys/index.js.map +1 -0
  463. package/lib/commonjs/keys/publicCipher.js +171 -0
  464. package/lib/commonjs/keys/publicCipher.js.map +1 -0
  465. package/lib/commonjs/keys/signVerify.js +227 -0
  466. package/lib/commonjs/keys/signVerify.js.map +1 -0
  467. package/lib/commonjs/keys/utils.js +181 -0
  468. package/lib/commonjs/keys/utils.js.map +1 -0
  469. package/lib/commonjs/mldsa.js +69 -0
  470. package/lib/commonjs/mldsa.js.map +1 -0
  471. package/lib/commonjs/mlkem.js +219 -0
  472. package/lib/commonjs/mlkem.js.map +1 -0
  473. package/lib/commonjs/native-nitro-bridge.js +344 -0
  474. package/lib/commonjs/nitro-node-shim.js +23 -0
  475. package/lib/commonjs/package.json +1 -0
  476. package/lib/commonjs/pbkdf2.js +106 -0
  477. package/lib/commonjs/pbkdf2.js.map +1 -0
  478. package/lib/commonjs/prime.js +84 -0
  479. package/lib/commonjs/prime.js.map +1 -0
  480. package/lib/commonjs/random.js +296 -0
  481. package/lib/commonjs/random.js.map +1 -0
  482. package/lib/commonjs/rsa.js +213 -0
  483. package/lib/commonjs/rsa.js.map +1 -0
  484. package/lib/commonjs/scrypt.js +139 -0
  485. package/lib/commonjs/scrypt.js.map +1 -0
  486. package/lib/commonjs/slhdsa.js +70 -0
  487. package/lib/commonjs/slhdsa.js.map +1 -0
  488. package/lib/commonjs/specs/argon2.nitro.js +6 -0
  489. package/lib/commonjs/specs/argon2.nitro.js.map +1 -0
  490. package/lib/commonjs/specs/blake3.nitro.js +6 -0
  491. package/lib/commonjs/specs/blake3.nitro.js.map +1 -0
  492. package/lib/commonjs/specs/certificate.nitro.js +6 -0
  493. package/lib/commonjs/specs/certificate.nitro.js.map +1 -0
  494. package/lib/commonjs/specs/cipher.nitro.js +6 -0
  495. package/lib/commonjs/specs/cipher.nitro.js.map +1 -0
  496. package/lib/commonjs/specs/dhKeyPair.nitro.js +6 -0
  497. package/lib/commonjs/specs/dhKeyPair.nitro.js.map +1 -0
  498. package/lib/commonjs/specs/diffie-hellman.nitro.js +6 -0
  499. package/lib/commonjs/specs/diffie-hellman.nitro.js.map +1 -0
  500. package/lib/commonjs/specs/dsaKeyPair.nitro.js +6 -0
  501. package/lib/commonjs/specs/dsaKeyPair.nitro.js.map +1 -0
  502. package/lib/commonjs/specs/ecKeyPair.nitro.js +6 -0
  503. package/lib/commonjs/specs/ecKeyPair.nitro.js.map +1 -0
  504. package/lib/commonjs/specs/ecdh.nitro.js +6 -0
  505. package/lib/commonjs/specs/ecdh.nitro.js.map +1 -0
  506. package/lib/commonjs/specs/edKeyPair.nitro.js +6 -0
  507. package/lib/commonjs/specs/edKeyPair.nitro.js.map +1 -0
  508. package/lib/commonjs/specs/hash.nitro.js +6 -0
  509. package/lib/commonjs/specs/hash.nitro.js.map +1 -0
  510. package/lib/commonjs/specs/hkdf.nitro.js +6 -0
  511. package/lib/commonjs/specs/hkdf.nitro.js.map +1 -0
  512. package/lib/commonjs/specs/hmac.nitro.js +6 -0
  513. package/lib/commonjs/specs/hmac.nitro.js.map +1 -0
  514. package/lib/commonjs/specs/keyObjectHandle.nitro.js +6 -0
  515. package/lib/commonjs/specs/keyObjectHandle.nitro.js.map +1 -0
  516. package/lib/commonjs/specs/kmac.nitro.js +6 -0
  517. package/lib/commonjs/specs/kmac.nitro.js.map +1 -0
  518. package/lib/commonjs/specs/mlDsaKeyPair.nitro.js +6 -0
  519. package/lib/commonjs/specs/mlDsaKeyPair.nitro.js.map +1 -0
  520. package/lib/commonjs/specs/mlKemKeyPair.nitro.js +6 -0
  521. package/lib/commonjs/specs/mlKemKeyPair.nitro.js.map +1 -0
  522. package/lib/commonjs/specs/pbkdf2.nitro.js +6 -0
  523. package/lib/commonjs/specs/pbkdf2.nitro.js.map +1 -0
  524. package/lib/commonjs/specs/prime.nitro.js +6 -0
  525. package/lib/commonjs/specs/prime.nitro.js.map +1 -0
  526. package/lib/commonjs/specs/random.nitro.js +6 -0
  527. package/lib/commonjs/specs/random.nitro.js.map +1 -0
  528. package/lib/commonjs/specs/rsaCipher.nitro.js +6 -0
  529. package/lib/commonjs/specs/rsaCipher.nitro.js.map +1 -0
  530. package/lib/commonjs/specs/rsaKeyPair.nitro.js +6 -0
  531. package/lib/commonjs/specs/rsaKeyPair.nitro.js.map +1 -0
  532. package/lib/commonjs/specs/scrypt.nitro.js +6 -0
  533. package/lib/commonjs/specs/scrypt.nitro.js.map +1 -0
  534. package/lib/commonjs/specs/sign.nitro.js +6 -0
  535. package/lib/commonjs/specs/sign.nitro.js.map +1 -0
  536. package/lib/commonjs/specs/slhDsaKeyPair.nitro.js +6 -0
  537. package/lib/commonjs/specs/slhDsaKeyPair.nitro.js.map +1 -0
  538. package/lib/commonjs/specs/turboshake.nitro.js +6 -0
  539. package/lib/commonjs/specs/turboshake.nitro.js.map +1 -0
  540. package/lib/commonjs/specs/utils.nitro.js +6 -0
  541. package/lib/commonjs/specs/utils.nitro.js.map +1 -0
  542. package/lib/commonjs/specs/x509certificate.nitro.js +6 -0
  543. package/lib/commonjs/specs/x509certificate.nitro.js.map +1 -0
  544. package/lib/commonjs/subtle.js +3211 -0
  545. package/lib/commonjs/subtle.js.map +1 -0
  546. package/lib/commonjs/utils/cipher.js +75 -0
  547. package/lib/commonjs/utils/cipher.js.map +1 -0
  548. package/lib/commonjs/utils/conversion.js +249 -0
  549. package/lib/commonjs/utils/conversion.js.map +1 -0
  550. package/lib/commonjs/utils/errors.js +73 -0
  551. package/lib/commonjs/utils/errors.js.map +1 -0
  552. package/lib/commonjs/utils/hashnames.js +122 -0
  553. package/lib/commonjs/utils/hashnames.js.map +1 -0
  554. package/lib/commonjs/utils/index.js +83 -0
  555. package/lib/commonjs/utils/index.js.map +1 -0
  556. package/lib/commonjs/utils/noble.js +82 -0
  557. package/lib/commonjs/utils/noble.js.map +1 -0
  558. package/lib/commonjs/utils/timingSafeEqual.js +29 -0
  559. package/lib/commonjs/utils/timingSafeEqual.js.map +1 -0
  560. package/lib/commonjs/utils/types.js +55 -0
  561. package/lib/commonjs/utils/types.js.map +1 -0
  562. package/lib/commonjs/utils/validation.js +144 -0
  563. package/lib/commonjs/utils/validation.js.map +1 -0
  564. package/lib/commonjs/x509certificate.js +189 -0
  565. package/lib/commonjs/x509certificate.js.map +1 -0
  566. package/lib/module/argon2.js +83 -0
  567. package/lib/module/argon2.js.map +1 -0
  568. package/lib/module/blake3.js +91 -0
  569. package/lib/module/blake3.js.map +1 -0
  570. package/lib/module/certificate.js +30 -0
  571. package/lib/module/certificate.js.map +1 -0
  572. package/lib/module/cipher.js +291 -0
  573. package/lib/module/cipher.js.map +1 -0
  574. package/lib/module/constants.js +28 -0
  575. package/lib/module/constants.js.map +1 -0
  576. package/lib/module/dh-groups.js +25 -0
  577. package/lib/module/dh-groups.js.map +1 -0
  578. package/lib/module/dhKeyPair.js +105 -0
  579. package/lib/module/dhKeyPair.js.map +1 -0
  580. package/lib/module/diffie-hellman.js +145 -0
  581. package/lib/module/diffie-hellman.js.map +1 -0
  582. package/lib/module/dsa.js +94 -0
  583. package/lib/module/dsa.js.map +1 -0
  584. package/lib/module/ec.js +358 -0
  585. package/lib/module/ec.js.map +1 -0
  586. package/lib/module/ecdh.js +103 -0
  587. package/lib/module/ecdh.js.map +1 -0
  588. package/lib/module/ed.js +433 -0
  589. package/lib/module/ed.js.map +1 -0
  590. package/lib/module/expo-plugin/@types.js +2 -0
  591. package/lib/module/expo-plugin/@types.js.map +1 -0
  592. package/lib/module/expo-plugin/withRNQC.js +21 -0
  593. package/lib/module/expo-plugin/withRNQC.js.map +1 -0
  594. package/lib/module/expo-plugin/withSodiumAndroid.js +20 -0
  595. package/lib/module/expo-plugin/withSodiumAndroid.js.map +1 -0
  596. package/lib/module/expo-plugin/withSodiumIos.js +17 -0
  597. package/lib/module/expo-plugin/withSodiumIos.js.map +1 -0
  598. package/lib/module/expo-plugin/withXCode.js +101 -0
  599. package/lib/module/expo-plugin/withXCode.js.map +1 -0
  600. package/lib/module/hash.js +282 -0
  601. package/lib/module/hash.js.map +1 -0
  602. package/lib/module/hkdf.js +168 -0
  603. package/lib/module/hkdf.js.map +1 -0
  604. package/lib/module/hmac.js +120 -0
  605. package/lib/module/hmac.js.map +1 -0
  606. package/lib/module/index.js +115 -0
  607. package/lib/module/index.js.map +1 -0
  608. package/lib/module/keys/classes.js +271 -0
  609. package/lib/module/keys/classes.js.map +1 -0
  610. package/lib/module/keys/generateKeyPair.js +231 -0
  611. package/lib/module/keys/generateKeyPair.js.map +1 -0
  612. package/lib/module/keys/index.js +246 -0
  613. package/lib/module/keys/index.js.map +1 -0
  614. package/lib/module/keys/publicCipher.js +164 -0
  615. package/lib/module/keys/publicCipher.js.map +1 -0
  616. package/lib/module/keys/signVerify.js +217 -0
  617. package/lib/module/keys/signVerify.js.map +1 -0
  618. package/lib/module/keys/utils.js +170 -0
  619. package/lib/module/keys/utils.js.map +1 -0
  620. package/lib/module/mldsa.js +63 -0
  621. package/lib/module/mldsa.js.map +1 -0
  622. package/lib/module/mlkem.js +211 -0
  623. package/lib/module/mlkem.js.map +1 -0
  624. package/lib/module/pbkdf2.js +100 -0
  625. package/lib/module/pbkdf2.js.map +1 -0
  626. package/lib/module/prime.js +77 -0
  627. package/lib/module/prime.js.map +1 -0
  628. package/lib/module/random.js +284 -0
  629. package/lib/module/random.js.map +1 -0
  630. package/lib/module/rsa.js +205 -0
  631. package/lib/module/rsa.js.map +1 -0
  632. package/lib/module/scrypt.js +134 -0
  633. package/lib/module/scrypt.js.map +1 -0
  634. package/lib/module/slhdsa.js +64 -0
  635. package/lib/module/slhdsa.js.map +1 -0
  636. package/lib/module/specs/argon2.nitro.js +4 -0
  637. package/lib/module/specs/argon2.nitro.js.map +1 -0
  638. package/lib/module/specs/blake3.nitro.js +4 -0
  639. package/lib/module/specs/blake3.nitro.js.map +1 -0
  640. package/lib/module/specs/certificate.nitro.js +4 -0
  641. package/lib/module/specs/certificate.nitro.js.map +1 -0
  642. package/lib/module/specs/cipher.nitro.js +4 -0
  643. package/lib/module/specs/cipher.nitro.js.map +1 -0
  644. package/lib/module/specs/dhKeyPair.nitro.js +4 -0
  645. package/lib/module/specs/dhKeyPair.nitro.js.map +1 -0
  646. package/lib/module/specs/diffie-hellman.nitro.js +4 -0
  647. package/lib/module/specs/diffie-hellman.nitro.js.map +1 -0
  648. package/lib/module/specs/dsaKeyPair.nitro.js +4 -0
  649. package/lib/module/specs/dsaKeyPair.nitro.js.map +1 -0
  650. package/lib/module/specs/ecKeyPair.nitro.js +4 -0
  651. package/lib/module/specs/ecKeyPair.nitro.js.map +1 -0
  652. package/lib/module/specs/ecdh.nitro.js +4 -0
  653. package/lib/module/specs/ecdh.nitro.js.map +1 -0
  654. package/lib/module/specs/edKeyPair.nitro.js +4 -0
  655. package/lib/module/specs/edKeyPair.nitro.js.map +1 -0
  656. package/lib/module/specs/hash.nitro.js +4 -0
  657. package/lib/module/specs/hash.nitro.js.map +1 -0
  658. package/lib/module/specs/hkdf.nitro.js +4 -0
  659. package/lib/module/specs/hkdf.nitro.js.map +1 -0
  660. package/lib/module/specs/hmac.nitro.js +4 -0
  661. package/lib/module/specs/hmac.nitro.js.map +1 -0
  662. package/lib/module/specs/keyObjectHandle.nitro.js +4 -0
  663. package/lib/module/specs/keyObjectHandle.nitro.js.map +1 -0
  664. package/lib/module/specs/kmac.nitro.js +4 -0
  665. package/lib/module/specs/kmac.nitro.js.map +1 -0
  666. package/lib/module/specs/mlDsaKeyPair.nitro.js +4 -0
  667. package/lib/module/specs/mlDsaKeyPair.nitro.js.map +1 -0
  668. package/lib/module/specs/mlKemKeyPair.nitro.js +4 -0
  669. package/lib/module/specs/mlKemKeyPair.nitro.js.map +1 -0
  670. package/lib/module/specs/pbkdf2.nitro.js +4 -0
  671. package/lib/module/specs/pbkdf2.nitro.js.map +1 -0
  672. package/lib/module/specs/prime.nitro.js +4 -0
  673. package/lib/module/specs/prime.nitro.js.map +1 -0
  674. package/lib/module/specs/random.nitro.js +4 -0
  675. package/lib/module/specs/random.nitro.js.map +1 -0
  676. package/lib/module/specs/rsaCipher.nitro.js +4 -0
  677. package/lib/module/specs/rsaCipher.nitro.js.map +1 -0
  678. package/lib/module/specs/rsaKeyPair.nitro.js +4 -0
  679. package/lib/module/specs/rsaKeyPair.nitro.js.map +1 -0
  680. package/lib/module/specs/scrypt.nitro.js +4 -0
  681. package/lib/module/specs/scrypt.nitro.js.map +1 -0
  682. package/lib/module/specs/sign.nitro.js +4 -0
  683. package/lib/module/specs/sign.nitro.js.map +1 -0
  684. package/lib/module/specs/slhDsaKeyPair.nitro.js +4 -0
  685. package/lib/module/specs/slhDsaKeyPair.nitro.js.map +1 -0
  686. package/lib/module/specs/turboshake.nitro.js +4 -0
  687. package/lib/module/specs/turboshake.nitro.js.map +1 -0
  688. package/lib/module/specs/utils.nitro.js +4 -0
  689. package/lib/module/specs/utils.nitro.js.map +1 -0
  690. package/lib/module/specs/x509certificate.nitro.js +4 -0
  691. package/lib/module/specs/x509certificate.nitro.js.map +1 -0
  692. package/lib/module/subtle.js +3205 -0
  693. package/lib/module/subtle.js.map +1 -0
  694. package/lib/module/utils/cipher.js +67 -0
  695. package/lib/module/utils/cipher.js.map +1 -0
  696. package/lib/module/utils/conversion.js +205 -0
  697. package/lib/module/utils/conversion.js.map +1 -0
  698. package/lib/module/utils/errors.js +67 -0
  699. package/lib/module/utils/errors.js.map +1 -0
  700. package/lib/module/utils/hashnames.js +120 -0
  701. package/lib/module/utils/hashnames.js.map +1 -0
  702. package/lib/module/utils/index.js +10 -0
  703. package/lib/module/utils/index.js.map +1 -0
  704. package/lib/module/utils/noble.js +76 -0
  705. package/lib/module/utils/noble.js.map +1 -0
  706. package/lib/module/utils/timingSafeEqual.js +25 -0
  707. package/lib/module/utils/timingSafeEqual.js.map +1 -0
  708. package/lib/module/utils/types.js +57 -0
  709. package/lib/module/utils/types.js.map +1 -0
  710. package/lib/module/utils/validation.js +131 -0
  711. package/lib/module/utils/validation.js.map +1 -0
  712. package/lib/module/x509certificate.js +184 -0
  713. package/lib/module/x509certificate.js.map +1 -0
  714. package/lib/typescript/argon2.d.ts +16 -0
  715. package/lib/typescript/argon2.d.ts.map +1 -0
  716. package/lib/typescript/blake3.d.ts +33 -0
  717. package/lib/typescript/blake3.d.ts.map +1 -0
  718. package/lib/typescript/certificate.d.ts +8 -0
  719. package/lib/typescript/certificate.d.ts.map +1 -0
  720. package/lib/typescript/cipher.d.ts +75 -0
  721. package/lib/typescript/cipher.d.ts.map +1 -0
  722. package/lib/typescript/constants.d.ts +21 -0
  723. package/lib/typescript/constants.d.ts.map +1 -0
  724. package/lib/typescript/dh-groups.d.ts +5 -0
  725. package/lib/typescript/dh-groups.d.ts.map +1 -0
  726. package/lib/typescript/dhKeyPair.d.ts +19 -0
  727. package/lib/typescript/dhKeyPair.d.ts.map +1 -0
  728. package/lib/typescript/diffie-hellman.d.ts +18 -0
  729. package/lib/typescript/diffie-hellman.d.ts.map +1 -0
  730. package/lib/typescript/dsa.d.ts +19 -0
  731. package/lib/typescript/dsa.d.ts.map +1 -0
  732. package/lib/typescript/ec.d.ts +24 -0
  733. package/lib/typescript/ec.d.ts.map +1 -0
  734. package/lib/typescript/ecdh.d.ts +19 -0
  735. package/lib/typescript/ecdh.d.ts.map +1 -0
  736. package/lib/typescript/ed.d.ts +47 -0
  737. package/lib/typescript/ed.d.ts.map +1 -0
  738. package/lib/typescript/expo-plugin/@types.d.ts +8 -0
  739. package/lib/typescript/expo-plugin/@types.d.ts.map +1 -0
  740. package/lib/typescript/expo-plugin/withRNQC.d.ts +4 -0
  741. package/lib/typescript/expo-plugin/withRNQC.d.ts.map +1 -0
  742. package/lib/typescript/expo-plugin/withSodiumAndroid.d.ts +4 -0
  743. package/lib/typescript/expo-plugin/withSodiumAndroid.d.ts.map +1 -0
  744. package/lib/typescript/expo-plugin/withSodiumIos.d.ts +4 -0
  745. package/lib/typescript/expo-plugin/withSodiumIos.d.ts.map +1 -0
  746. package/lib/typescript/expo-plugin/withXCode.d.ts +23 -0
  747. package/lib/typescript/expo-plugin/withXCode.d.ts.map +1 -0
  748. package/lib/typescript/hash.d.ts +126 -0
  749. package/lib/typescript/hash.d.ts.map +1 -0
  750. package/lib/typescript/hkdf.d.ts +26 -0
  751. package/lib/typescript/hkdf.d.ts.map +1 -0
  752. package/lib/typescript/hmac.d.ts +66 -0
  753. package/lib/typescript/hmac.d.ts.map +1 -0
  754. package/lib/typescript/index.d.ts +240 -0
  755. package/lib/typescript/index.d.ts.map +1 -0
  756. package/lib/typescript/keys/classes.d.ts +95 -0
  757. package/lib/typescript/keys/classes.d.ts.map +1 -0
  758. package/lib/typescript/keys/generateKeyPair.d.ts +17 -0
  759. package/lib/typescript/keys/generateKeyPair.d.ts.map +1 -0
  760. package/lib/typescript/keys/index.d.ts +26 -0
  761. package/lib/typescript/keys/index.d.ts.map +1 -0
  762. package/lib/typescript/keys/publicCipher.d.ts +23 -0
  763. package/lib/typescript/keys/publicCipher.d.ts.map +1 -0
  764. package/lib/typescript/keys/signVerify.d.ts +35 -0
  765. package/lib/typescript/keys/signVerify.d.ts.map +1 -0
  766. package/lib/typescript/keys/utils.d.ts +51 -0
  767. package/lib/typescript/keys/utils.d.ts.map +1 -0
  768. package/lib/typescript/mldsa.d.ts +18 -0
  769. package/lib/typescript/mldsa.d.ts.map +1 -0
  770. package/lib/typescript/mlkem.d.ts +30 -0
  771. package/lib/typescript/mlkem.d.ts.map +1 -0
  772. package/lib/typescript/pbkdf2.d.ts +12 -0
  773. package/lib/typescript/pbkdf2.d.ts.map +1 -0
  774. package/lib/typescript/prime.d.ts +19 -0
  775. package/lib/typescript/prime.d.ts.map +1 -0
  776. package/lib/typescript/random.d.ts +31 -0
  777. package/lib/typescript/random.d.ts.map +1 -0
  778. package/lib/typescript/rsa.d.ts +20 -0
  779. package/lib/typescript/rsa.d.ts.map +1 -0
  780. package/lib/typescript/scrypt.d.ts +18 -0
  781. package/lib/typescript/scrypt.d.ts.map +1 -0
  782. package/lib/typescript/slhdsa.d.ts +19 -0
  783. package/lib/typescript/slhdsa.d.ts.map +1 -0
  784. package/lib/typescript/specs/argon2.nitro.d.ts +9 -0
  785. package/lib/typescript/specs/argon2.nitro.d.ts.map +1 -0
  786. package/lib/typescript/specs/blake3.nitro.d.ts +15 -0
  787. package/lib/typescript/specs/blake3.nitro.d.ts.map +1 -0
  788. package/lib/typescript/specs/certificate.nitro.d.ts +10 -0
  789. package/lib/typescript/specs/certificate.nitro.d.ts.map +1 -0
  790. package/lib/typescript/specs/cipher.nitro.d.ts +38 -0
  791. package/lib/typescript/specs/cipher.nitro.d.ts.map +1 -0
  792. package/lib/typescript/specs/dhKeyPair.nitro.d.ts +14 -0
  793. package/lib/typescript/specs/dhKeyPair.nitro.d.ts.map +1 -0
  794. package/lib/typescript/specs/diffie-hellman.nitro.d.ts +18 -0
  795. package/lib/typescript/specs/diffie-hellman.nitro.d.ts.map +1 -0
  796. package/lib/typescript/specs/dsaKeyPair.nitro.d.ts +13 -0
  797. package/lib/typescript/specs/dsaKeyPair.nitro.d.ts.map +1 -0
  798. package/lib/typescript/specs/ecKeyPair.nitro.d.ts +21 -0
  799. package/lib/typescript/specs/ecKeyPair.nitro.d.ts.map +1 -0
  800. package/lib/typescript/specs/ecdh.nitro.d.ts +15 -0
  801. package/lib/typescript/specs/ecdh.nitro.d.ts.map +1 -0
  802. package/lib/typescript/specs/edKeyPair.nitro.d.ts +17 -0
  803. package/lib/typescript/specs/edKeyPair.nitro.d.ts.map +1 -0
  804. package/lib/typescript/specs/hash.nitro.d.ts +13 -0
  805. package/lib/typescript/specs/hash.nitro.d.ts.map +1 -0
  806. package/lib/typescript/specs/hkdf.nitro.d.ts +10 -0
  807. package/lib/typescript/specs/hkdf.nitro.d.ts.map +1 -0
  808. package/lib/typescript/specs/hmac.nitro.d.ts +10 -0
  809. package/lib/typescript/specs/hmac.nitro.d.ts.map +1 -0
  810. package/lib/typescript/specs/keyObjectHandle.nitro.d.ts +27 -0
  811. package/lib/typescript/specs/keyObjectHandle.nitro.d.ts.map +1 -0
  812. package/lib/typescript/specs/kmac.nitro.d.ts +10 -0
  813. package/lib/typescript/specs/kmac.nitro.d.ts.map +1 -0
  814. package/lib/typescript/specs/mlDsaKeyPair.nitro.d.ts +16 -0
  815. package/lib/typescript/specs/mlDsaKeyPair.nitro.d.ts.map +1 -0
  816. package/lib/typescript/specs/mlKemKeyPair.nitro.d.ts +18 -0
  817. package/lib/typescript/specs/mlKemKeyPair.nitro.d.ts.map +1 -0
  818. package/lib/typescript/specs/pbkdf2.nitro.d.ts +9 -0
  819. package/lib/typescript/specs/pbkdf2.nitro.d.ts.map +1 -0
  820. package/lib/typescript/specs/prime.nitro.d.ts +11 -0
  821. package/lib/typescript/specs/prime.nitro.d.ts.map +1 -0
  822. package/lib/typescript/specs/random.nitro.d.ts +9 -0
  823. package/lib/typescript/specs/random.nitro.d.ts.map +1 -0
  824. package/lib/typescript/specs/rsaCipher.nitro.d.ts +54 -0
  825. package/lib/typescript/specs/rsaCipher.nitro.d.ts.map +1 -0
  826. package/lib/typescript/specs/rsaKeyPair.nitro.d.ts +20 -0
  827. package/lib/typescript/specs/rsaKeyPair.nitro.d.ts.map +1 -0
  828. package/lib/typescript/specs/scrypt.nitro.d.ts +9 -0
  829. package/lib/typescript/specs/scrypt.nitro.d.ts.map +1 -0
  830. package/lib/typescript/specs/sign.nitro.d.ts +19 -0
  831. package/lib/typescript/specs/sign.nitro.d.ts.map +1 -0
  832. package/lib/typescript/specs/slhDsaKeyPair.nitro.d.ts +16 -0
  833. package/lib/typescript/specs/slhDsaKeyPair.nitro.d.ts.map +1 -0
  834. package/lib/typescript/specs/turboshake.nitro.d.ts +11 -0
  835. package/lib/typescript/specs/turboshake.nitro.d.ts.map +1 -0
  836. package/lib/typescript/specs/utils.nitro.d.ts +8 -0
  837. package/lib/typescript/specs/utils.nitro.d.ts.map +1 -0
  838. package/lib/typescript/specs/x509certificate.nitro.d.ts +34 -0
  839. package/lib/typescript/specs/x509certificate.nitro.d.ts.map +1 -0
  840. package/lib/typescript/subtle.d.ts +33 -0
  841. package/lib/typescript/subtle.d.ts.map +1 -0
  842. package/lib/typescript/utils/cipher.d.ts +19 -0
  843. package/lib/typescript/utils/cipher.d.ts.map +1 -0
  844. package/lib/typescript/utils/conversion.d.ts +36 -0
  845. package/lib/typescript/utils/conversion.d.ts.map +1 -0
  846. package/lib/typescript/utils/errors.d.ts +19 -0
  847. package/lib/typescript/utils/errors.d.ts.map +1 -0
  848. package/lib/typescript/utils/hashnames.d.ts +13 -0
  849. package/lib/typescript/utils/hashnames.d.ts.map +1 -0
  850. package/lib/typescript/utils/index.d.ts +8 -0
  851. package/lib/typescript/utils/index.d.ts.map +1 -0
  852. package/lib/typescript/utils/noble.d.ts +19 -0
  853. package/lib/typescript/utils/noble.d.ts.map +1 -0
  854. package/lib/typescript/utils/timingSafeEqual.d.ts +3 -0
  855. package/lib/typescript/utils/timingSafeEqual.d.ts.map +1 -0
  856. package/lib/typescript/utils/types.d.ts +314 -0
  857. package/lib/typescript/utils/types.d.ts.map +1 -0
  858. package/lib/typescript/utils/validation.d.ts +15 -0
  859. package/lib/typescript/utils/validation.d.ts.map +1 -0
  860. package/lib/typescript/x509certificate.d.ts +64 -0
  861. package/lib/typescript/x509certificate.d.ts.map +1 -0
  862. package/nitrogen/generated/.gitattributes +1 -0
  863. package/nitrogen/generated/android/QuickCrypto+autolinking.cmake +110 -0
  864. package/nitrogen/generated/android/QuickCrypto+autolinking.gradle +27 -0
  865. package/nitrogen/generated/android/QuickCryptoOnLoad.cpp +334 -0
  866. package/nitrogen/generated/android/QuickCryptoOnLoad.hpp +25 -0
  867. package/nitrogen/generated/android/kotlin/com/margelo/nitro/crypto/QuickCryptoOnLoad.kt +35 -0
  868. package/nitrogen/generated/ios/QuickCrypto+autolinking.rb +60 -0
  869. package/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Bridge.cpp +17 -0
  870. package/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Bridge.hpp +27 -0
  871. package/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Umbrella.hpp +38 -0
  872. package/nitrogen/generated/ios/QuickCryptoAutolinking.mm +325 -0
  873. package/nitrogen/generated/ios/QuickCryptoAutolinking.swift +16 -0
  874. package/nitrogen/generated/shared/c++/AsymmetricKeyType.hpp +176 -0
  875. package/nitrogen/generated/shared/c++/CipherArgs.hpp +101 -0
  876. package/nitrogen/generated/shared/c++/CipherInfo.hpp +104 -0
  877. package/nitrogen/generated/shared/c++/HkdfMode.hpp +80 -0
  878. package/nitrogen/generated/shared/c++/HybridArgon2Spec.cpp +22 -0
  879. package/nitrogen/generated/shared/c++/HybridArgon2Spec.hpp +66 -0
  880. package/nitrogen/generated/shared/c++/HybridBlake3Spec.cpp +28 -0
  881. package/nitrogen/generated/shared/c++/HybridBlake3Spec.hpp +74 -0
  882. package/nitrogen/generated/shared/c++/HybridCertificateSpec.cpp +23 -0
  883. package/nitrogen/generated/shared/c++/HybridCertificateSpec.hpp +64 -0
  884. package/nitrogen/generated/shared/c++/HybridCipherFactorySpec.cpp +21 -0
  885. package/nitrogen/generated/shared/c++/HybridCipherFactorySpec.hpp +67 -0
  886. package/nitrogen/generated/shared/c++/HybridCipherSpec.cpp +29 -0
  887. package/nitrogen/generated/shared/c++/HybridCipherSpec.hpp +78 -0
  888. package/nitrogen/generated/shared/c++/HybridDhKeyPairSpec.cpp +27 -0
  889. package/nitrogen/generated/shared/c++/HybridDhKeyPairSpec.hpp +69 -0
  890. package/nitrogen/generated/shared/c++/HybridDiffieHellmanSpec.cpp +31 -0
  891. package/nitrogen/generated/shared/c++/HybridDiffieHellmanSpec.hpp +72 -0
  892. package/nitrogen/generated/shared/c++/HybridDsaKeyPairSpec.cpp +26 -0
  893. package/nitrogen/generated/shared/c++/HybridDsaKeyPairSpec.hpp +68 -0
  894. package/nitrogen/generated/shared/c++/HybridECDHSpec.cpp +28 -0
  895. package/nitrogen/generated/shared/c++/HybridECDHSpec.hpp +70 -0
  896. package/nitrogen/generated/shared/c++/HybridEcKeyPairSpec.cpp +30 -0
  897. package/nitrogen/generated/shared/c++/HybridEcKeyPairSpec.hpp +76 -0
  898. package/nitrogen/generated/shared/c++/HybridEdKeyPairSpec.cpp +30 -0
  899. package/nitrogen/generated/shared/c++/HybridEdKeyPairSpec.hpp +74 -0
  900. package/nitrogen/generated/shared/c++/HybridHashSpec.cpp +26 -0
  901. package/nitrogen/generated/shared/c++/HybridHashSpec.hpp +74 -0
  902. package/nitrogen/generated/shared/c++/HybridHkdfSpec.cpp +22 -0
  903. package/nitrogen/generated/shared/c++/HybridHkdfSpec.hpp +67 -0
  904. package/nitrogen/generated/shared/c++/HybridHmacSpec.cpp +23 -0
  905. package/nitrogen/generated/shared/c++/HybridHmacSpec.hpp +66 -0
  906. package/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.cpp +39 -0
  907. package/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.hpp +107 -0
  908. package/nitrogen/generated/shared/c++/HybridKmacSpec.cpp +23 -0
  909. package/nitrogen/generated/shared/c++/HybridKmacSpec.hpp +66 -0
  910. package/nitrogen/generated/shared/c++/HybridMlDsaKeyPairSpec.cpp +29 -0
  911. package/nitrogen/generated/shared/c++/HybridMlDsaKeyPairSpec.hpp +72 -0
  912. package/nitrogen/generated/shared/c++/HybridMlKemKeyPairSpec.cpp +31 -0
  913. package/nitrogen/generated/shared/c++/HybridMlKemKeyPairSpec.hpp +74 -0
  914. package/nitrogen/generated/shared/c++/HybridPbkdf2Spec.cpp +22 -0
  915. package/nitrogen/generated/shared/c++/HybridPbkdf2Spec.hpp +65 -0
  916. package/nitrogen/generated/shared/c++/HybridPrimeSpec.cpp +24 -0
  917. package/nitrogen/generated/shared/c++/HybridPrimeSpec.hpp +67 -0
  918. package/nitrogen/generated/shared/c++/HybridRandomSpec.cpp +22 -0
  919. package/nitrogen/generated/shared/c++/HybridRandomSpec.hpp +64 -0
  920. package/nitrogen/generated/shared/c++/HybridRsaCipherSpec.cpp +25 -0
  921. package/nitrogen/generated/shared/c++/HybridRsaCipherSpec.hpp +71 -0
  922. package/nitrogen/generated/shared/c++/HybridRsaKeyPairSpec.cpp +29 -0
  923. package/nitrogen/generated/shared/c++/HybridRsaKeyPairSpec.hpp +75 -0
  924. package/nitrogen/generated/shared/c++/HybridScryptSpec.cpp +22 -0
  925. package/nitrogen/generated/shared/c++/HybridScryptSpec.hpp +64 -0
  926. package/nitrogen/generated/shared/c++/HybridSignHandleSpec.cpp +23 -0
  927. package/nitrogen/generated/shared/c++/HybridSignHandleSpec.hpp +69 -0
  928. package/nitrogen/generated/shared/c++/HybridSlhDsaKeyPairSpec.cpp +29 -0
  929. package/nitrogen/generated/shared/c++/HybridSlhDsaKeyPairSpec.hpp +72 -0
  930. package/nitrogen/generated/shared/c++/HybridTurboShakeSpec.cpp +22 -0
  931. package/nitrogen/generated/shared/c++/HybridTurboShakeSpec.hpp +70 -0
  932. package/nitrogen/generated/shared/c++/HybridUtilsSpec.cpp +21 -0
  933. package/nitrogen/generated/shared/c++/HybridUtilsSpec.hpp +62 -0
  934. package/nitrogen/generated/shared/c++/HybridVerifyHandleSpec.cpp +23 -0
  935. package/nitrogen/generated/shared/c++/HybridVerifyHandleSpec.hpp +69 -0
  936. package/nitrogen/generated/shared/c++/HybridX509CertificateHandleSpec.cpp +46 -0
  937. package/nitrogen/generated/shared/c++/HybridX509CertificateHandleSpec.hpp +96 -0
  938. package/nitrogen/generated/shared/c++/JWK.hpp +185 -0
  939. package/nitrogen/generated/shared/c++/JWKkty.hpp +92 -0
  940. package/nitrogen/generated/shared/c++/JWKuse.hpp +76 -0
  941. package/nitrogen/generated/shared/c++/KFormatType.hpp +63 -0
  942. package/nitrogen/generated/shared/c++/KangarooTwelveVariant.hpp +76 -0
  943. package/nitrogen/generated/shared/c++/KeyDetail.hpp +108 -0
  944. package/nitrogen/generated/shared/c++/KeyEncoding.hpp +64 -0
  945. package/nitrogen/generated/shared/c++/KeyObject.hpp +83 -0
  946. package/nitrogen/generated/shared/c++/KeyType.hpp +63 -0
  947. package/nitrogen/generated/shared/c++/KeyUsage.hpp +116 -0
  948. package/nitrogen/generated/shared/c++/NamedCurve.hpp +80 -0
  949. package/nitrogen/generated/shared/c++/TurboShakeVariant.hpp +76 -0
  950. package/ohos/binding.gyp +33 -0
  951. package/ohos/build/Release/quick_crypto.node +0 -0
  952. package/ohos/quick_crypto_napi.cpp +1316 -0
  953. package/package.json +158 -4
  954. package/src/argon2.ts +161 -0
  955. package/src/blake3.ts +124 -0
  956. package/src/certificate.ts +41 -0
  957. package/src/cipher.ts +497 -0
  958. package/src/constants.ts +32 -0
  959. package/src/dh-groups.ts +27 -0
  960. package/src/dhKeyPair.ts +164 -0
  961. package/src/diffie-hellman.ts +195 -0
  962. package/src/dsa.ts +146 -0
  963. package/src/ec.ts +580 -0
  964. package/src/ecdh.ts +132 -0
  965. package/src/ed.ts +605 -0
  966. package/src/expo-plugin/@types.ts +7 -0
  967. package/src/expo-plugin/withRNQC.ts +23 -0
  968. package/src/expo-plugin/withSodiumAndroid.ts +24 -0
  969. package/src/expo-plugin/withSodiumIos.ts +25 -0
  970. package/src/expo-plugin/withXCode.ts +134 -0
  971. package/src/hash.ts +433 -0
  972. package/src/hkdf.ts +327 -0
  973. package/src/hmac.ts +150 -0
  974. package/src/index.ts +126 -0
  975. package/src/keys/classes.ts +369 -0
  976. package/src/keys/generateKeyPair.ts +358 -0
  977. package/src/keys/index.ts +383 -0
  978. package/src/keys/publicCipher.ts +256 -0
  979. package/src/keys/signVerify.ts +329 -0
  980. package/src/keys/utils.ts +263 -0
  981. package/src/mldsa.ts +125 -0
  982. package/src/mlkem.ts +350 -0
  983. package/src/pbkdf2.ts +183 -0
  984. package/src/prime.ts +134 -0
  985. package/src/random.ts +427 -0
  986. package/src/rsa.ts +333 -0
  987. package/src/scrypt.ts +201 -0
  988. package/src/slhdsa.ts +146 -0
  989. package/src/specs/argon2.nitro.ts +29 -0
  990. package/src/specs/blake3.nitro.ts +12 -0
  991. package/src/specs/certificate.nitro.ts +8 -0
  992. package/src/specs/cipher.nitro.ts +39 -0
  993. package/src/specs/dhKeyPair.nitro.ts +14 -0
  994. package/src/specs/diffie-hellman.nitro.ts +16 -0
  995. package/src/specs/dsaKeyPair.nitro.ts +13 -0
  996. package/src/specs/ecKeyPair.nitro.ts +40 -0
  997. package/src/specs/ecdh.nitro.ts +12 -0
  998. package/src/specs/edKeyPair.nitro.ts +43 -0
  999. package/src/specs/hash.nitro.ts +10 -0
  1000. package/src/specs/hkdf.nitro.ts +25 -0
  1001. package/src/specs/hmac.nitro.ts +7 -0
  1002. package/src/specs/keyObjectHandle.nitro.ts +56 -0
  1003. package/src/specs/kmac.nitro.ts +12 -0
  1004. package/src/specs/mlDsaKeyPair.nitro.ts +29 -0
  1005. package/src/specs/mlKemKeyPair.nitro.ts +32 -0
  1006. package/src/specs/pbkdf2.nitro.ts +18 -0
  1007. package/src/specs/prime.nitro.ts +18 -0
  1008. package/src/specs/random.nitro.ts +14 -0
  1009. package/src/specs/rsaCipher.nitro.ts +82 -0
  1010. package/src/specs/rsaKeyPair.nitro.ts +33 -0
  1011. package/src/specs/scrypt.nitro.ts +23 -0
  1012. package/src/specs/sign.nitro.ts +31 -0
  1013. package/src/specs/slhDsaKeyPair.nitro.ts +29 -0
  1014. package/src/specs/turboshake.nitro.ts +21 -0
  1015. package/src/specs/utils.nitro.ts +5 -0
  1016. package/src/specs/x509certificate.nitro.ts +38 -0
  1017. package/src/subtle.ts +4545 -0
  1018. package/src/utils/cipher.ts +82 -0
  1019. package/src/utils/conversion.ts +285 -0
  1020. package/src/utils/errors.ts +83 -0
  1021. package/src/utils/hashnames.ts +129 -0
  1022. package/src/utils/index.ts +7 -0
  1023. package/src/utils/noble.ts +85 -0
  1024. package/src/utils/timingSafeEqual.ts +28 -0
  1025. package/src/utils/types.ts +617 -0
  1026. package/src/utils/validation.ts +199 -0
  1027. package/src/x509certificate.ts +276 -0
@@ -0,0 +1,433 @@
1
+ "use strict";
2
+
3
+ import { NitroModules } from 'react-native-nitro-modules';
4
+ import { Buffer } from '@craftzdog/react-native-buffer';
5
+ import { CryptoKey, KeyObject, PublicKeyObject, PrivateKeyObject as PrivateKeyObjectClass } from './keys/classes';
6
+ import { binaryLikeToArrayBuffer as toAB, hasAnyNotIn, lazyDOMException, getUsagesUnion, KFormatType, KeyEncoding } from './utils';
7
+ import { ECDH } from './ecdh';
8
+ function coerceToNumeric(value) {
9
+ return typeof value === 'number' ? value : -1;
10
+ }
11
+ export class Ed {
12
+ constructor(type, config) {
13
+ this.type = type;
14
+ this.config = config;
15
+ this.native = NitroModules.createHybridObject('EdKeyPair');
16
+ this.native.setCurve(type);
17
+ }
18
+
19
+ /**
20
+ * Computes the Diffie-Hellman secret based on a privateKey and a publicKey.
21
+ * Both keys must have the same asymmetricKeyType, which must be one of 'dh'
22
+ * (for Diffie-Hellman), 'ec', 'x448', or 'x25519' (for ECDH).
23
+ *
24
+ * @api nodejs/node
25
+ *
26
+ * @param options `{ privateKey, publicKey }`, both of which are `KeyObject`s
27
+ * @param callback optional `(err, secret) => void`
28
+ * @returns `Buffer` if no callback, or `void` if callback is provided
29
+ */
30
+ diffieHellman(options, callback) {
31
+ // extract raw key bytes from KeyObject instances
32
+ const privKeyObj = options.privateKey;
33
+ const pubKeyObj = options.publicKey;
34
+ const privateKey = privKeyObj.handle.exportKey();
35
+ const publicKey = pubKeyObj.handle.exportKey();
36
+ try {
37
+ const ret = this.native.diffieHellman(privateKey, publicKey);
38
+ if (!ret) {
39
+ throw new Error('No secret');
40
+ }
41
+ if (callback) {
42
+ callback(null, Buffer.from(ret));
43
+ } else {
44
+ return Buffer.from(ret);
45
+ }
46
+ } catch (e) {
47
+ const err = e;
48
+ if (callback) {
49
+ callback(err, undefined);
50
+ } else {
51
+ throw err;
52
+ }
53
+ }
54
+ }
55
+ async generateKeyPair() {
56
+ 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);
57
+ }
58
+ generateKeyPairSync() {
59
+ 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);
60
+ }
61
+ getPublicKey() {
62
+ return this.native.getPublicKey();
63
+ }
64
+ getPrivateKey() {
65
+ return this.native.getPrivateKey();
66
+ }
67
+
68
+ /**
69
+ * Computes the Diffie-Hellman shared secret based on a privateKey and a
70
+ * publicKey for key exchange
71
+ *
72
+ * @api \@paulmillr/noble-curves/ed25519
73
+ *
74
+ * @param privateKey
75
+ * @param publicKey
76
+ * @returns shared secret key
77
+ */
78
+ getSharedSecret(privateKey, publicKey) {
79
+ return this.native.diffieHellman(toAB(privateKey), toAB(publicKey));
80
+ }
81
+ async sign(message, key) {
82
+ return key ? this.native.sign(toAB(message), toAB(key)) : this.native.sign(toAB(message));
83
+ }
84
+ signSync(message, key) {
85
+ return key ? this.native.signSync(toAB(message), toAB(key)) : this.native.signSync(toAB(message));
86
+ }
87
+ async verify(signature, message, key) {
88
+ return key ? this.native.verify(toAB(signature), toAB(message), toAB(key)) : this.native.verify(toAB(signature), toAB(message));
89
+ }
90
+ verifySync(signature, message, key) {
91
+ return key ? this.native.verifySync(toAB(signature), toAB(message), toAB(key)) : this.native.verifySync(toAB(signature), toAB(message));
92
+ }
93
+ }
94
+
95
+ // Node API
96
+ export function diffieHellman(options, callback) {
97
+ if (!options || typeof options !== 'object') {
98
+ throw new TypeError('options must be an object');
99
+ }
100
+ if (callback !== undefined && typeof callback !== 'function') {
101
+ throw new TypeError('callback must be a function');
102
+ }
103
+ const resolvedOptions = {
104
+ publicKey: resolveDhKeyInput(options.publicKey, 'publicKey'),
105
+ privateKey: resolveDhKeyInput(options.privateKey, 'privateKey')
106
+ };
107
+ checkDiffieHellmanOptions(resolvedOptions);
108
+ const privateKey = resolvedOptions.privateKey;
109
+ const keyType = privateKey.asymmetricKeyType;
110
+ if (keyType === 'ec') {
111
+ return ecDiffieHellman(resolvedOptions, callback);
112
+ }
113
+ if (keyType === 'dh') {
114
+ throw new Error('crypto.diffieHellman with DH KeyObjects is not supported yet — use the DiffieHellman class for now');
115
+ }
116
+ const type = keyType;
117
+ const ed = new Ed(type, {});
118
+ return ed.diffieHellman(resolvedOptions, callback);
119
+ }
120
+ function isRawKeyInput(value) {
121
+ if (!value || typeof value !== 'object') return false;
122
+ const obj = value;
123
+ return obj.format === 'raw-public' || obj.format === 'raw-private' || obj.format === 'raw-seed';
124
+ }
125
+ function resolveDhKeyInput(input, name) {
126
+ if (isRawKeyInput(input)) {
127
+ const expectedKeyType = name === 'publicKey' ? 'public' : 'private';
128
+ if (input.format === 'raw-public' && expectedKeyType !== 'public') {
129
+ throw new Error(`Invalid format 'raw-public' for ${name}`);
130
+ }
131
+ if ((input.format === 'raw-private' || input.format === 'raw-seed') && expectedKeyType !== 'private') {
132
+ throw new Error(`Invalid format '${input.format}' for ${name}`);
133
+ }
134
+ if (input.asymmetricKeyType === 'ec' && !input.namedCurve) {
135
+ throw new Error(`namedCurve is required for EC raw key in ${name}`);
136
+ }
137
+ const handle = NitroModules.createHybridObject('KeyObjectHandle');
138
+ const keyData = toAB(input.key);
139
+ if (input.format === 'raw-public') {
140
+ handle.initRawPublic(input.asymmetricKeyType, keyData, input.namedCurve);
141
+ return new PublicKeyObject(handle);
142
+ }
143
+ if (input.format === 'raw-seed') {
144
+ handle.initRawSeed(input.asymmetricKeyType, keyData);
145
+ return new PrivateKeyObjectClass(handle);
146
+ }
147
+ handle.initRawPrivate(input.asymmetricKeyType, keyData, input.namedCurve);
148
+ return new PrivateKeyObjectClass(handle);
149
+ }
150
+ return input;
151
+ }
152
+ function ed_createKeyObjects(ed) {
153
+ const publicKeyData = ed.getPublicKey();
154
+ const privateKeyData = ed.getPrivateKey();
155
+ const pub = KeyObject.createKeyObject('public', publicKeyData, KFormatType.DER, KeyEncoding.SPKI);
156
+ const priv = KeyObject.createKeyObject('private', privateKeyData, KFormatType.DER, KeyEncoding.PKCS8);
157
+ return {
158
+ pub,
159
+ priv
160
+ };
161
+ }
162
+
163
+ // Node API
164
+ function ed_formatKeyPairOutput(ed, encoding) {
165
+ const {
166
+ publicFormat,
167
+ privateFormat,
168
+ cipher,
169
+ passphrase
170
+ } = encoding;
171
+ const {
172
+ pub,
173
+ priv
174
+ } = ed_createKeyObjects(ed);
175
+ let publicKey;
176
+ let privateKey;
177
+ if (publicFormat == null || publicFormat === -1) {
178
+ publicKey = pub;
179
+ } else if (publicFormat === 'raw-public') {
180
+ publicKey = Buffer.from(pub.handle.exportRawPublic());
181
+ } else {
182
+ const format = publicFormat === KFormatType.PEM ? KFormatType.PEM : KFormatType.DER;
183
+ const exported = pub.handle.exportKey(format, KeyEncoding.SPKI);
184
+ if (format === KFormatType.PEM) {
185
+ publicKey = Buffer.from(new Uint8Array(exported)).toString('utf-8');
186
+ } else {
187
+ publicKey = exported;
188
+ }
189
+ }
190
+ if (privateFormat == null || privateFormat === -1) {
191
+ privateKey = priv;
192
+ } else if (privateFormat === 'raw-private') {
193
+ privateKey = Buffer.from(priv.handle.exportRawPrivate());
194
+ } else if (privateFormat === 'raw-seed') {
195
+ privateKey = Buffer.from(priv.handle.exportRawSeed());
196
+ } else {
197
+ const format = privateFormat === KFormatType.PEM ? KFormatType.PEM : KFormatType.DER;
198
+ const exported = priv.handle.exportKey(format, KeyEncoding.PKCS8, cipher, passphrase);
199
+ if (format === KFormatType.PEM) {
200
+ privateKey = Buffer.from(new Uint8Array(exported)).toString('utf-8');
201
+ } else {
202
+ privateKey = exported;
203
+ }
204
+ }
205
+ return {
206
+ publicKey,
207
+ privateKey
208
+ };
209
+ }
210
+ export function ed_generateKeyPair(isAsync, type, encoding, callback) {
211
+ const derConfig = {
212
+ ...encoding,
213
+ publicFormat: KFormatType.DER,
214
+ publicType: KeyEncoding.SPKI,
215
+ privateFormat: KFormatType.DER,
216
+ privateType: KeyEncoding.PKCS8
217
+ };
218
+ const ed = new Ed(type, derConfig);
219
+ if (isAsync) {
220
+ if (!callback) {
221
+ throw new Error('A callback is required for async key generation.');
222
+ }
223
+ ed.generateKeyPair().then(() => {
224
+ const {
225
+ publicKey,
226
+ privateKey
227
+ } = ed_formatKeyPairOutput(ed, encoding);
228
+ callback(undefined, publicKey, privateKey);
229
+ }).catch(err => {
230
+ callback(err, undefined, undefined);
231
+ });
232
+ return;
233
+ }
234
+ let err;
235
+ try {
236
+ ed.generateKeyPairSync();
237
+ } catch (e) {
238
+ err = e instanceof Error ? e : new Error(String(e));
239
+ }
240
+ const {
241
+ publicKey,
242
+ privateKey
243
+ } = err ? {
244
+ publicKey: undefined,
245
+ privateKey: undefined
246
+ } : ed_formatKeyPairOutput(ed, encoding);
247
+ if (callback) {
248
+ callback(err, publicKey, privateKey);
249
+ return;
250
+ }
251
+ return [err, publicKey, privateKey];
252
+ }
253
+ function ecDiffieHellman(options, callback) {
254
+ const privateKey = options.privateKey;
255
+ const publicKey = options.publicKey;
256
+ const curveName = privateKey.namedCurve;
257
+ if (!curveName) {
258
+ throw new Error('Unable to determine EC curve name from private key');
259
+ }
260
+ const ecdh = new ECDH(curveName);
261
+ const jwkPrivate = privateKey.handle.exportJwk({}, false);
262
+ if (!jwkPrivate.d) throw new Error('Invalid private key');
263
+ ecdh.setPrivateKey(Buffer.from(jwkPrivate.d, 'base64url'));
264
+ const jwkPublic = publicKey.handle.exportJwk({}, false);
265
+ if (!jwkPublic.x || !jwkPublic.y) throw new Error('Invalid public key');
266
+ const x = Buffer.from(jwkPublic.x, 'base64url');
267
+ const y = Buffer.from(jwkPublic.y, 'base64url');
268
+ const publicBytes = Buffer.concat([Buffer.from([0x04]), x, y]);
269
+ try {
270
+ const secret = ecdh.computeSecret(publicBytes);
271
+ if (callback) {
272
+ callback(null, secret);
273
+ } else {
274
+ return secret;
275
+ }
276
+ } catch (e) {
277
+ const err = e;
278
+ if (callback) {
279
+ callback(err, undefined);
280
+ } else {
281
+ throw err;
282
+ }
283
+ }
284
+ }
285
+ function checkDiffieHellmanOptions(options) {
286
+ const {
287
+ privateKey,
288
+ publicKey
289
+ } = options;
290
+
291
+ // Check if keys are KeyObject instances
292
+ if (!privateKey || typeof privateKey !== 'object' || !('type' in privateKey)) {
293
+ throw new Error('privateKey must be a KeyObject');
294
+ }
295
+ if (!publicKey || typeof publicKey !== 'object' || !('type' in publicKey)) {
296
+ throw new Error('publicKey must be a KeyObject');
297
+ }
298
+
299
+ // type checks
300
+ if (privateKey.type !== 'private') {
301
+ throw new Error('privateKey must be a private KeyObject');
302
+ }
303
+ if (publicKey.type !== 'public') {
304
+ throw new Error('publicKey must be a public KeyObject');
305
+ }
306
+
307
+ // For asymmetric keys, check if they have the asymmetricKeyType property
308
+ const privateKeyAsym = privateKey;
309
+ const publicKeyAsym = publicKey;
310
+
311
+ // key types must match
312
+ if (privateKeyAsym.asymmetricKeyType && publicKeyAsym.asymmetricKeyType && privateKeyAsym.asymmetricKeyType !== publicKeyAsym.asymmetricKeyType) {
313
+ throw new Error('Keys must be asymmetric and their types must match');
314
+ }
315
+ switch (privateKeyAsym.asymmetricKeyType) {
316
+ // case 'dh': // TODO: uncomment when implemented
317
+ case 'ec':
318
+ {
319
+ const privateCurve = privateKeyAsym.namedCurve;
320
+ const publicCurve = publicKeyAsym.namedCurve;
321
+ if (privateCurve && publicCurve && privateCurve !== publicCurve) {
322
+ throw new Error('Private and public key curves do not match');
323
+ }
324
+ break;
325
+ }
326
+ case 'x25519':
327
+ case 'x448':
328
+ break;
329
+ default:
330
+ throw new Error(`Unknown curve type: ${privateKeyAsym.asymmetricKeyType}`);
331
+ }
332
+ }
333
+ export async function ed_generateKeyPairWebCrypto(type, extractable, keyUsages) {
334
+ if (hasAnyNotIn(keyUsages, ['sign', 'verify'])) {
335
+ throw lazyDOMException(`Unsupported key usage for ${type}`, 'SyntaxError');
336
+ }
337
+ const publicUsages = getUsagesUnion(keyUsages, 'verify');
338
+ const privateUsages = getUsagesUnion(keyUsages, 'sign');
339
+ if (privateUsages.length === 0) {
340
+ throw lazyDOMException('Usages cannot be empty', 'SyntaxError');
341
+ }
342
+
343
+ // Request DER-encoded SPKI for public key, PKCS8 for private key
344
+ const config = {
345
+ publicFormat: KFormatType.DER,
346
+ publicType: KeyEncoding.SPKI,
347
+ privateFormat: KFormatType.DER,
348
+ privateType: KeyEncoding.PKCS8
349
+ };
350
+ const ed = new Ed(type, config);
351
+ await ed.generateKeyPair();
352
+ const algorithmName = type === 'ed25519' ? 'Ed25519' : 'Ed448';
353
+ const {
354
+ pub,
355
+ priv
356
+ } = ed_createKeyObjects(ed);
357
+ const publicKey = new CryptoKey(pub, {
358
+ name: algorithmName
359
+ }, publicUsages, true);
360
+ const privateKey = new CryptoKey(priv, {
361
+ name: algorithmName
362
+ }, privateUsages, extractable);
363
+ return {
364
+ publicKey,
365
+ privateKey
366
+ };
367
+ }
368
+ export async function x_generateKeyPairWebCrypto(type, extractable, keyUsages) {
369
+ if (hasAnyNotIn(keyUsages, ['deriveKey', 'deriveBits'])) {
370
+ throw lazyDOMException(`Unsupported key usage for ${type}`, 'SyntaxError');
371
+ }
372
+ const publicUsages = getUsagesUnion(keyUsages);
373
+ const privateUsages = getUsagesUnion(keyUsages, 'deriveKey', 'deriveBits');
374
+ if (privateUsages.length === 0) {
375
+ throw lazyDOMException('Usages cannot be empty', 'SyntaxError');
376
+ }
377
+
378
+ // Request DER-encoded SPKI for public key, PKCS8 for private key
379
+ const config = {
380
+ publicFormat: KFormatType.DER,
381
+ publicType: KeyEncoding.SPKI,
382
+ privateFormat: KFormatType.DER,
383
+ privateType: KeyEncoding.PKCS8
384
+ };
385
+ const ed = new Ed(type, config);
386
+ await ed.generateKeyPair();
387
+ const algorithmName = type === 'x25519' ? 'X25519' : 'X448';
388
+ const {
389
+ pub,
390
+ priv
391
+ } = ed_createKeyObjects(ed);
392
+ const publicKey = new CryptoKey(pub, {
393
+ name: algorithmName
394
+ }, publicUsages, true);
395
+ const privateKey = new CryptoKey(priv, {
396
+ name: algorithmName
397
+ }, privateUsages, extractable);
398
+ return {
399
+ publicKey,
400
+ privateKey
401
+ };
402
+ }
403
+ export function xDeriveBits(algorithm, baseKey, length) {
404
+ const publicKey = algorithm.public;
405
+ if (!publicKey) {
406
+ throw new Error('Public key is required for X25519/X448 derivation');
407
+ }
408
+ if (baseKey.algorithm.name !== publicKey.algorithm.name) {
409
+ throw new Error('Keys must be of the same algorithm');
410
+ }
411
+ const type = baseKey.algorithm.name.toLowerCase();
412
+ const ed = new Ed(type, {});
413
+
414
+ // Export raw keys
415
+ const privateKeyBytes = baseKey.keyObject.handle.exportKey();
416
+ const publicKeyBytes = publicKey.keyObject.handle.exportKey();
417
+ const privateKeyTyped = new Uint8Array(privateKeyBytes);
418
+ const publicKeyTyped = new Uint8Array(publicKeyBytes);
419
+ const secret = ed.getSharedSecret(privateKeyTyped, publicKeyTyped);
420
+
421
+ // If length is null, return the full secret
422
+ if (length === null) {
423
+ return secret;
424
+ }
425
+
426
+ // If length is specified, truncate
427
+ const byteLength = Math.ceil(length / 8);
428
+ if (secret.byteLength >= byteLength) {
429
+ return secret.slice(0, byteLength);
430
+ }
431
+ throw new Error('Derived key is shorter than requested length');
432
+ }
433
+ //# sourceMappingURL=ed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NitroModules","Buffer","CryptoKey","KeyObject","PublicKeyObject","PrivateKeyObject","PrivateKeyObjectClass","binaryLikeToArrayBuffer","toAB","hasAnyNotIn","lazyDOMException","getUsagesUnion","KFormatType","KeyEncoding","ECDH","coerceToNumeric","value","Ed","constructor","type","config","native","createHybridObject","setCurve","diffieHellman","options","callback","privKeyObj","privateKey","pubKeyObj","publicKey","handle","exportKey","ret","Error","from","e","err","undefined","generateKeyPair","publicFormat","publicType","privateFormat","privateType","cipher","passphrase","generateKeyPairSync","getPublicKey","getPrivateKey","getSharedSecret","sign","message","key","signSync","verify","signature","verifySync","TypeError","resolvedOptions","resolveDhKeyInput","checkDiffieHellmanOptions","keyType","asymmetricKeyType","ecDiffieHellman","ed","isRawKeyInput","obj","format","input","name","expectedKeyType","namedCurve","keyData","initRawPublic","initRawSeed","initRawPrivate","ed_createKeyObjects","publicKeyData","privateKeyData","pub","createKeyObject","DER","SPKI","priv","PKCS8","ed_formatKeyPairOutput","encoding","exportRawPublic","PEM","exported","Uint8Array","toString","exportRawPrivate","exportRawSeed","ed_generateKeyPair","isAsync","derConfig","then","catch","String","curveName","ecdh","jwkPrivate","exportJwk","d","setPrivateKey","jwkPublic","x","y","publicBytes","concat","secret","computeSecret","privateKeyAsym","publicKeyAsym","privateCurve","publicCurve","ed_generateKeyPairWebCrypto","extractable","keyUsages","publicUsages","privateUsages","length","algorithmName","x_generateKeyPairWebCrypto","xDeriveBits","algorithm","baseKey","public","toLowerCase","privateKeyBytes","keyObject","publicKeyBytes","privateKeyTyped","publicKeyTyped","byteLength","Math","ceil","slice"],"sourceRoot":"../../src","sources":["ed.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AACzD,SAASC,MAAM,QAAQ,gCAAgC;AAEvD,SACEC,SAAS,EACTC,SAAS,EACTC,eAAe,EACfC,gBAAgB,IAAI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mD,CAAC;EACtE;EAEA,IAAI6F,OAAO,CAACD,SAAS,CAACzD,IAAI,KAAKvC,SAAS,CAACgG,SAAS,CAACzD,IAAI,EAAE;IACvD,MAAM,IAAInC,KAAK,CAAC,oCAAoC,CAAC;EACvD;EAEA,MAAMf,IAAI,GAAG4G,OAAO,CAACD,SAAS,CAACzD,IAAI,CAAC4D,WAAW,CAAC,CAAsB;EACtE,MAAMjE,EAAE,GAAG,IAAI/C,EAAE,CAACE,IAAI,EAAE,CAAC,CAAC,CAAC;;EAE3B;EACA,MAAM+G,eAAe,GAAGH,OAAO,CAACI,SAAS,CAACpG,MAAM,CAACC,SAAS,CAAC,CAAC;EAC5D,MAAMoG,cAAc,GAAGtG,SAAS,CAACqG,SAAS,CAACpG,MAAM,CAACC,SAAS,CAAC,CAAC;EAE7D,MAAMqG,eAAe,GAAG,IAAI3C,UAAU,CAACwC,eAAe,CAAC;EACvD,MAAMI,cAAc,GAAG,IAAI5C,UAAU,CAAC0C,cAAc,CAAC;EAErD,MAAMrB,MAAM,GAAG/C,EAAE,CAACf,eAAe,CAACoF,eAAe,EAAEC,cAAc,CAAC;;EAElE;EACA,IAAIZ,MAAM,KAAK,IAAI,EAAE;IACnB,OAAOX,MAAM;EACf;;EAEA;EACA,MAAMwB,UAAU,GAAGC,IAAI,CAACC,IAAI,CAACf,MAAM,GAAG,CAAC,CAAC;EACxC,IAAIX,MAAM,CAACwB,UAAU,IAAIA,UAAU,EAAE;IACnC,OAAOxB,MAAM,CAAC2B,KAAK,CAAC,CAAC,EAAEH,UAAU,CAAC;EACpC;EAEA,MAAM,IAAIrG,KAAK,CAAC,8CAA8C,CAAC;AACjE","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=@types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["expo-plugin/@types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ import { createRunOncePlugin } from 'expo/config-plugins';
4
+ import { withSodiumIos } from './withSodiumIos';
5
+ import { withSodiumAndroid } from './withSodiumAndroid';
6
+ import { withXCode } from './withXCode';
7
+ const withRNQCInternal = (config, props = {}) => {
8
+ // add XCode workarounds for some 16.x releases that are not RN-friendly
9
+ config = withXCode(config, props);
10
+
11
+ // enable libsodium algorithms
12
+ if (props.sodiumEnabled) {
13
+ config = withSodiumIos(config, props);
14
+ config = withSodiumAndroid(config, props);
15
+ }
16
+ return config;
17
+ };
18
+ export function createRNQCPlugin(name, version) {
19
+ return createRunOncePlugin(withRNQCInternal, name, version);
20
+ }
21
+ //# sourceMappingURL=withRNQC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createRunOncePlugin","withSodiumIos","withSodiumAndroid","withXCode","withRNQCInternal","config","props","sodiumEnabled","createRNQCPlugin","name","version"],"sourceRoot":"../../../src","sources":["expo-plugin/withRNQC.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAAQ,qBAAqB;AAGzD,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,SAAS,QAAQ,aAAa;AAEvC,MAAMC,gBAA2C,GAAGA,CAACC,MAAM,EAAEC,KAAK,GAAG,CAAC,CAAC,KAAK;EAC1E;EACAD,MAAM,GAAGF,SAAS,CAACE,MAAM,EAAEC,KAAK,CAAC;;EAEjC;EACA,IAAIA,KAAK,CAACC,aAAa,EAAE;IACvBF,MAAM,GAAGJ,aAAa,CAACI,MAAM,EAAEC,KAAK,CAAC;IACrCD,MAAM,GAAGH,iBAAiB,CAACG,MAAM,EAAEC,KAAK,CAAC;EAC3C;EAEA,OAAOD,MAAM;AACf,CAAC;AAED,OAAO,SAASG,gBAAgBA,CAACC,IAAY,EAAEC,OAAe,EAAE;EAC9D,OAAOV,mBAAmB,CAACI,gBAAgB,EAAEK,IAAI,EAAEC,OAAO,CAAC;AAC7D","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ import { withGradleProperties } from 'expo/config-plugins';
4
+ export const withSodiumAndroid = config => {
5
+ return withGradleProperties(config, config => {
6
+ config.modResults = config.modResults || [];
7
+
8
+ // Check if the property already exists
9
+ const existingProperty = config.modResults.find(item => item.type === 'property' && item.key === 'sodiumEnabled');
10
+ if (!existingProperty) {
11
+ config.modResults.push({
12
+ type: 'property',
13
+ key: 'sodiumEnabled',
14
+ value: 'true'
15
+ });
16
+ }
17
+ return config;
18
+ });
19
+ };
20
+ //# sourceMappingURL=withSodiumAndroid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["withGradleProperties","withSodiumAndroid","config","modResults","existingProperty","find","item","type","key","push","value"],"sourceRoot":"../../../src","sources":["expo-plugin/withSodiumAndroid.ts"],"mappings":";;AACA,SAASA,oBAAoB,QAAQ,qBAAqB;AAG1D,OAAO,MAAMC,iBAA4C,GAAGC,MAAM,IAAI;EACpE,OAAOF,oBAAoB,CAACE,MAAM,EAAEA,MAAM,IAAI;IAC5CA,MAAM,CAACC,UAAU,GAAGD,MAAM,CAACC,UAAU,IAAI,EAAE;;IAE3C;IACA,MAAMC,gBAAgB,GAAGF,MAAM,CAACC,UAAU,CAACE,IAAI,CAC7CC,IAAI,IAAIA,IAAI,CAACC,IAAI,KAAK,UAAU,IAAID,IAAI,CAACE,GAAG,KAAK,eACnD,CAAC;IAED,IAAI,CAACJ,gBAAgB,EAAE;MACrBF,MAAM,CAACC,UAAU,CAACM,IAAI,CAAC;QACrBF,IAAI,EAAE,UAAU;QAChBC,GAAG,EAAE,eAAe;QACpBE,KAAK,EAAE;MACT,CAAC,CAAC;IACJ;IAEA,OAAOR,MAAM;EACf,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ import { withDangerousMod } from 'expo/config-plugins';
4
+ import fs from 'fs';
5
+ import path from 'path';
6
+ export const withSodiumIos = config => {
7
+ return withDangerousMod(config, ['ios', config => {
8
+ const podfilePath = path.join(config.modRequest.platformProjectRoot, 'Podfile');
9
+ let contents = fs.readFileSync(podfilePath, 'utf-8');
10
+ if (!contents.includes("ENV['SODIUM_ENABLED']")) {
11
+ contents = `ENV['SODIUM_ENABLED'] = '1'\n${contents}`;
12
+ fs.writeFileSync(podfilePath, contents);
13
+ }
14
+ return config;
15
+ }]);
16
+ };
17
+ //# sourceMappingURL=withSodiumIos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["withDangerousMod","fs","path","withSodiumIos","config","podfilePath","join","modRequest","platformProjectRoot","contents","readFileSync","includes","writeFileSync"],"sourceRoot":"../../../src","sources":["expo-plugin/withSodiumIos.ts"],"mappings":";;AACA,SAASA,gBAAgB,QAAQ,qBAAqB;AACtD,OAAOC,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;AAGvB,OAAO,MAAMC,aAAwC,GAAGC,MAAM,IAAI;EAChE,OAAOJ,gBAAgB,CAACI,MAAM,EAAE,CAC9B,KAAK,EACLA,MAAM,IAAI;IACR,MAAMC,WAAW,GAAGH,IAAI,CAACI,IAAI,CAC3BF,MAAM,CAACG,UAAU,CAACC,mBAAmB,EACrC,SACF,CAAC;IACD,IAAIC,QAAQ,GAAGR,EAAE,CAACS,YAAY,CAACL,WAAW,EAAE,OAAO,CAAC;IAEpD,IAAI,CAACI,QAAQ,CAACE,QAAQ,CAAC,uBAAuB,CAAC,EAAE;MAC/CF,QAAQ,GAAG,gCAAgCA,QAAQ,EAAE;MACrDR,EAAE,CAACW,aAAa,CAACP,WAAW,EAAEI,QAAQ,CAAC;IACzC;IAEA,OAAOL,MAAM;EACf,CAAC,CACF,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+
3
+ import { IOSConfig, withDangerousMod, withPodfileProperties, withXcodeProject } from 'expo/config-plugins';
4
+ import fs from 'fs';
5
+ import path from 'path';
6
+ const MIN_IOS_DEPLOYMENT_TARGET = '16.4';
7
+ const MIN_PARTS = MIN_IOS_DEPLOYMENT_TARGET.split('.').map(Number);
8
+
9
+ /**
10
+ * True when `version` is absent or below our minimum, i.e. we should raise it.
11
+ * Compared component-wise: '16.10' and '16.4.1' are both above '16.4'.
12
+ */
13
+ export function needsRaising(version) {
14
+ if (!version) return true;
15
+ const parts = version.split('.').map(Number);
16
+ if (!parts.every(Number.isFinite)) {
17
+ console.warn(`[react-native-quick-crypto] leaving unparseable iOS deployment target "${version}" alone`);
18
+ return false;
19
+ }
20
+ for (let i = 0; i < Math.max(parts.length, MIN_PARTS.length); i++) {
21
+ const diff = (parts[i] ?? 0) - (MIN_PARTS[i] ?? 0);
22
+ if (diff !== 0) return diff < 0;
23
+ }
24
+ return false;
25
+ }
26
+ const POST_INSTALL_PATCH = ` # react-native-quick-crypto: floor the pods' deployment target, never lower it
27
+ # https://github.com/mrousavy/nitro/issues/422#issuecomment-2545988256
28
+ installer.pods_project.targets.each do |target|
29
+ target.build_configurations.each do |config|
30
+ current = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_s
31
+ if !Gem::Version.correct?(current) ||
32
+ Gem::Version.new(current) < Gem::Version.new('${MIN_IOS_DEPLOYMENT_TARGET}')
33
+ config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '${MIN_IOS_DEPLOYMENT_TARGET}'
34
+ end
35
+ end
36
+ end`;
37
+
38
+ /**
39
+ * Fallback for Podfiles whose post_install doesn't already pin a deployment
40
+ * target. No-op when one is already pinned - that's the app's call, not ours.
41
+ */
42
+ export function patchPodfile(contents) {
43
+ const alreadyPinned = /\.build_settings\s*\[\s*['"]IPHONEOS_DEPLOYMENT_TARGET['"]\s*\]\s*=/.test(contents);
44
+ if (alreadyPinned) return contents;
45
+ const patched = contents.replace(/(post_install\s+do\s+\|installer\|[\s\S]*?)(\r?\n\s\send\s*)$/m, `$1\n\n${POST_INSTALL_PATCH}\n$2`);
46
+ if (patched === contents) {
47
+ console.warn('[react-native-quick-crypto] no post_install block found in the Podfile; skipping the iOS deployment target floor');
48
+ }
49
+ return patched;
50
+ }
51
+
52
+ /**
53
+ * Workaround for some jank XCode releases that break React Native native modules
54
+ *
55
+ * see: https://github.com/mrousavy/nitro/issues/422#issuecomment-2545988256
56
+ *
57
+ * Raises the iOS deployment target to our minimum wherever it is lower. Reads
58
+ * the value at mod time rather than from static `plugins` config, so it floors
59
+ * apps that set a higher target by any means and never lowers one. (#1066)
60
+ */
61
+ export const withXCode = config => {
62
+ // what the generated Podfile reads for `platform :ios`
63
+ config = withPodfileProperties(config, podfileConfig => {
64
+ if (needsRaising(podfileConfig.modResults['ios.deploymentTarget'])) {
65
+ podfileConfig.modResults['ios.deploymentTarget'] = MIN_IOS_DEPLOYMENT_TARGET;
66
+ }
67
+ return podfileConfig;
68
+ });
69
+
70
+ // the app target in the generated Xcode project
71
+ config = withXcodeProject(config, xcodeConfig => {
72
+ const {
73
+ Target,
74
+ XcodeUtils
75
+ } = IOSConfig;
76
+ const listIds = Target.getNativeTargets(xcodeConfig.modResults).filter(([, target]) => Target.isTargetOfType(target, Target.TargetType.APPLICATION)).map(([, target]) => target.buildConfigurationList);
77
+ for (const listId of listIds) {
78
+ const configurations = XcodeUtils.getBuildConfigurationsForListId(xcodeConfig.modResults, listId);
79
+ for (const [, {
80
+ buildSettings
81
+ }] of configurations) {
82
+ // only floor an explicit target - writing one that was inherited from
83
+ // the project level could itself be a downgrade
84
+ const current = buildSettings?.IPHONEOS_DEPLOYMENT_TARGET;
85
+ if (current && needsRaising(String(current))) {
86
+ buildSettings.IPHONEOS_DEPLOYMENT_TARGET = MIN_IOS_DEPLOYMENT_TARGET;
87
+ }
88
+ }
89
+ }
90
+ return xcodeConfig;
91
+ });
92
+
93
+ // pods that don't inherit the platform from the Podfile
94
+ config = withDangerousMod(config, ['ios', modConfig => {
95
+ const podfilePath = path.join(modConfig.modRequest.platformProjectRoot, 'Podfile');
96
+ fs.writeFileSync(podfilePath, patchPodfile(fs.readFileSync(podfilePath, 'utf-8')));
97
+ return modConfig;
98
+ }]);
99
+ return config;
100
+ };
101
+ //# sourceMappingURL=withXCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["IOSConfig","withDangerousMod","withPodfileProperties","withXcodeProject","fs","path","MIN_IOS_DEPLOYMENT_TARGET","MIN_PARTS","split","map","Number","needsRaising","version","parts","every","isFinite","console","warn","i","Math","max","length","diff","POST_INSTALL_PATCH","patchPodfile","contents","alreadyPinned","test","patched","replace","withXCode","config","podfileConfig","modResults","xcodeConfig","Target","XcodeUtils","listIds","getNativeTargets","filter","target","isTargetOfType","TargetType","APPLICATION","buildConfigurationList","listId","configurations","getBuildConfigurationsForListId","buildSettings","current","IPHONEOS_DEPLOYMENT_TARGET","String","modConfig","podfilePath","join","modRequest","platformProjectRoot","writeFileSync","readFileSync"],"sourceRoot":"../../../src","sources":["expo-plugin/withXCode.ts"],"mappings":";;AAEA,SACEA,SAAS,EACTC,gBAAgB,EAChBC,qBAAqB,EACrBC,gBAAgB,QACX,qBAAqB;AAC5B,OAAOC,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;AAEvB,MAAMC,yBAAyB,GAAG,MAAM;AACxC,MAAMC,SAAS,GAAGD,yBAAyB,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAAC;;AAElE;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAACC,OAA2B,EAAW;EACjE,IAAI,CAACA,OAAO,EAAE,OAAO,IAAI;EAEzB,MAAMC,KAAK,GAAGD,OAAO,CAACJ,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAAC;EAC5C,IAAI,CAACG,KAAK,CAACC,KAAK,CAACJ,MAAM,CAACK,QAAQ,CAAC,EAAE;IACjCC,OAAO,CAACC,IAAI,CACV,0EAA0EL,OAAO,SACnF,CAAC;IACD,OAAO,KAAK;EACd;EAEA,KAAK,IAAIM,CAAC,GAAG,CAAC,EAAEA,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