@qntx/wallet-native 0.12.0 → 0.14.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.
Files changed (135) hide show
  1. package/README.md +184 -31
  2. package/WalletNative.podspec +11 -2
  3. package/android/CMakeLists.txt +7 -1
  4. package/android/build.gradle +4 -0
  5. package/android/src/main/AndroidManifest.xml +1 -2
  6. package/android/src/main/cpp/cpp-adapter.cpp +9 -0
  7. package/android/src/main/java/com/margelo/nitro/qntxwallet/CardReader.kt +316 -0
  8. package/android/src/main/java/com/margelo/nitro/qntxwallet/HybridGoogleDriveAuth.kt +142 -0
  9. package/android/src/main/java/com/margelo/nitro/qntxwallet/HybridSecureInputView.kt +25 -0
  10. package/android/src/main/java/com/margelo/nitro/qntxwallet/Keystore.kt +148 -9
  11. package/android/src/main/java/com/margelo/nitro/qntxwallet/SecureInputField.kt +422 -0
  12. package/android/src/main/java/com/margelo/nitro/qntxwallet/VaultAnchor.kt +90 -0
  13. package/android/src/main/java/com/margelo/nitro/qntxwallet/WalletNativePackage.java +10 -0
  14. package/cpp/host/CardReader.hpp +70 -0
  15. package/cpp/host/HybridKernelHost.cpp +90 -15
  16. package/cpp/host/HybridKernelHost.hpp +21 -5
  17. package/cpp/host/KernelFile.cpp +79 -15
  18. package/cpp/host/KernelFile.hpp +17 -6
  19. package/cpp/host/KernelSlot.hpp +103 -0
  20. package/cpp/host/Keystore.hpp +35 -11
  21. package/cpp/host/Lifecycle.cpp +11 -0
  22. package/cpp/host/Lifecycle.hpp +3 -0
  23. package/cpp/host/Passkey.hpp +8 -0
  24. package/cpp/host/SecureInput.cpp +233 -0
  25. package/cpp/host/SecureInput.hpp +103 -0
  26. package/cpp/host/VaultAnchor.cpp +39 -0
  27. package/cpp/host/VaultAnchor.hpp +28 -0
  28. package/cpp/host/VaultDirectory.hpp +1 -1
  29. package/cpp/platform/CardReaderAndroid.cpp +146 -0
  30. package/cpp/platform/CardReaderIos.mm +318 -0
  31. package/cpp/platform/KeystoreAndroid.cpp +48 -1
  32. package/cpp/platform/KeystoreIos.mm +109 -19
  33. package/cpp/platform/PasskeyAndroid.cpp +2 -0
  34. package/cpp/platform/PasskeyIos.mm +20 -18
  35. package/cpp/platform/QntxSecureInputField.h +24 -0
  36. package/cpp/platform/SecureInputAndroid.cpp +110 -0
  37. package/cpp/platform/SecureInputIos.mm +282 -0
  38. package/cpp/platform/VaultAnchorAndroid.cpp +76 -0
  39. package/cpp/platform/VaultAnchorIos.mm +76 -0
  40. package/cpp/runtime/KernelBackends.cpp +35 -28
  41. package/cpp/runtime/KernelBuffer.hpp +2 -5
  42. package/cpp/runtime/KernelCardReader.cpp +385 -0
  43. package/cpp/runtime/KernelCardReader.hpp +27 -0
  44. package/cpp/runtime/KernelGlobals.cpp +176 -63
  45. package/cpp/runtime/KernelGlobals.hpp +13 -7
  46. package/cpp/runtime/KernelJs.cpp +14 -0
  47. package/cpp/runtime/KernelJs.hpp +4 -0
  48. package/cpp/runtime/KernelKeystore.cpp +78 -2
  49. package/cpp/runtime/KernelKeystore.hpp +1 -0
  50. package/cpp/runtime/KernelPasskey.cpp +15 -12
  51. package/cpp/runtime/KernelRuntime.cpp +24 -7
  52. package/cpp/runtime/KernelRuntime.hpp +14 -6
  53. package/cpp/runtime/KernelSecureInput.cpp +154 -0
  54. package/cpp/runtime/KernelSecureInput.hpp +25 -0
  55. package/cpp/runtime/platform/KernelArgon2.cpp +34 -0
  56. package/cpp/runtime/platform/KernelArgon2.hpp +23 -0
  57. package/cpp/vendor/argon2/LICENSE +314 -0
  58. package/cpp/vendor/argon2/README.md +20 -0
  59. package/cpp/vendor/argon2/include/argon2.h +437 -0
  60. package/cpp/vendor/argon2/src/argon2.c +452 -0
  61. package/cpp/vendor/argon2/src/blake2/blake2-impl.h +156 -0
  62. package/cpp/vendor/argon2/src/blake2/blake2.h +89 -0
  63. package/cpp/vendor/argon2/src/blake2/blake2b.c +390 -0
  64. package/cpp/vendor/argon2/src/blake2/blamka-round-ref.h +56 -0
  65. package/cpp/vendor/argon2/src/core.c +648 -0
  66. package/cpp/vendor/argon2/src/core.h +228 -0
  67. package/cpp/vendor/argon2/src/encoding.c +463 -0
  68. package/cpp/vendor/argon2/src/encoding.h +57 -0
  69. package/cpp/vendor/argon2/src/ref.c +194 -0
  70. package/cpp/vendor/argon2/src/thread.c +57 -0
  71. package/cpp/vendor/argon2/src/thread.h +67 -0
  72. package/dist/cloud.d.mts +58 -0
  73. package/dist/cloud.mjs +114 -0
  74. package/dist/cloud.mjs.map +1 -0
  75. package/dist/index.d.mts +13 -4
  76. package/dist/index.mjs +89 -14
  77. package/dist/index.mjs.map +1 -1
  78. package/dist/secure-input.d.mts +24 -0
  79. package/dist/secure-input.mjs +25 -0
  80. package/dist/secure-input.mjs.map +1 -0
  81. package/ios/HybridCloudKitStore.swift +159 -0
  82. package/ios/HybridSecureInputView.swift +35 -0
  83. package/ios/cloud/CloudKitEnvelopeStore.swift +179 -0
  84. package/kernel/generated/kernel-entry.js +51913 -20526
  85. package/kernel/generated/kernel.manifest.json +17 -7
  86. package/nitrogen/generated/android/WalletNative+autolinking.cmake +7 -1
  87. package/nitrogen/generated/android/WalletNativeOnLoad.cpp +37 -2
  88. package/nitrogen/generated/android/c++/JFunc_void_SecureInputState.hpp +77 -0
  89. package/nitrogen/generated/android/c++/JHybridGoogleDriveAuthSpec.cpp +82 -0
  90. package/nitrogen/generated/android/c++/JHybridGoogleDriveAuthSpec.hpp +64 -0
  91. package/nitrogen/generated/android/c++/JHybridSecureInputViewSpec.cpp +70 -0
  92. package/nitrogen/generated/android/c++/JHybridSecureInputViewSpec.hpp +64 -0
  93. package/nitrogen/generated/android/c++/JSecureInputState.hpp +64 -0
  94. package/nitrogen/generated/android/c++/views/JHybridSecureInputViewStateUpdater.cpp +74 -0
  95. package/nitrogen/generated/android/c++/views/JHybridSecureInputViewStateUpdater.hpp +54 -0
  96. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/Func_void_SecureInputState.kt +78 -0
  97. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/HybridGoogleDriveAuthSpec.kt +61 -0
  98. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/HybridSecureInputViewSpec.kt +67 -0
  99. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/SecureInputState.kt +25 -0
  100. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/views/HybridSecureInputViewManager.kt +96 -0
  101. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/views/HybridSecureInputViewStateUpdater.kt +23 -0
  102. package/nitrogen/generated/ios/WalletNative-Swift-Cxx-Bridge.cpp +74 -1
  103. package/nitrogen/generated/ios/WalletNative-Swift-Cxx-Bridge.hpp +252 -3
  104. package/nitrogen/generated/ios/WalletNative-Swift-Cxx-Umbrella.hpp +21 -3
  105. package/nitrogen/generated/ios/WalletNativeAutolinking.mm +17 -1
  106. package/nitrogen/generated/ios/WalletNativeAutolinking.swift +22 -0
  107. package/nitrogen/generated/ios/c++/HybridCloudKitStoreSpecSwift.cpp +11 -0
  108. package/nitrogen/generated/ios/c++/HybridCloudKitStoreSpecSwift.hpp +116 -0
  109. package/nitrogen/generated/ios/c++/HybridSecureInputViewSpecSwift.cpp +11 -0
  110. package/nitrogen/generated/ios/c++/HybridSecureInputViewSpecSwift.hpp +83 -0
  111. package/nitrogen/generated/ios/c++/views/HybridSecureInputViewComponent.mm +144 -0
  112. package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
  113. package/nitrogen/generated/ios/swift/Func_void_SecureInputState.swift +46 -0
  114. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  115. package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +53 -0
  116. package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +46 -0
  117. package/nitrogen/generated/ios/swift/HybridCloudKitStoreSpec.swift +59 -0
  118. package/nitrogen/generated/ios/swift/HybridCloudKitStoreSpec_cxx.swift +230 -0
  119. package/nitrogen/generated/ios/swift/HybridSecureInputViewSpec.swift +55 -0
  120. package/nitrogen/generated/ios/swift/HybridSecureInputViewSpec_cxx.swift +164 -0
  121. package/nitrogen/generated/ios/swift/SecureInputState.swift +48 -0
  122. package/nitrogen/generated/shared/c++/HybridCloudKitStoreSpec.cpp +25 -0
  123. package/nitrogen/generated/shared/c++/HybridCloudKitStoreSpec.hpp +70 -0
  124. package/nitrogen/generated/shared/c++/HybridGoogleDriveAuthSpec.cpp +22 -0
  125. package/nitrogen/generated/shared/c++/HybridGoogleDriveAuthSpec.hpp +64 -0
  126. package/nitrogen/generated/shared/c++/HybridKernelHostSpec.cpp +1 -0
  127. package/nitrogen/generated/shared/c++/HybridKernelHostSpec.hpp +1 -0
  128. package/nitrogen/generated/shared/c++/HybridSecureInputViewSpec.cpp +22 -0
  129. package/nitrogen/generated/shared/c++/HybridSecureInputViewSpec.hpp +65 -0
  130. package/nitrogen/generated/shared/c++/SecureInputState.hpp +84 -0
  131. package/nitrogen/generated/shared/c++/views/HybridSecureInputViewComponent.cpp +34 -0
  132. package/nitrogen/generated/shared/c++/views/HybridSecureInputViewComponent.hpp +85 -0
  133. package/nitrogen/generated/shared/json/SecureInputViewConfig.json +10 -0
  134. package/package.json +24 -6
  135. package/scripts/compile-kernel.mjs +7 -3
