@onekeyfe/react-native-bundle-crypto 3.0.81 → 3.0.85

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 (45) hide show
  1. package/nitrogen/generated/android/c++/JDirHashEntry.hpp +2 -2
  2. package/nitrogen/generated/android/c++/JHybridReactNativeBundleCryptoSpec.cpp +31 -29
  3. package/nitrogen/generated/android/c++/JHybridReactNativeBundleCryptoSpec.hpp +20 -22
  4. package/nitrogen/generated/android/c++/JSha256Result.hpp +2 -2
  5. package/nitrogen/generated/android/c++/JVerifyDetachedAscResult.hpp +2 -2
  6. package/nitrogen/generated/android/c++/JVerifyGpgCleartextResult.hpp +2 -2
  7. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativebundlecrypto/DirHashEntry.kt +2 -2
  8. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativebundlecrypto/HybridReactNativeBundleCryptoSpec.kt +16 -19
  9. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativebundlecrypto/Sha256Result.kt +2 -2
  10. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativebundlecrypto/VerifyDetachedAscResult.kt +2 -2
  11. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativebundlecrypto/VerifyGpgCleartextResult.kt +2 -2
  12. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativebundlecrypto/reactnativebundlecryptoOnLoad.kt +1 -1
  13. package/nitrogen/generated/android/reactnativebundlecrypto+autolinking.cmake +1 -1
  14. package/nitrogen/generated/android/reactnativebundlecrypto+autolinking.gradle +1 -1
  15. package/nitrogen/generated/android/reactnativebundlecryptoOnLoad.cpp +27 -17
  16. package/nitrogen/generated/android/reactnativebundlecryptoOnLoad.hpp +14 -5
  17. package/nitrogen/generated/ios/ReactNativeBundleCrypto+autolinking.rb +2 -2
  18. package/nitrogen/generated/ios/ReactNativeBundleCrypto-Swift-Cxx-Bridge.cpp +1 -1
  19. package/nitrogen/generated/ios/ReactNativeBundleCrypto-Swift-Cxx-Bridge.hpp +2 -2
  20. package/nitrogen/generated/ios/ReactNativeBundleCrypto-Swift-Cxx-Umbrella.hpp +1 -1
  21. package/nitrogen/generated/ios/ReactNativeBundleCryptoAutolinking.mm +1 -1
  22. package/nitrogen/generated/ios/ReactNativeBundleCryptoAutolinking.swift +9 -8
  23. package/nitrogen/generated/ios/c++/HybridReactNativeBundleCryptoSpecSwift.cpp +1 -1
  24. package/nitrogen/generated/ios/c++/HybridReactNativeBundleCryptoSpecSwift.hpp +7 -1
  25. package/nitrogen/generated/ios/swift/DirHashEntry.swift +5 -18
  26. package/nitrogen/generated/ios/swift/Func_void.swift +1 -2
  27. package/nitrogen/generated/ios/swift/Func_void_Sha256Result.swift +1 -2
  28. package/nitrogen/generated/ios/swift/Func_void_VerifyDetachedAscResult.swift +1 -2
  29. package/nitrogen/generated/ios/swift/Func_void_VerifyGpgCleartextResult.swift +1 -2
  30. package/nitrogen/generated/ios/swift/Func_void_bool.swift +1 -2
  31. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -2
  32. package/nitrogen/generated/ios/swift/Func_void_std__vector_DirHashEntry_.swift +1 -2
  33. package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +1 -2
  34. package/nitrogen/generated/ios/swift/HybridReactNativeBundleCryptoSpec.swift +3 -4
  35. package/nitrogen/generated/ios/swift/HybridReactNativeBundleCryptoSpec_cxx.swift +9 -2
  36. package/nitrogen/generated/ios/swift/Sha256Result.swift +19 -44
  37. package/nitrogen/generated/ios/swift/VerifyDetachedAscResult.swift +21 -52
  38. package/nitrogen/generated/ios/swift/VerifyGpgCleartextResult.swift +21 -52
  39. package/nitrogen/generated/shared/c++/DirHashEntry.hpp +16 -8
  40. package/nitrogen/generated/shared/c++/HybridReactNativeBundleCryptoSpec.cpp +1 -1
  41. package/nitrogen/generated/shared/c++/HybridReactNativeBundleCryptoSpec.hpp +1 -1
  42. package/nitrogen/generated/shared/c++/Sha256Result.hpp +16 -8
  43. package/nitrogen/generated/shared/c++/VerifyDetachedAscResult.hpp +19 -11
  44. package/nitrogen/generated/shared/c++/VerifyGpgCleartextResult.hpp +19 -11
  45. package/package.json +4 -4
