react-native-quick-crypto 1.0.0 → 1.0.2

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 (92) hide show
  1. package/QuickCrypto.podspec +19 -52
  2. package/android/CMakeLists.txt +4 -2
  3. package/android/build.gradle +1 -1
  4. package/cpp/cipher/HybridCipher.cpp +20 -3
  5. package/cpp/cipher/HybridRsaCipher.cpp +20 -1
  6. package/cpp/ed25519/HybridEdKeyPair.cpp +8 -2
  7. package/cpp/keys/HybridKeyObjectHandle.cpp +8 -0
  8. package/cpp/keys/KeyObjectData.hpp +1 -1
  9. package/cpp/mldsa/HybridMlDsaKeyPair.cpp +264 -0
  10. package/cpp/mldsa/HybridMlDsaKeyPair.hpp +47 -0
  11. package/cpp/sign/HybridSignHandle.cpp +97 -22
  12. package/cpp/sign/HybridVerifyHandle.cpp +90 -21
  13. package/deps/ncrypto/.bazelignore +4 -0
  14. package/deps/ncrypto/.bazelrc +2 -0
  15. package/deps/ncrypto/.bazelversion +1 -0
  16. package/deps/ncrypto/.clang-format +111 -0
  17. package/deps/ncrypto/.github/workflows/bazel.yml +58 -0
  18. package/deps/ncrypto/.github/workflows/linter.yml +38 -0
  19. package/deps/ncrypto/.github/workflows/macos.yml +43 -0
  20. package/deps/ncrypto/.github/workflows/ubuntu.yml +46 -0
  21. package/deps/ncrypto/.github/workflows/visual-studio.yml +49 -0
  22. package/deps/ncrypto/.python-version +1 -0
  23. package/deps/ncrypto/BUILD.bazel +36 -0
  24. package/deps/ncrypto/CMakeLists.txt +55 -0
  25. package/deps/ncrypto/LICENSE +21 -0
  26. package/deps/ncrypto/MODULE.bazel +1 -0
  27. package/deps/ncrypto/MODULE.bazel.lock +280 -0
  28. package/deps/ncrypto/README.md +18 -0
  29. package/deps/ncrypto/WORKSPACE +15 -0
  30. package/deps/ncrypto/cmake/CPM.cmake +1225 -0
  31. package/deps/ncrypto/cmake/ncrypto-flags.cmake +16 -0
  32. package/deps/ncrypto/include/dh-primes.h +67 -0
  33. package/deps/ncrypto/{ncrypto.h → include/ncrypto.h} +361 -89
  34. package/deps/ncrypto/patches/0001-Expose-libdecrepit-so-NodeJS-can-use-it-for-ncrypto.patch +28 -0
  35. package/deps/ncrypto/pyproject.toml +38 -0
  36. package/deps/ncrypto/src/CMakeLists.txt +15 -0
  37. package/deps/ncrypto/src/engine.cpp +93 -0
  38. package/deps/ncrypto/{ncrypto.cc → src/ncrypto.cpp} +1168 -234
  39. package/deps/ncrypto/tests/BUILD.bazel +9 -0
  40. package/deps/ncrypto/tests/CMakeLists.txt +7 -0
  41. package/deps/ncrypto/tests/basic.cpp +86 -0
  42. package/deps/ncrypto/tools/run-clang-format.sh +42 -0
  43. package/lib/commonjs/ed.js +68 -0
  44. package/lib/commonjs/ed.js.map +1 -1
  45. package/lib/commonjs/keys/classes.js +6 -0
  46. package/lib/commonjs/keys/classes.js.map +1 -1
  47. package/lib/commonjs/mldsa.js +69 -0
  48. package/lib/commonjs/mldsa.js.map +1 -0
  49. package/lib/commonjs/specs/mlDsaKeyPair.nitro.js +6 -0
  50. package/lib/commonjs/specs/mlDsaKeyPair.nitro.js.map +1 -0
  51. package/lib/commonjs/subtle.js +483 -13
  52. package/lib/commonjs/subtle.js.map +1 -1
  53. package/lib/commonjs/utils/types.js.map +1 -1
  54. package/lib/module/ed.js +66 -0
  55. package/lib/module/ed.js.map +1 -1
  56. package/lib/module/keys/classes.js +6 -0
  57. package/lib/module/keys/classes.js.map +1 -1
  58. package/lib/module/mldsa.js +63 -0
  59. package/lib/module/mldsa.js.map +1 -0
  60. package/lib/module/specs/mlDsaKeyPair.nitro.js +4 -0
  61. package/lib/module/specs/mlDsaKeyPair.nitro.js.map +1 -0
  62. package/lib/module/subtle.js +484 -14
  63. package/lib/module/subtle.js.map +1 -1
  64. package/lib/module/utils/types.js.map +1 -1
  65. package/lib/tsconfig.tsbuildinfo +1 -1
  66. package/lib/typescript/ed.d.ts +4 -1
  67. package/lib/typescript/ed.d.ts.map +1 -1
  68. package/lib/typescript/index.d.ts +2 -0
  69. package/lib/typescript/index.d.ts.map +1 -1
  70. package/lib/typescript/keys/classes.d.ts +2 -0
  71. package/lib/typescript/keys/classes.d.ts.map +1 -1
  72. package/lib/typescript/mldsa.d.ts +18 -0
  73. package/lib/typescript/mldsa.d.ts.map +1 -0
  74. package/lib/typescript/specs/mlDsaKeyPair.nitro.d.ts +16 -0
  75. package/lib/typescript/specs/mlDsaKeyPair.nitro.d.ts.map +1 -0
  76. package/lib/typescript/subtle.d.ts +4 -1
  77. package/lib/typescript/subtle.d.ts.map +1 -1
  78. package/lib/typescript/utils/types.d.ts +14 -6
  79. package/lib/typescript/utils/types.d.ts.map +1 -1
  80. package/nitrogen/generated/android/QuickCrypto+autolinking.cmake +1 -0
  81. package/nitrogen/generated/android/QuickCryptoOnLoad.cpp +10 -0
  82. package/nitrogen/generated/ios/QuickCryptoAutolinking.mm +10 -0
  83. package/nitrogen/generated/shared/c++/AsymmetricKeyType.hpp +12 -0
  84. package/nitrogen/generated/shared/c++/HybridMlDsaKeyPairSpec.cpp +29 -0
  85. package/nitrogen/generated/shared/c++/HybridMlDsaKeyPairSpec.hpp +73 -0
  86. package/package.json +7 -3
  87. package/src/ed.ts +102 -0
  88. package/src/keys/classes.ts +9 -0
  89. package/src/mldsa.ts +125 -0
  90. package/src/specs/mlDsaKeyPair.nitro.ts +29 -0
  91. package/src/subtle.ts +667 -17
  92. package/src/utils/types.ts +27 -6