@@ -8,13 +8,32 @@
8
8
  #pragma once
9
9
 
10
10
  // Forward declarations of C++ defined types
11
-
11
+ // Forward declaration of `HybridCloudKitStoreSpec` to properly resolve imports.
12
+ namespace margelo::nitro::qntxwallet { class HybridCloudKitStoreSpec; }
13
+ // Forward declaration of `HybridSecureInputViewSpec` to properly resolve imports.
14
+ namespace margelo::nitro::qntxwallet { class HybridSecureInputViewSpec; }
15
+ // Forward declaration of `SecureInputState` to properly resolve imports.
16
+ namespace margelo::nitro::qntxwallet { enum class SecureInputState; }
12
17
 
13
18
  // Forward declarations of Swift defined types
14
-
19
+ // Forward declaration of `HybridCloudKitStoreSpec_cxx` to properly resolve imports.
20
+ namespace WalletNative { class HybridCloudKitStoreSpec_cxx; }
21
+ // Forward declaration of `HybridSecureInputViewSpec_cxx` to properly resolve imports.
22
+ namespace WalletNative { class HybridSecureInputViewSpec_cxx; }
15
23
 
16
24
  // Include C++ defined types
17
-
25
+ #include "HybridCloudKitStoreSpec.hpp"
26
+ #include "HybridSecureInputViewSpec.hpp"
27
+ #include "SecureInputState.hpp"
28
+ #include <NitroModules/Promise.hpp>
29
+ #include <NitroModules/PromiseHolder.hpp>
30
+ #include <NitroModules/Result.hpp>
31
+ #include <exception>
32
+ #include <functional>
33
+ #include <memory>
34
+ #include <optional>
35
+ #include <string>
36
+ #include <vector>
18
37
 