@@ -2,7 +2,7 @@
2
2
  /// JDirHashEntry.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -21,7 +21,7 @@ namespace margelo::nitro::reactnativebundlecrypto {
21
21
  */
22
22
  struct JDirHashEntry final: public jni::JavaClass<JDirHashEntry> {
23
23
  public:
24
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativebundlecrypto/DirHashEntry;";
24
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativebundlecrypto/DirHashEntry;";
25
25
 
26
26
  public:
27
27
  /**
@@ -2,7 +2,7 @@
2
2
  /// JHybridReactNativeBundleCryptoSpec.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "JHybridReactNativeBundleCryptoSpec.hpp"
@@ -29,33 +29,35 @@ namespace margelo::nitro::reactnativebundlecrypto { struct DirHashEntry; }
29
29
  #include "DirHashEntry.hpp"
30
30
  #include <vector>
31
31
  #include "JDirHashEntry.hpp"
32
+ #include <NitroModules/JUnit.hpp>
32
33
 
33
34
  namespace margelo::nitro::reactnativebundlecrypto {
34
35
 
35
- jni::local_ref<JHybridReactNativeBundleCryptoSpec::jhybriddata> JHybridReactNativeBundleCryptoSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
36
- return makeCxxInstance(jThis);
37
- }
38
-
39
- void JHybridReactNativeBundleCryptoSpec::registerNatives() {
40
- registerHybrid({
41
- makeNativeMethod("initHybrid", JHybridReactNativeBundleCryptoSpec::initHybrid),
42
- });
36
+ std::shared_ptr<JHybridReactNativeBundleCryptoSpec> JHybridReactNativeBundleCryptoSpec::JavaPart::getJHybridReactNativeBundleCryptoSpec() {
37
+ auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
38
+ auto castHybridObject = std::dynamic_pointer_cast<JHybridReactNativeBundleCryptoSpec>(hybridObject);
39
+ if (castHybridObject == nullptr) [[unlikely]] {
40
+ throw std::runtime_error("Failed to downcast JHybridObject to JHybridReactNativeBundleCryptoSpec!");
41
+ }
42
+ return castHybridObject;
43
43
  }
44
44
 
45
- size_t JHybridReactNativeBundleCryptoSpec::getExternalMemorySize() noexcept {
46
- static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
47
- return method(_javaPart);
45
+ jni::local_ref<JHybridReactNativeBundleCryptoSpec::CxxPart::jhybriddata> JHybridReactNativeBundleCryptoSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
46
+ return makeCxxInstance(jThis);
48
47
  }
49
48
 
50
- void JHybridReactNativeBundleCryptoSpec::dispose() noexcept {
51
- static const auto method = javaClassStatic()->getMethod<void()>("dispose");
52
- method(_javaPart);
49
+ std::shared_ptr<JHybridObject> JHybridReactNativeBundleCryptoSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
50
+ auto castJavaPart = jni::dynamic_ref_cast<JHybridReactNativeBundleCryptoSpec::JavaPart>(javaPart);
51
+ if (castJavaPart == nullptr) [[unlikely]] {
52
+ throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridReactNativeBundleCryptoSpec::JavaPart!");
53
+ }
54
+ return std::make_shared<JHybridReactNativeBundleCryptoSpec>(castJavaPart);
53
55
  }
54
56
 
55
- std::string JHybridReactNativeBundleCryptoSpec::toString() {
56
- static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
57
- auto javaString = method(_javaPart);
58
- return javaString->toStdString();
57
+ void JHybridReactNativeBundleCryptoSpec::CxxPart::registerNatives() {
58
+ registerHybrid({
59
+ makeNativeMethod("initHybrid", JHybridReactNativeBundleCryptoSpec::CxxPart::initHybrid),
60
+ });
59
61
  }
60
62
 
61
63
  // Properties
@@ -63,7 +65,7 @@ namespace margelo::nitro::reactnativebundlecrypto {
63
65
 
64
66
  // Methods
65
67
  std::shared_ptr<Promise<VerifyGpgCleartextResult>> JHybridReactNativeBundleCryptoSpec::verifyGpgCleartext(const std::string& signedMessage) {
66
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* signedMessage */)>("verifyGpgCleartext");
68
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* signedMessage */)>("verifyGpgCleartext");
67
69
  auto __result = method(_javaPart, jni::make_jstring(signedMessage));