@@ -0,0 +1,28 @@
1
+ From feda75fa93bb54bc697f1f771a0aec573ab87ab7 Mon Sep 17 00:00:00 2001
2
+ From: Nicholas Paun <npaun@cloudflare.com>
3
+ Date: Fri, 26 Sep 2025 14:57:57 -0700
4
+ Subject: [PATCH] Expose libdecrepit so NodeJS can use it for ncrypto
5
+
6
+ ---
7
+ BUILD.bazel | 2 +-
8
+ 1 file changed, 1 insertion(+), 1 deletion(-)
9
+
10
+ diff --git a/BUILD.bazel b/BUILD.bazel
11
+ index b7dc35932..7d214716c 100644
12
+ --- a/BUILD.bazel
13
+ +++ b/BUILD.bazel
14
+ @@ -155,10 +155,10 @@ bssl_cc_binary(
15
+ ],
16
+ )
17
+
18
+ -# Build, but do not export libdecrepit.
19
+ bssl_cc_library(
20
+ name = "decrepit",
21
+ srcs = decrepit_sources,
22
+ + visibility = ["//visibility:public"],
23
+ copts = ["-DBORINGSSL_IMPLEMENTATION"],
24
+ internal_hdrs = decrepit_internal_headers,
25
+ deps = [
26
+ --
27
+ 2.50.1 (Apple Git-155)
28
+
@@ -0,0 +1,38 @@
1
+ [project]
2
+ name = "ncrypto"
3
+ requires-python = ">=3.12"
4
+
5
+ [tool.ruff]
6
+ line-length = 120
7
+ target-version = "py312"
8
+
9
+ [tool.ruff.format]
10
+ quote-style = "single"
11
+ indent-style = "space"
12
+ docstring-code-format = true
13
+
14
+ [tool.ruff.lint]
15
+ select = [
16
+ "C90", # McCabe cyclomatic complexity
17
+ "E", # pycodestyle
18
+ "F", # Pyflakes
19
+ "ICN", # flake8-import-conventions
20
+ "INT", # flake8-gettext
21
+ "PLC", # Pylint conventions
22
+ "PLE", # Pylint errors
23
+ "PLR09", # Pylint refactoring: max-args, max-branches, max returns, max-statements
24
+ "PYI", # flake8-pyi
25
+ "RSE", # flake8-raise
26
+ "RUF", # Ruff-specific rules
27
+ "T10", # flake8-debugger
28
+ "TCH", # flake8-type-checking
29
+ "TID", # flake8-tidy-imports
30
+ "W", # pycodestyle
31
+ "YTT", # flake8-2020
32
+ "ANN" # flake8-annotations
33
+ ]
34
+ ignore = [
35
+ "E722", # Do not use bare `except`
36
+ "ANN101", # Missing type annotation for self in method
37
+ "TID252", # Prefer absolute imports over relative imports from parent modules
38
+ ]
@@ -0,0 +1,15 @@
1
+ add_library(ncrypto ncrypto.cpp engine.cpp)
2
+ target_link_libraries(ncrypto PUBLIC ssl crypto)
3
+
4
+ if (NCRYPTO_BSSL_LIBDECREPIT_MISSING)
5
+ target_compile_definitions(ncrypto PUBLIC NCRYPTO_BSSL_LIBDECREPIT_MISSING=1)
6
+ else()
7
+ target_link_libraries(ncrypto PUBLIC decrepit)
8
+ endif()
9
+
10
+ target_include_directories(ncrypto
11
+ PUBLIC
12
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
13
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
14
+ $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
15
+ )
@@ -0,0 +1,93 @@
1
+ #include "ncrypto.h"
2
+
3
+ namespace ncrypto {
4
+
5
+ // ============================================================================
6
+ // Engine
7
+
8
+ #ifndef OPENSSL_NO_ENGINE
9
+ EnginePointer::EnginePointer(ENGINE* engine_, bool finish_on_exit_)
10
+ : engine(engine_), finish_on_exit(finish_on_exit_) {}
11
+
12
+ EnginePointer::EnginePointer(EnginePointer&& other) noexcept
13
+ : engine(other.engine), finish_on_exit(other.finish_on_exit) {
14
+ other.release();
15
+ }
16
+
17
+ EnginePointer::~EnginePointer() {
18
+ reset();
19
+ }
20
+
21
+ EnginePointer& EnginePointer::operator=(EnginePointer&& other) noexcept {
22
+ if (this == &other) return *this;
23
+ this->~EnginePointer();
24
+ return *new (this) EnginePointer(std::move(other));
25
+ }
26
+
27
+ void EnginePointer::reset(ENGINE* engine_, bool finish_on_exit_) {
28
+ if (engine != nullptr) {
29
+ if (finish_on_exit) {
30
+ // This also does the equivalent of ENGINE_free.
31
+ ENGINE_finish(engine);
32
+ } else {
33
+ ENGINE_free(engine);
34
+ }
35
+ }
36
+ engine = engine_;
37
+ finish_on_exit = finish_on_exit_;
38
+ }
39
+
40
+ ENGINE* EnginePointer::release() {
41
+ ENGINE* ret = engine;
42
+ engine = nullptr;
43
+ finish_on_exit = false;
44
+ return ret;
45
+ }
46
+
47
+ EnginePointer EnginePointer::getEngineByName(const char* name,
48
+ CryptoErrorList* errors) {
49
+ MarkPopErrorOnReturn mark_pop_error_on_return(errors);
50
+ EnginePointer engine(ENGINE_by_id(name));
51
+ if (!engine) {
52
+ // Engine not found, try loading dynamically.
53
+ engine = EnginePointer(ENGINE_by_id("dynamic"));
54
+ if (engine) {
55
+ if (!ENGINE_ctrl_cmd_string(engine.get(), "SO_PATH", name, 0) ||
56
+ !ENGINE_ctrl_cmd_string(engine.get(), "LOAD", nullptr, 0)) {
57
+ engine.reset();
58
+ }
59
+ }
60
+ }
61
+ return engine;
62
+ }
63
+
64
+ bool EnginePointer::setAsDefault(uint32_t flags, CryptoErrorList* errors) {
65
+ if (engine == nullptr) return false;
66
+ ClearErrorOnReturn clear_error_on_return(errors);
67
+ return ENGINE_set_default(engine, flags) != 0;
68
+ }
69
+
70
+ bool EnginePointer::init(bool finish_on_exit) {
71
+ if (engine == nullptr) return false;
72
+ if (finish_on_exit) setFinishOnExit();
73
+ return ENGINE_init(engine) == 1;
74
+ }
75
+
76
+ EVPKeyPointer EnginePointer::loadPrivateKey(const char* key_name) {
77
+ if (engine == nullptr) return EVPKeyPointer();
78
+ return EVPKeyPointer(
79
+ ENGINE_load_private_key(engine, key_name, nullptr, nullptr));
80
+ }
81
+
82
+ void EnginePointer::initEnginesOnce() {
83
+ static bool initialized = false;
84
+ if (!initialized) {
85
+ ENGINE_load_builtin_engines();
86
+ ENGINE_register_all_complete();
87
+ initialized = true;
88
+ }
89
+ }
90
+
91
+ #endif // OPENSSL_NO_ENGINE
92
+
93
+ } // namespace ncrypto