19
38
  /**
20
39
  * Contains specialized versions of C++ templated types so they can be accessed from Swift,
@@ -22,6 +41,236 @@
22
41
  */
23
42
  namespace margelo::nitro::qntxwallet::bridge::swift {
24
43
 
44
+ // pragma MARK: std::vector<std::string>
45
+ /**
46
+ * Specialized version of `std::vector<std::string>`.
47
+ */
48
+ using std__vector_std__string_ = std::vector<std::string>;
49
+ inline std::vector<std::string> create_std__vector_std__string_(size_t size) noexcept {
50
+ std::vector<std::string> vector;
51
+ vector.reserve(size);
52
+ return vector;
53
+ }
54
+
55
+ // pragma MARK: std::shared_ptr<Promise<std::vector<std::string>>>
56
+ /**
57
+ * Specialized version of `std::shared_ptr<Promise<std::vector<std::string>>>`.
58
+ */
59
+ using std__shared_ptr_Promise_std__vector_std__string___ = std::shared_ptr<Promise<std::vector<std::string>>>;
60
+ inline std::shared_ptr<Promise<std::vector<std::string>>> create_std__shared_ptr_Promise_std__vector_std__string___() noexcept {
61
+ return Promise<std::vector<std::string>>::create();
62
+ }
63
+ 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 {
64
+ return PromiseHolder<std::vector<std::string>>(std::move(promise));
65
+ }
66
+
67
+ // pragma MARK: std::function<void(const std::vector<std::string>& /* result */)>
68
+ /**
69
+ * Specialized version of `std::function<void(const std::vector<std::string>&)>`.
70
+ */
71
+ using Func_void_std__vector_std__string_ = std::function<void(const std::vector<std::string>& /* result */)>;
72
+ /**
73
+ * Wrapper class for a `std::function<void(const std::vector<std::string>& / * result * /)>`, this can be used from Swift.
74
+ */
75
+ class Func_void_std__vector_std__string__Wrapper final {
76
+ public:
77
+ 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))) {}
78
+ inline void call(std::vector<std::string> result) const noexcept {
79
+ _function->operator()(result);
80
+ }
81
+ private:
82
+ std::unique_ptr<std::function<void(const std::vector<std::string>& /* result */)>> _function;
83
+ } SWIFT_NONCOPYABLE;
84
+ Func_void_std__vector_std__string_ create_Func_void_std__vector_std__string_(void* NON_NULL swiftClosureWrapper) noexcept;
85
+ inline Func_void_std__vector_std__string__Wrapper wrap_Func_void_std__vector_std__string_(Func_void_std__vector_std__string_ value) noexcept {
86
+ return Func_void_std__vector_std__string__Wrapper(std::move(value));
87
+ }
88
+
89
+ // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
90
+ /**
91
+ * Specialized version of `std::function<void(const std::exception_ptr&)>`.
92
+ */
93
+ using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
94
+ /**
95
+ * Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
96
+ */
97
+ class Func_void_std__exception_ptr_Wrapper final {
98
+ public:
99
+ 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))) {}
100
+ inline void call(std::exception_ptr error) const noexcept {
101
+ _function->operator()(error);
102
+ }
103
+ private:
104
+ std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
105
+ } SWIFT_NONCOPYABLE;
106
+ Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
107
+ inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
108
+ return Func_void_std__exception_ptr_Wrapper(std::move(value));
109
+ }
110
+
111
+ // pragma MARK: std::optional<std::string>
112
+ /**
113
+ * Specialized version of `std::optional<std::string>`.
114
+ */
115
+ using std__optional_std__string_ = std::optional<std::string>;
116
+ inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
117
+ return std::optional<std::string>(value);
118
+ }
119
+ inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
120
+ return optional.has_value();
121
+ }
122
+ inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
123
+ return optional.value();
124
+ }
125
+
126
+ // pragma MARK: std::shared_ptr<Promise<std::optional<std::string>>>
127
+ /**
128
+ * Specialized version of `std::shared_ptr<Promise<std::optional<std::string>>>`.
129
+ */
130
+ using std__shared_ptr_Promise_std__optional_std__string___ = std::shared_ptr<Promise<std::optional<std::string>>>;
131
+ inline std::shared_ptr<Promise<std::optional<std::string>>> create_std__shared_ptr_Promise_std__optional_std__string___() noexcept {
132
+ return Promise<std::optional<std::string>>::create();
133
+ }
134
+ inline PromiseHolder<std::optional<std::string>> wrap_std__shared_ptr_Promise_std__optional_std__string___(std::shared_ptr<Promise<std::optional<std::string>>> promise) noexcept {
135
+ return PromiseHolder<std::optional<std::string>>(std::move(promise));
136
+ }
137
+
138
+ // pragma MARK: std::function<void(const std::optional<std::string>& /* result */)>
139
+ /**
140
+ * Specialized version of `std::function<void(const std::optional<std::string>&)>`.
141
+ */
142
+ using Func_void_std__optional_std__string_ = std::function<void(const std::optional<std::string>& /* result */)>;
143
+ /**
144
+ * Wrapper class for a `std::function<void(const std::optional<std::string>& / * result * /)>`, this can be used from Swift.
145
+ */
146
+ class Func_void_std__optional_std__string__Wrapper final {
147
+ public:
148
+ explicit Func_void_std__optional_std__string__Wrapper(std::function<void(const std::optional<std::string>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::optional<std::string>& /* result */)>>(std::move(func))) {}
149
+ inline void call(std::optional<std::string> result) const noexcept {
150
+ _function->operator()(result);
151
+ }
152
+ private:
153
+ std::unique_ptr<std::function<void(const std::optional<std::string>& /* result */)>> _function;
154
+ } SWIFT_NONCOPYABLE;
155
+ Func_void_std__optional_std__string_ create_Func_void_std__optional_std__string_(void* NON_NULL swiftClosureWrapper) noexcept;
156
+ inline Func_void_std__optional_std__string__Wrapper wrap_Func_void_std__optional_std__string_(Func_void_std__optional_std__string_ value) noexcept {
157
+ return Func_void_std__optional_std__string__Wrapper(std::move(value));
158
+ }
159
+
160
+ // pragma MARK: std::shared_ptr<Promise<void>>
161
+ /**
162
+ * Specialized version of `std::shared_ptr<Promise<void>>`.
163
+ */
164
+ using std__shared_ptr_Promise_void__ = std::shared_ptr<Promise<void>>;
165
+ inline std::shared_ptr<Promise<void>> create_std__shared_ptr_Promise_void__() noexcept {
166
+ return Promise<void>::create();
167
+ }
168
+ inline PromiseHolder<void> wrap_std__shared_ptr_Promise_void__(std::shared_ptr<Promise<void>> promise) noexcept {
169
+ return PromiseHolder<void>(std::move(promise));
170
+ }
171
+
172
+ // pragma MARK: std::function<void()>
173
+ /**
174
+ * Specialized version of `std::function<void()>`.
175
+ */
176
+ using Func_void = std::function<void()>;
177
+ /**
178
+ * Wrapper class for a `std::function<void()>`, this can be used from Swift.
179
+ */
180
+ class Func_void_Wrapper final {
181
+ public:
182
+ explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
183
+ inline void call() const noexcept {
184
+ _function->operator()();
185
+ }
186
+ private:
187
+ std::unique_ptr<std::function<void()>> _function;
188
+ } SWIFT_NONCOPYABLE;
189
+ Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
190
+ inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
191
+ return Func_void_Wrapper(std::move(value));
192
+ }
193
+
194
+ // pragma MARK: std::shared_ptr<HybridCloudKitStoreSpec>
195
+ /**
196
+ * Specialized version of `std::shared_ptr<HybridCloudKitStoreSpec>`.
197
+ */
198
+ using std__shared_ptr_HybridCloudKitStoreSpec_ = std::shared_ptr<HybridCloudKitStoreSpec>;
199
+ std::shared_ptr<HybridCloudKitStoreSpec> create_std__shared_ptr_HybridCloudKitStoreSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
200
+ void* NON_NULL get_std__shared_ptr_HybridCloudKitStoreSpec_(std__shared_ptr_HybridCloudKitStoreSpec_ cppType);
201
+
202
+ // pragma MARK: std::weak_ptr<HybridCloudKitStoreSpec>
203
+ using std__weak_ptr_HybridCloudKitStoreSpec_ = std::weak_ptr<HybridCloudKitStoreSpec>;
204
+ inline std__weak_ptr_HybridCloudKitStoreSpec_ weakify_std__shared_ptr_HybridCloudKitStoreSpec_(const std::shared_ptr<HybridCloudKitStoreSpec>& strong) noexcept { return strong; }
205
+
206
+ // pragma MARK: Result<std::shared_ptr<Promise<std::vector<std::string>>>>
207
+ using Result_std__shared_ptr_Promise_std__vector_std__string____ = Result<std::shared_ptr<Promise<std::vector<std::string>>>>;
208
+ 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 {
209
+ return Result<std::shared_ptr<Promise<std::vector<std::string>>>>::withValue(value);
210
+ }
211
+ 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 {
212
+ return Result<std::shared_ptr<Promise<std::vector<std::string>>>>::withError(error);
213
+ }
214
+
215
+ // pragma MARK: Result<std::shared_ptr<Promise<std::optional<std::string>>>>
216
+ using Result_std__shared_ptr_Promise_std__optional_std__string____ = Result<std::shared_ptr<Promise<std::optional<std::string>>>>;
217
+ inline Result_std__shared_ptr_Promise_std__optional_std__string____ create_Result_std__shared_ptr_Promise_std__optional_std__string____(const std::shared_ptr<Promise<std::optional<std::string>>>& value) noexcept {
218
+ return Result<std::shared_ptr<Promise<std::optional<std::string>>>>::withValue(value);
219
+ }
220
+ inline Result_std__shared_ptr_Promise_std__optional_std__string____ create_Result_std__shared_ptr_Promise_std__optional_std__string____(const std::exception_ptr& error) noexcept {
221
+ return Result<std::shared_ptr<Promise<std::optional<std::string>>>>::withError(error);
222
+ }
223
+
224
+ // pragma MARK: Result<std::shared_ptr<Promise<void>>>
225
+ using Result_std__shared_ptr_Promise_void___ = Result<std::shared_ptr<Promise<void>>>;
226
+ inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::shared_ptr<Promise<void>>& value) noexcept {
227
+ return Result<std::shared_ptr<Promise<void>>>::withValue(value);
228
+ }
229
+ inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::exception_ptr& error) noexcept {
230
+ return Result<std::shared_ptr<Promise<void>>>::withError(error);
231
+ }
232
+
233
+ // pragma MARK: Result<void>
234
+ using Result_void_ = Result<void>;
235
+ inline Result_void_ create_Result_void_() noexcept {
236
+ return Result<void>::withValue();
237
+ }
238
+ inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
239
+ return Result<void>::withError(error);
240
+ }
241
+
242
+ // pragma MARK: std::function<void(SecureInputState /* state */)>
243
+ /**
244
+ * Specialized version of `std::function<void(SecureInputState)>`.
245
+ */
246
+ using Func_void_SecureInputState = std::function<void(SecureInputState /* state */)>;
247
+ /**
248
+ * Wrapper class for a `std::function<void(SecureInputState / * state * /)>`, this can be used from Swift.
249
+ */
250
+ class Func_void_SecureInputState_Wrapper final {
251
+ public:
252
+ explicit Func_void_SecureInputState_Wrapper(std::function<void(SecureInputState /* state */)>&& func): _function(std::make_unique<std::function<void(SecureInputState /* state */)>>(std::move(func))) {}
253
+ inline void call(int state) const noexcept {
254
+ _function->operator()(static_cast<SecureInputState>(state));
255
+ }
256
+ private:
257
+ std::unique_ptr<std::function<void(SecureInputState /* state */)>> _function;
258
+ } SWIFT_NONCOPYABLE;
259
+ Func_void_SecureInputState create_Func_void_SecureInputState(void* NON_NULL swiftClosureWrapper) noexcept;
260
+ inline Func_void_SecureInputState_Wrapper wrap_Func_void_SecureInputState(Func_void_SecureInputState value) noexcept {
261
+ return Func_void_SecureInputState_Wrapper(std::move(value));
262
+ }
263
+
264
+ // pragma MARK: std::shared_ptr<HybridSecureInputViewSpec>
265
+ /**
266
+ * Specialized version of `std::shared_ptr<HybridSecureInputViewSpec>`.
267
+ */
268
+ using std__shared_ptr_HybridSecureInputViewSpec_ = std::shared_ptr<HybridSecureInputViewSpec>;
269
+ std::shared_ptr<HybridSecureInputViewSpec> create_std__shared_ptr_HybridSecureInputViewSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
270
+ void* NON_NULL get_std__shared_ptr_HybridSecureInputViewSpec_(std__shared_ptr_HybridSecureInputViewSpec_ cppType);
25
271
 
