@ledgerhq/device-management-kit 0.0.0-rn-hid-20250221115747 → 0.0.0-rn-hid-sync-onboarding-behavior-20250516114041

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 (904) hide show
  1. package/README.md +61 -8
  2. package/lib/cjs/package.json +22 -23
  3. package/lib/cjs/src/api/DeviceManagementKit.js +1 -1
  4. package/lib/cjs/src/api/DeviceManagementKit.js.map +3 -3
  5. package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
  6. package/lib/cjs/src/api/DeviceManagementKit.test.js.map +3 -3
  7. package/lib/cjs/src/api/DeviceManagementKitBuilder.js +1 -1
  8. package/lib/cjs/src/api/DeviceManagementKitBuilder.js.map +2 -2
  9. package/lib/cjs/src/api/DmkConfig.js +1 -1
  10. package/lib/cjs/src/api/DmkConfig.js.map +1 -1
  11. package/lib/cjs/src/api/command/di/commandModule.js +1 -1
  12. package/lib/cjs/src/api/command/di/commandModule.js.map +3 -3
  13. package/lib/cjs/src/api/command/di/commandModule.test.js +1 -1
  14. package/lib/cjs/src/api/command/di/commandModule.test.js.map +2 -2
  15. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js +2 -0
  16. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js.map +7 -0
  17. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js +2 -0
  18. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js.map +7 -0
  19. package/lib/cjs/src/api/command/os/GetOsVersionCommand.js +1 -1
  20. package/lib/cjs/src/api/command/os/GetOsVersionCommand.js.map +3 -3
  21. package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js +1 -1
  22. package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js.map +3 -3
  23. package/lib/cjs/src/api/command/os/ListLanguagePackCommand.js +2 -0
  24. package/lib/cjs/src/api/command/os/ListLanguagePackCommand.js.map +7 -0
  25. package/lib/cjs/src/api/command/os/ListLanguagePackCommand.test.js +2 -0
  26. package/lib/cjs/src/api/command/os/ListLanguagePackCommand.test.js.map +7 -0
  27. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.js +2 -0
  28. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.js.map +7 -0
  29. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.test.js +2 -0
  30. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.test.js.map +7 -0
  31. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  32. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  33. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.js +1 -1
  34. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.js.map +3 -3
  35. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.test.js +1 -1
  36. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.test.js.map +3 -3
  37. package/lib/cjs/src/api/device/SecureElementFlags.js +2 -0
  38. package/lib/cjs/src/api/device/SecureElementFlags.js.map +7 -0
  39. package/lib/cjs/src/api/device-action/DeviceAction.js +1 -1
  40. package/lib/cjs/src/api/device-action/DeviceAction.js.map +1 -1
  41. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  42. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  43. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  44. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  45. package/lib/cjs/src/api/device-action/di/deviceActionModule.js +1 -1
  46. package/lib/cjs/src/api/device-action/di/deviceActionModule.js.map +3 -3
  47. package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js +1 -1
  48. package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
  49. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +1 -1
  50. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  51. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
  52. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
  53. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
  54. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
  55. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +1 -1
  56. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +1 -1
  57. package/lib/cjs/src/api/device-action/os/Errors.js +1 -1
  58. package/lib/cjs/src/api/device-action/os/Errors.js.map +3 -3
  59. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +2 -0
  60. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +7 -0
  61. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js +2 -0
  62. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js.map +7 -0
  63. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js +2 -0
  64. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js.map +7 -0
  65. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  66. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
  67. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  68. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
  69. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +1 -1
  70. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +2 -2
  71. package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js +1 -1
  72. package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js.map +1 -1
  73. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +2 -0
  74. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +7 -0
  75. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +2 -0
  76. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +7 -0
  77. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js +2 -0
  78. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js.map +7 -0
  79. package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +1 -1
  80. package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js.map +2 -2
  81. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
  82. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +3 -3
  83. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +1 -1
  84. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +3 -3
  85. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  86. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +2 -2
  87. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +2 -0
  88. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +7 -0
  89. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +2 -0
  90. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +7 -0
  91. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js +2 -0
  92. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js.map +7 -0
  93. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
  94. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
  95. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  96. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
  97. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +1 -1
  98. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js +2 -0
  99. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +7 -0
  100. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +2 -0
  101. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +7 -0
  102. package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.js +2 -0
  103. package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.js.map +7 -0
  104. package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.test.js +2 -0
  105. package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.test.js.map +7 -0
  106. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js +2 -0
  107. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js.map +7 -0
  108. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js +2 -0
  109. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +7 -0
  110. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.js +2 -0
  111. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.js.map +7 -0
  112. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.test.js +2 -0
  113. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.test.js.map +7 -0
  114. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
  115. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
  116. package/lib/cjs/src/api/device-model/model/DeviceModel.js +1 -1
  117. package/lib/cjs/src/api/device-model/model/DeviceModel.js.map +2 -2
  118. package/lib/cjs/src/api/device-model/model/DeviceModel.stub.js +1 -1
  119. package/lib/cjs/src/api/device-model/model/DeviceModel.stub.js.map +2 -2
  120. package/lib/cjs/src/api/device-session/DeviceSessionState.js +1 -1
  121. package/lib/cjs/src/api/device-session/DeviceSessionState.js.map +2 -2
  122. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.js +2 -0
  123. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.js.map +7 -0
  124. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js +2 -0
  125. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js.map +7 -0
  126. package/lib/cjs/src/api/index.js +1 -1
  127. package/lib/cjs/src/api/index.js.map +3 -3
  128. package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
  129. package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +3 -3
  130. package/lib/cjs/src/api/secure-channel/constants.js +2 -0
  131. package/lib/cjs/src/api/secure-channel/constants.js.map +7 -0
  132. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +2 -0
  133. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +7 -0
  134. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js +2 -0
  135. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js.map +7 -0
  136. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js +2 -0
  137. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js.map +7 -0
  138. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +2 -0
  139. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +7 -0
  140. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.js +2 -0
  141. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.js.map +7 -0
  142. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js +2 -0
  143. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js.map +7 -0
  144. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +2 -0
  145. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +7 -0
  146. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js +2 -0
  147. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js.map +7 -0
  148. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js +2 -0
  149. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +7 -0
  150. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +2 -0
  151. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +7 -0
  152. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.js +2 -0
  153. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.js.map +7 -0
  154. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js +2 -0
  155. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js.map +7 -0
  156. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +2 -0
  157. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +7 -0
  158. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +2 -0
  159. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +7 -0
  160. package/lib/cjs/src/api/secure-channel/task/types.js +2 -0
  161. package/lib/cjs/src/api/secure-channel/task/types.js.map +7 -0
  162. package/lib/cjs/src/api/secure-channel/types.js +2 -0
  163. package/lib/cjs/src/api/secure-channel/types.js.map +7 -0
  164. package/lib/cjs/src/api/secure-channel/utils.js +2 -0
  165. package/lib/cjs/src/api/secure-channel/utils.js.map +7 -0
  166. package/lib/cjs/src/api/secure-channel/utils.test.js +2 -0
  167. package/lib/cjs/src/api/secure-channel/utils.test.js.map +7 -0
  168. package/lib/cjs/src/api/transport/model/DeviceConnection.js +1 -1
  169. package/lib/cjs/src/api/transport/model/DeviceConnection.js.map +1 -1
  170. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
  171. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
  172. package/lib/cjs/src/api/transport/model/Errors.js +1 -1
  173. package/lib/cjs/src/api/transport/model/Errors.js.map +3 -3
  174. package/lib/cjs/src/api/transport/model/Transport.js.map +1 -1
  175. package/lib/cjs/src/api/transport/model/TransportConnectedDevice.test.js +1 -1
  176. package/lib/cjs/src/api/transport/model/TransportConnectedDevice.test.js.map +3 -3
  177. package/lib/cjs/src/api/types.js +1 -1
  178. package/lib/cjs/src/api/types.js.map +1 -1
  179. package/lib/cjs/src/di.js +1 -1
  180. package/lib/cjs/src/di.js.map +2 -2
  181. package/lib/cjs/src/internal/config/di/configModule.js +1 -1
  182. package/lib/cjs/src/internal/config/di/configModule.js.map +3 -3
  183. package/lib/cjs/src/internal/config/di/configModule.test.js +1 -1
  184. package/lib/cjs/src/internal/config/di/configModule.test.js.map +2 -2
  185. package/lib/cjs/src/internal/device-model/di/deviceModelModule.js +1 -1
  186. package/lib/cjs/src/internal/device-model/di/deviceModelModule.js.map +3 -3
  187. package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js +1 -1
  188. package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
  189. package/lib/cjs/src/internal/device-session/data/ApduResponseConst.js +1 -1
  190. package/lib/cjs/src/internal/device-session/data/ApduResponseConst.js.map +3 -3
  191. package/lib/cjs/src/internal/device-session/data/DeviceSessionRefresherConst.js +1 -1
  192. package/lib/cjs/src/internal/device-session/data/DeviceSessionRefresherConst.js.map +3 -3
  193. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +1 -1
  194. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  195. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
  196. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
  197. package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js +1 -1
  198. package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js.map +2 -2
  199. package/lib/cjs/src/internal/device-session/model/DevicePinger.js +2 -0
  200. package/lib/cjs/src/internal/device-session/model/DevicePinger.js.map +7 -0
  201. package/lib/cjs/src/internal/device-session/model/DevicePinger.test.js +2 -0
  202. package/lib/cjs/src/internal/device-session/model/DevicePinger.test.js.map +7 -0
  203. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  204. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
  205. package/lib/cjs/src/internal/device-session/model/DeviceSession.stub.js +1 -1
  206. package/lib/cjs/src/internal/device-session/model/DeviceSession.stub.js.map +3 -3
  207. package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.js +2 -0
  208. package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.js.map +7 -0
  209. package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.test.js +2 -0
  210. package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.test.js.map +7 -0
  211. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
  212. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js.map +3 -3
  213. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
  214. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +3 -3
  215. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js +2 -0
  216. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js.map +7 -0
  217. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js +2 -0
  218. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +7 -0
  219. package/lib/cjs/src/internal/device-session/model/Frame.js +1 -1
  220. package/lib/cjs/src/internal/device-session/model/Frame.js.map +3 -3
  221. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
  222. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
  223. package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
  224. package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +3 -3
  225. package/lib/cjs/src/internal/device-session/service/MutexService.js +2 -0
  226. package/lib/cjs/src/internal/device-session/service/MutexService.js.map +7 -0
  227. package/lib/cjs/src/internal/device-session/service/MutexService.test.js +2 -0
  228. package/lib/cjs/src/internal/device-session/service/MutexService.test.js.map +7 -0
  229. package/lib/cjs/src/internal/device-session/service/RefresherService.js +2 -0
  230. package/lib/cjs/src/internal/device-session/service/RefresherService.js.map +7 -0
  231. package/lib/cjs/src/internal/device-session/service/RefresherService.test.js +2 -0
  232. package/lib/cjs/src/internal/device-session/service/RefresherService.test.js.map +7 -0
  233. package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.test.js +1 -1
  234. package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.test.js.map +3 -3
  235. package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js +1 -1
  236. package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js.map +3 -3
  237. package/lib/cjs/src/internal/device-session/utils/deviceSessionUtils.js +2 -0
  238. package/lib/cjs/src/internal/device-session/utils/deviceSessionUtils.js.map +7 -0
  239. package/lib/cjs/src/internal/discovery/di/discoveryModule.js +1 -1
  240. package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +3 -3
  241. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
  242. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
  243. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
  244. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
  245. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  246. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
  247. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
  248. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +3 -3
  249. package/lib/cjs/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js +1 -1
  250. package/lib/cjs/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js.map +3 -3
  251. package/lib/cjs/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js +1 -1
  252. package/lib/cjs/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js.map +3 -3
  253. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js +1 -1
  254. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js.map +3 -3
  255. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js +1 -1
  256. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js.map +3 -3
  257. package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js +1 -1
  258. package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js.map +3 -3
  259. package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js +1 -1
  260. package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js.map +3 -3
  261. package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.js +1 -1
  262. package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.js.map +2 -2
  263. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.js +1 -1
  264. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.js.map +3 -3
  265. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  266. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
  267. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js +1 -1
  268. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
  269. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
  270. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
  271. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  272. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  273. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  274. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  275. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js +1 -1
  276. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js.map +1 -1
  277. package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js +1 -1
  278. package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
  279. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  280. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  281. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js +1 -1
  282. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  283. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  284. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  285. package/lib/cjs/src/internal/manager-api/di/managerApiTypes.js +1 -1
  286. package/lib/cjs/src/internal/manager-api/di/managerApiTypes.js.map +2 -2
  287. package/lib/cjs/src/internal/manager-api/model/Application.js +1 -1
  288. package/lib/cjs/src/internal/manager-api/model/Application.js.map +1 -1
  289. package/lib/cjs/src/internal/manager-api/model/Const.js +1 -1
  290. package/lib/cjs/src/internal/manager-api/model/Const.js.map +3 -3
  291. package/lib/cjs/src/internal/manager-api/model/Firmware.js +1 -1
  292. package/lib/cjs/src/internal/manager-api/model/Firmware.js.map +1 -1
  293. package/lib/cjs/src/internal/manager-api/model/Language.js +2 -0
  294. package/lib/cjs/src/internal/manager-api/model/Language.js.map +7 -0
  295. package/lib/cjs/src/internal/manager-api/model/Params.js +2 -0
  296. package/lib/cjs/src/internal/manager-api/model/Params.js.map +7 -0
  297. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  298. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  299. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  300. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  301. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js +1 -1
  302. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js.map +1 -1
  303. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.js +2 -0
  304. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.js.map +7 -0
  305. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.test.js +2 -0
  306. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.test.js.map +7 -0
  307. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js +1 -1
  308. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js.map +2 -2
  309. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js +1 -1
  310. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js.map +2 -2
  311. package/lib/cjs/src/internal/secure-channel/data/SecureChannelDataSource.js.map +1 -1
  312. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js +1 -1
  313. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
  314. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
  315. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
  316. package/lib/cjs/src/internal/secure-channel/model/Errors.js +1 -1
  317. package/lib/cjs/src/internal/secure-channel/model/Errors.js.map +3 -3
  318. package/lib/cjs/src/internal/secure-channel/model/Params.js +1 -1
  319. package/lib/cjs/src/internal/secure-channel/model/Params.js.map +1 -1
  320. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js +1 -1
  321. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +3 -3
  322. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +1 -1
  323. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +3 -3
  324. package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js +1 -1
  325. package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js.map +1 -1
  326. package/lib/cjs/src/internal/send/di/sendModule.js +1 -1
  327. package/lib/cjs/src/internal/send/di/sendModule.js.map +3 -3
  328. package/lib/cjs/src/internal/send/di/sendModule.test.js +1 -1
  329. package/lib/cjs/src/internal/send/di/sendModule.test.js.map +2 -2
  330. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js +1 -1
  331. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
  332. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
  333. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js.map +3 -3
  334. package/lib/cjs/src/internal/transport/di/transportModule.js +1 -1
  335. package/lib/cjs/src/internal/transport/di/transportModule.js.map +3 -3
  336. package/lib/cjs/src/internal/transport/di/transportModule.test.js +1 -1
  337. package/lib/cjs/src/internal/transport/di/transportModule.test.js.map +2 -2
  338. package/lib/esm/package.json +22 -23
  339. package/lib/esm/src/api/DeviceManagementKit.js +1 -1
  340. package/lib/esm/src/api/DeviceManagementKit.js.map +3 -3
  341. package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
  342. package/lib/esm/src/api/DeviceManagementKit.test.js.map +3 -3
  343. package/lib/esm/src/api/DeviceManagementKitBuilder.js +1 -1
  344. package/lib/esm/src/api/DeviceManagementKitBuilder.js.map +3 -3
  345. package/lib/esm/src/api/command/di/commandModule.js +1 -1
  346. package/lib/esm/src/api/command/di/commandModule.js.map +3 -3
  347. package/lib/esm/src/api/command/di/commandModule.test.js +1 -1
  348. package/lib/esm/src/api/command/di/commandModule.test.js.map +2 -2
  349. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js +2 -0
  350. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js.map +7 -0
  351. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js +2 -0
  352. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js.map +7 -0
  353. package/lib/esm/src/api/command/os/GetOsVersionCommand.js +1 -1
  354. package/lib/esm/src/api/command/os/GetOsVersionCommand.js.map +3 -3
  355. package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js +1 -1
  356. package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js.map +3 -3
  357. package/lib/esm/src/api/command/os/ListLanguagePackCommand.js +2 -0
  358. package/lib/esm/src/api/command/os/ListLanguagePackCommand.js.map +7 -0
  359. package/lib/esm/src/api/command/os/ListLanguagePackCommand.test.js +2 -0
  360. package/lib/esm/src/api/command/os/ListLanguagePackCommand.test.js.map +7 -0
  361. package/lib/esm/src/api/command/os/SecureElementFlagsParser.js +2 -0
  362. package/lib/esm/src/api/command/os/SecureElementFlagsParser.js.map +7 -0
  363. package/lib/esm/src/api/command/os/SecureElementFlagsParser.test.js +2 -0
  364. package/lib/esm/src/api/command/os/SecureElementFlagsParser.test.js.map +7 -0
  365. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  366. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  367. package/lib/esm/src/api/command/use-case/SendCommandUseCase.js +1 -1
  368. package/lib/esm/src/api/command/use-case/SendCommandUseCase.js.map +3 -3
  369. package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js +1 -1
  370. package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js.map +3 -3
  371. package/lib/esm/src/api/device/SecureElementFlags.js +1 -0
  372. package/lib/esm/src/api/device/SecureElementFlags.js.map +7 -0
  373. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  374. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  375. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  376. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  377. package/lib/esm/src/api/device-action/di/deviceActionModule.js +1 -1
  378. package/lib/esm/src/api/device-action/di/deviceActionModule.js.map +3 -3
  379. package/lib/esm/src/api/device-action/di/deviceActionModule.test.js +1 -1
  380. package/lib/esm/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
  381. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
  382. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  383. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
  384. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
  385. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
  386. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
  387. package/lib/esm/src/api/device-action/os/Errors.js +1 -1
  388. package/lib/esm/src/api/device-action/os/Errors.js.map +3 -3
  389. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +2 -0
  390. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +7 -0
  391. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js +2 -0
  392. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js.map +7 -0
  393. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/types.js +1 -0
  394. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/types.js.map +7 -0
  395. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  396. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
  397. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  398. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
  399. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +1 -1
  400. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +2 -2
  401. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +2 -0
  402. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +7 -0
  403. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +2 -0
  404. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +7 -0
  405. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -0
  406. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js.map +7 -0
  407. package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +1 -1
  408. package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js.map +2 -2
  409. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
  410. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +3 -3
  411. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +1 -1
  412. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +3 -3
  413. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  414. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +2 -2
  415. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +2 -0
  416. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +7 -0
  417. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +2 -0
  418. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +7 -0
  419. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js +1 -0
  420. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js.map +7 -0
  421. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
  422. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
  423. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  424. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
  425. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js +2 -0
  426. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +7 -0
  427. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +2 -0
  428. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +7 -0
  429. package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.js +2 -0
  430. package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.js.map +7 -0
  431. package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.test.js +2 -0
  432. package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.test.js.map +7 -0
  433. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js +2 -0
  434. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js.map +7 -0
  435. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js +2 -0
  436. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +7 -0
  437. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.js +2 -0
  438. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.js.map +7 -0
  439. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.test.js +2 -0
  440. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.test.js.map +7 -0
  441. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
  442. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
  443. package/lib/esm/src/api/device-model/model/DeviceModel.js +1 -1
  444. package/lib/esm/src/api/device-model/model/DeviceModel.js.map +2 -2
  445. package/lib/esm/src/api/device-model/model/DeviceModel.stub.js +1 -1
  446. package/lib/esm/src/api/device-model/model/DeviceModel.stub.js.map +2 -2
  447. package/lib/esm/src/api/device-session/DeviceSessionState.js +1 -1
  448. package/lib/esm/src/api/device-session/DeviceSessionState.js.map +2 -2
  449. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.js +2 -0
  450. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.js.map +7 -0
  451. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js +2 -0
  452. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js.map +7 -0
  453. package/lib/esm/src/api/index.js +1 -1
  454. package/lib/esm/src/api/index.js.map +3 -3
  455. package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
  456. package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +3 -3
  457. package/lib/esm/src/api/secure-channel/constants.js +2 -0
  458. package/lib/esm/src/api/secure-channel/constants.js.map +7 -0
  459. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +2 -0
  460. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +7 -0
  461. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js +2 -0
  462. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js.map +7 -0
  463. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/types.js +1 -0
  464. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/types.js.map +7 -0
  465. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +2 -0
  466. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +7 -0
  467. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.js +2 -0
  468. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.js.map +7 -0
  469. package/lib/esm/src/api/secure-channel/device-action/InstallApp/types.js +1 -0
  470. package/lib/esm/src/api/secure-channel/device-action/InstallApp/types.js.map +7 -0
  471. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +2 -0
  472. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +7 -0
  473. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js +2 -0
  474. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js.map +7 -0
  475. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js +2 -0
  476. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +7 -0
  477. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +2 -0
  478. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +7 -0
  479. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.js +2 -0
  480. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.js.map +7 -0
  481. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/types.js +1 -0
  482. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/types.js.map +7 -0
  483. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +2 -0
  484. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +7 -0
  485. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +2 -0
  486. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +7 -0
  487. package/lib/esm/src/api/secure-channel/task/types.js +2 -0
  488. package/lib/esm/src/api/secure-channel/task/types.js.map +7 -0
  489. package/lib/esm/src/api/secure-channel/types.js +1 -0
  490. package/lib/esm/src/api/secure-channel/types.js.map +7 -0
  491. package/lib/esm/src/api/secure-channel/utils.js +2 -0
  492. package/lib/esm/src/api/secure-channel/utils.js.map +7 -0
  493. package/lib/esm/src/api/secure-channel/utils.test.js +2 -0
  494. package/lib/esm/src/api/secure-channel/utils.test.js.map +7 -0
  495. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
  496. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
  497. package/lib/esm/src/api/transport/model/Errors.js +1 -1
  498. package/lib/esm/src/api/transport/model/Errors.js.map +3 -3
  499. package/lib/esm/src/api/transport/model/TransportConnectedDevice.test.js +1 -1
  500. package/lib/esm/src/api/transport/model/TransportConnectedDevice.test.js.map +3 -3
  501. package/lib/esm/src/di.js +1 -1
  502. package/lib/esm/src/di.js.map +3 -3
  503. package/lib/esm/src/internal/config/di/configModule.js +1 -1
  504. package/lib/esm/src/internal/config/di/configModule.js.map +3 -3
  505. package/lib/esm/src/internal/config/di/configModule.test.js +1 -1
  506. package/lib/esm/src/internal/config/di/configModule.test.js.map +2 -2
  507. package/lib/esm/src/internal/device-model/di/deviceModelModule.js +1 -1
  508. package/lib/esm/src/internal/device-model/di/deviceModelModule.js.map +3 -3
  509. package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js +1 -1
  510. package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
  511. package/lib/esm/src/internal/device-session/data/ApduResponseConst.js +1 -1
  512. package/lib/esm/src/internal/device-session/data/ApduResponseConst.js.map +3 -3
  513. package/lib/esm/src/internal/device-session/data/DeviceSessionRefresherConst.js +1 -1
  514. package/lib/esm/src/internal/device-session/data/DeviceSessionRefresherConst.js.map +3 -3
  515. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +1 -1
  516. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  517. package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
  518. package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
  519. package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js +1 -1
  520. package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js.map +2 -2
  521. package/lib/esm/src/internal/device-session/model/DevicePinger.js +2 -0
  522. package/lib/esm/src/internal/device-session/model/DevicePinger.js.map +7 -0
  523. package/lib/esm/src/internal/device-session/model/DevicePinger.test.js +2 -0
  524. package/lib/esm/src/internal/device-session/model/DevicePinger.test.js.map +7 -0
  525. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  526. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
  527. package/lib/esm/src/internal/device-session/model/DeviceSession.stub.js +1 -1
  528. package/lib/esm/src/internal/device-session/model/DeviceSession.stub.js.map +3 -3
  529. package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.js +2 -0
  530. package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.js.map +7 -0
  531. package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.test.js +2 -0
  532. package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.test.js.map +7 -0
  533. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
  534. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js.map +3 -3
  535. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
  536. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +3 -3
  537. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js +2 -0
  538. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js.map +7 -0
  539. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js +2 -0
  540. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +7 -0
  541. package/lib/esm/src/internal/device-session/model/Frame.js +1 -1
  542. package/lib/esm/src/internal/device-session/model/Frame.js.map +3 -3
  543. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
  544. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
  545. package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
  546. package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +3 -3
  547. package/lib/esm/src/internal/device-session/service/MutexService.js +2 -0
  548. package/lib/esm/src/internal/device-session/service/MutexService.js.map +7 -0
  549. package/lib/esm/src/internal/device-session/service/MutexService.test.js +2 -0
  550. package/lib/esm/src/internal/device-session/service/MutexService.test.js.map +7 -0
  551. package/lib/esm/src/internal/device-session/service/RefresherService.js +2 -0
  552. package/lib/esm/src/internal/device-session/service/RefresherService.js.map +7 -0
  553. package/lib/esm/src/internal/device-session/service/RefresherService.test.js +2 -0
  554. package/lib/esm/src/internal/device-session/service/RefresherService.test.js.map +7 -0
  555. package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.test.js +1 -1
  556. package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.test.js.map +3 -3
  557. package/lib/esm/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js +1 -1
  558. package/lib/esm/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js.map +3 -3
  559. package/lib/esm/src/internal/device-session/utils/deviceSessionUtils.js +2 -0
  560. package/lib/esm/src/internal/device-session/utils/deviceSessionUtils.js.map +7 -0
  561. package/lib/esm/src/internal/discovery/di/discoveryModule.js +1 -1
  562. package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +3 -3
  563. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
  564. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
  565. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
  566. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
  567. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  568. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
  569. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
  570. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +3 -3
  571. package/lib/esm/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js +1 -1
  572. package/lib/esm/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js.map +3 -3
  573. package/lib/esm/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js +1 -1
  574. package/lib/esm/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js.map +3 -3
  575. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js +1 -1
  576. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js.map +3 -3
  577. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js +1 -1
  578. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js.map +3 -3
  579. package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js +1 -1
  580. package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js.map +3 -3
  581. package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js +1 -1
  582. package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js.map +3 -3
  583. package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.js +1 -1
  584. package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.js.map +2 -2
  585. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.js +1 -1
  586. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.js.map +3 -3
  587. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  588. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
  589. package/lib/esm/src/internal/logger-publisher/di/loggerModule.js +1 -1
  590. package/lib/esm/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
  591. package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
  592. package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
  593. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  594. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  595. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  596. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  597. package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js +1 -1
  598. package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
  599. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  600. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  601. package/lib/esm/src/internal/manager-api/di/managerApiModule.js +1 -1
  602. package/lib/esm/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  603. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  604. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  605. package/lib/esm/src/internal/manager-api/di/managerApiTypes.js +1 -1
  606. package/lib/esm/src/internal/manager-api/di/managerApiTypes.js.map +2 -2
  607. package/lib/esm/src/internal/manager-api/model/Application.js +1 -1
  608. package/lib/esm/src/internal/manager-api/model/Application.js.map +1 -1
  609. package/lib/esm/src/internal/manager-api/model/Const.js +1 -1
  610. package/lib/esm/src/internal/manager-api/model/Const.js.map +3 -3
  611. package/lib/esm/src/internal/manager-api/model/Language.js +1 -0
  612. package/lib/esm/src/internal/manager-api/model/Language.js.map +7 -0
  613. package/lib/esm/src/internal/manager-api/model/Params.js +1 -0
  614. package/lib/esm/src/internal/manager-api/model/Params.js.map +7 -0
  615. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  616. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  617. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  618. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  619. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.js +2 -0
  620. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.js.map +7 -0
  621. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.test.js +2 -0
  622. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.test.js.map +7 -0
  623. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js +1 -1
  624. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js.map +2 -2
  625. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js +1 -1
  626. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js.map +2 -2
  627. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js +1 -1
  628. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
  629. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
  630. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
  631. package/lib/esm/src/internal/secure-channel/model/Errors.js +1 -1
  632. package/lib/esm/src/internal/secure-channel/model/Errors.js.map +3 -3
  633. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js +1 -1
  634. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +3 -3
  635. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +1 -1
  636. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +3 -3
  637. package/lib/esm/src/internal/send/di/sendModule.js +1 -1
  638. package/lib/esm/src/internal/send/di/sendModule.js.map +3 -3
  639. package/lib/esm/src/internal/send/di/sendModule.test.js +1 -1
  640. package/lib/esm/src/internal/send/di/sendModule.test.js.map +2 -2
  641. package/lib/esm/src/internal/send/use-case/SendApduUseCase.js +1 -1
  642. package/lib/esm/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
  643. package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
  644. package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js.map +3 -3
  645. package/lib/esm/src/internal/transport/di/transportModule.js +1 -1
  646. package/lib/esm/src/internal/transport/di/transportModule.js.map +3 -3
  647. package/lib/esm/src/internal/transport/di/transportModule.test.js +1 -1
  648. package/lib/esm/src/internal/transport/di/transportModule.test.js.map +2 -2
  649. package/lib/types/src/api/DeviceManagementKit.d.ts +26 -10
  650. package/lib/types/src/api/DeviceManagementKit.d.ts.map +1 -1
  651. package/lib/types/src/api/DeviceManagementKitBuilder.d.ts.map +1 -1
  652. package/lib/types/src/api/DmkConfig.d.ts +2 -0
  653. package/lib/types/src/api/DmkConfig.d.ts.map +1 -1
  654. package/lib/types/src/api/apdu/utils/ApduBuilder.d.ts.map +1 -1
  655. package/lib/types/src/api/apdu/utils/ApduParser.d.ts.map +1 -1
  656. package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts.map +1 -1
  657. package/lib/types/src/api/command/di/commandModule.d.ts.map +1 -1
  658. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts +16 -0
  659. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts.map +1 -0
  660. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.test.d.ts +2 -0
  661. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.test.d.ts.map +1 -0
  662. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts +38 -4
  663. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts.map +1 -1
  664. package/lib/types/src/api/command/os/ListLanguagePackCommand.d.ts +24 -0
  665. package/lib/types/src/api/command/os/ListLanguagePackCommand.d.ts.map +1 -0
  666. package/lib/types/src/api/command/os/ListLanguagePackCommand.test.d.ts +2 -0
  667. package/lib/types/src/api/command/os/ListLanguagePackCommand.test.d.ts.map +1 -0
  668. package/lib/types/src/api/command/os/SecureElementFlagsParser.d.ts +43 -0
  669. package/lib/types/src/api/command/os/SecureElementFlagsParser.d.ts.map +1 -0
  670. package/lib/types/src/api/command/os/SecureElementFlagsParser.test.d.ts +2 -0
  671. package/lib/types/src/api/command/os/SecureElementFlagsParser.test.d.ts.map +1 -0
  672. package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
  673. package/lib/types/src/api/command/use-case/SendCommandUseCase.d.ts +5 -1
  674. package/lib/types/src/api/command/use-case/SendCommandUseCase.d.ts.map +1 -1
  675. package/lib/types/src/api/command/utils/CommandErrors.d.ts.map +1 -1
  676. package/lib/types/src/api/device/SecureElementFlags.d.ts +41 -0
  677. package/lib/types/src/api/device/SecureElementFlags.d.ts.map +1 -0
  678. package/lib/types/src/api/device-action/DeviceAction.d.ts +4 -1
  679. package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
  680. package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
  681. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts +9 -0
  682. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
  683. package/lib/types/src/api/device-action/di/deviceActionModule.d.ts.map +1 -1
  684. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +3 -2
  685. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts.map +1 -1
  686. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts.map +1 -1
  687. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts +1 -0
  688. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts.map +1 -1
  689. package/lib/types/src/api/device-action/os/Errors.d.ts +10 -0
  690. package/lib/types/src/api/device-action/os/Errors.d.ts.map +1 -1
  691. package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts +58 -0
  692. package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts.map +1 -0
  693. package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.d.ts +2 -0
  694. package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.d.ts.map +1 -0
  695. package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts +27 -0
  696. package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts.map +1 -0
  697. package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts.map +1 -1
  698. package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts +3 -4
  699. package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts.map +1 -1
  700. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts +40 -0
  701. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts.map +1 -0
  702. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.d.ts +2 -0
  703. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.d.ts.map +1 -0
  704. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts +64 -0
  705. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts.map +1 -0
  706. package/lib/types/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.d.ts +1 -1
  707. package/lib/types/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.d.ts.map +1 -1
  708. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts +15 -0
  709. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts.map +1 -0
  710. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.d.ts +2 -0
  711. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.d.ts.map +1 -0
  712. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts +25 -0
  713. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts.map +1 -0
  714. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.d.ts.map +1 -1
  715. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts +1 -0
  716. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts.map +1 -1
  717. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts +30 -0
  718. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts.map +1 -0
  719. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.test.d.ts +2 -0
  720. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.test.d.ts.map +1 -0
  721. package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.d.ts +31 -0
  722. package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.d.ts.map +1 -0
  723. package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.test.d.ts +2 -0
  724. package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.test.d.ts.map +1 -0
  725. package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts +18 -0
  726. package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts.map +1 -0
  727. package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.test.d.ts +2 -0
  728. package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.test.d.ts.map +1 -0
  729. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.d.ts +21 -0
  730. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.d.ts.map +1 -0
  731. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.test.d.ts +2 -0
  732. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.test.d.ts.map +1 -0
  733. package/lib/types/src/api/device-model/data/StaticDeviceModelDataSource.d.ts.map +1 -1
  734. package/lib/types/src/api/device-model/model/DeviceModel.d.ts +2 -0
  735. package/lib/types/src/api/device-model/model/DeviceModel.d.ts.map +1 -1
  736. package/lib/types/src/api/device-model/model/DeviceModel.stub.d.ts.map +1 -1
  737. package/lib/types/src/api/device-session/DeviceSessionState.d.ts +97 -0
  738. package/lib/types/src/api/device-session/DeviceSessionState.d.ts.map +1 -1
  739. package/lib/types/src/api/device-session/service/DefaultApduReceiverService.stub.d.ts.map +1 -1
  740. package/lib/types/src/api/device-session/service/DefaultApduSenderService.stub.d.ts.map +1 -1
  741. package/lib/types/src/api/device-session/use-case/{ToggleDeviceSessionRefresher.d.ts → DisableDeviceSessionRefresher.d.ts} +6 -6
  742. package/lib/types/src/api/device-session/use-case/DisableDeviceSessionRefresher.d.ts.map +1 -0
  743. package/lib/types/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.d.ts +2 -0
  744. package/lib/types/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.d.ts.map +1 -0
  745. package/lib/types/src/api/index.d.ts +10 -2
  746. package/lib/types/src/api/index.d.ts.map +1 -1
  747. package/lib/types/src/api/secure-channel/constants.d.ts +2 -0
  748. package/lib/types/src/api/secure-channel/constants.d.ts.map +1 -0
  749. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts +8 -0
  750. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts.map +1 -0
  751. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.d.ts +2 -0
  752. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.d.ts.map +1 -0
  753. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts +48 -0
  754. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts.map +1 -0
  755. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts +8 -0
  756. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts.map +1 -0
  757. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.d.ts +2 -0
  758. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.d.ts.map +1 -0
  759. package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts +44 -0
  760. package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts.map +1 -0
  761. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts +8 -0
  762. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts.map +1 -0
  763. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.d.ts +2 -0
  764. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.d.ts.map +1 -0
  765. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts +57 -0
  766. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts.map +1 -0
  767. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.d.ts +8 -0
  768. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.d.ts.map +1 -0
  769. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.d.ts +2 -0
  770. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.d.ts.map +1 -0
  771. package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts +41 -0
  772. package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts.map +1 -0
  773. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts +23 -0
  774. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -0
  775. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.test.d.ts +2 -0
  776. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.test.d.ts.map +1 -0
  777. package/lib/types/src/api/secure-channel/task/types.d.ts +105 -0
  778. package/lib/types/src/api/secure-channel/task/types.d.ts.map +1 -0
  779. package/lib/types/src/api/secure-channel/types.d.ts +4 -0
  780. package/lib/types/src/api/secure-channel/types.d.ts.map +1 -0
  781. package/lib/types/src/api/secure-channel/utils.d.ts +30 -0
  782. package/lib/types/src/api/secure-channel/utils.d.ts.map +1 -0
  783. package/lib/types/src/api/secure-channel/utils.test.d.ts +2 -0
  784. package/lib/types/src/api/secure-channel/utils.test.d.ts.map +1 -0
  785. package/lib/types/src/api/transport/model/DeviceConnection.d.ts +1 -1
  786. package/lib/types/src/api/transport/model/DeviceConnection.d.ts.map +1 -1
  787. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts +9 -7
  788. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -1
  789. package/lib/types/src/api/transport/model/Errors.d.ts +12 -3
  790. package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
  791. package/lib/types/src/api/transport/model/Transport.d.ts +1 -1
  792. package/lib/types/src/api/transport/model/Transport.d.ts.map +1 -1
  793. package/lib/types/src/api/types.d.ts +8 -1
  794. package/lib/types/src/api/types.d.ts.map +1 -1
  795. package/lib/types/src/api/utils/HexaString.d.ts.map +1 -1
  796. package/lib/types/src/di.d.ts.map +1 -1
  797. package/lib/types/src/internal/config/di/configModule.d.ts.map +1 -1
  798. package/lib/types/src/internal/device-model/di/deviceModelModule.d.ts.map +1 -1
  799. package/lib/types/src/internal/device-session/data/ApduResponseConst.d.ts +1 -0
  800. package/lib/types/src/internal/device-session/data/ApduResponseConst.d.ts.map +1 -1
  801. package/lib/types/src/internal/device-session/data/DeviceSessionRefresherConst.d.ts +6 -1
  802. package/lib/types/src/internal/device-session/data/DeviceSessionRefresherConst.d.ts.map +1 -1
  803. package/lib/types/src/internal/device-session/di/deviceSessionModule.d.ts.map +1 -1
  804. package/lib/types/src/internal/device-session/di/deviceSessionTypes.d.ts +1 -1
  805. package/lib/types/src/internal/device-session/model/DevicePinger.d.ts +18 -0
  806. package/lib/types/src/internal/device-session/model/DevicePinger.d.ts.map +1 -0
  807. package/lib/types/src/internal/device-session/model/DevicePinger.test.d.ts +2 -0
  808. package/lib/types/src/internal/device-session/model/DevicePinger.test.d.ts.map +1 -0
  809. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts +22 -9
  810. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  811. package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts +2 -2
  812. package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts.map +1 -1
  813. package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.d.ts +35 -0
  814. package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.d.ts.map +1 -0
  815. package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.test.d.ts +2 -0
  816. package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.test.d.ts.map +1 -0
  817. package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts +17 -79
  818. package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts.map +1 -1
  819. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts +20 -0
  820. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts.map +1 -0
  821. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.test.d.ts +2 -0
  822. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.test.d.ts.map +1 -0
  823. package/lib/types/src/internal/device-session/model/Frame.d.ts.map +1 -1
  824. package/lib/types/src/internal/device-session/service/MutexService.d.ts +6 -0
  825. package/lib/types/src/internal/device-session/service/MutexService.d.ts.map +1 -0
  826. package/lib/types/src/internal/device-session/service/MutexService.test.d.ts +2 -0
  827. package/lib/types/src/internal/device-session/service/MutexService.test.d.ts.map +1 -0
  828. package/lib/types/src/internal/device-session/service/RefresherService.d.ts +15 -0
  829. package/lib/types/src/internal/device-session/service/RefresherService.d.ts.map +1 -0
  830. package/lib/types/src/internal/device-session/service/RefresherService.test.d.ts +2 -0
  831. package/lib/types/src/internal/device-session/service/RefresherService.test.d.ts.map +1 -0
  832. package/lib/types/src/internal/device-session/utils/deviceSessionUtils.d.ts +3 -0
  833. package/lib/types/src/internal/device-session/utils/deviceSessionUtils.d.ts.map +1 -0
  834. package/lib/types/src/internal/discovery/di/discoveryModule.d.ts.map +1 -1
  835. package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts +8 -1
  836. package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts.map +1 -1
  837. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.d.ts +14 -3
  838. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.d.ts.map +1 -1
  839. package/lib/types/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.d.ts +1 -1
  840. package/lib/types/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.d.ts.map +1 -1
  841. package/lib/types/src/internal/discovery/use-case/StartDiscoveringUseCase.d.ts +1 -1
  842. package/lib/types/src/internal/discovery/use-case/StartDiscoveringUseCase.d.ts.map +1 -1
  843. package/lib/types/src/internal/discovery/use-case/StopDiscoveringUseCase.d.ts +4 -2
  844. package/lib/types/src/internal/discovery/use-case/StopDiscoveringUseCase.d.ts.map +1 -1
  845. package/lib/types/src/internal/logger-publisher/di/loggerModule.d.ts.map +1 -1
  846. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts +27 -7
  847. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts.map +1 -1
  848. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts +62 -12
  849. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts.map +1 -1
  850. package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts +106 -17
  851. package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts.map +1 -1
  852. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts +8 -0
  853. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts.map +1 -1
  854. package/lib/types/src/internal/manager-api/di/managerApiModule.d.ts.map +1 -1
  855. package/lib/types/src/internal/manager-api/di/managerApiTypes.d.ts +1 -0
  856. package/lib/types/src/internal/manager-api/di/managerApiTypes.d.ts.map +1 -1
  857. package/lib/types/src/internal/manager-api/model/Application.d.ts +14 -11
  858. package/lib/types/src/internal/manager-api/model/Application.d.ts.map +1 -1
  859. package/lib/types/src/internal/manager-api/model/Const.d.ts +2 -0
  860. package/lib/types/src/internal/manager-api/model/Const.d.ts.map +1 -1
  861. package/lib/types/src/internal/manager-api/model/Firmware.d.ts +17 -3
  862. package/lib/types/src/internal/manager-api/model/Firmware.d.ts.map +1 -1
  863. package/lib/types/src/internal/manager-api/model/Language.d.ts +12 -0
  864. package/lib/types/src/internal/manager-api/model/Language.d.ts.map +1 -0
  865. package/lib/types/src/internal/manager-api/model/Params.d.ts +57 -0
  866. package/lib/types/src/internal/manager-api/model/Params.d.ts.map +1 -0
  867. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts +13 -7
  868. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts.map +1 -1
  869. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts +71 -5
  870. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts.map +1 -1
  871. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.d.ts +13 -0
  872. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.d.ts.map +1 -0
  873. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.test.d.ts +2 -0
  874. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.test.d.ts.map +1 -0
  875. package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.d.ts +3 -3
  876. package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.d.ts.map +1 -1
  877. package/lib/types/src/internal/secure-channel/data/SecureChannelDataSource.d.ts +13 -13
  878. package/lib/types/src/internal/secure-channel/data/SecureChannelDataSource.d.ts.map +1 -1
  879. package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts.map +1 -1
  880. package/lib/types/src/internal/secure-channel/model/Errors.d.ts +6 -0
  881. package/lib/types/src/internal/secure-channel/model/Errors.d.ts.map +1 -1
  882. package/lib/types/src/internal/secure-channel/model/Params.d.ts +3 -5
  883. package/lib/types/src/internal/secure-channel/model/Params.d.ts.map +1 -1
  884. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts +7 -7
  885. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts.map +1 -1
  886. package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts +41 -6
  887. package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts.map +1 -1
  888. package/lib/types/src/internal/send/di/sendModule.d.ts.map +1 -1
  889. package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts +5 -1
  890. package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts.map +1 -1
  891. package/lib/types/src/internal/transport/di/transportModule.d.ts.map +1 -1
  892. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  893. package/package.json +16 -17
  894. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js +0 -2
  895. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js.map +0 -7
  896. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js +0 -2
  897. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js.map +0 -7
  898. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js +0 -2
  899. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js.map +0 -7
  900. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js +0 -2
  901. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js.map +0 -7
  902. package/lib/types/src/api/device-session/use-case/ToggleDeviceSessionRefresher.d.ts.map +0 -1
  903. package/lib/types/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.d.ts +0 -2
  904. package/lib/types/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.d.ts.map +0 -1
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/secure-channel/device-action/UninstallApp/types.ts"],
4
+ "sourcesContent": ["import { type EitherAsync } from \"purify-ts\";\nimport { type Observable } from \"rxjs\";\n\nimport { type CommandErrorResult } from \"@api/command/model/CommandResult\";\nimport {\n type GetOsVersionCommandResult,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nimport { type DeviceActionState } from \"@api/device-action/model/DeviceActionState\";\nimport { type UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { type UnknownDAError } from \"@api/device-action/os/Errors\";\nimport {\n type GoToDashboardDAError,\n type GoToDashboardDAInput,\n} from \"@api/device-action/os/GoToDashboard/types\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type InstalledApp } from \"@api/secure-channel/device-action/ListInstalledApps/types\";\nimport { type SecureChannelEvent } from \"@api/secure-channel/task/types\";\nimport { type Input } from \"@api/secure-channel/types\";\nimport { type Application } from \"@internal/manager-api/model/Application\";\nimport { type HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\n\nexport type UninstallAppDAOutput = void;\n\nexport type UninstallAppDAInput = GoToDashboardDAInput & { appName: string };\n\nexport type UninstallAppDAError =\n | CommandErrorResult[\"error\"]\n | GoToDashboardDAError\n | HttpFetchApiError\n | UnknownDAError;\n\nexport type UninstallAppDARequiredInteraction =\n | UserInteractionRequired.None\n | UserInteractionRequired.UnlockDevice\n | UserInteractionRequired.AllowSecureConnection;\n\nexport type UninstallAppDAIntermediateValue = {\n requiredUserInteraction: UninstallAppDARequiredInteraction;\n};\n\nexport type UninstallAppDAState = DeviceActionState<\n UninstallAppDAOutput,\n UninstallAppDAError,\n UninstallAppDAIntermediateValue\n>;\n\nexport type UninstallAppStateMachineInternalState = {\n error: UninstallAppDAError | null;\n installedApps: Array<InstalledApp>;\n appList: Array<Application | null>;\n getOsVersionResponse: GetOsVersionResponse | null;\n};\n\nexport type MachineDependencies = {\n getOsVersion: () => Promise<GetOsVersionCommandResult>;\n getAppsByHash: (\n args: Input<InstalledApp[]>,\n ) => EitherAsync<HttpFetchApiError, Array<Application | null>>;\n uninstallApp: (\n args: Input<{ deviceInfo: GetOsVersionResponse; app: Application }>,\n ) => Observable<SecureChannelEvent>;\n getDeviceSessionState: () => DeviceSessionState;\n setDeviceSessionState: (state: DeviceSessionState) => DeviceSessionState;\n};\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["types_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var x=Object.create;var g=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var I=(o,t)=>{for(var c in t)g(o,c,{get:t[c],enumerable:!0})},_=(o,t,c,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of M(t))!O.call(o,l)&&l!==c&&g(o,l,{get:()=>t[l],enumerable:!(e=R(t,l))||e.enumerable});return o};var U=(o,t,c)=>(c=o!=null?x(T(o)):{},_(t||!o||!o.__esModule?g(c,"default",{value:o,enumerable:!0}):c,o)),N=o=>_(g({},"__esModule",{value:!0}),o);var P={};I(P,{ConnectToSecureChannelTask:()=>W});module.exports=N(P);var w=U(require("isomorphic-ws")),A=require("rxjs"),E=require("../../command/utils/CommandUtils"),n=require("../../secure-channel/task/types"),S=require("../../secure-channel/utils"),h=require("../../utils/HexaString"),i=require("../../../internal/secure-channel/model/Errors");class W{constructor(t,c){this._api=t;this._args=c;if(this._args.connection.isRight())this._connection=this._args.connection.extract();else throw new i.SecureChannelError(`Invalid WebSocket connection: ${String(this._args.connection.extract())}`)}_connection;run(){const t=this._api.disableRefresher("connectToSecureChannel");return new A.Observable(e=>{let l=!1,u=!1,m=!1,y=null,f=!1;return this._connection.onopen=()=>{e.next({type:n.SecureChannelEventType.Opened})},this._connection.onerror=C=>{u||e.error(new i.SecureChannelError({url:this._connection.url,errorMessage:C.message}))},this._connection.onclose=()=>{u||(m?(e.next({type:n.SecureChannelEventType.Closed}),e.complete()):e.error(new i.SecureChannelError(y??{url:this._connection.url,errorMessage:"Connection closed unexpectedly"})))},this._connection.onmessage=async C=>{if(!l){y=null;try{const a=JSON.parse(String(C.data));switch(a.query){case n.InMessageQueryEnum.EXCHANGE:{const{nonce:d}=a;if(Array.isArray(a.data)){e.error(new i.SecureChannelError(`${n.InMessageQueryEnum.EXCHANGE} data type should not be Array`));break}const r=(0,h.hexaStringToBuffer)(a.data);if(r===null||r.length<5){e.error(new i.SecureChannelError(`Received invalid APDU data: ${a.data}`));break}e.next({type:n.SecureChannelEventType.PreExchange,payload:{nonce:d,apdu:r}}),(0,S.willRequestPermission)(r)&&!this.isSecureConnectionAllowed()&&(f=!0,e.next({type:n.SecureChannelEventType.PermissionRequested}));const p=await this._api.sendApdu(r);if(l)return;p.caseOf({Left:s=>{e.error(new i.SecureChannelError(s))},Right:s=>{let k;if(E.CommandUtils.isSuccessResponse(s))k=n.OutMessageResponseEnum.SUCCESS,e.next({type:n.SecureChannelEventType.Exchange,payload:{nonce:d,apdu:r,data:s.data,status:s.statusCode}});else{if(k=n.OutMessageResponseEnum.ERROR,y=new i.SecureChannelError({url:this._connection.url,errorMessage:`Invalid status code: ${(0,h.bufferToHexaString)(s.statusCode)}`}),E.CommandUtils.isLockedDeviceResponse(s)){e.error(new i.SecureChannelError({url:this._connection.url,errorMessage:"Device is locked"}));return}if((0,S.isRefusedByUser)(s.statusCode)&&f){e.error(new i.SecureChannelError({url:this._connection.url,errorMessage:"User refused on the device"}));return}}f&&(e.next({type:n.SecureChannelEventType.PermissionGranted}),f=!1);const v={nonce:d,response:k,data:(0,h.bufferToHexaString)(s.data).slice(2)};this._connection.send(JSON.stringify(v))}});break}case n.InMessageQueryEnum.BULK:{if(u=!0,this._connection.close(),!Array.isArray(a.data)||a.data.length===0){e.error(new i.SecureChannelError("Invalid bulk data received"));break}const d=a.data.reduce((r,p)=>{const s=(0,h.hexaStringToBuffer)(p);return s===null?r:[...r,s]},[]);for(let r=0,p=d.length;r<p;r++){if(await this._api.sendApdu(d[r]),l){e.error(new i.SecureChannelError("Bulk sending cancelled by unsubscribing"));break}e.next({type:n.SecureChannelEventType.Progress,payload:{progress:+Number((r+1)/p).toFixed(2),index:r,total:p}})}m=!0,e.complete();break}case n.InMessageQueryEnum.SUCCESS:{if(u)break;const d=a.result??a.data;d&&e.next({type:n.SecureChannelEventType.Result,payload:d??""}),m=!0,e.complete();break}case n.InMessageQueryEnum.WARNING:{if(u)break;e.next({type:n.SecureChannelEventType.Warning,payload:{message:String(a.data)}});break}case n.InMessageQueryEnum.ERROR:{if(u)break;e.error(new i.SecureChannelError({url:this._connection.url,errorMessage:String(a.data)}))}}}catch(a){y=new i.SecureChannelError(a),e.error(y)}}},()=>{t(),l=!0,this._connection.readyState===w.default.OPEN&&this._connection.close()}})}isSecureConnectionAllowed(){const t=this._api.getDeviceSessionState();return"isSecureConnectionAllowed"in t&&t.isSecureConnectionAllowed}}0&&(module.exports={ConnectToSecureChannelTask});
2
+ //# sourceMappingURL=ConnectToSecureChannelTask.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/secure-channel/task/ConnectToSecureChannelTask.ts"],
4
+ "sourcesContent": ["import WebSocket from \"isomorphic-ws\";\nimport { type Either } from \"purify-ts\";\nimport { Observable } from \"rxjs\";\n\nimport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport {\n InMessageQueryEnum,\n type InMessageType,\n OutMessageResponseEnum,\n type OutMessageType,\n type SecureChannelEvent,\n SecureChannelEventType,\n} from \"@api/secure-channel/task/types\";\nimport {\n isRefusedByUser,\n willRequestPermission,\n} from \"@api/secure-channel/utils\";\nimport { bufferToHexaString, hexaStringToBuffer } from \"@api/utils/HexaString\";\nimport {\n SecureChannelError,\n type WebSocketConnectionError,\n} from \"@internal/secure-channel/model/Errors\";\n\nexport type ConnectToSecureChannelTaskArgs = {\n connection: Either<WebSocketConnectionError, WebSocket>;\n};\n\nexport class ConnectToSecureChannelTask {\n private readonly _connection: WebSocket;\n constructor(\n private readonly _api: InternalApi,\n private readonly _args: ConnectToSecureChannelTaskArgs,\n ) {\n if (this._args.connection.isRight()) {\n this._connection = this._args.connection.extract();\n } else {\n throw new SecureChannelError(\n `Invalid WebSocket connection: ${String(this._args.connection.extract())}`,\n );\n }\n }\n\n run(): Observable<SecureChannelEvent> {\n const reenableRefresher = this._api.disableRefresher(\n \"connectToSecureChannel\",\n );\n\n const obs = new Observable<SecureChannelEvent>((subscriber) => {\n let unsubscribed: boolean = false;\n let inBulkMode = false;\n let communicationFinished = false;\n let deviceError: SecureChannelError | null = null;\n let waitingForUserAction = false;\n\n this._connection.onopen = () => {\n subscriber.next({\n type: SecureChannelEventType.Opened,\n });\n };\n\n this._connection.onerror = (error) => {\n // When the bulk sending is in progress, network error is ignored\n if (inBulkMode) {\n return;\n }\n\n subscriber.error(\n new SecureChannelError({\n url: this._connection.url,\n errorMessage: error.message,\n }),\n );\n };\n\n this._connection.onclose = () => {\n // When the bulk sending is in progress, network event is ignored\n if (inBulkMode) {\n return;\n }\n\n if (communicationFinished) {\n subscriber.next({\n type: SecureChannelEventType.Closed,\n });\n subscriber.complete();\n } else {\n subscriber.error(\n new SecureChannelError(\n deviceError ?? {\n url: this._connection.url,\n errorMessage: \"Connection closed unexpectedly\",\n },\n ),\n );\n }\n };\n\n this._connection.onmessage = async (event) => {\n // When unsubscribed, ignore the message\n if (unsubscribed) {\n return;\n }\n deviceError = null;\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const input: InMessageType = JSON.parse(String(event.data));\n\n switch (input.query) {\n case InMessageQueryEnum.EXCHANGE: {\n const { nonce } = input;\n\n if (Array.isArray(input.data)) {\n subscriber.error(\n new SecureChannelError(\n `${InMessageQueryEnum.EXCHANGE} data type should not be Array`,\n ),\n );\n break;\n }\n\n const apdu = hexaStringToBuffer(input.data);\n\n if (apdu === null || apdu.length < 5) {\n subscriber.error(\n new SecureChannelError(\n `Received invalid APDU data: ${input.data}`,\n ),\n );\n break;\n }\n\n subscriber.next({\n type: SecureChannelEventType.PreExchange,\n payload: { nonce, apdu },\n });\n\n if (\n willRequestPermission(apdu) &&\n !this.isSecureConnectionAllowed()\n ) {\n waitingForUserAction = true;\n subscriber.next({\n type: SecureChannelEventType.PermissionRequested,\n });\n }\n\n const response = await this._api.sendApdu(apdu);\n\n if (unsubscribed) {\n return;\n }\n\n response.caseOf({\n Left: (error) => {\n subscriber.error(new SecureChannelError(error));\n },\n Right: (apduResponse: ApduResponse) => {\n let outMessageResponse: OutMessageResponseEnum;\n /**\n * | Status Code | Description | Event Emitted |\n * |-------------|------------------------------------|------------------------------------|\n * | 0x9000 | Success | SecureChannelEventEnum.Exchange |\n * | 0x5515 | Device is locked | Error |\n * | 0x5501 | User refused on the device | Error |\n * | 0x6985 | Condition of use not satisfied | Error |\n */\n // Success response\n if (CommandUtils.isSuccessResponse(apduResponse)) {\n outMessageResponse = OutMessageResponseEnum.SUCCESS;\n // Emit event for the exchange\n subscriber.next({\n type: SecureChannelEventType.Exchange,\n payload: {\n nonce,\n apdu,\n data: apduResponse.data,\n status: apduResponse.statusCode,\n },\n });\n } else {\n outMessageResponse = OutMessageResponseEnum.ERROR;\n\n deviceError = new SecureChannelError({\n url: this._connection.url,\n errorMessage: `Invalid status code: ${bufferToHexaString(\n apduResponse.statusCode,\n )}`,\n });\n\n // Device is locked\n if (CommandUtils.isLockedDeviceResponse(apduResponse)) {\n subscriber.error(\n new SecureChannelError({\n url: this._connection.url,\n errorMessage: `Device is locked`,\n }),\n );\n return;\n }\n\n // User refused the permission\n if (\n isRefusedByUser(apduResponse.statusCode) &&\n waitingForUserAction\n ) {\n subscriber.error(\n new SecureChannelError({\n url: this._connection.url,\n errorMessage: \"User refused on the device\",\n }),\n );\n return;\n }\n }\n\n if (waitingForUserAction) {\n subscriber.next({\n type: SecureChannelEventType.PermissionGranted,\n });\n waitingForUserAction = false;\n }\n\n // Send the message back to the server\n const message: OutMessageType = {\n nonce,\n response: outMessageResponse,\n data: bufferToHexaString(apduResponse.data).slice(2),\n };\n this._connection.send(JSON.stringify(message));\n },\n });\n break;\n }\n case InMessageQueryEnum.BULK: {\n inBulkMode = true;\n this._connection.close();\n\n if (!Array.isArray(input.data) || input.data.length === 0) {\n subscriber.error(\n new SecureChannelError(\"Invalid bulk data received\"),\n );\n break;\n }\n\n const apdus = input.data.reduce(\n (acc: Array<Uint8Array>, cur: string) => {\n const apdu = hexaStringToBuffer(cur);\n return apdu === null ? acc : [...acc, apdu];\n },\n [],\n );\n\n for (let i = 0, len = apdus.length; i < len; i++) {\n await this._api.sendApdu(apdus[i]!);\n if (unsubscribed) {\n subscriber.error(\n new SecureChannelError(\n \"Bulk sending cancelled by unsubscribing\",\n ),\n );\n break;\n }\n subscriber.next({\n type: SecureChannelEventType.Progress,\n payload: {\n progress: +Number((i + 1) / len).toFixed(2),\n index: i,\n total: len,\n },\n });\n }\n communicationFinished = true;\n subscriber.complete();\n break;\n }\n case InMessageQueryEnum.SUCCESS: {\n // Ignore success message when in bulk mode\n if (inBulkMode) {\n break;\n }\n // Emit the result if there is any\n const payload = input.result ?? input.data;\n if (payload) {\n subscriber.next({\n type: SecureChannelEventType.Result,\n payload: payload ?? \"\",\n });\n }\n communicationFinished = true;\n subscriber.complete();\n break;\n }\n case InMessageQueryEnum.WARNING: {\n // Ignore warning message when in bulk mode\n if (inBulkMode) {\n break;\n }\n subscriber.next({\n type: SecureChannelEventType.Warning,\n payload: { message: String(input.data) },\n });\n break;\n }\n case InMessageQueryEnum.ERROR: {\n if (inBulkMode) {\n break;\n }\n subscriber.error(\n new SecureChannelError({\n url: this._connection.url,\n errorMessage: String(input.data),\n }),\n );\n }\n }\n } catch (error) {\n deviceError = new SecureChannelError(error);\n subscriber.error(deviceError);\n }\n };\n\n return () => {\n reenableRefresher();\n unsubscribed = true;\n // Close the connection if it is open when unsubscribing\n if (this._connection.readyState === WebSocket.OPEN) {\n this._connection.close();\n }\n };\n });\n\n return obs;\n }\n\n /**\n * Determines if a secure connection is already allowed based on the current device session state.\n *\n * @returns {boolean} `true` if a secure connection is allowed, otherwise `false`.\n */\n isSecureConnectionAllowed(): boolean {\n const deviceSessionState = this._api.getDeviceSessionState();\n return (\n \"isSecureConnectionAllowed\" in deviceSessionState &&\n deviceSessionState.isSecureConnectionAllowed\n );\n }\n}\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAsB,4BAEtBC,EAA2B,gBAE3BC,EAA6B,2CAG7BC,EAOO,0CACPC,EAGO,qCACPC,EAAuD,iCACvDC,EAGO,iDAMA,MAAMR,CAA2B,CAEtC,YACmBS,EACAC,EACjB,CAFiB,UAAAD,EACA,WAAAC,EAEjB,GAAI,KAAK,MAAM,WAAW,QAAQ,EAChC,KAAK,YAAc,KAAK,MAAM,WAAW,QAAQ,MAEjD,OAAM,IAAI,qBACR,iCAAiC,OAAO,KAAK,MAAM,WAAW,QAAQ,CAAC,CAAC,EAC1E,CAEJ,CAZiB,YAcjB,KAAsC,CACpC,MAAMC,EAAoB,KAAK,KAAK,iBAClC,wBACF,EA+RA,OA7RY,IAAI,aAAgCC,GAAe,CAC7D,IAAIC,EAAwB,GACxBC,EAAa,GACbC,EAAwB,GACxBC,EAAyC,KACzCC,EAAuB,GAE3B,YAAK,YAAY,OAAS,IAAM,CAC9BL,EAAW,KAAK,CACd,KAAM,yBAAuB,MAC/B,CAAC,CACH,EAEA,KAAK,YAAY,QAAWM,GAAU,CAEhCJ,GAIJF,EAAW,MACT,IAAI,qBAAmB,CACrB,IAAK,KAAK,YAAY,IACtB,aAAcM,EAAM,OACtB,CAAC,CACH,CACF,EAEA,KAAK,YAAY,QAAU,IAAM,CAE3BJ,IAIAC,GACFH,EAAW,KAAK,CACd,KAAM,yBAAuB,MAC/B,CAAC,EACDA,EAAW,SAAS,GAEpBA,EAAW,MACT,IAAI,qBACFI,GAAe,CACb,IAAK,KAAK,YAAY,IACtB,aAAc,gCAChB,CACF,CACF,EAEJ,EAEA,KAAK,YAAY,UAAY,MAAOG,GAAU,CAE5C,GAAI,CAAAN,EAGJ,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H,EAAW,SAAS,EACpB,KACF,CACA,KAAK,qBAAmB,QAAS,CAE/B,GAAIE,EACF,MAGF,MAAMkB,EAAUZ,EAAM,QAAUA,EAAM,KAClCY,GACFpB,EAAW,KAAK,CACd,KAAM,yBAAuB,OAC7B,QAASoB,GAAW,EACtB,CAAC,EAEHjB,EAAwB,GACxBH,EAAW,SAAS,EACpB,KACF,CACA,KAAK,qBAAmB,QAAS,CAE/B,GAAIE,EACF,MAEFF,EAAW,KAAK,CACd,KAAM,yBAAuB,QAC7B,QAAS,CAAE,QAAS,OAAOQ,EAAM,IAAI,CAAE,CACzC,CAAC,EACD,KACF,CACA,KAAK,qBAAmB,MAAO,CAC7B,GAAIN,EACF,MAEFF,EAAW,MACT,IAAI,qBAAmB,CACrB,IAAK,KAAK,YAAY,IACtB,aAAc,OAAOQ,EAAM,IAAI,CACjC,CAAC,CACH,CACF,CACF,CACF,OAASF,EAAO,CACdF,EAAc,IAAI,qBAAmBE,CAAK,EAC1CN,EAAW,MAAMI,CAAW,CAC9B,EACF,EAEO,IAAM,CACXL,EAAkB,EAClBE,EAAe,GAEX,KAAK,YAAY,aAAe,EAAAoB,QAAU,MAC5C,KAAK,YAAY,MAAM,CAE3B,CACF,CAAC,CAGH,CAOA,2BAAqC,CACnC,MAAMC,EAAqB,KAAK,KAAK,sBAAsB,EAC3D,MACE,8BAA+BA,GAC/BA,EAAmB,yBAEvB,CACF",
6
+ "names": ["ConnectToSecureChannelTask_exports", "__export", "ConnectToSecureChannelTask", "__toCommonJS", "import_isomorphic_ws", "import_rxjs", "import_CommandUtils", "import_types", "import_utils", "import_HexaString", "import_Errors", "_api", "_args", "reenableRefresher", "subscriber", "unsubscribed", "inBulkMode", "communicationFinished", "deviceError", "waitingForUserAction", "error", "event", "input", "nonce", "apdu", "response", "apduResponse", "outMessageResponse", "message", "apdus", "acc", "cur", "i", "len", "payload", "WebSocket", "deviceSessionState"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var h=Object.create;var m=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var f=(e,o,u,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of S(o))!C.call(e,c)&&c!==u&&m(e,c,{get:()=>o[c],enumerable:!(a=b(o,c))||a.enumerable});return e};var E=(e,o,u)=>(u=e!=null?h(v(e)):{},f(o||!e||!e.__esModule?m(u,"default",{value:e,enumerable:!0}):u,e));var g=E(require("isomorphic-ws")),p=require("purify-ts"),n=require("vitest"),r=require("../../secure-channel/task/types"),y=require("../../../internal/secure-channel/model/Errors"),x=require("./ConnectToSecureChannelTask");n.vi.mock("isomorphic-ws",()=>({...n.vi.importActual("isomorphic-ws"),__esModule:!0,default:class{onopen=null;onmessage=null;send=n.vi.fn();close=n.vi.fn();url;constructor(e){this.url=e}}}));const d=5;(0,n.describe)("ConnectToSecureChannelTask",()=>{let e,o,u,a;const c=n.vi.fn();beforeEach(()=>{e=new g.default("wss://test-host.com"),o={sendApdu:c,disableRefresher:n.vi.fn()},u={connection:(0,p.Right)(e)},a=new x.ConnectToSecureChannelTask(o,u)}),afterEach(()=>{n.vi.resetAllMocks()}),(0,n.it)("should emit Opened event on WebSocket open",async()=>{const t=[];a.run().subscribe(s=>t.push(s)),expect(e.onopen).toBeDefined(),e.onopen({type:"open",target:{}}),await new Promise(s=>setTimeout(s,d)),expect(t).toStrictEqual([{type:r.SecureChannelEventType.Opened}])}),(0,n.it)("should handle incoming EXCHANGE message including requesting user permission",async()=>{c.mockResolvedValue((0,p.Right)({data:new Uint8Array([144,0]),statusCode:new Uint8Array([144,0])}));const t=n.vi.spyOn(e,"send");n.vi.spyOn(a,"isSecureConnectionAllowed").mockReturnValueOnce(!1);const i=[];a.run().subscribe({next:l=>{i.push(l)}}),expect(e.onmessage).toBeDefined(),e.onmessage({data:JSON.stringify({query:"exchange",nonce:1,data:"e051000000"}),type:"",target:{}}),await new Promise(l=>setTimeout(l,d)),expect(t).toHaveBeenCalledExactlyOnceWith(JSON.stringify({nonce:1,response:"success",data:"9000"})),expect(i).toStrictEqual([{type:r.SecureChannelEventType.PreExchange,payload:{nonce:1,apdu:new Uint8Array([224,81,0,0,0])}},{type:r.SecureChannelEventType.PermissionRequested},{type:r.SecureChannelEventType.Exchange,payload:{nonce:1,apdu:new Uint8Array([224,81,0,0,0]),data:new Uint8Array([144,0]),status:new Uint8Array([144,0])}},{type:r.SecureChannelEventType.PermissionGranted}])}),(0,n.it)("should handle incoming BULK message",async()=>{c.mockResolvedValue((0,p.Right)({data:new Uint8Array([144,0]),statusCode:new Uint8Array([144,0])}));const t=n.vi.fn(),i=a.run(),s=[];i.subscribe({next:l=>{s.push(l)},complete:()=>t()}),expect(e.onmessage).toBeDefined(),e.onmessage({data:JSON.stringify({query:"bulk",nonce:1,data:["0000000100","0000000200","0000000300"]}),type:"",target:{}}),await new Promise(l=>setTimeout(l,d)),expect(c).toHaveBeenCalledTimes(3),expect(s).toStrictEqual([{type:r.SecureChannelEventType.Progress,payload:{progress:.33,index:0,total:3}},{type:r.SecureChannelEventType.Progress,payload:{progress:.67,index:1,total:3}},{type:r.SecureChannelEventType.Progress,payload:{progress:1,index:2,total:3}}]),expect(t).toHaveBeenCalledOnce()}),(0,n.it)("should handle incoming SUCCESS message",()=>{const t=n.vi.fn(),i=[];a.run().subscribe({next:l=>i.push(l),complete:()=>t()}),e.onmessage({data:JSON.stringify({query:"success",nonce:1,result:"success result"}),type:"",target:{}}),expect(i).toStrictEqual([{type:r.SecureChannelEventType.Result,payload:"success result"}]),expect(t).toHaveBeenCalledOnce()}),(0,n.it)("should handle incoming WARNING message",()=>{const t=[];a.run().subscribe({next:s=>t.push(s)}),expect(e.onmessage).toBeDefined(),e.onmessage({data:JSON.stringify({query:"warning",nonce:1,data:"warning message"}),type:"",target:{}}),expect(t).toStrictEqual([{type:r.SecureChannelEventType.Warning,payload:{message:"warning message"}}])}),(0,n.it)("should handle incoming ERROR message",()=>{const t=n.vi.fn();a.run().subscribe({error:s=>{expect(s).toBeInstanceOf(y.SecureChannelError),t(s)}}),expect(e.onmessage).toBeDefined(),e.onmessage({data:JSON.stringify({query:"error"}),type:"",target:{}}),expect(t).toHaveBeenCalled()})});
2
+ //# sourceMappingURL=ConnectToSecureChannelTask.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/secure-channel/task/ConnectToSecureChannelTask.test.ts"],
4
+ "sourcesContent": ["import WebSocket from \"isomorphic-ws\";\nimport { Right } from \"purify-ts\";\nimport { describe, it, vi } from \"vitest\";\n\nimport { type InternalApi } from \"@api/index\";\nimport {\n type SecureChannelEvent,\n SecureChannelEventType,\n} from \"@api/secure-channel/task/types\";\nimport { SecureChannelError } from \"@internal/secure-channel/model/Errors\";\n\nimport {\n ConnectToSecureChannelTask,\n type ConnectToSecureChannelTaskArgs,\n} from \"./ConnectToSecureChannelTask\";\n\nvi.mock(\"isomorphic-ws\", () => ({\n ...vi.importActual(\"isomorphic-ws\"),\n __esModule: true,\n default: class {\n onopen: (() => void) | null = null;\n onmessage: ((event: { data: string }) => void) | null = null;\n send = vi.fn();\n close = vi.fn();\n url: string;\n constructor(url: string) {\n this.url = url;\n }\n },\n}));\n\nconst TEST_DELAY = 5;\n\ndescribe(\"ConnectToSecureChannelTask\", () => {\n let mockWebSocket: WebSocket;\n let mockInternalApi: InternalApi;\n let taskArgs: ConnectToSecureChannelTaskArgs;\n let task: ConnectToSecureChannelTask;\n const sendApduFn = vi.fn();\n\n beforeEach(() => {\n // vi.useFakeTimers({ shouldAdvanceTime: true });\n\n mockWebSocket = new WebSocket(\"wss://test-host.com\");\n mockInternalApi = {\n sendApdu: sendApduFn,\n disableRefresher: vi.fn(),\n } as unknown as InternalApi;\n taskArgs = { connection: Right(mockWebSocket) };\n task = new ConnectToSecureChannelTask(mockInternalApi, taskArgs);\n });\n\n afterEach(() => {\n vi.resetAllMocks();\n });\n\n it(\"should emit Opened event on WebSocket open\", async () => {\n const events: SecureChannelEvent[] = [];\n const obs = task.run();\n obs.subscribe((e) => events.push(e));\n\n expect(mockWebSocket.onopen).toBeDefined();\n mockWebSocket.onopen!({\n type: \"open\",\n target: {} as WebSocket,\n });\n\n await new Promise((resolve) => setTimeout(resolve, TEST_DELAY));\n\n expect(events).toStrictEqual([{ type: SecureChannelEventType.Opened }]);\n });\n\n it(\"should handle incoming EXCHANGE message including requesting user permission\", async () => {\n sendApduFn.mockResolvedValue(\n Right({\n data: new Uint8Array([0x90, 0x00]),\n statusCode: new Uint8Array([0x90, 0x00]),\n }),\n );\n\n const sendSpy = vi.spyOn(mockWebSocket, \"send\");\n vi.spyOn(task, \"isSecureConnectionAllowed\").mockReturnValueOnce(false);\n\n const events: SecureChannelEvent[] = [];\n const obs = task.run();\n obs.subscribe({\n next: (event) => {\n events.push(event);\n },\n });\n\n expect(mockWebSocket.onmessage).toBeDefined();\n mockWebSocket.onmessage!({\n data: JSON.stringify({\n query: \"exchange\",\n nonce: 1,\n data: \"e051000000\",\n }),\n type: \"\",\n target: {} as WebSocket,\n });\n\n await new Promise((resolve) => setTimeout(resolve, TEST_DELAY));\n\n expect(sendSpy).toHaveBeenCalledExactlyOnceWith(\n JSON.stringify({\n nonce: 1,\n response: \"success\",\n data: \"9000\",\n }),\n );\n expect(events).toStrictEqual([\n {\n type: SecureChannelEventType.PreExchange,\n payload: {\n nonce: 1,\n apdu: new Uint8Array([0xe0, 0x51, 0x00, 0x00, 0x00]),\n },\n },\n {\n type: SecureChannelEventType.PermissionRequested,\n },\n {\n type: SecureChannelEventType.Exchange,\n payload: {\n nonce: 1,\n apdu: new Uint8Array([0xe0, 0x51, 0x00, 0x00, 0x00]),\n data: new Uint8Array([0x90, 0x00]),\n status: new Uint8Array([0x90, 0x00]),\n },\n },\n {\n type: SecureChannelEventType.PermissionGranted,\n },\n ]);\n });\n\n it(\"should handle incoming BULK message\", async () => {\n sendApduFn.mockResolvedValue(\n Right({\n data: new Uint8Array([0x90, 0x00]),\n statusCode: new Uint8Array([0x90, 0x00]),\n }),\n );\n const completeFn: () => void = vi.fn();\n const obs = task.run();\n const events: SecureChannelEvent[] = [];\n obs.subscribe({\n next: (event: SecureChannelEvent) => {\n events.push(event);\n },\n complete: () => completeFn(),\n });\n\n expect(mockWebSocket.onmessage).toBeDefined();\n mockWebSocket.onmessage!({\n data: JSON.stringify({\n query: \"bulk\",\n nonce: 1,\n data: [\"0000000100\", \"0000000200\", \"0000000300\"],\n }),\n type: \"\",\n target: {} as WebSocket,\n });\n\n await new Promise((resolve) => setTimeout(resolve, TEST_DELAY));\n\n expect(sendApduFn).toHaveBeenCalledTimes(3);\n expect(events).toStrictEqual([\n {\n type: SecureChannelEventType.Progress,\n payload: { progress: 0.33, index: 0, total: 3 },\n },\n {\n type: SecureChannelEventType.Progress,\n payload: { progress: 0.67, index: 1, total: 3 },\n },\n {\n type: SecureChannelEventType.Progress,\n payload: { progress: 1.0, index: 2, total: 3 },\n },\n ]);\n expect(completeFn).toHaveBeenCalledOnce();\n });\n\n it(\"should handle incoming SUCCESS message\", () => {\n const completeFn: () => void = vi.fn();\n const events: SecureChannelEvent[] = [];\n const observable = task.run();\n observable.subscribe({\n next: (event: SecureChannelEvent) => events.push(event),\n complete: () => completeFn(),\n });\n\n mockWebSocket.onmessage!({\n data: JSON.stringify({\n query: \"success\",\n nonce: 1,\n result: \"success result\",\n }),\n type: \"\",\n target: {} as WebSocket,\n });\n\n expect(events).toStrictEqual([\n { type: SecureChannelEventType.Result, payload: \"success result\" },\n ]);\n expect(completeFn).toHaveBeenCalledOnce();\n });\n\n it(\"should handle incoming WARNING message\", () => {\n const events: SecureChannelEvent[] = [];\n const observable = task.run();\n observable.subscribe({\n next: (event: SecureChannelEvent) => events.push(event),\n });\n\n expect(mockWebSocket.onmessage).toBeDefined();\n mockWebSocket.onmessage!({\n data: JSON.stringify({\n query: \"warning\",\n nonce: 1,\n data: \"warning message\",\n }),\n type: \"\",\n target: {} as WebSocket,\n });\n\n expect(events).toStrictEqual([\n {\n type: SecureChannelEventType.Warning,\n payload: { message: \"warning message\" },\n },\n ]);\n });\n\n it(\"should handle incoming ERROR message\", () => {\n const errorFn = vi.fn();\n const observable = task.run();\n observable.subscribe({\n error: (err) => {\n expect(err).toBeInstanceOf(SecureChannelError);\n errorFn(err);\n },\n });\n\n expect(mockWebSocket.onmessage).toBeDefined();\n mockWebSocket.onmessage!({\n data: JSON.stringify({\n query: \"error\",\n }),\n type: \"\",\n target: {} as WebSocket,\n });\n\n expect(errorFn).toHaveBeenCalled();\n });\n});\n"],
5
+ "mappings": "wdAAA,IAAAA,EAAsB,4BACtBC,EAAsB,qBACtBC,EAAiC,kBAGjCC,EAGO,0CACPC,EAAmC,iDAEnCC,EAGO,wCAEP,KAAG,KAAK,gBAAiB,KAAO,CAC9B,GAAG,KAAG,aAAa,eAAe,EAClC,WAAY,GACZ,QAAS,KAAM,CACb,OAA8B,KAC9B,UAAwD,KACxD,KAAO,KAAG,GAAG,EACb,MAAQ,KAAG,GAAG,EACd,IACA,YAAYC,EAAa,CACvB,KAAK,IAAMA,CACb,CACF,CACF,EAAE,EAEF,MAAMC,EAAa,KAEnB,YAAS,6BAA8B,IAAM,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACJ,MAAMC,EAAa,KAAG,GAAG,EAEzB,WAAW,IAAM,CAGfJ,EAAgB,IAAI,EAAAK,QAAU,qBAAqB,EACnDJ,EAAkB,CAChB,SAAUG,EACV,iBAAkB,KAAG,GAAG,CAC1B,EACAF,EAAW,CAAE,cAAY,SAAMF,CAAa,CAAE,EAC9CG,EAAO,IAAI,6BAA2BF,EAAiBC,CAAQ,CACjE,CAAC,EAED,UAAU,IAAM,CACd,KAAG,cAAc,CACnB,CAAC,KAED,MAAG,6CAA8C,SAAY,CAC3D,MAAMI,EAA+B,CAAC,EAC1BH,EAAK,IAAI,EACjB,UAAWI,GAAMD,EAAO,KAAKC,CAAC,CAAC,EAEnC,OAAOP,EAAc,MAA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IAAI,EACjB,UAAU,CACnB,KAAOO,GAA8BJ,EAAO,KAAKI,CAAK,EACtD,SAAU,IAAMC,EAAW,CAC7B,CAAC,EAEDX,EAAc,UAAW,CACvB,KAAM,KAAK,UAAU,CACnB,MAAO,UACP,MAAO,EACP,OAAQ,gBACV,CAAC,EACD,KAAM,GACN,OAAQ,CAAC,CACX,CAAC,EAED,OAAOM,CAAM,EAAE,cAAc,CAC3B,CAAE,KAAM,yBAAuB,OAAQ,QAAS,gBAAiB,CACnE,CAAC,EACD,OAAOK,CAAU,EAAE,qBAAqB,CAC1C,CAAC,KAED,MAAG,yCAA0C,IAAM,CACjD,MAAML,EAA+B,CAAC,EACnBH,EAAK,IAAI,EACjB,UAAU,CACnB,KAAOO,GAA8BJ,EAAO,KAAKI,CAAK,CACxD,CAAC,EAED,OAAOV,EAAc,SAAS,EAAE,YAAY,EAC5CA,EAAc,UAAW,CACvB,KAAM,KAAK,UAAU,CACnB,MAAO,UACP,MAAO,EACP,KAAM,iBACR,CAAC,EACD,KAAM,GACN,OAAQ,CAAC,CACX,CAAC,EAED,OAAOM,CAAM,EAAE,cAAc,CAC3B,CACE,KAAM,yBAAuB,QAC7B,QAAS,CAAE,QAAS,iBAAkB,CACxC,CACF,CAAC,CACH,CAAC,KAED,MAAG,uCAAwC,IAAM,CAC/C,MAAMO,EAAU,KAAG,GAAG,EACHV,EAAK,IAAI,EACjB,UAAU,CACnB,MAAQW,GAAQ,CACd,OAAOA,CAAG,EAAE,eAAe,oBAAkB,EAC7CD,EAAQC,CAAG,CACb,CACF,CAAC,EAED,OAAOd,EAAc,SAAS,EAAE,YAAY,EAC5CA,EAAc,UAAW,CACvB,KAAM,KAAK,UAAU,CACnB,MAAO,OACT,CAAC,EACD,KAAM,GACN,OAAQ,CAAC,CACX,CAAC,EAED,OAAOa,CAAO,EAAE,iBAAiB,CACnC,CAAC,CACH,CAAC",
6
+ "names": ["import_isomorphic_ws", "import_purify_ts", "import_vitest", "import_types", "import_Errors", "import_ConnectToSecureChannelTask", "url", "TEST_DELAY", "mockWebSocket", "mockInternalApi", "taskArgs", "task", "sendApduFn", "WebSocket", "events", "e", "resolve", "sendSpy", "event", "completeFn", "obs", "errorFn", "err"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var P=(r,e)=>{for(var t in e)o(r,t,{get:e[t],enumerable:!0})},h=(r,e,t,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of u(e))!x.call(r,s)&&s!==t&&o(r,s,{get:()=>e[s],enumerable:!(d=c(e,s))||d.enumerable});return r};var A=r=>h(o({},"__esModule",{value:!0}),r);var U={};P(U,{InMessageQueryEnum:()=>i,OutMessageResponseEnum:()=>g,SecureChannelEventType:()=>y,SecureChannelOperationEnum:()=>l});module.exports=A(U);var l=(a=>(a.GenuineCheck="GenuineCheck",a.ListInstalledApps="ListInstalledApps",a.UpdateMcu="UpdateMcu",a.UpdateFirmware="UpdateFirmware",a.InstallApp="InstallApp",a.UninstallApp="UninstallApp",a))(l||{}),i=(p=>(p.EXCHANGE="exchange",p.BULK="bulk",p.ERROR="error",p.WARNING="warning",p.SUCCESS="success",p))(i||{}),g=(t=>(t.SUCCESS="success",t.ERROR="error",t))(g||{}),y=(n=>(n.Opened="opened",n.Closed="closed",n.PermissionRequested="permission-requested",n.PermissionGranted="permission-granted",n.PreExchange="pre-exchange",n.Exchange="exchange",n.Progress="progress",n.Warning="warning",n.Result="result",n))(y||{});0&&(module.exports={InMessageQueryEnum,OutMessageResponseEnum,SecureChannelEventType,SecureChannelOperationEnum});
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/secure-channel/task/types.ts"],
4
+ "sourcesContent": ["export enum SecureChannelOperationEnum {\n GenuineCheck = \"GenuineCheck\",\n ListInstalledApps = \"ListInstalledApps\",\n UpdateMcu = \"UpdateMcu\",\n UpdateFirmware = \"UpdateFirmware\",\n InstallApp = \"InstallApp\",\n UninstallApp = \"UninstallApp\",\n}\n\n/**\n * The message that will be received from the server by the secure channel.\n */\nexport type InMessageType = {\n uuid: string;\n session: string;\n query: InMessageQueryEnum;\n nonce: number;\n data: string | Array<string>;\n result?: unknown;\n};\n\nexport enum InMessageQueryEnum {\n EXCHANGE = \"exchange\",\n BULK = \"bulk\",\n ERROR = \"error\",\n WARNING = \"warning\",\n SUCCESS = \"success\",\n}\n\n/**\n * The message that will be sent to the server by the secure channel.\n */\nexport type OutMessageType = {\n nonce: number;\n response: OutMessageResponseEnum;\n data: string;\n};\n\nexport enum OutMessageResponseEnum {\n SUCCESS = \"success\",\n ERROR = \"error\",\n}\n\n/**\n * The all event types that can be emitted to the client by the secure channel.\n *\n */\nexport enum SecureChannelEventType {\n Opened = \"opened\",\n Closed = \"closed\",\n PermissionRequested = \"permission-requested\",\n PermissionGranted = \"permission-granted\",\n PreExchange = \"pre-exchange\",\n Exchange = \"exchange\",\n Progress = \"progress\",\n Warning = \"warning\",\n Result = \"result\",\n}\n\n/**\n * The possible payload that will be sent to the client when a secure channel event occurs.\n */\nexport type SecureChannelEventPayload = {\n PreExchange: { nonce: number; apdu: Uint8Array };\n Exchange: {\n nonce: number;\n apdu: Uint8Array;\n data: Uint8Array;\n status: Uint8Array;\n };\n Progress: { progress: number; index: number; total: number };\n Warning: { message: string };\n Result: unknown;\n};\n\n/**\n * The event type that will be emitted to the client when a secure channel event occurs.\n */\nexport type SecureChannelEvent =\n | {\n type: SecureChannelEventType.Opened;\n }\n | {\n type: SecureChannelEventType.Closed;\n }\n | {\n type: SecureChannelEventType.PermissionRequested;\n }\n | {\n type: SecureChannelEventType.PermissionGranted;\n }\n | {\n type: SecureChannelEventType.PreExchange;\n payload: SecureChannelEventPayload[\"PreExchange\"];\n }\n | {\n type: SecureChannelEventType.Exchange;\n payload: SecureChannelEventPayload[\"Exchange\"];\n }\n | {\n type: SecureChannelEventType.Progress;\n payload: SecureChannelEventPayload[\"Progress\"];\n }\n | {\n type: SecureChannelEventType.Warning;\n payload: SecureChannelEventPayload[\"Warning\"];\n }\n | {\n type: SecureChannelEventType.Result;\n payload: SecureChannelEventPayload[\"Result\"];\n };\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,EAAA,2BAAAC,EAAA,2BAAAC,EAAA,+BAAAC,IAAA,eAAAC,EAAAN,GAAO,IAAKK,OACVA,EAAA,aAAe,eACfA,EAAA,kBAAoB,oBACpBA,EAAA,UAAY,YACZA,EAAA,eAAiB,iBACjBA,EAAA,WAAa,aACbA,EAAA,aAAe,eANLA,OAAA,IAqBAH,OACVA,EAAA,SAAW,WACXA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,QAAU,UACVA,EAAA,QAAU,UALAA,OAAA,IAiBAC,OACVA,EAAA,QAAU,UACVA,EAAA,MAAQ,QAFEA,OAAA,IASAC,OACVA,EAAA,OAAS,SACTA,EAAA,OAAS,SACTA,EAAA,oBAAsB,uBACtBA,EAAA,kBAAoB,qBACpBA,EAAA,YAAc,eACdA,EAAA,SAAW,WACXA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,OAAS,SATCA,OAAA",
6
+ "names": ["types_exports", "__export", "InMessageQueryEnum", "OutMessageResponseEnum", "SecureChannelEventType", "SecureChannelOperationEnum", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var u=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var x=(t,p,T,n)=>{if(p&&typeof p=="object"||typeof p=="function")for(let e of o(p))!r.call(t,e)&&e!==T&&u(t,e,{get:()=>p[e],enumerable:!(n=i(p,e))||n.enumerable});return t};var y=t=>x(u({},"__esModule",{value:!0}),t);var I={};module.exports=y(I);
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/api/secure-channel/types.ts"],
4
+ "sourcesContent": ["export type Input<T> = { input: T };\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["types_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var c=(e,n)=>{for(var i in n)o(e,i,{get:n[i],enumerable:!0})},f=(e,n,i,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of u(n))!E.call(e,r)&&r!==i&&o(e,r,{get:()=>n[r],enumerable:!(t=x(n,r))||t.enumerable});return e};var y=e=>f(o({},"__esModule",{value:!0}),e);var U={};c(U,{isDeviceGenuine:()=>p,isRefusedByUser:()=>m,willRequestPermission:()=>a});module.exports=y(U);var l=require("./constants");function a(e){return e[0]===224&&e[1]===81}function m(e){return e.length===2&&(e[0]===85&&e[1]===1||e[0]===105&&e[1]===133)}function p(e){return e===l.GENUINE_DEVICE_RESULT}0&&(module.exports={isDeviceGenuine,isRefusedByUser,willRequestPermission});
2
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/api/secure-channel/utils.ts"],
4
+ "sourcesContent": ["import { type SecureChannelEventPayload } from \"./task/types\";\nimport { GENUINE_DEVICE_RESULT } from \"./constants\";\n\n/**\n * Checks if the given APDU command will request permission.\n *\n * This method checks if the first byte of the APDU command is `0xe0` and the second byte is `0x51`.\n *\n * @param apdu - The APDU command as a Uint8Array.\n * @returns `true` if the APDU command will request permission, otherwise `false`.\n */\nexport function willRequestPermission(apdu: Uint8Array): boolean {\n return apdu[0] === 0xe0 && apdu[1] === 0x51;\n}\n\n/**\n * Checks if the user refused the permission on the device.\n *\n * The following status codes indicate a refusal:\n * - \"0x5501\": User refused the permission.\n * - \"0x6985\": Condition of use not satisfied.\n *\n * @param statusCode - The status code to check.\n * @returns `true` if the status code indicates a refusal, otherwise `false`.\n */\nexport function isRefusedByUser(statusCode: Uint8Array): boolean {\n return (\n statusCode.length === 2 &&\n ((statusCode[0] === 0x55 && statusCode[1] === 0x01) ||\n (statusCode[0] === 0x69 && statusCode[1] === 0x85))\n );\n}\n\n/**\n * Checks if the device is genuine.\n *\n * @param payload - The payload of the result secure channel event.\n * The payload has already been stringified, so that the type check is not necessary.\n * @returns `true` if the device is genuine, otherwise `false`.\n */\nexport function isDeviceGenuine(payload: SecureChannelEventPayload[\"Result\"]) {\n return payload === GENUINE_DEVICE_RESULT;\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,oBAAAC,EAAA,0BAAAC,IAAA,eAAAC,EAAAL,GACA,IAAAM,EAAsC,uBAU/B,SAASF,EAAsBG,EAA2B,CAC/D,OAAOA,EAAK,CAAC,IAAM,KAAQA,EAAK,CAAC,IAAM,EACzC,CAYO,SAASJ,EAAgBK,EAAiC,CAC/D,OACEA,EAAW,SAAW,IACpBA,EAAW,CAAC,IAAM,IAAQA,EAAW,CAAC,IAAM,GAC3CA,EAAW,CAAC,IAAM,KAAQA,EAAW,CAAC,IAAM,IAEnD,CASO,SAASN,EAAgBO,EAA8C,CAC5E,OAAOA,IAAY,uBACrB",
6
+ "names": ["utils_exports", "__export", "isDeviceGenuine", "isRefusedByUser", "willRequestPermission", "__toCommonJS", "import_constants", "apdu", "statusCode", "payload"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var t=require("./utils");describe("willRequestPermission",()=>{it("should return true if the APDU is a permission request",()=>{const e=new Uint8Array([224,81,0,0,0]);expect((0,t.willRequestPermission)(e)).toBe(!0)}),it("should return false if the APDU is not a permission request",()=>{const e=new Uint8Array([224,82,0,0,0]);expect((0,t.willRequestPermission)(e)).toBe(!1)})});describe("isRefusedByUser",()=>{it("should return true if the status code indicates a refusal",()=>{[new Uint8Array([85,1]),new Uint8Array([105,133])].forEach(e=>{expect((0,t.isRefusedByUser)(e)).toBe(!0)})}),it("should return false if the status code does not indicate a refusal",()=>{const e=new Uint8Array([144,0]);expect((0,t.isRefusedByUser)(e)).toBe(!1)})});describe("isDeviceGenuine",()=>{it("should return true if the device is genuine",()=>{expect((0,t.isDeviceGenuine)("0000")).toBe(!0)}),it("should return false if the device is not genuine",()=>{expect((0,t.isDeviceGenuine)("not genuine")).toBe(!1)})});
2
+ //# sourceMappingURL=utils.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/api/secure-channel/utils.test.ts"],
4
+ "sourcesContent": ["import {\n isDeviceGenuine,\n isRefusedByUser,\n willRequestPermission,\n} from \"./utils\";\n\ndescribe(\"willRequestPermission\", () => {\n it(\"should return true if the APDU is a permission request\", () => {\n const apdu = new Uint8Array([0xe0, 0x51, 0x00, 0x00, 0x00]);\n expect(willRequestPermission(apdu)).toBe(true);\n });\n it(\"should return false if the APDU is not a permission request\", () => {\n const apdu = new Uint8Array([0xe0, 0x52, 0x00, 0x00, 0x00]);\n expect(willRequestPermission(apdu)).toBe(false);\n });\n});\n\ndescribe(\"isRefusedByUser\", () => {\n it(\"should return true if the status code indicates a refusal\", () => {\n [new Uint8Array([0x55, 0x01]), new Uint8Array([0x69, 0x85])].forEach(\n (statusCode) => {\n expect(isRefusedByUser(statusCode)).toBe(true);\n },\n );\n });\n it(\"should return false if the status code does not indicate a refusal\", () => {\n const statusCode = new Uint8Array([0x90, 0x00]);\n expect(isRefusedByUser(statusCode)).toBe(false);\n });\n});\n\ndescribe(\"isDeviceGenuine\", () => {\n it(\"should return true if the device is genuine\", () => {\n const payload = \"0000\";\n expect(isDeviceGenuine(payload)).toBe(true);\n });\n it(\"should return false if the device is not genuine\", () => {\n const payload = \"not genuine\";\n expect(isDeviceGenuine(payload)).toBe(false);\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAIO,mBAEP,SAAS,wBAAyB,IAAM,CACtC,GAAG,yDAA0D,IAAM,CACjE,MAAMC,EAAO,IAAI,WAAW,CAAC,IAAM,GAAM,EAAM,EAAM,CAAI,CAAC,EAC1D,UAAO,yBAAsBA,CAAI,CAAC,EAAE,KAAK,EAAI,CAC/C,CAAC,EACD,GAAG,8DAA+D,IAAM,CACtE,MAAMA,EAAO,IAAI,WAAW,CAAC,IAAM,GAAM,EAAM,EAAM,CAAI,CAAC,EAC1D,UAAO,yBAAsBA,CAAI,CAAC,EAAE,KAAK,EAAK,CAChD,CAAC,CACH,CAAC,EAED,SAAS,kBAAmB,IAAM,CAChC,GAAG,4DAA6D,IAAM,CACpE,CAAC,IAAI,WAAW,CAAC,GAAM,CAAI,CAAC,EAAG,IAAI,WAAW,CAAC,IAAM,GAAI,CAAC,CAAC,EAAE,QAC1DC,GAAe,CACd,UAAO,mBAAgBA,CAAU,CAAC,EAAE,KAAK,EAAI,CAC/C,CACF,CACF,CAAC,EACD,GAAG,qEAAsE,IAAM,CAC7E,MAAMA,EAAa,IAAI,WAAW,CAAC,IAAM,CAAI,CAAC,EAC9C,UAAO,mBAAgBA,CAAU,CAAC,EAAE,KAAK,EAAK,CAChD,CAAC,CACH,CAAC,EAED,SAAS,kBAAmB,IAAM,CAChC,GAAG,8CAA+C,IAAM,CAEtD,UAAO,mBADS,MACc,CAAC,EAAE,KAAK,EAAI,CAC5C,CAAC,EACD,GAAG,mDAAoD,IAAM,CAE3D,UAAO,mBADS,aACc,CAAC,EAAE,KAAK,EAAK,CAC7C,CAAC,CACH,CAAC",
6
+ "names": ["import_utils", "apdu", "statusCode"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var t=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var s=(p,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of i(e))!m.call(p,r)&&r!==n&&t(p,r,{get:()=>e[r],enumerable:!(o=d(e,r))||o.enumerable});return p};var c=p=>s(t({},"__esModule",{value:!0}),p);var u={};module.exports=c(u);
1
+ "use strict";var t=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var u=(r,e,n,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of d(e))!m.call(r,o)&&o!==n&&t(r,o,{get:()=>e[o],enumerable:!(p=i(e,o))||p.enumerable});return r};var s=r=>u(t({},"__esModule",{value:!0}),r);var c={};module.exports=s(c);
2
2
  //# sourceMappingURL=DeviceConnection.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/transport/model/DeviceConnection.ts"],
4
- "sourcesContent": ["import { type Either } from \"purify-ts\";\n\nimport { type DeviceId } from \"@api/device/DeviceModel\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DmkError } from \"@api/Error\";\n\nexport type DisconnectHandler = (deviceId: DeviceId) => void;\n\nexport type SendApduResult = Either<DmkError, ApduResponse>;\n\nexport type SendApduFnType = (\n apdu: Uint8Array,\n triggersDisconnection?: boolean,\n) => Promise<SendApduResult>;\n\nexport interface DeviceConnection {\n sendApdu: SendApduFnType;\n}\n"],
4
+ "sourcesContent": ["import { type Either } from \"purify-ts\";\n\nimport { type DeviceId } from \"@api/device/DeviceModel\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DmkError } from \"@api/Error\";\n\nexport type DisconnectHandler = (deviceId: DeviceId) => void;\n\nexport type SendApduResult = Either<DmkError, ApduResponse>;\n\nexport type SendApduFnType = (\n apdu: Uint8Array,\n triggersDisconnection?: boolean,\n abortTimeout?: number,\n) => Promise<SendApduResult>;\n\nexport interface DeviceConnection {\n sendApdu: SendApduFnType;\n}\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["DeviceConnection_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var D=(c,n)=>{for(var o in n)u(c,o,{get:n[o],enumerable:!0})},y=(c,n,o,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of C(n))!v.call(c,s)&&s!==o&&u(c,s,{get:()=>n[s],enumerable:!(i=h(n,s))||i.enumerable});return c};var R=c=>y(u({},"__esModule",{value:!0}),c);var E={};D(E,{DeviceConnectionStateMachine:()=>T});module.exports=R(E);var t=require("purify-ts"),r=require("xstate"),l=require("../../command/utils/CommandUtils"),m=require("../../Error"),d=require("./Errors");class T{deviceId;deviceAdpuSender;machineActor;timeoutDuration;timeout=null;startReconnectionTimeout(){this.timeout=setTimeout(()=>{this.machineActor.send({type:"ReconnectionTimedOut"})},this.timeoutDuration)}constructor(n){this.deviceId=n.deviceId,this.deviceAdpuSender=n.deviceApduSender,this.timeoutDuration=n.timeoutDuration,this.machineActor=(0,r.createActor)(S({sendApduFn:(o,i)=>this.sendApduToDeviceConnection(o,i),startReconnectionTimeout:()=>this.startReconnectionTimeout(),cancelReconnectionTimeout:()=>{this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},onTerminated:n.onTerminated,closeConnection:()=>{this.deviceAdpuSender.closeConnection()}})),this.machineActor.start()}sendApduToDeviceConnection(n,o){console.log("[sendApduToDeviceConnection] called",n,o),this.deviceAdpuSender.sendApdu(n,o).then(i=>{i.caseOf({Left:s=>{console.log("[sendApduToDeviceConnection] got error response",s),this.machineActor.send({type:"ApduSendingError",error:s})},Right:s=>{console.log("[sendApduToDeviceConnection] got successful response",s),this.machineActor.send({type:"ApduResponseReceived",apduResponse:s})}})}).catch(i=>{console.log("[sendApduToDeviceConnection] caught error",i),this.machineActor.send({type:"ApduSendingError",error:new m.UnknownDeviceExchangeError(i)})})}getDependencies(){return this.deviceAdpuSender.getDependencies()}setDependencies(n){this.deviceAdpuSender.setDependencies(n)}getDeviceId(){return this.deviceId}sendApdu(n,o){return new Promise(i=>{this.machineActor.send({type:"SendApduCalled",apdu:n,triggersDisconnection:!!o,responseCallback:i})})}async setupConnection(){await this.deviceAdpuSender.setupConnection()}eventDeviceAttached(){this.machineActor.send({type:"DeviceAttached"})}eventDeviceDetached(){this.machineActor.send({type:"DeviceDetached"})}closeConnection(){this.machineActor.send({type:"CloseConnectionCalled"})}}function S({sendApduFn:c,startReconnectionTimeout:n,cancelReconnectionTimeout:o,onTerminated:i,closeConnection:s}){return(0,r.setup)({types:{},actions:{startTimer:()=>{n()},cancelTimer:()=>{o()},reconnectionTimeoutEvent:(0,r.emit)({type:"ReconnectionTimedOut"}),sendApdu:({context:e})=>{e.apduInProgress.caseOf({Just:({apdu:p})=>{c(p,!1)},Nothing:()=>{console.error("sendApdu called while no apdu in progress")}})},sendApduResponse:({context:e},p)=>{e.apduInProgress.caseOf({Just:({responseCallback:a})=>{a(p.response)},Nothing:()=>{console.error("sendApduResponse called while no apdu in progress")}})},cleanupContext:(0,r.assign)({apduInProgress:t.Nothing}),signalTermination:()=>{i()},closeConnection:async()=>{try{await s()}catch(e){console.error("Error closing connection",e)}}},guards:{isApduThatTriggersDisconnection:({context:e},p)=>e.apduInProgress.caseOf({Just:({triggersDisconnection:a,apdu:A})=>{const g=(a||l.CommandUtils.isApduThatTriggersDisconnection(A))&&l.CommandUtils.isSuccessResponse(p.apduResponse);return console.log("isApduThatTriggersDisconnection",g,A),g},Nothing:()=>!1})}}).createMachine({id:"deviceConnection",initial:"Connected",context:{apduInProgress:t.Nothing},states:{Connected:{on:{DeviceDetached:{target:"WaitingForReconnection"},SendApduCalled:{target:"SendingApdu",actions:(0,r.assign)({apduInProgress:({event:e})=>t.Maybe.of({apdu:e.apdu,triggersDisconnection:e.triggersDisconnection,responseCallback:e.responseCallback})})},CloseConnectionCalled:{target:"Terminated"}}},SendingApdu:{entry:"sendApdu",on:{ApduResponseReceived:[{guard:{type:"isApduThatTriggersDisconnection",params:({event:e})=>({apduResponse:e.apduResponse})},target:"WaitingForReconnection",actions:[{type:"sendApduResponse",params:({event:e})=>({response:(0,t.Right)(e.apduResponse)})},{type:"cleanupContext"}]},{target:"Connected",actions:[{type:"sendApduResponse",params:({event:e})=>({response:(0,t.Right)(e.apduResponse)})},{type:"cleanupContext"}]}],ApduSendingError:{target:"Connected",actions:[{type:"sendApduResponse",params:({event:e})=>({response:(0,t.Left)(e.error)})},"cleanupContext"]},DeviceDetached:{target:"WaitingForReconnection",actions:[{type:"sendApduResponse",params:{response:(0,t.Left)(new d.DeviceDisconnectedWhileSendingError)}},"cleanupContext"]},CloseConnectionCalled:{target:"Terminated",actions:[{type:"sendApduResponse",params:{response:(0,t.Left)(new d.DeviceDisconnectedWhileSendingError)}},"cleanupContext"]},SendApduCalled:{actions:({event:e})=>{console.log("EXTRA SendApduCalled while in state: SendingApdu state"),e.responseCallback((0,t.Left)(new d.AlreadySendingApduError))}}}},WaitingForReconnection:{entry:"startTimer",on:{DeviceAttached:{target:"Connected",actions:"cancelTimer"},SendApduCalled:{target:"WaitingForReconnectionWithQueuedSendApdu",actions:(0,r.assign)({apduInProgress:({event:e})=>t.Maybe.of({apdu:e.apdu,triggersDisconnection:e.triggersDisconnection,responseCallback:e.responseCallback})})},ReconnectionTimedOut:{target:"Terminated"},CloseConnectionCalled:{target:"Terminated"}}},WaitingForReconnectionWithQueuedSendApdu:{on:{DeviceAttached:{target:"SendingApdu",actions:"cancelTimer"},ReconnectionTimedOut:{target:"Terminated",actions:[{type:"sendApduResponse",params:{response:(0,t.Left)(new d.DeviceDisconnectedBeforeSendingApdu)}},{type:"cleanupContext"}]},CloseConnectionCalled:{target:"Terminated",actions:[{type:"sendApduResponse",params:{response:(0,t.Left)(new d.DeviceDisconnectedWhileSendingError)}},"cleanupContext"]},SendApduCalled:{actions:({event:e})=>{console.log("EXTRA SendApduCalled while in state:WaitingForReconnectionWithQueuedSendApdu"),e.responseCallback((0,t.Left)(new d.AlreadySendingApduError))}}}},Terminated:{entry:["signalTermination","closeConnection"],type:"final"}}})}0&&(module.exports={DeviceConnectionStateMachine});
1
+ "use strict";var u=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var C=(r,n)=>{for(var i in n)u(r,i,{get:n[i],enumerable:!0})},v=(r,n,i,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of h(n))!D.call(r,o)&&o!==i&&u(r,o,{get:()=>n[o],enumerable:!(s=g(n,o))||s.enumerable});return r};var y=r=>v(u({},"__esModule",{value:!0}),r);var S={};C(S,{DeviceConnectionStateMachine:()=>R});module.exports=y(S);var t=require("purify-ts"),c=require("xstate"),m=require("../../command/utils/CommandUtils"),l=require("../../Error"),d=require("./Errors");class R{deviceId;deviceAdpuSender;machineActor;timeoutDuration;timeout=null;startReconnectionTimeout(){this.timeout=setTimeout(()=>{this.machineActor.send({type:"ReconnectionTimedOut"})},this.timeoutDuration)}constructor(n){this.deviceId=n.deviceId,this.deviceAdpuSender=n.deviceApduSender,this.timeoutDuration=n.timeoutDuration,this.machineActor=(0,c.createActor)(T({sendApduFn:(i,s,o)=>this.sendApduToDeviceConnection(i,s,o),startReconnectionTimeout:()=>this.startReconnectionTimeout(),cancelReconnectionTimeout:()=>{this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},onTerminated:n.onTerminated,closeConnection:()=>{this.deviceAdpuSender.closeConnection()}})),this.machineActor.start()}sendApduToDeviceConnection(n,i,s){this.deviceAdpuSender.sendApdu(n,i,s).then(o=>{o.caseOf({Left:e=>{this.machineActor.send({type:"ApduSendingError",error:e})},Right:e=>{this.machineActor.send({type:"ApduResponseReceived",apduResponse:e})}})}).catch(o=>{this.machineActor.send({type:"ApduSendingError",error:new l.UnknownDeviceExchangeError(o)})})}getDependencies(){return this.deviceAdpuSender.getDependencies()}setDependencies(n){this.deviceAdpuSender.setDependencies(n)}getDeviceId(){return this.deviceId}sendApdu(n,i,s){return new Promise(o=>{this.machineActor.send({type:"SendApduCalled",apdu:n,triggersDisconnection:!!i,abortTimeout:s,responseCallback:o})})}async setupConnection(){await this.deviceAdpuSender.setupConnection()}eventDeviceAttached(){this.machineActor.send({type:"DeviceAttached"})}eventDeviceDetached(){this.machineActor.send({type:"DeviceDetached"})}closeConnection(){this.machineActor.send({type:"CloseConnectionCalled"})}}function T({sendApduFn:r,startReconnectionTimeout:n,cancelReconnectionTimeout:i,onTerminated:s,closeConnection:o}){return(0,c.setup)({types:{},actions:{startTimer:()=>{n()},cancelTimer:()=>{i()},reconnectionTimeoutEvent:(0,c.emit)({type:"ReconnectionTimedOut"}),sendApdu:({context:e})=>{e.apduInProgress.map(({apdu:p,abortTimeout:a})=>{r(p,!1,a)})},sendApduResponse:({context:e},p)=>{e.apduInProgress.map(({responseCallback:a})=>a(p.response))},cleanupContext:(0,c.assign)({apduInProgress:t.Nothing}),signalTermination:()=>{s()},closeConnection:()=>{o()}},guards:{isApduThatTriggersDisconnection:({context:e},p)=>e.apduInProgress.caseOf({Just:({triggersDisconnection:a,apdu:A})=>(a||m.CommandUtils.isApduThatTriggersDisconnection(A))&&m.CommandUtils.isSuccessResponse(p.apduResponse),Nothing:()=>!1})}}).createMachine({id:"deviceConnection",initial:"Connected",context:{apduInProgress:t.Nothing},states:{Connected:{on:{DeviceDetached:{target:"WaitingForReconnection"},SendApduCalled:{target:"SendingApdu",actions:(0,c.assign)({apduInProgress:({event:e})=>t.Maybe.of({apdu:e.apdu,triggersDisconnection:e.triggersDisconnection,abortTimeout:e.abortTimeout,responseCallback:e.responseCallback})})},CloseConnectionCalled:{target:"Terminated"}}},SendingApdu:{entry:"sendApdu",on:{ApduResponseReceived:[{guard:{type:"isApduThatTriggersDisconnection",params:({event:e})=>({apduResponse:e.apduResponse})},target:"WaitingForReconnection",actions:[{type:"sendApduResponse",params:({event:e})=>({response:(0,t.Right)(e.apduResponse)})},{type:"cleanupContext"}]},{target:"Connected",actions:[{type:"sendApduResponse",params:({event:e})=>({response:(0,t.Right)(e.apduResponse)})},{type:"cleanupContext"}]}],ApduSendingError:{target:"Connected",actions:[{type:"sendApduResponse",params:({event:e})=>({response:(0,t.Left)(e.error)})},"cleanupContext"]},DeviceDetached:{target:"WaitingForReconnection",actions:[{type:"sendApduResponse",params:{response:(0,t.Left)(new d.DeviceDisconnectedWhileSendingError)}},"cleanupContext"]},CloseConnectionCalled:{target:"Terminated",actions:[{type:"sendApduResponse",params:{response:(0,t.Left)(new d.DeviceDisconnectedWhileSendingError)}},"cleanupContext"]},SendApduCalled:{actions:({event:e})=>{e.responseCallback((0,t.Left)(new d.AlreadySendingApduError))}}}},WaitingForReconnection:{entry:"startTimer",on:{DeviceAttached:{target:"Connected",actions:"cancelTimer"},SendApduCalled:{target:"WaitingForReconnectionWithQueuedSendApdu",actions:(0,c.assign)({apduInProgress:({event:e})=>t.Maybe.of({apdu:e.apdu,triggersDisconnection:e.triggersDisconnection,abortTimeout:e.abortTimeout,responseCallback:e.responseCallback})})},ReconnectionTimedOut:{target:"Terminated"},CloseConnectionCalled:{target:"Terminated"}}},WaitingForReconnectionWithQueuedSendApdu:{on:{DeviceAttached:{target:"SendingApdu",actions:"cancelTimer"},ReconnectionTimedOut:{target:"Terminated",actions:[{type:"sendApduResponse",params:{response:(0,t.Left)(new d.DeviceDisconnectedBeforeSendingApdu)}},{type:"cleanupContext"}]},CloseConnectionCalled:{target:"Terminated",actions:[{type:"sendApduResponse",params:{response:(0,t.Left)(new d.DeviceDisconnectedWhileSendingError)}},"cleanupContext"]},SendApduCalled:{actions:({event:e})=>{e.responseCallback((0,t.Left)(new d.AlreadySendingApduError))}}}},Terminated:{entry:["signalTermination","closeConnection"],type:"final"}}})}0&&(module.exports={DeviceConnectionStateMachine});
2
2
  //# sourceMappingURL=DeviceConnectionStateMachine.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/transport/model/DeviceConnectionStateMachine.ts"],
4
- "sourcesContent": ["// import { createBrowserInspector } from \"@statelyai/inspect\";\nimport { type Either, Left, Maybe, Nothing, Right } from \"purify-ts\";\nimport { type Actor, assign, createActor, emit, setup } from \"xstate\";\n\nimport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DmkError, UnknownDeviceExchangeError } from \"@api/Error\";\nimport { type DeviceId } from \"@api/types\";\n\nimport { type DeviceApduSender } from \"./DeviceApduSender\";\nimport {\n AlreadySendingApduError,\n DeviceDisconnectedBeforeSendingApdu,\n DeviceDisconnectedWhileSendingError,\n} from \"./Errors\";\n\n// const { inspect } = createBrowserInspector();\n\ntype DeviceDetachedEvent = {\n type: \"DeviceDetached\";\n};\n\ntype DeviceAttachedEvent = {\n type: \"DeviceAttached\";\n};\n\ntype ApduResponseReceived = {\n type: \"ApduResponseReceived\";\n apduResponse: ApduResponse;\n};\n\ntype ApduSendingError = {\n type: \"ApduSendingError\";\n error: DmkError;\n};\n\ntype SendApduCalled = {\n type: \"SendApduCalled\";\n apdu: Uint8Array;\n triggersDisconnection: boolean;\n responseCallback: (response: Either<DmkError, ApduResponse>) => void;\n};\n\ntype ReconnectionTimedOut = {\n type: \"ReconnectionTimedOut\";\n};\n\ntype CloseConnectionCalled = {\n type: \"CloseConnectionCalled\";\n};\n\nexport type DeviceConnectionEvent =\n | DeviceDetachedEvent\n | DeviceAttachedEvent\n | ApduResponseReceived\n | ApduSendingError\n | SendApduCalled\n | CloseConnectionCalled\n | ReconnectionTimedOut;\n\nexport class DeviceConnectionStateMachine<Dependencies> {\n private deviceId: DeviceId;\n private deviceAdpuSender: DeviceApduSender<Dependencies>;\n\n private machineActor: Actor<ReturnType<typeof makeStateMachine>>;\n\n private timeoutDuration: number;\n private timeout: ReturnType<typeof setTimeout> | null = null;\n\n startReconnectionTimeout() {\n this.timeout = setTimeout(() => {\n this.machineActor.send({ type: \"ReconnectionTimedOut\" });\n }, this.timeoutDuration);\n }\n\n constructor(params: {\n deviceId: DeviceId;\n deviceApduSender: DeviceApduSender<Dependencies>;\n timeoutDuration: number;\n onTerminated: () => void;\n }) {\n this.deviceId = params.deviceId;\n this.deviceAdpuSender = params.deviceApduSender;\n this.timeoutDuration = params.timeoutDuration;\n this.machineActor = createActor(\n makeStateMachine({\n sendApduFn: (apdu, triggersDisconnection) =>\n this.sendApduToDeviceConnection(apdu, triggersDisconnection),\n startReconnectionTimeout: () => this.startReconnectionTimeout(),\n cancelReconnectionTimeout: () => {\n if (this.timeout) {\n clearTimeout(this.timeout);\n this.timeout = null;\n }\n },\n onTerminated: params.onTerminated,\n closeConnection: () => {\n this.deviceAdpuSender.closeConnection();\n },\n }),\n // {\n // // inspect,\n // },\n );\n this.machineActor.start();\n }\n\n private sendApduToDeviceConnection(\n apdu: Uint8Array,\n triggersDisconnection?: boolean,\n ) {\n console.log(\n \"[sendApduToDeviceConnection] called\",\n apdu,\n triggersDisconnection,\n );\n this.deviceAdpuSender\n .sendApdu(apdu, triggersDisconnection)\n .then((response) => {\n response.caseOf({\n Left: (error) => {\n console.log(\n \"[sendApduToDeviceConnection] got error response\",\n error,\n );\n this.machineActor.send({ type: \"ApduSendingError\", error });\n },\n Right: (apduResponse) => {\n console.log(\n \"[sendApduToDeviceConnection] got successful response\",\n apduResponse,\n );\n this.machineActor.send({\n type: \"ApduResponseReceived\",\n apduResponse,\n });\n },\n });\n })\n .catch((error) => {\n console.log(\"[sendApduToDeviceConnection] caught error\", error);\n this.machineActor.send({\n type: \"ApduSendingError\",\n error: new UnknownDeviceExchangeError(error),\n });\n });\n }\n\n /**\n * Called by the transport\n */\n\n public getDependencies(): Dependencies {\n return this.deviceAdpuSender.getDependencies();\n }\n\n public setDependencies(dependencies: Dependencies) {\n this.deviceAdpuSender.setDependencies(dependencies);\n }\n\n public getDeviceId() {\n return this.deviceId;\n }\n\n public sendApdu(\n apdu: Uint8Array,\n triggersDisconnection?: boolean,\n ): Promise<Either<DmkError, ApduResponse>> {\n return new Promise((responseCallback) => {\n this.machineActor.send({\n type: \"SendApduCalled\",\n apdu,\n triggersDisconnection: !!triggersDisconnection,\n responseCallback,\n });\n });\n }\n\n public async setupConnection() {\n await this.deviceAdpuSender.setupConnection();\n }\n\n // State Machine Events\n\n public eventDeviceAttached() {\n this.machineActor.send({ type: \"DeviceAttached\" });\n }\n\n public eventDeviceDetached() {\n this.machineActor.send({ type: \"DeviceDetached\" });\n }\n\n public closeConnection() {\n this.machineActor.send({ type: \"CloseConnectionCalled\" });\n }\n}\n\nfunction makeStateMachine({\n sendApduFn,\n startReconnectionTimeout,\n cancelReconnectionTimeout,\n onTerminated,\n closeConnection,\n}: {\n sendApduFn: (apdu: Uint8Array, triggersDisconnection: boolean) => void;\n startReconnectionTimeout: () => void;\n cancelReconnectionTimeout: () => void;\n onTerminated: () => void;\n closeConnection: () => void;\n}) {\n return setup({\n types: {} as {\n context: {\n apduInProgress: Maybe<{\n apdu: Uint8Array;\n triggersDisconnection: boolean;\n responseCallback: (response: Either<DmkError, ApduResponse>) => void;\n }>;\n };\n events: DeviceConnectionEvent;\n },\n actions: {\n // event transitions\n startTimer: () => {\n startReconnectionTimeout();\n },\n cancelTimer: () => {\n cancelReconnectionTimeout();\n },\n reconnectionTimeoutEvent: emit({ type: \"ReconnectionTimedOut\" }),\n sendApdu: ({ context }) => {\n context.apduInProgress.caseOf({\n Just: ({ apdu }) => {\n sendApduFn(apdu, false);\n },\n Nothing: () => {\n console.error(\"sendApdu called while no apdu in progress\");\n },\n });\n },\n sendApduResponse: (\n { context },\n params: { response: Either<DmkError, ApduResponse> },\n ) => {\n context.apduInProgress.caseOf({\n Just: ({ responseCallback }) => {\n responseCallback(params.response);\n },\n Nothing: () => {\n console.error(\"sendApduResponse called while no apdu in progress\");\n },\n });\n },\n cleanupContext: assign({ apduInProgress: Nothing }),\n signalTermination: () => {\n onTerminated();\n },\n closeConnection: async () => {\n try {\n await closeConnection(); // ASK: how do we handle errors ?\n } catch (e) {\n console.error(\"Error closing connection\", e);\n }\n },\n },\n guards: {\n isApduThatTriggersDisconnection: (\n { context },\n params: { apduResponse: ApduResponse },\n ) => {\n return context.apduInProgress.caseOf({\n Just: ({ triggersDisconnection, apdu }) => {\n const res =\n (triggersDisconnection ||\n CommandUtils.isApduThatTriggersDisconnection(apdu)) &&\n CommandUtils.isSuccessResponse(params.apduResponse);\n console.log(\"isApduThatTriggersDisconnection\", res, apdu);\n return res;\n },\n Nothing: () => false,\n });\n },\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QTANwJYGMwGED2AdgWJgC7qEB0+RJpkAxACJpZgukCGmAFpANoAGALqJQABzyx05QmJAAPRAA4A7AGZKywQEYAnAFYATMoAsBg6fUA2ADQgAnolUnKBjUdXXVpnUb0aAL6B9igY2DTEZBQE1IRR9BAMAMpgBBAAguIQAK44nAA2BQIi8pLSsgTySgjW6oKU6uo61kbWyh06Vsr2TgjqAZR6HUaWXcrqBmrBoawR8XQxcbRkjDgFUrgL0YT5RSWiSCDlMjHVKnrWjaO6ev6qlnp6vYim1qaN9YLqGuPKOjpVDMQGE2JFFlRUul0AQoFlcgx4TkAEpwSQEWBgVHYdCoA5lKSnORHGpNVSUPwGXQDQSmNTDF4IZTWPRDJotUw+HwAnTA0HzFaVShQiAwuHZHKIiWo2DozHYsC4gQ6Q4SQmVc79TxDIzqG6eJq+VSM94NPQ6CYuUzmQGCax8uZbQVLEVipFS3Ku2EAUQATr68L6hKrjuqziTEJNNHrTG1dIIDE8jLTGVTlJQboI2i56QZeSEQY7wTtYl7xQiWOF2GAuLx8UcThqIwh-OmdBZPF0qQCBoydIJlAZKK0jP4bHntBaHVXi0Ky+71ptZzE9sUIMGCRVw6Aau2dJQ6WZlMM-D9+89HIh++mbndVHpdNYLAnp2DtnO0qLYe6RUjV-W1S3Ykd0QABac1KFpbx3kHCxumNS9ak5SDTHNax0NUDRfFMV8BQSJYAHVOFOWEADFA2xd8YmYR0MlIWs+HXUoGzDYDFEQQx90mVozABJ9BAvPo6iuFpRgtQRdDUWNcKdfCqCIkioHI31KOdQgUk-P9CjXDcWKAqpmx0dR-gpCTaXNUxvh7RkvCHWlaWM9RfC6dCZOXeTiPIMiKJIKj1NUuSCAAFXQABbSAAHkclIXTAKJAyQIQLpBHJAEXB8AS1HvdRGT0a0D2ZZpBxjSc3L82IFK8pSfMwcqGEXTF3IIf8mJDRtt3YpLLPJZMWkmTtzJyxD+1UBofifVQOm8YyWjKtSKs8sVlICiECAImQeAARRyMAdogX8JRoqs6IYgDQ30zUjJ8CkWQmYZbOsFLGWzUyzE5bssx8ObAsoSqlpq8r1tILadr2g6ERWksQvCiAopi5i4qbRKjH7Bo4N1dsvFjOxEIeIwUPQ9o9AGSYvG+1bfsW7yVN8+agZB3bIHByUGtk1aWti874s1FGJOHYy6gTLo3lMVN7wPBNVAtbRRg0IEC35NmS0pxTltpwL6e2xn9s0w7mY5hGuaRzrAWZIYBJpc0pd1E18tNMZLOMAwnOCAsCDwFB4CORWms3bnm1AozWSgrHYMsYyEL6FGKXcDleMMO5rXJ5XZ0gP3jZqB4evaLwXEeqwnJNKYDypWlzHePwcIVotyuFT83QldOOpqWNU30A8rEmrMjPcAJk6FP7qch432rY3dxnN1onlaZ9idy5NILuCxl+UEwrH7wiqeqmnarpjatbB3Xcibser3eckfmd3xOkrnpce0DMjHMeoAgLjeqCCsBfVCmFOESE+EqdSfnmNwLJjBPBSs0QwuV3CQWPN3AwT4LTtldoEIAA */\n id: \"deviceConnection\",\n initial: \"Connected\",\n context: {\n apduInProgress: Nothing,\n },\n states: {\n Connected: {\n on: {\n DeviceDetached: {\n target: \"WaitingForReconnection\",\n },\n SendApduCalled: {\n target: \"SendingApdu\",\n actions: assign({\n apduInProgress: ({ event }) => {\n return Maybe.of({\n apdu: event.apdu,\n triggersDisconnection: event.triggersDisconnection,\n responseCallback: event.responseCallback,\n });\n },\n }),\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n },\n },\n },\n SendingApdu: {\n entry: \"sendApdu\",\n on: {\n ApduResponseReceived: [\n {\n guard: {\n type: \"isApduThatTriggersDisconnection\",\n params: ({ event }) => ({ apduResponse: event.apduResponse }),\n },\n target: \"WaitingForReconnection\",\n actions: [\n {\n type: \"sendApduResponse\",\n // https://stately.ai/docs/actions#dynamic-action-parameters\n params: ({ event }) => {\n return {\n response: Right(event.apduResponse),\n };\n },\n },\n { type: \"cleanupContext\" },\n ],\n },\n {\n target: \"Connected\",\n actions: [\n {\n type: \"sendApduResponse\",\n // https://stately.ai/docs/actions#dynamic-action-parameters\n params: ({ event }) => {\n return {\n response: Right(event.apduResponse),\n };\n },\n },\n { type: \"cleanupContext\" },\n ],\n },\n ],\n ApduSendingError: {\n target: \"Connected\",\n actions: [\n {\n type: \"sendApduResponse\",\n // https://stately.ai/docs/actions#dynamic-action-parameters\n params: ({ event }) => {\n return {\n response: Left(event.error),\n };\n },\n },\n \"cleanupContext\",\n ],\n },\n DeviceDetached: {\n target: \"WaitingForReconnection\",\n actions: [\n {\n type: \"sendApduResponse\",\n params: {\n response: Left(new DeviceDisconnectedWhileSendingError()),\n },\n },\n \"cleanupContext\",\n ],\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n actions: [\n {\n type: \"sendApduResponse\",\n params: {\n response: Left(new DeviceDisconnectedWhileSendingError()),\n },\n },\n \"cleanupContext\",\n ],\n },\n SendApduCalled: {\n actions: ({ event }) => {\n console.log(\n \"EXTRA SendApduCalled while in state: SendingApdu state\",\n );\n event.responseCallback(Left(new AlreadySendingApduError()));\n },\n },\n },\n },\n WaitingForReconnection: {\n entry: \"startTimer\",\n on: {\n DeviceAttached: {\n target: \"Connected\",\n actions: \"cancelTimer\",\n },\n SendApduCalled: {\n target: \"WaitingForReconnectionWithQueuedSendApdu\",\n actions: assign({\n apduInProgress: ({ event }) => {\n return Maybe.of({\n apdu: event.apdu,\n triggersDisconnection: event.triggersDisconnection,\n responseCallback: event.responseCallback,\n });\n },\n }),\n },\n ReconnectionTimedOut: {\n target: \"Terminated\",\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n },\n },\n },\n WaitingForReconnectionWithQueuedSendApdu: {\n on: {\n DeviceAttached: {\n target: \"SendingApdu\",\n actions: \"cancelTimer\",\n },\n ReconnectionTimedOut: {\n target: \"Terminated\",\n actions: [\n {\n type: \"sendApduResponse\",\n params: {\n response: Left(new DeviceDisconnectedBeforeSendingApdu()),\n },\n },\n {\n type: \"cleanupContext\",\n },\n ],\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n actions: [\n {\n type: \"sendApduResponse\",\n params: {\n response: Left(new DeviceDisconnectedWhileSendingError()),\n },\n },\n \"cleanupContext\",\n ],\n },\n SendApduCalled: {\n actions: ({ event }) => {\n console.log(\n \"EXTRA SendApduCalled while in state:WaitingForReconnectionWithQueuedSendApdu\",\n );\n event.responseCallback(Left(new AlreadySendingApduError()));\n },\n },\n },\n },\n // TODO: ADD INACTIVE STATE\n Terminated: {\n entry: [\"signalTermination\", \"closeConnection\"],\n type: \"final\",\n },\n },\n });\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kCAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAyD,qBACzDC,EAA6D,kBAE7DC,EAA6B,2CAE7BC,EAA0D,sBAI1DC,EAIO,oBA8CA,MAAMN,CAA2C,CAC9C,SACA,iBAEA,aAEA,gBACA,QAAgD,KAExD,0BAA2B,CACzB,KAAK,QAAU,WAAW,IAAM,CAC9B,KAAK,aAAa,KAAK,CAAE,KAAM,sBAAuB,CAAC,CACzD,EAAG,KAAK,eAAe,CACzB,CAEA,YAAYO,EAKT,CACD,KAAK,SAAWA,EAAO,SACvB,KAAK,iBAAmBA,EAAO,iBAC/B,KAAK,gBAAkBA,EAAO,gBAC9B,KAAK,gBAAe,eAClBC,EAAiB,CACf,WAAY,CAACC,EAAMC,IACjB,KAAK,2BAA2BD,EAAMC,CAAqB,EAC7D,yBAA0B,IAAM,KAAK,yBAAyB,EAC9D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CACF,EACA,gBACF,CACF,EACA,sBAAuB,CACrB,OAAQ,aACR,QAAS,CACP,CACE,KAAM,mBACN,OAAQ,CACN,YAAU,QAAK,IAAI,qCAAqC,CAC1D,CACF,EACA,gBACF,CACF,EACA,eAAgB,CACd,QAAS,CAAC,CAAE,MAAAA,CAAM,IAAM,CACtB,QAAQ,IACN,wDACF,EACAA,EAAM,oBAAiB,QAAK,IAAI,yBAAyB,CAAC,CAC5D,CACF,CACF,CACF,EACA,uBAAwB,CACtB,MAAO,aACP,GAAI,CACF,eAAgB,CACd,OAAQ,YACR,QAAS,aACX,EACA,eAAgB,CACd,OAAQ,2CACR,WAAS,UAAO,CACd,eAAgB,CAAC,CAAE,MAAAA,CAAM,IAChB,QAAM,GAAG,CACd,KAAMA,EAAM,KACZ,sBAAuBA,EAAM,sBAC7B,iBAAkBA,EAAM,gBAC1B,CAAC,CAEL,CAAC,CACH,EACA,qBAAsB,CACpB,OAAQ,YACV,EACA,sBAAuB,CACrB,OAAQ,YACV,CACF,CACF,EACA,yCAA0C,CACxC,GAAI,CACF,eAAgB,CACd,OAAQ,cACR,QAAS,aACX,EACA,qBAAsB,CACpB,OAAQ,aACR,QAAS,CACP,CACE,KAAM,mBACN,OAAQ,CACN,YAAU,QAAK,IAAI,qCAAqC,CAC1D,CACF,EACA,CACE,KAAM,gBACR,CACF,CACF,EACA,sBAAuB,CACrB,OAAQ,aACR,QAAS,CACP,CACE,KAAM,mBACN,OAAQ,CACN,YAAU,QAAK,IAAI,qCAAqC,CAC1D,CACF,EACA,gBACF,CACF,EACA,eAAgB,CACd,QAAS,CAAC,CAAE,MAAAA,CAAM,IAAM,CACtB,QAAQ,IACN,8EACF,EACAA,EAAM,oBAAiB,QAAK,IAAI,yBAAyB,CAAC,CAC5D,CACF,CACF,CACF,EAEA,WAAY,CACV,MAAO,CAAC,oBAAqB,iBAAiB,EAC9C,KAAM,OACR,CACF,CACF,CAAC,CACH",
6
- "names": ["DeviceConnectionStateMachine_exports", "__export", "DeviceConnectionStateMachine", "__toCommonJS", "import_purify_ts", "import_xstate", "import_CommandUtils", "import_Error", "import_Errors", "params", "makeStateMachine", "apdu", "triggersDisconnection", "response", "error", "apduResponse", "dependencies", "responseCallback", "sendApduFn", "startReconnectionTimeout", "cancelReconnectionTimeout", "onTerminated", "closeConnection", "context", "res", "event"]
4
+ "sourcesContent": ["// import { createBrowserInspector } from \"@statelyai/inspect\";\nimport { type Either, Left, Maybe, Nothing, Right } from \"purify-ts\";\nimport { type Actor, assign, createActor, emit, setup } from \"xstate\";\n\nimport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DmkError, UnknownDeviceExchangeError } from \"@api/Error\";\nimport { type DeviceId } from \"@api/types\";\n\nimport { type DeviceApduSender } from \"./DeviceApduSender\";\nimport {\n AlreadySendingApduError,\n DeviceDisconnectedBeforeSendingApdu,\n DeviceDisconnectedWhileSendingError,\n} from \"./Errors\";\n\n// const { inspect } = createBrowserInspector();\n\ntype DeviceDetachedEvent = {\n type: \"DeviceDetached\";\n};\n\ntype DeviceAttachedEvent = {\n type: \"DeviceAttached\";\n};\n\ntype ApduResponseReceived = {\n type: \"ApduResponseReceived\";\n apduResponse: ApduResponse;\n};\n\ntype ApduSendingError = {\n type: \"ApduSendingError\";\n error: DmkError;\n};\n\ntype SendApduCalled = {\n type: \"SendApduCalled\";\n apdu: Uint8Array;\n triggersDisconnection: boolean;\n abortTimeout?: number;\n responseCallback: (response: Either<DmkError, ApduResponse>) => void;\n};\n\ntype ReconnectionTimedOut = {\n type: \"ReconnectionTimedOut\";\n};\n\ntype CloseConnectionCalled = {\n type: \"CloseConnectionCalled\";\n};\n\nexport type DeviceConnectionEvent =\n | DeviceDetachedEvent\n | DeviceAttachedEvent\n | ApduResponseReceived\n | ApduSendingError\n | SendApduCalled\n | CloseConnectionCalled\n | ReconnectionTimedOut;\n\nexport type DeviceConnectionStateMachineParams<Dependencies> = {\n deviceId: DeviceId;\n deviceApduSender: DeviceApduSender<Dependencies>;\n timeoutDuration: number;\n onTerminated: () => void;\n};\n\nexport class DeviceConnectionStateMachine<Dependencies> {\n private deviceId: DeviceId;\n private deviceAdpuSender: DeviceApduSender<Dependencies>;\n\n private machineActor: Actor<ReturnType<typeof makeStateMachine>>;\n\n private timeoutDuration: number;\n private timeout: ReturnType<typeof setTimeout> | null = null;\n\n startReconnectionTimeout() {\n this.timeout = setTimeout(() => {\n this.machineActor.send({ type: \"ReconnectionTimedOut\" });\n }, this.timeoutDuration);\n }\n\n constructor(params: DeviceConnectionStateMachineParams<Dependencies>) {\n this.deviceId = params.deviceId;\n this.deviceAdpuSender = params.deviceApduSender;\n this.timeoutDuration = params.timeoutDuration;\n this.machineActor = createActor(\n makeStateMachine({\n sendApduFn: (apdu, triggersDisconnection, abortTimeout) =>\n this.sendApduToDeviceConnection(\n apdu,\n triggersDisconnection,\n abortTimeout,\n ),\n startReconnectionTimeout: () => this.startReconnectionTimeout(),\n cancelReconnectionTimeout: () => {\n if (this.timeout) {\n clearTimeout(this.timeout);\n this.timeout = null;\n }\n },\n onTerminated: params.onTerminated,\n closeConnection: () => {\n this.deviceAdpuSender.closeConnection();\n },\n }),\n // {\n // // inspect,\n // },\n );\n this.machineActor.start();\n }\n\n private sendApduToDeviceConnection(\n apdu: Uint8Array,\n triggersDisconnection?: boolean,\n abortTimeout?: number,\n ) {\n this.deviceAdpuSender\n .sendApdu(apdu, triggersDisconnection, abortTimeout)\n .then((response) => {\n response.caseOf({\n Left: (error) => {\n this.machineActor.send({ type: \"ApduSendingError\", error });\n },\n Right: (apduResponse) => {\n this.machineActor.send({\n type: \"ApduResponseReceived\",\n apduResponse,\n });\n },\n });\n })\n .catch((error) => {\n this.machineActor.send({\n type: \"ApduSendingError\",\n error: new UnknownDeviceExchangeError(error),\n });\n });\n }\n\n /**\n * Called by the transport\n */\n\n public getDependencies(): Dependencies {\n return this.deviceAdpuSender.getDependencies();\n }\n\n public setDependencies(dependencies: Dependencies) {\n this.deviceAdpuSender.setDependencies(dependencies);\n }\n\n public getDeviceId() {\n return this.deviceId;\n }\n\n public sendApdu(\n apdu: Uint8Array,\n triggersDisconnection?: boolean,\n abortTimeout?: number,\n ): Promise<Either<DmkError, ApduResponse>> {\n return new Promise((responseCallback) => {\n this.machineActor.send({\n type: \"SendApduCalled\",\n apdu,\n triggersDisconnection: !!triggersDisconnection,\n abortTimeout,\n responseCallback,\n });\n });\n }\n\n public async setupConnection() {\n await this.deviceAdpuSender.setupConnection();\n }\n\n // State Machine Events\n\n public eventDeviceAttached() {\n this.machineActor.send({ type: \"DeviceAttached\" });\n }\n\n public eventDeviceDetached() {\n this.machineActor.send({ type: \"DeviceDetached\" });\n }\n\n public closeConnection() {\n this.machineActor.send({ type: \"CloseConnectionCalled\" });\n }\n}\n\nfunction makeStateMachine({\n sendApduFn,\n startReconnectionTimeout,\n cancelReconnectionTimeout,\n onTerminated,\n closeConnection,\n}: {\n sendApduFn: (\n apdu: Uint8Array,\n triggersDisconnection: boolean,\n abortTimeout?: number,\n ) => void;\n startReconnectionTimeout: () => void;\n cancelReconnectionTimeout: () => void;\n onTerminated: () => void;\n closeConnection: () => void;\n}) {\n return setup({\n types: {} as {\n context: {\n apduInProgress: Maybe<{\n apdu: Uint8Array;\n triggersDisconnection: boolean;\n abortTimeout?: number;\n responseCallback: (response: Either<DmkError, ApduResponse>) => void;\n }>;\n };\n events: DeviceConnectionEvent;\n },\n actions: {\n // event transitions\n startTimer: () => {\n startReconnectionTimeout();\n },\n cancelTimer: () => {\n cancelReconnectionTimeout();\n },\n reconnectionTimeoutEvent: emit({ type: \"ReconnectionTimedOut\" }),\n sendApdu: ({ context }) => {\n context.apduInProgress.map(({ apdu, abortTimeout }) => {\n sendApduFn(apdu, false, abortTimeout);\n });\n },\n sendApduResponse: (\n { context },\n params: { response: Either<DmkError, ApduResponse> },\n ) => {\n context.apduInProgress.map(({ responseCallback }) =>\n responseCallback(params.response),\n );\n },\n cleanupContext: assign({ apduInProgress: Nothing }),\n signalTermination: () => {\n onTerminated();\n },\n closeConnection: () => {\n closeConnection(); // ASK: how do we handle errors ?\n },\n },\n guards: {\n isApduThatTriggersDisconnection: (\n { context },\n params: { apduResponse: ApduResponse },\n ) => {\n return context.apduInProgress.caseOf({\n Just: ({ triggersDisconnection, apdu }) => {\n const res =\n (triggersDisconnection ||\n CommandUtils.isApduThatTriggersDisconnection(apdu)) &&\n CommandUtils.isSuccessResponse(params.apduResponse);\n return res;\n },\n Nothing: () => false,\n });\n },\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QTANwJYGMwGED2AdgWJgC7qEB0+RJpkAxACJpZgukCGmAFpANoAGALqJQABzyx05QmJAAPRAA4A7AGZKywQEYAnAFYATMoAsBg6fUA2ADQgAnolUnKBjUdXXVpnUb0aAL6B9igY2DTEZBQE1IRR9BAMAMpgBBAAguIQAK44nAA2BQIi8pLSsgTySgjW6oKU6uo61kbWyh06Vsr2TgjqAZR6HUaWXcrqBmrBoawR8XQxcbRkjDgFUrgL0YT5RSWiSCDlMjHVKnrWjaO6ev6qlnp6vYim1qaN9YLqGuPKOjpVDMQGE2JFFlRUul0AQoFlcgx4TkAEpwSQEWBgVHYdCoA5lKSnORHGpNVSUPwGXQDQSmNTDF4IZTWPRDJotUw+HwAnTA0HzFaVShQiAwuHZHKIiWo2DozHYsC4gQ6Q4SQmVc79TxDIzqG6eJq+VSM94NPQ6CYuUzmQGCax8uZbQVLEVipFS3Ku2EAUQATr68L6hKrjuqziTEJNNHrTG1dIIDE8jLTGVTlJQboI2i56QZeSEQY7wTtYl7xQiWOF2GAuLx8UcThqIwh-OmdBZPF0qQCBoydIJlAZKK0jP4bHntBaHVXi0Ky+71ptZzE9sUIMGCRVw6Aau2dJQ6WZlMM-D9+89HIh++mbndVHpdNYLAnp2DtnO0qLYe6RUjV-W1S3Ykd0QABac1KFpbx3kHCxumNS9ak5SDTHNax0NUDRfFMV8BQSJYAHVOFOWEADFA2xd8YmYR0MlIWs+HXUoGzDYDFEQQx90mVozABJ9BAvPo6iuFpRgtQRdDUWNcKdfCqCIkioHI31KOdQgUk-P9CjXDcWKAqpmx0dR-gpCTaXNUxvh7RkvCHWlaWM9RfC6dCZOXeTiPIMiKJIKj1NUuSCAAFXQABbSAAHkclIXTAKJAyQIQLpBHJAEXB8AS1HvdRGT0a0D2ZZpBxjSc3L82IFK8pSfMwcqGEXTF3IIf8mJDRtt3YpLLPJZMWkmTtzJyxD+1UBofifVQOm8YyWjKtSKs8sVlICiECAImQeAARRyMAdogX8JRoqs6IYgDQ30zUjJ8CkWQmYZbOsFLGWzUyzE5bssx8ObAsoSqlpq8r1tILadr2g6ERWksQvCiAopi5i4qbRKjH7Bo4N1dsvFjOxEIeIwUPQ9o9AGSYvG+1bfsW7yVN8+agZB3bIHByUGtk1aWti874s1FGJOHYy6gTLo3lMVN7wPBNVAtbRRg0IEC35NmS0pxTltpwL6e2xn9s0w7mY5hGuaRzrAWZIYBJpc0pd1E18tNMZLOMAwnOCAsCDwFB4CORWms3bnm1AozWSgrHYMsYyEL6FGKXcDleMMO5rXJ5XZ0gP3jZqB4evaLwXEeqwnJNKYDypWlzHePwcIVotyuFT83QldOOpqWNU30A8rEmrMjPcAJk6FP7qch432rY3dxnN1onlaZ9idy5NILuCxl+UEwrH7wiqeqmnarpjatbB3Xcibser3eckfmd3xOkrnpce0DMjHMeoAgLjeqCCsBfVCmFOESE+EqdSfnmNwLJjBPBSs0QwuV3CQWPN3AwT4LTtldoEIAA */\n id: \"deviceConnection\",\n initial: \"Connected\",\n context: {\n apduInProgress: Nothing,\n },\n states: {\n Connected: {\n on: {\n DeviceDetached: {\n target: \"WaitingForReconnection\",\n },\n SendApduCalled: {\n target: \"SendingApdu\",\n actions: assign({\n apduInProgress: ({ event }) => {\n return Maybe.of({\n apdu: event.apdu,\n triggersDisconnection: event.triggersDisconnection,\n abortTimeout: event.abortTimeout,\n responseCallback: event.responseCallback,\n });\n },\n }),\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n },\n },\n },\n SendingApdu: {\n entry: \"sendApdu\",\n on: {\n ApduResponseReceived: [\n {\n guard: {\n type: \"isApduThatTriggersDisconnection\",\n params: ({ event }) => ({ apduResponse: event.apduResponse }),\n },\n target: \"WaitingForReconnection\",\n actions: [\n {\n type: \"sendApduResponse\",\n // https://stately.ai/docs/actions#dynamic-action-parameters\n params: ({ event }) => {\n return {\n response: Right(event.apduResponse),\n };\n },\n },\n { type: \"cleanupContext\" },\n ],\n },\n {\n target: \"Connected\",\n actions: [\n {\n type: \"sendApduResponse\",\n // https://stately.ai/docs/actions#dynamic-action-parameters\n params: ({ event }) => {\n return {\n response: Right(event.apduResponse),\n };\n },\n },\n { type: \"cleanupContext\" },\n ],\n },\n ],\n ApduSendingError: {\n target: \"Connected\",\n actions: [\n {\n type: \"sendApduResponse\",\n // https://stately.ai/docs/actions#dynamic-action-parameters\n params: ({ event }) => {\n return {\n response: Left(event.error),\n };\n },\n },\n \"cleanupContext\",\n ],\n },\n DeviceDetached: {\n target: \"WaitingForReconnection\",\n actions: [\n {\n type: \"sendApduResponse\",\n params: {\n response: Left(new DeviceDisconnectedWhileSendingError()),\n },\n },\n \"cleanupContext\",\n ],\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n actions: [\n {\n type: \"sendApduResponse\",\n params: {\n response: Left(new DeviceDisconnectedWhileSendingError()),\n },\n },\n \"cleanupContext\",\n ],\n },\n SendApduCalled: {\n actions: ({ event }) => {\n event.responseCallback(Left(new AlreadySendingApduError()));\n },\n },\n },\n },\n WaitingForReconnection: {\n entry: \"startTimer\",\n on: {\n DeviceAttached: {\n target: \"Connected\",\n actions: \"cancelTimer\",\n },\n SendApduCalled: {\n target: \"WaitingForReconnectionWithQueuedSendApdu\",\n actions: assign({\n apduInProgress: ({ event }) => {\n return Maybe.of({\n apdu: event.apdu,\n triggersDisconnection: event.triggersDisconnection,\n abortTimeout: event.abortTimeout,\n responseCallback: event.responseCallback,\n });\n },\n }),\n },\n ReconnectionTimedOut: {\n target: \"Terminated\",\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n },\n },\n },\n WaitingForReconnectionWithQueuedSendApdu: {\n on: {\n DeviceAttached: {\n target: \"SendingApdu\",\n actions: \"cancelTimer\",\n },\n ReconnectionTimedOut: {\n target: \"Terminated\",\n actions: [\n {\n type: \"sendApduResponse\",\n params: {\n response: Left(new DeviceDisconnectedBeforeSendingApdu()),\n },\n },\n {\n type: \"cleanupContext\",\n },\n ],\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n actions: [\n {\n type: \"sendApduResponse\",\n params: {\n response: Left(new DeviceDisconnectedWhileSendingError()),\n },\n },\n \"cleanupContext\",\n ],\n },\n SendApduCalled: {\n actions: ({ event }) => {\n event.responseCallback(Left(new AlreadySendingApduError()));\n },\n },\n },\n },\n // TODO: ADD INACTIVE STATE\n Terminated: {\n entry: [\"signalTermination\", \"closeConnection\"],\n type: \"final\",\n },\n },\n });\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kCAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAyD,qBACzDC,EAA6D,kBAE7DC,EAA6B,2CAE7BC,EAA0D,sBAI1DC,EAIO,oBAsDA,MAAMN,CAA2C,CAC9C,SACA,iBAEA,aAEA,gBACA,QAAgD,KAExD,0BAA2B,CACzB,KAAK,QAAU,WAAW,IAAM,CAC9B,KAAK,aAAa,KAAK,CAAE,KAAM,sBAAuB,CAAC,CACzD,EAAG,KAAK,eAAe,CACzB,CAEA,YAAYO,EAA0D,CACpE,KAAK,SAAWA,EAAO,SACvB,KAAK,iBAAmBA,EAAO,iBAC/B,KAAK,gBAAkBA,EAAO,gBAC9B,KAAK,gBAAe,eAClBC,EAAiB,CACf,WAAY,CAACC,EAAMC,EAAuBC,IACxC,KAAK,2BACHF,EACAC,EACAC,CACF,EACF,yBAA0B,IAAM,KAAK,yBAAyB,EAC9D,0BAA2B,IAAM,CAC3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2CACR,WAAS,UAAO,CACd,eAAgB,CAAC,CAAE,MAAAA,CAAM,IAChB,QAAM,GAAG,CACd,KAAMA,EAAM,KACZ,sBAAuBA,EAAM,sBAC7B,aAAcA,EAAM,aACpB,iBAAkBA,EAAM,gBAC1B,CAAC,CAEL,CAAC,CACH,EACA,qBAAsB,CACpB,OAAQ,YACV,EACA,sBAAuB,CACrB,OAAQ,YACV,CACF,CACF,EACA,yCAA0C,CACxC,GAAI,CACF,eAAgB,CACd,OAAQ,cACR,QAAS,aACX,EACA,qBAAsB,CACpB,OAAQ,aACR,QAAS,CACP,CACE,KAAM,mBACN,OAAQ,CACN,YAAU,QAAK,IAAI,qCAAqC,CAC1D,CACF,EACA,CACE,KAAM,gBACR,CACF,CACF,EACA,sBAAuB,CACrB,OAAQ,aACR,QAAS,CACP,CACE,KAAM,mBACN,OAAQ,CACN,YAAU,QAAK,IAAI,qCAAqC,CAC1D,CACF,EACA,gBACF,CACF,EACA,eAAgB,CACd,QAAS,CAAC,CAAE,MAAAA,CAAM,IAAM,CACtBA,EAAM,oBAAiB,QAAK,IAAI,yBAAyB,CAAC,CAC5D,CACF,CACF,CACF,EAEA,WAAY,CACV,MAAO,CAAC,oBAAqB,iBAAiB,EAC9C,KAAM,OACR,CACF,CACF,CAAC,CACH",
6
+ "names": ["DeviceConnectionStateMachine_exports", "__export", "DeviceConnectionStateMachine", "__toCommonJS", "import_purify_ts", "import_xstate", "import_CommandUtils", "import_Error", "import_Errors", "params", "makeStateMachine", "apdu", "triggersDisconnection", "abortTimeout", "response", "error", "apduResponse", "dependencies", "responseCallback", "sendApduFn", "startReconnectionTimeout", "cancelReconnectionTimeout", "onTerminated", "closeConnection", "context", "event"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var l=(o,e)=>{for(var r in e)s(o,r,{get:e[r],enumerable:!0})},u=(o,e,r,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of a(e))!i.call(o,t)&&t!==r&&s(o,t,{get:()=>e[t],enumerable:!(d=c(e,t))||d.enumerable});return o};var p=o=>u(s({},"__esModule",{value:!0}),o);var h={};l(h,{AlreadySendingApduError:()=>C,DeviceAlreadyConnectedError:()=>E,DeviceDisconnectedBeforeSendingApdu:()=>T,DeviceDisconnectedWhileSendingError:()=>m,DeviceNotInitializedError:()=>A,DeviceNotRecognizedError:()=>y,DisconnectError:()=>w,GeneralDmkError:()=>n,NoAccessibleDeviceError:()=>v,NoTransportProvidedError:()=>f,NoTransportsProvidedError:()=>N,OpeningConnectionError:()=>x,ReconnectionFailedError:()=>_,SendApduConcurrencyError:()=>k,TransportAlreadyExistsError:()=>S,TransportNotSupportedError:()=>D,UnknownDeviceError:()=>g});module.exports=p(h);class n{_tag="GeneralDmkError";originalError;constructor(e){e instanceof Error?this.originalError=e:e!==void 0&&(this.originalError=new Error(String(e)))}}class E extends n{constructor(r){super(r);this.err=r}_tag="DeviceAlreadyDiscoveredError"}class y extends n{constructor(r){super(r);this.err=r}_tag="DeviceNotRecognizedError"}class v extends n{constructor(r){super(r);this.err=r}_tag="NoAccessibleDeviceError"}class x extends n{constructor(r){super(r);this.err=r}_tag="ConnectionOpeningError"}class g extends n{constructor(r){super(r);this.err=r}_tag="UnknownDeviceError"}class D extends n{constructor(r){super(r);this.err=r}_tag="TransportNotSupportedError"}class k extends n{constructor(r){super(r);this.err=r}_tag="SendApduConcurrencyError"}class w extends n{constructor(r){super(r);this.err=r}_tag="DisconnectError"}class _ extends n{constructor(r){super(r);this.err=r}_tag="ReconnectionFailedError"}class A extends n{constructor(r){super(r);this.err=r}_tag="DeviceNotInitializedError"}class N extends n{constructor(r){super(r);this.err=r}_tag="NoTransportsProvidedError"}class S extends n{constructor(r){super(r);this.err=r}_tag="TransportAlreadyExistsError"}class m extends n{constructor(r){super(r);this.err=r}_tag="DeviceDisconnectedWhileSendingError"}class C extends n{constructor(r){super(r);this.err=r}_tag="AlreadySendingApduError"}class T extends n{constructor(r){super(r);this.err=r}_tag="DeviceDisconnectedBeforeSendingApdu"}class f extends n{constructor(r){super(r);this.err=r}_tag="NoTransportProvidedError"}0&&(module.exports={AlreadySendingApduError,DeviceAlreadyConnectedError,DeviceDisconnectedBeforeSendingApdu,DeviceDisconnectedWhileSendingError,DeviceNotInitializedError,DeviceNotRecognizedError,DisconnectError,GeneralDmkError,NoAccessibleDeviceError,NoTransportProvidedError,NoTransportsProvidedError,OpeningConnectionError,ReconnectionFailedError,SendApduConcurrencyError,TransportAlreadyExistsError,TransportNotSupportedError,UnknownDeviceError});
1
+ "use strict";var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var l=(o,e)=>{for(var r in e)s(o,r,{get:e[r],enumerable:!0})},u=(o,e,r,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of a(e))!i.call(o,t)&&t!==r&&s(o,t,{get:()=>e[t],enumerable:!(d=c(e,t))||d.enumerable});return o};var p=o=>u(s({},"__esModule",{value:!0}),o);var z={};l(z,{AlreadySendingApduError:()=>f,DeviceAlreadyConnectedError:()=>E,DeviceDisconnectedBeforeSendingApdu:()=>R,DeviceDisconnectedWhileSendingError:()=>C,DeviceNotInitializedError:()=>m,DeviceNotRecognizedError:()=>y,DisconnectError:()=>_,GeneralDmkError:()=>n,NoAccessibleDeviceError:()=>x,NoTransportProvidedError:()=>h,NoTransportsProvidedError:()=>N,OpeningConnectionError:()=>v,ReconnectionFailedError:()=>S,SendApduConcurrencyError:()=>D,SendApduEmptyResponseError:()=>A,SendApduTimeoutError:()=>w,TransportAlreadyExistsError:()=>T,TransportNotSupportedError:()=>k,UnknownDeviceError:()=>g});module.exports=p(z);class n{_tag="GeneralDmkError";originalError;constructor(e){e instanceof Error?this.originalError=e:e!==void 0&&(this.originalError=new Error(String(e)))}}class E extends n{constructor(r){super(r);this.err=r}_tag="DeviceAlreadyDiscoveredError"}class y extends n{constructor(r){super(r);this.err=r}_tag="DeviceNotRecognizedError"}class x extends n{constructor(r){super(r);this.err=r}_tag="NoAccessibleDeviceError"}class v extends n{_tag="ConnectionOpeningError";constructor(e){super(e)}}class g extends n{constructor(r){super(r);this.err=r}_tag="UnknownDeviceError"}class k extends n{constructor(r){super(r);this.err=r}_tag="TransportNotSupportedError"}class D extends n{constructor(r){super(r);this.err=r}_tag="SendApduConcurrencyError"}class w extends n{constructor(r){super(r);this.err=r}_tag="SendApduTimeoutError"}class A extends n{constructor(r){super(r);this.err=r}_tag="SendApduEmptyResponseError"}class _ extends n{constructor(r){super(r);this.err=r}_tag="DisconnectError"}class S extends n{constructor(r){super(r);this.err=r}_tag="ReconnectionFailedError"}class m extends n{constructor(r){super(r);this.err=r}_tag="DeviceNotInitializedError"}class N extends n{constructor(r){super(r);this.err=r}_tag="NoTransportsProvidedError"}class T extends n{constructor(r){super(r);this.err=r}_tag="TransportAlreadyExistsError"}class C extends n{constructor(r){super(r);this.err=r}_tag="DeviceDisconnectedWhileSendingError"}class f extends n{constructor(r){super(r);this.err=r}_tag="AlreadySendingApduError"}class R extends n{constructor(r){super(r);this.err=r}_tag="DeviceDisconnectedBeforeSendingApdu"}class h extends n{constructor(r){super(r);this.err=r}_tag="NoTransportProvidedError"}0&&(module.exports={AlreadySendingApduError,DeviceAlreadyConnectedError,DeviceDisconnectedBeforeSendingApdu,DeviceDisconnectedWhileSendingError,DeviceNotInitializedError,DeviceNotRecognizedError,DisconnectError,GeneralDmkError,NoAccessibleDeviceError,NoTransportProvidedError,NoTransportsProvidedError,OpeningConnectionError,ReconnectionFailedError,SendApduConcurrencyError,SendApduEmptyResponseError,SendApduTimeoutError,TransportAlreadyExistsError,TransportNotSupportedError,UnknownDeviceError});
2
2
  //# sourceMappingURL=Errors.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/transport/model/Errors.ts"],
4
- "sourcesContent": ["import { type DmkError } from \"@api/Error\";\n\nexport type ConnectError =\n | UnknownDeviceError\n | OpeningConnectionError\n | DeviceAlreadyConnectedError;\n\nexport class GeneralDmkError implements DmkError {\n _tag = \"GeneralDmkError\";\n originalError?: unknown;\n constructor(err?: unknown) {\n if (err instanceof Error) {\n this.originalError = err;\n } else if (err !== undefined) {\n this.originalError = new Error(String(err));\n }\n }\n}\n\nexport class DeviceAlreadyConnectedError extends GeneralDmkError {\n override readonly _tag = \"DeviceAlreadyDiscoveredError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class DeviceNotRecognizedError extends GeneralDmkError {\n override readonly _tag = \"DeviceNotRecognizedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class NoAccessibleDeviceError extends GeneralDmkError {\n override readonly _tag = \"NoAccessibleDeviceError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class OpeningConnectionError extends GeneralDmkError {\n override readonly _tag = \"ConnectionOpeningError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class UnknownDeviceError extends GeneralDmkError {\n override readonly _tag = \"UnknownDeviceError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class TransportNotSupportedError extends GeneralDmkError {\n override readonly _tag = \"TransportNotSupportedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class SendApduConcurrencyError extends GeneralDmkError {\n override readonly _tag = \"SendApduConcurrencyError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class DisconnectError extends GeneralDmkError {\n override readonly _tag = \"DisconnectError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class ReconnectionFailedError extends GeneralDmkError {\n override readonly _tag = \"ReconnectionFailedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class DeviceNotInitializedError extends GeneralDmkError {\n override readonly _tag = \"DeviceNotInitializedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class NoTransportsProvidedError extends GeneralDmkError {\n override readonly _tag = \"NoTransportsProvidedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class TransportAlreadyExistsError extends GeneralDmkError {\n override readonly _tag = \"TransportAlreadyExistsError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class DeviceDisconnectedWhileSendingError extends GeneralDmkError {\n override readonly _tag = \"DeviceDisconnectedWhileSendingError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class AlreadySendingApduError extends GeneralDmkError {\n override readonly _tag = \"AlreadySendingApduError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class DeviceDisconnectedBeforeSendingApdu extends GeneralDmkError {\n override readonly _tag = \"DeviceDisconnectedBeforeSendingApdu\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class NoTransportProvidedError extends GeneralDmkError {\n override readonly _tag = \"NoTransportProvidedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,gCAAAC,EAAA,wCAAAC,EAAA,wCAAAC,EAAA,8BAAAC,EAAA,6BAAAC,EAAA,oBAAAC,EAAA,oBAAAC,EAAA,4BAAAC,EAAA,6BAAAC,EAAA,8BAAAC,EAAA,2BAAAC,EAAA,4BAAAC,EAAA,6BAAAC,EAAA,gCAAAC,EAAA,+BAAAC,EAAA,uBAAAC,IAAA,eAAAC,EAAAnB,GAOO,MAAMS,CAAoC,CAC/C,KAAO,kBACP,cACA,YAAYW,EAAe,CACrBA,aAAe,MACjB,KAAK,cAAgBA,EACZA,IAAQ,SACjB,KAAK,cAAgB,IAAI,MAAM,OAAOA,CAAG,CAAC,EAE9C,CACF,CAEO,MAAMjB,UAAoCM,CAAgB,CAE/D,YAAqBW,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,8BAI3B,CA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,CAEvE,YAAqBW,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,qCAI3B,CAEO,MAAMlB,UAAgCO,CAAgB,CAE3D,YAAqBW,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,yBAI3B,CAEO,MAAMhB,UAA4CK,CAAgB,CAEvE,YAAqBW,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,qCAI3B,CAEO,MAAMT,UAAiCF,CAAgB,CAE5D,YAAqBW,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,0BAI3B",
6
- "names": ["Errors_exports", "__export", "AlreadySendingApduError", "DeviceAlreadyConnectedError", "DeviceDisconnectedBeforeSendingApdu", "DeviceDisconnectedWhileSendingError", "DeviceNotInitializedError", "DeviceNotRecognizedError", "DisconnectError", "GeneralDmkError", "NoAccessibleDeviceError", "NoTransportProvidedError", "NoTransportsProvidedError", "OpeningConnectionError", "ReconnectionFailedError", "SendApduConcurrencyError", "TransportAlreadyExistsError", "TransportNotSupportedError", "UnknownDeviceError", "__toCommonJS", "err"]
4
+ "sourcesContent": ["import { type DmkError } from \"@api/Error\";\n\nexport type ConnectError =\n | UnknownDeviceError\n | OpeningConnectionError\n | DeviceAlreadyConnectedError;\n\nexport class GeneralDmkError implements DmkError {\n _tag = \"GeneralDmkError\";\n originalError?: unknown;\n constructor(err?: unknown) {\n if (err instanceof Error) {\n this.originalError = err;\n } else if (err !== undefined) {\n this.originalError = new Error(String(err));\n }\n }\n}\n\nexport class DeviceAlreadyConnectedError extends GeneralDmkError {\n override readonly _tag = \"DeviceAlreadyDiscoveredError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class DeviceNotRecognizedError extends GeneralDmkError {\n override readonly _tag = \"DeviceNotRecognizedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class NoAccessibleDeviceError extends GeneralDmkError {\n override readonly _tag = \"NoAccessibleDeviceError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class OpeningConnectionError extends GeneralDmkError {\n override _tag = \"ConnectionOpeningError\";\n constructor(err?: unknown) {\n super(err);\n }\n}\n\nexport class UnknownDeviceError extends GeneralDmkError {\n override readonly _tag = \"UnknownDeviceError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class TransportNotSupportedError extends GeneralDmkError {\n override readonly _tag = \"TransportNotSupportedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\nexport class SendApduConcurrencyError extends GeneralDmkError {\n override readonly _tag = \"SendApduConcurrencyError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class SendApduTimeoutError extends GeneralDmkError {\n override readonly _tag = \"SendApduTimeoutError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class SendApduEmptyResponseError extends GeneralDmkError {\n override readonly _tag = \"SendApduEmptyResponseError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class DisconnectError extends GeneralDmkError {\n override readonly _tag = \"DisconnectError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class ReconnectionFailedError extends GeneralDmkError {\n override readonly _tag = \"ReconnectionFailedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class DeviceNotInitializedError extends GeneralDmkError {\n override readonly _tag = \"DeviceNotInitializedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class NoTransportsProvidedError extends GeneralDmkError {\n override readonly _tag = \"NoTransportsProvidedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class TransportAlreadyExistsError extends GeneralDmkError {\n override readonly _tag = \"TransportAlreadyExistsError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class DeviceDisconnectedWhileSendingError extends GeneralDmkError {\n override readonly _tag = \"DeviceDisconnectedWhileSendingError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class AlreadySendingApduError extends GeneralDmkError {\n override readonly _tag = \"AlreadySendingApduError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class DeviceDisconnectedBeforeSendingApdu extends GeneralDmkError {\n override readonly _tag = \"DeviceDisconnectedBeforeSendingApdu\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class NoTransportProvidedError extends GeneralDmkError {\n override readonly _tag = \"NoTransportProvidedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,gCAAAC,EAAA,wCAAAC,EAAA,wCAAAC,EAAA,8BAAAC,EAAA,6BAAAC,EAAA,oBAAAC,EAAA,oBAAAC,EAAA,4BAAAC,EAAA,6BAAAC,EAAA,8BAAAC,EAAA,2BAAAC,EAAA,4BAAAC,EAAA,6BAAAC,EAAA,+BAAAC,EAAA,yBAAAC,EAAA,gCAAAC,EAAA,+BAAAC,EAAA,uBAAAC,IAAA,eAAAC,EAAArB,GAOO,MAAMS,CAAoC,CAC/C,KAAO,kBACP,cACA,YAAYa,EAAe,CACrBA,aAAe,MACjB,KAAK,cAAgBA,EACZA,IAAQ,SACjB,KAAK,cAAgB,IAAI,MAAM,OAAOA,CAAG,CAAC,EAE9C,CACF,CAEO,MAAMnB,UAAoCM,CAAgB,CAE/D,YAAqBa,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,8BAI3B,CAEO,MAAMf,UAAiCE,CAAgB,CAE5D,YAAqBa,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,0BAI3B,CAEO,MAAMZ,UAAgCD,CAAgB,CAE3D,YAAqBa,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,yBAI3B,CAEO,MAAMT,UAA+BJ,CAAgB,CACjD,KAAO,yBAChB,YAAYa,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CAI3B,CAEO,MAAMpB,UAAgCO,CAAgB,CAE3D,YAAqBa,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,yBAI3B,CAEO,MAAMlB,UAA4CK,CAAgB,CAEvE,YAAqBa,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,qCAI3B,CAEO,MAAMX,UAAiCF,CAAgB,CAE5D,YAAqBa,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,0BAI3B",
6
+ "names": ["Errors_exports", "__export", "AlreadySendingApduError", "DeviceAlreadyConnectedError", "DeviceDisconnectedBeforeSendingApdu", "DeviceDisconnectedWhileSendingError", "DeviceNotInitializedError", "DeviceNotRecognizedError", "DisconnectError", "GeneralDmkError", "NoAccessibleDeviceError", "NoTransportProvidedError", "NoTransportsProvidedError", "OpeningConnectionError", "ReconnectionFailedError", "SendApduConcurrencyError", "SendApduEmptyResponseError", "SendApduTimeoutError", "TransportAlreadyExistsError", "TransportNotSupportedError", "UnknownDeviceError", "__toCommonJS", "err"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/transport/model/Transport.ts"],
4
- "sourcesContent": ["import { type Either } from \"purify-ts\";\nimport { type Observable } from \"rxjs\";\n\nimport { type DeviceId } from \"@api/device/DeviceModel\";\nimport { type DeviceModelDataSource } from \"@api/device-model/data/DeviceModelDataSource\";\nimport { type ApduReceiverServiceFactory } from \"@api/device-session/service/ApduReceiverService\";\nimport { type ApduSenderServiceFactory } from \"@api/device-session/service/ApduSenderService\";\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { type DmkError } from \"@api/Error\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { type ConnectError } from \"@api/transport/model/Errors\";\nimport { type TransportDiscoveredDevice } from \"@api/transport/model/TransportDiscoveredDevice\";\nimport { type TransportIdentifier } from \"@api/transport/model/TransportIdentifier\";\n\nimport { type TransportConnectedDevice } from \"./TransportConnectedDevice\";\n\nexport type DisconnectHandler = (deviceId: DeviceId) => void;\n\n/**\n * Transport interface\n */\nexport interface Transport {\n /**\n * Get the transport identifier, which is a string to uniquely identify that transport.\n */\n getIdentifier(): TransportIdentifier;\n\n isSupported(): boolean;\n\n startDiscovering(): Observable<TransportDiscoveredDevice>;\n\n stopDiscovering(): void;\n\n listenToAvailableDevices(): Observable<TransportDiscoveredDevice[]>;\n\n /**\n * Enables communication with the device by connecting to it.\n *\n * @param params containing\n * - id: the device id from the DTO discovered device\n */\n connect(params: {\n deviceId: DeviceId;\n onDisconnect: DisconnectHandler;\n }): Promise<Either<ConnectError, TransportConnectedDevice>>;\n\n disconnect(params: {\n connectedDevice: TransportConnectedDevice;\n }): Promise<Either<DmkError, void>>;\n}\n\nexport type TransportArgs = {\n deviceModelDataSource: DeviceModelDataSource;\n loggerServiceFactory: (tag: string) => LoggerPublisherService;\n config: DmkConfig;\n apduSenderServiceFactory: ApduSenderServiceFactory;\n apduReceiverServiceFactory: ApduReceiverServiceFactory;\n};\n\nexport type TransportFactory = (args: TransportArgs) => Transport;\n"],
4
+ "sourcesContent": ["import { type Either } from \"purify-ts\";\nimport { type Observable } from \"rxjs\";\n\nimport { type DeviceId } from \"@api/device/DeviceModel\";\nimport { type DeviceModelDataSource } from \"@api/device-model/data/DeviceModelDataSource\";\nimport { type ApduReceiverServiceFactory } from \"@api/device-session/service/ApduReceiverService\";\nimport { type ApduSenderServiceFactory } from \"@api/device-session/service/ApduSenderService\";\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { type DmkError } from \"@api/Error\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { type ConnectError } from \"@api/transport/model/Errors\";\nimport { type TransportDiscoveredDevice } from \"@api/transport/model/TransportDiscoveredDevice\";\nimport { type TransportIdentifier } from \"@api/transport/model/TransportIdentifier\";\n\nimport { type TransportConnectedDevice } from \"./TransportConnectedDevice\";\n\nexport type DisconnectHandler = (deviceId: DeviceId) => void;\n\n/**\n * Transport interface\n */\nexport interface Transport {\n /**\n * Get the transport identifier, which is a string to uniquely identify that transport.\n */\n getIdentifier(): TransportIdentifier;\n\n isSupported(): boolean;\n\n startDiscovering(): Observable<TransportDiscoveredDevice>;\n\n stopDiscovering(): void | Promise<void>;\n\n listenToAvailableDevices(): Observable<TransportDiscoveredDevice[]>;\n\n /**\n * Enables communication with the device by connecting to it.\n *\n * @param params containing\n * - id: the device id from the DTO discovered device\n */\n connect(params: {\n deviceId: DeviceId;\n onDisconnect: DisconnectHandler;\n }): Promise<Either<ConnectError, TransportConnectedDevice>>;\n\n disconnect(params: {\n connectedDevice: TransportConnectedDevice;\n }): Promise<Either<DmkError, void>>;\n}\n\nexport type TransportArgs = {\n deviceModelDataSource: DeviceModelDataSource;\n loggerServiceFactory: (tag: string) => LoggerPublisherService;\n config: DmkConfig;\n apduSenderServiceFactory: ApduSenderServiceFactory;\n apduReceiverServiceFactory: ApduReceiverServiceFactory;\n};\n\nexport type TransportFactory = (args: TransportArgs) => Transport;\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["Transport_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var t=require("purify-ts"),r=require("../../device-model/model/DeviceModel.stub"),o=require("../../device-session/ApduResponse.stub"),c=require("./TransportConnectedDevice"),i=require("./TransportConnectedDevice.stub");describe("TransportConnectedDevice",()=>{let e;beforeEach(()=>{e=(0,i.connectedDeviceStubBuilder)()}),it("should create an instance",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(c.TransportConnectedDevice)}),it("should return the correct id",()=>{expect(e.id).toEqual("42")}),it("should return the correct device model",()=>{expect(JSON.stringify(e.deviceModel)).toEqual(JSON.stringify((0,r.deviceModelStubBuilder)()))}),it("should return the correct type",()=>{expect(e.type).toEqual("MOCK")}),it("should return the correct send apdu response",()=>{expect(e.sendApdu(new Uint8Array)).resolves.toMatchObject((0,t.Right)((0,o.defaultApduResponseStubBuilder)()))})});
1
+ "use strict";var t=require("purify-ts"),r=require("../../device-model/model/DeviceModel.stub"),o=require("../../device-session/ApduResponse.stub"),c=require("./TransportConnectedDevice"),i=require("./TransportConnectedDevice.stub");describe("TransportConnectedDevice",()=>{let e;beforeEach(()=>{e=(0,i.connectedDeviceStubBuilder)()}),it("should create an instance",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(c.TransportConnectedDevice)}),it("should return the correct id",()=>{expect(e.id).toEqual("42")}),it("should return the correct device model",()=>{expect(JSON.stringify(e.deviceModel)).toEqual(JSON.stringify((0,r.deviceModelStubBuilder)()))}),it("should return the correct type",()=>{expect(e.type).toEqual("MOCK")}),it("should return the correct send apdu response",async()=>{const n=await e.sendApdu(new Uint8Array);expect(n).toMatchObject((0,t.Right)((0,o.defaultApduResponseStubBuilder)()))})});
2
2
  //# sourceMappingURL=TransportConnectedDevice.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/transport/model/TransportConnectedDevice.test.ts"],
4
- "sourcesContent": ["import { Right } from \"purify-ts\";\n\nimport { deviceModelStubBuilder } from \"@api/device-model/model/DeviceModel.stub\";\nimport { defaultApduResponseStubBuilder } from \"@api/device-session/ApduResponse.stub\";\n\nimport { TransportConnectedDevice } from \"./TransportConnectedDevice\";\nimport { connectedDeviceStubBuilder } from \"./TransportConnectedDevice.stub\";\n\ndescribe(\"TransportConnectedDevice\", () => {\n let connectedDevice: TransportConnectedDevice;\n\n beforeEach(() => {\n connectedDevice = connectedDeviceStubBuilder();\n });\n\n it(\"should create an instance\", () => {\n expect(connectedDevice).toBeDefined();\n expect(connectedDevice).toBeInstanceOf(TransportConnectedDevice);\n });\n\n it(\"should return the correct id\", () => {\n expect(connectedDevice.id).toEqual(\"42\");\n });\n\n it(\"should return the correct device model\", () => {\n expect(JSON.stringify(connectedDevice.deviceModel)).toEqual(\n JSON.stringify(deviceModelStubBuilder()),\n );\n });\n\n it(\"should return the correct type\", () => {\n expect(connectedDevice.type).toEqual(\"MOCK\");\n });\n\n it(\"should return the correct send apdu response\", () => {\n expect(connectedDevice.sendApdu(new Uint8Array())).resolves.toMatchObject(\n Right(defaultApduResponseStubBuilder()),\n );\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAAsB,qBAEtBC,EAAuC,oDACvCC,EAA+C,iDAE/CC,EAAyC,sCACzCA,EAA2C,2CAE3C,SAAS,2BAA4B,IAAM,CACzC,IAAIC,EAEJ,WAAW,IAAM,CACfA,KAAkB,8BAA2B,CAC/C,CAAC,EAED,GAAG,4BAA6B,IAAM,CACpC,OAAOA,CAAe,EAAE,YAAY,EACpC,OAAOA,CAAe,EAAE,eAAe,0BAAwB,CACjE,CAAC,EAED,GAAG,+BAAgC,IAAM,CACvC,OAAOA,EAAgB,EAAE,EAAE,QAAQ,IAAI,CACzC,CAAC,EAED,GAAG,yCAA0C,IAAM,CACjD,OAAO,KAAK,UAAUA,EAAgB,WAAW,CAAC,EAAE,QAClD,KAAK,aAAU,0BAAuB,CAAC,CACzC,CACF,CAAC,EAED,GAAG,iCAAkC,IAAM,CACzC,OAAOA,EAAgB,IAAI,EAAE,QAAQ,MAAM,CAC7C,CAAC,EAED,GAAG,+CAAgD,IAAM,CACvD,OAAOA,EAAgB,SAAS,IAAI,UAAY,CAAC,EAAE,SAAS,iBAC1D,YAAM,kCAA+B,CAAC,CACxC,CACF,CAAC,CACH,CAAC",
6
- "names": ["import_purify_ts", "import_DeviceModel", "import_ApduResponse", "import_TransportConnectedDevice", "connectedDevice"]
4
+ "sourcesContent": ["import { Right } from \"purify-ts\";\n\nimport { deviceModelStubBuilder } from \"@api/device-model/model/DeviceModel.stub\";\nimport { defaultApduResponseStubBuilder } from \"@api/device-session/ApduResponse.stub\";\n\nimport { TransportConnectedDevice } from \"./TransportConnectedDevice\";\nimport { connectedDeviceStubBuilder } from \"./TransportConnectedDevice.stub\";\n\ndescribe(\"TransportConnectedDevice\", () => {\n let connectedDevice: TransportConnectedDevice;\n\n beforeEach(() => {\n connectedDevice = connectedDeviceStubBuilder();\n });\n\n it(\"should create an instance\", () => {\n expect(connectedDevice).toBeDefined();\n expect(connectedDevice).toBeInstanceOf(TransportConnectedDevice);\n });\n\n it(\"should return the correct id\", () => {\n expect(connectedDevice.id).toEqual(\"42\");\n });\n\n it(\"should return the correct device model\", () => {\n expect(JSON.stringify(connectedDevice.deviceModel)).toEqual(\n JSON.stringify(deviceModelStubBuilder()),\n );\n });\n\n it(\"should return the correct type\", () => {\n expect(connectedDevice.type).toEqual(\"MOCK\");\n });\n\n it(\"should return the correct send apdu response\", async () => {\n const res = await connectedDevice.sendApdu(new Uint8Array());\n expect(res).toMatchObject(Right(defaultApduResponseStubBuilder()));\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAAsB,qBAEtBC,EAAuC,oDACvCC,EAA+C,iDAE/CC,EAAyC,sCACzCA,EAA2C,2CAE3C,SAAS,2BAA4B,IAAM,CACzC,IAAIC,EAEJ,WAAW,IAAM,CACfA,KAAkB,8BAA2B,CAC/C,CAAC,EAED,GAAG,4BAA6B,IAAM,CACpC,OAAOA,CAAe,EAAE,YAAY,EACpC,OAAOA,CAAe,EAAE,eAAe,0BAAwB,CACjE,CAAC,EAED,GAAG,+BAAgC,IAAM,CACvC,OAAOA,EAAgB,EAAE,EAAE,QAAQ,IAAI,CACzC,CAAC,EAED,GAAG,yCAA0C,IAAM,CACjD,OAAO,KAAK,UAAUA,EAAgB,WAAW,CAAC,EAAE,QAClD,KAAK,aAAU,0BAAuB,CAAC,CACzC,CACF,CAAC,EAED,GAAG,iCAAkC,IAAM,CACzC,OAAOA,EAAgB,IAAI,EAAE,QAAQ,MAAM,CAC7C,CAAC,EAED,GAAG,+CAAgD,SAAY,CAC7D,MAAMC,EAAM,MAAMD,EAAgB,SAAS,IAAI,UAAY,EAC3D,OAAOC,CAAG,EAAE,iBAAc,YAAM,kCAA+B,CAAC,CAAC,CACnE,CAAC,CACH,CAAC",
6
+ "names": ["import_purify_ts", "import_DeviceModel", "import_ApduResponse", "import_TransportConnectedDevice", "connectedDevice", "res"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var n=Object.prototype.hasOwnProperty;var m=(t,e,s,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of i(e))!n.call(t,r)&&r!==s&&o(t,r,{get:()=>e[r],enumerable:!(p=a(e,r))||p.enumerable});return t};var c=t=>m(o({},"__esModule",{value:!0}),t);var d={};module.exports=c(d);
1
+ "use strict";var o=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var A=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of i(e))!s.call(t,p)&&p!==n&&o(t,p,{get:()=>e[p],enumerable:!(r=a(e,p))||r.enumerable});return t};var d=t=>A(o({},"__esModule",{value:!0}),t);var y={};module.exports=d(y);
2
2
  //# sourceMappingURL=types.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/types.ts"],
4
- "sourcesContent": ["export type { OpenAppErrorCodes } from \"./command/os/OpenAppCommand\";\nexport type { CommandErrors } from \"./command/utils/CommandErrors\";\nexport type { DeviceId } from \"./device/DeviceModel\";\nexport type { ConnectionType } from \"./discovery/ConnectionType\";\nexport type { CommandErrorArgs } from \"./Error\";\nexport type { LogSubscriberOptions } from \"./logger-subscriber/model/LogSubscriberOptions\";\nexport type { DiscoveredDevice } from \"./transport/model/DiscoveredDevice\";\nexport type {\n Transport,\n TransportArgs,\n TransportFactory,\n} from \"./transport/model/Transport\";\nexport type { TransportIdentifier } from \"./transport/model/TransportIdentifier\";\nexport type { ApduBuilderArgs } from \"@api/apdu/utils/ApduBuilder\";\nexport type { Command } from \"@api/command/Command\";\nexport type {\n CommandErrorResult,\n CommandResult,\n CommandSuccessResult,\n} from \"@api/command/model/CommandResult\";\nexport type { SendCommandUseCaseArgs } from \"@api/command/use-case/SendCommandUseCase\";\nexport type { DeviceModelId } from \"@api/device/DeviceModel\";\nexport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n} from \"@api/device-action/DeviceAction\";\nexport {\n type GetDeviceStatusDAError,\n type GetDeviceStatusDAInput,\n type GetDeviceStatusDAIntermediateValue,\n type GetDeviceStatusDAOutput,\n type GetDeviceStatusDAState,\n} from \"@api/device-action/os/GetDeviceStatus/types\";\nexport {\n type GoToDashboardDAError,\n type GoToDashboardDAInput,\n type GoToDashboardDAIntermediateValue,\n type GoToDashboardDAOutput,\n type GoToDashboardDAState,\n} from \"@api/device-action/os/GoToDashboard/types\";\nexport {\n type ListAppsDAError,\n type ListAppsDAInput,\n type ListAppsDAIntermediateValue,\n type ListAppsDAOutput,\n type ListAppsDAState,\n} from \"@api/device-action/os/ListApps/types\";\nexport {\n type ListAppsWithMetadataDAError,\n type ListAppsWithMetadataDAInput,\n type ListAppsWithMetadataDAIntermediateValue,\n type ListAppsWithMetadataDAOutput,\n type ListAppsWithMetadataDAState,\n} from \"@api/device-action/os/ListAppsWithMetadata/types\";\nexport {\n type OpenAppDAError,\n type OpenAppDAInput,\n type OpenAppDAIntermediateValue,\n type OpenAppDAOutput,\n type OpenAppDARequiredInteraction,\n type OpenAppDAState,\n} from \"@api/device-action/os/OpenAppDeviceAction/types\";\nexport {\n type SendCommandInAppDAError,\n type SendCommandInAppDAInput,\n type SendCommandInAppDAIntermediateValue,\n type SendCommandInAppDAOutput,\n} from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes\";\nexport type { ExecuteDeviceActionUseCaseArgs } from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nexport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nexport { type DeviceModelDataSource } from \"@api/device-model/data/DeviceModelDataSource\";\nexport type { DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nexport { type ApduReceiverService } from \"@api/device-session/service/ApduReceiverService\";\nexport { type ApduReceiverServiceFactory } from \"@api/device-session/service/ApduReceiverService\";\nexport { type ApduSenderServiceFactory } from \"@api/device-session/service/ApduSenderService\";\nexport { type ApduSenderService } from \"@api/device-session/service/ApduSenderService\";\nexport type { DeviceSessionId } from \"@api/device-session/types\";\nexport type { DmkConfig } from \"@api/DmkConfig\";\nexport type { DmkError } from \"@api/Error\";\nexport type { LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nexport type {\n LoggerSubscriberService,\n LogParams,\n} from \"@api/logger-subscriber/service/LoggerSubscriberService\";\nexport { type DeviceApduSender } from \"@api/transport/model/DeviceApduSender\";\nexport {\n type DeviceConnection,\n type DisconnectHandler,\n type SendApduFnType,\n type SendApduResult,\n} from \"@api/transport/model/DeviceConnection\";\nexport { type TransportDiscoveredDevice } from \"@api/transport/model/TransportDiscoveredDevice\";\nexport type { HexaString } from \"@api/utils/HexaString\";\nexport type { ConnectUseCaseArgs } from \"@internal/discovery/use-case/ConnectUseCase\";\nexport type { DisconnectUseCaseArgs } from \"@internal/discovery/use-case/DisconnectUseCase\";\nexport type { GetConnectedDeviceUseCaseArgs } from \"@internal/discovery/use-case/GetConnectedDeviceUseCase\";\nexport type { StartDiscoveringUseCaseArgs } from \"@internal/discovery/use-case/StartDiscoveringUseCase\";\nexport type { SendApduUseCaseArgs } from \"@internal/send/use-case/SendApduUseCase\";\n"],
4
+ "sourcesContent": ["export type { OpenAppErrorCodes } from \"./command/os/OpenAppCommand\";\nexport type { CommandErrors } from \"./command/utils/CommandErrors\";\nexport type { DeviceId } from \"./device/DeviceModel\";\nexport type { ConnectionType } from \"./discovery/ConnectionType\";\nexport type { CommandErrorArgs } from \"./Error\";\nexport type { LogSubscriberOptions } from \"./logger-subscriber/model/LogSubscriberOptions\";\nexport type { DiscoveredDevice } from \"./transport/model/DiscoveredDevice\";\nexport type {\n Transport,\n TransportArgs,\n TransportFactory,\n} from \"./transport/model/Transport\";\nexport type { TransportIdentifier } from \"./transport/model/TransportIdentifier\";\nexport type { ApduBuilderArgs } from \"@api/apdu/utils/ApduBuilder\";\nexport type { Command } from \"@api/command/Command\";\nexport type {\n CommandErrorResult,\n CommandResult,\n CommandSuccessResult,\n} from \"@api/command/model/CommandResult\";\nexport type { SendCommandUseCaseArgs } from \"@api/command/use-case/SendCommandUseCase\";\nexport type { DeviceModelId } from \"@api/device/DeviceModel\";\nexport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n} from \"@api/device-action/DeviceAction\";\nexport {\n type GetDeviceMetadataDAError,\n type GetDeviceMetadataDAInput,\n type GetDeviceMetadataDAIntermediateValue,\n type GetDeviceMetadataDAOutput,\n type GetDeviceMetadataDAState,\n} from \"@api/device-action/os/GetDeviceMetadata/types\";\nexport {\n type GetDeviceStatusDAError,\n type GetDeviceStatusDAInput,\n type GetDeviceStatusDAIntermediateValue,\n type GetDeviceStatusDAOutput,\n type GetDeviceStatusDAState,\n} from \"@api/device-action/os/GetDeviceStatus/types\";\nexport {\n type GoToDashboardDAError,\n type GoToDashboardDAInput,\n type GoToDashboardDAIntermediateValue,\n type GoToDashboardDAOutput,\n type GoToDashboardDAState,\n} from \"@api/device-action/os/GoToDashboard/types\";\nexport {\n type ApplicationConstraint,\n type ApplicationDependency,\n type ApplicationVersionConstraint,\n type InstallOrUpdateAppsDAError,\n type InstallOrUpdateAppsDAInput,\n type InstallOrUpdateAppsDAIntermediateValue,\n type InstallOrUpdateAppsDAOutput,\n type InstallOrUpdateAppsDAState,\n type InstallPlan,\n} from \"@api/device-action/os/InstallOrUpdateApps/types\";\nexport {\n type ListAppsDAError,\n type ListAppsDAInput,\n type ListAppsDAIntermediateValue,\n type ListAppsDAOutput,\n type ListAppsDAState,\n} from \"@api/device-action/os/ListApps/types\";\nexport {\n type ListAppsWithMetadataDAError,\n type ListAppsWithMetadataDAInput,\n type ListAppsWithMetadataDAIntermediateValue,\n type ListAppsWithMetadataDAOutput,\n type ListAppsWithMetadataDAState,\n} from \"@api/device-action/os/ListAppsWithMetadata/types\";\nexport {\n type OpenAppDAError,\n type OpenAppDAInput,\n type OpenAppDAIntermediateValue,\n type OpenAppDAOutput,\n type OpenAppDARequiredInteraction,\n type OpenAppDAState,\n} from \"@api/device-action/os/OpenAppDeviceAction/types\";\nexport {\n type OpenAppWithDependenciesDAError,\n type OpenAppWithDependenciesDAInput,\n type OpenAppWithDependenciesDAIntermediateValue,\n type OpenAppWithDependenciesDAOutput,\n type OpenAppWithDependenciesDARequiredInteraction,\n type OpenAppWithDependenciesDAState,\n} from \"@api/device-action/os/OpenAppWithDependencies/types\";\nexport {\n type SendCommandInAppDAError,\n type SendCommandInAppDAInput,\n type SendCommandInAppDAIntermediateValue,\n type SendCommandInAppDAOutput,\n} from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes\";\nexport type { ExecuteDeviceActionUseCaseArgs } from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nexport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nexport { type DeviceModelDataSource } from \"@api/device-model/data/DeviceModelDataSource\";\nexport type {\n Catalog,\n CustomImage,\n DeviceSessionState,\n FirmwareUpdate,\n FirmwareUpdateContext,\n FirmwareVersion,\n InstalledLanguagePackage,\n RunningApp,\n} from \"@api/device-session/DeviceSessionState\";\nexport { type ApduReceiverService } from \"@api/device-session/service/ApduReceiverService\";\nexport { type ApduReceiverServiceFactory } from \"@api/device-session/service/ApduReceiverService\";\nexport { type ApduSenderServiceFactory } from \"@api/device-session/service/ApduSenderService\";\nexport { type ApduSenderService } from \"@api/device-session/service/ApduSenderService\";\nexport type { DeviceSessionId } from \"@api/device-session/types\";\nexport type { DmkConfig } from \"@api/DmkConfig\";\nexport type { DmkError } from \"@api/Error\";\nexport type { LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nexport type {\n LoggerSubscriberService,\n LogParams,\n} from \"@api/logger-subscriber/service/LoggerSubscriberService\";\nexport {\n type GenuineCheckDAError,\n type GenuineCheckDAInput,\n type GenuineCheckDAIntermediateValue,\n type GenuineCheckDAOutput,\n type GenuineCheckDARequiredInteraction,\n type GenuineCheckDAState,\n} from \"@api/secure-channel/device-action/GenuineCheck/types\";\nexport {\n type InstallAppDAError,\n type InstallAppDAInput,\n type InstallAppDAIntermediateValue,\n type InstallAppDAOutput,\n type InstallAppDARequiredInteraction,\n type InstallAppDAState,\n} from \"@api/secure-channel/device-action/InstallApp/types\";\nexport {\n type ListInstalledAppsDAError,\n type ListInstalledAppsDAInput,\n type ListInstalledAppsDAIntermediateValue,\n type ListInstalledAppsDAOutput,\n type ListInstalledAppsDARequiredInteraction,\n type ListInstalledAppsDAState,\n} from \"@api/secure-channel/device-action/ListInstalledApps/types\";\nexport {\n type UninstallAppDAError,\n type UninstallAppDAInput,\n type UninstallAppDAIntermediateValue,\n type UninstallAppDAOutput,\n type UninstallAppDARequiredInteraction,\n type UninstallAppDAState,\n} from \"@api/secure-channel/device-action/UninstallApp/types\";\nexport { type DeviceApduSender } from \"@api/transport/model/DeviceApduSender\";\nexport {\n type DeviceConnection,\n type DisconnectHandler,\n type SendApduFnType,\n type SendApduResult,\n} from \"@api/transport/model/DeviceConnection\";\nexport { type TransportDiscoveredDevice } from \"@api/transport/model/TransportDiscoveredDevice\";\nexport type { HexaString } from \"@api/utils/HexaString\";\nexport type { ConnectUseCaseArgs } from \"@internal/discovery/use-case/ConnectUseCase\";\nexport type { DisconnectUseCaseArgs } from \"@internal/discovery/use-case/DisconnectUseCase\";\nexport type { GetConnectedDeviceUseCaseArgs } from \"@internal/discovery/use-case/GetConnectedDeviceUseCase\";\nexport type { StartDiscoveringUseCaseArgs } from \"@internal/discovery/use-case/StartDiscoveringUseCase\";\nexport type { SendApduUseCaseArgs } from \"@internal/send/use-case/SendApduUseCase\";\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["types_exports", "__toCommonJS"]
7
7
  }
package/lib/cjs/src/di.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var U=(o,r)=>{for(var t in r)a(o,t,{get:r[t],enumerable:!0})},u=(o,r,t,m)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of S(r))!C.call(o,e)&&e!==t&&a(o,e,{get:()=>r[e],enumerable:!(m=E(r,e))||m.enumerable});return o};var L=o=>u(a({},"__esModule",{value:!0}),o);var v={};U(v,{makeContainer:()=>k});module.exports=L(v);var p=require("inversify"),c=require("./api/command/di/commandModule"),n=require("./api/device-action/di/deviceActionModule"),l=require("./internal/config/di/configModule"),f=require("./internal/device-model/di/deviceModelModule"),d=require("./internal/device-session/di/deviceSessionModule"),y=require("./internal/discovery/di/discoveryModule"),F=require("./internal/logger-publisher/di/loggerModule"),M=require("./internal/manager-api/di/managerApiModule"),i=require("./internal/manager-api/model/Const"),s=require("./internal/secure-channel/di/secureChannelModule"),g=require("./internal/secure-channel/model/Const"),A=require("./internal/send/di/sendModule"),_=require("./internal/transport/di/transportModule");const k=({stub:o=!1,transports:r=[],loggers:t=[],config:m={mockUrl:i.DEFAULT_MOCK_SERVER_BASE_URL,managerApiUrl:i.DEFAULT_MANAGER_API_BASE_URL,webSocketUrl:g.DEFAULT_WEB_SOCKET_BASE_URL}})=>{const e=new p.Container;return e.load((0,l.configModuleFactory)({stub:o}),(0,f.deviceModelModuleFactory)({stub:o}),(0,_.transportModuleFactory)({stub:o,transports:r,config:m}),(0,M.managerApiModuleFactory)({stub:o,config:m}),(0,s.secureChannelModuleFactory)({stub:o,config:m}),(0,y.discoveryModuleFactory)({stub:o}),(0,F.loggerModuleFactory)({subscribers:t}),(0,d.deviceSessionModuleFactory)({stub:o}),(0,A.sendModuleFactory)({stub:o}),(0,c.commandModuleFactory)({stub:o}),(0,n.deviceActionModuleFactory)({stub:o})),e};0&&(module.exports={makeContainer});
1
+ "use strict";var a=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var L=(o,r)=>{for(var i in r)a(o,i,{get:r[i],enumerable:!0})},R=(o,r,i,m)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of g(r))!U.call(o,e)&&e!==i&&a(o,e,{get:()=>r[e],enumerable:!(m=s(r,e))||m.enumerable});return o};var T=o=>R(a({},"__esModule",{value:!0}),o);var u={};L(u,{makeContainer:()=>D});module.exports=T(u);var p=require("inversify"),c=require("./api/command/di/commandModule"),n=require("./api/device-action/di/deviceActionModule"),l=require("./internal/config/di/configModule"),f=require("./internal/device-model/di/deviceModelModule"),d=require("./internal/device-session/di/deviceSessionModule"),y=require("./internal/discovery/di/discoveryModule"),F=require("./internal/logger-publisher/di/loggerModule"),M=require("./internal/manager-api/di/managerApiModule"),t=require("./internal/manager-api/model/Const"),A=require("./internal/secure-channel/di/secureChannelModule"),_=require("./internal/secure-channel/model/Const"),E=require("./internal/send/di/sendModule"),S=require("./internal/transport/di/transportModule");const D=({stub:o=!1,transports:r=[],loggers:i=[],config:m={mockUrl:t.DEFAULT_MOCK_SERVER_BASE_URL,managerApiUrl:t.DEFAULT_MANAGER_API_BASE_URL,webSocketUrl:_.DEFAULT_WEB_SOCKET_BASE_URL,provider:t.DEFAULT_PROVIDER,firmwareDistributionSalt:t.DEFAULT_FIRMWARE_DISTRIBUTION_SALT}})=>{const e=new p.Container;return e.loadSync((0,l.configModuleFactory)({stub:o}),(0,f.deviceModelModuleFactory)({stub:o}),(0,S.transportModuleFactory)({stub:o,transports:r,config:m}),(0,M.managerApiModuleFactory)({stub:o,config:m}),(0,A.secureChannelModuleFactory)({stub:o,config:m}),(0,y.discoveryModuleFactory)({stub:o}),(0,F.loggerModuleFactory)({subscribers:i}),(0,d.deviceSessionModuleFactory)({stub:o}),(0,E.sendModuleFactory)({stub:o}),(0,c.commandModuleFactory)({stub:o}),(0,n.deviceActionModuleFactory)({stub:o})),e};0&&(module.exports={makeContainer});
2
2
  //# sourceMappingURL=di.js.map