68
70
  return [&]() {
69
71
  auto __promise = Promise<VerifyGpgCleartextResult>::create();
@@ -79,7 +81,7 @@ namespace margelo::nitro::reactnativebundlecrypto {
79
81
  }();
80
82
  }
81
83
  std::shared_ptr<Promise<VerifyDetachedAscResult>> JHybridReactNativeBundleCryptoSpec::verifyDetachedAsc(const std::string& ascContent) {
82
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* ascContent */)>("verifyDetachedAsc");
84
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* ascContent */)>("verifyDetachedAsc");
83
85
  auto __result = method(_javaPart, jni::make_jstring(ascContent));
84
86
  return [&]() {
85
87
  auto __promise = Promise<VerifyDetachedAscResult>::create();
@@ -95,7 +97,7 @@ namespace margelo::nitro::reactnativebundlecrypto {
95
97
  }();
96
98
  }
97
99
  std::shared_ptr<Promise<Sha256Result>> JHybridReactNativeBundleCryptoSpec::sha256OfFile(const std::string& filePath) {
98
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* filePath */)>("sha256OfFile");
100
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* filePath */)>("sha256OfFile");
99
101
  auto __result = method(_javaPart, jni::make_jstring(filePath));
100
102
  return [&]() {
101
103
  auto __promise = Promise<Sha256Result>::create();
@@ -111,12 +113,12 @@ namespace margelo::nitro::reactnativebundlecrypto {
111
113
  }();
112
114
  }
113
115
  bool JHybridReactNativeBundleCryptoSpec::secureEqualHex(const std::string& a, const std::string& b) {
114
- static const auto method = javaClassStatic()->getMethod<jboolean(jni::alias_ref<jni::JString> /* a */, jni::alias_ref<jni::JString> /* b */)>("secureEqualHex");
116
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean(jni::alias_ref<jni::JString> /* a */, jni::alias_ref<jni::JString> /* b */)>("secureEqualHex");
115
117
  auto __result = method(_javaPart, jni::make_jstring(a), jni::make_jstring(b));
116
118
  return static_cast<bool>(__result);
117
119
  }
118
120
  std::shared_ptr<Promise<bool>> JHybridReactNativeBundleCryptoSpec::verifyDirAgainstHashes(const std::string& dirPath, const std::vector<DirHashEntry>& entries) {
119
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* dirPath */, jni::alias_ref<jni::JArrayClass<JDirHashEntry>> /* entries */)>("verifyDirAgainstHashes");
121
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* dirPath */, jni::alias_ref<jni::JArrayClass<JDirHashEntry>> /* entries */)>("verifyDirAgainstHashes");
120
122
  auto __result = method(_javaPart, jni::make_jstring(dirPath), [&]() {
121
123
  size_t __size = entries.size();
122
124
  jni::local_ref<jni::JArrayClass<JDirHashEntry>> __array = jni::JArrayClass<JDirHashEntry>::newArray(__size);
@@ -141,7 +143,7 @@ namespace margelo::nitro::reactnativebundlecrypto {
141
143
  }();
142
144
  }
143
145
  std::shared_ptr<Promise<std::vector<DirHashEntry>>> JHybridReactNativeBundleCryptoSpec::hashDir(const std::string& dirPath) {
144
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* dirPath */)>("hashDir");
146
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* dirPath */)>("hashDir");
145
147
  auto __result = method(_javaPart, jni::make_jstring(dirPath));
146
148
  return [&]() {
147
149
  auto __promise = Promise<std::vector<DirHashEntry>>::create();
@@ -166,7 +168,7 @@ namespace margelo::nitro::reactnativebundlecrypto {
166
168
  }();
167
169
  }
168
170
  std::shared_ptr<Promise<bool>> JHybridReactNativeBundleCryptoSpec::validateExtractedPathSafety(const std::string& destination) {
169
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* destination */)>("validateExtractedPathSafety");
171
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* destination */)>("validateExtractedPathSafety");
170
172
  auto __result = method(_javaPart, jni::make_jstring(destination));
171
173
  return [&]() {
172
174
  auto __promise = Promise<bool>::create();
@@ -182,7 +184,7 @@ namespace margelo::nitro::reactnativebundlecrypto {
182
184
  }();
183
185
  }