272
+ // pragma MARK: std::weak_ptr<HybridSecureInputViewSpec>
273
+ using std__weak_ptr_HybridSecureInputViewSpec_ = std::weak_ptr<HybridSecureInputViewSpec>;
274
+ inline std__weak_ptr_HybridSecureInputViewSpec_ weakify_std__shared_ptr_HybridSecureInputViewSpec_(const std::shared_ptr<HybridSecureInputViewSpec>& strong) noexcept { return strong; }
26
275
 
27
276
  } // namespace margelo::nitro::qntxwallet::bridge::swift
@@ -8,10 +8,25 @@
8
8
  #pragma once
9
9
 
10
10
  // Forward declarations of C++ defined types
11
-
11
+ // Forward declaration of `HybridCloudKitStoreSpec` to properly resolve imports.
12
+ namespace margelo::nitro::qntxwallet { class HybridCloudKitStoreSpec; }
13
+ // Forward declaration of `HybridSecureInputViewSpec` to properly resolve imports.
14
+ namespace margelo::nitro::qntxwallet { class HybridSecureInputViewSpec; }
15
+ // Forward declaration of `SecureInputState` to properly resolve imports.
16
+ namespace margelo::nitro::qntxwallet { enum class SecureInputState; }
12
17
 
13
18
  // Include C++ defined types
