@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.
Files changed (155) hide show
  1. package/README.md +8 -26
  2. package/android/build.gradle +27 -3
  3. package/android/build.gradle_opensource +121 -0
  4. package/android/libs/core-reactnative-compatible-2025.0305.1.aar +0 -0
  5. package/android/src/main/AndroidManifest.xml +5 -2
  6. package/android/src/main/java/ch/procivis/one/core/Deserialize.kt +5 -5
  7. package/android/src/main/java/ch/procivis/one/core/DeserializeSpecific.kt +3 -2
  8. package/android/src/main/java/ch/procivis/one/core/ProcivisOneCoreModule.kt +99 -12
  9. package/android/src/main/java/ch/procivis/one/core/ProcivisOneCorePackage.kt +3 -4
  10. package/android/src/main/java/ch/procivis/one/core/SerializeSpecific.kt +6 -0
  11. package/android/src/main/java/ch/procivis/one/core/ubiqu/PinPadRunner.kt +123 -0
  12. package/android/src/main/java/ch/procivis/one/core/ubiqu/PinPadViewManager.kt +23 -0
  13. package/android/src/main/java/ch/procivis/one/core/ubiqu/PinPadViewManager.kt_opensource +20 -0
  14. package/android/src/main/java/ch/procivis/one/core/ubiqu/PinPadWrapper.kt +396 -0
  15. package/android/src/main/java/ch/procivis/one/core/ubiqu/RegistrationManager.kt +59 -0
  16. package/android/src/main/java/ch/procivis/one/core/ubiqu/TokenManager.kt +48 -0
  17. package/android/src/main/java/ch/procivis/one/core/ubiqu/UbiquKeyStorage.kt +256 -0
  18. package/android/src/main/java/ch/procivis/one/core/ubiqu/UbiquKeyStorage.kt_opensource +51 -0
  19. package/android/src/main/java/ch/procivis/one/core/ubiqu/Util.kt +74 -0
  20. package/android/src/main/java/ch/procivis/one/core/ubiqu/dataformats/CreateIdentityRequest.kt +9 -0
  21. package/android/src/main/java/ch/procivis/one/core/ubiqu/dataformats/CreateIdentityResponse.kt +9 -0
  22. package/android/src/main/java/ch/procivis/one/core/ubiqu/dataformats/RegisterRSEResponse.kt +10 -0
  23. package/core-sdk.json +6 -6
  24. package/dist/index.d.ts +7 -0
  25. package/dist/index.js +10 -4
  26. package/dist/src/cache.d.ts +0 -4
  27. package/dist/src/cache.js +0 -5
  28. package/dist/src/config.d.ts +11 -3
  29. package/dist/src/core.d.ts +8 -4
  30. package/dist/src/core.js +67 -0
  31. package/dist/src/credential.d.ts +1 -0
  32. package/dist/src/credentialSchema.d.ts +5 -2
  33. package/dist/src/credentialSchema.js +2 -0
  34. package/dist/src/history.d.ts +19 -4
  35. package/dist/src/history.js +10 -1
  36. package/dist/src/organisation.d.ts +8 -0
  37. package/dist/src/organisation.js +1 -0
  38. package/dist/src/proof.d.ts +19 -4
  39. package/dist/src/proof.js +13 -5
  40. package/dist/src/trust.d.ts +1 -1
  41. package/dist/src/ubiqu.d.ts +49 -0
  42. package/dist/src/ubiqu.js +69 -0
  43. package/ios/Deserialize.swift +57 -19
  44. package/ios/EventEmitter.swift +79 -0
  45. package/ios/ProcivisOneCoreModule.m +30 -4
  46. package/ios/ProcivisOneCoreModule.swift +141 -14
  47. package/ios/ProcivisRNOneCore.xcodeproj/project.pbxproj +28 -26
  48. package/ios/RSEKeyStorage.swift +587 -0
  49. package/ios/RSEKeyStorage.swift_opensource +49 -0
  50. package/ios/RSEPinPad.swift +74 -0
  51. package/ios/RSEPinPad.swift_opensource +21 -0
  52. package/ios/RSEPinPadManager.m +19 -0
  53. package/ios/Serialize.swift +40 -20
  54. package/ios/UBQKit.xcframework/Info.plist +44 -0
  55. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Assets.car +0 -0
  56. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFCompatibilityMacros.h +37 -0
  57. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFHTTPSessionManager.h +304 -0
  58. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFNetworkReachabilityManager.h +216 -0
  59. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFNetworking.h +41 -0
  60. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFPlainTextRequestSerializer.h +16 -0
  61. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFSecurityPolicy.h +156 -0
  62. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFURLRequestSerialization.h +479 -0
  63. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFURLResponseSerialization.h +310 -0
  64. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/AFURLSessionManager.h +501 -0
  65. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/CardRequestProtocol.h +72 -0
  66. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/Constants.h +222 -0
  67. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/DeviceBindProtocol.h +38 -0
  68. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/DomainSecurityModule.h +43 -0
  69. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/ErrorDomains.h +68 -0
  70. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/FreeAssetProtocol.h +40 -0
  71. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/GDataXMLNode.h +214 -0
  72. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/NSDictionary+Utilities.h +23 -0
  73. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/NSFileManager+Utilities.h +20 -0
  74. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/NSString+Utilities.h +23 -0
  75. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/NSURL+Utilities.h +12 -0
  76. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/ProtocolBase.h +38 -0
  77. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/ResetPinProtocol.h +45 -0
  78. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/Settings.h +120 -0
  79. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequest.h +58 -0
  80. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestBaseProcessor.h +37 -0
  81. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestBindProcessor.h +34 -0
  82. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestNullProcessor.h +28 -0
  83. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestResetPinProcessor.h +35 -0
  84. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestUnlockProcessor.h +31 -0
  85. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQCardRequestUseProcessor.h +34 -0
  86. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQKit-Swift.h +761 -0
  87. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQKit.h +56 -0
  88. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Headers/UBQPacket.h +38 -0
  89. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Info.plist +0 -0
  90. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios.abi.json +89006 -0
  91. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios.private.swiftinterface +1099 -0
  92. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  93. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios.swiftinterface +1099 -0
  94. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/Modules/module.modulemap +11 -0
  95. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/UBQKit +0 -0
  96. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/_CodeSignature/CodeResources +597 -0
  97. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/certs +0 -0
  98. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/checksums +0 -0
  99. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/pinning_pub +0 -0
  100. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/static +0 -0
  101. package/ios/UBQKit.xcframework/ios-arm64/UBQKit.framework/stream +0 -0
  102. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Assets.car +0 -0
  103. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFCompatibilityMacros.h +37 -0
  104. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFHTTPSessionManager.h +304 -0
  105. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFNetworkReachabilityManager.h +216 -0
  106. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFNetworking.h +41 -0
  107. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFPlainTextRequestSerializer.h +16 -0
  108. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFSecurityPolicy.h +156 -0
  109. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFURLRequestSerialization.h +479 -0
  110. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFURLResponseSerialization.h +310 -0
  111. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/AFURLSessionManager.h +501 -0
  112. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/CardRequestProtocol.h +72 -0
  113. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/Constants.h +222 -0
  114. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/DeviceBindProtocol.h +38 -0
  115. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/DomainSecurityModule.h +43 -0
  116. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/ErrorDomains.h +68 -0
  117. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/FreeAssetProtocol.h +40 -0
  118. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/GDataXMLNode.h +214 -0
  119. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/NSDictionary+Utilities.h +23 -0
  120. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/NSFileManager+Utilities.h +20 -0
  121. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/NSString+Utilities.h +23 -0
  122. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/NSURL+Utilities.h +12 -0
  123. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/ProtocolBase.h +38 -0
  124. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/ResetPinProtocol.h +45 -0
  125. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/Settings.h +120 -0
  126. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequest.h +58 -0
  127. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestBaseProcessor.h +37 -0
  128. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestBindProcessor.h +34 -0
  129. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestNullProcessor.h +28 -0
  130. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestResetPinProcessor.h +35 -0
  131. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestUnlockProcessor.h +31 -0
  132. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQCardRequestUseProcessor.h +34 -0
  133. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQKit-Swift.h +1522 -0
  134. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQKit.h +56 -0
  135. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Headers/UBQPacket.h +38 -0
  136. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Info.plist +0 -0
  137. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios-simulator.abi.json +89006 -0
  138. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +1099 -0
  139. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  140. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1099 -0
  141. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +89006 -0
  142. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +1099 -0
  143. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  144. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/UBQKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +1099 -0
  145. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/Modules/module.modulemap +11 -0
  146. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/UBQKit +0 -0
  147. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/_CodeSignature/CodeResources +652 -0
  148. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/certs +0 -0
  149. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/checksums +0 -0
  150. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/pinning_pub +0 -0
  151. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/static +0 -0
  152. package/ios/UBQKit.xcframework/ios-arm64_x86_64-simulator/UBQKit.framework/stream +0 -0
  153. package/ios/Util.swift +1 -0
  154. package/package.json +5 -4
  155. package/react-native-one-core.podspec +4 -5
