@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
@@ -0,0 +1,55 @@
1
+ ///
2
+ /// HybridSecureInputViewSpec.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
+ /// See ``HybridSecureInputViewSpec``
11
+ public protocol HybridSecureInputViewSpec_protocol: HybridObject, HybridView {
12
+ // Properties
13
+ var onStateChange: (_ state: SecureInputState) -> Void { get set }
14
+
15
+ // Methods
16
+
17
+ }
18
+
19
+ public extension HybridSecureInputViewSpec_protocol {
20
+ /// Default implementation of ``HybridObject.toString``
21
+ func toString() -> String {
22
+ return "[HybridObject SecureInputView]"
23
+ }
24
+ }
25
+
26
+ /// See ``HybridSecureInputViewSpec``
27
+ open class HybridSecureInputViewSpec_base {
28
+ private weak var cxxWrapper: HybridSecureInputViewSpec_cxx? = nil
29
+ public init() { }
30
+ public func getCxxWrapper() -> HybridSecureInputViewSpec_cxx {
31
+ #if DEBUG
32
+ guard self is any HybridSecureInputViewSpec else {
33
+ fatalError("`self` is not a `HybridSecureInputViewSpec`! Did you accidentally inherit from `HybridSecureInputViewSpec_base` instead of `HybridSecureInputViewSpec`?")
34
+ }
35
+ #endif
36
+ if let cxxWrapper = self.cxxWrapper {
37
+ return cxxWrapper
38
+ } else {
39
+ let cxxWrapper = HybridSecureInputViewSpec_cxx(self as! any HybridSecureInputViewSpec)
40
+ self.cxxWrapper = cxxWrapper
41
+ return cxxWrapper
42
+ }
43
+ }
44
+ }
45
+
46
+ /**
47
+ * A Swift base-protocol representing the SecureInputView HybridObject.
48
+ * Implement this protocol to create Swift-based instances of SecureInputView.
49
+ * ```swift
50
+ * class HybridSecureInputView : HybridSecureInputViewSpec {
51
+ * // ...
52
+ * }
53
+ * ```
54
+ */
55
+ public typealias HybridSecureInputViewSpec = HybridSecureInputViewSpec_protocol & HybridSecureInputViewSpec_base
@@ -0,0 +1,164 @@
1
+ ///
2
+ /// HybridSecureInputViewSpec_cxx.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
+ * A class implementation that bridges HybridSecureInputViewSpec over to C++.
12
+ * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
13
+ *
14
+ * Also, some Swift types need to be bridged with special handling:
15
+ * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
16
+ * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
17
+ * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
18
+ */
19
+ open class HybridSecureInputViewSpec_cxx {
20
+ /**
21
+ * The Swift <> C++ bridge's namespace (`margelo::nitro::qntxwallet::bridge::swift`)
22
+ * from `WalletNative-Swift-Cxx-Bridge.hpp`.
23
+ * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
24
+ */
25
+ public typealias bridge = margelo.nitro.qntxwallet.bridge.swift
26
+
27
+ /**
28
+ * Holds an instance of the `HybridSecureInputViewSpec` Swift protocol.
29
+ */
30
+ private var __implementation: any HybridSecureInputViewSpec
31
+
32
+ /**
33
+ * Holds a weak pointer to the C++ class that wraps the Swift class.
34
+ */
35
+ private var __cxxPart: bridge.std__weak_ptr_HybridSecureInputViewSpec_
36
+
37
+ /**
38
+ * Create a new `HybridSecureInputViewSpec_cxx` that wraps the given `HybridSecureInputViewSpec`.
39
+ * All properties and methods bridge to C++ types.
40
+ */
41
+ public init(_ implementation: any HybridSecureInputViewSpec) {
42
+ self.__implementation = implementation
43
+ self.__cxxPart = .init()
44
+ /* no base class */
45
+ }
46
+
47
+ /**
48
+ * Get the actual `HybridSecureInputViewSpec` instance this class wraps.
49
+ */
50
+ @inline(__always)
51
+ public func getHybridSecureInputViewSpec() -> any HybridSecureInputViewSpec {
52
+ return __implementation
53
+ }
54
+
55
+ /**
56
+ * Casts this instance to a retained unsafe raw pointer.
57
+ * This acquires one additional strong reference on the object!
58
+ */
59
+ public func toUnsafe() -> UnsafeMutableRawPointer {
60
+ return Unmanaged.passRetained(self).toOpaque()
61
+ }
62
+
63
+ /**
64
+ * Casts an unsafe pointer to a `HybridSecureInputViewSpec_cxx`.
65
+ * The pointer has to be a retained opaque `Unmanaged<HybridSecureInputViewSpec_cxx>`.
66
+ * This removes one strong reference from the object!
67
+ */
68
+ public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridSecureInputViewSpec_cxx {
69
+ return Unmanaged<HybridSecureInputViewSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
70
+ }
71
+
72
+ /**
73
+ * Gets (or creates) the C++ part of this Hybrid Object.
74
+ * The C++ part is a `std::shared_ptr<HybridSecureInputViewSpec>`.
75
+ */
76
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridSecureInputViewSpec_ {
77
+ let cachedCxxPart = self.__cxxPart.lock()
78
+ if Bool(fromCxx: cachedCxxPart) {
79
+ return cachedCxxPart
80
+ } else {
81
+ let newCxxPart = bridge.create_std__shared_ptr_HybridSecureInputViewSpec_(self.toUnsafe())
82
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridSecureInputViewSpec_(newCxxPart)
83
+ return newCxxPart
84
+ }
85
+ }
86
+
87
+
88
+
89
+ /**
90
+ * Get the memory size of the Swift class (plus size of any other allocations)
91
+ * so the JS VM can properly track it and garbage-collect the JS object if needed.
92
+ */
93
+ @inline(__always)
94
+ public var memorySize: Int {
95
+ return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
96
+ }
97
+
98
+ /**
99
+ * Compares this object with the given [other] object for reference equality.
100
+ */
101
+ @inline(__always)
102
+ public func equals(other: HybridSecureInputViewSpec_cxx) -> Bool {
103
+ return self.__implementation === other.__implementation
104
+ }
105
+
106
+ /**
107
+ * Call dispose() on the Swift class.
108
+ * This _may_ be called manually from JS.
109
+ */
110
+ @inline(__always)
111
+ public func dispose() {
112
+ self.__implementation.dispose()
113
+ }
114
+
115
+ /**
116
+ * Call toString() on the Swift class.
117
+ */
118
+ @inline(__always)
119
+ public func toString() -> String {
120
+ return self.__implementation.toString()
121
+ }
122
+
123
+ // Properties
124
+ public final var onStateChange: bridge.Func_void_SecureInputState {
125
+ @inline(__always)
126
+ get {
127
+ return { () -> bridge.Func_void_SecureInputState in
128
+ let __closureWrapper = Func_void_SecureInputState(self.__implementation.onStateChange)
129
+ return bridge.create_Func_void_SecureInputState(__closureWrapper.toUnsafe())
130
+ }()
131
+ }
132
+ @inline(__always)
133
+ set {
134
+ self.__implementation.onStateChange = { () -> (SecureInputState) -> Void in
135
+ let __wrappedFunction = bridge.wrap_Func_void_SecureInputState(newValue)
136
+ return { (__state: SecureInputState) -> Void in
137
+ __wrappedFunction.call(__state.rawValue)
138
+ }
139
+ }()
140
+ }
141
+ }
142
+
143
+ // Methods
144
+ public final func getView() -> UnsafeMutableRawPointer {
145
+ return Unmanaged.passRetained(__implementation.view).toOpaque()
146
+ }
147
+
148
+ public final func beforeUpdate() {
149
+ __implementation.beforeUpdate()
150
+ }
151
+
152
+ public final func afterUpdate() {
153
+ __implementation.afterUpdate()
154
+ }
155
+
156
+ public final func maybePrepareForRecycle() {
157
+ guard let recyclable = __implementation as? any RecyclableView else { return }
158
+ recyclable.prepareForRecycle()
159
+ }
160
+
161
+ public final func onDropView() {
162
+ __implementation.onDropView()
163
+ }
164
+ }
@@ -0,0 +1,48 @@
1
+ ///
2
+ /// SecureInputState.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
+ /**
9
+ * Represents the JS union `SecureInputState`, backed by a C++ enum.
10
+ */
11
+ public typealias SecureInputState = margelo.nitro.qntxwallet.SecureInputState
12
+
13
+ public extension SecureInputState {
14
+ /**
15
+ * Get a SecureInputState for the given String value, or
16
+ * return `nil` if the given value was invalid/unknown.
17
+ */
18
+ init?(fromString string: String) {
19
+ switch string {
20
+ case "idle":
21
+ self = .idle
22
+ case "empty":
23
+ self = .empty
24
+ case "filled":
25
+ self = .filled
26
+ case "submitted":
27
+ self = .submitted
28
+ default:
29
+ return nil
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Get the String value this SecureInputState represents.
35
+ */
36
+ var stringValue: String {
37
+ switch self {
38
+ case .idle:
39
+ return "idle"
40
+ case .empty:
41
+ return "empty"
42
+ case .filled:
43
+ return "filled"
44
+ case .submitted:
45
+ return "submitted"
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,25 @@
1
+ ///
2
+ /// HybridCloudKitStoreSpec.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 "HybridCloudKitStoreSpec.hpp"
9
+
10
+ namespace margelo::nitro::qntxwallet {
11
+
12
+ void HybridCloudKitStoreSpec::loadHybridMethods() {
13
+ // load base methods/properties
14
+ HybridObject::loadHybridMethods();
15
+ // load custom methods/properties
16
+ registerHybrids(this, [](Prototype& prototype) {
17
+ prototype.registerHybridMethod("list", &HybridCloudKitStoreSpec::list);
18
+ prototype.registerHybridMethod("read", &HybridCloudKitStoreSpec::read);
19
+ prototype.registerHybridMethod("write", &HybridCloudKitStoreSpec::write);
20
+ prototype.registerHybridMethod("remove", &HybridCloudKitStoreSpec::remove);
21
+ prototype.registerHybridMethod("setAccountListener", &HybridCloudKitStoreSpec::setAccountListener);
22
+ });
23
+ }
24
+
25
+ } // namespace margelo::nitro::qntxwallet
@@ -0,0 +1,70 @@
1
+ ///
2
+ /// HybridCloudKitStoreSpec.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
+ #if __has_include(<NitroModules/HybridObject.hpp>)
11
+ #include <NitroModules/HybridObject.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+
16
+
17
+
18
+ #include <string>
19
+ #include <vector>
20
+ #include <NitroModules/Promise.hpp>
21
+ #include <optional>
22
+ #include <functional>
23
+
24
+ namespace margelo::nitro::qntxwallet {
25
+
26
+ using namespace margelo::nitro;
27
+
28
+ /**
29
+ * An abstract base class for `CloudKitStore`
30
+ * Inherit this class to create instances of `HybridCloudKitStoreSpec` in C++.
31
+ * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
32
+ * @example
33
+ * ```cpp
34
+ * class HybridCloudKitStore: public HybridCloudKitStoreSpec {
35
+ * public:
36
+ * HybridCloudKitStore(...): HybridObject(TAG) { ... }
37
+ * // ...
38
+ * };
39
+ * ```
40
+ */
41
+ class HybridCloudKitStoreSpec: public virtual HybridObject {
42
+ public:
43
+ // Constructor
44
+ explicit HybridCloudKitStoreSpec(): HybridObject(TAG) { }
45
+
46
+ // Destructor
47
+ ~HybridCloudKitStoreSpec() override = default;
48
+
49
+ public:
50
+ // Properties
51
+
52
+
53
+ public:
54
+ // Methods
55
+ virtual std::shared_ptr<Promise<std::vector<std::string>>> list(const std::string& container) = 0;
56
+ virtual std::shared_ptr<Promise<std::optional<std::string>>> read(const std::string& container, const std::string& name) = 0;
57
+ virtual std::shared_ptr<Promise<void>> write(const std::string& container, const std::string& name, const std::string& text) = 0;
58
+ virtual std::shared_ptr<Promise<void>> remove(const std::string& container, const std::string& name) = 0;
59
+ virtual void setAccountListener(const std::function<void()>& listener) = 0;
60
+
61
+ protected:
62
+ // Hybrid Setup
63
+ void loadHybridMethods() override;
64
+
65
+ protected:
66
+ // Tag for logging
67
+ static constexpr auto TAG = "CloudKitStore";
68
+ };
69
+
70
+ } // namespace margelo::nitro::qntxwallet
@@ -0,0 +1,22 @@
1
+ ///
2
+ /// HybridGoogleDriveAuthSpec.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 "HybridGoogleDriveAuthSpec.hpp"
9
+
10
+ namespace margelo::nitro::qntxwallet {
11
+
12
+ void HybridGoogleDriveAuthSpec::loadHybridMethods() {
13
+ // load base methods/properties
14
+ HybridObject::loadHybridMethods();
15
+ // load custom methods/properties
16
+ registerHybrids(this, [](Prototype& prototype) {
17
+ prototype.registerHybridMethod("accessToken", &HybridGoogleDriveAuthSpec::accessToken);
18
+ prototype.registerHybridMethod("clearToken", &HybridGoogleDriveAuthSpec::clearToken);
19
+ });
20
+ }
21
+
22
+ } // namespace margelo::nitro::qntxwallet
@@ -0,0 +1,64 @@
1
+ ///
2
+ /// HybridGoogleDriveAuthSpec.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
+ #if __has_include(<NitroModules/HybridObject.hpp>)
11
+ #include <NitroModules/HybridObject.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+
16
+
17
+
18
+ #include <string>
19
+ #include <NitroModules/Promise.hpp>
20
+
21
+ namespace margelo::nitro::qntxwallet {
22
+
23
+ using namespace margelo::nitro;
24
+
25
+ /**
26
+ * An abstract base class for `GoogleDriveAuth`
27
+ * Inherit this class to create instances of `HybridGoogleDriveAuthSpec` in C++.
28
+ * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
29
+ * @example
30
+ * ```cpp
31
+ * class HybridGoogleDriveAuth: public HybridGoogleDriveAuthSpec {
32
+ * public:
33
+ * HybridGoogleDriveAuth(...): HybridObject(TAG) { ... }
34
+ * // ...
35
+ * };
36
+ * ```
37
+ */
38
+ class HybridGoogleDriveAuthSpec: public virtual HybridObject {
39
+ public:
40
+ // Constructor
41
+ explicit HybridGoogleDriveAuthSpec(): HybridObject(TAG) { }
42
+
43
+ // Destructor
44
+ ~HybridGoogleDriveAuthSpec() override = default;
45
+
46
+ public:
47
+ // Properties
48
+
49
+
50
+ public:
51
+ // Methods
52
+ virtual std::shared_ptr<Promise<std::string>> accessToken(bool interactive) = 0;
53
+ virtual std::shared_ptr<Promise<void>> clearToken(const std::string& token) = 0;
54
+
55
+ protected:
56
+ // Hybrid Setup
57
+ void loadHybridMethods() override;
58
+
59
+ protected:
60
+ // Tag for logging
61
+ static constexpr auto TAG = "GoogleDriveAuth";
62
+ };
63
+
64
+ } // namespace margelo::nitro::qntxwallet
@@ -18,6 +18,7 @@ namespace margelo::nitro::qntxwallet {
18
18
  prototype.registerHybridMethod("post", &HybridKernelHostSpec::post);
19
19
  prototype.registerHybridMethod("onMessage", &HybridKernelHostSpec::onMessage);
20
20
  prototype.registerHybridMethod("onExit", &HybridKernelHostSpec::onExit);
21
+ prototype.registerHybridMethod("setBackgroundLock", &HybridKernelHostSpec::setBackgroundLock);
21
22
  prototype.registerHybridMethod("lock", &HybridKernelHostSpec::lock);
22
23
  });
23
24
  }
@@ -55,6 +55,7 @@ namespace margelo::nitro::qntxwallet {
55
55
  virtual void post(const std::shared_ptr<ArrayBuffer>& frame) = 0;
56
56
  virtual void onMessage(const std::function<void(const std::shared_ptr<ArrayBuffer>& /* frame */)>& listener) = 0;
57
57
  virtual void onExit(const std::function<void(KernelExitReason /* reason */)>& listener) = 0;
58
+ virtual void setBackgroundLock(double backgroundLockSeconds) = 0;
58
59
  virtual void lock() = 0;
59
60
 
60
61
  protected:
@@ -0,0 +1,22 @@
1
+ ///
2
+ /// HybridSecureInputViewSpec.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 "HybridSecureInputViewSpec.hpp"
9
+
10
+ namespace margelo::nitro::qntxwallet {
11
+
12
+ void HybridSecureInputViewSpec::loadHybridMethods() {
13
+ // load base methods/properties
14
+ HybridObject::loadHybridMethods();
15
+ // load custom methods/properties
16
+ registerHybrids(this, [](Prototype& prototype) {
17
+ prototype.registerHybridGetter("onStateChange", &HybridSecureInputViewSpec::getOnStateChange);
18
+ prototype.registerHybridSetter("onStateChange", &HybridSecureInputViewSpec::setOnStateChange);
19
+ });
20
+ }
21
+
22
+ } // namespace margelo::nitro::qntxwallet
@@ -0,0 +1,65 @@
1
+ ///
2
+ /// HybridSecureInputViewSpec.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
+ #if __has_include(<NitroModules/HybridObject.hpp>)
11
+ #include <NitroModules/HybridObject.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+
16
+ // Forward declaration of `SecureInputState` to properly resolve imports.
17
+ namespace margelo::nitro::qntxwallet { enum class SecureInputState; }
18
+
19
+ #include "SecureInputState.hpp"
20
+ #include <functional>
21
+
22
+ namespace margelo::nitro::qntxwallet {
23
+
24
+ using namespace margelo::nitro;
25
+
26
+ /**
27
+ * An abstract base class for `SecureInputView`
28
+ * Inherit this class to create instances of `HybridSecureInputViewSpec` in C++.
29
+ * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
30
+ * @example
31
+ * ```cpp
32
+ * class HybridSecureInputView: public HybridSecureInputViewSpec {
33
+ * public:
34
+ * HybridSecureInputView(...): HybridObject(TAG) { ... }
35
+ * // ...
36
+ * };
37
+ * ```
38
+ */
39
+ class HybridSecureInputViewSpec: public virtual HybridObject {
40
+ public:
41
+ // Constructor
42
+ explicit HybridSecureInputViewSpec(): HybridObject(TAG) { }
43
+
44
+ // Destructor
45
+ ~HybridSecureInputViewSpec() override = default;
46
+
47
+ public:
48
+ // Properties
49
+ virtual std::function<void(SecureInputState /* state */)> getOnStateChange() = 0;
50
+ virtual void setOnStateChange(const std::function<void(SecureInputState /* state */)>& onStateChange) = 0;
51
+
52
+ public:
53
+ // Methods
54
+
55
+
56
+ protected:
57
+ // Hybrid Setup
58
+ void loadHybridMethods() override;
59
+
60
+ protected:
61
+ // Tag for logging
62
+ static constexpr auto TAG = "SecureInputView";
63
+ };
64
+
65
+ } // namespace margelo::nitro::qntxwallet
@@ -0,0 +1,84 @@
1
+ ///
2
+ /// SecureInputState.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
+ #if __has_include(<NitroModules/NitroHash.hpp>)
11
+ #include <NitroModules/NitroHash.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
16
+ #include <NitroModules/JSIConverter.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
21
+ #include <NitroModules/NitroDefines.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+
26
+ namespace margelo::nitro::qntxwallet {
27
+
28
+ /**
29
+ * An enum which can be represented as a JavaScript union (SecureInputState).
30
+ */
31
+ enum class SecureInputState {
32
+ IDLE SWIFT_NAME(idle) = 0,
33
+ EMPTY SWIFT_NAME(empty) = 1,
34
+ FILLED SWIFT_NAME(filled) = 2,
35
+ SUBMITTED SWIFT_NAME(submitted) = 3,
36
+ } CLOSED_ENUM;
37
+
38
+ } // namespace margelo::nitro::qntxwallet
39
+
40
+ namespace margelo::nitro {
41
+
42
+ // C++ SecureInputState <> JS SecureInputState (union)
43
+ template <>
44
+ struct JSIConverter<margelo::nitro::qntxwallet::SecureInputState> final {
45
+ static inline margelo::nitro::qntxwallet::SecureInputState fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
46
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
47
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
48
+ case hashString("idle"): return margelo::nitro::qntxwallet::SecureInputState::IDLE;
49
+ case hashString("empty"): return margelo::nitro::qntxwallet::SecureInputState::EMPTY;
50
+ case hashString("filled"): return margelo::nitro::qntxwallet::SecureInputState::FILLED;
51
+ case hashString("submitted"): return margelo::nitro::qntxwallet::SecureInputState::SUBMITTED;
52
+ default: [[unlikely]]
53
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum SecureInputState - invalid value!");
54
+ }
55
+ }
56
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::qntxwallet::SecureInputState arg) {
57
+ switch (arg) {
58
+ case margelo::nitro::qntxwallet::SecureInputState::IDLE: return JSIConverter<std::string>::toJSI(runtime, "idle");
59
+ case margelo::nitro::qntxwallet::SecureInputState::EMPTY: return JSIConverter<std::string>::toJSI(runtime, "empty");
60
+ case margelo::nitro::qntxwallet::SecureInputState::FILLED: return JSIConverter<std::string>::toJSI(runtime, "filled");
61
+ case margelo::nitro::qntxwallet::SecureInputState::SUBMITTED: return JSIConverter<std::string>::toJSI(runtime, "submitted");
62
+ default: [[unlikely]]
63
+ throw std::invalid_argument("Cannot convert SecureInputState to JS - invalid value: "
64
+ + std::to_string(static_cast<int>(arg)) + "!");
65
+ }
66
+ }
67
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
68
+ if (!value.isString()) {
69
+ return false;
70
+ }
71
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
72
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
73
+ case hashString("idle"):
74
+ case hashString("empty"):
75
+ case hashString("filled"):
76
+ case hashString("submitted"):
77
+ return true;
78
+ default:
79
+ return false;
80
+ }
81
+ }
82
+ };
83
+
84
+ } // namespace margelo::nitro
@@ -0,0 +1,34 @@
1
+ ///
2
+ /// HybridSecureInputViewComponent.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 "HybridSecureInputViewComponent.hpp"
9
+
10
+ #include <NitroModules/NitroHash.hpp>
11
+ #include <NitroModules/ReactProp.hpp>
12
+
13
+ namespace margelo::nitro::qntxwallet::views {
14
+
15
+ using namespace facebook;
16
+
17
+ extern const char HybridSecureInputViewComponentName[] = "SecureInputView";
18
+
19
+ HybridSecureInputViewProps::HybridSecureInputViewProps(const react::PropsParserContext& context,
20
+ const HybridSecureInputViewProps& sourceProps,
21
+ const react::RawProps& rawProps):
22
+ react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
23
+ onStateChange(nitro::ReactProp<std::function<void(SecureInputState /* state */)>>::fromRawValue("SecureInputView", "onStateChange", rawProps, sourceProps.onStateChange)),
24
+ hybridRef(nitro::ReactProp<std::optional<std::function<void(const std::shared_ptr<HybridSecureInputViewSpec>& /* ref */)>>>::fromRawValue("SecureInputView", "hybridRef", rawProps, sourceProps.hybridRef)) { }
25
+
26
+ bool HybridSecureInputViewProps::filterObjectKeys(const std::string& propName) {
27
+ switch (hashString(propName)) {
28
+ case hashString("onStateChange"): return true;
29
+ case hashString("hybridRef"): return true;
30
+ default: return false;
31
+ }
32
+ }
33
+
34
+ } // namespace margelo::nitro::qntxwallet::views