@procivis/react-native-one-core 1.75488.0 → 1.81885.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/README.md +15 -14
  2. package/android/build.gradle +0 -11
  3. package/android/src/main/java/ch/procivis/one/core/DeserializeSpecific.kt +1 -15
  4. package/android/src/main/java/ch/procivis/one/core/ProcivisOneCoreModule.kt +4 -4
  5. package/android/src/main/java/ch/procivis/one/core/Serialize.kt +0 -2
  6. package/android/src/main/java/ch/procivis/one/core/SerializeSpecific.kt +124 -107
  7. package/android/src/main/java/ch/procivis/one/core/ubiqu/PinPadViewManager.kt +5 -8
  8. package/android/src/main/java/ch/procivis/one/core/ubiqu/UbiquKeyStorage.kt +17 -222
  9. package/core-sdk.json +6 -6
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.js +2 -0
  12. package/dist/src/config.d.ts +3 -2
  13. package/dist/src/config.js +5 -0
  14. package/dist/src/core.d.ts +9 -182
  15. package/dist/src/core.js +9 -20
  16. package/dist/src/nfc.d.ts +0 -5
  17. package/dist/src/one-core-uniffi-intf.d.ts +1773 -0
  18. package/dist/src/one-core-uniffi-intf.js +356 -0
  19. package/ios/Deserialize.swift +0 -28
  20. package/ios/ProcivisOneCoreModule.m +4 -4
  21. package/ios/ProcivisOneCoreModule.swift +10 -10
  22. package/ios/RSEKeyStorage.swift +17 -571
  23. package/ios/RSEPinPad.swift +3 -56
  24. package/ios/Serialize.swift +80 -44
  25. package/package.json +4 -2
  26. package/react-native-one-core.podspec +1 -1
  27. package/android/build.gradle_opensource +0 -122
  28. package/android/libs/core-reactnative-compatible-2025.0305.1.aar +0 -0
  29. package/android/src/main/java/ch/procivis/one/core/ubiqu/PinPadRunner.kt +0 -123
  30. package/android/src/main/java/ch/procivis/one/core/ubiqu/PinPadViewManager.kt_opensource +0 -20
  31. package/android/src/main/java/ch/procivis/one/core/ubiqu/PinPadWrapper.kt +0 -396
  32. package/android/src/main/java/ch/procivis/one/core/ubiqu/RegistrationManager.kt +0 -59
  33. package/android/src/main/java/ch/procivis/one/core/ubiqu/TokenManager.kt +0 -48
  34. package/android/src/main/java/ch/procivis/one/core/ubiqu/UbiquKeyStorage.kt_opensource +0 -63
  35. package/android/src/main/java/ch/procivis/one/core/ubiqu/Util.kt +0 -74
  36. package/android/src/main/java/ch/procivis/one/core/ubiqu/dataformats/CreateIdentityRequest.kt +0 -9
  37. package/android/src/main/java/ch/procivis/one/core/ubiqu/dataformats/CreateIdentityResponse.kt +0 -9
  38. package/android/src/main/java/ch/procivis/one/core/ubiqu/dataformats/RegisterRSEResponse.kt +0 -10
  39. package/dist/src/backup.d.ts +0 -22
  40. package/dist/src/backup.js +0 -1
  41. package/dist/src/cache.d.ts +0 -11
  42. package/dist/src/cache.js +0 -12
  43. package/dist/src/credential.d.ts +0 -201
  44. package/dist/src/credential.js +0 -44
  45. package/dist/src/credentialSchema.d.ts +0 -135
  46. package/dist/src/credentialSchema.js +0 -34
  47. package/dist/src/did.d.ts +0 -63
  48. package/dist/src/did.js +0 -27
  49. package/dist/src/history.d.ts +0 -101
  50. package/dist/src/history.js +0 -63
  51. package/dist/src/identifier.d.ts +0 -133
  52. package/dist/src/identifier.js +0 -29
  53. package/dist/src/key.d.ts +0 -17
  54. package/dist/src/key.js +0 -1
  55. package/dist/src/list.d.ts +0 -14
  56. package/dist/src/list.js +0 -5
  57. package/dist/src/organisation.d.ts +0 -9
  58. package/dist/src/organisation.js +0 -1
  59. package/dist/src/proof.d.ts +0 -234
  60. package/dist/src/proof.js +0 -43
  61. package/dist/src/proofSchema.d.ts +0 -116
  62. package/dist/src/proofSchema.js +0 -9
  63. package/dist/src/trust.d.ts +0 -173
  64. package/dist/src/trust.js +0 -44
  65. package/dist/src/walletUnit.d.ts +0 -30
  66. package/dist/src/walletUnit.js +0 -11
  67. package/ios/RSEKeyStorage.swift_opensource +0 -61
  68. package/ios/RSEPinPad.swift_opensource +0 -21
  69. package/ios/UBQKit.xcframework/Info.plist +0 -44
  70. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Assets.car +0 -0
  71. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFCompatibilityMacros.h +0 -37
  72. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFHTTPSessionManager.h +0 -304
  73. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFNetworkReachabilityManager.h +0 -216
  74. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFNetworking.h +0 -41
  75. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFPlainTextRequestSerializer.h +0 -16
  76. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFSecurityPolicy.h +0 -156
  77. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFURLRequestSerialization.h +0 -479
  78. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFURLResponseSerialization.h +0 -310
  79. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFURLSessionManager.h +0 -501
  80. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/CardRequestProtocol.h +0 -72
  81. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/Constants.h +0 -222
  82. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/DeviceBindProtocol.h +0 -38
  83. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/DomainSecurityModule.h +0 -43
  84. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/ErrorDomains.h +0 -68
  85. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/FreeAssetProtocol.h +0 -40
  86. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/GDataXMLNode.h +0 -214
  87. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/NSDictionary+Utilities.h +0 -23
  88. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/NSFileManager+Utilities.h +0 -20
  89. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/NSString+Utilities.h +0 -23
  90. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/NSURL+Utilities.h +0 -12
  91. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/ProtocolBase.h +0 -38
  92. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/ResetPinProtocol.h +0 -45
  93. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/Settings.h +0 -120
  94. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequest.h +0 -58
  95. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestBaseProcessor.h +0 -37
  96. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestBindProcessor.h +0 -34
  97. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestNullProcessor.h +0 -28
  98. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestResetPinProcessor.h +0 -35
  99. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestUnlockProcessor.h +0 -31
  100. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestUseProcessor.h +0 -34
  101. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQKit-Swift.h +0 -761
  102. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQKit.h +0 -56
  103. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQPacket.h +0 -38
  104. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Info.plist +0 -0
  105. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios.abi.json +0 -89006
  106. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -1099
  107. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  108. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios.swiftinterface +0 -1099
  109. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Modules/module.modulemap +0 -11
  110. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/UBQKit +0 -0
  111. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/_CodeSignature/CodeResources +0 -597
  112. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/certs +0 -0
  113. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/checksums +0 -0
  114. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/pinning_pub +0 -0
  115. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/static +0 -0
  116. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/stream +0 -0
  117. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Assets.car +0 -0
  118. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFCompatibilityMacros.h +0 -37
  119. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFHTTPSessionManager.h +0 -304
  120. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFNetworkReachabilityManager.h +0 -216
  121. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFNetworking.h +0 -41
  122. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFPlainTextRequestSerializer.h +0 -16
  123. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFSecurityPolicy.h +0 -156
  124. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFURLRequestSerialization.h +0 -479
  125. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFURLResponseSerialization.h +0 -310
  126. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFURLSessionManager.h +0 -501
  127. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/CardRequestProtocol.h +0 -72
  128. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/Constants.h +0 -222
  129. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/DeviceBindProtocol.h +0 -38
  130. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/DomainSecurityModule.h +0 -43
  131. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/ErrorDomains.h +0 -68
  132. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/FreeAssetProtocol.h +0 -40
  133. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/GDataXMLNode.h +0 -214
  134. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/NSDictionary+Utilities.h +0 -23
  135. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/NSFileManager+Utilities.h +0 -20
  136. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/NSString+Utilities.h +0 -23
  137. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/NSURL+Utilities.h +0 -12
  138. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/ProtocolBase.h +0 -38
  139. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/ResetPinProtocol.h +0 -45
  140. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/Settings.h +0 -120
  141. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequest.h +0 -58
  142. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestBaseProcessor.h +0 -37
  143. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestBindProcessor.h +0 -34
  144. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestNullProcessor.h +0 -28
  145. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestResetPinProcessor.h +0 -35
  146. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestUnlockProcessor.h +0 -31
  147. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestUseProcessor.h +0 -34
  148. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQKit-Swift.h +0 -1522
  149. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQKit.h +0 -56
  150. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQPacket.h +0 -38
  151. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Info.plist +0 -0
  152. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -89006
  153. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -1099
  154. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  155. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -1099
  156. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -89006
  157. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +0 -1099
  158. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  159. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +0 -1099
  160. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/module.modulemap +0 -11
  161. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/UBQKit +0 -0
  162. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/_CodeSignature/CodeResources +0 -652
  163. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/certs +0 -0
  164. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/checksums +0 -0
  165. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/pinning_pub +0 -0
  166. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/static +0 -0
  167. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/stream +0 -0
