react-native-security-pack 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +181 -13
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +55 -60
- package/android/fix-prefab.gradle +44 -0
- package/android/gradle.properties +5 -5
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/leerman/rnsecuritypack/RNSecurityPackPackage.kt +23 -0
- package/android/src/main/java/com/margelo/nitro/rnsecuritypack/HybridSecurityPack.kt +85 -0
- package/ios/HybridSecurityPack.swift +17 -0
- package/jest/mock.js +7 -0
- package/lib/commonjs/index.js +24 -17
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/SecurityPack.nitro.js +6 -0
- package/lib/commonjs/specs/SecurityPack.nitro.js.map +1 -0
- package/lib/module/index.js +25 -18
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/SecurityPack.nitro.js +4 -0
- package/lib/module/specs/SecurityPack.nitro.js.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +7 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/specs/SecurityPack.nitro.d.ts +9 -0
- package/lib/typescript/commonjs/src/specs/SecurityPack.nitro.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +7 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/specs/SecurityPack.nitro.d.ts +9 -0
- package/lib/typescript/module/src/specs/SecurityPack.nitro.d.ts.map +1 -0
- package/nitro.json +24 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/RNSecurityPack+autolinking.cmake +81 -0
- package/nitrogen/generated/android/RNSecurityPack+autolinking.gradle +27 -0
- package/nitrogen/generated/android/RNSecurityPackOnLoad.cpp +54 -0
- package/nitrogen/generated/android/RNSecurityPackOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JHybridSecurityPackSpec.cpp +92 -0
- package/nitrogen/generated/android/c++/JHybridSecurityPackSpec.hpp +64 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnsecuritypack/HybridSecurityPackSpec.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnsecuritypack/RNSecurityPackOnLoad.kt +35 -0
- package/nitrogen/generated/ios/RNSecurityPack+autolinking.rb +62 -0
- package/nitrogen/generated/ios/RNSecurityPack-Swift-Cxx-Bridge.cpp +57 -0
- package/nitrogen/generated/ios/RNSecurityPack-Swift-Cxx-Bridge.hpp +166 -0
- package/nitrogen/generated/ios/RNSecurityPack-Swift-Cxx-Umbrella.hpp +46 -0
- package/nitrogen/generated/ios/RNSecurityPackAutolinking.mm +33 -0
- package/nitrogen/generated/ios/RNSecurityPackAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridSecurityPackSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridSecurityPackSpecSwift.hpp +92 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridSecurityPackSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridSecurityPackSpec_cxx.swift +170 -0
- package/nitrogen/generated/shared/c++/HybridSecurityPackSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridSecurityPackSpec.hpp +65 -0
- package/package.json +36 -42
- package/react-native-security-pack.podspec +18 -27
- package/react-native.config.js +1 -0
- package/src/index.ts +39 -0
- package/src/specs/SecurityPack.nitro.ts +7 -0
- package/android/src/main/AndroidManifestNew.xml +0 -2
- package/android/src/main/java/com/leerman/rnsecuritypack/SecurityPackModule.kt +0 -85
- package/android/src/main/java/com/leerman/rnsecuritypack/SecurityPackPackage.kt +0 -35
- package/android/src/newarch/SecurityPackSpec.kt +0 -7
- package/android/src/oldarch/SecurityPackSpec.kt +0 -12
- package/ios/SecurityPack.h +0 -12
- package/ios/SecurityPack.mm +0 -25
- package/lib/commonjs/NativeSecurityPack.js +0 -9
- package/lib/commonjs/NativeSecurityPack.js.map +0 -1
- package/lib/module/NativeSecurityPack.js +0 -5
- package/lib/module/NativeSecurityPack.js.map +0 -1
- package/lib/typescript/commonjs/src/NativeSecurityPack.d.ts +0 -8
- package/lib/typescript/commonjs/src/NativeSecurityPack.d.ts.map +0 -1
- package/lib/typescript/module/src/NativeSecurityPack.d.ts +0 -8
- package/lib/typescript/module/src/NativeSecurityPack.d.ts.map +0 -1
- package/src/NativeSecurityPack.ts +0 -9
- package/src/index.tsx +0 -43
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#
|
|
2
|
+
# RNSecurityPack+autolinking.rb
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © 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/RNSecurityPack+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 RNSecurityPack 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/RNSecurityPack-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 ObjC)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
# Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here)
|
|
60
|
+
"SWIFT_INSTALL_OBJC_HEADER" => "NO",
|
|
61
|
+
})
|
|
62
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RNSecurityPack-Swift-Cxx-Bridge.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "RNSecurityPack-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridSecurityPackSpecSwift.hpp"
|
|
12
|
+
#include "RNSecurityPack-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::rnsecuritypack::bridge::swift {
|
|
16
|
+
|
|
17
|
+
// pragma MARK: std::function<void(const std::vector<std::string>& /* result */)>
|
|
18
|
+
Func_void_std__vector_std__string_ create_Func_void_std__vector_std__string_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
19
|
+
auto swiftClosure = RNSecurityPack::Func_void_std__vector_std__string_::fromUnsafe(swiftClosureWrapper);
|
|
20
|
+
return [swiftClosure = std::move(swiftClosure)](const std::vector<std::string>& 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 = RNSecurityPack::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(bool /* result */)>
|
|
34
|
+
Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
35
|
+
auto swiftClosure = RNSecurityPack::Func_void_bool::fromUnsafe(swiftClosureWrapper);
|
|
36
|
+
return [swiftClosure = std::move(swiftClosure)](bool result) mutable -> void {
|
|
37
|
+
swiftClosure.call(result);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// pragma MARK: std::shared_ptr<HybridSecurityPackSpec>
|
|
42
|
+
std::shared_ptr<HybridSecurityPackSpec> create_std__shared_ptr_HybridSecurityPackSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
43
|
+
RNSecurityPack::HybridSecurityPackSpec_cxx swiftPart = RNSecurityPack::HybridSecurityPackSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
44
|
+
return std::make_shared<margelo::nitro::rnsecuritypack::HybridSecurityPackSpecSwift>(swiftPart);
|
|
45
|
+
}
|
|
46
|
+
void* NON_NULL get_std__shared_ptr_HybridSecurityPackSpec_(std__shared_ptr_HybridSecurityPackSpec_ cppType) {
|
|
47
|
+
std::shared_ptr<margelo::nitro::rnsecuritypack::HybridSecurityPackSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::rnsecuritypack::HybridSecurityPackSpecSwift>(cppType);
|
|
48
|
+
#ifdef NITRO_DEBUG
|
|
49
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
50
|
+
throw std::runtime_error("Class \"HybridSecurityPackSpec\" is not implemented in Swift!");
|
|
51
|
+
}
|
|
52
|
+
#endif
|
|
53
|
+
RNSecurityPack::HybridSecurityPackSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
54
|
+
return swiftPart.toUnsafe();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::rnsecuritypack::bridge::swift
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RNSecurityPack-Swift-Cxx-Bridge.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridSecurityPackSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::rnsecuritypack { class HybridSecurityPackSpec; }
|
|
13
|
+
|
|
14
|
+
// Forward declarations of Swift defined types
|
|
15
|
+
// Forward declaration of `HybridSecurityPackSpec_cxx` to properly resolve imports.
|
|
16
|
+
namespace RNSecurityPack { class HybridSecurityPackSpec_cxx; }
|
|
17
|
+
|
|
18
|
+
// Include C++ defined types
|
|
19
|
+
#include "HybridSecurityPackSpec.hpp"
|
|
20
|
+
#include <NitroModules/Promise.hpp>
|
|
21
|
+
#include <NitroModules/PromiseHolder.hpp>
|
|
22
|
+
#include <NitroModules/Result.hpp>
|
|
23
|
+
#include <exception>
|
|
24
|
+
#include <functional>
|
|
25
|
+
#include <memory>
|
|
26
|
+
#include <string>
|
|
27
|
+
#include <vector>
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
31
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
32
|
+
*/
|
|
33
|
+
namespace margelo::nitro::rnsecuritypack::bridge::swift {
|
|
34
|
+
|
|
35
|
+
// pragma MARK: std::vector<std::string>
|
|
36
|
+
/**
|
|
37
|
+
* Specialized version of `std::vector<std::string>`.
|
|
38
|
+
*/
|
|
39
|
+
using std__vector_std__string_ = std::vector<std::string>;
|
|
40
|
+
inline std::vector<std::string> create_std__vector_std__string_(size_t size) noexcept {
|
|
41
|
+
std::vector<std::string> vector;
|
|
42
|
+
vector.reserve(size);
|
|
43
|
+
return vector;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// pragma MARK: std::shared_ptr<Promise<std::vector<std::string>>>
|
|
47
|
+
/**
|
|
48
|
+
* Specialized version of `std::shared_ptr<Promise<std::vector<std::string>>>`.
|
|
49
|
+
*/
|
|
50
|
+
using std__shared_ptr_Promise_std__vector_std__string___ = std::shared_ptr<Promise<std::vector<std::string>>>;
|
|
51
|
+
inline std::shared_ptr<Promise<std::vector<std::string>>> create_std__shared_ptr_Promise_std__vector_std__string___() noexcept {
|
|
52
|
+
return Promise<std::vector<std::string>>::create();
|
|
53
|
+
}
|
|
54
|
+
inline PromiseHolder<std::vector<std::string>> wrap_std__shared_ptr_Promise_std__vector_std__string___(std::shared_ptr<Promise<std::vector<std::string>>> promise) noexcept {
|
|
55
|
+
return PromiseHolder<std::vector<std::string>>(std::move(promise));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// pragma MARK: std::function<void(const std::vector<std::string>& /* result */)>
|
|
59
|
+
/**
|
|
60
|
+
* Specialized version of `std::function<void(const std::vector<std::string>&)>`.
|
|
61
|
+
*/
|
|
62
|
+
using Func_void_std__vector_std__string_ = std::function<void(const std::vector<std::string>& /* result */)>;
|
|
63
|
+
/**
|
|
64
|
+
* Wrapper class for a `std::function<void(const std::vector<std::string>& / * result * /)>`, this can be used from Swift.
|
|
65
|
+
*/
|
|
66
|
+
class Func_void_std__vector_std__string__Wrapper final {
|
|
67
|
+
public:
|
|
68
|
+
explicit Func_void_std__vector_std__string__Wrapper(std::function<void(const std::vector<std::string>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::vector<std::string>& /* result */)>>(std::move(func))) {}
|
|
69
|
+
inline void call(std::vector<std::string> result) const noexcept {
|
|
70
|
+
_function->operator()(result);
|
|
71
|
+
}
|
|
72
|
+
private:
|
|
73
|
+
std::unique_ptr<std::function<void(const std::vector<std::string>& /* result */)>> _function;
|
|
74
|
+
} SWIFT_NONCOPYABLE;
|
|
75
|
+
Func_void_std__vector_std__string_ create_Func_void_std__vector_std__string_(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
76
|
+
inline Func_void_std__vector_std__string__Wrapper wrap_Func_void_std__vector_std__string_(Func_void_std__vector_std__string_ value) noexcept {
|
|
77
|
+
return Func_void_std__vector_std__string__Wrapper(std::move(value));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
81
|
+
/**
|
|
82
|
+
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
83
|
+
*/
|
|
84
|
+
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
85
|
+
/**
|
|
86
|
+
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
87
|
+
*/
|
|
88
|
+
class Func_void_std__exception_ptr_Wrapper final {
|
|
89
|
+
public:
|
|
90
|
+
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
|
|
91
|
+
inline void call(std::exception_ptr error) const noexcept {
|
|
92
|
+
_function->operator()(error);
|
|
93
|
+
}
|
|
94
|
+
private:
|
|
95
|
+
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
96
|
+
} SWIFT_NONCOPYABLE;
|
|
97
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
98
|
+
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
99
|
+
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// pragma MARK: std::shared_ptr<Promise<bool>>
|
|
103
|
+
/**
|
|
104
|
+
* Specialized version of `std::shared_ptr<Promise<bool>>`.
|
|
105
|
+
*/
|
|
106
|
+
using std__shared_ptr_Promise_bool__ = std::shared_ptr<Promise<bool>>;
|
|
107
|
+
inline std::shared_ptr<Promise<bool>> create_std__shared_ptr_Promise_bool__() noexcept {
|
|
108
|
+
return Promise<bool>::create();
|
|
109
|
+
}
|
|
110
|
+
inline PromiseHolder<bool> wrap_std__shared_ptr_Promise_bool__(std::shared_ptr<Promise<bool>> promise) noexcept {
|
|
111
|
+
return PromiseHolder<bool>(std::move(promise));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// pragma MARK: std::function<void(bool /* result */)>
|
|
115
|
+
/**
|
|
116
|
+
* Specialized version of `std::function<void(bool)>`.
|
|
117
|
+
*/
|
|
118
|
+
using Func_void_bool = std::function<void(bool /* result */)>;
|
|
119
|
+
/**
|
|
120
|
+
* Wrapper class for a `std::function<void(bool / * result * /)>`, this can be used from Swift.
|
|
121
|
+
*/
|
|
122
|
+
class Func_void_bool_Wrapper final {
|
|
123
|
+
public:
|
|
124
|
+
explicit Func_void_bool_Wrapper(std::function<void(bool /* result */)>&& func): _function(std::make_unique<std::function<void(bool /* result */)>>(std::move(func))) {}
|
|
125
|
+
inline void call(bool result) const noexcept {
|
|
126
|
+
_function->operator()(result);
|
|
127
|
+
}
|
|
128
|
+
private:
|
|
129
|
+
std::unique_ptr<std::function<void(bool /* result */)>> _function;
|
|
130
|
+
} SWIFT_NONCOPYABLE;
|
|
131
|
+
Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
132
|
+
inline Func_void_bool_Wrapper wrap_Func_void_bool(Func_void_bool value) noexcept {
|
|
133
|
+
return Func_void_bool_Wrapper(std::move(value));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// pragma MARK: std::shared_ptr<HybridSecurityPackSpec>
|
|
137
|
+
/**
|
|
138
|
+
* Specialized version of `std::shared_ptr<HybridSecurityPackSpec>`.
|
|
139
|
+
*/
|
|
140
|
+
using std__shared_ptr_HybridSecurityPackSpec_ = std::shared_ptr<HybridSecurityPackSpec>;
|
|
141
|
+
std::shared_ptr<HybridSecurityPackSpec> create_std__shared_ptr_HybridSecurityPackSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
142
|
+
void* NON_NULL get_std__shared_ptr_HybridSecurityPackSpec_(std__shared_ptr_HybridSecurityPackSpec_ cppType);
|
|
143
|
+
|
|
144
|
+
// pragma MARK: std::weak_ptr<HybridSecurityPackSpec>
|
|
145
|
+
using std__weak_ptr_HybridSecurityPackSpec_ = std::weak_ptr<HybridSecurityPackSpec>;
|
|
146
|
+
inline std__weak_ptr_HybridSecurityPackSpec_ weakify_std__shared_ptr_HybridSecurityPackSpec_(const std::shared_ptr<HybridSecurityPackSpec>& strong) noexcept { return strong; }
|
|
147
|
+
|
|
148
|
+
// pragma MARK: Result<std::shared_ptr<Promise<std::vector<std::string>>>>
|
|
149
|
+
using Result_std__shared_ptr_Promise_std__vector_std__string____ = Result<std::shared_ptr<Promise<std::vector<std::string>>>>;
|
|
150
|
+
inline Result_std__shared_ptr_Promise_std__vector_std__string____ create_Result_std__shared_ptr_Promise_std__vector_std__string____(const std::shared_ptr<Promise<std::vector<std::string>>>& value) noexcept {
|
|
151
|
+
return Result<std::shared_ptr<Promise<std::vector<std::string>>>>::withValue(value);
|
|
152
|
+
}
|
|
153
|
+
inline Result_std__shared_ptr_Promise_std__vector_std__string____ create_Result_std__shared_ptr_Promise_std__vector_std__string____(const std::exception_ptr& error) noexcept {
|
|
154
|
+
return Result<std::shared_ptr<Promise<std::vector<std::string>>>>::withError(error);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// pragma MARK: Result<std::shared_ptr<Promise<bool>>>
|
|
158
|
+
using Result_std__shared_ptr_Promise_bool___ = Result<std::shared_ptr<Promise<bool>>>;
|
|
159
|
+
inline Result_std__shared_ptr_Promise_bool___ create_Result_std__shared_ptr_Promise_bool___(const std::shared_ptr<Promise<bool>>& value) noexcept {
|
|
160
|
+
return Result<std::shared_ptr<Promise<bool>>>::withValue(value);
|
|
161
|
+
}
|
|
162
|
+
inline Result_std__shared_ptr_Promise_bool___ create_Result_std__shared_ptr_Promise_bool___(const std::exception_ptr& error) noexcept {
|
|
163
|
+
return Result<std::shared_ptr<Promise<bool>>>::withError(error);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
} // namespace margelo::nitro::rnsecuritypack::bridge::swift
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RNSecurityPack-Swift-Cxx-Umbrella.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridSecurityPackSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::rnsecuritypack { class HybridSecurityPackSpec; }
|
|
13
|
+
|
|
14
|
+
// Include C++ defined types
|
|
15
|
+
#include "HybridSecurityPackSpec.hpp"
|
|
16
|
+
#include <NitroModules/Promise.hpp>
|
|
17
|
+
#include <NitroModules/Result.hpp>
|
|
18
|
+
#include <exception>
|
|
19
|
+
#include <memory>
|
|
20
|
+
#include <string>
|
|
21
|
+
#include <vector>
|
|
22
|
+
|
|
23
|
+
// C++ helpers for Swift
|
|
24
|
+
#include "RNSecurityPack-Swift-Cxx-Bridge.hpp"
|
|
25
|
+
|
|
26
|
+
// Common C++ types used in Swift
|
|
27
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
28
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
29
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
30
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
31
|
+
|
|
32
|
+
// Forward declarations of Swift defined types
|
|
33
|
+
// Forward declaration of `HybridSecurityPackSpec_cxx` to properly resolve imports.
|
|
34
|
+
namespace RNSecurityPack { class HybridSecurityPackSpec_cxx; }
|
|
35
|
+
|
|
36
|
+
// Include Swift defined types
|
|
37
|
+
#if __has_include("RNSecurityPack-Swift.h")
|
|
38
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
39
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "RNSecurityPack".
|
|
40
|
+
#include "RNSecurityPack-Swift.h"
|
|
41
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
42
|
+
#elif __has_include(<RNSecurityPack/RNSecurityPack-Swift.h>)
|
|
43
|
+
#include <RNSecurityPack/RNSecurityPack-Swift.h>
|
|
44
|
+
#else
|
|
45
|
+
#error RNSecurityPack's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "RNSecurityPack", and try building the app first.
|
|
46
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RNSecurityPackAutolinking.mm
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "RNSecurityPack-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridSecurityPackSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface RNSecurityPackAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation RNSecurityPackAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::rnsecuritypack;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"SecurityPack",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridSecurityPackSpec> hybridObject = RNSecurityPack::RNSecurityPackAutolinking::createSecurityPack();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RNSecurityPackAutolinking.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
12
|
+
public final class RNSecurityPackAutolinking {
|
|
13
|
+
public typealias bridge = margelo.nitro.rnsecuritypack.bridge.swift
|
|
14
|
+
|
|
15
|
+
public static func createSecurityPack() -> bridge.std__shared_ptr_HybridSecurityPackSpec_ {
|
|
16
|
+
let hybridObject = HybridSecurityPack()
|
|
17
|
+
return { () -> bridge.std__shared_ptr_HybridSecurityPackSpec_ in
|
|
18
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
19
|
+
return __cxxWrapped.getCxxPart()
|
|
20
|
+
}()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static func isSecurityPackRecyclable() -> Bool {
|
|
24
|
+
return HybridSecurityPack.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSecurityPackSpecSwift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridSecurityPackSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::rnsecuritypack {
|
|
11
|
+
} // namespace margelo::nitro::rnsecuritypack
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSecurityPackSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridSecurityPackSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridSecurityPackSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace RNSecurityPack { class HybridSecurityPackSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
#include <string>
|
|
18
|
+
#include <vector>
|
|
19
|
+
#include <NitroModules/Promise.hpp>
|
|
20
|
+
|
|
21
|
+
#include "RNSecurityPack-Swift-Cxx-Umbrella.hpp"
|
|
22
|
+
|
|
23
|
+
namespace margelo::nitro::rnsecuritypack {
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The C++ part of HybridSecurityPackSpec_cxx.swift.
|
|
27
|
+
*
|
|
28
|
+
* HybridSecurityPackSpecSwift (C++) accesses HybridSecurityPackSpec_cxx (Swift), and might
|
|
29
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
30
|
+
*
|
|
31
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
32
|
+
* the future, HybridSecurityPackSpec_cxx can directly inherit from the C++ class HybridSecurityPackSpec
|
|
33
|
+
* to simplify the whole structure and memory management.
|
|
34
|
+
*/
|
|
35
|
+
class HybridSecurityPackSpecSwift: public virtual HybridSecurityPackSpec {
|
|
36
|
+
public:
|
|
37
|
+
// Constructor from a Swift instance
|
|
38
|
+
explicit HybridSecurityPackSpecSwift(const RNSecurityPack::HybridSecurityPackSpec_cxx& swiftPart):
|
|
39
|
+
HybridObject(HybridSecurityPackSpec::TAG),
|
|
40
|
+
_swiftPart(swiftPart) { }
|
|
41
|
+
|
|
42
|
+
public:
|
|
43
|
+
// Get the Swift part
|
|
44
|
+
inline RNSecurityPack::HybridSecurityPackSpec_cxx& getSwiftPart() noexcept {
|
|
45
|
+
return _swiftPart;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
50
|
+
return _swiftPart.getMemorySize();
|
|
51
|
+
}
|
|
52
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
53
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridSecurityPackSpecSwift>(other)) {
|
|
54
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
void dispose() noexcept override {
|
|
59
|
+
_swiftPart.dispose();
|
|
60
|
+
}
|
|
61
|
+
std::string toString() override {
|
|
62
|
+
return _swiftPart.toString();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public:
|
|
66
|
+
// Properties
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
public:
|
|
70
|
+
// Methods
|
|
71
|
+
inline std::shared_ptr<Promise<std::vector<std::string>>> getSignatures() override {
|
|
72
|
+
auto __result = _swiftPart.getSignatures();
|
|
73
|
+
if (__result.hasError()) [[unlikely]] {
|
|
74
|
+
std::rethrow_exception(__result.error());
|
|
75
|
+
}
|
|
76
|
+
auto __value = std::move(__result.value());
|
|
77
|
+
return __value;
|
|
78
|
+
}
|
|
79
|
+
inline std::shared_ptr<Promise<bool>> isRooted() override {
|
|
80
|
+
auto __result = _swiftPart.isRooted();
|
|
81
|
+
if (__result.hasError()) [[unlikely]] {
|
|
82
|
+
std::rethrow_exception(__result.error());
|
|
83
|
+
}
|
|
84
|
+
auto __value = std::move(__result.value());
|
|
85
|
+
return __value;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private:
|
|
89
|
+
RNSecurityPack::HybridSecurityPackSpec_cxx _swiftPart;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
} // namespace margelo::nitro::rnsecuritypack
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_bool.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ value: Bool) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_bool {
|
|
15
|
+
public typealias bridge = margelo.nitro.rnsecuritypack.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ value: Bool) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ value: Bool) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(value: Bool) -> Void {
|
|
25
|
+
self.closure(value)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_bool`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_bool>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_bool {
|
|
44
|
+
return Unmanaged<Func_void_bool>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__exception_ptr.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ error: Error) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_std__exception_ptr {
|
|
15
|
+
public typealias bridge = margelo.nitro.rnsecuritypack.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ error: Error) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ error: Error) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(error: std.exception_ptr) -> Void {
|
|
25
|
+
self.closure(RuntimeError.from(cppError: error))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
|
|
44
|
+
return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__vector_std__string_.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ value: [String]) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_std__vector_std__string_ {
|
|
15
|
+
public typealias bridge = margelo.nitro.rnsecuritypack.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ value: [String]) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ value: [String]) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(value: bridge.std__vector_std__string_) -> Void {
|
|
25
|
+
self.closure(value.map({ __item in String(__item) }))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_std__vector_std__string_`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__vector_std__string_>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_std__string_ {
|
|
44
|
+
return Unmanaged<Func_void_std__vector_std__string_>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|