@@ -0,0 +1,256 @@
1
+ package ch.procivis.one.core.ubiqu
2
+
3
+ import android.annotation.SuppressLint
4
+ import android.util.Base64
5
+ import android.util.Log
6
+ import androidx.appcompat.app.AppCompatActivity
7
+ import ch.procivis.one.core.GeneratedKeyBindingDto
8
+ import ch.procivis.one.core.NativeKeyStorage
9
+ import ch.procivis.one.core.NativeKeyStorageException
10
+ import ch.procivis.one.core.ubiqu.PinPadRunner.RequestType
11
+ import ch.procivis.one.core.ubiqu.PinPadRunner.cancelPinPadFlow
12
+ import ch.procivis.one.core.ubiqu.PinPadRunner.startPinPadFlow
13
+ import ch.procivis.one.core.ubiqu.Util.asyncCallback
14
+ import ch.procivis.one.core.ubiqu.Util.exceptionWrapper
15
+ import ch.procivis.one.core.ubiqu.Util.runOnUIThread
16
+ import ch.procivis.one.core.ubiqu.dataformats.CreateIdentityRequest
17
+ import ch.procivis.one.core.ubiqu.dataformats.RegisterRSEResponse
18
+ import com.facebook.react.bridge.ReactApplicationContext
19
+ import com.ubiqu.eid.sdk.UbqSdk
20
+ import com.ubiqu.eid.sdk.backend.assets.UbqAsset
21
+ import com.ubiqu.eid.sdk.backend.assets.UbqDerivedAsset
22
+ import com.ubiqu.eid.sdk.dataformats.UnsignedData
23
+ import com.ubiqu.eid.sdk.enums.CryptoTypes
24
+ import com.ubiqu.eid.sdk.enums.UbqAssetState
25
+ import com.ubiqu.eid.sdk.requests.UbqRequestFlow
26
+ import com.ubiqu.eid.sdk.utils.Utilities.checkBiometricsAvailable
27
+ import com.ubiqu.eid.sdk.utils.Utilities.checkBiometricsSupported
28
+ import java.util.Arrays
29
+ import java.util.UUID
30
+
31
+ @SuppressLint("LogNotTimber")
32
+ class UbiquKeyStorage(private val context: ReactApplicationContext) : NativeKeyStorage {
33
+ companion object {
34
+ private const val TAG = "ch.procivis.one.core.ubiqu.UbiquKeyStorage"
35
+
36
+ // Procivis secrets for Ubiqu
37
+ private const val CONFIG_FILE_CONTENT = "{" +
38
+ "\"id\": \"26c46847-152e-44e8-b73a-b7d4c51c7074\"," +
39
+ "\"version\": \"0\"," +
40
+ "\"content\": \"OJwoFNrtC73zg2andJ/ABXa6mM16ONVa8N4zDHcjjLUhI21KEV0bHsEiCjYJ0xOiBSEgKrGXQF8oTZfPS2gb7/ObFxRzFwacygL9m0TLVKYM3svK8CE+GF5pP/O+fVy6hvxQphsOTHbj0G7TT6Xd1v0YOCjyL7MMWz9nA8I07O0MGw+WjWds1Ecth7NyvazoOOIRgqavyzvbQpLYatqN/JeK/mbBvsrptzESL3KMc+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ZWC7vO1ZEhp2K8prC/QUJzZr5hQhdeK+VvPkDH5E3PjOGMSZEPSP8F2zeVg4e0gLBYyHdG5MAe6o/No95ZEcolW1Tz+LoFfZy4WV3nJuOQ21CmsOZVBiv8iRHv/OVmD5PEob2l4ts9pmfDTJm1Td7clD/P7BElgjUlHq1Cc//3x112AHdiHgmxu4q1UHXnDVfOfzyMTQYtzVyyQma1hmFFOnHc2mXMnVPHsYKZ90qAHhIHYW8DWvuNqizfsoN55eb8nF4kOo9/XDAlN4syhHA3hIfyP61O+4W3AH8ReDTXcb2EEDNnZ/Q9sJfPxvmQkKPz0XnSTF9Bs+6mQsgt8GF74p53WAkcpM5U8PEn7GBjiTAQTRQBpMCQ/I9GmhOSpD1mzqdkG/ATBb8qYxUNV+703ChDqeBvryV3k8mlNBuouK9+0JDNbSF7qEpCPNg2f+IWiBr3jXy3JutguH+WnjeqNbk0AeZKCGP9tgF1dOHwcoymzC/mx3N38+kSlDopUEz4oWxzYpqjfYmHIQLW94QywRzfOHWYxISBAYZ8UQclk/BkMNwc9m6Y+pHmULRTs+1fU5NSTUoxXfI0SWkgt46459A==\"," +
41
+ "\"signature\": \"ijEe2xRd36VNR7WwAgDqBbt1jpvuqS/NJL6RG+w3x9gWImR/wm/7W3mCHTlEEJ6AS0md2hVZG1pKvZqApAG788xIeVSSDfuMYn57yCu8XPBVloQazGQu4xU9WjbocbKc5VNtu0Sb1us5tBsW1wJt8eQLaPErihEcQ9HW/EaXz1h5s4pKwed/bsuLtH1HdCulLMs1IKhJKuSWzjuaf2l9Tmg2Z354C2mPm8UnXX2TE77PVxCXegIic9U6tDOgelDgGLjKFLbZwkxpuK8kSRPnvSS/K8vkyl+5KxQEwNL6DC+glFWDwB3PpWi/reniqc5QzrBMUgsdMMoPTaWaXi9F8A==\"" +
42
+ "}"
43
+ private const val IDENTITY_SERVICE_URL = "https://api.identity.strongpin.ubiqu-sandbox.com"
44
+ private const val ORGANISATION_ID = "88e5fe80-106e-465c-a29d-1822d3790feb"
45
+ private const val TOKEN_GENERATOR_URL =
46
+ "https://api.token-generator.strongpin.ubiqu-sandbox.com/ubiqu/"
47
+ private const val API_KEY =
48
+ "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczovL2FwaS5pZGVudGl0eS5zdHJvbmdwaW4udWJpcXUtc2FuZGJveC5jb20iLCJpYXQiOjE3MzgzMzY2NTksImp0aSI6Ijc2NTY0M2FhLTI2NzgtNDFjZC04N2RiLThhODhmMzdjZDVhNSIsInNjb3BlIjoic2VydmljZV9hY2NvdW50Iiwic3ViIjoicHJvY2l2aXMtdGVzdCIsImF1ZCI6Imh0dHBzOi8vYXBpLnRva2VuLWdlbmVyYXRvci5zdHJvbmdwaW4udWJpcXUtc2FuZGJveC5jb20vdWJpcXUvIiwidG9rZW5fdHlwZSI6ImFwaV9rZXkifQ.RZtik0TlyoCd8M5BIKCsa0vQVols9eqB3QsvxPK-t5BvQO-v39VZoEQWahQCVQ2OKScEKX_EUeFiK0v1kzTLvKVGIIYuLYIBYJf6QQkc2MWroco54iDPMnK6_8J7EdRXdDhDH3-ukpzRrHwvOfAH50WGNco1U5QSqwvuwoWYWVANBZSBCSOMI4zYrNomEUbo04b-V10VjdHYMcpac14XxSNaxATSEliDVGv_JrAEOXSTs49ebGLT4OOdLHLoAfwu1NylpbvJQnhJYlpudzWf-46FM58uxCYs0DphYMtC6sC0XM1nhvcgli1ngzn-llSyaCQ1TY3PStU8RKxCtfa95A"
49
+
50
+ // ASN.1 prefix used for EdDSA public keys
51
+ private val EDDSA_PREFIX_ASN1 =
52
+ byteArrayOf(0x30, 0x2a, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70, 0x03, 0x21, 0x00)
53
+
54
+ @Volatile
55
+ var listenerCount = 0
56
+ }
57
+
58
+ // ==== NativeKeyStorage interface
59
+ override suspend fun generateKey(keyAlias: String): GeneratedKeyBindingDto {
60
+ return exceptionWrapper {
61
+ ensureUbiquSDKInitialized()
62
+
63
+ // a locked asset can be left out if previous initialization failed,
64
+ // in such case start all over
65
+ if (UbqSdk.assets.isNotEmpty() && UbqSdk.assets[0].state != UbqAssetState.NORMAL) {
66
+ Log.w(TAG, "Invalid asset state: ${UbqSdk.assets[0].state.name}, resetting")
67
+ UbqSdk.reset()
68
+ }
69
+
70
+ if (UbqSdk.assets.isEmpty()) {
71
+ val accessToken = TokenManager.getAccessToken()
72
+ val request = CreateIdentityRequest(UUID.randomUUID().toString())
73
+ val identityResponse = RegistrationManager.createIdentity(accessToken, request)
74
+ val rseResponse =
75
+ RegistrationManager.registerRse(accessToken, identityResponse.body()!!.sub)
76
+ createMainUbqAsset(rseResponse.body()!!)
77
+ }
78
+
79
+ val asset = UbqSdk.assets[0]
80
+ val newKey = asset.createDerivedAsset(context, CryptoTypes.EdDSA_25519)
81
+
82
+ val keyContent = parsePemPubKeyContent(newKey.publicKey)
83
+ if (keyContent.size != 44) {
84
+ throw NativeKeyStorageException.KeyGenerationFailure("Invalid key length")
85
+ }
86
+
87
+ val prefix = Arrays.copyOfRange(keyContent, 0, 12)
88
+ if (!(EDDSA_PREFIX_ASN1 contentEquals prefix)) {
89
+ throw NativeKeyStorageException.KeyGenerationFailure("Invalid key prefix")
90
+ }
91
+
92
+ val publicKey = Arrays.copyOfRange(keyContent, 12, 44)
93
+ val keyReference = newKey.uuid.toString().toByteArray(Charsets.UTF_8)
94
+ return@exceptionWrapper GeneratedKeyBindingDto(keyReference, publicKey)
95
+ }
96
+ }
97
+
98
+ override suspend fun sign(keyReference: ByteArray, message: ByteArray): ByteArray {
99
+ return exceptionWrapper {
100
+ val derivedAssetId = UUID.fromString(keyReference.toString(Charsets.UTF_8))
101
+
102
+ val key =
103
+ getMainUbqAsset().listDerivedAssets(context).find { it.uuid == derivedAssetId }
104
+ ?: throw NativeKeyStorageException.SignatureFailure("Ubiqu key not found")
105
+
106
+ val signature = signWithUbqAsset(key, message)
107
+ ?: throw NativeKeyStorageException.SignatureFailure("No signature provided")
108
+
109
+ return@exceptionWrapper Base64.decode(signature, Base64.DEFAULT)
110
+ }
111
+ }
112
+
113
+ // ==== public interface
114
+ suspend fun changePin(): String? {
115
+ return exceptionWrapper {
116
+ val asset = getMainUbqAsset()
117
+ return@exceptionWrapper runOnUIThread { promise ->
118
+ asset.changePin(onStarted = {
119
+ startFlow(it, RequestType.CHANGE_PIN, promise)
120
+ }, onStartFailure = { e ->
121
+ promise.fail(e)
122
+ })
123
+ }
124
+ }
125
+ }
126
+
127
+ fun getBiometricsSupported(): Boolean {
128
+ return exceptionWrapper {
129
+ return@exceptionWrapper checkBiometricsSupported(context) && checkBiometricsAvailable(
130
+ context
131
+ )
132
+ }
133
+ }
134
+
135
+ suspend fun getBiometricsEnabled(): Boolean {
136
+ return exceptionWrapper {
137
+ return@exceptionWrapper getMainUbqAsset().biometricsEnabled
138
+ }
139
+ }
140
+
141
+ suspend fun enableBiometrics(verifyBiometrics: Boolean): String? {
142
+ return exceptionWrapper {
143
+ val asset = getMainUbqAsset()
144
+ return@exceptionWrapper runOnUIThread { promise ->
145
+ val activity =
146
+ context.currentActivity as? AppCompatActivity
147
+ ?: throw NativeKeyStorageException.Unknown("No activity")
148
+ asset.addBiometrics(activity, verifyBiometrics, onStarted = {
149
+ startFlow(it, RequestType.ADD_BIOMETRICS, promise)
150
+ }, onStartFailure = { e ->
151
+ promise.fail(e)
152
+ })
153
+ }
154
+ }
155
+ }
156
+
157
+ suspend fun disableBiometrics() {
158
+ return exceptionWrapper {
159
+ getMainUbqAsset().removeBiometrics()
160
+ }
161
+ }
162
+
163
+ suspend fun reset() {
164
+ return exceptionWrapper {
165
+ ensureUbiquSDKInitialized()
166
+ UbqSdk.reset()
167
+ }
168
+ }
169
+
170
+ fun resetPinFlow() {
171
+ return exceptionWrapper {
172
+ cancelPinPadFlow()
173
+ }
174
+ }
175
+
176
+ // ==== private methods
177
+ @Volatile
178
+ private var sdkInitialized = false
179
+ private suspend fun ensureUbiquSDKInitialized() {
180
+ if (sdkInitialized) return
181
+ return runOnUIThread { promise ->
182
+ val activity = context.currentActivity
183
+ ?: throw NativeKeyStorageException.Unknown("No current activity")
184
+
185
+ UbqSdk.enableLogging(2)
186
+
187
+ val configFile = CONFIG_FILE_CONTENT.byteInputStream(Charsets.UTF_8)
188
+ UbqSdk.initialize(activity.application, configFile)
189
+
190
+ RegistrationManager.build(IDENTITY_SERVICE_URL, ORGANISATION_ID)
191
+ TokenManager.build(TOKEN_GENERATOR_URL, API_KEY)
192
+
193
+ sdkInitialized = true
194
+ promise.succeed(Unit)
195
+ }
196
+ }
197
+
198
+ private suspend fun createMainUbqAsset(rseResponse: RegisterRSEResponse): String? {
199
+ return runOnUIThread { promise ->
200
+ UbqSdk.subscribe(
201
+ rseResponse.nonce,
202
+ rseResponse.puk,
203
+ onStarted = {
204
+ startFlow(it, RequestType.SUBSCRIBE, promise)
205
+ },
206
+ onStartFailure = { e ->
207
+ promise.fail(e)
208
+ }
209
+ )
210
+ }
211
+ }
212
+
213
+ private suspend fun getMainUbqAsset(): UbqAsset {
214
+ ensureUbiquSDKInitialized()
215
+
216
+ if (UbqSdk.assets.isEmpty()) {
217
+ throw NativeKeyStorageException.Unknown("Ubiqu main asset missing")
218
+ }
219
+ val asset = UbqSdk.assets[0]
220
+ if (asset.state != UbqAssetState.NORMAL) {
221
+ throw NativeKeyStorageException.Unknown("Ubiqu main asset in wrong state: ${asset.state.name}")
222
+ }
223
+ return asset
224
+ }
225
+
226
+ @OptIn(ExperimentalStdlibApi::class)
227
+ private suspend fun signWithUbqAsset(key: UbqDerivedAsset, message: ByteArray): String? {
228
+ return asyncCallback { promise ->
229
+ val hexMessage = UnsignedData(message.toHexString())
230
+ key.use(context, hexMessage, onStarted = {
231
+ startFlow(it, RequestType.TRANSACTION, promise)
232
+ }, onStartFailure = { e ->
233
+ promise.fail(e)
234
+ })
235
+ }
236
+ }
237
+
238
+ private fun parsePemPubKeyContent(pem: String): ByteArray {
239
+ val base64Content = pem.split("\n").filter { part ->
240
+ part != "-----BEGIN PUBLIC KEY-----" && part != "-----END PUBLIC KEY-----"
241
+ }.joinToString(separator = "")
242
+ return Base64.decode(base64Content, Base64.DEFAULT)
243
+ }
244
+
245
+ private fun startFlow(
246
+ flow: UbqRequestFlow,
247
+ requestType: RequestType,
248
+ promise: Util.Promise<String?>
249
+ ) {
250
+ if (listenerCount == 0) {
251
+ promise.fail(NativeKeyStorageException.Unknown("No UI listeners"))
252
+ } else {
253
+ startPinPadFlow(context, flow, requestType, promise)
254
+ }
255
+ }
256
+ }
@@ -0,0 +1,51 @@
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
+ // ==== public interface
24
+ fun changePin(): String? {
25
+ throw NativeKeyStorageException.Unsupported()
26
+ }
27
+
28
+ fun getBiometricsSupported(): Boolean {
29
+ throw NativeKeyStorageException.Unsupported()
30
+ }
31
+
32
+ fun getBiometricsEnabled(): Boolean {
33
+ throw NativeKeyStorageException.Unsupported()
34
+ }
35
+
36
+ fun enableBiometrics(verifyBiometrics: Boolean): String? {
37
+ throw NativeKeyStorageException.Unsupported()
38
+ }
39
+
40
+ fun disableBiometrics() {
41
+ throw NativeKeyStorageException.Unsupported()
42
+ }
43
+
44
+ fun reset() {
45
+ throw NativeKeyStorageException.Unsupported()
46
+ }
47
+
48
+ fun resetPinFlow() {
49
+ throw NativeKeyStorageException.Unsupported()
50
+ }
51
+ }
@@ -0,0 +1,74 @@
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
+ }
@@ -0,0 +1,9 @@
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
+ )
@@ -0,0 +1,9 @@
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
+ )
@@ -0,0 +1,10 @@
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
+ )
package/core-sdk.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "android": {
3
3
  "debug": {
4
- "url": "https://onetfstatestorage.blob.core.windows.net/core-sdk/android/33398/onecore-debug.aar",
5
- "sha1": "06d7af07daa1a98ff1aad434aae6eeabac8531f0"
4
+ "url": "https://onetfstatestorage.blob.core.windows.net/core-sdk/android/41710/onecore-debug.aar",
5
+ "sha1": "c07081741f81c7482148ef2d84ec85d869509563"
6
6
  },
7
7
  "release": {
8
- "url": "https://onetfstatestorage.blob.core.windows.net/core-sdk/android/33398/onecore-release.aar",
9
- "sha1": "f5f0f535ef83e4c10019736fe86367b36c359d33"
8
+ "url": "https://onetfstatestorage.blob.core.windows.net/core-sdk/android/41710/onecore-release.aar",
9
+ "sha1": "75e3b007ef873221f996b96be8bf4471b44d3919"
10
10
  }
11
11
  },