14
-
19
+ #include "HybridCloudKitStoreSpec.hpp"
20
+ #include "HybridSecureInputViewSpec.hpp"
21
+ #include "SecureInputState.hpp"
22
+ #include <NitroModules/Promise.hpp>
23
+ #include <NitroModules/Result.hpp>
24
+ #include <exception>
25
+ #include <functional>
26
+ #include <memory>
27
+ #include <optional>
28
+ #include <string>
29
+ #include <vector>
15
30
 
16
31
  // C++ helpers for Swift
17
32
  #include "WalletNative-Swift-Cxx-Bridge.hpp"
@@ -23,7 +38,10 @@
23
38
  #include <NitroModules/DateToChronoDate.hpp>
24
39
 
25
40
  // Forward declarations of Swift defined types
26
-
41
+ // Forward declaration of `HybridCloudKitStoreSpec_cxx` to properly resolve imports.
42
+ namespace WalletNative { class HybridCloudKitStoreSpec_cxx; }
43
+ // Forward declaration of `HybridSecureInputViewSpec_cxx` to properly resolve imports.
44
+ namespace WalletNative { class HybridSecureInputViewSpec_cxx; }
27
45
 
28
46
  // Include Swift defined types
29
47
  #if __has_include("WalletNative-Swift.h")