@@ -1,396 +0,0 @@
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
- }
@@ -1,59 +0,0 @@
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
-
@@ -1,48 +0,0 @@
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
- }
@@ -1,63 +0,0 @@
1
- package ch.procivis.one.core.ubiqu
2
-
3
- import ch.procivis.one.core.GeneratedKeyBindingDto
4
- import ch.procivis.one.core.NativeKeyStorage
5
- import ch.procivis.one.core.NativeKeyStorageException
6
- import com.facebook.react.bridge.ReactApplicationContext
7
-
8
- // Dummy implementation for licensed library
9
- class UbiquKeyStorage(private val context: ReactApplicationContext) : NativeKeyStorage {
10
- companion object {
11
- var listenerCount = 0
12
- }
13
-
14
- // ==== NativeKeyStorage interface
15
- override suspend fun generateKey(keyAlias: String): GeneratedKeyBindingDto {
16
- throw NativeKeyStorageException.Unsupported()
17
- }
18
-
19
- override suspend fun sign(keyReference: ByteArray, message: ByteArray): ByteArray {
20
- throw NativeKeyStorageException.Unsupported()
21
- }
22
-
23
- override suspend fun generateAttestation(keyReference: ByteArray, nonce: String?): List<String> {
24
- throw NativeKeyStorageException.Unsupported()
25
- }
26
-
27
- override suspend fun generateAttestationKey(keyAlias: String, nonce: String?): GeneratedKeyBindingDto {
28
- throw NativeKeyStorageException.Unsupported()
29
- }
30
-
31
- override suspend fun signWithAttestationKey(keyReference: ByteArray, message: ByteArray): ByteArray {
32
- throw NativeKeyStorageException.Unsupported()
33
- }
34
-
35
- // ==== public interface
36
- fun changePin(): String? {
37
- throw NativeKeyStorageException.Unsupported()
38
- }
39
-
40
- fun getBiometricsSupported(): Boolean {
41
- throw NativeKeyStorageException.Unsupported()
42
- }
43
-
44
- fun getBiometricsEnabled(): Boolean {
45
- throw NativeKeyStorageException.Unsupported()
46
- }
47
-
48
- fun enableBiometrics(verifyBiometrics: Boolean): String? {
49
- throw NativeKeyStorageException.Unsupported()
50
- }
51
-
52
- fun disableBiometrics() {
53
- throw NativeKeyStorageException.Unsupported()
54
- }
55
-
56
- fun reset() {
57
- throw NativeKeyStorageException.Unsupported()
58
- }
59
-
60
- fun resetPinFlow() {
61
- throw NativeKeyStorageException.Unsupported()
62
- }
63
- }
@@ -1,74 +0,0 @@
1
- package ch.procivis.one.core.ubiqu
2
-
3
- import android.annotation.SuppressLint
4
- import android.os.Handler
5
- import android.os.Looper
6
- import android.util.Log
7
- import ch.procivis.one.core.NativeKeyStorageException
8
- import kotlin.coroutines.Continuation
9
- import kotlin.coroutines.resume
10
- import kotlin.coroutines.resumeWithException
11
- import kotlin.coroutines.suspendCoroutine
12
-
13
- @SuppressLint("LogNotTimber")
14
- object Util {
15
- val TAG = "ch.procivis.one.core.ubiqu"
16
-
17
- class Promise<in T>(private val continuation: Continuation<T>) {
18
- @Volatile
19
- private var finished = false
20
-
21
- @Synchronized
22
- fun succeed(result: T) {
23
- if (!finished) {
24
- finished = true
25
- continuation.resume(result)
26
- }
27
- }
28
-
29
- @Synchronized
30
- fun fail(error: Throwable) {
31
- if (!finished) {
32
- finished = true
33
- continuation.resumeWithException(error)
34
- }
35
- }
36
- }
37
-
38
- suspend inline fun <T> asyncCallback(crossinline block: (Promise<T>) -> Unit): T {
39
- return exceptionWrapper {
40
- return@exceptionWrapper suspendCoroutine { continuation ->
41
- val promise = Promise(continuation)
42
- try {
43
- block(promise)
44
- } catch (error: Throwable) {
45
- promise.fail(error)
46
- }
47
- }
48
- }
49
- }
50
-
51
- inline fun <R> exceptionWrapper(function: () -> R): R {
52
- try {
53
- return function()
54
- } catch (error: NativeKeyStorageException) {
55
- Log.w(TAG, "NativeKeyStorageException: $error")
56
- throw error
57
- } catch (error: Throwable) {
58
- Log.w(TAG, "Throwable: $error")
59
- throw NativeKeyStorageException.Unknown(error.toString())
60
- }
61
- }
62
-
63
- suspend inline fun <R> runOnUIThread(crossinline block: (Promise<R>) -> Unit): R {
64
- return asyncCallback { promise ->
65
- Handler(Looper.getMainLooper()).post {
66
- try {
67
- block(promise)
68
- } catch (e: Throwable) {
69
- promise.fail(e)
70
- }
71
- }
72
- }
73
- }
74
- }
@@ -1,9 +0,0 @@
1
- package ch.procivis.one.core.ubiqu.dataformats
2
-
3
- import kotlinx.serialization.SerialName
4
- import kotlinx.serialization.Serializable
5
-
6
- @Serializable
7
- data class CreateIdentityRequest(
8
- @SerialName("sub") val sub: String
9
- )
@@ -1,9 +0,0 @@
1
- package ch.procivis.one.core.ubiqu.dataformats
2
-
3
- import kotlinx.serialization.SerialName
4
- import kotlinx.serialization.Serializable
5
-
6
- @Serializable
7
- data class CreateIdentityResponse(
8
- @SerialName("sub") val sub: String
9
- )
@@ -1,10 +0,0 @@
1
- package ch.procivis.one.core.ubiqu.dataformats
2
-
3
- import kotlinx.serialization.SerialName
4
- import kotlinx.serialization.Serializable
5
-
6
- @Serializable
7
- data class RegisterRSEResponse(
8
- @SerialName("nonce") val nonce: String,
9
- @SerialName("puk") val puk: String
10
- )
@@ -1,22 +0,0 @@
1
- import { CredentialDetail } from "./credential";
2
- import { DidListItem } from "./did";
3
- import { HistoryListItem } from "./history";
4
- import { KeyListItem } from "./key";
5
- export interface UnexportableEntities {
6
- credentials: CredentialDetail[];
7
- keys: KeyListItem[];
8
- dids: DidListItem[];
9
- totalCredentials: number;
10
- totalKeys: number;
11
- totalDids: number;
12
- }
13
- export interface BackupCreate {
14
- historyId: HistoryListItem["id"];
15
- file: string;
16
- unexportable: UnexportableEntities;
17
- }
18
- export interface ImportBackupMetadata {
19
- dbVersion: string;
20
- dbHash: string;
21
- createdAt: string;
22
- }
@@ -1 +0,0 @@
1
- export {};