12
12
  "ios": {
13
- "url": "https://onetfstatestorage.blob.core.windows.net/core-sdk/ios/33398/deploy.zip",
14
- "sha1": "66f87203d8b3b36443c2bf6e1f2f577ccdf95907"
13
+ "url": "https://onetfstatestorage.blob.core.windows.net/core-sdk/ios/41710/deploy.zip",
14
+ "sha1": "938ca63f338b0539c9138808be5a4f2a7919a3c3"
15
15
  }
16
16
  }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,13 @@
1
1
  import { ONECore } from "./src/core";
2
+ import * as ubiqu from "./src/ubiqu";
2
3
  export * from "./src/core";
3
4
  export * from "./src/error";
5
+ export declare const Ubiqu: typeof ubiqu;
6
+ export declare namespace Ubiqu {
7
+ type PinEventType = ubiqu.PinEventType;
8
+ type PinFlowType = ubiqu.PinFlowType;
9
+ type PinFlowStage = ubiqu.PinFlowStage;
10
+ }
4
11
  /**
5
12
  * Initialize ONE Core
6
13
  * @note Beware that only one instance can be initialized at a time, repeated calls will fail
package/dist/index.js CHANGED
@@ -1,11 +1,18 @@
1
1
  import { NativeModules } from "react-native";
2
2
  import { OneError } from "./src/error";
3
+ import { interfaceMethodNames } from "./src/core";
4
+ import * as ubiqu from "./src/ubiqu";
3
5
  export * from "./src/core";
4
6
  export * from "./src/error";
7
+ export const Ubiqu = ubiqu;
5
8
  const ONE = NativeModules.ProcivisOneCoreModule;
9
+ // New Architecture bridgeless issue workaround: see https://github.com/facebook/react-native/issues/43221
10
+ interfaceMethodNames.forEach((method) => ONE?.[method]);
6
11
  // Config entities are exposed as serialized JSON, here conversion to structs
7
- const originalGetConfig = ONE.getConfig;
8
- ONE.getConfig = () => originalGetConfig().then((config) => objectMap(config, (entities) => objectMap(entities, (json) => JSON.parse(json))));
12
+ const originalGetConfig = ONE?.getConfig;
13
+ if (originalGetConfig) {
14
+ ONE.getConfig = () => originalGetConfig().then((config) => objectMap(config, (entities) => objectMap(entities, (json) => JSON.parse(json))));
15
+ }
9
16
  /**
10
17
  * Initialize ONE Core
11
18
  * @note Beware that only one instance can be initialized at a time, repeated calls will fail
@@ -47,8 +54,7 @@ function wrapFn(fn, operation) {
47
54
  };
48
55
  // set name on the err handler to display the original function name in callstack
49
56
  Object.defineProperty(errHandler, "name", { value: operation });
50
- // convert undefined parameters to null for proper parameter matching in native code
51
- return fn(...args.map((x) => (x === undefined ? null : x))).catch(errHandler);
57
+ return fn(...args).catch(errHandler);
52
58
  };
53
59
  }
54
60
  function wrapObj(obj) {
@@ -6,7 +6,3 @@ export declare enum CacheType {
6
6
  JSON_SCHEMA = "JSON_SCHEMA",
7
7
  TRUST_LIST = "TRUST_LIST"
8
8
  }
9
- export declare enum BypassCache {
10
- DID_DOCUMENT = "DID_DOCUMENT",
11
- STATUS_LIST_CREDENTIAL = "STATUS_LIST_CREDENTIAL"
12
- }
package/dist/src/cache.js CHANGED
@@ -7,8 +7,3 @@ export var CacheType;
7
7
  CacheType["JSON_SCHEMA"] = "JSON_SCHEMA";
8
8
  CacheType["TRUST_LIST"] = "TRUST_LIST";
9
9
  })(CacheType || (CacheType = {}));
10
- export var BypassCache;
11
- (function (BypassCache) {
12
- BypassCache["DID_DOCUMENT"] = "DID_DOCUMENT";
13
- BypassCache["STATUS_LIST_CREDENTIAL"] = "STATUS_LIST_CREDENTIAL";
14
- })(BypassCache || (BypassCache = {}));
@@ -56,7 +56,7 @@ export interface RevocationCapabilities {
56
56
  operations: RevocationOperationEnum[];
57
57
  }
58
58
  export interface ConfigEntity<Capabilities> {
59
- disabled?: boolean;
59
+ enabled?: boolean;
60
60
  capabilities: Capabilities;
61
61
  display: string;
62
62
  order: number;
@@ -110,14 +110,22 @@ export type DataTypeParams = {
110
110
  type: DataTypeEnum.Object;
111
111
  params?: undefined;
112
112
  };
113
+ export interface IssuanceProtocolCapabilities {
114
+ didMethods: string[];
115
+ }
116
+ export interface VerificationProtocolCapabilities {
117
+ didMethods: string[];
118
+ supportedTransports: string[];
119
+ }
113
120
  export interface Config {
114
121
  format: ConfigEntities<FormatCapabilities>;
115
- exchange: ConfigEntities;
122
+ issuanceProtocol: ConfigEntities<IssuanceProtocolCapabilities>;
123
+ verificationProtocol: ConfigEntities<VerificationProtocolCapabilities>;
116
124
  transport: ConfigEntities;
117
125
  revocation: ConfigEntities<RevocationCapabilities>;
118
126
  did: ConfigEntities<DidCapabilities>;
119
127
  datatype: ConfigEntities<undefined, DataTypeParams>;
120
- keyAlgorithm: ConfigEntities<KeyAlgorithmCapabilities>;
128
+ keyAlgorithm: ConfigEntities<KeyAlgorithmCapabilities, {}>;
121
129
  keyStorage: ConfigEntities<KeyStorageCapabilities>;
122
130
  trustManagement: ConfigEntities;
123
131
  cacheEntities: ConfigEntities;
@@ -9,7 +9,8 @@ import { ItemList } from "./list";
9
9
  import { CreateProofRequest, InvitationResultProofRequest, PresentationDefinition, PresentationDefinitionRequestedCredential, PresentationSubmitCredentialRequest, ProofDetail, ProofListItem, ProofListQuery, ProposeProofResponse, ShareProofRequest, ShareProofResponse } from "./proof";
10
10
  import { CreateProofSchemaRequest, ImportProofSchemaRequest, ProofSchema, ProofSchemaListItem, ProofSchemaListQuery, ShareProofSchemaResponse } from "./proofSchema";
11
11
  import { CreateRemoteTrustEntityRequest, CreateTrustAnchorRequest, CreateTrustEntityRequest, TrustAnchor, TrustAnchorListItem, TrustAnchorListQuery, TrustEntity, TrustEntityListItem, TrustEntityListQuery, UpdateRemoteTrustEntityRequest } from "./trust";
12
- import { BypassCache, CacheType } from "./cache";
12
+ import { CacheType } from "./cache";
13
+ import { CreateOrganisationRequest, UpsertOrganisationRequest } from "./organisation";
13
14
  export * from "./backup";
14
15
  export * from "./cache";
15
16
  export * from "./config";
@@ -19,6 +20,7 @@ export * from "./did";
19
20
  export * from "./history";
20
21
  export * from "./key";
21
22
  export * from "./list";
23
+ export * from "./organisation";
22
24
  export * from "./proof";
23
25
  export * from "./proofSchema";
24
26
  export * from "./trust";
@@ -38,7 +40,8 @@ export interface ResolveJsonLdContextResponse {
38
40
  export interface ONECore {
39
41
  getVersion(): Promise<Version>;
40
42
  getConfig(): Promise<Config>;
41
- createOrganisation(uuid: string | undefined): Promise<string>;
43
+ createOrganisation(request: CreateOrganisationRequest): Promise<string>;
44
+ upsertOrganisation(request: UpsertOrganisationRequest): Promise<void>;
42
45
  generateKey(keyRequest: KeyRequest): Promise<string>;
43
46
  createDid(didRequest: DidRequest): Promise<string>;
44
47
  getDids(query: DidListQuery): Promise<ItemList<DidListItem>>;
@@ -64,14 +67,14 @@ export interface ONECore {
64
67
  shareCredentialSchema(credentialSchemaId: CredentialSchema["id"]): Promise<ShareCredentialSchemaResponse>;
65
68
  getProof(proofId: ProofDetail["id"]): Promise<ProofDetail>;
66
69
  getProofs(query: ProofListQuery): Promise<ItemList<ProofListItem>>;
67
- retractProof(proofId: ProofDetail["id"]): Promise<ProofDetail["id"]>;
70
+ deleteProof(proofId: ProofDetail["id"]): Promise<void>;
68
71
  proposeProof(exchange: string, organisationId: string): Promise<ProposeProofResponse>;
69
72
  createProofSchema(request: CreateProofSchemaRequest): Promise<ProofSchema["id"]>;
70
73
  getProofSchemas(query: ProofSchemaListQuery): Promise<ItemList<ProofSchemaListItem>>;
71
74
  getProofSchema(proofSchemaId: ProofSchema["id"]): Promise<ProofSchema>;
72
75
  deleteProofSchema(proofSchemaId: ProofSchema["id"]): Promise<void>;
73
76
  importProofSchema(request: ImportProofSchemaRequest): Promise<ProofSchema["id"]>;
74
- checkRevocation(credentialIds: Array<CredentialListItem["id"]>, bypassCache: BypassCache[] | undefined): Promise<CredentialRevocationCheckResponse[]>;
77
+ checkRevocation(credentialIds: Array<CredentialListItem["id"]>, forceRefresh: boolean): Promise<CredentialRevocationCheckResponse[]>;
75
78
  createTrustAnchor(request: CreateTrustAnchorRequest): Promise<TrustAnchor["id"]>;
76
79
  deleteTrustAnchor(trustAnchorId: TrustAnchor["id"]): Promise<void>;
77
80
  getTrustAnchor(trustAnchorId: TrustAnchor["id"]): Promise<TrustAnchor>;
@@ -119,3 +122,4 @@ export interface ONECore {
119
122
  */