184
186
  std::shared_ptr<Promise<void>> JHybridReactNativeBundleCryptoSpec::atomicWriteFile(const std::string& filePath, const std::string& contentUtf8) {
185
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* filePath */, jni::alias_ref<jni::JString> /* contentUtf8 */)>("atomicWriteFile");
187
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* filePath */, jni::alias_ref<jni::JString> /* contentUtf8 */)>("atomicWriteFile");
186
188
  auto __result = method(_javaPart, jni::make_jstring(filePath), jni::make_jstring(contentUtf8));
187
189
  return [&]() {
188
190
  auto __promise = Promise<void>::create();
@@ -197,7 +199,7 @@ namespace margelo::nitro::reactnativebundlecrypto {
197
199
  }();
198
200
  }
199
201
  std::shared_ptr<Promise<void>> JHybridReactNativeBundleCryptoSpec::safeRename(const std::string& fromPath, const std::string& toPath) {
200
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* fromPath */, jni::alias_ref<jni::JString> /* toPath */)>("safeRename");
202
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* fromPath */, jni::alias_ref<jni::JString> /* toPath */)>("safeRename");
201
203
  auto __result = method(_javaPart, jni::make_jstring(fromPath), jni::make_jstring(toPath));
202
204
  return [&]() {
203
205
  auto __promise = Promise<void>::create();
@@ -212,7 +214,7 @@ namespace margelo::nitro::reactnativebundlecrypto {
212
214
  }();
213
215
  }
214
216
  std::shared_ptr<Promise<std::vector<std::string>>> JHybridReactNativeBundleCryptoSpec::listVersionDirs(const std::string& parentDir) {
215
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* parentDir */)>("listVersionDirs");
217
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* parentDir */)>("listVersionDirs");
216
218
  auto __result = method(_javaPart, jni::make_jstring(parentDir));
