@procivis/react-native-one-core 1.26999.0 → 1.41710.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 +71 -40
- package/android/build.gradle +46 -10
- package/android/build.gradle_opensource +121 -0
- package/android/libs/core-reactnative-compatible-2025.0305.1.aar +0 -0
- package/android/src/main/AndroidManifest.xml +5 -2
- package/android/src/main/java/ch/procivis/one/core/Deserialize.kt +10 -6
- package/android/src/main/java/ch/procivis/one/core/DeserializeSpecific.kt +13 -5
- package/android/src/main/java/ch/procivis/one/core/ProcivisOneCoreModule.kt +251 -79
- package/android/src/main/java/ch/procivis/one/core/ProcivisOneCorePackage.kt +3 -4
- package/android/src/main/java/ch/procivis/one/core/SerializeSpecific.kt +13 -1
- package/android/src/main/java/ch/procivis/one/core/Util.kt +42 -10
- package/android/src/main/java/ch/procivis/one/core/ubiqu/PinPadRunner.kt +123 -0
- package/android/src/main/java/ch/procivis/one/core/ubiqu/PinPadViewManager.kt +23 -0
- package/android/src/main/java/ch/procivis/one/core/ubiqu/PinPadViewManager.kt_opensource +20 -0
- package/android/src/main/java/ch/procivis/one/core/ubiqu/PinPadWrapper.kt +396 -0
- package/android/src/main/java/ch/procivis/one/core/ubiqu/RegistrationManager.kt +59 -0
- package/android/src/main/java/ch/procivis/one/core/ubiqu/TokenManager.kt +48 -0
- package/android/src/main/java/ch/procivis/one/core/ubiqu/UbiquKeyStorage.kt +256 -0
- package/android/src/main/java/ch/procivis/one/core/ubiqu/UbiquKeyStorage.kt_opensource +51 -0
- package/android/src/main/java/ch/procivis/one/core/ubiqu/Util.kt +74 -0
- package/android/src/main/java/ch/procivis/one/core/ubiqu/dataformats/CreateIdentityRequest.kt +9 -0
- package/android/src/main/java/ch/procivis/one/core/ubiqu/dataformats/CreateIdentityResponse.kt +9 -0
- package/android/src/main/java/ch/procivis/one/core/ubiqu/dataformats/RegisterRSEResponse.kt +10 -0
- package/core-sdk.json +6 -6
- package/dist/index.d.ts +10 -8
- package/dist/index.js +31 -25
- package/dist/src/cache.d.ts +8 -0
- package/dist/src/cache.js +9 -0
- package/dist/src/config.d.ts +39 -6
- package/dist/src/config.js +19 -0
- package/dist/src/core.d.ts +24 -8
- package/dist/src/core.js +68 -0
- package/dist/src/credential.d.ts +15 -1
- package/dist/src/credential.js +5 -0
- package/dist/src/credentialSchema.d.ts +5 -2
- package/dist/src/credentialSchema.js +2 -0
- package/dist/src/did.d.ts +9 -5
- package/dist/src/error.d.ts +10 -17
- package/dist/src/error.js +5 -14
- package/dist/src/history.d.ts +19 -5
- package/dist/src/history.js +10 -2
- package/dist/src/key.d.ts +3 -0
- package/dist/src/organisation.d.ts +8 -0
- package/dist/src/organisation.js +1 -0
- package/dist/src/proof.d.ts +29 -2
- package/dist/src/proof.js +13 -0
- package/dist/src/proofSchema.d.ts +2 -0
- package/dist/src/trust.d.ts +85 -19
- package/dist/src/trust.js +28 -7
- package/dist/src/ubiqu.d.ts +49 -0
- package/dist/src/ubiqu.js +69 -0
- package/ios/Deserialize.swift +203 -24
- package/ios/EventEmitter.swift +79 -0
- package/ios/ProcivisOneCoreModule.m +74 -6
- package/ios/ProcivisOneCoreModule.swift +312 -88
- package/ios/ProcivisRNOneCore.xcodeproj/project.pbxproj +28 -26
- package/ios/RSEKeyStorage.swift +587 -0
- package/ios/RSEKeyStorage.swift_opensource +49 -0
- package/ios/RSEPinPad.swift +74 -0
- package/ios/RSEPinPad.swift_opensource +21 -0
- package/ios/RSEPinPadManager.m +19 -0
- package/ios/Serialize.swift +105 -28
- package/ios/UBQKit.xcframework/Info.plist +44 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Assets.car +0 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFCompatibilityMacros.h +37 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFHTTPSessionManager.h +304 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFNetworkReachabilityManager.h +216 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFNetworking.h +41 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFPlainTextRequestSerializer.h +16 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFSecurityPolicy.h +156 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFURLRequestSerialization.h +479 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFURLResponseSerialization.h +310 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFURLSessionManager.h +501 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/CardRequestProtocol.h +72 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/Constants.h +222 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/DeviceBindProtocol.h +38 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/DomainSecurityModule.h +43 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/ErrorDomains.h +68 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/FreeAssetProtocol.h +40 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/GDataXMLNode.h +214 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/NSDictionary+Utilities.h +23 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/NSFileManager+Utilities.h +20 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/NSString+Utilities.h +23 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/NSURL+Utilities.h +12 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/ProtocolBase.h +38 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/ResetPinProtocol.h +45 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/Settings.h +120 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequest.h +58 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestBaseProcessor.h +37 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestBindProcessor.h +34 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestNullProcessor.h +28 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestResetPinProcessor.h +35 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestUnlockProcessor.h +31 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestUseProcessor.h +34 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQKit-Swift.h +761 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQKit.h +56 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQPacket.h +38 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Info.plist +0 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios.abi.json +89006 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios.private.swiftinterface +1099 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios.swiftinterface +1099 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Modules/module.modulemap +11 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/UBQKit +0 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/_CodeSignature/CodeResources +597 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/certs +0 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/checksums +0 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/pinning_pub +0 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/static +0 -0
- package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/stream +0 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Assets.car +0 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFCompatibilityMacros.h +37 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFHTTPSessionManager.h +304 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFNetworkReachabilityManager.h +216 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFNetworking.h +41 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFPlainTextRequestSerializer.h +16 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFSecurityPolicy.h +156 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFURLRequestSerialization.h +479 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFURLResponseSerialization.h +310 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFURLSessionManager.h +501 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/CardRequestProtocol.h +72 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/Constants.h +222 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/DeviceBindProtocol.h +38 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/DomainSecurityModule.h +43 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/ErrorDomains.h +68 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/FreeAssetProtocol.h +40 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/GDataXMLNode.h +214 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/NSDictionary+Utilities.h +23 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/NSFileManager+Utilities.h +20 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/NSString+Utilities.h +23 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/NSURL+Utilities.h +12 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/ProtocolBase.h +38 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/ResetPinProtocol.h +45 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/Settings.h +120 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequest.h +58 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestBaseProcessor.h +37 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestBindProcessor.h +34 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestNullProcessor.h +28 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestResetPinProcessor.h +35 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestUnlockProcessor.h +31 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestUseProcessor.h +34 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQKit-Swift.h +1522 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQKit.h +56 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQPacket.h +38 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Info.plist +0 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios-simulator.abi.json +89006 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +1099 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1099 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +89006 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +1099 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +1099 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/module.modulemap +11 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/UBQKit +0 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/_CodeSignature/CodeResources +652 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/certs +0 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/checksums +0 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/pinning_pub +0 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/static +0 -0
- package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/stream +0 -0
- package/ios/Util.swift +21 -24
- package/package.json +4 -3
- package/react-native-one-core.podspec +4 -5
|
@@ -40,6 +40,9 @@ object SerializeSpecific {
|
|
|
40
40
|
when (metadata) {
|
|
41
41
|
is HistoryMetadataBinding.UnexportableEntities ->
|
|
42
42
|
return convertToRN(metadata.value) as ReadableMap
|
|
43
|
+
|
|
44
|
+
is HistoryMetadataBinding.ErrorMetadata ->
|
|
45
|
+
return convertToRN(metadata.value) as ReadableMap
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
48
|
|
|
@@ -53,7 +56,13 @@ object SerializeSpecific {
|
|
|
53
56
|
when (val value = c.value) {
|
|
54
57
|
is ClaimValueBindingDto.Boolean -> result.putBoolean("value", value.value)
|
|
55
58
|
is ClaimValueBindingDto.Float -> result.putDouble("value", value.value)
|
|
56
|
-
is ClaimValueBindingDto.Integer ->
|
|
59
|
+
is ClaimValueBindingDto.Integer -> {
|
|
60
|
+
if (value.value < Int.MIN_VALUE || value.value > Int.MAX_VALUE) {
|
|
61
|
+
result.putDouble("value", value.value.toDouble())
|
|
62
|
+
} else {
|
|
63
|
+
result.putInt("value", value.value.toInt())
|
|
64
|
+
}
|
|
65
|
+
}
|
|
57
66
|
is ClaimValueBindingDto.String -> result.putString("value", value.value)
|
|
58
67
|
is ClaimValueBindingDto.Nested ->
|
|
59
68
|
result.putArray("value", convertToRN(value.value) as ReadableArray)
|
|
@@ -113,6 +122,9 @@ object SerializeSpecific {
|
|
|
113
122
|
is CredentialSchemaTypeBindingEnum.Mdoc ->
|
|
114
123
|
"MDOC"
|
|
115
124
|
|
|
125
|
+
is CredentialSchemaTypeBindingEnum.SdJwtVc ->
|
|
126
|
+
"SD_JWT_VC"
|
|
127
|
+
|
|
116
128
|
is CredentialSchemaTypeBindingEnum.Other ->
|
|
117
129
|
type.value
|
|
118
130
|
}
|
|
@@ -1,20 +1,52 @@
|
|
|
1
1
|
package ch.procivis.one.core
|
|
2
2
|
|
|
3
|
+
import com.facebook.react.bridge.Arguments
|
|
3
4
|
import com.facebook.react.bridge.Promise
|
|
4
5
|
import com.facebook.react.bridge.ReadableMap
|
|
6
|
+
import kotlinx.coroutines.CoroutineScope
|
|
7
|
+
import kotlinx.coroutines.launch
|
|
5
8
|
|
|
6
9
|
object Util {
|
|
7
|
-
// error handling
|
|
8
|
-
fun
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
error.
|
|
14
|
-
|
|
15
|
-
error
|
|
16
|
-
|
|
10
|
+
// error handling + running core code outside JS thread
|
|
11
|
+
fun syncCall(promise: Promise, function: () -> Any?) {
|
|
12
|
+
object : Thread() {
|
|
13
|
+
override fun run() {
|
|
14
|
+
try {
|
|
15
|
+
promise.resolve(function())
|
|
16
|
+
} catch (error: BindingException.ErrorResponse) {
|
|
17
|
+
handleBindingException(promise, error)
|
|
18
|
+
} catch (error: Throwable) {
|
|
19
|
+
promise.reject(error)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}.start()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
fun asyncCall(promise: Promise, scope: CoroutineScope, function: suspend () -> Any?) {
|
|
26
|
+
scope.launch {
|
|
27
|
+
try {
|
|
28
|
+
promise.resolve(function())
|
|
29
|
+
} catch (error: BindingException.ErrorResponse) {
|
|
30
|
+
handleBindingException(promise, error)
|
|
31
|
+
} catch (error: Throwable) {
|
|
32
|
+
promise.reject(error)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private fun handleBindingException(promise: Promise, error: BindingException.ErrorResponse) {
|
|
38
|
+
val userInfo = Arguments.createMap()
|
|
39
|
+
val cause = error.data.cause?.message
|
|
40
|
+
if (!cause.isNullOrEmpty()) {
|
|
41
|
+
userInfo.putString("cause", cause)
|
|
17
42
|
}
|
|
43
|
+
|
|
44
|
+
promise.reject(
|
|
45
|
+
error.data.code,
|
|
46
|
+
error.data.message,
|
|
47
|
+
error,
|
|
48
|
+
userInfo
|
|
49
|
+
)
|
|
18
50
|
}
|
|
19
51
|
}
|
|
20
52
|
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
package ch.procivis.one.core.ubiqu
|
|
2
|
+
|
|
3
|
+
import android.content.Intent
|
|
4
|
+
import ch.procivis.one.core.NativeKeyStorageException
|
|
5
|
+
import com.facebook.react.bridge.Arguments
|
|
6
|
+
import com.facebook.react.bridge.ReactContext
|
|
7
|
+
import com.facebook.react.bridge.WritableMap
|
|
8
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
9
|
+
import com.ubiqu.eid.sdk.requests.UbqRequestFlow
|
|
10
|
+
|
|
11
|
+
object PinPadRunner {
|
|
12
|
+
enum class RequestType {
|
|
13
|
+
SUBSCRIBE,
|
|
14
|
+
TRANSACTION,
|
|
15
|
+
ADD_BIOMETRICS,
|
|
16
|
+
CHANGE_PIN
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
enum class RNEvent {
|
|
20
|
+
RSE_SHOW_PIN,
|
|
21
|
+
RSE_HIDE_PIN,
|
|
22
|
+
RSE_DIGITS_ENTERED,
|
|
23
|
+
RSE_PIN_STAGE,
|
|
24
|
+
RSE_INCORRECT_PIN
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
enum class RNEventParam {
|
|
28
|
+
flowType,
|
|
29
|
+
digitsEntered,
|
|
30
|
+
stage,
|
|
31
|
+
attemptsLeft,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
enum class RNEventStage {
|
|
35
|
+
CHECK_CURRENT_PIN,
|
|
36
|
+
NEW_FIRST_PIN,
|
|
37
|
+
NEW_SECOND_PIN,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
data class Flow(
|
|
41
|
+
val flow: UbqRequestFlow,
|
|
42
|
+
val promise: Util.Promise<String?>,
|
|
43
|
+
val type: RequestType
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
@Volatile
|
|
47
|
+
private var activeFlow: Flow? = null
|
|
48
|
+
|
|
49
|
+
@Synchronized
|
|
50
|
+
fun getActiveFlow(): Flow {
|
|
51
|
+
return activeFlow ?: throw NativeKeyStorageException.Unknown("No active flow")
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private fun sendRNEvent(context: ReactContext, eventName: String, params: WritableMap?) {
|
|
55
|
+
context
|
|
56
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
57
|
+
.emit(eventName, params)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// ==== called from UbiquKeyStorage
|
|
61
|
+
@Synchronized
|
|
62
|
+
fun startPinPadFlow(
|
|
63
|
+
context: ReactContext,
|
|
64
|
+
flow: UbqRequestFlow,
|
|
65
|
+
requestType: RequestType,
|
|
66
|
+
promise: Util.Promise<String?>
|
|
67
|
+
) {
|
|
68
|
+
if (activeFlow != null) {
|
|
69
|
+
throw NativeKeyStorageException.Unknown("Another PinPad flow in progress")
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
activeFlow = Flow(flow, promise, requestType)
|
|
73
|
+
|
|
74
|
+
val params = Arguments.createMap()
|
|
75
|
+
params.putString(RNEventParam.flowType.name, requestType.name)
|
|
76
|
+
|
|
77
|
+
val initialStage = when (requestType) {
|
|
78
|
+
RequestType.SUBSCRIBE -> RNEventStage.NEW_FIRST_PIN
|
|
79
|
+
else -> RNEventStage.CHECK_CURRENT_PIN
|
|
80
|
+
}
|
|
81
|
+
params.putString(RNEventParam.stage.name, initialStage.name)
|
|
82
|
+
sendRNEvent(context, RNEvent.RSE_SHOW_PIN.name, params)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@Synchronized
|
|
86
|
+
fun cancelPinPadFlow() {
|
|
87
|
+
activeFlow?.promise?.fail(NativeKeyStorageException.Unknown("Canceled by user"))
|
|
88
|
+
activeFlow = null
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// ==== called from PinPadWrapper
|
|
92
|
+
@Synchronized
|
|
93
|
+
fun finishPinPadFlowSuccess(context: ReactContext, data: String?) {
|
|
94
|
+
activeFlow?.promise?.succeed(data)
|
|
95
|
+
activeFlow = null
|
|
96
|
+
sendRNEvent(context, RNEvent.RSE_HIDE_PIN.name, null)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@Synchronized
|
|
100
|
+
fun finishPinPadFlowFailure(context: ReactContext, error: Throwable) {
|
|
101
|
+
activeFlow?.promise?.fail(error)
|
|
102
|
+
activeFlow = null
|
|
103
|
+
sendRNEvent(context, RNEvent.RSE_HIDE_PIN.name, null)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
fun digitsEntered(context: ReactContext, numPins: Int) {
|
|
107
|
+
val params = Arguments.createMap()
|
|
108
|
+
params.putInt(RNEventParam.digitsEntered.name, numPins)
|
|
109
|
+
sendRNEvent(context, RNEvent.RSE_DIGITS_ENTERED.name, params)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
fun pinStage(context: ReactContext, stage: RNEventStage) {
|
|
113
|
+
val params = Arguments.createMap()
|
|
114
|
+
params.putString(RNEventParam.stage.name, stage.name)
|
|
115
|
+
sendRNEvent(context, RNEvent.RSE_PIN_STAGE.name, params)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
fun incorrectPin(context: ReactContext, attemptsLeft: Int) {
|
|
119
|
+
val params = Arguments.createMap()
|
|
120
|
+
params.putInt(RNEventParam.attemptsLeft.name, attemptsLeft)
|
|
121
|
+
sendRNEvent(context, RNEvent.RSE_INCORRECT_PIN.name, params)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
package ch.procivis.one.core.ubiqu
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
5
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
6
|
+
import com.ubiqu.eid.sdk.components.UbqInternalPad
|
|
7
|
+
import com.ubiqu.eid.sdk.components.UbqPinPad
|
|
8
|
+
|
|
9
|
+
class PinPadViewManager(private val callerContext: ReactApplicationContext) :
|
|
10
|
+
SimpleViewManager<UbqPinPad>() {
|
|
11
|
+
companion object {
|
|
12
|
+
const val REACT_CLASS = "RCTProcivisRSEPinPad"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
override fun getName() = REACT_CLASS
|
|
16
|
+
|
|
17
|
+
override fun createViewInstance(context: ThemedReactContext): UbqPinPad {
|
|
18
|
+
val pinPad = UbqPinPad(context, extraButton = UbqInternalPad.ExtraButtonFunctionality.BIOMETRICS_AUTO.code)
|
|
19
|
+
val activeFlow = PinPadRunner.getActiveFlow()
|
|
20
|
+
PinPadWrapper(callerContext, pinPad, activeFlow.flow, activeFlow.type)
|
|
21
|
+
return pinPad
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
package ch.procivis.one.core.ubiqu
|
|
2
|
+
|
|
3
|
+
import android.view.View
|
|
4
|
+
import ch.procivis.one.core.NativeKeyStorageException
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
7
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
8
|
+
|
|
9
|
+
class PinPadViewManager(private val callerContext: ReactApplicationContext) :
|
|
10
|
+
SimpleViewManager<View>() {
|
|
11
|
+
companion object {
|
|
12
|
+
const val REACT_CLASS = "RCTProcivisRSEPinPad"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
override fun getName() = REACT_CLASS
|
|
16
|
+
|
|
17
|
+
override fun createViewInstance(context: ThemedReactContext): View {
|
|
18
|
+
throw NativeKeyStorageException.Unsupported()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
package ch.procivis.one.core.ubiqu
|
|
2
|
+
|
|
3
|
+
import android.annotation.SuppressLint
|
|
4
|
+
import android.util.Log
|
|
5
|
+
import androidx.fragment.app.FragmentActivity
|
|
6
|
+
import ch.procivis.one.core.NativeKeyStorageException
|
|
7
|
+
import ch.procivis.one.core.ubiqu.PinPadRunner.digitsEntered
|
|
8
|
+
import ch.procivis.one.core.ubiqu.PinPadRunner.finishPinPadFlowFailure
|
|
9
|
+
import ch.procivis.one.core.ubiqu.PinPadRunner.finishPinPadFlowSuccess
|
|
10
|
+
import ch.procivis.one.core.ubiqu.PinPadRunner.incorrectPin
|
|
11
|
+
import ch.procivis.one.core.ubiqu.PinPadRunner.pinStage
|
|
12
|
+
import com.facebook.react.bridge.ReactContext
|
|
13
|
+
import com.ubiqu.eid.sdk.backend.assets.UbqAsset
|
|
14
|
+
import com.ubiqu.eid.sdk.components.UbqPinPad
|
|
15
|
+
import com.ubiqu.eid.sdk.enums.AddBiometricsState
|
|
16
|
+
import com.ubiqu.eid.sdk.enums.ChangePinState
|
|
17
|
+
import com.ubiqu.eid.sdk.enums.SubscribeState
|
|
18
|
+
import com.ubiqu.eid.sdk.enums.TransactionState
|
|
19
|
+
import com.ubiqu.eid.sdk.exceptions.UbqSdkException
|
|
20
|
+
import com.ubiqu.eid.sdk.interfaces.AddBiometricsFinishInterface
|
|
21
|
+
import com.ubiqu.eid.sdk.interfaces.AddBiometricsUiInterface
|
|
22
|
+
import com.ubiqu.eid.sdk.interfaces.ChangePinFinishInterface
|
|
23
|
+
import com.ubiqu.eid.sdk.interfaces.ChangePinUiInterface
|
|
24
|
+
import com.ubiqu.eid.sdk.interfaces.SubscribeFinishInterface
|
|
25
|
+
import com.ubiqu.eid.sdk.interfaces.SubscribeUiInterface
|
|
26
|
+
import com.ubiqu.eid.sdk.interfaces.TransactionFinishInterface
|
|
27
|
+
import com.ubiqu.eid.sdk.interfaces.TransactionUiInterface
|
|
28
|
+
import com.ubiqu.eid.sdk.interfaces.UbqPinPadReporting
|
|
29
|
+
import com.ubiqu.eid.sdk.requests.UbqAddBiometrics
|
|
30
|
+
import com.ubiqu.eid.sdk.requests.UbqChangePin
|
|
31
|
+
import com.ubiqu.eid.sdk.requests.UbqRequestFlow
|
|
32
|
+
import com.ubiqu.eid.sdk.requests.UbqSubscribe
|
|
33
|
+
import com.ubiqu.eid.sdk.requests.UbqTransaction
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@SuppressLint("LogNotTimber")
|
|
37
|
+
class PinPadWrapper(
|
|
38
|
+
private val context: ReactContext,
|
|
39
|
+
private val pinPad: UbqPinPad,
|
|
40
|
+
private val flow: UbqRequestFlow,
|
|
41
|
+
flowType: PinPadRunner.RequestType
|
|
42
|
+
) : SubscribeUiInterface, SubscribeFinishInterface,
|
|
43
|
+
UbqPinPadReporting, TransactionUiInterface, TransactionFinishInterface,
|
|
44
|
+
AddBiometricsUiInterface, AddBiometricsFinishInterface, ChangePinUiInterface,
|
|
45
|
+
ChangePinFinishInterface {
|
|
46
|
+
|
|
47
|
+
companion object {
|
|
48
|
+
private const val TAG = "ch.procivis.one.core.ubiqu.PinPadWrapper"
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
init {
|
|
52
|
+
pinPad.setKeyPadOnKeyListener(this)
|
|
53
|
+
pinPad.setOnPinInputFinishListener(flow)
|
|
54
|
+
|
|
55
|
+
when (flowType) {
|
|
56
|
+
PinPadRunner.RequestType.SUBSCRIBE -> {
|
|
57
|
+
(flow as UbqSubscribe).update(this)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
PinPadRunner.RequestType.TRANSACTION -> {
|
|
61
|
+
val fragmentActivity = context.currentActivity as? FragmentActivity
|
|
62
|
+
val transaction = flow as UbqTransaction
|
|
63
|
+
transaction.update(this, fragmentActivity = fragmentActivity)
|
|
64
|
+
if (transaction.ubqAsset?.biometricsEnabled == true) {
|
|
65
|
+
pinPad.enableBiometrics(transaction)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
PinPadRunner.RequestType.ADD_BIOMETRICS -> {
|
|
70
|
+
(flow as UbqAddBiometrics).update(this)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
PinPadRunner.RequestType.CHANGE_PIN -> {
|
|
74
|
+
(flow as UbqChangePin).update(this)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ========== SubscribeUiInterface
|
|
80
|
+
override fun onSubscribeFirstPinEntered() {
|
|
81
|
+
Log.d(TAG, "onSubscribeFirstPinEntered")
|
|
82
|
+
updateSubscribeFlow(flow as UbqSubscribe)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
override fun onSubscribePinConfirmed() {
|
|
86
|
+
Log.d(TAG, "onSubscribePinConfirmed")
|
|
87
|
+
updateSubscribeFlow(flow as UbqSubscribe)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
override fun onSubscribePinNotConfirmed() {
|
|
91
|
+
Log.d(TAG, "onSubscribePinNotConfirmed")
|
|
92
|
+
updateSubscribeFlow(flow as UbqSubscribe)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
override fun onSubscribePukEntered() {
|
|
96
|
+
Log.d(TAG, "onSubscribePukEntered")
|
|
97
|
+
updateSubscribeFlow(flow as UbqSubscribe)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
override fun onSubscribeUiError(error: UbqSdkException) {
|
|
101
|
+
Log.w(TAG, "onSubscribeUiError: $error")
|
|
102
|
+
finishPinPadFlowFailure(context, error)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
override fun onSubscribeUnallowedPinEntered() {
|
|
106
|
+
Log.d(TAG, "onSubscribeUnallowedPinEntered")
|
|
107
|
+
updateSubscribeFlow(flow as UbqSubscribe)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// ========== SubscribeFinishInterface
|
|
111
|
+
override fun onSubscribeCompleted(ubqAsset: UbqAsset) {
|
|
112
|
+
Log.d(TAG, "onSubscribeCompleted")
|
|
113
|
+
updateSubscribeFlow(flow as UbqSubscribe)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
override fun onSubscribeFinishFailure(error: UbqSdkException) {
|
|
117
|
+
Log.w(TAG, "onSubscribeFinishFailure: $error")
|
|
118
|
+
finishPinPadFlowFailure(context, error)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
override fun onSubscribeIncorrectPukEntered(ubqAsset: UbqAsset) {
|
|
122
|
+
Log.d(TAG, "onSubscribeIncorrectPukEntered")
|
|
123
|
+
finishPinPadFlowFailure(context, NativeKeyStorageException.Unknown("Wrong PUK"))
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ========== TransactionUiInterface
|
|
127
|
+
override fun onTransactionBiometricsEntered() {
|
|
128
|
+
Log.d(TAG, "onTransactionBiometricsEntered")
|
|
129
|
+
updateTransactionFlow(flow as UbqTransaction)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
override fun onTransactionPinEntered() {
|
|
133
|
+
Log.d(TAG, "onTransactionPinEntered")
|
|
134
|
+
updateTransactionFlow(flow as UbqTransaction)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
override fun onTransactionUiError(error: UbqSdkException) {
|
|
138
|
+
Log.w(TAG, "onTransactionUiError: $error")
|
|
139
|
+
finishPinPadFlowFailure(context, error)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// ========== TransactionFinishInterface
|
|
143
|
+
override fun onTransactionCompleted(result: String?) {
|
|
144
|
+
Log.d(TAG, "onTransactionCompleted")
|
|
145
|
+
finishPinPadFlowSuccess(context, result)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
override fun onTransactionIncorrectPinEntered(pinAttemptsLeft: Int) {
|
|
149
|
+
Log.d(TAG, "onTransactionIncorrectPinEntered (attempts left: $pinAttemptsLeft)")
|
|
150
|
+
incorrectPin(context, pinAttemptsLeft)
|
|
151
|
+
if (pinAttemptsLeft == 0) {
|
|
152
|
+
finishPinPadFlowFailure(
|
|
153
|
+
context,
|
|
154
|
+
NativeKeyStorageException.Unknown("Exceeded PIN input attempts")
|
|
155
|
+
)
|
|
156
|
+
} else {
|
|
157
|
+
pinPad.clear(true)
|
|
158
|
+
pinStage(context, PinPadRunner.RNEventStage.CHECK_CURRENT_PIN)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
override fun onTransactionFinishFailure(error: UbqSdkException) {
|
|
163
|
+
Log.w(TAG, "onTransactionFinishFailure: $error")
|
|
164
|
+
finishPinPadFlowFailure(context, error)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// ========== AddBiometricsUiInterface
|
|
168
|
+
override fun onAddBiometricsIncorrectBiometricsEntered() {
|
|
169
|
+
Log.d(TAG, "onAddBiometricsIncorrectBiometricsEntered")
|
|
170
|
+
updateAddBiometricsFlow(flow as UbqAddBiometrics)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
override fun onAddBiometricsPinEntered() {
|
|
174
|
+
Log.d(TAG, "onAddBiometricsPinEntered")
|
|
175
|
+
updateAddBiometricsFlow(flow as UbqAddBiometrics)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
override fun onAddBiometricsUiError(error: UbqSdkException) {
|
|
179
|
+
Log.w(TAG, "onAddBiometricsUiError: $error")
|
|
180
|
+
finishPinPadFlowFailure(context, error)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// ========== AddBiometricsFinishInterface
|
|
184
|
+
override fun onAddBiometricsCompleted() {
|
|
185
|
+
Log.d(TAG, "onAddBiometricsCompleted")
|
|
186
|
+
updateAddBiometricsFlow(flow as UbqAddBiometrics)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
override fun onAddBiometricsFinishFailure(error: UbqSdkException) {
|
|
190
|
+
Log.w(TAG, "onAddBiometricsFinishFailure: $error")
|
|
191
|
+
finishPinPadFlowFailure(context, error)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
override fun onAddBiometricsIncorrectPinEntered(pinAttemptsLeft: Int) {
|
|
195
|
+
Log.d(TAG, "onAddBiometricsIncorrectPinEntered (attempts left: $pinAttemptsLeft)")
|
|
196
|
+
incorrectPin(context, pinAttemptsLeft)
|
|
197
|
+
if (pinAttemptsLeft == 0) {
|
|
198
|
+
finishPinPadFlowFailure(
|
|
199
|
+
context,
|
|
200
|
+
NativeKeyStorageException.Unknown("Exceeded PIN input attempts")
|
|
201
|
+
)
|
|
202
|
+
} else {
|
|
203
|
+
pinPad.clear(true)
|
|
204
|
+
pinStage(context, PinPadRunner.RNEventStage.CHECK_CURRENT_PIN)
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// ========== ChangePinUiInterface
|
|
209
|
+
override fun onChangePinPinEntered() {
|
|
210
|
+
Log.d(TAG, "onChangePinPinEntered")
|
|
211
|
+
updateChangePinFlow(flow as UbqChangePin)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
override fun onChangePinNewPinEntered() {
|
|
215
|
+
Log.d(TAG, "onChangePinNewPinEntered")
|
|
216
|
+
updateChangePinFlow(flow as UbqChangePin)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
override fun onChangePinPinConfirmed() {
|
|
220
|
+
Log.d(TAG, "onChangePinPinConfirmed")
|
|
221
|
+
updateChangePinFlow(flow as UbqChangePin)
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
override fun onChangePinPinNotConfirmed() {
|
|
225
|
+
Log.d(TAG, "onChangePinPinNotConfirmed")
|
|
226
|
+
updateChangePinFlow(flow as UbqChangePin)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
override fun onChangePinUiError(error: UbqSdkException) {
|
|
230
|
+
Log.w(TAG, "onChangePinUiError: $error")
|
|
231
|
+
finishPinPadFlowFailure(context, error)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
override fun onChangePinUnallowedPinEntered() {
|
|
235
|
+
Log.d(TAG, "onChangePinUnallowedPinEntered")
|
|
236
|
+
updateChangePinFlow(flow as UbqChangePin)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// ========== ChangePinFinishInterface
|
|
240
|
+
override fun onChangePinCompleted() {
|
|
241
|
+
Log.d(TAG, "onChangePinCompleted")
|
|
242
|
+
updateChangePinFlow(flow as UbqChangePin)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
override fun onChangePinFinishFailure(error: UbqSdkException) {
|
|
246
|
+
Log.w(TAG, "onChangePinFinishFailure: $error")
|
|
247
|
+
finishPinPadFlowFailure(context, error)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
override fun onChangePinIncorrectPinEntered(pinAttemptsLeft: Int) {
|
|
251
|
+
Log.d(TAG, "onChangePinIncorrectPinEntered (attempts left: $pinAttemptsLeft)")
|
|
252
|
+
incorrectPin(context, pinAttemptsLeft)
|
|
253
|
+
if (pinAttemptsLeft == 0) {
|
|
254
|
+
finishPinPadFlowFailure(
|
|
255
|
+
context,
|
|
256
|
+
NativeKeyStorageException.Unknown("Exceeded PIN input attempts")
|
|
257
|
+
)
|
|
258
|
+
} else {
|
|
259
|
+
pinStage(context, PinPadRunner.RNEventStage.CHECK_CURRENT_PIN)
|
|
260
|
+
finishPinPadFlowFailure(
|
|
261
|
+
context,
|
|
262
|
+
NativeKeyStorageException.Unknown("Incorrect PIN entered")
|
|
263
|
+
)
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// ========== UbqPinPadReporting
|
|
268
|
+
override fun onDigitsChanged(newAmount: Int) {
|
|
269
|
+
Log.d(TAG, "onDigitsChanged: $newAmount")
|
|
270
|
+
digitsEntered(context, newAmount)
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// private
|
|
274
|
+
private fun updateChangePinFlow(flow: UbqChangePin) {
|
|
275
|
+
when (flow.state) {
|
|
276
|
+
ChangePinState.AWAITING_PIN -> {
|
|
277
|
+
pinPad.clear(true)
|
|
278
|
+
pinStage(context, PinPadRunner.RNEventStage.CHECK_CURRENT_PIN)
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
ChangePinState.AWAITING_NEW_PIN -> {
|
|
282
|
+
pinPad.clear(true)
|
|
283
|
+
pinStage(context, PinPadRunner.RNEventStage.NEW_FIRST_PIN)
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
ChangePinState.AWAITING_CONFIRMATION_PIN -> {
|
|
287
|
+
pinPad.clear(true)
|
|
288
|
+
pinStage(context, PinPadRunner.RNEventStage.NEW_SECOND_PIN)
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
ChangePinState.AWAITING_FINISH -> {
|
|
292
|
+
flow.finish(this)
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
ChangePinState.SUCCESS -> {
|
|
296
|
+
finishPinPadFlowSuccess(context, null)
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
ChangePinState.FAILURE -> {
|
|
300
|
+
finishPinPadFlowFailure(
|
|
301
|
+
context,
|
|
302
|
+
NativeKeyStorageException.Unknown("Change PIN flow failure")
|
|
303
|
+
)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
null -> {
|
|
307
|
+
throw NativeKeyStorageException.Unknown("Missing change PIN flow state")
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
private fun updateAddBiometricsFlow(flow: UbqAddBiometrics) {
|
|
313
|
+
when (flow.state) {
|
|
314
|
+
AddBiometricsState.AWAITING_PIN -> {
|
|
315
|
+
pinPad.clear(true)
|
|
316
|
+
pinStage(context, PinPadRunner.RNEventStage.CHECK_CURRENT_PIN)
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
AddBiometricsState.AWAITING_FINISH -> {
|
|
320
|
+
flow.finish(this)
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
AddBiometricsState.SUCCESS -> {
|
|
324
|
+
finishPinPadFlowSuccess(context, null)
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
AddBiometricsState.FAILURE -> {
|
|
328
|
+
finishPinPadFlowFailure(
|
|
329
|
+
context,
|
|
330
|
+
NativeKeyStorageException.Unknown("Add biometrics flow failure")
|
|
331
|
+
)
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
null -> {
|
|
335
|
+
throw NativeKeyStorageException.Unknown("Missing add biometrics flow state")
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
private fun updateTransactionFlow(flow: UbqTransaction) {
|
|
341
|
+
when (flow.state) {
|
|
342
|
+
TransactionState.AWAITING_PIN -> {
|
|
343
|
+
pinPad.clear(true)
|
|
344
|
+
pinStage(context, PinPadRunner.RNEventStage.CHECK_CURRENT_PIN)
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
TransactionState.AWAITING_FINISH -> {
|
|
348
|
+
flow.finish(this)
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
TransactionState.FAILURE -> {
|
|
352
|
+
finishPinPadFlowFailure(
|
|
353
|
+
context,
|
|
354
|
+
NativeKeyStorageException.Unknown("Transaction flow failure")
|
|
355
|
+
)
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
else -> {
|
|
359
|
+
throw NativeKeyStorageException.Unknown("Invalid transaction flow state ${flow.state}")
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
private fun updateSubscribeFlow(flow: UbqSubscribe) {
|
|
365
|
+
when (flow.state) {
|
|
366
|
+
SubscribeState.AWAITING_FIRST_PIN -> {
|
|
367
|
+
pinPad.clear(true)
|
|
368
|
+
pinStage(context, PinPadRunner.RNEventStage.NEW_FIRST_PIN)
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
SubscribeState.AWAITING_CONFIRMATION_PIN -> {
|
|
372
|
+
pinPad.clear(true)
|
|
373
|
+
pinStage(context, PinPadRunner.RNEventStage.NEW_SECOND_PIN)
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
SubscribeState.AWAITING_FINISH -> {
|
|
377
|
+
flow.finish(this)
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
SubscribeState.SUCCESS -> {
|
|
381
|
+
finishPinPadFlowSuccess(context, null)
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
SubscribeState.FAILURE -> {
|
|
385
|
+
finishPinPadFlowFailure(
|
|
386
|
+
context,
|
|
387
|
+
NativeKeyStorageException.Unknown("Subscribe flow failure")
|
|
388
|
+
)
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
else -> {
|
|
392
|
+
throw NativeKeyStorageException.Unknown("Invalid subscribe flow state ${flow.state}")
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|