120
123
  uninitialize(deleteData: boolean): Promise<void>;
121
124
  }
125
+ export declare const interfaceMethodNames: readonly ["getVersion", "getConfig", "createOrganisation", "upsertOrganisation", "generateKey", "createDid", "getDids", "handleInvitation", "holderAcceptCredential", "holderRejectCredential", "getPresentationDefinition", "holderRejectProof", "holderSubmitProof", "getCredentials", "runTask", "checkCertificate", "deleteProofClaims", "getCredential", "deleteCredential", "importCredentialSchema", "getCredentialSchema", "getCredentialSchemas", "deleteCredentialSchema", "createProof", "shareProof", "shareProofSchema", "shareCredentialSchema", "getProof", "getProofs", "deleteProof", "proposeProof", "createProofSchema", "getProofSchemas", "getProofSchema", "deleteProofSchema", "importProofSchema", "checkRevocation", "createTrustAnchor", "deleteTrustAnchor", "getTrustAnchor", "getTrustAnchors", "createTrustEntity", "getTrustEntity", "getTrustEntities", "getTrustEntityByDid", "createRemoteTrustEntity", "getRemoteTrustEntity", "updateRemoteTrustEntity", "getHistory", "getHistoryEntry", "createBackup", "backupInfo", "deleteCache", "unpackBackup", "finalizeImport", "rollbackImport", "resolveJsonldContext", "uninitialize"];