217
219
  return [&]() {
218
220
  auto __promise = Promise<std::vector<std::string>>::create();
@@ -2,7 +2,7 @@
2
2
  /// HybridReactNativeBundleCryptoSpec.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -18,33 +18,33 @@ namespace margelo::nitro::reactnativebundlecrypto {
18
18
 
19
19
  using namespace facebook;
20
20
 
21
- class JHybridReactNativeBundleCryptoSpec: public jni::HybridClass<JHybridReactNativeBundleCryptoSpec, JHybridObject>,
22
- public virtual HybridReactNativeBundleCryptoSpec {
21
+ class JHybridReactNativeBundleCryptoSpec: public virtual HybridReactNativeBundleCryptoSpec, public virtual JHybridObject {
23
22
  public:
24
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativebundlecrypto/HybridReactNativeBundleCryptoSpec;";
25
- static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
26
- static void registerNatives();
27
-
28
- protected:
29
- // C++ constructor (called from Java via `initHybrid()`)
30
- explicit JHybridReactNativeBundleCryptoSpec(jni::alias_ref<jhybridobject> jThis) :
31
- HybridObject(HybridReactNativeBundleCryptoSpec::TAG),
32
- HybridBase(jThis),
33
- _javaPart(jni::make_global(jThis)) {}
23
+ struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
24
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativebundlecrypto/HybridReactNativeBundleCryptoSpec;";
25
+ std::shared_ptr<JHybridReactNativeBundleCryptoSpec> getJHybridReactNativeBundleCryptoSpec();
26
+ };
27
+ struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
28
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativebundlecrypto/HybridReactNativeBundleCryptoSpec$CxxPart;";
29
+ static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
30
+ static void registerNatives();
31
+ using HybridBase::HybridBase;
32
+ protected:
33
+ std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
34
+ };
34
35
 
35
36
  public:
37
+ explicit JHybridReactNativeBundleCryptoSpec(const jni::local_ref<JHybridReactNativeBundleCryptoSpec::JavaPart>& javaPart):
38
+ HybridObject(HybridReactNativeBundleCryptoSpec::TAG),
39
+ JHybridObject(javaPart),
40
+ _javaPart(jni::make_global(javaPart)) {}
36
41
  ~JHybridReactNativeBundleCryptoSpec() override {
37
42
  // Hermes GC can destroy JS objects on a non-JNI Thread.
38
43
  jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
39
44
  }
40
45
 
41
46
  public:
42
- size_t getExternalMemorySize() noexcept override;
43
- void dispose() noexcept override;
44
- std::string toString() override;
45
-
46
- public:
47
- inline const jni::global_ref<JHybridReactNativeBundleCryptoSpec::javaobject>& getJavaPart() const noexcept {
47
+ inline const jni::global_ref<JHybridReactNativeBundleCryptoSpec::JavaPart>& getJavaPart() const noexcept {
48
48
  return _javaPart;
49
49
  }
50
50
 
@@ -66,9 +66,7 @@ namespace margelo::nitro::reactnativebundlecrypto {
66
66
  std::shared_ptr<Promise<std::vector<std::string>>> listVersionDirs(const std::string& parentDir) override;
67
67
 
68
68
  private:
69
- friend HybridBase;
70
- using HybridBase::HybridBase;
71
- jni::global_ref<JHybridReactNativeBundleCryptoSpec::javaobject> _javaPart;
69
+ jni::global_ref<JHybridReactNativeBundleCryptoSpec::JavaPart> _javaPart;
72
70
  };
73
71
 
74
72
  } // namespace margelo::nitro::reactnativebundlecrypto
@@ -2,7 +2,7 @@
2
2
  /// JSha256Result.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -22,7 +22,7 @@ namespace margelo::nitro::reactnativebundlecrypto {
22
22
  */
23
23
  struct JSha256Result final: public jni::JavaClass<JSha256Result> {
24
24
  public:
25
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativebundlecrypto/Sha256Result;";
25
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativebundlecrypto/Sha256Result;";
26
26
 
27
27
  public:
28
28
  /**
@@ -2,7 +2,7 @@
2
2
  /// JVerifyDetachedAscResult.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -22,7 +22,7 @@ namespace margelo::nitro::reactnativebundlecrypto {
22
22
  */
23
23
  struct JVerifyDetachedAscResult final: public jni::JavaClass<JVerifyDetachedAscResult> {
24
24
  public:
25
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativebundlecrypto/VerifyDetachedAscResult;";
25
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativebundlecrypto/VerifyDetachedAscResult;";
26
26
 
27
27
  public:
28
28
  /**
@@ -2,7 +2,7 @@
2
2
  /// JVerifyGpgCleartextResult.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -22,7 +22,7 @@ namespace margelo::nitro::reactnativebundlecrypto {
22
22
  */
23
23
  struct JVerifyGpgCleartextResult final: public jni::JavaClass<JVerifyGpgCleartextResult> {
24
24
  public:
25
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativebundlecrypto/VerifyGpgCleartextResult;";
25
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativebundlecrypto/VerifyGpgCleartextResult;";
26
26
 
27
27
  public:
28
28
  /**
@@ -2,7 +2,7 @@
2
2
  /// DirHashEntry.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.reactnativebundlecrypto
@@ -26,7 +26,7 @@ data class DirHashEntry(
26
26
  ) {
27
27
  /* primary constructor */
28
28
 
29
- private companion object {
29
+ companion object {
30
30
  /**
31
31
  * Constructor called from C++
32
32
  */
@@ -2,7 +2,7 @@
2
2
  /// HybridReactNativeBundleCryptoSpec.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.reactnativebundlecrypto
@@ -25,23 +25,6 @@ import com.margelo.nitro.core.HybridObject
25
25
  "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
26
26
  )
27
27
  abstract class HybridReactNativeBundleCryptoSpec: HybridObject() {
28
- @DoNotStrip
29
- private var mHybridData: HybridData = initHybrid()
30
-
31
- init {
32
- super.updateNative(mHybridData)
33
- }
34
-
35
- override fun updateNative(hybridData: HybridData) {
36
- mHybridData = hybridData
37
- super.updateNative(hybridData)
38
- }
39
-
40
- // Default implementation of `HybridObject.toString()`
41
- override fun toString(): String {
42
- return "[HybridObject ReactNativeBundleCrypto]"
43
- }
44
-
45
28
  // Properties
46
29
 
47
30
 
@@ -86,7 +69,21 @@ abstract class HybridReactNativeBundleCryptoSpec: HybridObject() {
86
69
  @Keep
87
70
  abstract fun listVersionDirs(parentDir: String): Promise<Array<String>>
88
71
 
89
- private external fun initHybrid(): HybridData
72
+ // Default implementation of `HybridObject.toString()`
73
+ override fun toString(): String {
74
+ return "[HybridObject ReactNativeBundleCrypto]"
75
+ }
76
+
77
+ // C++ backing class
78
+ @DoNotStrip
79
+ @Keep
80
+ protected open class CxxPart(javaPart: HybridReactNativeBundleCryptoSpec): HybridObject.CxxPart(javaPart) {
81
+ // C++ JHybridReactNativeBundleCryptoSpec::CxxPart::initHybrid(...)
82
+ external override fun initHybrid(): HybridData
83
+ }
84
+ override fun createCxxPart(): CxxPart {
85
+ return CxxPart(this)
86
+ }
90
87
 
91
88
  companion object {
92
89
  protected const val TAG = "HybridReactNativeBundleCryptoSpec"
@@ -2,7 +2,7 @@
2
2
  /// Sha256Result.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.reactnativebundlecrypto
@@ -26,7 +26,7 @@ data class Sha256Result(
26
26
  ) {
27
27
  /* primary constructor */
28
28
 
29
- private companion object {
29
+ companion object {
30
30
  /**
31
31
  * Constructor called from C++
32
32
  */
@@ -2,7 +2,7 @@
2
2
  /// VerifyDetachedAscResult.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.reactnativebundlecrypto
@@ -29,7 +29,7 @@ data class VerifyDetachedAscResult(
29
29
  ) {
30
30
  /* primary constructor */
31
31
 
32
- private companion object {
32
+ companion object {
33
33
  /**
34
34
  * Constructor called from C++
35
35
  */
@@ -2,7 +2,7 @@
2
2
  /// VerifyGpgCleartextResult.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.reactnativebundlecrypto
@@ -29,7 +29,7 @@ data class VerifyGpgCleartextResult(
29
29
  ) {
30
30
  /* primary constructor */
31
31
 
32
- private companion object {
32
+ companion object {
33
33
  /**
34
34
  * Constructor called from C++
35
35
  */
@@ -2,7 +2,7 @@
2
2
  /// reactnativebundlecryptoOnLoad.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.reactnativebundlecrypto
@@ -2,7 +2,7 @@
2
2
  # reactnativebundlecrypto+autolinking.cmake
3
3
  # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  # https://github.com/mrousavy/nitro
5
- # Copyright © 2026 Marc Rousavy @ Margelo
5
+ # Copyright © Marc Rousavy @ Margelo
6
6
  #
7
7
 
8
8
  # This is a CMake file that adds all files generated by Nitrogen
@@ -2,7 +2,7 @@
2
2
  /// reactnativebundlecrypto+autolinking.gradle
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  /// This is a Gradle file that adds all files generated by Nitrogen
@@ -2,7 +2,7 @@
2
2
  /// reactnativebundlecryptoOnLoad.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #ifndef BUILDING_REACTNATIVEBUNDLECRYPTO_WITH_GENERATED_CMAKE_PROJECT
@@ -21,24 +21,34 @@
21
21
  namespace margelo::nitro::reactnativebundlecrypto {
22
22
 
23
23
  int initialize(JavaVM* vm) {
24
+ return facebook::jni::initialize(vm, []() {
25
+ ::margelo::nitro::reactnativebundlecrypto::registerAllNatives();
26
+ });
27
+ }
28
+
29
+ struct JHybridReactNativeBundleCryptoSpecImpl: public jni::JavaClass<JHybridReactNativeBundleCryptoSpecImpl, JHybridReactNativeBundleCryptoSpec::JavaPart> {
30
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativebundlecrypto/ReactNativeBundleCrypto;";
31
+ static std::shared_ptr<JHybridReactNativeBundleCryptoSpec> create() {
32
+ static const auto constructorFn = javaClassStatic()->getConstructor<JHybridReactNativeBundleCryptoSpecImpl::javaobject()>();
33
+ jni::local_ref<JHybridReactNativeBundleCryptoSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
34
+ return javaPart->getJHybridReactNativeBundleCryptoSpec();
35
+ }
36
+ };
37
+
38
+ void registerAllNatives() {
24
39
  using namespace margelo::nitro;
25
40
  using namespace margelo::nitro::reactnativebundlecrypto;
26
- using namespace facebook;
27
-
28
- return facebook::jni::initialize(vm, [] {
29
- // Register native JNI methods
30
- margelo::nitro::reactnativebundlecrypto::JHybridReactNativeBundleCryptoSpec::registerNatives();
31
-
32
- // Register Nitro Hybrid Objects
33
- HybridObjectRegistry::registerHybridObjectConstructor(
34
- "ReactNativeBundleCrypto",
35
- []() -> std::shared_ptr<HybridObject> {
36
- static DefaultConstructableObject<JHybridReactNativeBundleCryptoSpec::javaobject> object("com/margelo/nitro/reactnativebundlecrypto/ReactNativeBundleCrypto");
37
- auto instance = object.create();
38
- return instance->cthis()->shared();
39
- }
40
- );
41
- });
41
+
42
+ // Register native JNI methods
43
+ margelo::nitro::reactnativebundlecrypto::JHybridReactNativeBundleCryptoSpec::CxxPart::registerNatives();
44
+
45
+ // Register Nitro Hybrid Objects
46
+ HybridObjectRegistry::registerHybridObjectConstructor(
47
+ "ReactNativeBundleCrypto",
48
+ []() -> std::shared_ptr<HybridObject> {
49
+ return JHybridReactNativeBundleCryptoSpecImpl::create();
50
+ }
51
+ );
42
52
  }
43
53
 
44
54
  } // namespace margelo::nitro::reactnativebundlecrypto
@@ -2,24 +2,33 @@
2
2
  /// reactnativebundlecryptoOnLoad.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include <jni.h>
9
+ #include <functional>
9
10
  #include <NitroModules/NitroDefines.hpp>
10
11
 
11
12
  namespace margelo::nitro::reactnativebundlecrypto {
12
13
 
14
+ [[deprecated("Use registerNatives() instead.")]]
15
+ int initialize(JavaVM* vm);
16
+
13
17
  /**
14
- * Initializes the native (C++) part of reactnativebundlecrypto, and autolinks all Hybrid Objects.
15
- * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`).
18
+ * Register the native (C++) part of reactnativebundlecrypto, and autolinks all Hybrid Objects.
19
+ * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),
20
+ * inside a `facebook::jni::initialize(vm, ...)` call.
16
21
  * Example:
17
22
  * ```cpp (cpp-adapter.cpp)
18
23
  * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
19
- * return margelo::nitro::reactnativebundlecrypto::initialize(vm);
24
+ * return facebook::jni::initialize(vm, []() {
25
+ * // register all reactnativebundlecrypto HybridObjects
26
+ * margelo::nitro::reactnativebundlecrypto::registerNatives();
27
+ * // any other custom registrations go here.
28
+ * });
20
29
  * }
21
30
  * ```
22
31
  */
23
- int initialize(JavaVM* vm);
32
+ void registerAllNatives();
24
33
 
25
34
  } // namespace margelo::nitro::reactnativebundlecrypto
@@ -2,7 +2,7 @@
2
2
  # ReactNativeBundleCrypto+autolinking.rb
3
3
  # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  # https://github.com/mrousavy/nitro
5
- # Copyright © 2026 Marc Rousavy @ Margelo
5
+ # Copyright © Marc Rousavy @ Margelo
6
6
  #
7
7
 
8
8
  # This is a Ruby script that adds all files generated by Nitrogen
@@ -52,7 +52,7 @@ def add_nitrogen_files(spec)
52
52
  spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
53
53
  # Use C++ 20
54
54
  "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
55
- # Enables C++ <-> Swift interop (by default it's only C)
55
+ # Enables C++ <-> Swift interop (by default it's only ObjC)
56
56
  "SWIFT_OBJC_INTEROP_MODE" => "objcxx",
57
57
  # Enables stricter modular headers
58
58
  "DEFINES_MODULE" => "YES",
@@ -2,7 +2,7 @@
2
2
  /// ReactNativeBundleCrypto-Swift-Cxx-Bridge.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "ReactNativeBundleCrypto-Swift-Cxx-Bridge.hpp"
@@ -2,7 +2,7 @@
2
2
  /// ReactNativeBundleCrypto-Swift-Cxx-Bridge.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -57,7 +57,7 @@ namespace margelo::nitro::reactnativebundlecrypto::bridge::swift {
57
57
  return optional.has_value();
58
58
  }
59
59
  inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
60
- return *optional;
60
+ return optional.value();
61
61
  }
62
62
 
63
63
  // pragma MARK: std::shared_ptr<Promise<VerifyGpgCleartextResult>>
@@ -2,7 +2,7 @@
2
2
  /// ReactNativeBundleCrypto-Swift-Cxx-Umbrella.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -2,7 +2,7 @@
2
2
  /// ReactNativeBundleCryptoAutolinking.mm
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #import <Foundation/Foundation.h>