@@ -7,10 +7,12 @@
7
7
 
8
8
  #import <Foundation/Foundation.h>
9
9
  #import <NitroModules/HybridObjectRegistry.hpp>
10
-
10
+ #import "WalletNative-Swift-Cxx-Umbrella.hpp"
11
11
  #import <type_traits>
12
12
 
13
13
  #include "HybridKernelHost.hpp"
14
+ #include "HybridSecureInputViewSpecSwift.hpp"
15
+ #include "HybridCloudKitStoreSpecSwift.hpp"
14
16
 
15
17
  @interface WalletNativeAutolinking : NSObject
16
18
  @end
@@ -30,6 +32,20 @@
30
32
  return std::make_shared<HybridKernelHost>();
31
33
  }
32
34
  );
35
+ HybridObjectRegistry::registerHybridObjectConstructor(
36
+ "SecureInputView",
37
+ []() -> std::shared_ptr<HybridObject> {
38
+ std::shared_ptr<HybridSecureInputViewSpec> hybridObject = WalletNative::WalletNativeAutolinking::createSecureInputView();
39
+ return hybridObject;
40
+ }
41
+ );
42
+ HybridObjectRegistry::registerHybridObjectConstructor(
43
+ "CloudKitStore",
44
+ []() -> std::shared_ptr<HybridObject> {
45
+ std::shared_ptr<HybridCloudKitStoreSpec> hybridObject = WalletNative::WalletNativeAutolinking::createCloudKitStore();
46
+ return hybridObject;
47
+ }
48
+ );
33
49
  }
