@procivis/react-native-one-core 1.33398.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 +8 -26
- package/android/build.gradle +27 -3
- 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 +5 -5
- package/android/src/main/java/ch/procivis/one/core/DeserializeSpecific.kt +3 -2
- package/android/src/main/java/ch/procivis/one/core/ProcivisOneCoreModule.kt +99 -12
- package/android/src/main/java/ch/procivis/one/core/ProcivisOneCorePackage.kt +3 -4
- package/android/src/main/java/ch/procivis/one/core/SerializeSpecific.kt +6 -0
- 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 +7 -0
- package/dist/index.js +10 -4
- package/dist/src/cache.d.ts +0 -4
- package/dist/src/cache.js +0 -5
- package/dist/src/config.d.ts +11 -3
- package/dist/src/core.d.ts +8 -4
- package/dist/src/core.js +67 -0
- package/dist/src/credential.d.ts +1 -0
- package/dist/src/credentialSchema.d.ts +5 -2
- package/dist/src/credentialSchema.js +2 -0
- package/dist/src/history.d.ts +19 -4
- package/dist/src/history.js +10 -1
- package/dist/src/organisation.d.ts +8 -0
- package/dist/src/organisation.js +1 -0
- package/dist/src/proof.d.ts +19 -4
- package/dist/src/proof.js +13 -5
- package/dist/src/trust.d.ts +1 -1
- package/dist/src/ubiqu.d.ts +49 -0
- package/dist/src/ubiqu.js +69 -0
- package/ios/Deserialize.swift +57 -19
- package/ios/EventEmitter.swift +79 -0
- package/ios/ProcivisOneCoreModule.m +30 -4
- package/ios/ProcivisOneCoreModule.swift +141 -14
- 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 +40 -20
- 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 +1 -0
- package/package.json +5 -4
- package/react-native-one-core.podspec +4 -5
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
package ch.procivis.one.core.ubiqu
|
|
2
|
+
|
|
3
|
+
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
|
|
4
|
+
import ch.procivis.one.core.ubiqu.dataformats.CreateIdentityRequest
|
|
5
|
+
import ch.procivis.one.core.ubiqu.dataformats.CreateIdentityResponse
|
|
6
|
+
import ch.procivis.one.core.ubiqu.dataformats.RegisterRSEResponse
|
|
7
|
+
import kotlinx.serialization.json.Json
|
|
8
|
+
import okhttp3.MediaType.Companion.toMediaType
|
|
9
|
+
import okhttp3.OkHttpClient
|
|
10
|
+
import retrofit2.Response
|
|
11
|
+
import retrofit2.Retrofit
|
|
12
|
+
import retrofit2.converter.scalars.ScalarsConverterFactory
|
|
13
|
+
import retrofit2.http.Body
|
|
14
|
+
import retrofit2.http.Header
|
|
15
|
+
import retrofit2.http.POST
|
|
16
|
+
import retrofit2.http.Path
|
|
17
|
+
|
|
18
|
+
object RegistrationManager {
|
|
19
|
+
private lateinit var retrofitService: IdentityApi
|
|
20
|
+
|
|
21
|
+
private val client = OkHttpClient.Builder().build()
|
|
22
|
+
|
|
23
|
+
lateinit var organisationId: String
|
|
24
|
+
|
|
25
|
+
fun build(identityServiceUrl: String, organisationId: String) {
|
|
26
|
+
this.organisationId = organisationId
|
|
27
|
+
|
|
28
|
+
val retrofit = Retrofit.Builder()
|
|
29
|
+
.baseUrl(identityServiceUrl)
|
|
30
|
+
.client(client)
|
|
31
|
+
.addConverterFactory(ScalarsConverterFactory.create())
|
|
32
|
+
.addConverterFactory(Json{
|
|
33
|
+
ignoreUnknownKeys = true
|
|
34
|
+
}.asConverterFactory("application/json".toMediaType()))
|
|
35
|
+
.build()
|
|
36
|
+
|
|
37
|
+
retrofitService = retrofit.create(IdentityApi::class.java)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
suspend fun createIdentity(accessToken: String, body: CreateIdentityRequest): Response<CreateIdentityResponse> {
|
|
41
|
+
val auth = "Bearer $accessToken"
|
|
42
|
+
return retrofitService.createIdentity(auth, organisationId, body)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
suspend fun registerRse(accessToken: String, subject: String): Response<RegisterRSEResponse> {
|
|
46
|
+
val auth = "Bearer $accessToken"
|
|
47
|
+
return retrofitService.registerRse(auth, organisationId, subject)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface IdentityApi {
|
|
52
|
+
|
|
53
|
+
@POST("/organisation/{id}/identity/")
|
|
54
|
+
suspend fun createIdentity(@Header("Authorization") authorization: String, @Path("id") organisationId: String, @Body body: CreateIdentityRequest): Response<CreateIdentityResponse>
|
|
55
|
+
|
|
56
|
+
@POST("/organisation/{id}/identity/{subject}/register_rse/")
|
|
57
|
+
suspend fun registerRse(@Header("Authorization") authorization: String, @Path("id") organisationId: String, @Path("subject") subject: String): Response<RegisterRSEResponse>
|
|
58
|
+
}
|
|
59
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
package ch.procivis.one.core.ubiqu
|
|
2
|
+
|
|
3
|
+
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
|
|
4
|
+
import kotlinx.serialization.json.Json
|
|
5
|
+
import okhttp3.MediaType.Companion.toMediaType
|
|
6
|
+
import okhttp3.OkHttpClient
|
|
7
|
+
import org.json.JSONObject
|
|
8
|
+
import retrofit2.Response
|
|
9
|
+
import retrofit2.Retrofit
|
|
10
|
+
import retrofit2.converter.scalars.ScalarsConverterFactory
|
|
11
|
+
import retrofit2.http.GET
|
|
12
|
+
import retrofit2.http.Header
|
|
13
|
+
|
|
14
|
+
object TokenManager {
|
|
15
|
+
private lateinit var retrofitService: TokenApi
|
|
16
|
+
|
|
17
|
+
private val client = OkHttpClient.Builder().build()
|
|
18
|
+
|
|
19
|
+
lateinit var apiKey: String
|
|
20
|
+
|
|
21
|
+
fun build(tokenGeneratorUrl: String, apiKey: String) {
|
|
22
|
+
this.apiKey = apiKey
|
|
23
|
+
|
|
24
|
+
val retrofit = Retrofit.Builder()
|
|
25
|
+
.baseUrl(tokenGeneratorUrl)
|
|
26
|
+
.client(client)
|
|
27
|
+
.addConverterFactory(ScalarsConverterFactory.create())
|
|
28
|
+
.addConverterFactory(Json.asConverterFactory("application/json".toMediaType()))
|
|
29
|
+
.build()
|
|
30
|
+
|
|
31
|
+
retrofitService = retrofit.create(TokenApi::class.java)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
suspend fun getAccessToken(): String {
|
|
35
|
+
val apiKey = apiKey
|
|
36
|
+
val auth = "Bearer $apiKey"
|
|
37
|
+
val response = retrofitService.getAccessToken(auth)
|
|
38
|
+
|
|
39
|
+
return JSONObject(response.body()!!).getString("access_token")
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface TokenApi {
|
|
45
|
+
|
|
46
|
+
@GET("/ubiqu/")
|
|
47
|
+
suspend fun getAccessToken(@Header("Authorization") authorization: String): Response<String>
|
|
48
|
+
}
|