@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.
- package/README.md +184 -31
- package/WalletNative.podspec +11 -2
- package/android/CMakeLists.txt +7 -1
- package/android/build.gradle +4 -0
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/cpp/cpp-adapter.cpp +9 -0
- package/android/src/main/java/com/margelo/nitro/qntxwallet/CardReader.kt +316 -0
- package/android/src/main/java/com/margelo/nitro/qntxwallet/HybridGoogleDriveAuth.kt +142 -0
- package/android/src/main/java/com/margelo/nitro/qntxwallet/HybridSecureInputView.kt +25 -0
- package/android/src/main/java/com/margelo/nitro/qntxwallet/Keystore.kt +148 -9
- package/android/src/main/java/com/margelo/nitro/qntxwallet/SecureInputField.kt +422 -0
- package/android/src/main/java/com/margelo/nitro/qntxwallet/VaultAnchor.kt +90 -0
- package/android/src/main/java/com/margelo/nitro/qntxwallet/WalletNativePackage.java +10 -0
- package/cpp/host/CardReader.hpp +70 -0
- package/cpp/host/HybridKernelHost.cpp +90 -15
- package/cpp/host/HybridKernelHost.hpp +21 -5
- package/cpp/host/KernelFile.cpp +79 -15
- package/cpp/host/KernelFile.hpp +17 -6
- package/cpp/host/KernelSlot.hpp +103 -0
- package/cpp/host/Keystore.hpp +35 -11
- package/cpp/host/Lifecycle.cpp +11 -0
- package/cpp/host/Lifecycle.hpp +3 -0
- package/cpp/host/Passkey.hpp +8 -0
- package/cpp/host/SecureInput.cpp +233 -0
- package/cpp/host/SecureInput.hpp +103 -0
- package/cpp/host/VaultAnchor.cpp +39 -0
- package/cpp/host/VaultAnchor.hpp +28 -0
- package/cpp/host/VaultDirectory.hpp +1 -1
- package/cpp/platform/CardReaderAndroid.cpp +146 -0
- package/cpp/platform/CardReaderIos.mm +318 -0
- package/cpp/platform/KeystoreAndroid.cpp +48 -1
- package/cpp/platform/KeystoreIos.mm +109 -19
- package/cpp/platform/PasskeyAndroid.cpp +2 -0
- package/cpp/platform/PasskeyIos.mm +20 -18
- package/cpp/platform/QntxSecureInputField.h +24 -0
- package/cpp/platform/SecureInputAndroid.cpp +110 -0
- package/cpp/platform/SecureInputIos.mm +282 -0
- package/cpp/platform/VaultAnchorAndroid.cpp +76 -0
- package/cpp/platform/VaultAnchorIos.mm +76 -0
- package/cpp/runtime/KernelBackends.cpp +35 -28
- package/cpp/runtime/KernelBuffer.hpp +2 -5
- package/cpp/runtime/KernelCardReader.cpp +385 -0
- package/cpp/runtime/KernelCardReader.hpp +27 -0
- package/cpp/runtime/KernelGlobals.cpp +176 -63
- package/cpp/runtime/KernelGlobals.hpp +13 -7
- package/cpp/runtime/KernelJs.cpp +14 -0
- package/cpp/runtime/KernelJs.hpp +4 -0
- package/cpp/runtime/KernelKeystore.cpp +78 -2
- package/cpp/runtime/KernelKeystore.hpp +1 -0
- package/cpp/runtime/KernelPasskey.cpp +15 -12
- package/cpp/runtime/KernelRuntime.cpp +24 -7
- package/cpp/runtime/KernelRuntime.hpp +14 -6
- package/cpp/runtime/KernelSecureInput.cpp +154 -0
- package/cpp/runtime/KernelSecureInput.hpp +25 -0
- package/cpp/runtime/platform/KernelArgon2.cpp +34 -0
- package/cpp/runtime/platform/KernelArgon2.hpp +23 -0
- package/cpp/vendor/argon2/LICENSE +314 -0
- package/cpp/vendor/argon2/README.md +20 -0
- package/cpp/vendor/argon2/include/argon2.h +437 -0
- package/cpp/vendor/argon2/src/argon2.c +452 -0
- package/cpp/vendor/argon2/src/blake2/blake2-impl.h +156 -0
- package/cpp/vendor/argon2/src/blake2/blake2.h +89 -0
- package/cpp/vendor/argon2/src/blake2/blake2b.c +390 -0
- package/cpp/vendor/argon2/src/blake2/blamka-round-ref.h +56 -0
- package/cpp/vendor/argon2/src/core.c +648 -0
- package/cpp/vendor/argon2/src/core.h +228 -0
- package/cpp/vendor/argon2/src/encoding.c +463 -0
- package/cpp/vendor/argon2/src/encoding.h +57 -0
- package/cpp/vendor/argon2/src/ref.c +194 -0
- package/cpp/vendor/argon2/src/thread.c +57 -0
- package/cpp/vendor/argon2/src/thread.h +67 -0
- package/dist/cloud.d.mts +58 -0
- package/dist/cloud.mjs +114 -0
- package/dist/cloud.mjs.map +1 -0
- package/dist/index.d.mts +13 -4
- package/dist/index.mjs +89 -14
- package/dist/index.mjs.map +1 -1
- package/dist/secure-input.d.mts +24 -0
- package/dist/secure-input.mjs +25 -0
- package/dist/secure-input.mjs.map +1 -0
- package/ios/HybridCloudKitStore.swift +159 -0
- package/ios/HybridSecureInputView.swift +35 -0
- package/ios/cloud/CloudKitEnvelopeStore.swift +179 -0
- package/kernel/generated/kernel-entry.js +51913 -20526
- package/kernel/generated/kernel.manifest.json +17 -7
- package/nitrogen/generated/android/WalletNative+autolinking.cmake +7 -1
- package/nitrogen/generated/android/WalletNativeOnLoad.cpp +37 -2
- package/nitrogen/generated/android/c++/JFunc_void_SecureInputState.hpp +77 -0
- package/nitrogen/generated/android/c++/JHybridGoogleDriveAuthSpec.cpp +82 -0
- package/nitrogen/generated/android/c++/JHybridGoogleDriveAuthSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JHybridSecureInputViewSpec.cpp +70 -0
- package/nitrogen/generated/android/c++/JHybridSecureInputViewSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JSecureInputState.hpp +64 -0
- package/nitrogen/generated/android/c++/views/JHybridSecureInputViewStateUpdater.cpp +74 -0
- package/nitrogen/generated/android/c++/views/JHybridSecureInputViewStateUpdater.hpp +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/Func_void_SecureInputState.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/HybridGoogleDriveAuthSpec.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/HybridSecureInputViewSpec.kt +67 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/SecureInputState.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/views/HybridSecureInputViewManager.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/views/HybridSecureInputViewStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/WalletNative-Swift-Cxx-Bridge.cpp +74 -1
- package/nitrogen/generated/ios/WalletNative-Swift-Cxx-Bridge.hpp +252 -3
- package/nitrogen/generated/ios/WalletNative-Swift-Cxx-Umbrella.hpp +21 -3
- package/nitrogen/generated/ios/WalletNativeAutolinking.mm +17 -1
- package/nitrogen/generated/ios/WalletNativeAutolinking.swift +22 -0
- package/nitrogen/generated/ios/c++/HybridCloudKitStoreSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCloudKitStoreSpecSwift.hpp +116 -0
- package/nitrogen/generated/ios/c++/HybridSecureInputViewSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridSecureInputViewSpecSwift.hpp +83 -0
- package/nitrogen/generated/ios/c++/views/HybridSecureInputViewComponent.mm +144 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_SecureInputState.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +53 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridCloudKitStoreSpec.swift +59 -0
- package/nitrogen/generated/ios/swift/HybridCloudKitStoreSpec_cxx.swift +230 -0
- package/nitrogen/generated/ios/swift/HybridSecureInputViewSpec.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridSecureInputViewSpec_cxx.swift +164 -0
- package/nitrogen/generated/ios/swift/SecureInputState.swift +48 -0
- package/nitrogen/generated/shared/c++/HybridCloudKitStoreSpec.cpp +25 -0
- package/nitrogen/generated/shared/c++/HybridCloudKitStoreSpec.hpp +70 -0
- package/nitrogen/generated/shared/c++/HybridGoogleDriveAuthSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridGoogleDriveAuthSpec.hpp +64 -0
- package/nitrogen/generated/shared/c++/HybridKernelHostSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridKernelHostSpec.hpp +1 -0
- package/nitrogen/generated/shared/c++/HybridSecureInputViewSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridSecureInputViewSpec.hpp +65 -0
- package/nitrogen/generated/shared/c++/SecureInputState.hpp +84 -0
- package/nitrogen/generated/shared/c++/views/HybridSecureInputViewComponent.cpp +34 -0
- package/nitrogen/generated/shared/c++/views/HybridSecureInputViewComponent.hpp +85 -0
- package/nitrogen/generated/shared/json/SecureInputViewConfig.json +10 -0
- package/package.json +24 -6
- package/scripts/compile-kernel.mjs +7 -3
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridSecureInputViewStateUpdater.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
|
+
#ifndef RN_SERIALIZABLE_STATE
|
|
11
|
+
#error WalletNative was compiled without the 'RN_SERIALIZABLE_STATE' flag. This flag is required for Nitro Views - set it in your CMakeLists!
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#include <fbjni/fbjni.h>
|
|
15
|
+
#include <react/fabric/CoreComponentsRegistry.h>
|
|
16
|
+
#include <react/fabric/StateWrapperImpl.h>
|
|
17
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
18
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
19
|
+
#include <NitroModules/JStateWrapper.hpp>
|
|
20
|
+
#include "JHybridSecureInputViewSpec.hpp"
|
|
21
|
+
#include "views/HybridSecureInputViewComponent.hpp"
|
|
22
|
+
|
|
23
|
+
namespace margelo::nitro::qntxwallet::views {
|
|
24
|
+
|
|
25
|
+
using namespace facebook;
|
|
26
|
+
|
|
27
|
+
class JHybridSecureInputViewStateUpdater final: public jni::JavaClass<JHybridSecureInputViewStateUpdater> {
|
|
28
|
+
public:
|
|
29
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/qntxwallet/views/HybridSecureInputViewStateUpdater;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
static void updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
33
|
+
jni::alias_ref<JHybridSecureInputViewSpec::JavaPart> view,
|
|
34
|
+
jni::alias_ref<JStateWrapper::javaobject> newState,
|
|
35
|
+
jni::alias_ref<JStateWrapper::javaobject> oldState);
|
|
36
|
+
|
|
37
|
+
private:
|
|
38
|
+
static std::shared_ptr<const HybridSecureInputViewProps> getPropsFromStateWrapper(
|
|
39
|
+
jni::alias_ref<JStateWrapper::javaobject> stateWrapper);
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
static void registerNatives() {
|
|
43
|
+
// Register JNI calls
|
|
44
|
+
javaClassStatic()->registerNatives({
|
|
45
|
+
makeNativeMethod("updateViewProps", JHybridSecureInputViewStateUpdater::updateViewProps),
|
|
46
|
+
});
|
|
47
|
+
// Register React Native view component descriptor
|
|
48
|
+
auto provider = react::concreteComponentDescriptorProvider<HybridSecureInputViewComponentDescriptor>();
|
|
49
|
+
auto providerRegistry = react::CoreComponentsRegistry::sharedProviderRegistry();
|
|
50
|
+
providerRegistry->add(provider);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::qntxwallet::views
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/Func_void_SecureInputState.kt
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_SecureInputState.kt
|
|
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
|
+
package com.margelo.nitro.qntxwallet
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript callback `(state: enum) => void`.
|
|
17
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
+
fun interface Func_void_SecureInputState: (SecureInputState) -> Unit {
|
|
24
|
+
/**
|
|
25
|
+
* Call the given JS callback.
|
|
26
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
override fun invoke(state: SecureInputState): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `(state: enum) => void`.
|
|
35
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
36
|
+
* The callback might be coming from JS.
|
|
37
|
+
*/
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
@Suppress(
|
|
41
|
+
"KotlinJniMissingFunction", "unused",
|
|
42
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
|
+
)
|
|
45
|
+
class Func_void_SecureInputState_cxx: Func_void_SecureInputState {
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
private val mHybridData: HybridData
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
private constructor(hybridData: HybridData) {
|
|
53
|
+
mHybridData = hybridData
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
override fun invoke(state: SecureInputState): Unit
|
|
59
|
+
= invoke_cxx(state)
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(state: SecureInputState): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `(state: enum) => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(SecureInputState) -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_SecureInputState_java(private val function: (SecureInputState) -> Unit): Func_void_SecureInputState {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(state: SecureInputState): Unit {
|
|
76
|
+
return this.function(state)
|
|
77
|
+
}
|
|
78
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/HybridGoogleDriveAuthSpec.kt
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridGoogleDriveAuthSpec.kt
|
|
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
|
+
package com.margelo.nitro.qntxwallet
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
import com.margelo.nitro.core.Promise
|
|
15
|
+
import com.margelo.nitro.core.HybridObject
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A Kotlin class representing the GoogleDriveAuth HybridObject.
|
|
19
|
+
* Implement this abstract class to create Kotlin-based instances of GoogleDriveAuth.
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress(
|
|
24
|
+
"KotlinJniMissingFunction", "unused",
|
|
25
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
26
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
27
|
+
)
|
|
28
|
+
abstract class HybridGoogleDriveAuthSpec: HybridObject() {
|
|
29
|
+
// Properties
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// Methods
|
|
33
|
+
@DoNotStrip
|
|
34
|
+
@Keep
|
|
35
|
+
abstract fun accessToken(interactive: Boolean): Promise<String>
|
|
36
|
+
|
|
37
|
+
@DoNotStrip
|
|
38
|
+
@Keep
|
|
39
|
+
abstract fun clearToken(token: String): Promise<Unit>
|
|
40
|
+
|
|
41
|
+
// Default implementation of `HybridObject.toString()`
|
|
42
|
+
override fun toString(): String {
|
|
43
|
+
return "[HybridObject GoogleDriveAuth]"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// C++ backing class
|
|
47
|
+
@DoNotStrip
|
|
48
|
+
@Keep
|
|
49
|
+
protected open class CxxPart(javaPart: HybridGoogleDriveAuthSpec): HybridObject.CxxPart(javaPart) {
|
|
50
|
+
// C++ JHybridGoogleDriveAuthSpec::CxxPart::initHybrid(...)
|
|
51
|
+
@FastNative
|
|
52
|
+
external override fun initHybrid(): HybridData
|
|
53
|
+
}
|
|
54
|
+
override fun createCxxPart(): CxxPart {
|
|
55
|
+
return CxxPart(this)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
companion object {
|
|
59
|
+
protected const val TAG = "HybridGoogleDriveAuthSpec"
|
|
60
|
+
}
|
|
61
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/HybridSecureInputViewSpec.kt
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSecureInputViewSpec.kt
|
|
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
|
+
package com.margelo.nitro.qntxwallet
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
import com.margelo.nitro.core.HybridObject
|
|
15
|
+
import com.margelo.nitro.views.HybridView
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A Kotlin class representing the SecureInputView HybridObject.
|
|
19
|
+
* Implement this abstract class to create Kotlin-based instances of SecureInputView.
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress(
|
|
24
|
+
"KotlinJniMissingFunction", "unused",
|
|
25
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
26
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
27
|
+
)
|
|
28
|
+
abstract class HybridSecureInputViewSpec: HybridView() {
|
|
29
|
+
// Properties
|
|
30
|
+
abstract var onStateChange: (state: SecureInputState) -> Unit
|
|
31
|
+
|
|
32
|
+
private var onStateChange_cxx: Func_void_SecureInputState
|
|
33
|
+
@Keep
|
|
34
|
+
@DoNotStrip
|
|
35
|
+
get() {
|
|
36
|
+
return Func_void_SecureInputState_java(onStateChange)
|
|
37
|
+
}
|
|
38
|
+
@Keep
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
set(value) {
|
|
41
|
+
onStateChange = value
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Methods
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
// Default implementation of `HybridObject.toString()`
|
|
48
|
+
override fun toString(): String {
|
|
49
|
+
return "[HybridObject SecureInputView]"
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// C++ backing class
|
|
53
|
+
@DoNotStrip
|
|
54
|
+
@Keep
|
|
55
|
+
protected open class CxxPart(javaPart: HybridSecureInputViewSpec): HybridObject.CxxPart(javaPart) {
|
|
56
|
+
// C++ JHybridSecureInputViewSpec::CxxPart::initHybrid(...)
|
|
57
|
+
@FastNative
|
|
58
|
+
external override fun initHybrid(): HybridData
|
|
59
|
+
}
|
|
60
|
+
override fun createCxxPart(): CxxPart {
|
|
61
|
+
return CxxPart(this)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
companion object {
|
|
65
|
+
protected const val TAG = "HybridSecureInputViewSpec"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// SecureInputState.kt
|
|
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
|
+
package com.margelo.nitro.qntxwallet
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "SecureInputState".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class SecureInputState(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
IDLE(0),
|
|
20
|
+
EMPTY(1),
|
|
21
|
+
FILLED(2),
|
|
22
|
+
SUBMITTED(3);
|
|
23
|
+
|
|
24
|
+
companion object
|
|
25
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSecureInputViewManager.kt
|
|
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
|
+
package com.margelo.nitro.qntxwallet.views
|
|
9
|
+
|
|
10
|
+
import android.view.View
|
|
11
|
+
import com.facebook.react.uimanager.ReactStylesDiffMap
|
|
12
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
13
|
+
import com.facebook.react.uimanager.StateWrapper
|
|
14
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
15
|
+
import com.margelo.nitro.R.id.associated_hybrid_view_tag
|
|
16
|
+
import com.margelo.nitro.views.RecyclableView
|
|
17
|
+
import com.margelo.nitro.qntxwallet.*
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Represents the React Native `ViewManager` for the "SecureInputView" Nitro HybridView.
|
|
21
|
+
*/
|
|
22
|
+
public class HybridSecureInputViewManager: SimpleViewManager<View>() {
|
|
23
|
+
/**
|
|
24
|
+
* Represents the View and its last state snapshot (mutable)
|
|
25
|
+
*/
|
|
26
|
+
private class HybridViewHolder(
|
|
27
|
+
val hybridView: HybridSecureInputView,
|
|
28
|
+
var lastState: StateWrapper? = null,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
init {
|
|
32
|
+
if (RecyclableView::class.java.isAssignableFrom(HybridSecureInputView::class.java)) {
|
|
33
|
+
// Enable view recycling
|
|
34
|
+
super.setupViewRecycling()
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
override fun getName(): String {
|
|
39
|
+
return "SecureInputView"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
override fun createViewInstance(reactContext: ThemedReactContext): View {
|
|
43
|
+
val hybridView = HybridSecureInputView(reactContext)
|
|
44
|
+
val view = hybridView.view
|
|
45
|
+
view.setTag(associated_hybrid_view_tag, HybridViewHolder(hybridView))
|
|
46
|
+
return view
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
override fun updateState(view: View, props: ReactStylesDiffMap, stateWrapper: StateWrapper): Any? {
|
|
50
|
+
val holder = getHybridViewHolder(view)
|
|
51
|
+
?: throw Error("Couldn't find view $view in local views table!")
|
|
52
|
+
val hybridView = holder.hybridView
|
|
53
|
+
val oldState = holder.lastState
|
|
54
|
+
val newState = stateWrapper
|
|
55
|
+
|
|
56
|
+
// 1. Update each prop individually
|
|
57
|
+
hybridView.beforeUpdate()
|
|
58
|
+
HybridSecureInputViewStateUpdater.updateViewProps(hybridView, newState, oldState)
|
|
59
|
+
hybridView.afterUpdate()
|
|
60
|
+
holder.lastState = newState
|
|
61
|
+
|
|
62
|
+
// 2. Continue in base View props
|
|
63
|
+
return super.updateState(view, props, newState)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
override fun onDropViewInstance(view: View) {
|
|
67
|
+
val holder = getHybridViewHolder(view)
|
|
68
|
+
holder?.lastState = null
|
|
69
|
+
holder?.hybridView?.onDropView()
|
|
70
|
+
return super.onDropViewInstance(view)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
protected override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? {
|
|
74
|
+
val preparedView = super.prepareToRecycleView(reactContext, view)
|
|
75
|
+
?: return null
|
|
76
|
+
val holder = getHybridViewHolder(preparedView)
|
|
77
|
+
?: return null
|
|
78
|
+
val hybridView = holder.hybridView
|
|
79
|
+
holder.lastState = null
|
|
80
|
+
|
|
81
|
+
@Suppress("USELESS_IS_CHECK")
|
|
82
|
+
if (hybridView is RecyclableView) {
|
|
83
|
+
// Recycle in it's implementation
|
|
84
|
+
hybridView.prepareForRecycle()
|
|
85
|
+
|
|
86
|
+
// Maybe update the view if it changed
|
|
87
|
+
return hybridView.view
|
|
88
|
+
} else {
|
|
89
|
+
return null
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private fun getHybridViewHolder(view: View): HybridViewHolder? {
|
|
94
|
+
return view.getTag(associated_hybrid_view_tag) as? HybridViewHolder
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSecureInputViewStateUpdater.kt
|
|
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
|
+
package com.margelo.nitro.qntxwallet.views
|
|
9
|
+
|
|
10
|
+
import com.facebook.react.uimanager.StateWrapper
|
|
11
|
+
import com.margelo.nitro.qntxwallet.*
|
|
12
|
+
|
|
13
|
+
internal class HybridSecureInputViewStateUpdater {
|
|
14
|
+
companion object {
|
|
15
|
+
/**
|
|
16
|
+
* Updates the props for [view] through C++.
|
|
17
|
+
* The [newState] prop is expected to contain [view]'s props as wrapped Fabric state.
|
|
18
|
+
*/
|
|
19
|
+
@Suppress("KotlinJniMissingFunction")
|
|
20
|
+
@JvmStatic
|
|
21
|
+
external fun updateViewProps(view: HybridSecureInputViewSpec, newState: StateWrapper, oldState: StateWrapper?)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -8,10 +8,83 @@
|
|
|
8
8
|
#include "WalletNative-Swift-Cxx-Bridge.hpp"
|
|
9
9
|
|
|
10
10
|
// Include C++ implementation defined types
|
|
11
|
-
|
|
11
|
+
#include "HybridCloudKitStoreSpecSwift.hpp"
|
|
12
|
+
#include "HybridSecureInputViewSpecSwift.hpp"
|
|
13
|
+
#include "WalletNative-Swift-Cxx-Umbrella.hpp"
|
|
14
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
12
15
|
|
|
13
16
|
namespace margelo::nitro::qntxwallet::bridge::swift {
|
|
14
17
|
|
|
18
|
+
// pragma MARK: std::function<void(const std::vector<std::string>& /* result */)>
|
|
19
|
+
Func_void_std__vector_std__string_ create_Func_void_std__vector_std__string_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
20
|
+
auto swiftClosure = WalletNative::Func_void_std__vector_std__string_::fromUnsafe(swiftClosureWrapper);
|
|
21
|
+
return [swiftClosure = std::move(swiftClosure)](const std::vector<std::string>& result) mutable -> void {
|
|
22
|
+
swiftClosure.call(result);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
27
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
28
|
+
auto swiftClosure = WalletNative::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
|
|
29
|
+
return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
|
|
30
|
+
swiftClosure.call(error);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// pragma MARK: std::function<void(const std::optional<std::string>& /* result */)>
|
|
35
|
+
Func_void_std__optional_std__string_ create_Func_void_std__optional_std__string_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
36
|
+
auto swiftClosure = WalletNative::Func_void_std__optional_std__string_::fromUnsafe(swiftClosureWrapper);
|
|
37
|
+
return [swiftClosure = std::move(swiftClosure)](const std::optional<std::string>& result) mutable -> void {
|
|
38
|
+
swiftClosure.call(result);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// pragma MARK: std::function<void()>
|
|
43
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
44
|
+
auto swiftClosure = WalletNative::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
45
|
+
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
46
|
+
swiftClosure.call();
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// pragma MARK: std::shared_ptr<HybridCloudKitStoreSpec>
|
|
51
|
+
std::shared_ptr<HybridCloudKitStoreSpec> create_std__shared_ptr_HybridCloudKitStoreSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
52
|
+
WalletNative::HybridCloudKitStoreSpec_cxx swiftPart = WalletNative::HybridCloudKitStoreSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
53
|
+
return std::make_shared<margelo::nitro::qntxwallet::HybridCloudKitStoreSpecSwift>(swiftPart);
|
|
54
|
+
}
|
|
55
|
+
void* NON_NULL get_std__shared_ptr_HybridCloudKitStoreSpec_(std__shared_ptr_HybridCloudKitStoreSpec_ cppType) {
|
|
56
|
+
std::shared_ptr<margelo::nitro::qntxwallet::HybridCloudKitStoreSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::qntxwallet::HybridCloudKitStoreSpecSwift>(cppType);
|
|
57
|
+
#ifdef NITRO_DEBUG
|
|
58
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
59
|
+
throw std::runtime_error("Class \"HybridCloudKitStoreSpec\" is not implemented in Swift!");
|
|
60
|
+
}
|
|
61
|
+
#endif
|
|
62
|
+
WalletNative::HybridCloudKitStoreSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
63
|
+
return swiftPart.toUnsafe();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// pragma MARK: std::function<void(SecureInputState /* state */)>
|
|
67
|
+
Func_void_SecureInputState create_Func_void_SecureInputState(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
68
|
+
auto swiftClosure = WalletNative::Func_void_SecureInputState::fromUnsafe(swiftClosureWrapper);
|
|
69
|
+
return [swiftClosure = std::move(swiftClosure)](SecureInputState state) mutable -> void {
|
|
70
|
+
swiftClosure.call(static_cast<int>(state));
|
|
71
|
+
};
|
|
72
|
+
}
|
|
15
73
|
|
|
74
|
+
// pragma MARK: std::shared_ptr<HybridSecureInputViewSpec>
|
|
75
|
+
std::shared_ptr<HybridSecureInputViewSpec> create_std__shared_ptr_HybridSecureInputViewSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
76
|
+
WalletNative::HybridSecureInputViewSpec_cxx swiftPart = WalletNative::HybridSecureInputViewSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
77
|
+
return std::make_shared<margelo::nitro::qntxwallet::HybridSecureInputViewSpecSwift>(swiftPart);
|
|
78
|
+
}
|
|
79
|
+
void* NON_NULL get_std__shared_ptr_HybridSecureInputViewSpec_(std__shared_ptr_HybridSecureInputViewSpec_ cppType) {
|
|
80
|
+
std::shared_ptr<margelo::nitro::qntxwallet::HybridSecureInputViewSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::qntxwallet::HybridSecureInputViewSpecSwift>(cppType);
|
|
81
|
+
#ifdef NITRO_DEBUG
|
|
82
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
83
|
+
throw std::runtime_error("Class \"HybridSecureInputViewSpec\" is not implemented in Swift!");
|
|
84
|
+
}
|
|
85
|
+
#endif
|
|
86
|
+
WalletNative::HybridSecureInputViewSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
87
|
+
return swiftPart.toUnsafe();
|
|
88
|
+
}
|
|
16
89
|
|
|
17
90
|
} // namespace margelo::nitro::qntxwallet::bridge::swift
|