34
50
 
35
51
  @end
@@ -12,5 +12,27 @@ import NitroModules
12
12
  public final class WalletNativeAutolinking {
13
13
  public typealias bridge = margelo.nitro.qntxwallet.bridge.swift
14
14
 
15
+ public static func createSecureInputView() -> bridge.std__shared_ptr_HybridSecureInputViewSpec_ {
16
+ let hybridObject = HybridSecureInputView()
17
+ return { () -> bridge.std__shared_ptr_HybridSecureInputViewSpec_ in
18
+ let __cxxWrapped = hybridObject.getCxxWrapper()
19
+ return __cxxWrapped.getCxxPart()
20
+ }()
21
+ }
15
22
 
23
+ public static func isSecureInputViewRecyclable() -> Bool {
24
+ return HybridSecureInputView.self is any RecyclableView.Type
25
+ }
26
+
27
+ public static func createCloudKitStore() -> bridge.std__shared_ptr_HybridCloudKitStoreSpec_ {
28
+ let hybridObject = HybridCloudKitStore()
29
+ return { () -> bridge.std__shared_ptr_HybridCloudKitStoreSpec_ in
30
+ let __cxxWrapped = hybridObject.getCxxWrapper()
31
+ return __cxxWrapped.getCxxPart()
32
+ }()
33
+ }
34
+
35
+ public static func isCloudKitStoreRecyclable() -> Bool {
36
+ return HybridCloudKitStore.self is any RecyclableView.Type
37
+ }
16
38
  }
