@onekeyfe/react-native-bundle-crypto 3.0.39

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 (96) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -0
  3. package/ReactNativeBundleCrypto.podspec +35 -0
  4. package/android/CMakeLists.txt +24 -0
  5. package/android/build.gradle +136 -0
  6. package/android/gradle.properties +4 -0
  7. package/android/src/main/AndroidManifest.xml +1 -0
  8. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  9. package/android/src/main/java/com/margelo/nitro/reactnativebundlecrypto/BundleCryptoCore.kt +526 -0
  10. package/android/src/main/java/com/margelo/nitro/reactnativebundlecrypto/ReactNativeBundleCrypto.kt +110 -0
  11. package/android/src/main/java/com/margelo/nitro/reactnativebundlecrypto/ReactNativeBundleCryptoPackage.kt +24 -0
  12. package/ios/BundleCryptoCore.swift +529 -0
  13. package/ios/Frameworks/Gopenpgp.xcframework/Info.plist +52 -0
  14. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64/Gopenpgp.framework/Gopenpgp +0 -0
  15. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64/Gopenpgp.framework/Headers/Armor.objc.h +96 -0
  16. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64/Gopenpgp.framework/Headers/Constants.objc.h +197 -0
  17. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64/Gopenpgp.framework/Headers/Crypto.objc.h +1963 -0
  18. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64/Gopenpgp.framework/Headers/Gopenpgp.h +23 -0
  19. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64/Gopenpgp.framework/Headers/Mime.objc.h +59 -0
  20. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64/Gopenpgp.framework/Headers/Mobile.objc.h +252 -0
  21. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64/Gopenpgp.framework/Headers/Profile.objc.h +107 -0
  22. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64/Gopenpgp.framework/Headers/Universe.objc.h +29 -0
  23. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64/Gopenpgp.framework/Headers/ref.h +35 -0
  24. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64/Gopenpgp.framework/Info.plist +20 -0
  25. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64/Gopenpgp.framework/Modules/module.modulemap +13 -0
  26. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64_x86_64-simulator/Gopenpgp.framework/Gopenpgp +0 -0
  27. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64_x86_64-simulator/Gopenpgp.framework/Headers/Armor.objc.h +96 -0
  28. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64_x86_64-simulator/Gopenpgp.framework/Headers/Constants.objc.h +197 -0
  29. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64_x86_64-simulator/Gopenpgp.framework/Headers/Crypto.objc.h +1963 -0
  30. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64_x86_64-simulator/Gopenpgp.framework/Headers/Gopenpgp.h +23 -0
  31. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64_x86_64-simulator/Gopenpgp.framework/Headers/Mime.objc.h +59 -0
  32. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64_x86_64-simulator/Gopenpgp.framework/Headers/Mobile.objc.h +252 -0
  33. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64_x86_64-simulator/Gopenpgp.framework/Headers/Profile.objc.h +107 -0
  34. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64_x86_64-simulator/Gopenpgp.framework/Headers/Universe.objc.h +29 -0
  35. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64_x86_64-simulator/Gopenpgp.framework/Headers/ref.h +35 -0
  36. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64_x86_64-simulator/Gopenpgp.framework/Info.plist +20 -0
  37. package/ios/Frameworks/Gopenpgp.xcframework/ios-arm64_x86_64-simulator/Gopenpgp.framework/Modules/module.modulemap +13 -0
  38. package/ios/ReactNativeBundleCrypto.swift +104 -0
  39. package/lib/module/ReactNativeBundleCrypto.nitro.js +4 -0
  40. package/lib/module/ReactNativeBundleCrypto.nitro.js.map +1 -0
  41. package/lib/module/index.js +6 -0
  42. package/lib/module/index.js.map +1 -0
  43. package/lib/module/package.json +1 -0
  44. package/lib/typescript/package.json +1 -0
  45. package/lib/typescript/src/ReactNativeBundleCrypto.nitro.d.ts +35 -0
  46. package/lib/typescript/src/ReactNativeBundleCrypto.nitro.d.ts.map +1 -0
  47. package/lib/typescript/src/index.d.ts +4 -0
  48. package/lib/typescript/src/index.d.ts.map +1 -0
  49. package/nitro.json +17 -0
  50. package/nitrogen/generated/android/c++/JDirHashEntry.hpp +61 -0
  51. package/nitrogen/generated/android/c++/JHybridReactNativeBundleCryptoSpec.cpp +240 -0
  52. package/nitrogen/generated/android/c++/JHybridReactNativeBundleCryptoSpec.hpp +74 -0
  53. package/nitrogen/generated/android/c++/JSha256Result.hpp +62 -0
  54. package/nitrogen/generated/android/c++/JVerifyDetachedAscResult.hpp +66 -0
  55. package/nitrogen/generated/android/c++/JVerifyGpgCleartextResult.hpp +66 -0
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativebundlecrypto/DirHashEntry.kt +41 -0
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativebundlecrypto/HybridReactNativeBundleCryptoSpec.kt +94 -0
  58. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativebundlecrypto/Sha256Result.kt +41 -0
  59. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativebundlecrypto/VerifyDetachedAscResult.kt +44 -0
  60. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativebundlecrypto/VerifyGpgCleartextResult.kt +44 -0
  61. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativebundlecrypto/reactnativebundlecryptoOnLoad.kt +35 -0
  62. package/nitrogen/generated/android/reactnativebundlecrypto+autolinking.cmake +81 -0
  63. package/nitrogen/generated/android/reactnativebundlecrypto+autolinking.gradle +27 -0
  64. package/nitrogen/generated/android/reactnativebundlecryptoOnLoad.cpp +44 -0
  65. package/nitrogen/generated/android/reactnativebundlecryptoOnLoad.hpp +25 -0
  66. package/nitrogen/generated/ios/ReactNativeBundleCrypto+autolinking.rb +60 -0
  67. package/nitrogen/generated/ios/ReactNativeBundleCrypto-Swift-Cxx-Bridge.cpp +97 -0
  68. package/nitrogen/generated/ios/ReactNativeBundleCrypto-Swift-Cxx-Bridge.hpp +429 -0
  69. package/nitrogen/generated/ios/ReactNativeBundleCrypto-Swift-Cxx-Umbrella.hpp +59 -0
  70. package/nitrogen/generated/ios/ReactNativeBundleCryptoAutolinking.mm +33 -0
  71. package/nitrogen/generated/ios/ReactNativeBundleCryptoAutolinking.swift +25 -0
  72. package/nitrogen/generated/ios/c++/HybridReactNativeBundleCryptoSpecSwift.cpp +11 -0
  73. package/nitrogen/generated/ios/c++/HybridReactNativeBundleCryptoSpecSwift.hpp +162 -0
  74. package/nitrogen/generated/ios/swift/DirHashEntry.swift +47 -0
  75. package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  76. package/nitrogen/generated/ios/swift/Func_void_Sha256Result.swift +47 -0
  77. package/nitrogen/generated/ios/swift/Func_void_VerifyDetachedAscResult.swift +47 -0
  78. package/nitrogen/generated/ios/swift/Func_void_VerifyGpgCleartextResult.swift +47 -0
  79. package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
  80. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
  81. package/nitrogen/generated/ios/swift/Func_void_std__vector_DirHashEntry_.swift +47 -0
  82. package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +47 -0
  83. package/nitrogen/generated/ios/swift/HybridReactNativeBundleCryptoSpec.swift +65 -0
  84. package/nitrogen/generated/ios/swift/HybridReactNativeBundleCryptoSpec_cxx.swift +314 -0
  85. package/nitrogen/generated/ios/swift/Sha256Result.swift +85 -0
  86. package/nitrogen/generated/ios/swift/VerifyDetachedAscResult.swift +96 -0
  87. package/nitrogen/generated/ios/swift/VerifyGpgCleartextResult.swift +96 -0
  88. package/nitrogen/generated/shared/c++/DirHashEntry.hpp +79 -0
  89. package/nitrogen/generated/shared/c++/HybridReactNativeBundleCryptoSpec.cpp +30 -0
  90. package/nitrogen/generated/shared/c++/HybridReactNativeBundleCryptoSpec.hpp +84 -0
  91. package/nitrogen/generated/shared/c++/Sha256Result.hpp +80 -0
  92. package/nitrogen/generated/shared/c++/VerifyDetachedAscResult.hpp +84 -0
  93. package/nitrogen/generated/shared/c++/VerifyGpgCleartextResult.hpp +84 -0
  94. package/package.json +169 -0
  95. package/src/ReactNativeBundleCrypto.nitro.ts +56 -0
  96. package/src/index.tsx +8 -0
