@onekeyfe/react-native-get-random-values 1.1.10

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 (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -0
  3. package/ReactNativeGetRandomValues.podspec +29 -0
  4. package/android/CMakeLists.txt +24 -0
  5. package/android/build.gradle +128 -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/reactnativegetrandomvalues/ReactNativeGetRandomValues.kt +15 -0
  10. package/android/src/main/java/com/margelo/nitro/reactnativegetrandomvalues/ReactNativeGetRandomValuesPackage.kt +22 -0
  11. package/ios/ReactNativeGetRandomValues.swift +12 -0
  12. package/lib/module/ReactNativeGetRandomValues.nitro.js +4 -0
  13. package/lib/module/ReactNativeGetRandomValues.nitro.js.map +1 -0
  14. package/lib/module/index.js +86 -0
  15. package/lib/module/index.js.map +1 -0
  16. package/lib/module/module.js +4 -0
  17. package/lib/module/module.js.map +1 -0
  18. package/lib/module/module.native.js +6 -0
  19. package/lib/module/module.native.js.map +1 -0
  20. package/lib/module/package.json +1 -0
  21. package/lib/typescript/package.json +1 -0
  22. package/lib/typescript/src/ReactNativeGetRandomValues.nitro.d.ts +15 -0
  23. package/lib/typescript/src/ReactNativeGetRandomValues.nitro.d.ts.map +1 -0
  24. package/lib/typescript/src/index.d.ts +2 -0
  25. package/lib/typescript/src/index.d.ts.map +1 -0
  26. package/lib/typescript/src/module.d.ts +3 -0
  27. package/lib/typescript/src/module.d.ts.map +1 -0
  28. package/lib/typescript/src/module.native.d.ts +4 -0
  29. package/lib/typescript/src/module.native.d.ts.map +1 -0
  30. package/nitro.json +17 -0
  31. package/nitrogen/generated/android/c++/JHybridReactNativeGetRandomValuesSpec.cpp +52 -0
  32. package/nitrogen/generated/android/c++/JHybridReactNativeGetRandomValuesSpec.hpp +65 -0
  33. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativegetrandomvalues/HybridReactNativeGetRandomValuesSpec.kt +57 -0
  34. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativegetrandomvalues/reactnativegetrandomvaluesOnLoad.kt +35 -0
  35. package/nitrogen/generated/android/reactnativegetrandomvalues+autolinking.cmake +81 -0
  36. package/nitrogen/generated/android/reactnativegetrandomvalues+autolinking.gradle +27 -0
  37. package/nitrogen/generated/android/reactnativegetrandomvaluesOnLoad.cpp +44 -0
  38. package/nitrogen/generated/android/reactnativegetrandomvaluesOnLoad.hpp +25 -0
  39. package/nitrogen/generated/ios/ReactNativeGetRandomValues+autolinking.rb +60 -0
  40. package/nitrogen/generated/ios/ReactNativeGetRandomValues-Swift-Cxx-Bridge.cpp +33 -0
  41. package/nitrogen/generated/ios/ReactNativeGetRandomValues-Swift-Cxx-Bridge.hpp +52 -0
  42. package/nitrogen/generated/ios/ReactNativeGetRandomValues-Swift-Cxx-Umbrella.hpp +44 -0
  43. package/nitrogen/generated/ios/ReactNativeGetRandomValuesAutolinking.mm +33 -0
  44. package/nitrogen/generated/ios/ReactNativeGetRandomValuesAutolinking.swift +25 -0
  45. package/nitrogen/generated/ios/c++/HybridReactNativeGetRandomValuesSpecSwift.cpp +11 -0
  46. package/nitrogen/generated/ios/c++/HybridReactNativeGetRandomValuesSpecSwift.hpp +76 -0
  47. package/nitrogen/generated/ios/swift/HybridReactNativeGetRandomValuesSpec.swift +56 -0
  48. package/nitrogen/generated/ios/swift/HybridReactNativeGetRandomValuesSpec_cxx.swift +131 -0
  49. package/nitrogen/generated/shared/c++/HybridReactNativeGetRandomValuesSpec.cpp +21 -0
  50. package/nitrogen/generated/shared/c++/HybridReactNativeGetRandomValuesSpec.hpp +62 -0
  51. package/package.json +170 -0
  52. package/src/ReactNativeGetRandomValues.nitro.ts +15 -0
  53. package/src/index.tsx +95 -0
  54. package/src/module.native.tsx +8 -0
  55. package/src/module.tsx +4 -0
@@ -0,0 +1,57 @@
1
+ ///
2
+ /// HybridReactNativeGetRandomValuesSpec.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.reactnativegetrandomvalues
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.HybridObject
14
+
15
+ /**
16
+ * A Kotlin class representing the ReactNativeGetRandomValues HybridObject.
17
+ * Implement this abstract class to create Kotlin-based instances of ReactNativeGetRandomValues.
18
+ */
19
+ @DoNotStrip
20
+ @Keep
21
+ @Suppress(
22
+ "KotlinJniMissingFunction", "unused",
23
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
24
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
25
+ )
26
+ abstract class HybridReactNativeGetRandomValuesSpec: HybridObject() {
27
+ @DoNotStrip
28
+ private var mHybridData: HybridData = initHybrid()
29
+
30
+ init {
31
+ super.updateNative(mHybridData)
32
+ }
33
+
34
+ override fun updateNative(hybridData: HybridData) {
35
+ mHybridData = hybridData
36
+ super.updateNative(hybridData)
37
+ }
38
+
39
+ // Default implementation of `HybridObject.toString()`
40
+ override fun toString(): String {
41
+ return "[HybridObject ReactNativeGetRandomValues]"
42
+ }
43
+
44
+ // Properties
45
+
46
+
47
+ // Methods
48
+ @DoNotStrip
49
+ @Keep
50
+ abstract fun getRandomBase64(byteLength: Double): String
51
+
52
+ private external fun initHybrid(): HybridData
53
+
54
+ companion object {
55
+ protected const val TAG = "HybridReactNativeGetRandomValuesSpec"
56
+ }
57
+ }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// reactnativegetrandomvaluesOnLoad.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.reactnativegetrandomvalues
9
+
10
+ import android.util.Log
11
+
12
+ internal class reactnativegetrandomvaluesOnLoad {
13
+ companion object {
14
+ private const val TAG = "reactnativegetrandomvaluesOnLoad"
15
+ private var didLoad = false
16
+ /**
17
+ * Initializes the native part of "reactnativegetrandomvalues".
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 reactnativegetrandomvalues C++ library...")
25
+ System.loadLibrary("reactnativegetrandomvalues")
26
+ Log.i(TAG, "Successfully loaded reactnativegetrandomvalues C++ library!")
27
+ didLoad = true
28
+ } catch (e: Error) {
29
+ Log.e(TAG, "Failed to load reactnativegetrandomvalues 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
+ # reactnativegetrandomvalues+autolinking.cmake
3
+ # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ # https://github.com/mrousavy/nitro
5
+ # Copyright © 2025 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/reactnativegetrandomvalues+autolinking.cmake)
14
+ # ```
15
+
16
+ # Define a flag to check if we are building properly
17
+ add_definitions(-DBUILDING_REACTNATIVEGETRANDOMVALUES_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
+ reactnativegetrandomvalues PRIVATE
33
+ # Autolinking Setup
34
+ ../nitrogen/generated/android/reactnativegetrandomvaluesOnLoad.cpp
35
+ # Shared Nitrogen C++ sources
36
+ ../nitrogen/generated/shared/c++/HybridReactNativeGetRandomValuesSpec.cpp
37
+ # Android-specific Nitrogen C++ sources
38
+ ../nitrogen/generated/android/c++/JHybridReactNativeGetRandomValuesSpec.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
+ reactnativegetrandomvalues 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
+ reactnativegetrandomvalues
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
+ reactnativegetrandomvalues
74
+ ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
75
+ )
76
+ else()
77
+ target_link_libraries(
78
+ reactnativegetrandomvalues
79
+ ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
80
+ )
81
+ endif()
@@ -0,0 +1,27 @@
1
+ ///
2
+ /// reactnativegetrandomvalues+autolinking.gradle
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 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/reactnativegetrandomvalues+autolinking.gradle'
14
+ /// ```
15
+
16
+ logger.warn("[NitroModules] 🔥 reactnativegetrandomvalues 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
+ /// reactnativegetrandomvaluesOnLoad.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #ifndef BUILDING_REACTNATIVEGETRANDOMVALUES_WITH_GENERATED_CMAKE_PROJECT
9
+ #error reactnativegetrandomvaluesOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
10
+ #endif
11
+
12
+ #include "reactnativegetrandomvaluesOnLoad.hpp"
13
+
14
+ #include <jni.h>
15
+ #include <fbjni/fbjni.h>
16
+ #include <NitroModules/HybridObjectRegistry.hpp>
17
+
18
+ #include "JHybridReactNativeGetRandomValuesSpec.hpp"
19
+ #include <NitroModules/DefaultConstructableObject.hpp>
20
+
21
+ namespace margelo::nitro::reactnativegetrandomvalues {
22
+
23
+ int initialize(JavaVM* vm) {
24
+ using namespace margelo::nitro;
25
+ using namespace margelo::nitro::reactnativegetrandomvalues;
26
+ using namespace facebook;
27
+
28
+ return facebook::jni::initialize(vm, [] {
29
+ // Register native JNI methods
30
+ margelo::nitro::reactnativegetrandomvalues::JHybridReactNativeGetRandomValuesSpec::registerNatives();
31
+
32
+ // Register Nitro Hybrid Objects
33
+ HybridObjectRegistry::registerHybridObjectConstructor(
34
+ "ReactNativeGetRandomValues",
35
+ []() -> std::shared_ptr<HybridObject> {
36
+ static DefaultConstructableObject<JHybridReactNativeGetRandomValuesSpec::javaobject> object("com/margelo/nitro/reactnativegetrandomvalues/ReactNativeGetRandomValues");
37
+ auto instance = object.create();
38
+ return instance->cthis()->shared();
39
+ }
40
+ );
41
+ });
42
+ }
43
+
44
+ } // namespace margelo::nitro::reactnativegetrandomvalues
@@ -0,0 +1,25 @@
1
+ ///
2
+ /// reactnativegetrandomvaluesOnLoad.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include <jni.h>
9
+ #include <NitroModules/NitroDefines.hpp>
10
+
11
+ namespace margelo::nitro::reactnativegetrandomvalues {
12
+
13
+ /**
14
+ * Initializes the native (C++) part of reactnativegetrandomvalues, 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::reactnativegetrandomvalues::initialize(vm);
20
+ * }
21
+ * ```
22
+ */
23
+ int initialize(JavaVM* vm);
24
+
25
+ } // namespace margelo::nitro::reactnativegetrandomvalues
@@ -0,0 +1,60 @@
1
+ #
2
+ # ReactNativeGetRandomValues+autolinking.rb
3
+ # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ # https://github.com/mrousavy/nitro
5
+ # Copyright © 2025 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/ReactNativeGetRandomValues+autolinking.rb'
18
+ # add_nitrogen_files(spec)
19
+ # end
20
+ # ```
21
+
22
+ def add_nitrogen_files(spec)
23
+ Pod::UI.puts "[NitroModules] 🔥 ReactNativeGetRandomValues 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/ReactNativeGetRandomValues-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,33 @@
1
+ ///
2
+ /// ReactNativeGetRandomValues-Swift-Cxx-Bridge.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "ReactNativeGetRandomValues-Swift-Cxx-Bridge.hpp"
9
+
10
+ // Include C++ implementation defined types
11
+ #include "HybridReactNativeGetRandomValuesSpecSwift.hpp"
12
+ #include "ReactNativeGetRandomValues-Swift-Cxx-Umbrella.hpp"
13
+ #include <NitroModules/NitroDefines.hpp>
14
+
15
+ namespace margelo::nitro::reactnativegetrandomvalues::bridge::swift {
16
+
17
+ // pragma MARK: std::shared_ptr<HybridReactNativeGetRandomValuesSpec>
18
+ std::shared_ptr<HybridReactNativeGetRandomValuesSpec> create_std__shared_ptr_HybridReactNativeGetRandomValuesSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
19
+ ReactNativeGetRandomValues::HybridReactNativeGetRandomValuesSpec_cxx swiftPart = ReactNativeGetRandomValues::HybridReactNativeGetRandomValuesSpec_cxx::fromUnsafe(swiftUnsafePointer);
20
+ return std::make_shared<margelo::nitro::reactnativegetrandomvalues::HybridReactNativeGetRandomValuesSpecSwift>(swiftPart);
21
+ }
22
+ void* NON_NULL get_std__shared_ptr_HybridReactNativeGetRandomValuesSpec_(std__shared_ptr_HybridReactNativeGetRandomValuesSpec_ cppType) {
23
+ std::shared_ptr<margelo::nitro::reactnativegetrandomvalues::HybridReactNativeGetRandomValuesSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::reactnativegetrandomvalues::HybridReactNativeGetRandomValuesSpecSwift>(cppType);
24
+ #ifdef NITRO_DEBUG
25
+ if (swiftWrapper == nullptr) [[unlikely]] {
26
+ throw std::runtime_error("Class \"HybridReactNativeGetRandomValuesSpec\" is not implemented in Swift!");
27
+ }
28
+ #endif
29
+ ReactNativeGetRandomValues::HybridReactNativeGetRandomValuesSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
30
+ return swiftPart.toUnsafe();
31
+ }
32
+
33
+ } // namespace margelo::nitro::reactnativegetrandomvalues::bridge::swift
@@ -0,0 +1,52 @@
1
+ ///
2
+ /// ReactNativeGetRandomValues-Swift-Cxx-Bridge.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ // Forward declarations of C++ defined types
11
+ // Forward declaration of `HybridReactNativeGetRandomValuesSpec` to properly resolve imports.
12
+ namespace margelo::nitro::reactnativegetrandomvalues { class HybridReactNativeGetRandomValuesSpec; }
13
+
14
+ // Forward declarations of Swift defined types
15
+ // Forward declaration of `HybridReactNativeGetRandomValuesSpec_cxx` to properly resolve imports.
16
+ namespace ReactNativeGetRandomValues { class HybridReactNativeGetRandomValuesSpec_cxx; }
17
+
18
+ // Include C++ defined types
19
+ #include "HybridReactNativeGetRandomValuesSpec.hpp"
20
+ #include <NitroModules/Result.hpp>
21
+ #include <exception>
22
+ #include <memory>
23
+ #include <string>
24
+
25
+ /**
26
+ * Contains specialized versions of C++ templated types so they can be accessed from Swift,
27
+ * as well as helper functions to interact with those C++ types from Swift.
28
+ */
29
+ namespace margelo::nitro::reactnativegetrandomvalues::bridge::swift {
30
+
31
+ // pragma MARK: std::shared_ptr<HybridReactNativeGetRandomValuesSpec>
32
+ /**
33
+ * Specialized version of `std::shared_ptr<HybridReactNativeGetRandomValuesSpec>`.
34
+ */
35
+ using std__shared_ptr_HybridReactNativeGetRandomValuesSpec_ = std::shared_ptr<HybridReactNativeGetRandomValuesSpec>;
36
+ std::shared_ptr<HybridReactNativeGetRandomValuesSpec> create_std__shared_ptr_HybridReactNativeGetRandomValuesSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
37
+ void* NON_NULL get_std__shared_ptr_HybridReactNativeGetRandomValuesSpec_(std__shared_ptr_HybridReactNativeGetRandomValuesSpec_ cppType);
38
+
39
+ // pragma MARK: std::weak_ptr<HybridReactNativeGetRandomValuesSpec>
40
+ using std__weak_ptr_HybridReactNativeGetRandomValuesSpec_ = std::weak_ptr<HybridReactNativeGetRandomValuesSpec>;
41
+ inline std__weak_ptr_HybridReactNativeGetRandomValuesSpec_ weakify_std__shared_ptr_HybridReactNativeGetRandomValuesSpec_(const std::shared_ptr<HybridReactNativeGetRandomValuesSpec>& strong) noexcept { return strong; }
42
+
43
+ // pragma MARK: Result<std::string>
44
+ using Result_std__string_ = Result<std::string>;
45
+ inline Result_std__string_ create_Result_std__string_(const std::string& value) noexcept {
46
+ return Result<std::string>::withValue(value);
47
+ }
48
+ inline Result_std__string_ create_Result_std__string_(const std::exception_ptr& error) noexcept {
49
+ return Result<std::string>::withError(error);
50
+ }
51
+
52
+ } // namespace margelo::nitro::reactnativegetrandomvalues::bridge::swift
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// ReactNativeGetRandomValues-Swift-Cxx-Umbrella.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ // Forward declarations of C++ defined types
11
+ // Forward declaration of `HybridReactNativeGetRandomValuesSpec` to properly resolve imports.
12
+ namespace margelo::nitro::reactnativegetrandomvalues { class HybridReactNativeGetRandomValuesSpec; }
13
+
14
+ // Include C++ defined types
15
+ #include "HybridReactNativeGetRandomValuesSpec.hpp"
16
+ #include <NitroModules/Result.hpp>
17
+ #include <exception>
18
+ #include <memory>
19
+ #include <string>
20
+
21
+ // C++ helpers for Swift
22
+ #include "ReactNativeGetRandomValues-Swift-Cxx-Bridge.hpp"
23
+
24
+ // Common C++ types used in Swift
25
+ #include <NitroModules/ArrayBufferHolder.hpp>
26
+ #include <NitroModules/AnyMapUtils.hpp>
27
+ #include <NitroModules/RuntimeError.hpp>
28
+ #include <NitroModules/DateToChronoDate.hpp>
29
+
30
+ // Forward declarations of Swift defined types
31
+ // Forward declaration of `HybridReactNativeGetRandomValuesSpec_cxx` to properly resolve imports.
32
+ namespace ReactNativeGetRandomValues { class HybridReactNativeGetRandomValuesSpec_cxx; }
33
+
34
+ // Include Swift defined types
35
+ #if __has_include("ReactNativeGetRandomValues-Swift.h")
36
+ // This header is generated by Xcode/Swift on every app build.
37
+ // If it cannot be found, make sure the Swift module's name (= podspec name) is actually "ReactNativeGetRandomValues".
38
+ #include "ReactNativeGetRandomValues-Swift.h"
39
+ // Same as above, but used when building with frameworks (`use_frameworks`)
40
+ #elif __has_include(<ReactNativeGetRandomValues/ReactNativeGetRandomValues-Swift.h>)
41
+ #include <ReactNativeGetRandomValues/ReactNativeGetRandomValues-Swift.h>
42
+ #else
43
+ #error ReactNativeGetRandomValues's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "ReactNativeGetRandomValues", and try building the app first.
44
+ #endif
@@ -0,0 +1,33 @@
1
+ ///
2
+ /// ReactNativeGetRandomValuesAutolinking.mm
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #import <NitroModules/HybridObjectRegistry.hpp>
10
+ #import "ReactNativeGetRandomValues-Swift-Cxx-Umbrella.hpp"
11
+ #import <type_traits>
12
+
13
+ #include "HybridReactNativeGetRandomValuesSpecSwift.hpp"
14
+
15
+ @interface ReactNativeGetRandomValuesAutolinking : NSObject
16
+ @end
17
+
18
+ @implementation ReactNativeGetRandomValuesAutolinking
19
+
20
+ + (void) load {
21
+ using namespace margelo::nitro;
22
+ using namespace margelo::nitro::reactnativegetrandomvalues;
23
+
24
+ HybridObjectRegistry::registerHybridObjectConstructor(
25
+ "ReactNativeGetRandomValues",
26
+ []() -> std::shared_ptr<HybridObject> {
27
+ std::shared_ptr<HybridReactNativeGetRandomValuesSpec> hybridObject = ReactNativeGetRandomValues::ReactNativeGetRandomValuesAutolinking::createReactNativeGetRandomValues();
28
+ return hybridObject;
29
+ }
30
+ );
31
+ }
32
+
33
+ @end
@@ -0,0 +1,25 @@
1
+ ///
2
+ /// ReactNativeGetRandomValuesAutolinking.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ public final class ReactNativeGetRandomValuesAutolinking {
9
+ public typealias bridge = margelo.nitro.reactnativegetrandomvalues.bridge.swift
10
+
11
+ /**
12
+ * Creates an instance of a Swift class that implements `HybridReactNativeGetRandomValuesSpec`,
13
+ * and wraps it in a Swift class that can directly interop with C++ (`HybridReactNativeGetRandomValuesSpec_cxx`)
14
+ *
15
+ * This is generated by Nitrogen and will initialize the class specified
16
+ * in the `"autolinking"` property of `nitro.json` (in this case, `ReactNativeGetRandomValues`).
17
+ */
18
+ public static func createReactNativeGetRandomValues() -> bridge.std__shared_ptr_HybridReactNativeGetRandomValuesSpec_ {
19
+ let hybridObject = ReactNativeGetRandomValues()
20
+ return { () -> bridge.std__shared_ptr_HybridReactNativeGetRandomValuesSpec_ in
21
+ let __cxxWrapped = hybridObject.getCxxWrapper()
22
+ return __cxxWrapped.getCxxPart()
23
+ }()
24
+ }
25
+ }
@@ -0,0 +1,11 @@
1
+ ///
2
+ /// HybridReactNativeGetRandomValuesSpecSwift.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "HybridReactNativeGetRandomValuesSpecSwift.hpp"
9
+
10
+ namespace margelo::nitro::reactnativegetrandomvalues {
11
+ } // namespace margelo::nitro::reactnativegetrandomvalues
@@ -0,0 +1,76 @@
1
+ ///
2
+ /// HybridReactNativeGetRandomValuesSpecSwift.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include "HybridReactNativeGetRandomValuesSpec.hpp"
11
+
12
+ // Forward declaration of `HybridReactNativeGetRandomValuesSpec_cxx` to properly resolve imports.
13
+ namespace ReactNativeGetRandomValues { class HybridReactNativeGetRandomValuesSpec_cxx; }
14
+
15
+
16
+
17
+ #include <string>
18
+
19
+ #include "ReactNativeGetRandomValues-Swift-Cxx-Umbrella.hpp"
20
+
21
+ namespace margelo::nitro::reactnativegetrandomvalues {
22
+
23
+ /**
24
+ * The C++ part of HybridReactNativeGetRandomValuesSpec_cxx.swift.
25
+ *
26
+ * HybridReactNativeGetRandomValuesSpecSwift (C++) accesses HybridReactNativeGetRandomValuesSpec_cxx (Swift), and might
27
+ * contain some additional bridging code for C++ <> Swift interop.
28
+ *
29
+ * Since this obviously introduces an overhead, I hope at some point in
30
+ * the future, HybridReactNativeGetRandomValuesSpec_cxx can directly inherit from the C++ class HybridReactNativeGetRandomValuesSpec
31
+ * to simplify the whole structure and memory management.
32
+ */
33
+ class HybridReactNativeGetRandomValuesSpecSwift: public virtual HybridReactNativeGetRandomValuesSpec {
34
+ public:
35
+ // Constructor from a Swift instance
36
+ explicit HybridReactNativeGetRandomValuesSpecSwift(const ReactNativeGetRandomValues::HybridReactNativeGetRandomValuesSpec_cxx& swiftPart):
37
+ HybridObject(HybridReactNativeGetRandomValuesSpec::TAG),
38
+ _swiftPart(swiftPart) { }
39
+
40
+ public:
41
+ // Get the Swift part
42
+ inline ReactNativeGetRandomValues::HybridReactNativeGetRandomValuesSpec_cxx& getSwiftPart() noexcept {
43
+ return _swiftPart;
44
+ }
45
+
46
+ public:
47
+ inline size_t getExternalMemorySize() noexcept override {
48
+ return _swiftPart.getMemorySize();
49
+ }
50
+ void dispose() noexcept override {
51
+ _swiftPart.dispose();
52
+ }
53
+ std::string toString() override {
54
+ return _swiftPart.toString();
55
+ }
56
+
57
+ public:
58
+ // Properties
59
+
60
+
61
+ public:
62
+ // Methods
63
+ inline std::string getRandomBase64(double byteLength) override {
64
+ auto __result = _swiftPart.getRandomBase64(std::forward<decltype(byteLength)>(byteLength));
65
+ if (__result.hasError()) [[unlikely]] {
66
+ std::rethrow_exception(__result.error());
67
+ }
68
+ auto __value = std::move(__result.value());
69
+ return __value;
70
+ }
71
+
72
+ private:
73
+ ReactNativeGetRandomValues::HybridReactNativeGetRandomValuesSpec_cxx _swiftPart;
74
+ };
75
+
76
+ } // namespace margelo::nitro::reactnativegetrandomvalues
@@ -0,0 +1,56 @@
1
+ ///
2
+ /// HybridReactNativeGetRandomValuesSpec.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /// See ``HybridReactNativeGetRandomValuesSpec``
12
+ public protocol HybridReactNativeGetRandomValuesSpec_protocol: HybridObject {
13
+ // Properties
14
+
15
+
16
+ // Methods
17
+ func getRandomBase64(byteLength: Double) throws -> String
18
+ }
19
+
20
+ public extension HybridReactNativeGetRandomValuesSpec_protocol {
21
+ /// Default implementation of ``HybridObject.toString``
22
+ func toString() -> String {
23
+ return "[HybridObject ReactNativeGetRandomValues]"
24
+ }
25
+ }
26
+
27
+ /// See ``HybridReactNativeGetRandomValuesSpec``
28
+ open class HybridReactNativeGetRandomValuesSpec_base {
29
+ private weak var cxxWrapper: HybridReactNativeGetRandomValuesSpec_cxx? = nil
30
+ public init() { }
31
+ public func getCxxWrapper() -> HybridReactNativeGetRandomValuesSpec_cxx {
32
+ #if DEBUG
33
+ guard self is HybridReactNativeGetRandomValuesSpec else {
34
+ fatalError("`self` is not a `HybridReactNativeGetRandomValuesSpec`! Did you accidentally inherit from `HybridReactNativeGetRandomValuesSpec_base` instead of `HybridReactNativeGetRandomValuesSpec`?")
35
+ }
36
+ #endif
37
+ if let cxxWrapper = self.cxxWrapper {
38
+ return cxxWrapper
39
+ } else {
40
+ let cxxWrapper = HybridReactNativeGetRandomValuesSpec_cxx(self as! HybridReactNativeGetRandomValuesSpec)
41
+ self.cxxWrapper = cxxWrapper
42
+ return cxxWrapper
43
+ }
44
+ }
45
+ }
46
+
47
+ /**
48
+ * A Swift base-protocol representing the ReactNativeGetRandomValues HybridObject.
49
+ * Implement this protocol to create Swift-based instances of ReactNativeGetRandomValues.
50
+ * ```swift
51
+ * class HybridReactNativeGetRandomValues : HybridReactNativeGetRandomValuesSpec {
52
+ * // ...
53
+ * }
54
+ * ```
55
+ */
56
+ public typealias HybridReactNativeGetRandomValuesSpec = HybridReactNativeGetRandomValuesSpec_protocol & HybridReactNativeGetRandomValuesSpec_base