@@ -0,0 +1,11 @@
1
+ ///
2
+ /// HybridCloudKitStoreSpecSwift.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 "HybridCloudKitStoreSpecSwift.hpp"
9
+
10
+ namespace margelo::nitro::qntxwallet {
11
+ } // namespace margelo::nitro::qntxwallet
@@ -0,0 +1,116 @@
1
+ ///
2
+ /// HybridCloudKitStoreSpecSwift.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 "HybridCloudKitStoreSpec.hpp"
11
+
12
+ // Forward declaration of `HybridCloudKitStoreSpec_cxx` to properly resolve imports.
13
+ namespace WalletNative { class HybridCloudKitStoreSpec_cxx; }
14
+
15
+
16
+
17
+ #include <string>
18
+ #include <vector>
19
+ #include <NitroModules/Promise.hpp>
20
+ #include <optional>
21
+ #include <functional>
22
+
23
+ #include "WalletNative-Swift-Cxx-Umbrella.hpp"
24
+
25
+ namespace margelo::nitro::qntxwallet {
26
+
27
+ /**
28
+ * The C++ part of HybridCloudKitStoreSpec_cxx.swift.
29
+ *
30
+ * HybridCloudKitStoreSpecSwift (C++) accesses HybridCloudKitStoreSpec_cxx (Swift), and might
31
+ * contain some additional bridging code for C++ <> Swift interop.
32
+ *
33
+ * Since this obviously introduces an overhead, I hope at some point in
34
+ * the future, HybridCloudKitStoreSpec_cxx can directly inherit from the C++ class HybridCloudKitStoreSpec
35
+ * to simplify the whole structure and memory management.
36
+ */
37
+ class HybridCloudKitStoreSpecSwift: public virtual HybridCloudKitStoreSpec {
38
+ public:
39
+ // Constructor from a Swift instance
40
+ explicit HybridCloudKitStoreSpecSwift(const WalletNative::HybridCloudKitStoreSpec_cxx& swiftPart):
41
+ HybridObject(HybridCloudKitStoreSpec::TAG),
42
+ _swiftPart(swiftPart) { }
43
+
44
+ public:
45
+ // Get the Swift part
46
+ inline WalletNative::HybridCloudKitStoreSpec_cxx& getSwiftPart() noexcept {
47
+ return _swiftPart;
48
+ }
49
+
50
+ public:
51
+ inline size_t getExternalMemorySize() noexcept override {
52
+ return _swiftPart.getMemorySize();
53
+ }
54
+ bool equals(const std::shared_ptr<HybridObject>& other) override {
55
+ if (auto otherCast = std::dynamic_pointer_cast<HybridCloudKitStoreSpecSwift>(other)) {
56
+ return _swiftPart.equals(otherCast->_swiftPart);
57
+ }
58
+ return false;
59
+ }
60
+ void dispose() noexcept override {
61
+ _swiftPart.dispose();
62
+ }
63
+ std::string toString() override {
64
+ return _swiftPart.toString();
65
+ }
66
+
67
+ public:
68
+ // Properties
69
+
70
+
71
+ public:
72
+ // Methods
73
+ inline std::shared_ptr<Promise<std::vector<std::string>>> list(const std::string& container) override {
74
+ auto __result = _swiftPart.list(container);
75
+ if (__result.hasError()) [[unlikely]] {
76
+ std::rethrow_exception(__result.error());
77
+ }
78
+ auto __value = std::move(__result.value());
79
+ return __value;
80
+ }
81
+ inline std::shared_ptr<Promise<std::optional<std::string>>> read(const std::string& container, const std::string& name) override {
82
+ auto __result = _swiftPart.read(container, name);
83
+ if (__result.hasError()) [[unlikely]] {
84
+ std::rethrow_exception(__result.error());
85
+ }
86
+ auto __value = std::move(__result.value());
87
+ return __value;
88
+ }
89
+ inline std::shared_ptr<Promise<void>> write(const std::string& container, const std::string& name, const std::string& text) override {
90
+ auto __result = _swiftPart.write(container, name, text);
91
+ if (__result.hasError()) [[unlikely]] {
92
+ std::rethrow_exception(__result.error());
93
+ }
94
+ auto __value = std::move(__result.value());
95
+ return __value;
96
+ }
97
+ inline std::shared_ptr<Promise<void>> remove(const std::string& container, const std::string& name) override {
98
+ auto __result = _swiftPart.remove(container, name);
99
+ if (__result.hasError()) [[unlikely]] {
100
+ std::rethrow_exception(__result.error());
101
+ }
102
+ auto __value = std::move(__result.value());
103
+ return __value;
104
+ }
105
+ inline void setAccountListener(const std::function<void()>& listener) override {
106
+ auto __result = _swiftPart.setAccountListener(listener);
107
+ if (__result.hasError()) [[unlikely]] {
108
+ std::rethrow_exception(__result.error());
109
+ }
110
+ }
111
+
112
+ private:
113
+ WalletNative::HybridCloudKitStoreSpec_cxx _swiftPart;
114
+ };
115
+
116
+ } // namespace margelo::nitro::qntxwallet
@@ -0,0 +1,11 @@
1
+ ///
2
+ /// HybridSecureInputViewSpecSwift.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 "HybridSecureInputViewSpecSwift.hpp"
9
+
10
+ namespace margelo::nitro::qntxwallet {
11
+ } // namespace margelo::nitro::qntxwallet
@@ -0,0 +1,83 @@
1
+ ///
2
+ /// HybridSecureInputViewSpecSwift.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 "HybridSecureInputViewSpec.hpp"
11
+
12
+ // Forward declaration of `HybridSecureInputViewSpec_cxx` to properly resolve imports.
13
+ namespace WalletNative { class HybridSecureInputViewSpec_cxx; }
14
+
15
+ // Forward declaration of `SecureInputState` to properly resolve imports.
16
+ namespace margelo::nitro::qntxwallet { enum class SecureInputState; }
17
+
18
+ #include "SecureInputState.hpp"
19
+ #include <functional>
20
+
21
+ #include "WalletNative-Swift-Cxx-Umbrella.hpp"
22
+
23
+ namespace margelo::nitro::qntxwallet {
24
+
25
+ /**
26
+ * The C++ part of HybridSecureInputViewSpec_cxx.swift.
27
+ *
28
+ * HybridSecureInputViewSpecSwift (C++) accesses HybridSecureInputViewSpec_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, HybridSecureInputViewSpec_cxx can directly inherit from the C++ class HybridSecureInputViewSpec
33
+ * to simplify the whole structure and memory management.
34
+ */
35
+ class HybridSecureInputViewSpecSwift: public virtual HybridSecureInputViewSpec {
36
+ public:
37
+ // Constructor from a Swift instance
38
+ explicit HybridSecureInputViewSpecSwift(const WalletNative::HybridSecureInputViewSpec_cxx& swiftPart):
39
+ HybridObject(HybridSecureInputViewSpec::TAG),
40
+ _swiftPart(swiftPart) { }
41
+
42
+ public:
43
+ // Get the Swift part
44
+ inline WalletNative::HybridSecureInputViewSpec_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<HybridSecureInputViewSpecSwift>(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
+ inline std::function<void(SecureInputState /* state */)> getOnStateChange() noexcept override {
68
+ auto __result = _swiftPart.getOnStateChange();
69
+ return __result;
70
+ }
71
+ inline void setOnStateChange(const std::function<void(SecureInputState /* state */)>& onStateChange) noexcept override {
72
+ _swiftPart.setOnStateChange(onStateChange);
73
+ }
74
+
75
+ public:
76
+ // Methods
77
+
78
+
79
+ private:
80
+ WalletNative::HybridSecureInputViewSpec_cxx _swiftPart;
81
+ };
82
+
83
+ } // namespace margelo::nitro::qntxwallet