@@ -0,0 +1,41 @@
1
+ ///
2
+ /// DirHashEntry.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.reactnativebundlecrypto
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "DirHashEntry".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class DirHashEntry(
20
+ @DoNotStrip
21
+ @Keep
22
+ val relativePath: String,
23
+ @DoNotStrip
24
+ @Keep
25
+ val sha256: String
26
+ ) {
27
+ /* primary constructor */
28
+
29
+ private companion object {
30
+ /**
31
+ * Constructor called from C++
32
+ */
33
+ @DoNotStrip
34
+ @Keep
35
+ @Suppress("unused")
36
+ @JvmStatic
37
+ private fun fromCpp(relativePath: String, sha256: String): DirHashEntry {
38
+ return DirHashEntry(relativePath, sha256)
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,94 @@
1
+ ///
2
+ /// HybridReactNativeBundleCryptoSpec.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.reactnativebundlecrypto
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.Promise
14
+ import com.margelo.nitro.core.HybridObject
15
+
16
+ /**
17
+ * A Kotlin class representing the ReactNativeBundleCrypto HybridObject.
18
+ * Implement this abstract class to create Kotlin-based instances of ReactNativeBundleCrypto.
19
+ */
20
+ @DoNotStrip
21
+ @Keep
22
+ @Suppress(
23
+ "KotlinJniMissingFunction", "unused",
24
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
25
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
26
+ )
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
+ // Properties
46
+
47
+
48
+ // Methods
49
+ @DoNotStrip
50
+ @Keep
51
+ abstract fun verifyGpgCleartext(signedMessage: String): Promise<VerifyGpgCleartextResult>
52
+
53
+ @DoNotStrip
54
+ @Keep
55
+ abstract fun verifyDetachedAsc(ascContent: String): Promise<VerifyDetachedAscResult>
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ abstract fun sha256OfFile(filePath: String): Promise<Sha256Result>
60
+
61
+ @DoNotStrip
62
+ @Keep
63
+ abstract fun secureEqualHex(a: String, b: String): Boolean
64
+
65
+ @DoNotStrip
66
+ @Keep
67
+ abstract fun verifyDirAgainstHashes(dirPath: String, entries: Array<DirHashEntry>): Promise<Boolean>
68
+
69
+ @DoNotStrip
70
+ @Keep
71
+ abstract fun hashDir(dirPath: String): Promise<Array<DirHashEntry>>
72
+
73
+ @DoNotStrip
74
+ @Keep
75
+ abstract fun validateExtractedPathSafety(destination: String): Promise<Boolean>
76
+
77
+ @DoNotStrip
78
+ @Keep
79
+ abstract fun atomicWriteFile(filePath: String, contentUtf8: String): Promise<Unit>
80
+
81
+ @DoNotStrip
82
+ @Keep
83
+ abstract fun safeRename(fromPath: String, toPath: String): Promise<Unit>
84
+
85
+ @DoNotStrip
86
+ @Keep
87
+ abstract fun listVersionDirs(parentDir: String): Promise<Array<String>>
88
+
89
+ private external fun initHybrid(): HybridData
90
+
91
+ companion object {
92
+ protected const val TAG = "HybridReactNativeBundleCryptoSpec"
93
+ }
94
+ }
@@ -0,0 +1,41 @@
1
+ ///
2
+ /// Sha256Result.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.reactnativebundlecrypto
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "Sha256Result".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class Sha256Result(
20
+ @DoNotStrip
21
+ @Keep
22
+ val sha256: String?,
23
+ @DoNotStrip
24
+ @Keep
25
+ val failureReason: String?
26
+ ) {
27
+ /* primary constructor */
28
+
29
+ private companion object {
30
+ /**
31
+ * Constructor called from C++
32
+ */
33
+ @DoNotStrip
34
+ @Keep
35
+ @Suppress("unused")
36
+ @JvmStatic
37
+ private fun fromCpp(sha256: String?, failureReason: String?): Sha256Result {
38
+ return Sha256Result(sha256, failureReason)
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// VerifyDetachedAscResult.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.reactnativebundlecrypto
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "VerifyDetachedAscResult".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class VerifyDetachedAscResult(
20
+ @DoNotStrip
21
+ @Keep
22
+ val valid: Boolean,
23
+ @DoNotStrip
24
+ @Keep
25
+ val sha256: String?,
26
+ @DoNotStrip
27
+ @Keep
28
+ val reason: String?
29
+ ) {
30
+ /* primary constructor */
31
+
32
+ private companion object {
33
+ /**
34
+ * Constructor called from C++
35
+ */
36
+ @DoNotStrip
37
+ @Keep
38
+ @Suppress("unused")
39
+ @JvmStatic
40
+ private fun fromCpp(valid: Boolean, sha256: String?, reason: String?): VerifyDetachedAscResult {
41
+ return VerifyDetachedAscResult(valid, sha256, reason)
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// VerifyGpgCleartextResult.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.reactnativebundlecrypto
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "VerifyGpgCleartextResult".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class VerifyGpgCleartextResult(
20
+ @DoNotStrip
21
+ @Keep
22
+ val valid: Boolean,
23
+ @DoNotStrip
24
+ @Keep
25
+ val sha256: String?,
26
+ @DoNotStrip
27
+ @Keep
28
+ val reason: String?
29
+ ) {
30
+ /* primary constructor */
31
+
32
+ private companion object {
33
+ /**
34
+ * Constructor called from C++
35
+ */
36
+ @DoNotStrip
37
+ @Keep
38
+ @Suppress("unused")
39
+ @JvmStatic
40
+ private fun fromCpp(valid: Boolean, sha256: String?, reason: String?): VerifyGpgCleartextResult {
41
+ return VerifyGpgCleartextResult(valid, sha256, reason)
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// reactnativebundlecryptoOnLoad.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.reactnativebundlecrypto
9
+
10
+ import android.util.Log
11
+
12
+ internal class reactnativebundlecryptoOnLoad {
13
+ companion object {
14
+ private const val TAG = "reactnativebundlecryptoOnLoad"
15
+ private var didLoad = false
16
+ /**
17
+ * Initializes the native part of "reactnativebundlecrypto".
18
+ * This method is idempotent and can be called more than once.
19
+ */
20
+ @JvmStatic
21
+ fun initializeNative() {
22
+ if (didLoad) return
23
+ try {
24
+ Log.i(TAG, "Loading reactnativebundlecrypto C++ library...")
25
+ System.loadLibrary("reactnativebundlecrypto")
26
+ Log.i(TAG, "Successfully loaded reactnativebundlecrypto C++ library!")
27
+ didLoad = true
28
+ } catch (e: Error) {
29
+ Log.e(TAG, "Failed to load reactnativebundlecrypto C++ library! Is it properly installed and linked? " +
30
+ "Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
31
+ throw e
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,81 @@
1
+ #
2
+ # reactnativebundlecrypto+autolinking.cmake
3
+ # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ # https://github.com/mrousavy/nitro
5
+ # Copyright © 2026 Marc Rousavy @ Margelo
6
+ #
7
+
8
+ # This is a CMake file that adds all files generated by Nitrogen
9
+ # to the current CMake project.
10
+ #
11
+ # To use it, add this to your CMakeLists.txt:
12
+ # ```cmake
13
+ # include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/reactnativebundlecrypto+autolinking.cmake)
14
+ # ```
15
+
16
+ # Define a flag to check if we are building properly
17
+ add_definitions(-DBUILDING_REACTNATIVEBUNDLECRYPTO_WITH_GENERATED_CMAKE_PROJECT)
18
+
19
+ # Enable Raw Props parsing in react-native (for Nitro Views)
20
+ add_definitions(-DRN_SERIALIZABLE_STATE)
21
+
22
+ # Add all headers that were generated by Nitrogen
23
+ include_directories(
24
+ "../nitrogen/generated/shared/c++"
25
+ "../nitrogen/generated/android/c++"
26
+ "../nitrogen/generated/android/"
27
+ )
28
+
29
+ # Add all .cpp sources that were generated by Nitrogen
30
+ target_sources(
31
+ # CMake project name (Android C++ library name)
32
+ reactnativebundlecrypto PRIVATE
33
+ # Autolinking Setup
34
+ ../nitrogen/generated/android/reactnativebundlecryptoOnLoad.cpp
35
+ # Shared Nitrogen C++ sources
36
+ ../nitrogen/generated/shared/c++/HybridReactNativeBundleCryptoSpec.cpp
37
+ # Android-specific Nitrogen C++ sources
38
+ ../nitrogen/generated/android/c++/JHybridReactNativeBundleCryptoSpec.cpp
39
+ )
40
+
41
+ # From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
42
+ # Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
43
+ target_compile_definitions(
44
+ reactnativebundlecrypto PRIVATE
45
+ -DFOLLY_NO_CONFIG=1
46
+ -DFOLLY_HAVE_CLOCK_GETTIME=1
47
+ -DFOLLY_USE_LIBCPP=1
48
+ -DFOLLY_CFG_NO_COROUTINES=1
49
+ -DFOLLY_MOBILE=1
50
+ -DFOLLY_HAVE_RECVMMSG=1
51
+ -DFOLLY_HAVE_PTHREAD=1
52
+ # Once we target android-23 above, we can comment
53
+ # the following line. NDK uses GNU style stderror_r() after API 23.
54
+ -DFOLLY_HAVE_XSI_STRERROR_R=1
55
+ )
56
+
57
+ # Add all libraries required by the generated specs
58
+ find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
59
+ find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
60
+ find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
61
+
62
+ # Link all libraries together
63
+ target_link_libraries(
64
+ reactnativebundlecrypto
65
+ fbjni::fbjni # <-- Facebook C++ JNI helpers
66
+ ReactAndroid::jsi # <-- RN: JSI
67
+ react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
68
+ )
69
+
70
+ # Link react-native (different prefab between RN 0.75 and RN 0.76)
71
+ if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
72
+ target_link_libraries(
73
+ reactnativebundlecrypto
74
+ ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
75
+ )
76
+ else()
77
+ target_link_libraries(
78
+ reactnativebundlecrypto
79
+ ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
80
+ )
81
+ endif()
@@ -0,0 +1,27 @@
1
+ ///
2
+ /// reactnativebundlecrypto+autolinking.gradle
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ /// This is a Gradle file that adds all files generated by Nitrogen
9
+ /// to the current Gradle project.
10
+ ///
11
+ /// To use it, add this to your build.gradle:
12
+ /// ```gradle
13
+ /// apply from: '../nitrogen/generated/android/reactnativebundlecrypto+autolinking.gradle'
14
+ /// ```
15
+
16
+ logger.warn("[NitroModules] 🔥 reactnativebundlecrypto is boosted by nitro!")
17
+
18
+ android {
19
+ sourceSets {
20
+ main {
21
+ java.srcDirs += [
22
+ // Nitrogen files
23
+ "${project.projectDir}/../nitrogen/generated/android/kotlin"
24
+ ]
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// reactnativebundlecryptoOnLoad.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #ifndef BUILDING_REACTNATIVEBUNDLECRYPTO_WITH_GENERATED_CMAKE_PROJECT
9
+ #error reactnativebundlecryptoOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
10
+ #endif
11
+
12
+ #include "reactnativebundlecryptoOnLoad.hpp"
13
+
14
+ #include <jni.h>
15
+ #include <fbjni/fbjni.h>
16
+ #include <NitroModules/HybridObjectRegistry.hpp>
17
+
18
+ #include "JHybridReactNativeBundleCryptoSpec.hpp"
19
+ #include <NitroModules/DefaultConstructableObject.hpp>
20
+
21
+ namespace margelo::nitro::reactnativebundlecrypto {
22
+
23
+ int initialize(JavaVM* vm) {
24
+ using namespace margelo::nitro;
25
+ 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
+ });
42
+ }
43
+
44
+ } // namespace margelo::nitro::reactnativebundlecrypto
@@ -0,0 +1,25 @@
1
+ ///
2
+ /// reactnativebundlecryptoOnLoad.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include <jni.h>
9
+ #include <NitroModules/NitroDefines.hpp>
10
+
11
+ namespace margelo::nitro::reactnativebundlecrypto {
12
+
13
+ /**
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`).
16
+ * Example:
17
+ * ```cpp (cpp-adapter.cpp)
18
+ * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
19
+ * return margelo::nitro::reactnativebundlecrypto::initialize(vm);
20
+ * }
21
+ * ```
22
+ */
23
+ int initialize(JavaVM* vm);
24
+
25
+ } // namespace margelo::nitro::reactnativebundlecrypto
@@ -0,0 +1,60 @@
1
+ #
2
+ # ReactNativeBundleCrypto+autolinking.rb
3
+ # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ # https://github.com/mrousavy/nitro
5
+ # Copyright © 2026 Marc Rousavy @ Margelo
6
+ #
7
+
8
+ # This is a Ruby script that adds all files generated by Nitrogen
9
+ # to the given podspec.
10
+ #
11
+ # To use it, add this to your .podspec:
12
+ # ```ruby
13
+ # Pod::Spec.new do |spec|
14
+ # # ...
15
+ #
16
+ # # Add all files generated by Nitrogen
17
+ # load 'nitrogen/generated/ios/ReactNativeBundleCrypto+autolinking.rb'
18
+ # add_nitrogen_files(spec)
19
+ # end
20
+ # ```
21
+
22
+ def add_nitrogen_files(spec)
23
+ Pod::UI.puts "[NitroModules] 🔥 ReactNativeBundleCrypto is boosted by nitro!"
24
+
25
+ spec.dependency "NitroModules"
26
+
27
+ current_source_files = Array(spec.attributes_hash['source_files'])
28
+ spec.source_files = current_source_files + [
29
+ # Generated cross-platform specs
30
+ "nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
31
+ # Generated bridges for the cross-platform specs
32
+ "nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
33
+ ]
34
+
35
+ current_public_header_files = Array(spec.attributes_hash['public_header_files'])
36
+ spec.public_header_files = current_public_header_files + [
37
+ # Generated specs
38
+ "nitrogen/generated/shared/**/*.{h,hpp}",
39
+ # Swift to C++ bridging helpers
40
+ "nitrogen/generated/ios/ReactNativeBundleCrypto-Swift-Cxx-Bridge.hpp"
41
+ ]
42
+
43
+ current_private_header_files = Array(spec.attributes_hash['private_header_files'])
44
+ spec.private_header_files = current_private_header_files + [
45
+ # iOS specific specs
46
+ "nitrogen/generated/ios/c++/**/*.{h,hpp}",
47
+ # Views are framework-specific and should be private
48
+ "nitrogen/generated/shared/**/views/**/*"
49
+ ]
50
+
51
+ current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
52
+ spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
53
+ # Use C++ 20
54
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
55
+ # Enables C++ <-> Swift interop (by default it's only C)
56
+ "SWIFT_OBJC_INTEROP_MODE" => "objcxx",
57
+ # Enables stricter modular headers
58
+ "DEFINES_MODULE" => "YES",
59
+ })
60
+ end
@@ -0,0 +1,97 @@
1
+ ///
2
+ /// ReactNativeBundleCrypto-Swift-Cxx-Bridge.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "ReactNativeBundleCrypto-Swift-Cxx-Bridge.hpp"
9
+
10
+ // Include C++ implementation defined types
11
+ #include "HybridReactNativeBundleCryptoSpecSwift.hpp"
12
+ #include "ReactNativeBundleCrypto-Swift-Cxx-Umbrella.hpp"
13
+ #include <NitroModules/NitroDefines.hpp>
14
+
15
+ namespace margelo::nitro::reactnativebundlecrypto::bridge::swift {
16
+
17
+ // pragma MARK: std::function<void(const VerifyGpgCleartextResult& /* result */)>
18
+ Func_void_VerifyGpgCleartextResult create_Func_void_VerifyGpgCleartextResult(void* NON_NULL swiftClosureWrapper) noexcept {
19
+ auto swiftClosure = ReactNativeBundleCrypto::Func_void_VerifyGpgCleartextResult::fromUnsafe(swiftClosureWrapper);
20
+ return [swiftClosure = std::move(swiftClosure)](const VerifyGpgCleartextResult& result) mutable -> void {
21
+ swiftClosure.call(result);
22
+ };
23
+ }
24
+
25
+ // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
26
+ Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
27
+ auto swiftClosure = ReactNativeBundleCrypto::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
28
+ return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
29
+ swiftClosure.call(error);
30
+ };
31
+ }
32
+
33
+ // pragma MARK: std::function<void(const VerifyDetachedAscResult& /* result */)>
34
+ Func_void_VerifyDetachedAscResult create_Func_void_VerifyDetachedAscResult(void* NON_NULL swiftClosureWrapper) noexcept {
35
+ auto swiftClosure = ReactNativeBundleCrypto::Func_void_VerifyDetachedAscResult::fromUnsafe(swiftClosureWrapper);
36
+ return [swiftClosure = std::move(swiftClosure)](const VerifyDetachedAscResult& result) mutable -> void {
37
+ swiftClosure.call(result);
38
+ };
39
+ }
40
+
41
+ // pragma MARK: std::function<void(const Sha256Result& /* result */)>
42
+ Func_void_Sha256Result create_Func_void_Sha256Result(void* NON_NULL swiftClosureWrapper) noexcept {
43
+ auto swiftClosure = ReactNativeBundleCrypto::Func_void_Sha256Result::fromUnsafe(swiftClosureWrapper);
44
+ return [swiftClosure = std::move(swiftClosure)](const Sha256Result& result) mutable -> void {
45
+ swiftClosure.call(result);
46
+ };
47
+ }
48
+
49
+ // pragma MARK: std::function<void(bool /* result */)>
50
+ Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
51
+ auto swiftClosure = ReactNativeBundleCrypto::Func_void_bool::fromUnsafe(swiftClosureWrapper);
52
+ return [swiftClosure = std::move(swiftClosure)](bool result) mutable -> void {
53
+ swiftClosure.call(result);
54
+ };
55
+ }
56
+
57
+ // pragma MARK: std::function<void(const std::vector<DirHashEntry>& /* result */)>
58
+ Func_void_std__vector_DirHashEntry_ create_Func_void_std__vector_DirHashEntry_(void* NON_NULL swiftClosureWrapper) noexcept {
59
+ auto swiftClosure = ReactNativeBundleCrypto::Func_void_std__vector_DirHashEntry_::fromUnsafe(swiftClosureWrapper);
60
+ return [swiftClosure = std::move(swiftClosure)](const std::vector<DirHashEntry>& result) mutable -> void {
61
+ swiftClosure.call(result);
62
+ };
63
+ }
64
+
65
+ // pragma MARK: std::function<void()>
66
+ Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
67
+ auto swiftClosure = ReactNativeBundleCrypto::Func_void::fromUnsafe(swiftClosureWrapper);
68
+ return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
69
+ swiftClosure.call();
70
+ };
71
+ }
72
+
73
+ // pragma MARK: std::function<void(const std::vector<std::string>& /* result */)>
74
+ Func_void_std__vector_std__string_ create_Func_void_std__vector_std__string_(void* NON_NULL swiftClosureWrapper) noexcept {
75
+ auto swiftClosure = ReactNativeBundleCrypto::Func_void_std__vector_std__string_::fromUnsafe(swiftClosureWrapper);
76
+ return [swiftClosure = std::move(swiftClosure)](const std::vector<std::string>& result) mutable -> void {
77
+ swiftClosure.call(result);
78
+ };
79
+ }
80
+
81
+ // pragma MARK: std::shared_ptr<HybridReactNativeBundleCryptoSpec>
82
+ std::shared_ptr<HybridReactNativeBundleCryptoSpec> create_std__shared_ptr_HybridReactNativeBundleCryptoSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
83
+ ReactNativeBundleCrypto::HybridReactNativeBundleCryptoSpec_cxx swiftPart = ReactNativeBundleCrypto::HybridReactNativeBundleCryptoSpec_cxx::fromUnsafe(swiftUnsafePointer);
84
+ return std::make_shared<margelo::nitro::reactnativebundlecrypto::HybridReactNativeBundleCryptoSpecSwift>(swiftPart);
85
+ }
86
+ void* NON_NULL get_std__shared_ptr_HybridReactNativeBundleCryptoSpec_(std__shared_ptr_HybridReactNativeBundleCryptoSpec_ cppType) {
87
+ std::shared_ptr<margelo::nitro::reactnativebundlecrypto::HybridReactNativeBundleCryptoSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::reactnativebundlecrypto::HybridReactNativeBundleCryptoSpecSwift>(cppType);
88
+ #ifdef NITRO_DEBUG
89
+ if (swiftWrapper == nullptr) [[unlikely]] {
90
+ throw std::runtime_error("Class \"HybridReactNativeBundleCryptoSpec\" is not implemented in Swift!");
91
+ }
92
+ #endif
93
+ ReactNativeBundleCrypto::HybridReactNativeBundleCryptoSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
94
+ return swiftPart.toUnsafe();
95
+ }
96
+
97
+ } // namespace margelo::nitro::reactnativebundlecrypto::bridge::swift