@ledgerhq/device-management-kit 0.6.0 → 0.6.2

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 (647) hide show
  1. package/lib/cjs/index.js.map +1 -1
  2. package/lib/cjs/package.json +11 -10
  3. package/lib/cjs/src/api/DeviceManagementKit.js +1 -1
  4. package/lib/cjs/src/api/DeviceManagementKit.js.map +2 -2
  5. package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
  6. package/lib/cjs/src/api/DeviceManagementKit.test.js.map +2 -2
  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/DeviceManagementKitBuilder.test.js +1 -1
  10. package/lib/cjs/src/api/DeviceManagementKitBuilder.test.js.map +2 -2
  11. package/lib/cjs/src/api/apdu/utils/ByteArrayParser.test.js +1 -1
  12. package/lib/cjs/src/api/apdu/utils/ByteArrayParser.test.js.map +2 -2
  13. package/lib/cjs/src/api/command/os/GetOsVersionCommand.js +1 -1
  14. package/lib/cjs/src/api/command/os/GetOsVersionCommand.js.map +3 -3
  15. package/lib/cjs/src/api/command/os/LoadCertificateCommand.js +2 -0
  16. package/lib/cjs/src/api/command/os/LoadCertificateCommand.js.map +7 -0
  17. package/lib/cjs/src/api/command/os/LoadCertificateCommand.test.js +2 -0
  18. package/lib/cjs/src/api/command/os/LoadCertificateCommand.test.js.map +7 -0
  19. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.js +2 -0
  20. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.js.map +7 -0
  21. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.test.js +2 -0
  22. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.test.js.map +7 -0
  23. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  24. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  25. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.test.js +1 -1
  26. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.test.js.map +3 -3
  27. package/lib/cjs/src/api/device/SecureElementFlags.js +2 -0
  28. package/lib/cjs/src/api/device/SecureElementFlags.js.map +7 -0
  29. package/lib/cjs/src/api/device-action/DeviceAction.js +1 -1
  30. package/lib/cjs/src/api/device-action/DeviceAction.js.map +1 -1
  31. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  32. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  33. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  34. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js.map +2 -2
  35. package/lib/cjs/src/api/device-action/__test-utils__/testDeviceActionStates.js +1 -1
  36. package/lib/cjs/src/api/device-action/__test-utils__/testDeviceActionStates.js.map +3 -3
  37. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +1 -1
  38. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +2 -0
  39. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +7 -0
  40. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +2 -0
  41. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +7 -0
  42. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +2 -0
  43. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +7 -0
  44. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  45. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
  46. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +1 -1
  47. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +3 -3
  48. package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js +1 -1
  49. package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js.map +3 -3
  50. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
  51. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +3 -3
  52. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +1 -1
  53. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +3 -3
  54. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  55. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
  56. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  57. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +3 -3
  58. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  59. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +3 -3
  60. package/lib/cjs/src/api/device-session/DeviceSessionState.js +1 -1
  61. package/lib/cjs/src/api/device-session/DeviceSessionState.js.map +1 -1
  62. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.js +2 -0
  63. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.js.map +7 -0
  64. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js +2 -0
  65. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js.map +7 -0
  66. package/lib/cjs/src/api/index.js +1 -1
  67. package/lib/cjs/src/api/index.js.map +3 -3
  68. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.test.js +1 -1
  69. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.test.js.map +2 -2
  70. package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
  71. package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +2 -2
  72. package/lib/cjs/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.js +1 -1
  73. package/lib/cjs/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.js.map +2 -2
  74. package/lib/cjs/src/api/secure-channel/constants.js +2 -0
  75. package/lib/cjs/src/api/secure-channel/constants.js.map +7 -0
  76. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +2 -0
  77. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +7 -0
  78. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js +2 -0
  79. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js.map +7 -0
  80. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js +2 -0
  81. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js.map +7 -0
  82. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +2 -0
  83. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +7 -0
  84. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +2 -0
  85. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +7 -0
  86. package/lib/cjs/src/api/secure-channel/task/types.js +2 -0
  87. package/lib/cjs/src/api/secure-channel/task/types.js.map +7 -0
  88. package/lib/cjs/src/api/secure-channel/types.js +2 -0
  89. package/lib/cjs/src/api/secure-channel/types.js.map +7 -0
  90. package/lib/cjs/src/api/secure-channel/utils.js +2 -0
  91. package/lib/cjs/src/api/secure-channel/utils.js.map +7 -0
  92. package/lib/cjs/src/api/secure-channel/utils.test.js +2 -0
  93. package/lib/cjs/src/api/secure-channel/utils.test.js.map +7 -0
  94. package/lib/cjs/src/api/transport/model/DeviceConnectionFactory.stub.js +1 -1
  95. package/lib/cjs/src/api/transport/model/DeviceConnectionFactory.stub.js.map +2 -2
  96. package/lib/cjs/src/api/transport/model/DiscoveredDevice.js +1 -1
  97. package/lib/cjs/src/api/transport/model/DiscoveredDevice.js.map +1 -1
  98. package/lib/cjs/src/api/transport/model/Errors.js.map +2 -2
  99. package/lib/cjs/src/api/transport/model/Transport.js.map +1 -1
  100. package/lib/cjs/src/api/transport/model/TransportConnectedDevice.stub.js +1 -1
  101. package/lib/cjs/src/api/transport/model/TransportConnectedDevice.stub.js.map +2 -2
  102. package/lib/cjs/src/api/transport/model/TransportDiscoveredDevice.js +1 -1
  103. package/lib/cjs/src/api/transport/model/TransportDiscoveredDevice.js.map +1 -1
  104. package/lib/cjs/src/api/transport/model/__mocks__/TransportMock.js +1 -1
  105. package/lib/cjs/src/api/transport/model/__mocks__/TransportMock.js.map +2 -2
  106. package/lib/cjs/src/api/types.js +1 -1
  107. package/lib/cjs/src/api/types.js.map +1 -1
  108. package/lib/cjs/src/api/utils/Base64String.test.js +1 -1
  109. package/lib/cjs/src/api/utils/Base64String.test.js.map +2 -2
  110. package/lib/cjs/src/api/utils/HexaString.js +1 -1
  111. package/lib/cjs/src/api/utils/HexaString.js.map +2 -2
  112. package/lib/cjs/src/api/utils/HexaString.test.js +1 -1
  113. package/lib/cjs/src/api/utils/HexaString.test.js.map +2 -2
  114. package/lib/cjs/src/di.js +1 -1
  115. package/lib/cjs/src/di.js.map +3 -3
  116. package/lib/cjs/src/di.stub.js +1 -1
  117. package/lib/cjs/src/di.stub.js.map +2 -2
  118. package/lib/cjs/src/internal/config/data/LocalConfigDataSource.test.js +1 -1
  119. package/lib/cjs/src/internal/config/data/LocalConfigDataSource.test.js.map +3 -3
  120. package/lib/cjs/src/internal/config/data/RemoteConfigDataSource.test.js +1 -1
  121. package/lib/cjs/src/internal/config/data/RemoteConfigDataSource.test.js.map +2 -2
  122. package/lib/cjs/src/internal/config/data/__mocks__/LocalConfigDataSource.js +1 -1
  123. package/lib/cjs/src/internal/config/data/__mocks__/LocalConfigDataSource.js.map +2 -2
  124. package/lib/cjs/src/internal/config/data/__mocks__/RemoteConfigDataSource.js +1 -1
  125. package/lib/cjs/src/internal/config/data/__mocks__/RemoteConfigDataSource.js.map +2 -2
  126. package/lib/cjs/src/internal/config/service/DefaultConfigService.test.js +1 -1
  127. package/lib/cjs/src/internal/config/service/DefaultConfigService.test.js.map +2 -2
  128. package/lib/cjs/src/internal/config/use-case/GetDmkVersionUseCase.test.js +1 -1
  129. package/lib/cjs/src/internal/config/use-case/GetDmkVersionUseCase.test.js.map +2 -2
  130. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +1 -1
  131. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  132. package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js +1 -1
  133. package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js.map +2 -2
  134. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  135. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
  136. package/lib/cjs/src/internal/device-session/model/DeviceSession.stub.js +1 -1
  137. package/lib/cjs/src/internal/device-session/model/DeviceSession.stub.js.map +3 -3
  138. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
  139. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js.map +2 -2
  140. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
  141. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +2 -2
  142. package/lib/cjs/src/internal/device-session/service/DefaultApduReceiverService.test.js +1 -1
  143. package/lib/cjs/src/internal/device-session/service/DefaultApduReceiverService.test.js.map +2 -2
  144. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
  145. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
  146. package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
  147. package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +3 -3
  148. package/lib/cjs/src/internal/device-session/service/RefresherService.js +2 -0
  149. package/lib/cjs/src/internal/device-session/service/RefresherService.js.map +7 -0
  150. package/lib/cjs/src/internal/device-session/service/RefresherService.test.js +2 -0
  151. package/lib/cjs/src/internal/device-session/service/RefresherService.test.js.map +7 -0
  152. package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.test.js +1 -1
  153. package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.test.js.map +3 -3
  154. package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js +1 -1
  155. package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js.map +3 -3
  156. package/lib/cjs/src/internal/discovery/di/discoveryModule.js +1 -1
  157. package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +3 -3
  158. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
  159. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +3 -3
  160. package/lib/cjs/src/internal/discovery/di/discoveryTypes.js +1 -1
  161. package/lib/cjs/src/internal/discovery/di/discoveryTypes.js.map +2 -2
  162. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
  163. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
  164. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  165. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
  166. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
  167. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +3 -3
  168. package/lib/cjs/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js +1 -1
  169. package/lib/cjs/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js.map +3 -3
  170. package/lib/cjs/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js +1 -1
  171. package/lib/cjs/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js.map +3 -3
  172. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js +2 -0
  173. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js.map +7 -0
  174. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js +2 -0
  175. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js.map +7 -0
  176. package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js +1 -1
  177. package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js.map +3 -3
  178. package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js +1 -1
  179. package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js.map +3 -3
  180. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  181. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +2 -2
  182. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.js +1 -1
  183. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.js.map +2 -2
  184. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js +1 -1
  185. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js.map +2 -2
  186. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  187. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  188. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  189. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  190. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js +1 -1
  191. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js.map +1 -1
  192. package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js +1 -1
  193. package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
  194. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  195. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  196. package/lib/cjs/src/internal/manager-api/model/Application.js +1 -1
  197. package/lib/cjs/src/internal/manager-api/model/Application.js.map +1 -1
  198. package/lib/cjs/src/internal/manager-api/model/Const.js +1 -1
  199. package/lib/cjs/src/internal/manager-api/model/Const.js.map +3 -3
  200. package/lib/cjs/src/internal/manager-api/model/Errors.js +1 -1
  201. package/lib/cjs/src/internal/manager-api/model/Errors.js.map +3 -3
  202. package/lib/cjs/src/internal/manager-api/model/Firmware.js +1 -1
  203. package/lib/cjs/src/internal/manager-api/model/Firmware.js.map +1 -1
  204. package/lib/cjs/src/internal/manager-api/model/Params.js +1 -1
  205. package/lib/cjs/src/internal/manager-api/model/Params.js.map +1 -1
  206. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  207. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  208. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  209. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  210. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js +1 -1
  211. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js.map +1 -1
  212. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js +2 -0
  213. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js.map +7 -0
  214. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js +2 -0
  215. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js.map +7 -0
  216. package/lib/cjs/src/internal/secure-channel/data/SecureChannelDataSource.js +2 -0
  217. package/lib/cjs/src/internal/secure-channel/data/SecureChannelDataSource.js.map +7 -0
  218. package/lib/cjs/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js +2 -0
  219. package/lib/cjs/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js.map +7 -0
  220. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js +2 -0
  221. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js.map +7 -0
  222. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js +2 -0
  223. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js.map +7 -0
  224. package/lib/cjs/src/internal/secure-channel/di/secureChannelTypes.js +2 -0
  225. package/lib/cjs/src/internal/secure-channel/di/secureChannelTypes.js.map +7 -0
  226. package/lib/cjs/src/internal/secure-channel/model/Const.js +2 -0
  227. package/lib/cjs/src/internal/secure-channel/model/Const.js.map +7 -0
  228. package/lib/cjs/src/internal/secure-channel/model/Errors.js +2 -0
  229. package/lib/cjs/src/internal/secure-channel/model/Errors.js.map +7 -0
  230. package/lib/cjs/src/internal/secure-channel/model/Params.js +2 -0
  231. package/lib/cjs/src/internal/secure-channel/model/Params.js.map +7 -0
  232. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js +2 -0
  233. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +7 -0
  234. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +2 -0
  235. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +7 -0
  236. package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js +2 -0
  237. package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js.map +7 -0
  238. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
  239. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js.map +3 -3
  240. package/lib/cjs/src/internal/transport/di/transportModule.test.js +1 -1
  241. package/lib/cjs/src/internal/transport/di/transportModule.test.js.map +2 -2
  242. package/lib/cjs/src/internal/transport/service/DefaultTransportService.test.js +1 -1
  243. package/lib/cjs/src/internal/transport/service/DefaultTransportService.test.js.map +2 -2
  244. package/lib/cjs/src/internal/transport/service/__mocks__/DefaultTransportService.js +1 -1
  245. package/lib/cjs/src/internal/transport/service/__mocks__/DefaultTransportService.js.map +2 -2
  246. package/lib/esm/package.json +11 -10
  247. package/lib/esm/src/api/DeviceManagementKit.js +1 -1
  248. package/lib/esm/src/api/DeviceManagementKit.js.map +2 -2
  249. package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
  250. package/lib/esm/src/api/DeviceManagementKit.test.js.map +2 -2
  251. package/lib/esm/src/api/DeviceManagementKitBuilder.js +1 -1
  252. package/lib/esm/src/api/DeviceManagementKitBuilder.js.map +2 -2
  253. package/lib/esm/src/api/DeviceManagementKitBuilder.test.js +1 -1
  254. package/lib/esm/src/api/DeviceManagementKitBuilder.test.js.map +2 -2
  255. package/lib/esm/src/api/apdu/utils/ByteArrayParser.test.js +1 -1
  256. package/lib/esm/src/api/apdu/utils/ByteArrayParser.test.js.map +2 -2
  257. package/lib/esm/src/api/command/os/GetOsVersionCommand.js +1 -1
  258. package/lib/esm/src/api/command/os/GetOsVersionCommand.js.map +3 -3
  259. package/lib/esm/src/api/command/os/LoadCertificateCommand.js +2 -0
  260. package/lib/esm/src/api/command/os/LoadCertificateCommand.js.map +7 -0
  261. package/lib/esm/src/api/command/os/LoadCertificateCommand.test.js +2 -0
  262. package/lib/esm/src/api/command/os/LoadCertificateCommand.test.js.map +7 -0
  263. package/lib/esm/src/api/command/os/SecureElementFlagsParser.js +2 -0
  264. package/lib/esm/src/api/command/os/SecureElementFlagsParser.js.map +7 -0
  265. package/lib/esm/src/api/command/os/SecureElementFlagsParser.test.js +2 -0
  266. package/lib/esm/src/api/command/os/SecureElementFlagsParser.test.js.map +7 -0
  267. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  268. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  269. package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js +1 -1
  270. package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js.map +3 -3
  271. package/lib/esm/src/api/device/SecureElementFlags.js +1 -0
  272. package/lib/esm/src/api/device/SecureElementFlags.js.map +7 -0
  273. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  274. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  275. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  276. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js.map +2 -2
  277. package/lib/esm/src/api/device-action/__test-utils__/testDeviceActionStates.js +1 -1
  278. package/lib/esm/src/api/device-action/__test-utils__/testDeviceActionStates.js.map +3 -3
  279. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +1 -1
  280. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +2 -0
  281. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +7 -0
  282. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +2 -0
  283. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +7 -0
  284. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +1 -0
  285. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +7 -0
  286. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  287. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
  288. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +1 -1
  289. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +3 -3
  290. package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js +1 -1
  291. package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js.map +3 -3
  292. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
  293. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +3 -3
  294. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +1 -1
  295. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +3 -3
  296. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  297. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
  298. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  299. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +3 -3
  300. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  301. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +3 -3
  302. package/lib/esm/src/api/device-session/DeviceSessionState.js.map +1 -1
  303. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.js +2 -0
  304. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.js.map +7 -0
  305. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js +2 -0
  306. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js.map +7 -0
  307. package/lib/esm/src/api/index.js +1 -1
  308. package/lib/esm/src/api/index.js.map +3 -3
  309. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.test.js +1 -1
  310. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.test.js.map +2 -2
  311. package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
  312. package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +2 -2
  313. package/lib/esm/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.js +1 -1
  314. package/lib/esm/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.js.map +2 -2
  315. package/lib/esm/src/api/secure-channel/constants.js +2 -0
  316. package/lib/esm/src/api/secure-channel/constants.js.map +7 -0
  317. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +2 -0
  318. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +7 -0
  319. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js +2 -0
  320. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js.map +7 -0
  321. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/types.js +1 -0
  322. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/types.js.map +7 -0
  323. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +2 -0
  324. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +7 -0
  325. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +2 -0
  326. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +7 -0
  327. package/lib/esm/src/api/secure-channel/task/types.js +2 -0
  328. package/lib/esm/src/api/secure-channel/task/types.js.map +7 -0
  329. package/lib/esm/src/api/secure-channel/types.js +1 -0
  330. package/lib/esm/src/api/secure-channel/types.js.map +7 -0
  331. package/lib/esm/src/api/secure-channel/utils.js +2 -0
  332. package/lib/esm/src/api/secure-channel/utils.js.map +7 -0
  333. package/lib/esm/src/api/secure-channel/utils.test.js +2 -0
  334. package/lib/esm/src/api/secure-channel/utils.test.js.map +7 -0
  335. package/lib/esm/src/api/transport/model/DeviceConnectionFactory.stub.js +1 -1
  336. package/lib/esm/src/api/transport/model/DeviceConnectionFactory.stub.js.map +2 -2
  337. package/lib/esm/src/api/transport/model/Errors.js.map +2 -2
  338. package/lib/esm/src/api/transport/model/TransportConnectedDevice.stub.js +1 -1
  339. package/lib/esm/src/api/transport/model/TransportConnectedDevice.stub.js.map +2 -2
  340. package/lib/esm/src/api/transport/model/__mocks__/TransportMock.js +1 -1
  341. package/lib/esm/src/api/transport/model/__mocks__/TransportMock.js.map +2 -2
  342. package/lib/esm/src/api/utils/Base64String.test.js +1 -1
  343. package/lib/esm/src/api/utils/Base64String.test.js.map +2 -2
  344. package/lib/esm/src/api/utils/HexaString.js +1 -1
  345. package/lib/esm/src/api/utils/HexaString.js.map +2 -2
  346. package/lib/esm/src/api/utils/HexaString.test.js +1 -1
  347. package/lib/esm/src/api/utils/HexaString.test.js.map +2 -2
  348. package/lib/esm/src/di.js +1 -1
  349. package/lib/esm/src/di.js.map +3 -3
  350. package/lib/esm/src/di.stub.js +1 -1
  351. package/lib/esm/src/di.stub.js.map +2 -2
  352. package/lib/esm/src/internal/config/data/LocalConfigDataSource.test.js +1 -1
  353. package/lib/esm/src/internal/config/data/LocalConfigDataSource.test.js.map +3 -3
  354. package/lib/esm/src/internal/config/data/RemoteConfigDataSource.test.js +1 -1
  355. package/lib/esm/src/internal/config/data/RemoteConfigDataSource.test.js.map +2 -2
  356. package/lib/esm/src/internal/config/data/__mocks__/LocalConfigDataSource.js +1 -1
  357. package/lib/esm/src/internal/config/data/__mocks__/LocalConfigDataSource.js.map +2 -2
  358. package/lib/esm/src/internal/config/data/__mocks__/RemoteConfigDataSource.js +1 -1
  359. package/lib/esm/src/internal/config/data/__mocks__/RemoteConfigDataSource.js.map +2 -2
  360. package/lib/esm/src/internal/config/service/DefaultConfigService.test.js +1 -1
  361. package/lib/esm/src/internal/config/service/DefaultConfigService.test.js.map +2 -2
  362. package/lib/esm/src/internal/config/use-case/GetDmkVersionUseCase.test.js +1 -1
  363. package/lib/esm/src/internal/config/use-case/GetDmkVersionUseCase.test.js.map +2 -2
  364. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +1 -1
  365. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  366. package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js +1 -1
  367. package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js.map +2 -2
  368. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  369. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
  370. package/lib/esm/src/internal/device-session/model/DeviceSession.stub.js +1 -1
  371. package/lib/esm/src/internal/device-session/model/DeviceSession.stub.js.map +3 -3
  372. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
  373. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js.map +2 -2
  374. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
  375. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +2 -2
  376. package/lib/esm/src/internal/device-session/service/DefaultApduReceiverService.test.js +1 -1
  377. package/lib/esm/src/internal/device-session/service/DefaultApduReceiverService.test.js.map +2 -2
  378. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
  379. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
  380. package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
  381. package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +3 -3
  382. package/lib/esm/src/internal/device-session/service/RefresherService.js +2 -0
  383. package/lib/esm/src/internal/device-session/service/RefresherService.js.map +7 -0
  384. package/lib/esm/src/internal/device-session/service/RefresherService.test.js +2 -0
  385. package/lib/esm/src/internal/device-session/service/RefresherService.test.js.map +7 -0
  386. package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.test.js +1 -1
  387. package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.test.js.map +3 -3
  388. package/lib/esm/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js +1 -1
  389. package/lib/esm/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js.map +3 -3
  390. package/lib/esm/src/internal/discovery/di/discoveryModule.js +1 -1
  391. package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +3 -3
  392. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
  393. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +3 -3
  394. package/lib/esm/src/internal/discovery/di/discoveryTypes.js +1 -1
  395. package/lib/esm/src/internal/discovery/di/discoveryTypes.js.map +2 -2
  396. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
  397. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
  398. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  399. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
  400. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
  401. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +3 -3
  402. package/lib/esm/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js +1 -1
  403. package/lib/esm/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js.map +3 -3
  404. package/lib/esm/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js +1 -1
  405. package/lib/esm/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js.map +3 -3
  406. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js +2 -0
  407. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js.map +7 -0
  408. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js +2 -0
  409. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js.map +7 -0
  410. package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js +1 -1
  411. package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js.map +3 -3
  412. package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js +1 -1
  413. package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js.map +3 -3
  414. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  415. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +2 -2
  416. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.js +1 -1
  417. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.js.map +2 -2
  418. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js +1 -1
  419. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js.map +2 -2
  420. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  421. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  422. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  423. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  424. package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
  425. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  426. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  427. package/lib/esm/src/internal/manager-api/model/Application.js.map +1 -1
  428. package/lib/esm/src/internal/manager-api/model/Const.js +1 -1
  429. package/lib/esm/src/internal/manager-api/model/Const.js.map +3 -3
  430. package/lib/esm/src/internal/manager-api/model/Errors.js +1 -1
  431. package/lib/esm/src/internal/manager-api/model/Errors.js.map +3 -3
  432. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  433. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  434. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  435. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  436. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js +2 -0
  437. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js.map +7 -0
  438. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js +2 -0
  439. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js.map +7 -0
  440. package/lib/esm/src/internal/secure-channel/data/SecureChannelDataSource.js +1 -0
  441. package/lib/esm/src/internal/secure-channel/data/SecureChannelDataSource.js.map +7 -0
  442. package/lib/esm/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js +2 -0
  443. package/lib/esm/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js.map +7 -0
  444. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js +2 -0
  445. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js.map +7 -0
  446. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js +2 -0
  447. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js.map +7 -0
  448. package/lib/esm/src/internal/secure-channel/di/secureChannelTypes.js +2 -0
  449. package/lib/esm/src/internal/secure-channel/di/secureChannelTypes.js.map +7 -0
  450. package/lib/esm/src/internal/secure-channel/model/Const.js +2 -0
  451. package/lib/esm/src/internal/secure-channel/model/Const.js.map +7 -0
  452. package/lib/esm/src/internal/secure-channel/model/Errors.js +2 -0
  453. package/lib/esm/src/internal/secure-channel/model/Errors.js.map +7 -0
  454. package/lib/esm/src/internal/secure-channel/model/Params.js +1 -0
  455. package/lib/esm/src/internal/secure-channel/model/Params.js.map +7 -0
  456. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js +2 -0
  457. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +7 -0
  458. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +2 -0
  459. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +7 -0
  460. package/lib/esm/src/internal/secure-channel/service/SecureChannelService.js +1 -0
  461. package/lib/esm/src/internal/secure-channel/service/SecureChannelService.js.map +7 -0
  462. package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
  463. package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js.map +3 -3
  464. package/lib/esm/src/internal/transport/di/transportModule.test.js +1 -1
  465. package/lib/esm/src/internal/transport/di/transportModule.test.js.map +2 -2
  466. package/lib/esm/src/internal/transport/service/DefaultTransportService.test.js +1 -1
  467. package/lib/esm/src/internal/transport/service/DefaultTransportService.test.js.map +2 -2
  468. package/lib/esm/src/internal/transport/service/__mocks__/DefaultTransportService.js +1 -1
  469. package/lib/esm/src/internal/transport/service/__mocks__/DefaultTransportService.js.map +2 -2
  470. package/lib/types/src/api/DeviceManagementKit.d.ts +10 -8
  471. package/lib/types/src/api/DeviceManagementKit.d.ts.map +1 -1
  472. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts +8 -2
  473. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts.map +1 -1
  474. package/lib/types/src/api/command/os/LoadCertificateCommand.d.ts +25 -0
  475. package/lib/types/src/api/command/os/LoadCertificateCommand.d.ts.map +1 -0
  476. package/lib/types/src/api/command/os/LoadCertificateCommand.test.d.ts +2 -0
  477. package/lib/types/src/api/command/os/LoadCertificateCommand.test.d.ts.map +1 -0
  478. package/lib/types/src/api/command/os/SecureElementFlagsParser.d.ts +43 -0
  479. package/lib/types/src/api/command/os/SecureElementFlagsParser.d.ts.map +1 -0
  480. package/lib/types/src/api/command/os/SecureElementFlagsParser.test.d.ts +2 -0
  481. package/lib/types/src/api/command/os/SecureElementFlagsParser.test.d.ts.map +1 -0
  482. package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
  483. package/lib/types/src/api/device/SecureElementFlags.d.ts +41 -0
  484. package/lib/types/src/api/device/SecureElementFlags.d.ts.map +1 -0
  485. package/lib/types/src/api/device-action/DeviceAction.d.ts +6 -0
  486. package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
  487. package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts +2 -1
  488. package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
  489. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
  490. package/lib/types/src/api/device-action/__test-utils__/testDeviceActionStates.d.ts +5 -2
  491. package/lib/types/src/api/device-action/__test-utils__/testDeviceActionStates.d.ts.map +1 -1
  492. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +1 -1
  493. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts +40 -0
  494. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts.map +1 -0
  495. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.d.ts +2 -0
  496. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.d.ts.map +1 -0
  497. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts +19 -0
  498. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts.map +1 -0
  499. package/lib/types/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.d.ts +1 -1
  500. package/lib/types/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.d.ts.map +1 -1
  501. package/lib/types/src/api/device-session/DeviceSessionState.d.ts +4 -0
  502. package/lib/types/src/api/device-session/DeviceSessionState.d.ts.map +1 -1
  503. package/lib/types/src/api/device-session/use-case/{ToggleDeviceSessionRefresher.d.ts → DisableDeviceSessionRefresher.d.ts} +6 -6
  504. package/lib/types/src/api/device-session/use-case/DisableDeviceSessionRefresher.d.ts.map +1 -0
  505. package/lib/types/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.d.ts +2 -0
  506. package/lib/types/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.d.ts.map +1 -0
  507. package/lib/types/src/api/index.d.ts +3 -0
  508. package/lib/types/src/api/index.d.ts.map +1 -1
  509. package/lib/types/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.d.ts +1 -1
  510. package/lib/types/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.d.ts.map +1 -1
  511. package/lib/types/src/api/secure-channel/constants.d.ts +2 -0
  512. package/lib/types/src/api/secure-channel/constants.d.ts.map +1 -0
  513. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts +8 -0
  514. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts.map +1 -0
  515. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.d.ts +1 -0
  516. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.d.ts.map +1 -0
  517. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts +48 -0
  518. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts.map +1 -0
  519. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts +23 -0
  520. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -0
  521. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.test.d.ts +2 -0
  522. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.test.d.ts.map +1 -0
  523. package/lib/types/src/api/secure-channel/task/types.d.ts +105 -0
  524. package/lib/types/src/api/secure-channel/task/types.d.ts.map +1 -0
  525. package/lib/types/src/api/secure-channel/types.d.ts +4 -0
  526. package/lib/types/src/api/secure-channel/types.d.ts.map +1 -0
  527. package/lib/types/src/api/secure-channel/utils.d.ts +30 -0
  528. package/lib/types/src/api/secure-channel/utils.d.ts.map +1 -0
  529. package/lib/types/src/api/secure-channel/utils.test.d.ts +2 -0
  530. package/lib/types/src/api/secure-channel/utils.test.d.ts.map +1 -0
  531. package/lib/types/src/api/transport/model/DeviceConnectionFactory.stub.d.ts +1 -1
  532. package/lib/types/src/api/transport/model/DeviceConnectionFactory.stub.d.ts.map +1 -1
  533. package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts +2 -0
  534. package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts.map +1 -1
  535. package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
  536. package/lib/types/src/api/transport/model/Transport.d.ts +1 -1
  537. package/lib/types/src/api/transport/model/Transport.d.ts.map +1 -1
  538. package/lib/types/src/api/transport/model/TransportDiscoveredDevice.d.ts +2 -0
  539. package/lib/types/src/api/transport/model/TransportDiscoveredDevice.d.ts.map +1 -1
  540. package/lib/types/src/api/transport/model/__mocks__/TransportMock.d.ts +7 -7
  541. package/lib/types/src/api/transport/model/__mocks__/TransportMock.d.ts.map +1 -1
  542. package/lib/types/src/api/types.d.ts +1 -0
  543. package/lib/types/src/api/types.d.ts.map +1 -1
  544. package/lib/types/src/api/utils/HexaString.d.ts +1 -1
  545. package/lib/types/src/api/utils/HexaString.d.ts.map +1 -1
  546. package/lib/types/src/di.d.ts.map +1 -1
  547. package/lib/types/src/di.stub.d.ts +1 -1
  548. package/lib/types/src/di.stub.d.ts.map +1 -1
  549. package/lib/types/src/internal/config/data/__mocks__/LocalConfigDataSource.d.ts +1 -1
  550. package/lib/types/src/internal/config/data/__mocks__/LocalConfigDataSource.d.ts.map +1 -1
  551. package/lib/types/src/internal/config/data/__mocks__/RemoteConfigDataSource.d.ts +3 -3
  552. package/lib/types/src/internal/config/data/__mocks__/RemoteConfigDataSource.d.ts.map +1 -1
  553. package/lib/types/src/internal/device-session/di/deviceSessionTypes.d.ts +1 -1
  554. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts +13 -7
  555. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  556. package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts +2 -1
  557. package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts.map +1 -1
  558. package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts.map +1 -1
  559. package/lib/types/src/internal/device-session/service/RefresherService.d.ts +10 -0
  560. package/lib/types/src/internal/device-session/service/RefresherService.d.ts.map +1 -0
  561. package/lib/types/src/internal/device-session/service/RefresherService.test.d.ts +2 -0
  562. package/lib/types/src/internal/device-session/service/RefresherService.test.d.ts.map +1 -0
  563. package/lib/types/src/internal/discovery/di/discoveryTypes.d.ts +1 -1
  564. package/lib/types/src/internal/discovery/di/discoveryTypes.d.ts.map +1 -1
  565. package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts +3 -1
  566. package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts.map +1 -1
  567. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.d.ts +24 -0
  568. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.d.ts.map +1 -0
  569. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.d.ts +2 -0
  570. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.d.ts.map +1 -0
  571. package/lib/types/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.d.ts +5 -5
  572. package/lib/types/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.d.ts.map +1 -1
  573. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts +8 -16
  574. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts.map +1 -1
  575. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts +16 -55
  576. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts.map +1 -1
  577. package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts +4 -1
  578. package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts.map +1 -1
  579. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts +4 -9
  580. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts.map +1 -1
  581. package/lib/types/src/internal/manager-api/model/Application.d.ts +4 -1
  582. package/lib/types/src/internal/manager-api/model/Application.d.ts.map +1 -1
  583. package/lib/types/src/internal/manager-api/model/Const.d.ts +0 -1
  584. package/lib/types/src/internal/manager-api/model/Const.d.ts.map +1 -1
  585. package/lib/types/src/internal/manager-api/model/Errors.d.ts +0 -6
  586. package/lib/types/src/internal/manager-api/model/Errors.d.ts.map +1 -1
  587. package/lib/types/src/internal/manager-api/model/Firmware.d.ts +4 -0
  588. package/lib/types/src/internal/manager-api/model/Firmware.d.ts.map +1 -1
  589. package/lib/types/src/internal/manager-api/model/Params.d.ts +25 -68
  590. package/lib/types/src/internal/manager-api/model/Params.d.ts.map +1 -1
  591. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts +5 -5
  592. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts.map +1 -1
  593. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts +33 -2
  594. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts.map +1 -1
  595. package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.d.ts +18 -0
  596. package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.d.ts.map +1 -0
  597. package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.d.ts +2 -0
  598. package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.d.ts.map +1 -0
  599. package/lib/types/src/internal/secure-channel/data/SecureChannelDataSource.d.ts +52 -0
  600. package/lib/types/src/internal/secure-channel/data/SecureChannelDataSource.d.ts.map +1 -0
  601. package/lib/types/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.d.ts +10 -0
  602. package/lib/types/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.d.ts.map +1 -0
  603. package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts +9 -0
  604. package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts.map +1 -0
  605. package/lib/types/src/internal/secure-channel/di/secureChannelModule.test.d.ts +2 -0
  606. package/lib/types/src/internal/secure-channel/di/secureChannelModule.test.d.ts.map +1 -0
  607. package/lib/types/src/internal/secure-channel/di/secureChannelTypes.d.ts +6 -0
  608. package/lib/types/src/internal/secure-channel/di/secureChannelTypes.d.ts.map +1 -0
  609. package/lib/types/src/internal/secure-channel/model/Const.d.ts +2 -0
  610. package/lib/types/src/internal/secure-channel/model/Const.d.ts.map +1 -0
  611. package/lib/types/src/internal/secure-channel/model/Errors.d.ts +14 -0
  612. package/lib/types/src/internal/secure-channel/model/Errors.d.ts.map +1 -0
  613. package/lib/types/src/internal/secure-channel/model/Params.d.ts +86 -0
  614. package/lib/types/src/internal/secure-channel/model/Params.d.ts.map +1 -0
  615. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts +21 -0
  616. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts.map +1 -0
  617. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.test.d.ts +2 -0
  618. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.test.d.ts.map +1 -0
  619. package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts +22 -0
  620. package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts.map +1 -0
  621. package/lib/types/src/internal/transport/service/__mocks__/DefaultTransportService.d.ts +6 -6
  622. package/lib/types/src/internal/transport/service/__mocks__/DefaultTransportService.d.ts.map +1 -1
  623. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  624. package/package.json +12 -11
  625. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js +0 -2
  626. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js.map +0 -7
  627. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js +0 -2
  628. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js.map +0 -7
  629. package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js +0 -2
  630. package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js.map +0 -7
  631. package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js +0 -2
  632. package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js.map +0 -7
  633. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js +0 -2
  634. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js.map +0 -7
  635. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js +0 -2
  636. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js.map +0 -7
  637. package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js +0 -2
  638. package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js.map +0 -7
  639. package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js +0 -2
  640. package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js.map +0 -7
  641. package/lib/types/src/api/device-session/use-case/ToggleDeviceSessionRefresher.d.ts.map +0 -1
  642. package/lib/types/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.d.ts +0 -2
  643. package/lib/types/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.d.ts.map +0 -1
  644. package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.d.ts +0 -13
  645. package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.d.ts.map +0 -1
  646. package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.d.ts +0 -2
  647. package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.d.ts.map +0 -1
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/command/os/LoadCertificateCommand.ts"],
4
+ "sourcesContent": ["import { type Apdu } from \"@api/apdu/model/Apdu\";\nimport { ApduBuilder, type ApduBuilderArgs } from \"@api/apdu/utils/ApduBuilder\";\nimport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nimport {\n type CommandResult,\n CommandResultFactory,\n} from \"@api/command/model/CommandResult\";\nimport {\n type CommandErrors,\n isCommandErrorCode,\n} from \"@api/command/utils/CommandErrors\";\nimport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nimport { GlobalCommandErrorHandler } from \"@api/command/utils/GlobalCommandError\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { DeviceExchangeError } from \"@api/Error\";\nimport { type Command, type CommandErrorArgs } from \"@api/types\";\n\nexport type LoadCertificateArgs = {\n readonly keyUsage: number;\n readonly certificate: Uint8Array;\n};\n\nexport type LoadCertificateErrorCodes =\n | \"422f\"\n | \"4230\"\n | \"4231\"\n | \"4232\"\n | \"4233\"\n | \"4234\"\n | \"4235\"\n | \"4236\"\n | \"4237\"\n | \"4238\"\n | \"4239\"\n | \"422d\"\n | \"3301\"\n | \"422e\"\n | \"5720\"\n | \"4118\"\n | \"ffff\";\n\nconst LOAD_CERTIFICATE_ERRORS: CommandErrors<LoadCertificateErrorCodes> = {\n \"422f\": { message: \"Incorrect structure type\" },\n \"4230\": { message: \"Incorrect certificate version\" },\n \"4231\": { message: \"Incorrect certificate validity\" },\n \"4232\": { message: \"Incorrect certificate validity index\" },\n \"4233\": { message: \"Unknown signer key ID\" },\n \"4234\": { message: \"Unknown signature algorithm\" },\n \"4235\": { message: \"Unknown public key ID\" },\n \"4236\": { message: \"Unknown public key usage\" },\n \"4237\": { message: \"Incorrect elliptic curve ID\" },\n \"4238\": {\n message: \"Incorrect signature algorithm associated to the public key\",\n },\n \"4239\": { message: \"Unknown target device\" },\n \"422d\": { message: \"Unknown certificate tag\" },\n \"3301\": { message: \"Failed to hash data\" },\n \"422e\": {\n message: \"expected_key_usage doesn't match certificate key usage\",\n },\n \"5720\": { message: \"Failed to verify signature\" },\n \"4118\": {\n message: \"trusted_name buffer is too small to contain the trusted name\",\n },\n ffff: { message: \"Cryptography-related error\" },\n};\n\nexport class LoadCertificateCommandError extends DeviceExchangeError<LoadCertificateErrorCodes> {\n constructor({\n message,\n errorCode,\n }: CommandErrorArgs<LoadCertificateErrorCodes>) {\n super({ tag: \"ProvidePkiCertificateCommandError\", message, errorCode });\n }\n}\n\nexport type LoadCertificateCommandResult = CommandResult<\n void,\n LoadCertificateErrorCodes\n>;\n\n/**\n * The command to load a certificate on the device.\n */\nexport class LoadCertificateCommand\n implements Command<void, LoadCertificateArgs, LoadCertificateErrorCodes>\n{\n readonly args: LoadCertificateArgs;\n readonly triggersDisconnection = false;\n\n constructor(args: LoadCertificateArgs) {\n this.args = args;\n }\n\n getApdu(): Apdu {\n const providePkiApduArgs: ApduBuilderArgs = {\n cla: 0xb0,\n ins: 0x06,\n p1: this.args.keyUsage,\n p2: 0x00,\n };\n return new ApduBuilder(providePkiApduArgs)\n .addBufferToData(this.args.certificate)\n .build();\n }\n\n parseResponse(apduResponse: ApduResponse): LoadCertificateCommandResult {\n if (CommandUtils.isSuccessResponse(apduResponse)) {\n return CommandResultFactory({\n data: undefined,\n });\n }\n const parser = new ApduParser(apduResponse);\n const errorCode = parser.encodeToHexaString(apduResponse.statusCode);\n if (isCommandErrorCode(errorCode, LOAD_CERTIFICATE_ERRORS)) {\n return CommandResultFactory({\n error: new LoadCertificateCommandError({\n ...LOAD_CERTIFICATE_ERRORS[errorCode],\n errorCode,\n }),\n });\n }\n return CommandResultFactory({\n error: GlobalCommandErrorHandler.handle(apduResponse),\n });\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,EAAA,gCAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAkD,uCAClDC,EAA2B,sCAC3BC,EAGO,4CACPC,EAGO,4CACPC,EAA6B,2CAC7BC,EAA0C,iDAE1CC,EAAoC,sBA2BpC,MAAMC,EAAoE,CACxE,OAAQ,CAAE,QAAS,0BAA2B,EAC9C,KAAQ,CAAE,QAAS,+BAAgC,EACnD,KAAQ,CAAE,QAAS,gCAAiC,EACpD,KAAQ,CAAE,QAAS,sCAAuC,EAC1D,KAAQ,CAAE,QAAS,uBAAwB,EAC3C,KAAQ,CAAE,QAAS,6BAA8B,EACjD,KAAQ,CAAE,QAAS,uBAAwB,EAC3C,KAAQ,CAAE,QAAS,0BAA2B,EAC9C,KAAQ,CAAE,QAAS,6BAA8B,EACjD,KAAQ,CACN,QAAS,4DACX,EACA,KAAQ,CAAE,QAAS,uBAAwB,EAC3C,OAAQ,CAAE,QAAS,yBAA0B,EAC7C,KAAQ,CAAE,QAAS,qBAAsB,EACzC,OAAQ,CACN,QAAS,wDACX,EACA,KAAQ,CAAE,QAAS,4BAA6B,EAChD,KAAQ,CACN,QAAS,8DACX,EACA,KAAM,CAAE,QAAS,4BAA6B,CAChD,EAEO,MAAMT,UAAoC,qBAA+C,CAC9F,YAAY,CACV,QAAAU,EACA,UAAAC,CACF,EAAgD,CAC9C,MAAM,CAAE,IAAK,oCAAqC,QAAAD,EAAS,UAAAC,CAAU,CAAC,CACxE,CACF,CAUO,MAAMZ,CAEb,CACW,KACA,sBAAwB,GAEjC,YAAYa,EAA2B,CACrC,KAAK,KAAOA,CACd,CAEA,SAAgB,CACd,MAAMC,EAAsC,CAC1C,IAAK,IACL,IAAK,EACL,GAAI,KAAK,KAAK,SACd,GAAI,CACN,EACA,OAAO,IAAI,cAAYA,CAAkB,EACtC,gBAAgB,KAAK,KAAK,WAAW,EACrC,MAAM,CACX,CAEA,cAAcC,EAA0D,CACtE,GAAI,eAAa,kBAAkBA,CAAY,EAC7C,SAAO,wBAAqB,CAC1B,KAAM,MACR,CAAC,EAGH,MAAMH,EADS,IAAI,aAAWG,CAAY,EACjB,mBAAmBA,EAAa,UAAU,EACnE,SAAI,sBAAmBH,EAAWF,CAAuB,KAChD,wBAAqB,CAC1B,MAAO,IAAIT,EAA4B,CACrC,GAAGS,EAAwBE,CAAS,EACpC,UAAAA,CACF,CAAC,CACH,CAAC,KAEI,wBAAqB,CAC1B,MAAO,4BAA0B,OAAOG,CAAY,CACtD,CAAC,CACH,CACF",
6
+ "names": ["LoadCertificateCommand_exports", "__export", "LoadCertificateCommand", "LoadCertificateCommandError", "__toCommonJS", "import_ApduBuilder", "import_ApduParser", "import_CommandResult", "import_CommandErrors", "import_CommandUtils", "import_GlobalCommandError", "import_Error", "LOAD_CERTIFICATE_ERRORS", "message", "errorCode", "args", "providePkiApduArgs", "apduResponse"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var s=require("../../command/model/CommandResult"),o=require("../../command/os/LoadCertificateCommand"),n=require("../../command/utils/GlobalCommandError"),c=require("../../utils/HexaString");describe("LoadCertificateCommand",()=>{describe("getApdu",()=>{it("should return the APDU with key equal to 1",()=>{const r={keyUsage:66,certificate:new Uint8Array([1,2,3])},e=new o.LoadCertificateCommand(r).getApdu();expect(e.cla).toBe(176),expect(e.ins).toBe(6),expect(e.p1).toBe(66),expect(e.p2).toBe(0),expect(e.data).toStrictEqual(new Uint8Array([1,2,3]))})}),describe("parseResponse",()=>{let r;beforeEach(()=>{r=new o.LoadCertificateCommand({keyUsage:1,certificate:new Uint8Array})}),it("should return success if the response status code is success",()=>{const t={statusCode:new Uint8Array([144,0]),data:new Uint8Array},e=r.parseResponse(t);expect(e).toStrictEqual((0,s.CommandResultFactory)({data:void 0}))}),describe("errors",()=>{it("should return error command result if the device is locked",()=>{const t={statusCode:new Uint8Array([85,21]),data:new Uint8Array},e=r.parseResponse(t);(0,s.isSuccessCommandResult)(e)?assert.fail("Expected error command result"):expect(e.error).toBeInstanceOf(n.GlobalCommandError)}),it.each(["422f","4230","4231","4232","4233","4234","4235","4236","4237","4238","4239","422d","3301","422e","5720","4118","ffff"])("should return a ProvidePkiCertificateCommandError if the response is a %s specific error code",t=>{const e={statusCode:(0,c.hexaStringToBuffer)(t),data:new Uint8Array},a=r.parseResponse(e);(0,s.isSuccessCommandResult)(a)?assert.fail("Expected error command result"):(expect(a.error).toBeInstanceOf(o.LoadCertificateCommandError),expect(a.error.errorCode).toBe(t))})})})});
2
+ //# sourceMappingURL=LoadCertificateCommand.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/command/os/LoadCertificateCommand.test.ts"],
4
+ "sourcesContent": ["import {\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nimport {\n LoadCertificateCommand,\n LoadCertificateCommandError,\n} from \"@api/command/os/LoadCertificateCommand\";\nimport { GlobalCommandError } from \"@api/command/utils/GlobalCommandError\";\nimport { hexaStringToBuffer } from \"@api/utils/HexaString\";\n\ndescribe(\"LoadCertificateCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should return the APDU with key equal to 1\", () => {\n // GIVEN\n const args = {\n keyUsage: 0x42,\n certificate: new Uint8Array([0x01, 0x02, 0x03]),\n };\n const command = new LoadCertificateCommand(args);\n\n // WHEN\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.cla).toBe(0xb0);\n expect(apdu.ins).toBe(0x06);\n expect(apdu.p1).toBe(0x42);\n expect(apdu.p2).toBe(0x00);\n expect(apdu.data).toStrictEqual(new Uint8Array([0x01, 0x02, 0x03]));\n });\n });\n\n describe(\"parseResponse\", () => {\n let command: LoadCertificateCommand;\n\n beforeEach(() => {\n command = new LoadCertificateCommand({\n keyUsage: 0x01,\n certificate: new Uint8Array(),\n });\n });\n\n it(\"should return success if the response status code is success\", () => {\n // GIVEN\n const response = {\n statusCode: new Uint8Array([0x90, 0x00]),\n data: new Uint8Array(),\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n expect(result).toStrictEqual(CommandResultFactory({ data: undefined }));\n });\n\n describe(\"errors\", () => {\n it(\"should return error command result if the device is locked\", () => {\n // GIVEN\n const response = {\n statusCode: new Uint8Array([0x55, 0x15]),\n data: new Uint8Array(),\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n assert.fail(\"Expected error command result\");\n } else {\n expect(result.error).toBeInstanceOf(GlobalCommandError);\n }\n });\n\n it.each([\n \"422f\",\n \"4230\",\n \"4231\",\n \"4232\",\n \"4233\",\n \"4234\",\n \"4235\",\n \"4236\",\n \"4237\",\n \"4238\",\n \"4239\",\n \"422d\",\n \"3301\",\n \"422e\",\n \"5720\",\n \"4118\",\n \"ffff\",\n ])(\n \"should return a ProvidePkiCertificateCommandError if the response is a %s specific error code\",\n (errorCode) => {\n // GIVEN\n const response = {\n statusCode: hexaStringToBuffer(errorCode)!,\n data: new Uint8Array(),\n };\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n assert.fail(\"Expected error command result\");\n } else {\n expect(result.error).toBeInstanceOf(LoadCertificateCommandError);\n // @ts-expect-error intended\n expect(result.error.errorCode).toBe(errorCode);\n }\n },\n );\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAGO,4CACPC,EAGO,kDACPC,EAAmC,iDACnCC,EAAmC,iCAEnC,SAAS,yBAA0B,IAAM,CACvC,SAAS,UAAW,IAAM,CACxB,GAAG,6CAA8C,IAAM,CAErD,MAAMC,EAAO,CACX,SAAU,GACV,YAAa,IAAI,WAAW,CAAC,EAAM,EAAM,CAAI,CAAC,CAChD,EAIMC,EAHU,IAAI,yBAAuBD,CAAI,EAG1B,QAAQ,EAG7B,OAAOC,EAAK,GAAG,EAAE,KAAK,GAAI,EAC1B,OAAOA,EAAK,GAAG,EAAE,KAAK,CAAI,EAC1B,OAAOA,EAAK,EAAE,EAAE,KAAK,EAAI,EACzB,OAAOA,EAAK,EAAE,EAAE,KAAK,CAAI,EACzB,OAAOA,EAAK,IAAI,EAAE,cAAc,IAAI,WAAW,CAAC,EAAM,EAAM,CAAI,CAAC,CAAC,CACpE,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,IAAIC,EAEJ,WAAW,IAAM,CACfA,EAAU,IAAI,yBAAuB,CACnC,SAAU,EACV,YAAa,IAAI,UACnB,CAAC,CACH,CAAC,EAED,GAAG,+DAAgE,IAAM,CAEvE,MAAMC,EAAW,CACf,WAAY,IAAI,WAAW,CAAC,IAAM,CAAI,CAAC,EACvC,KAAM,IAAI,UACZ,EAGMC,EAASF,EAAQ,cAAcC,CAAQ,EAG7C,OAAOC,CAAM,EAAE,iBAAc,wBAAqB,CAAE,KAAM,MAAU,CAAC,CAAC,CACxE,CAAC,EAED,SAAS,SAAU,IAAM,CACvB,GAAG,6DAA8D,IAAM,CAErE,MAAMD,EAAW,CACf,WAAY,IAAI,WAAW,CAAC,GAAM,EAAI,CAAC,EACvC,KAAM,IAAI,UACZ,EAGMC,EAASF,EAAQ,cAAcC,CAAQ,KAGzC,0BAAuBC,CAAM,EAC/B,OAAO,KAAK,+BAA+B,EAE3C,OAAOA,EAAO,KAAK,EAAE,eAAe,oBAAkB,CAE1D,CAAC,EAED,GAAG,KAAK,CACN,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,MACF,CAAC,EACC,gGACCC,GAAc,CAEb,MAAMF,EAAW,CACf,cAAY,sBAAmBE,CAAS,EACxC,KAAM,IAAI,UACZ,EAGMD,EAASF,EAAQ,cAAcC,CAAQ,KAGzC,0BAAuBC,CAAM,EAC/B,OAAO,KAAK,+BAA+B,GAE3C,OAAOA,EAAO,KAAK,EAAE,eAAe,6BAA2B,EAE/D,OAAOA,EAAO,MAAM,SAAS,EAAE,KAAKC,CAAS,EAEjD,CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_CommandResult", "import_LoadCertificateCommand", "import_GlobalCommandError", "import_HexaString", "args", "apdu", "command", "response", "result", "errorCode"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var c=(t,e)=>{for(var n in e)i(t,n,{get:e[n],enumerable:!0})},l=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of a(e))!h.call(t,r)&&r!==n&&i(t,r,{get:()=>e[r],enumerable:!(o=s(e,r))||o.enumerable});return t};var d=t=>l(i({},"__esModule",{value:!0}),t);var B={};c(B,{SecureElementFlagsParser:()=>m});module.exports=d(B);class m{constructor(e){this.seFlags=e;if(this.seFlags.length!==4)throw new Error("Invalid secure element flags length")}generalDeviceState(){const e=this.seFlags[0]??0;return{isPinValidated:this._checkNthBitInByte(e,1),hasMcuSerialNumber:this._checkNthBitInByte(e,2),hasValidCertificate:this._checkNthBitInByte(e,3),isCustomAuthorityConnectionAllowed:this._checkNthBitInByte(e,4),isSecureConnectionAllowed:this._checkNthBitInByte(e,5),isOnboarded:this._checkNthBitInByte(e,6),isMcuCodeSigned:this._checkNthBitInByte(e,7),isInRecoveryMode:this._checkNthBitInByte(e,8)}}endorsementInformation(){throw new Error("Not implemented")}wordsInformation(){throw new Error("Not implemented")}onboardingStatus(){throw new Error("Not implemented")}_checkNthBitInByte(e,n){return(e>>8-n&1)===1}}0&&(module.exports={SecureElementFlagsParser});
2
+ //# sourceMappingURL=SecureElementFlagsParser.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/command/os/SecureElementFlagsParser.ts"],
4
+ "sourcesContent": ["import {\n type DeviceGeneralState,\n type EndorsementInformation,\n type OnboardingStatus,\n type WordsInformation,\n} from \"@api/device/SecureElementFlags\";\n\n/**\n * Secure element flags parser class.\n */\nexport class SecureElementFlagsParser {\n /**\n * Creates an instance of SecureElementFlags parser.\n * @param seFlags - The secure element flags as an Uint8Array, it comes from the response of the GetOsVersionCommand.\n */\n constructor(private readonly seFlags: Uint8Array) {\n if (this.seFlags.length !== 4) {\n throw new Error(\"Invalid secure element flags length\");\n }\n }\n\n /**\n * Retrieves the general device state based on the secure element flags, which is the first byte of the flags.\n * @returns {DeviceGeneralState}\n */\n generalDeviceState(): DeviceGeneralState {\n const firstByte = this.seFlags[0] ?? 0x00;\n\n return {\n isPinValidated: this._checkNthBitInByte(firstByte, 1),\n hasMcuSerialNumber: this._checkNthBitInByte(firstByte, 2),\n hasValidCertificate: this._checkNthBitInByte(firstByte, 3),\n isCustomAuthorityConnectionAllowed: this._checkNthBitInByte(firstByte, 4),\n isSecureConnectionAllowed: this._checkNthBitInByte(firstByte, 5),\n isOnboarded: this._checkNthBitInByte(firstByte, 6),\n isMcuCodeSigned: this._checkNthBitInByte(firstByte, 7),\n isInRecoveryMode: this._checkNthBitInByte(firstByte, 8),\n };\n }\n\n /**\n * Retrieves the endorsement information based on the secure element flags, which is the second byte of the flags.\n * @returns {EndorsementInformation}\n * @throws Will throw an error if the method is not implemented.\n */\n endorsementInformation(): EndorsementInformation {\n throw new Error(\"Not implemented\");\n }\n\n /**\n * Retrieves the words information based on the secure element flags, which is the third byte of the flags.\n * @returns {WordsInformation}\n * @throws Will throw an error if the method is not implemented.\n */\n wordsInformation(): WordsInformation {\n throw new Error(\"Not implemented\");\n }\n\n /**\n * Retrieves the onboarding status based on the secure element flags, which is the fourth byte of the flags.\n * @returns {OnboardingStatus}\n * @throws Will throw an error if the method is not implemented.\n */\n onboardingStatus(): OnboardingStatus {\n throw new Error(\"Not implemented\");\n }\n\n /**\n * Check the nth bit in a byte, returns true if the bit is set, false otherwise.\n * @param byte - The byte to check.\n * @param n - The bit number to check.\n * @returns {boolean} - True if the bit is set, false otherwise.\n */\n _checkNthBitInByte(byte: number, n: number): boolean {\n return ((byte >> (8 - n)) & 1) === 1;\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAUO,MAAME,CAAyB,CAKpC,YAA6BE,EAAqB,CAArB,aAAAA,EAC3B,GAAI,KAAK,QAAQ,SAAW,EAC1B,MAAM,IAAI,MAAM,qCAAqC,CAEzD,CAMA,oBAAyC,CACvC,MAAMC,EAAY,KAAK,QAAQ,CAAC,GAAK,EAErC,MAAO,CACL,eAAgB,KAAK,mBAAmBA,EAAW,CAAC,EACpD,mBAAoB,KAAK,mBAAmBA,EAAW,CAAC,EACxD,oBAAqB,KAAK,mBAAmBA,EAAW,CAAC,EACzD,mCAAoC,KAAK,mBAAmBA,EAAW,CAAC,EACxE,0BAA2B,KAAK,mBAAmBA,EAAW,CAAC,EAC/D,YAAa,KAAK,mBAAmBA,EAAW,CAAC,EACjD,gBAAiB,KAAK,mBAAmBA,EAAW,CAAC,EACrD,iBAAkB,KAAK,mBAAmBA,EAAW,CAAC,CACxD,CACF,CAOA,wBAAiD,CAC/C,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAOA,kBAAqC,CACnC,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAOA,kBAAqC,CACnC,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAQA,mBAAmBC,EAAc,EAAoB,CACnD,OAASA,GAAS,EAAI,EAAM,KAAO,CACrC,CACF",
6
+ "names": ["SecureElementFlagsParser_exports", "__export", "SecureElementFlagsParser", "__toCommonJS", "seFlags", "firstByte", "byte"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("vitest"),n=require("./SecureElementFlagsParser");(0,e.describe)("SecureElementFlagsParser",()=>{(0,e.it)("should throw an error if the secure element flags length is not 4",()=>{(0,e.expect)(()=>new n.SecureElementFlagsParser(new Uint8Array([0,1,2]))).toThrow("Invalid secure element flags length")}),(0,e.it)("should correctly parse the general device state",()=>{const o=new Uint8Array([170,0,0,0]),t=new n.SecureElementFlagsParser(o),r={isPinValidated:!0,hasMcuSerialNumber:!1,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!0,isOnboarded:!1,isMcuCodeSigned:!0,isInRecoveryMode:!1};(0,e.expect)(t.generalDeviceState()).toEqual(r)}),(0,e.it)("should throw an error for endorsementInformation method",()=>{const o=new Uint8Array([0,0,0,0]),t=new n.SecureElementFlagsParser(o);(0,e.expect)(()=>t.endorsementInformation()).toThrow("Not implemented")}),(0,e.it)("should throw an error for wordsInformation method",()=>{const o=new Uint8Array([0,0,0,0]),t=new n.SecureElementFlagsParser(o);(0,e.expect)(()=>t.wordsInformation()).toThrow("Not implemented")}),(0,e.it)("should throw an error for onboardingStatus method",()=>{const o=new Uint8Array([0,0,0,0]),t=new n.SecureElementFlagsParser(o);(0,e.expect)(()=>t.onboardingStatus()).toThrow("Not implemented")}),(0,e.it)("should correctly check the nth bit in a byte",()=>{const o=new Uint8Array([0,0,0,0]),t=new n.SecureElementFlagsParser(o),r=170;(0,e.expect)(t._checkNthBitInByte(r,1)).toBe(!0),(0,e.expect)(t._checkNthBitInByte(r,2)).toBe(!1),(0,e.expect)(t._checkNthBitInByte(r,3)).toBe(!0),(0,e.expect)(t._checkNthBitInByte(r,4)).toBe(!1),(0,e.expect)(t._checkNthBitInByte(r,5)).toBe(!0),(0,e.expect)(t._checkNthBitInByte(r,6)).toBe(!1),(0,e.expect)(t._checkNthBitInByte(r,7)).toBe(!0),(0,e.expect)(t._checkNthBitInByte(r,8)).toBe(!1)})});
2
+ //# sourceMappingURL=SecureElementFlagsParser.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/command/os/SecureElementFlagsParser.test.ts"],
4
+ "sourcesContent": ["import { describe, expect, it } from \"vitest\";\n\nimport { type DeviceGeneralState } from \"@api/device/SecureElementFlags\";\n\nimport { SecureElementFlagsParser } from \"./SecureElementFlagsParser\";\n\ndescribe(\"SecureElementFlagsParser\", () => {\n it(\"should throw an error if the secure element flags length is not 4\", () => {\n expect(\n () => new SecureElementFlagsParser(new Uint8Array([0x00, 0x01, 0x02])),\n ).toThrow(\"Invalid secure element flags length\");\n });\n\n it(\"should correctly parse the general device state\", () => {\n const seFlags = new Uint8Array([0b10101010, 0x00, 0x00, 0x00]);\n const parser = new SecureElementFlagsParser(seFlags);\n const expectedState: DeviceGeneralState = {\n isPinValidated: true,\n hasMcuSerialNumber: false,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: true,\n isOnboarded: false,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n };\n expect(parser.generalDeviceState()).toEqual(expectedState);\n });\n\n it(\"should throw an error for endorsementInformation method\", () => {\n const seFlags = new Uint8Array([0x00, 0x00, 0x00, 0x00]);\n const parser = new SecureElementFlagsParser(seFlags);\n expect(() => parser.endorsementInformation()).toThrow(\"Not implemented\");\n });\n\n it(\"should throw an error for wordsInformation method\", () => {\n const seFlags = new Uint8Array([0x00, 0x00, 0x00, 0x00]);\n const parser = new SecureElementFlagsParser(seFlags);\n expect(() => parser.wordsInformation()).toThrow(\"Not implemented\");\n });\n\n it(\"should throw an error for onboardingStatus method\", () => {\n const seFlags = new Uint8Array([0x00, 0x00, 0x00, 0x00]);\n const parser = new SecureElementFlagsParser(seFlags);\n expect(() => parser.onboardingStatus()).toThrow(\"Not implemented\");\n });\n\n it(\"should correctly check the nth bit in a byte\", () => {\n const seFlags = new Uint8Array([0x00, 0x00, 0x00, 0x00]);\n const parser = new SecureElementFlagsParser(seFlags);\n const byte = 0b10101010;\n expect(parser._checkNthBitInByte(byte, 1)).toBe(true);\n expect(parser._checkNthBitInByte(byte, 2)).toBe(false);\n expect(parser._checkNthBitInByte(byte, 3)).toBe(true);\n expect(parser._checkNthBitInByte(byte, 4)).toBe(false);\n expect(parser._checkNthBitInByte(byte, 5)).toBe(true);\n expect(parser._checkNthBitInByte(byte, 6)).toBe(false);\n expect(parser._checkNthBitInByte(byte, 7)).toBe(true);\n expect(parser._checkNthBitInByte(byte, 8)).toBe(false);\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAAqC,kBAIrCC,EAAyC,yCAEzC,YAAS,2BAA4B,IAAM,IACzC,MAAG,oEAAqE,IAAM,IAC5E,UACE,IAAM,IAAI,2BAAyB,IAAI,WAAW,CAAC,EAAM,EAAM,CAAI,CAAC,CAAC,CACvE,EAAE,QAAQ,qCAAqC,CACjD,CAAC,KAED,MAAG,kDAAmD,IAAM,CAC1D,MAAMC,EAAU,IAAI,WAAW,CAAC,IAAY,EAAM,EAAM,CAAI,CAAC,EACvDC,EAAS,IAAI,2BAAyBD,CAAO,EAC7CE,EAAoC,CACxC,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,KACA,UAAOD,EAAO,mBAAmB,CAAC,EAAE,QAAQC,CAAa,CAC3D,CAAC,KAED,MAAG,0DAA2D,IAAM,CAClE,MAAMF,EAAU,IAAI,WAAW,CAAC,EAAM,EAAM,EAAM,CAAI,CAAC,EACjDC,EAAS,IAAI,2BAAyBD,CAAO,KACnD,UAAO,IAAMC,EAAO,uBAAuB,CAAC,EAAE,QAAQ,iBAAiB,CACzE,CAAC,KAED,MAAG,oDAAqD,IAAM,CAC5D,MAAMD,EAAU,IAAI,WAAW,CAAC,EAAM,EAAM,EAAM,CAAI,CAAC,EACjDC,EAAS,IAAI,2BAAyBD,CAAO,KACnD,UAAO,IAAMC,EAAO,iBAAiB,CAAC,EAAE,QAAQ,iBAAiB,CACnE,CAAC,KAED,MAAG,oDAAqD,IAAM,CAC5D,MAAMD,EAAU,IAAI,WAAW,CAAC,EAAM,EAAM,EAAM,CAAI,CAAC,EACjDC,EAAS,IAAI,2BAAyBD,CAAO,KACnD,UAAO,IAAMC,EAAO,iBAAiB,CAAC,EAAE,QAAQ,iBAAiB,CACnE,CAAC,KAED,MAAG,+CAAgD,IAAM,CACvD,MAAMD,EAAU,IAAI,WAAW,CAAC,EAAM,EAAM,EAAM,CAAI,CAAC,EACjDC,EAAS,IAAI,2BAAyBD,CAAO,EAC7CG,EAAO,OACb,UAAOF,EAAO,mBAAmBE,EAAM,CAAC,CAAC,EAAE,KAAK,EAAI,KACpD,UAAOF,EAAO,mBAAmBE,EAAM,CAAC,CAAC,EAAE,KAAK,EAAK,KACrD,UAAOF,EAAO,mBAAmBE,EAAM,CAAC,CAAC,EAAE,KAAK,EAAI,KACpD,UAAOF,EAAO,mBAAmBE,EAAM,CAAC,CAAC,EAAE,KAAK,EAAK,KACrD,UAAOF,EAAO,mBAAmBE,EAAM,CAAC,CAAC,EAAE,KAAK,EAAI,KACpD,UAAOF,EAAO,mBAAmBE,EAAM,CAAC,CAAC,EAAE,KAAK,EAAK,KACrD,UAAOF,EAAO,mBAAmBE,EAAM,CAAC,CAAC,EAAE,KAAK,EAAI,KACpD,UAAOF,EAAO,mBAAmBE,EAAM,CAAC,CAAC,EAAE,KAAK,EAAK,CACvD,CAAC,CACH,CAAC",
6
+ "names": ["import_vitest", "import_SecureElementFlagsParser", "seFlags", "parser", "expectedState", "byte"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var c=(o,e)=>{for(var n in e)t(o,n,{get:e[n],enumerable:!0})},l=(o,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of V(e))!d.call(o,r)&&r!==n&&t(o,r,{get:()=>e[r],enumerable:!(i=a(e,r))||i.enumerable});return o};var g=o=>l(t({},"__esModule",{value:!0}),o);var S={};c(S,{getOsVersionCommandResponseMockBuilder:()=>m});module.exports=g(S);var s=require("../../../device/DeviceModel");const m=(o=s.DeviceModelId.NANO_SP,e={})=>({[s.DeviceModelId.NANO_SP]:{targetId:856686596,seVersion:"1.1.1",seFlags:3858759680,mcuSephVersion:"4.03",mcuBootloaderVersion:"3.12",hwVersion:"00",langId:"00",recoverState:"00",...e},[s.DeviceModelId.NANO_S]:{targetId:858783748,seVersion:"1.1.1",seFlags:3858759680,mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:"00",recoverState:"00",...e},[s.DeviceModelId.NANO_X]:{targetId:855638020,seVersion:"2.2.3",seFlags:3858759680,mcuSephVersion:"2.30",mcuBootloaderVersion:"1.16",hwVersion:"00",langId:"00",recoverState:"00"},[s.DeviceModelId.STAX]:{targetId:857735172,seVersion:"1.3.0",seFlags:3858759680,mcuSephVersion:"5.24",mcuBootloaderVersion:"0.48",hwVersion:"00",langId:"00",recoverState:"00",...e},[s.DeviceModelId.FLEX]:{targetId:858783748,seVersion:"1.1.1",seFlags:3858759680,mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:"00",recoverState:"00",...e}})[o];0&&(module.exports={getOsVersionCommandResponseMockBuilder});
1
+ "use strict";var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var u=(r,e)=>{for(var o in e)t(r,o,{get:e[o],enumerable:!0})},c=(r,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!d.call(r,i)&&i!==o&&t(r,i,{get:()=>e[i],enumerable:!(n=a(e,i))||n.enumerable});return r};var V=r=>c(t({},"__esModule",{value:!0}),r);var S={};u(S,{getOsVersionCommandResponseMockBuilder:()=>m});module.exports=V(S);var s=require("../../../device/DeviceModel");const m=(r=s.DeviceModelId.NANO_SP,e={})=>({[s.DeviceModelId.NANO_SP]:{targetId:856686596,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuSephVersion:"4.03",mcuBootloaderVersion:"3.12",hwVersion:"00",langId:"00",recoverState:"00",secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...e},[s.DeviceModelId.NANO_S]:{targetId:858783748,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:"00",recoverState:"00",secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...e},[s.DeviceModelId.NANO_X]:{targetId:855638020,seVersion:"2.2.3",seFlags:new Uint8Array([230,0,0,0]),mcuSephVersion:"2.30",mcuBootloaderVersion:"1.16",hwVersion:"00",langId:"00",recoverState:"00",secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1}},[s.DeviceModelId.STAX]:{targetId:857735172,seVersion:"1.3.0",seFlags:new Uint8Array([230,0,0,0]),mcuSephVersion:"5.24",mcuBootloaderVersion:"0.48",hwVersion:"00",langId:"00",recoverState:"00",secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...e},[s.DeviceModelId.FLEX]:{targetId:858783748,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:"00",recoverState:"00",secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...e}})[r];0&&(module.exports={getOsVersionCommandResponseMockBuilder});
2
2
  //# sourceMappingURL=GetOsVersionCommand.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/command/os/__mocks__/GetOsVersionCommand.ts"],
4
- "sourcesContent": ["import { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\n\nexport const getOsVersionCommandResponseMockBuilder = (\n deviceModelId: DeviceModelId = DeviceModelId.NANO_SP,\n props: Partial<GetOsVersionResponse> = {},\n): GetOsVersionResponse =>\n ({\n [DeviceModelId.NANO_SP]: {\n targetId: 856686596,\n seVersion: \"1.1.1\",\n seFlags: 3858759680,\n mcuSephVersion: \"4.03\",\n mcuBootloaderVersion: \"3.12\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n ...props,\n },\n [DeviceModelId.NANO_S]: {\n targetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: 3858759680,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n ...props,\n },\n [DeviceModelId.NANO_X]: {\n targetId: 855638020,\n seVersion: \"2.2.3\",\n seFlags: 3858759680,\n mcuSephVersion: \"2.30\",\n mcuBootloaderVersion: \"1.16\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n },\n [DeviceModelId.STAX]: {\n targetId: 857735172,\n seVersion: \"1.3.0\",\n seFlags: 3858759680,\n mcuSephVersion: \"5.24\",\n mcuBootloaderVersion: \"0.48\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n ...props,\n },\n [DeviceModelId.FLEX]: {\n targetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: 3858759680,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n ...props,\n },\n })[deviceModelId];\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4CAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAA8B,mCAEvB,MAAMF,EAAyC,CACpDG,EAA+B,gBAAc,QAC7CC,EAAuC,CAAC,KAEvC,CACC,CAAC,gBAAc,OAAO,EAAG,CACvB,SAAU,UACV,UAAW,QACX,QAAS,WACT,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,GAAGA,CACL,EACA,CAAC,gBAAc,MAAM,EAAG,CACtB,SAAU,UACV,UAAW,QACX,QAAS,WACT,eAAgB,QAChB,qBAAsB,QACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,GAAGA,CACL,EACA,CAAC,gBAAc,MAAM,EAAG,CACtB,SAAU,UACV,UAAW,QACX,QAAS,WACT,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,KACR,aAAc,IAChB,EACA,CAAC,gBAAc,IAAI,EAAG,CACpB,SAAU,UACV,UAAW,QACX,QAAS,WACT,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,GAAGA,CACL,EACA,CAAC,gBAAc,IAAI,EAAG,CACpB,SAAU,UACV,UAAW,QACX,QAAS,WACT,eAAgB,QAChB,qBAAsB,QACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,GAAGA,CACL,CACF,GAAGD,CAAa",
4
+ "sourcesContent": ["import { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\n\nexport const getOsVersionCommandResponseMockBuilder = (\n deviceModelId: DeviceModelId = DeviceModelId.NANO_SP,\n props: Partial<GetOsVersionResponse> = {},\n): GetOsVersionResponse =>\n ({\n [DeviceModelId.NANO_SP]: {\n targetId: 856686596,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuSephVersion: \"4.03\",\n mcuBootloaderVersion: \"3.12\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.NANO_S]: {\n targetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.NANO_X]: {\n targetId: 855638020,\n seVersion: \"2.2.3\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuSephVersion: \"2.30\",\n mcuBootloaderVersion: \"1.16\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n },\n [DeviceModelId.STAX]: {\n targetId: 857735172,\n seVersion: \"1.3.0\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuSephVersion: \"5.24\",\n mcuBootloaderVersion: \"0.48\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.FLEX]: {\n targetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n })[deviceModelId];\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4CAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAA8B,mCAEvB,MAAMF,EAAyC,CACpDG,EAA+B,gBAAc,QAC7CC,EAAuC,CAAC,KAEvC,CACC,CAAC,gBAAc,OAAO,EAAG,CACvB,SAAU,UACV,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,EACA,GAAGA,CACL,EACA,CAAC,gBAAc,MAAM,EAAG,CACtB,SAAU,UACV,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,eAAgB,QAChB,qBAAsB,QACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,EACA,GAAGA,CACL,EACA,CAAC,gBAAc,MAAM,EAAG,CACtB,SAAU,UACV,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,CACF,EACA,CAAC,gBAAc,IAAI,EAAG,CACpB,SAAU,UACV,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,EACA,GAAGA,CACL,EACA,CAAC,gBAAc,IAAI,EAAG,CACpB,SAAU,UACV,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,eAAgB,QAChB,qBAAsB,QACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,EACA,GAAGA,CACL,CACF,GAAGD,CAAa",
6
6
  "names": ["GetOsVersionCommand_exports", "__export", "getOsVersionCommandResponseMockBuilder", "__toCommonJS", "import_DeviceModel", "deviceModelId", "props"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var d=require("purify-ts"),r=require("../../command/model/CommandResult"),u=require("../../../internal/device-session/model/DeviceSession.stub"),p=require("../../../internal/device-session/service/DefaultDeviceSessionService"),S=require("../../../internal/logger-publisher/service/DefaultLoggerPublisherService"),f=require("../../../internal/manager-api/data/AxiosManagerApiDataSource"),g=require("../../../internal/manager-api/service/DefaultManagerApiService"),a=require("./SendCommandUseCase");let s,o,n,c;const m="fakeSessionId";let i;describe("SendCommandUseCase",()=>{beforeEach(()=>{s=new S.DefaultLoggerPublisherService([],"send-command-use-case"),o=new p.DefaultDeviceSessionService(()=>s),c=new f.AxiosManagerApiDataSource({}),n=new g.DefaultManagerApiService(c),i={getApdu:jest.fn(),parseResponse:jest.fn()}}),afterEach(()=>{jest.restoreAllMocks()}),it("should send a command to a connected device",async()=>{const e=(0,u.deviceSessionStubBuilder)({},()=>s,n);o.addDeviceSession(e);const t=new a.SendCommandUseCase(o,()=>s);jest.spyOn(e,"sendCommand").mockResolvedValue({status:r.CommandResultStatus.Success,data:void 0});const v=await t.execute({sessionId:m,command:i});e.close(),expect(v).toStrictEqual({status:r.CommandResultStatus.Success,data:void 0})}),it("should throw an error if the session is not found",async()=>{const e=new a.SendCommandUseCase(o,()=>s);jest.spyOn(o,"getDeviceSessionById").mockReturnValue((0,d.Left)({_tag:"DeviceSessionNotFound"}));const t=e.execute({sessionId:m,command:i});await expect(t).rejects.toMatchObject({_tag:"DeviceSessionNotFound"})})});
1
+ "use strict";var d=require("purify-ts"),i=require("../../command/model/CommandResult"),p=require("../../../internal/device-session/model/DeviceSession.stub"),f=require("../../../internal/device-session/service/DefaultDeviceSessionService"),l=require("../../../internal/logger-publisher/service/DefaultLoggerPublisherService"),v=require("../../../internal/manager-api/data/AxiosManagerApiDataSource"),g=require("../../../internal/manager-api/service/DefaultManagerApiService"),D=require("../../../internal/secure-channel/data/DefaultSecureChannelDataSource"),C=require("../../../internal/secure-channel/service/DefaultSecureChannelService"),a=require("./SendCommandUseCase");let o,t,n,c,m,u;const S="fakeSessionId";let s;describe("SendCommandUseCase",()=>{beforeEach(()=>{o=new l.DefaultLoggerPublisherService([],"send-command-use-case"),t=new f.DefaultDeviceSessionService(()=>o),c=new v.AxiosManagerApiDataSource({}),n=new g.DefaultManagerApiService(c),u=new D.DefaultSecureChannelDataSource({}),m=new C.DefaultSecureChannelService(u),s={getApdu:vi.fn(),parseResponse:vi.fn()}}),afterEach(()=>{vi.restoreAllMocks()}),it("should send a command to a connected device",async()=>{const e=(0,p.deviceSessionStubBuilder)({},()=>o,n,m);t.addDeviceSession(e);const r=new a.SendCommandUseCase(t,()=>o);vi.spyOn(e,"sendCommand").mockResolvedValue({status:i.CommandResultStatus.Success,data:void 0});const h=await r.execute({sessionId:S,command:s});e.close(),expect(h).toStrictEqual({status:i.CommandResultStatus.Success,data:void 0})}),it("should throw an error if the session is not found",async()=>{const e=new a.SendCommandUseCase(t,()=>o);vi.spyOn(t,"getDeviceSessionById").mockReturnValue((0,d.Left)({_tag:"DeviceSessionNotFound"}));const r=e.execute({sessionId:S,command:s});await expect(r).rejects.toMatchObject({_tag:"DeviceSessionNotFound"})})});
2
2
  //# sourceMappingURL=SendCommandUseCase.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/command/use-case/SendCommandUseCase.test.ts"],
4
- "sourcesContent": ["import { Left } from \"purify-ts\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { CommandResultStatus } from \"@api/command/model/CommandResult\";\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { deviceSessionStubBuilder } from \"@internal/device-session/model/DeviceSession.stub\";\nimport { DefaultDeviceSessionService } from \"@internal/device-session/service/DefaultDeviceSessionService\";\nimport { type DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\nimport { AxiosManagerApiDataSource } from \"@internal/manager-api/data/AxiosManagerApiDataSource\";\nimport { type ManagerApiDataSource } from \"@internal/manager-api/data/ManagerApiDataSource\";\nimport { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\n\nimport { SendCommandUseCase } from \"./SendCommandUseCase\";\n\nlet logger: LoggerPublisherService;\nlet sessionService: DeviceSessionService;\nlet managerApi: ManagerApiService;\nlet managerApiDataSource: ManagerApiDataSource;\nconst fakeSessionId = \"fakeSessionId\";\nlet command: Command<{ status: string }>;\n\ndescribe(\"SendCommandUseCase\", () => {\n beforeEach(() => {\n logger = new DefaultLoggerPublisherService([], \"send-command-use-case\");\n sessionService = new DefaultDeviceSessionService(() => logger);\n managerApiDataSource = new AxiosManagerApiDataSource({} as DmkConfig);\n managerApi = new DefaultManagerApiService(managerApiDataSource);\n command = {\n getApdu: jest.fn(),\n parseResponse: jest.fn(),\n };\n });\n\n afterEach(() => {\n jest.restoreAllMocks();\n });\n\n it(\"should send a command to a connected device\", async () => {\n const deviceSession = deviceSessionStubBuilder(\n {},\n () => logger,\n managerApi,\n );\n sessionService.addDeviceSession(deviceSession);\n const useCase = new SendCommandUseCase(sessionService, () => logger);\n\n jest.spyOn(deviceSession, \"sendCommand\").mockResolvedValue({\n status: CommandResultStatus.Success,\n data: undefined,\n });\n\n const response = await useCase.execute<{ status: string }, void, void>({\n sessionId: fakeSessionId,\n command,\n });\n\n deviceSession.close();\n\n expect(response).toStrictEqual({\n status: CommandResultStatus.Success,\n data: undefined,\n });\n });\n\n it(\"should throw an error if the session is not found\", async () => {\n const useCase = new SendCommandUseCase(sessionService, () => logger);\n jest\n .spyOn(sessionService, \"getDeviceSessionById\")\n .mockReturnValue(Left({ _tag: \"DeviceSessionNotFound\" }));\n\n const res = useCase.execute<{ status: string }, void, void>({\n sessionId: fakeSessionId,\n command,\n });\n\n await expect(res).rejects.toMatchObject({ _tag: \"DeviceSessionNotFound\" });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAAqB,qBAGrBC,EAAoC,4CAGpCC,EAAyC,6DACzCC,EAA4C,wEAE5CC,EAA8C,4EAC9CC,EAA0C,gEAE1CC,EAAyC,kEAGzCC,EAAmC,gCAEnC,IAAIC,EACAC,EACAC,EACAC,EACJ,MAAMC,EAAgB,gBACtB,IAAIC,EAEJ,SAAS,qBAAsB,IAAM,CACnC,WAAW,IAAM,CACfL,EAAS,IAAI,gCAA8B,CAAC,EAAG,uBAAuB,EACtEC,EAAiB,IAAI,8BAA4B,IAAMD,CAAM,EAC7DG,EAAuB,IAAI,4BAA0B,CAAC,CAAc,EACpED,EAAa,IAAI,2BAAyBC,CAAoB,EAC9DE,EAAU,CACR,QAAS,KAAK,GAAG,EACjB,cAAe,KAAK,GAAG,CACzB,CACF,CAAC,EAED,UAAU,IAAM,CACd,KAAK,gBAAgB,CACvB,CAAC,EAED,GAAG,8CAA+C,SAAY,CAC5D,MAAMC,KAAgB,4BACpB,CAAC,EACD,IAAMN,EACNE,CACF,EACAD,EAAe,iBAAiBK,CAAa,EAC7C,MAAMC,EAAU,IAAI,qBAAmBN,EAAgB,IAAMD,CAAM,EAEnE,KAAK,MAAMM,EAAe,aAAa,EAAE,kBAAkB,CACzD,OAAQ,sBAAoB,QAC5B,KAAM,MACR,CAAC,EAED,MAAME,EAAW,MAAMD,EAAQ,QAAwC,CACrE,UAAWH,EACX,QAAAC,CACF,CAAC,EAEDC,EAAc,MAAM,EAEpB,OAAOE,CAAQ,EAAE,cAAc,CAC7B,OAAQ,sBAAoB,QAC5B,KAAM,MACR,CAAC,CACH,CAAC,EAED,GAAG,oDAAqD,SAAY,CAClE,MAAMD,EAAU,IAAI,qBAAmBN,EAAgB,IAAMD,CAAM,EACnE,KACG,MAAMC,EAAgB,sBAAsB,EAC5C,mBAAgB,QAAK,CAAE,KAAM,uBAAwB,CAAC,CAAC,EAE1D,MAAMQ,EAAMF,EAAQ,QAAwC,CAC1D,UAAWH,EACX,QAAAC,CACF,CAAC,EAED,MAAM,OAAOI,CAAG,EAAE,QAAQ,cAAc,CAAE,KAAM,uBAAwB,CAAC,CAC3E,CAAC,CACH,CAAC",
6
- "names": ["import_purify_ts", "import_CommandResult", "import_DeviceSession", "import_DefaultDeviceSessionService", "import_DefaultLoggerPublisherService", "import_AxiosManagerApiDataSource", "import_DefaultManagerApiService", "import_SendCommandUseCase", "logger", "sessionService", "managerApi", "managerApiDataSource", "fakeSessionId", "command", "deviceSession", "useCase", "response", "res"]
4
+ "sourcesContent": ["import { Left } from \"purify-ts\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { CommandResultStatus } from \"@api/command/model/CommandResult\";\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { deviceSessionStubBuilder } from \"@internal/device-session/model/DeviceSession.stub\";\nimport { DefaultDeviceSessionService } from \"@internal/device-session/service/DefaultDeviceSessionService\";\nimport { type DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\nimport { AxiosManagerApiDataSource } from \"@internal/manager-api/data/AxiosManagerApiDataSource\";\nimport { type ManagerApiDataSource } from \"@internal/manager-api/data/ManagerApiDataSource\";\nimport { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { DefaultSecureChannelDataSource } from \"@internal/secure-channel/data/DefaultSecureChannelDataSource\";\nimport { type SecureChannelDataSource } from \"@internal/secure-channel/data/SecureChannelDataSource\";\nimport { DefaultSecureChannelService } from \"@internal/secure-channel/service/DefaultSecureChannelService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { SendCommandUseCase } from \"./SendCommandUseCase\";\n\nlet logger: LoggerPublisherService;\nlet sessionService: DeviceSessionService;\nlet managerApi: ManagerApiService;\nlet managerApiDataSource: ManagerApiDataSource;\nlet secureChannel: SecureChannelService;\nlet secureChannelDataSource: SecureChannelDataSource;\nconst fakeSessionId = \"fakeSessionId\";\nlet command: Command<{ status: string }>;\n\ndescribe(\"SendCommandUseCase\", () => {\n beforeEach(() => {\n logger = new DefaultLoggerPublisherService([], \"send-command-use-case\");\n sessionService = new DefaultDeviceSessionService(() => logger);\n managerApiDataSource = new AxiosManagerApiDataSource({} as DmkConfig);\n managerApi = new DefaultManagerApiService(managerApiDataSource);\n secureChannelDataSource = new DefaultSecureChannelDataSource(\n {} as DmkConfig,\n );\n secureChannel = new DefaultSecureChannelService(secureChannelDataSource);\n command = {\n getApdu: vi.fn(),\n parseResponse: vi.fn(),\n };\n });\n\n afterEach(() => {\n vi.restoreAllMocks();\n });\n\n it(\"should send a command to a connected device\", async () => {\n const deviceSession = deviceSessionStubBuilder(\n {},\n () => logger,\n managerApi,\n secureChannel,\n );\n sessionService.addDeviceSession(deviceSession);\n const useCase = new SendCommandUseCase(sessionService, () => logger);\n\n vi.spyOn(deviceSession, \"sendCommand\").mockResolvedValue({\n status: CommandResultStatus.Success,\n data: undefined,\n });\n\n const response = await useCase.execute<{ status: string }, void, void>({\n sessionId: fakeSessionId,\n command,\n });\n\n deviceSession.close();\n\n expect(response).toStrictEqual({\n status: CommandResultStatus.Success,\n data: undefined,\n });\n });\n\n it(\"should throw an error if the session is not found\", async () => {\n const useCase = new SendCommandUseCase(sessionService, () => logger);\n vi.spyOn(sessionService, \"getDeviceSessionById\").mockReturnValue(\n Left({ _tag: \"DeviceSessionNotFound\" }),\n );\n\n const res = useCase.execute<{ status: string }, void, void>({\n sessionId: fakeSessionId,\n command,\n });\n\n await expect(res).rejects.toMatchObject({ _tag: \"DeviceSessionNotFound\" });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAAqB,qBAGrBC,EAAoC,4CAGpCC,EAAyC,6DACzCC,EAA4C,wEAE5CC,EAA8C,4EAC9CC,EAA0C,gEAE1CC,EAAyC,kEAEzCC,EAA+C,wEAE/CC,EAA4C,wEAG5CC,EAAmC,gCAEnC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACJ,MAAMC,EAAgB,gBACtB,IAAIC,EAEJ,SAAS,qBAAsB,IAAM,CACnC,WAAW,IAAM,CACfP,EAAS,IAAI,gCAA8B,CAAC,EAAG,uBAAuB,EACtEC,EAAiB,IAAI,8BAA4B,IAAMD,CAAM,EAC7DG,EAAuB,IAAI,4BAA0B,CAAC,CAAc,EACpED,EAAa,IAAI,2BAAyBC,CAAoB,EAC9DE,EAA0B,IAAI,iCAC5B,CAAC,CACH,EACAD,EAAgB,IAAI,8BAA4BC,CAAuB,EACvEE,EAAU,CACR,QAAS,GAAG,GAAG,EACf,cAAe,GAAG,GAAG,CACvB,CACF,CAAC,EAED,UAAU,IAAM,CACd,GAAG,gBAAgB,CACrB,CAAC,EAED,GAAG,8CAA+C,SAAY,CAC5D,MAAMC,KAAgB,4BACpB,CAAC,EACD,IAAMR,EACNE,EACAE,CACF,EACAH,EAAe,iBAAiBO,CAAa,EAC7C,MAAMC,EAAU,IAAI,qBAAmBR,EAAgB,IAAMD,CAAM,EAEnE,GAAG,MAAMQ,EAAe,aAAa,EAAE,kBAAkB,CACvD,OAAQ,sBAAoB,QAC5B,KAAM,MACR,CAAC,EAED,MAAME,EAAW,MAAMD,EAAQ,QAAwC,CACrE,UAAWH,EACX,QAAAC,CACF,CAAC,EAEDC,EAAc,MAAM,EAEpB,OAAOE,CAAQ,EAAE,cAAc,CAC7B,OAAQ,sBAAoB,QAC5B,KAAM,MACR,CAAC,CACH,CAAC,EAED,GAAG,oDAAqD,SAAY,CAClE,MAAMD,EAAU,IAAI,qBAAmBR,EAAgB,IAAMD,CAAM,EACnE,GAAG,MAAMC,EAAgB,sBAAsB,EAAE,mBAC/C,QAAK,CAAE,KAAM,uBAAwB,CAAC,CACxC,EAEA,MAAMU,EAAMF,EAAQ,QAAwC,CAC1D,UAAWH,EACX,QAAAC,CACF,CAAC,EAED,MAAM,OAAOI,CAAG,EAAE,QAAQ,cAAc,CAAE,KAAM,uBAAwB,CAAC,CAC3E,CAAC,CACH,CAAC",
6
+ "names": ["import_purify_ts", "import_CommandResult", "import_DeviceSession", "import_DefaultDeviceSessionService", "import_DefaultLoggerPublisherService", "import_AxiosManagerApiDataSource", "import_DefaultManagerApiService", "import_DefaultSecureChannelDataSource", "import_DefaultSecureChannelService", "import_SendCommandUseCase", "logger", "sessionService", "managerApi", "managerApiDataSource", "secureChannel", "secureChannelDataSource", "fakeSessionId", "command", "deviceSession", "useCase", "response", "res"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var a=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var s=(e,o,i,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of l(o))!d.call(e,n)&&n!==i&&a(e,n,{get:()=>o[n],enumerable:!(t=r(o,n))||t.enumerable});return e};var b=e=>s(a({},"__esModule",{value:!0}),e);var u={};module.exports=b(u);
2
+ //# sourceMappingURL=SecureElementFlags.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/api/device/SecureElementFlags.ts"],
4
+ "sourcesContent": ["/**\n * Represents the general state of a device, the information comes from the first byte of the secure element flags.\n */\nexport type DeviceGeneralState = {\n /**\n * Indicates whether the device's PIN has been validated.\n */\n isPinValidated: boolean;\n\n /**\n * Indicates whether the device has a MCU serial number.\n */\n hasMcuSerialNumber: boolean;\n\n /**\n * Indicates whether the device has a personalized valid Ledger certificate.\n */\n hasValidCertificate: boolean;\n\n /**\n * Indicates whether the device is allowed to connect with a custom certificate authority.\n */\n isCustomAuthorityConnectionAllowed: boolean;\n\n /**\n * Indicates whether the device is allowed to commnunicate with secure connection.\n */\n isSecureConnectionAllowed: boolean;\n\n /**\n * Indicates whether the device has been onboarded.\n */\n isOnboarded: boolean;\n\n /**\n * Indicates whether the MCU code on the device is signed.\n */\n isMcuCodeSigned: boolean;\n\n /**\n * Indicates whether the device is in recovery mode.\n */\n isInRecoveryMode: boolean;\n};\n\n// 2nd byte of the secure element flags, placeholder for the endorsement information\nexport type EndorsementInformation = unknown;\n\n// 3rd byte of the secure element flags, placeholder for the words information\nexport type WordsInformation = unknown;\n\n// 4th byte of the secure element flags, placeholder for the onboarding status\nexport type OnboardingStatus = unknown;\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["SecureElementFlags_exports", "__toCommonJS"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var m=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of s(e))!p.call(t,r)&&r!==i&&a(t,r,{get:()=>e[r],enumerable:!(o=n(e,r))||o.enumerable});return t};var c=t=>m(a({},"__esModule",{value:!0}),t);var d={};module.exports=c(d);
1
+ "use strict";var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var m=(r,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of s(e))!p.call(r,t)&&t!==i&&n(r,t,{get:()=>e[t],enumerable:!(o=a(e,t))||o.enumerable});return r};var c=r=>m(n({},"__esModule",{value:!0}),r);var d={};module.exports=c(d);
2
2
  //# sourceMappingURL=DeviceAction.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/api/device-action/DeviceAction.ts"],
4
- "sourcesContent": ["import { type Observable } from \"rxjs\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type DmkError } from \"@api/Error\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\n\nimport { type DeviceActionState } from \"./model/DeviceActionState\";\n\nexport type InternalApi = {\n readonly sendCommand: <Response, Args, ErrorStatusCodes>(\n command: Command<Response, Args, ErrorStatusCodes>,\n ) => Promise<CommandResult<Response, ErrorStatusCodes>>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly getDeviceSessionStateObservable: () => Observable<DeviceSessionState>;\n readonly setDeviceSessionState: (\n state: DeviceSessionState,\n ) => DeviceSessionState;\n readonly getManagerApiService: () => ManagerApiService;\n};\n\nexport type DeviceActionIntermediateValue = {\n readonly requiredUserInteraction: string;\n};\n\nexport type ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> = {\n readonly observable: Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >;\n cancel(): void;\n};\n\nexport interface DeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n> {\n readonly input: Input;\n\n _execute(\n params: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue>;\n}\n"],
4
+ "sourcesContent": ["import { type Either } from \"purify-ts\";\nimport { type Observable } from \"rxjs\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type DmkError } from \"@api/Error\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { type DeviceActionState } from \"./model/DeviceActionState\";\n\nexport type InternalApi = {\n readonly sendApdu: (\n apdu: Uint8Array,\n ) => Promise<Either<DmkError, ApduResponse>>;\n readonly sendCommand: <Response, Args, ErrorStatusCodes>(\n command: Command<Response, Args, ErrorStatusCodes>,\n ) => Promise<CommandResult<Response, ErrorStatusCodes>>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly getDeviceSessionStateObservable: () => Observable<DeviceSessionState>;\n readonly setDeviceSessionState: (\n state: DeviceSessionState,\n ) => DeviceSessionState;\n readonly disableRefresher: (blockerId: string) => () => void;\n readonly getManagerApiService: () => ManagerApiService;\n readonly getSecureChannelService: () => SecureChannelService;\n};\n\nexport type DeviceActionIntermediateValue = {\n readonly requiredUserInteraction: string;\n};\n\nexport type ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> = {\n readonly observable: Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >;\n cancel(): void;\n};\n\nexport interface DeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n> {\n readonly input: Input;\n\n _execute(\n params: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue>;\n}\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["DeviceAction_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var S=(t,e)=>{for(var s in e)i(t,s,{get:e[s],enumerable:!0})},v=(t,e,s,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of a(e))!r.call(t,n)&&n!==s&&i(t,n,{get:()=>e[n],enumerable:!(o=c(e,n))||o.enumerable});return t};var p=t=>v(i({},"__esModule",{value:!0}),t);var j={};S(j,{makeDeviceActionInternalApiMock:()=>g});module.exports=p(j);const M=jest.fn(),k=jest.fn(),f=jest.fn(),m=jest.fn(),D=jest.fn();function g(){return{sendCommand:M,getDeviceSessionState:k,getDeviceSessionStateObservable:f,setDeviceSessionState:m,getManagerApiService:D}}0&&(module.exports={makeDeviceActionInternalApiMock});
1
+ "use strict";var c=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var v=(n,e)=>{for(var i in e)c(n,i,{get:e[i],enumerable:!0})},S=(n,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of a(e))!r.call(n,t)&&t!==i&&c(n,t,{get:()=>e[t],enumerable:!(o=s(e,t))||o.enumerable});return n};var p=n=>S(c({},"__esModule",{value:!0}),n);var b={};v(b,{makeDeviceActionInternalApiMock:()=>D});module.exports=p(b);const f=vi.fn(),M=vi.fn(),d=vi.fn(),k=vi.fn(),l=vi.fn(),m=vi.fn(),g=vi.fn(),A=vi.fn();function D(){return{sendApdu:f,sendCommand:M,getDeviceSessionState:d,getDeviceSessionStateObservable:k,setDeviceSessionState:l,getManagerApiService:m,getSecureChannelService:g,disableRefresher:A}}0&&(module.exports={makeDeviceActionInternalApiMock});
2
2
  //# sourceMappingURL=makeInternalApi.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/__test-utils__/makeInternalApi.ts"],
4
- "sourcesContent": ["import { type InternalApi } from \"@api/device-action/DeviceAction\";\n\nconst sendCommandMock = jest.fn();\nconst apiGetDeviceSessionStateMock = jest.fn();\nconst apiGetDeviceSessionStateObservableMock = jest.fn();\nconst setDeviceSessionStateMock = jest.fn();\nconst getManagerApiServiceMock = jest.fn();\n\nexport function makeDeviceActionInternalApiMock(): jest.Mocked<InternalApi> {\n return {\n sendCommand: sendCommandMock,\n getDeviceSessionState: apiGetDeviceSessionStateMock,\n getDeviceSessionStateObservable: apiGetDeviceSessionStateObservableMock,\n setDeviceSessionState: setDeviceSessionStateMock,\n getManagerApiService: getManagerApiServiceMock,\n };\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,IAAA,eAAAC,EAAAH,GAEA,MAAMI,EAAkB,KAAK,GAAG,EAC1BC,EAA+B,KAAK,GAAG,EACvCC,EAAyC,KAAK,GAAG,EACjDC,EAA4B,KAAK,GAAG,EACpCC,EAA2B,KAAK,GAAG,EAElC,SAASN,GAA4D,CAC1E,MAAO,CACL,YAAaE,EACb,sBAAuBC,EACvB,gCAAiCC,EACjC,sBAAuBC,EACvB,qBAAsBC,CACxB,CACF",
6
- "names": ["makeInternalApi_exports", "__export", "makeDeviceActionInternalApiMock", "__toCommonJS", "sendCommandMock", "apiGetDeviceSessionStateMock", "apiGetDeviceSessionStateObservableMock", "setDeviceSessionStateMock", "getManagerApiServiceMock"]
4
+ "sourcesContent": ["import { type Mocked } from \"vitest\";\n\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\n\nconst sendApduMock = vi.fn();\nconst sendCommandMock = vi.fn();\nconst apiGetDeviceSessionStateMock = vi.fn();\nconst apiGetDeviceSessionStateObservableMock = vi.fn();\nconst setDeviceSessionStateMock = vi.fn();\nconst getManagerApiServiceMock = vi.fn();\nconst getSecureChannelServiceMock = vi.fn();\nconst disableRefresherMock = vi.fn();\n\nexport function makeDeviceActionInternalApiMock(): Mocked<InternalApi> {\n return {\n sendApdu: sendApduMock,\n sendCommand: sendCommandMock,\n getDeviceSessionState: apiGetDeviceSessionStateMock,\n getDeviceSessionStateObservable: apiGetDeviceSessionStateObservableMock,\n setDeviceSessionState: setDeviceSessionStateMock,\n getManagerApiService: getManagerApiServiceMock,\n getSecureChannelService: getSecureChannelServiceMock,\n disableRefresher: disableRefresherMock,\n };\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,IAAA,eAAAC,EAAAH,GAIA,MAAMI,EAAe,GAAG,GAAG,EACrBC,EAAkB,GAAG,GAAG,EACxBC,EAA+B,GAAG,GAAG,EACrCC,EAAyC,GAAG,GAAG,EAC/CC,EAA4B,GAAG,GAAG,EAClCC,EAA2B,GAAG,GAAG,EACjCC,EAA8B,GAAG,GAAG,EACpCC,EAAuB,GAAG,GAAG,EAE5B,SAAST,GAAuD,CACrE,MAAO,CACL,SAAUE,EACV,YAAaC,EACb,sBAAuBC,EACvB,gCAAiCC,EACjC,sBAAuBC,EACvB,qBAAsBC,EACtB,wBAAyBC,EACzB,iBAAkBC,CACpB,CACF",
6
+ "names": ["makeInternalApi_exports", "__export", "makeDeviceActionInternalApiMock", "__toCommonJS", "sendApduMock", "sendCommandMock", "apiGetDeviceSessionStateMock", "apiGetDeviceSessionStateObservableMock", "setDeviceSessionStateMock", "getManagerApiServiceMock", "getSecureChannelServiceMock", "disableRefresherMock"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var k=(t,e)=>{for(var o in e)p(t,o,{get:e[o],enumerable:!0})},y=(t,e,o,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!A.call(t,i)&&i!==o&&p(t,i,{get:()=>e[i],enumerable:!(c=f(e,i))||c.enumerable});return t};var D=t=>y(p({},"__esModule",{value:!0}),t);var v={};k(v,{setupGetDeviceStatusMock:()=>h,setupGoToDashboardMock:()=>I,setupListAppsMock:()=>M});module.exports=D(v);var r=require("purify-ts"),n=require("xstate"),a=require("../../device-action/model/UserInteractionRequired"),s=require("../../device-action/os/Errors"),m=require("../../device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),d=require("../../device-action/os/GoToDashboard/GoToDashboardDeviceAction"),u=require("../../device-action/os/ListApps/ListAppsDeviceAction");const M=(t,e=!1)=>{u.ListAppsDeviceAction.mockImplementation(()=>({makeStateMachine:jest.fn().mockImplementation(()=>(0,n.createMachine)({id:"MockListAppsDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,n.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.AllowListApps})})},done:{type:"final"}},output:()=>e?(0,r.Left)(new s.UnknownDAError("ListApps failed")):(0,r.Right)(t)}))}))},I=(t=!1)=>{d.GoToDashboardDeviceAction.mockImplementation(()=>({makeStateMachine:jest.fn().mockImplementation(()=>(0,n.createMachine)({id:"MockGoToDashboardDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,n.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.None})})},done:{type:"final"}},output:()=>t?(0,r.Left)(new s.UnknownDAError("GoToDashboard failed")):(0,r.Right)(void 0)}))}))},h=(t=[{currentApp:"BOLOS",currentAppVersion:"1.0.0"}])=>{const e=jest.fn();for(const o of t)e.mockImplementationOnce(()=>"currentApp"in o?(0,r.Right)(o):(0,r.Left)(o));m.GetDeviceStatusDeviceAction.mockImplementation(()=>({makeStateMachine:jest.fn().mockImplementation(()=>(0,n.createMachine)({id:"MockGetDeviceStatusDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,n.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.None})})},done:{type:"final"}},output:e}))}))};0&&(module.exports={setupGetDeviceStatusMock,setupGoToDashboardMock,setupListAppsMock});
1
+ "use strict";var p=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var A=(t,e)=>{for(var o in e)p(t,o,{get:e[o],enumerable:!0})},y=(t,e,o,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!k.call(t,i)&&i!==o&&p(t,i,{get:()=>e[i],enumerable:!(m=f(e,i))||m.enumerable});return t};var D=t=>y(p({},"__esModule",{value:!0}),t);var h={};A(h,{setupGetDeviceStatusMock:()=>I,setupGoToDashboardMock:()=>v,setupListAppsMock:()=>M});module.exports=D(h);var r=require("purify-ts"),n=require("xstate"),a=require("../../device-action/model/UserInteractionRequired"),c=require("../../device-action/os/Errors"),s=require("../../device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),d=require("../../device-action/os/GoToDashboard/GoToDashboardDeviceAction"),u=require("../../device-action/os/ListApps/ListAppsDeviceAction");const M=(t,e=!1)=>{u.ListAppsDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,n.createMachine)({id:"MockListAppsDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,n.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.AllowListApps})})},done:{type:"final"}},output:()=>e?(0,r.Left)(new c.UnknownDAError("ListApps failed")):(0,r.Right)(t)}))}))},v=(t=!1)=>{d.GoToDashboardDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,n.createMachine)({id:"MockGoToDashboardDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,n.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.None})})},done:{type:"final"}},output:()=>t?(0,r.Left)(new c.UnknownDAError("GoToDashboard failed")):(0,r.Right)(void 0)}))}))},I=(t=[{currentApp:"BOLOS",currentAppVersion:"1.0.0"}])=>{const e=vi.fn();for(const o of t)e.mockImplementationOnce(()=>"currentApp"in o?(0,r.Right)(o):(0,r.Left)(o));s.GetDeviceStatusDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,n.createMachine)({id:"MockGetDeviceStatusDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,n.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.None})})},done:{type:"final"}},output:e}))}))};0&&(module.exports={setupGetDeviceStatusMock,setupGoToDashboardMock,setupListAppsMock});
2
2
  //# sourceMappingURL=setupTestMachine.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/__test-utils__/setupTestMachine.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, createMachine } from \"xstate\";\n\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nimport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nimport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nimport { type DmkError } from \"@api/Error\";\n\nimport { type BTC_APP } from \"./data\";\n\ntype App = typeof BTC_APP;\n\nexport const setupListAppsMock = (apps: App[], error = false) => {\n (ListAppsDeviceAction as jest.Mock).mockImplementation(() => ({\n makeStateMachine: jest.fn().mockImplementation(() =>\n createMachine({\n id: \"MockListAppsDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"ListApps failed\"))\n : Right(apps);\n },\n }),\n ),\n }));\n};\n\nexport const setupGoToDashboardMock = (error: boolean = false) => {\n (GoToDashboardDeviceAction as jest.Mock).mockImplementation(() => ({\n makeStateMachine: jest.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGoToDashboardDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"GoToDashboard failed\"))\n : Right(undefined);\n },\n }),\n ),\n }));\n};\n\nexport const setupGetDeviceStatusMock = (\n outputs: ReadonlyArray<\n { currentApp: string; currentAppVersion: string } | DmkError\n > = [\n {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n ],\n) => {\n const outputFn = jest.fn();\n\n for (const output of outputs) {\n outputFn.mockImplementationOnce(() =>\n \"currentApp\" in output ? Right(output) : Left(output),\n );\n }\n (GetDeviceStatusDeviceAction as jest.Mock).mockImplementation(() => ({\n makeStateMachine: jest.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGetDeviceStatusDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: outputFn,\n }),\n ),\n }));\n};\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,EAAA,2BAAAC,EAAA,sBAAAC,IAAA,eAAAC,EAAAL,GAAA,IAAAM,EAA4B,qBAC5BC,EAAsC,kBAEtCC,EAAwC,4DACxCC,EAA+B,wCAC/BC,EAA4C,6EAC5CC,EAA0C,yEAC1CC,EAAqC,+DAO9B,MAAMR,EAAoB,CAACS,EAAaC,EAAQ,KAAU,CAC9D,uBAAmC,mBAAmB,KAAO,CAC5D,iBAAkB,KAAK,GAAG,EAAE,mBAAmB,OAC7C,iBAAc,CACZ,GAAI,2BACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,aACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQ,IACCA,KACH,QAAK,IAAI,iBAAe,iBAAiB,CAAC,KAC1C,SAAMD,CAAI,CAElB,CAAC,CACH,CACF,EAAE,CACJ,EAEaV,EAAyB,CAACW,EAAiB,KAAU,CAC/D,4BAAwC,mBAAmB,KAAO,CACjE,iBAAkB,KAAK,GAAG,EAAE,mBAAmB,OAC7C,iBAAc,CACZ,GAAI,gCACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,IACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQ,IACCA,KACH,QAAK,IAAI,iBAAe,sBAAsB,CAAC,KAC/C,SAAM,MAAS,CAEvB,CAAC,CACH,CACF,EAAE,CACJ,EAEaZ,EAA2B,CACtCa,EAEI,CACF,CACE,WAAY,QACZ,kBAAmB,OACrB,CACF,IACG,CACH,MAAMC,EAAW,KAAK,GAAG,EAEzB,UAAWC,KAAUF,EACnBC,EAAS,uBAAuB,IAC9B,eAAgBC,KAAS,SAAMA,CAAM,KAAI,QAAKA,CAAM,CACtD,EAED,8BAA0C,mBAAmB,KAAO,CACnE,iBAAkB,KAAK,GAAG,EAAE,mBAAmB,OAC7C,iBAAc,CACZ,GAAI,kCACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,IACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQD,CACV,CAAC,CACH,CACF,EAAE,CACJ",
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { type Mock } from \"vitest\";\nimport { assign, createMachine } from \"xstate\";\n\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nimport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nimport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nimport { type DmkError } from \"@api/Error\";\n\nimport { type BTC_APP } from \"./data\";\n\ntype App = typeof BTC_APP;\n\nexport const setupListAppsMock = (apps: App[], error = false) => {\n (ListAppsDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockListAppsDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"ListApps failed\"))\n : Right(apps);\n },\n }),\n ),\n }));\n};\n\nexport const setupGoToDashboardMock = (error: boolean = false) => {\n (GoToDashboardDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGoToDashboardDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"GoToDashboard failed\"))\n : Right(undefined);\n },\n }),\n ),\n }));\n};\n\nexport const setupGetDeviceStatusMock = (\n outputs: ReadonlyArray<\n { currentApp: string; currentAppVersion: string } | DmkError\n > = [\n {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n ],\n) => {\n const outputFn = vi.fn();\n\n for (const output of outputs) {\n outputFn.mockImplementationOnce(() =>\n \"currentApp\" in output ? Right(output) : Left(output),\n );\n }\n (GetDeviceStatusDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGetDeviceStatusDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: outputFn,\n }),\n ),\n }));\n};\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,EAAA,2BAAAC,EAAA,sBAAAC,IAAA,eAAAC,EAAAL,GAAA,IAAAM,EAA4B,qBAE5BC,EAAsC,kBAEtCC,EAAwC,4DACxCC,EAA+B,wCAC/BC,EAA4C,6EAC5CC,EAA0C,yEAC1CC,EAAqC,+DAO9B,MAAMR,EAAoB,CAACS,EAAaC,EAAQ,KAAU,CAC9D,uBAA8B,mBAAmB,KAAO,CACvD,iBAAkB,GAAG,GAAG,EAAE,mBAAmB,OAC3C,iBAAc,CACZ,GAAI,2BACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,aACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQ,IACCA,KACH,QAAK,IAAI,iBAAe,iBAAiB,CAAC,KAC1C,SAAMD,CAAI,CAElB,CAAC,CACH,CACF,EAAE,CACJ,EAEaV,EAAyB,CAACW,EAAiB,KAAU,CAC/D,4BAAmC,mBAAmB,KAAO,CAC5D,iBAAkB,GAAG,GAAG,EAAE,mBAAmB,OAC3C,iBAAc,CACZ,GAAI,gCACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,IACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQ,IACCA,KACH,QAAK,IAAI,iBAAe,sBAAsB,CAAC,KAC/C,SAAM,MAAS,CAEvB,CAAC,CACH,CACF,EAAE,CACJ,EAEaZ,EAA2B,CACtCa,EAEI,CACF,CACE,WAAY,QACZ,kBAAmB,OACrB,CACF,IACG,CACH,MAAMC,EAAW,GAAG,GAAG,EAEvB,UAAWC,KAAUF,EACnBC,EAAS,uBAAuB,IAC9B,eAAgBC,KAAS,SAAMA,CAAM,KAAI,QAAKA,CAAM,CACtD,EAED,8BAAqC,mBAAmB,KAAO,CAC9D,iBAAkB,GAAG,GAAG,EAAE,mBAAmB,OAC3C,iBAAc,CACZ,GAAI,kCACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,IACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQD,CACV,CAAC,CACH,CACF,EAAE,CACJ",
6
6
  "names": ["setupTestMachine_exports", "__export", "setupGetDeviceStatusMock", "setupGoToDashboardMock", "setupListAppsMock", "__toCommonJS", "import_purify_ts", "import_xstate", "import_UserInteractionRequired", "import_Errors", "import_GetDeviceStatusDeviceAction", "import_GoToDashboardDeviceAction", "import_ListAppsDeviceAction", "apps", "error", "outputs", "outputFn", "output"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var s=(t,e)=>{for(var i in e)o(t,i,{get:e[i],enumerable:!0})},A=(t,e,i,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!l.call(t,r)&&r!==i&&o(t,r,{get:()=>e[r],enumerable:!(c=p(e,r))||c.enumerable});return t};var D=t=>A(o({},"__esModule",{value:!0}),t);var I={};s(I,{testDeviceActionStates:()=>v});module.exports=D(I);function v(t,e,i,c){const r=[],{observable:a,cancel:u}=t._execute(i);return a.subscribe({next:n=>{r.push(n)},error:n=>{c(n)},complete:()=>{try{expect(r).toEqual(e),c()}catch(n){c(n)}}}),{observable:a,cancel:u}}0&&(module.exports={testDeviceActionStates});
1
+ "use strict";var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var v=(t,e)=>{for(var o in e)c(t,o,{get:e[o],enumerable:!0})},A=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of s(e))!l.call(t,r)&&r!==o&&c(t,r,{get:()=>e[r],enumerable:!(n=m(e,r))||n.enumerable});return t};var d=t=>A(c({},"__esModule",{value:!0}),t);var I={};v(I,{testDeviceActionStates:()=>D});module.exports=d(I);function D(t,e,o,{onDone:n,onError:r}){const a=[],{observable:u,cancel:p}=t._execute(o);return u.subscribe({next:i=>{a.push(i)},error:i=>{r(i)},complete:()=>{try{expect(a).toEqual(e),n()}catch(i){r(i)}}}),{observable:u,cancel:p}}0&&(module.exports={testDeviceActionStates});
2
2
  //# sourceMappingURL=testDeviceActionStates.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/__test-utils__/testDeviceActionStates.ts"],
4
- "sourcesContent": ["import {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type InternalApi,\n} from \"@api/device-action/DeviceAction\";\nimport { type DeviceActionState } from \"@api/device-action/model/DeviceActionState\";\nimport { type DmkError } from \"@api/Error\";\n\n/**\n * Test that the states emitted by a device action match the expected states.\n * @param deviceAction The device action to test.\n * @param expectedStates The expected states.\n * @param internalApi\n * @param done The Jest done callback.\n */\nexport function testDeviceActionStates<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n>(\n deviceAction: DeviceAction<Output, Input, Error, IntermediateValue>,\n expectedStates: Array<DeviceActionState<Output, Error, IntermediateValue>>,\n internalApi: InternalApi,\n done: jest.DoneCallback,\n) {\n const observedStates: Array<\n DeviceActionState<Output, Error, IntermediateValue>\n > = [];\n\n const { observable, cancel } = deviceAction._execute(internalApi);\n observable.subscribe({\n next: (state) => {\n observedStates.push(state);\n },\n error: (error) => {\n done(error);\n },\n complete: () => {\n try {\n expect(observedStates).toEqual(expectedStates);\n done();\n } catch (e) {\n done(e);\n }\n },\n });\n return { observable, cancel };\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAeO,SAASE,EAMdE,EACAC,EACAC,EACAC,EACA,CACA,MAAMC,EAEF,CAAC,EAEC,CAAE,WAAAC,EAAY,OAAAC,CAAO,EAAIN,EAAa,SAASE,CAAW,EAChE,OAAAG,EAAW,UAAU,CACnB,KAAOE,GAAU,CACfH,EAAe,KAAKG,CAAK,CAC3B,EACA,MAAQC,GAAU,CAChBL,EAAKK,CAAK,CACZ,EACA,SAAU,IAAM,CACd,GAAI,CACF,OAAOJ,CAAc,EAAE,QAAQH,CAAc,EAC7CE,EAAK,CACP,OAASM,EAAG,CACVN,EAAKM,CAAC,CACR,CACF,CACF,CAAC,EACM,CAAE,WAAAJ,EAAY,OAAAC,CAAO,CAC9B",
6
- "names": ["testDeviceActionStates_exports", "__export", "testDeviceActionStates", "__toCommonJS", "deviceAction", "expectedStates", "internalApi", "done", "observedStates", "observable", "cancel", "state", "error", "e"]
4
+ "sourcesContent": ["import {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type InternalApi,\n} from \"@api/device-action/DeviceAction\";\nimport { type DeviceActionState } from \"@api/device-action/model/DeviceActionState\";\nimport { type DmkError } from \"@api/Error\";\n\n/**\n * Test that the states emitted by a device action match the expected states.\n * @param deviceAction The device action to test.\n * @param expectedStates The expected states.\n * @param internalApi\n * @param callbacks { onDone, onError } The callbacks to call when the test is done or an error occurs.\n */\nexport function testDeviceActionStates<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n>(\n deviceAction: DeviceAction<Output, Input, Error, IntermediateValue>,\n expectedStates: Array<DeviceActionState<Output, Error, IntermediateValue>>,\n internalApi: InternalApi,\n {\n onDone,\n onError,\n }: {\n onDone: () => void;\n onError: (error: Error) => void;\n },\n) {\n const observedStates: Array<\n DeviceActionState<Output, Error, IntermediateValue>\n > = [];\n\n const { observable, cancel } = deviceAction._execute(internalApi);\n\n observable.subscribe({\n next: (state) => {\n observedStates.push(state);\n },\n error: (error) => {\n onError(error);\n },\n complete: () => {\n try {\n expect(observedStates).toEqual(expectedStates);\n onDone();\n } catch (e) {\n onError(e as Error);\n }\n },\n });\n\n return { observable, cancel };\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAeO,SAASE,EAMdE,EACAC,EACAC,EACA,CACE,OAAAC,EACA,QAAAC,CACF,EAIA,CACA,MAAMC,EAEF,CAAC,EAEC,CAAE,WAAAC,EAAY,OAAAC,CAAO,EAAIP,EAAa,SAASE,CAAW,EAEhE,OAAAI,EAAW,UAAU,CACnB,KAAOE,GAAU,CACfH,EAAe,KAAKG,CAAK,CAC3B,EACA,MAAQC,GAAU,CAChBL,EAAQK,CAAK,CACf,EACA,SAAU,IAAM,CACd,GAAI,CACF,OAAOJ,CAAc,EAAE,QAAQJ,CAAc,EAC7CE,EAAO,CACT,OAASO,EAAG,CACVN,EAAQM,CAAU,CACpB,CACF,CACF,CAAC,EAEM,CAAE,WAAAJ,EAAY,OAAAC,CAAO,CAC9B",
6
+ "names": ["testDeviceActionStates_exports", "__export", "testDeviceActionStates", "__toCommonJS", "deviceAction", "expectedStates", "internalApi", "onDone", "onError", "observedStates", "observable", "cancel", "state", "error", "e"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/model/UserInteractionRequired.ts"],
4
- "sourcesContent": ["/**\n * The user interaction required on the device to move further in a device action.\n * This is used to inform the user about the action they need to take on the device.\n */\nexport enum UserInteractionRequired {\n None = \"none\",\n UnlockDevice = \"unlock-device\",\n AllowSecureConnection = \"allow-secure-connection\",\n ConfirmOpenApp = \"confirm-open-app\",\n SignTransaction = \"sign-transaction\",\n SignTypedData = \"sign-typed-data\",\n AllowListApps = \"allow-list-apps\",\n VerifyAddress = \"verify-address\",\n SignPersonalMessage = \"sign-personal-message\",\n}\n"],
4
+ "sourcesContent": ["/**\n * The user interaction required on the device to move further in a device action.\n * This is used to inform the users about the action they need to take on the device.\n */\nexport enum UserInteractionRequired {\n None = \"none\",\n UnlockDevice = \"unlock-device\",\n AllowSecureConnection = \"allow-secure-connection\",\n ConfirmOpenApp = \"confirm-open-app\",\n SignTransaction = \"sign-transaction\",\n SignTypedData = \"sign-typed-data\",\n AllowListApps = \"allow-list-apps\",\n VerifyAddress = \"verify-address\",\n SignPersonalMessage = \"sign-personal-message\",\n}\n"],
5
5
  "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAIO,IAAKE,OACVA,EAAA,KAAO,OACPA,EAAA,aAAe,gBACfA,EAAA,sBAAwB,0BACxBA,EAAA,eAAiB,mBACjBA,EAAA,gBAAkB,mBAClBA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,iBAChBA,EAAA,oBAAsB,wBATZA,OAAA",
6
6
  "names": ["UserInteractionRequired_exports", "__export", "UserInteractionRequired", "__toCommonJS"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var I=(r,t)=>{for(var s in t)o(r,s,{get:t[s],enumerable:!0})},C=(r,t,s,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of T(t))!m.call(r,n)&&n!==s&&o(r,n,{get:()=>t[n],enumerable:!(e=A(t,n))||e.enumerable});return r};var d=r=>C(o({},"__esModule",{value:!0}),r);var S={};I(S,{CallTaskInAppDeviceAction:()=>D});module.exports=d(S);var p=require("purify-ts"),a=require("xstate"),l=require("../../../command/model/CommandResult"),i=require("../../../device-action/model/UserInteractionRequired"),c=require("../../../device-action/os/Errors"),u=require("../../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),k=require("../../../device-action/xstate-utils/XStateDeviceAction");class D extends k.XStateDeviceAction{makeStateMachine(t){const{callTask:s}=this.extractDependencies(t);return(0,a.setup)({types:{input:{},context:{},output:{}},actors:{callTask:(0,a.fromPromise)(s),openAppStateMachine:new u.OpenAppDeviceAction({input:{appName:this.input.appName,compatibleAppNames:this.input.compatibleAppNames}}).makeStateMachine(t)},guards:{noInternalError:({context:e})=>e._internalState.error===null},actions:{assignErrorFromEvent:(0,a.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"CallTaskInAppDeviceAction",initial:"OpenAppDeviceAction",context:({input:e})=>({input:e,intermediateValue:{requiredUserInteraction:i.UserInteractionRequired.None},_internalState:{taskResponse:null,error:null}}),states:{OpenAppDeviceAction:{invoke:{id:"openAppStateMachine",input:{appName:this.input.appName,compatibleAppNames:this.input.compatibleAppNames},src:"openAppStateMachine",onSnapshot:{actions:(0,a.assign)({intermediateValue:e=>e.event.snapshot.context.intermediateValue})},onDone:{actions:(0,a.assign)({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:n=>({...e.context._internalState,error:n})})}),target:"CheckOpenAppDeviceActionResult"}}},CheckOpenAppDeviceActionResult:{always:[{target:"CallTask",guard:"noInternalError"},"Error"]},CallTask:{entry:(0,a.assign)({intermediateValue:{requiredUserInteraction:this.input.requiredUserInteraction}}),exit:(0,a.assign)({intermediateValue:{requiredUserInteraction:i.UserInteractionRequired.None}}),invoke:{id:"callTask",src:"callTask",input:e=>e.context.input.task,onDone:{target:"CallTaskResultCheck",actions:[(0,a.assign)({_internalState:({event:e,context:n})=>(0,l.isSuccessCommandResult)(e.output)?{...n._internalState,taskResponse:e.output.data}:{...n._internalState,error:e.output.error}})]},onError:{target:"Error",actions:"assignErrorFromEvent"}}},CallTaskResultCheck:{always:[{target:"Success",guard:"noInternalError"},"Error"]},Success:{type:"final"},Error:{type:"final"}},output:({context:e})=>e._internalState.taskResponse?(0,p.Right)(e._internalState.taskResponse):(0,p.Left)(e._internalState.error||new c.UnknownDAError("No error in final state"))})}extractDependencies(t){return{callTask:s=>s.input(t)}}}0&&(module.exports={CallTaskInAppDeviceAction});
2
+ //# sourceMappingURL=CallTaskInAppDeviceAction.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.ts"],
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromPromise, setup } from \"xstate\";\n\nimport {\n type CommandResult,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\n\nimport {\n type CallTaskInAppDAError,\n type CallTaskInAppDAInput,\n type CallTaskInAppDAIntermediateValue,\n type CallTaskInAppDAInternalState,\n type CallTaskInAppDAOutput,\n} from \"./CallTaskInAppDeviceActionTypes\";\n\n/**\n * Tries to open an app on the device, and if it is successful, calls a task\n * in the app.\n * The output will be the result of the task.\n *\n * ```ts\n * input: {\n * appName: string;\n * task: (internalApi: InternalApi) => Promise<CommandResult<TaskResponse, TaskErrorCodes>>;\n * requiredUserInteraction: UserInteraction;\n * }\n * ```\n *\n * Example of usage:\n *\n * ```ts\n * const deviceAction = new CallTaskInAppDeviceAction({\n * input: {\n * appName: \"MyApp\",\n * task: async (internalApi: InternalApi) => internalApi.sendCommand(new MyAppSpecificCommand()),\n * requiredUserInteraction: UserInteractionRequired.None,\n * },\n * });\n * dmk.executeDeviceAction({ sessionId: \"mySessionId\", deviceAction });\n * ```\n */\nexport class CallTaskInAppDeviceAction<\n TaskResponse,\n TaskErrorCodes,\n UserInteraction extends UserInteractionRequired,\n> extends XStateDeviceAction<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n> {\n makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n > {\n type types = StateMachineTypes<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n >;\n\n const { callTask } = this.extractDependencies(internalAPI);\n\n return setup({\n types: {\n input: {} as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n callTask: fromPromise(callTask),\n openAppStateMachine: new OpenAppDeviceAction({\n input: {\n appName: this.input.appName,\n compatibleAppNames: this.input.compatibleAppNames,\n },\n }).makeStateMachine(internalAPI),\n },\n guards: {\n noInternalError: ({ context }) => context._internalState.error === null,\n },\n actions: {\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // NOTE: it should never happen, the error is not typed anymore here\n }),\n }),\n },\n }).createMachine({\n id: \"CallTaskInAppDeviceAction\",\n initial: \"OpenAppDeviceAction\",\n context: ({ input }) => {\n return {\n input: input,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n taskResponse: null,\n error: null,\n },\n };\n },\n states: {\n OpenAppDeviceAction: {\n invoke: {\n id: \"openAppStateMachine\",\n input: {\n appName: this.input.appName,\n compatibleAppNames: this.input.compatibleAppNames,\n },\n src: \"openAppStateMachine\",\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) =>\n _.event.snapshot.context.intermediateValue,\n }),\n },\n onDone: {\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n >({\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n });\n },\n }),\n target: \"CheckOpenAppDeviceActionResult\",\n },\n },\n },\n CheckOpenAppDeviceActionResult: {\n always: [\n {\n target: \"CallTask\",\n guard: \"noInternalError\",\n },\n \"Error\",\n ],\n },\n CallTask: {\n entry: assign({\n intermediateValue: {\n requiredUserInteraction: this.input.requiredUserInteraction,\n },\n }),\n exit: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n }),\n invoke: {\n id: \"callTask\",\n src: \"callTask\",\n input: (_: { context: types[\"context\"] }) => _.context.input.task,\n onDone: {\n target: \"CallTaskResultCheck\",\n actions: [\n assign({\n _internalState: ({ event, context }) => {\n if (isSuccessCommandResult(event.output)) {\n return {\n ...context._internalState,\n taskResponse: event.output.data,\n };\n }\n return {\n ...context._internalState,\n error: event.output.error,\n };\n },\n }),\n ],\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n CallTaskResultCheck: {\n always: [\n {\n target: \"Success\",\n guard: \"noInternalError\",\n },\n \"Error\",\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: ({ context }) =>\n context._internalState.taskResponse\n ? Right(context._internalState.taskResponse)\n : Left(\n context._internalState.error ||\n new UnknownDAError(\"No error in final state\"),\n ),\n });\n }\n\n extractDependencies(internalApi: InternalApi) {\n return {\n callTask: (_: {\n input: (\n internalApi: InternalApi,\n ) => Promise<CommandResult<TaskResponse, TaskErrorCodes>>;\n }): Promise<CommandResult<TaskResponse, TaskErrorCodes>> =>\n _.input(internalApi),\n };\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4B,qBAC5BC,EAA2C,kBAE3CC,EAGO,4CAEPC,EAAwC,4DACxCC,EAA+B,wCAC/BC,EAAoC,yEAEpCC,EAGO,8DAoCA,MAAMR,UAIH,oBAMR,CACA,iBACES,EAOA,CASA,KAAM,CAAE,SAAAC,CAAS,EAAI,KAAK,oBAAoBD,CAAW,EAEzD,SAAO,SAAM,CACX,MAAO,CACL,MAAO,CAAC,EACR,QAAS,CAAC,EACV,OAAQ,CAAC,CACX,EACA,OAAQ,CACN,YAAU,eAAYC,CAAQ,EAC9B,oBAAqB,IAAI,sBAAoB,CAC3C,MAAO,CACL,QAAS,KAAK,MAAM,QACpB,mBAAoB,KAAK,MAAM,kBACjC,CACF,CAAC,EAAE,iBAAiBD,CAAW,CACjC,EACA,OAAQ,CACN,gBAAiB,CAAC,CAAE,QAAAE,CAAQ,IAAMA,EAAQ,eAAe,QAAU,IACrE,EACA,QAAS,CACP,wBAAsB,UAAO,CAC3B,eAAiBC,IAAO,CACtB,GAAGA,EAAE,QAAQ,eACb,MAAOA,EAAE,MAAM,KACjB,EACF,CAAC,CACH,CACF,CAAC,EAAE,cAAc,CACf,GAAI,4BACJ,QAAS,sBACT,QAAS,CAAC,CAAE,MAAAC,CAAM,KACT,CACL,MAAOA,EACP,kBAAmB,CACjB,wBAAyB,0BAAwB,IACnD,EACA,eAAgB,CACd,aAAc,KACd,MAAO,IACT,CACF,GAEF,OAAQ,CACN,oBAAqB,CACnB,OAAQ,CACN,GAAI,sBACJ,MAAO,CACL,QAAS,KAAK,MAAM,QACpB,mBAAoB,KAAK,MAAM,kBACjC,EACA,IAAK,sBACL,WAAY,CACV,WAAS,UAAO,CACd,kBAAoBD,GAClBA,EAAE,MAAM,SAAS,QAAQ,iBAC7B,CAAC,CACH,EACA,OAAQ,CACN,WAAS,UAAO,CACd,eAAiBA,GACRA,EAAE,MAAM,OAAO,OAEpB,CACA,MAAO,IAAMA,EAAE,QAAQ,eACvB,KAAOE,IAAW,CAChB,GAAGF,EAAE,QAAQ,eACb,MAAAE,CACF,EACF,CAAC,CAEL,CAAC,EACD,OAAQ,gCACV,CACF,CACF,EACA,+BAAgC,CAC9B,OAAQ,CACN,CACE,OAAQ,WACR,MAAO,iBACT,EACA,OACF,CACF,EACA,SAAU,CACR,SAAO,UAAO,CACZ,kBAAmB,CACjB,wBAAyB,KAAK,MAAM,uBACtC,CACF,CAAC,EACD,QAAM,UAAO,CACX,kBAAmB,CACjB,wBAAyB,0BAAwB,IACnD,CACF,CAAC,EACD,OAAQ,CACN,GAAI,WACJ,IAAK,WACL,MAAQF,GAAqCA,EAAE,QAAQ,MAAM,KAC7D,OAAQ,CACN,OAAQ,sBACR,QAAS,IACP,UAAO,CACL,eAAgB,CAAC,CAAE,MAAAG,EAAO,QAAAJ,CAAQ,OAC5B,0BAAuBI,EAAM,MAAM,EAC9B,CACL,GAAGJ,EAAQ,eACX,aAAcI,EAAM,OAAO,IAC7B,EAEK,CACL,GAAGJ,EAAQ,eACX,MAAOI,EAAM,OAAO,KACtB,CAEJ,CAAC,CACH,CACF,EACA,QAAS,CACP,OAAQ,QACR,QAAS,sBACX,CACF,CACF,EACA,oBAAqB,CACnB,OAAQ,CACN,CACE,OAAQ,UACR,MAAO,iBACT,EACA,OACF,CACF,EACA,QAAS,CACP,KAAM,OACR,EACA,MAAO,CACL,KAAM,OACR,CACF,EACA,OAAQ,CAAC,CAAE,QAAAJ,CAAQ,IACjBA,EAAQ,eAAe,gBACnB,SAAMA,EAAQ,eAAe,YAAY,KACzC,QACEA,EAAQ,eAAe,OACrB,IAAI,iBAAe,yBAAyB,CAChD,CACR,CAAC,CACH,CAEA,oBAAoBK,EAA0B,CAC5C,MAAO,CACL,SAAWJ,GAKTA,EAAE,MAAMI,CAAW,CACvB,CACF,CACF",
6
+ "names": ["CallTaskInAppDeviceAction_exports", "__export", "CallTaskInAppDeviceAction", "__toCommonJS", "import_purify_ts", "import_xstate", "import_CommandResult", "import_UserInteractionRequired", "import_Errors", "import_OpenAppDeviceAction", "import_XStateDeviceAction", "internalAPI", "callTask", "context", "_", "input", "error", "event", "internalApi"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var k=require("purify-ts"),y=require("xstate"),w=require("../../../apdu/utils/ApduBuilder"),u=require("../../../command/model/CommandResult"),s=require("../../../device-action/__test-utils__/makeInternalApi"),A=require("../../../device-action/__test-utils__/testDeviceActionStates"),n=require("../../../device-action/model/DeviceActionState"),e=require("../../../device-action/model/UserInteractionRequired"),C=require("../../../device-action/os/Errors"),M=require("../../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),v=require("../../../../../src"),d=require("./CallTaskInAppDeviceAction");vi.mock("@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction",async t=>{const o=await t();return{...o,OpenAppDeviceAction:vi.fn(()=>({...o.OpenAppDeviceAction,makeStateMachine:vi.fn()}))}});const l=t=>{M.OpenAppDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,y.createMachine)({initial:"pending",states:{pending:{entry:(0,y.assign)({intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}}),after:{0:"done"}},done:{type:"final"}},output:()=>t?(0,k.Left)(t):(0,k.Right)(void 0)}))}))};describe("CallTaskInAppDeviceAction",()=>{const t=vi.fn(),o=()=>({callTask:t}),{sendCommand:D}=(0,s.makeDeviceActionInternalApiMock)(),p={paramString:"aParameter",paramNumber:1234},I={aNumber:5678,aString:"mockedResponseString"};beforeEach(()=>{vi.resetAllMocks()}),describe("without mocking extractDependencies",()=>{it("should call sendCommand on internalApi with the correct parameters",async()=>{l(),D.mockResolvedValue((0,u.CommandResultFactory)({data:void 0}));const i=new d.CallTaskInAppDeviceAction({input:{task:async r=>await r.sendCommand(new c(p)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}});await new Promise((r,a)=>{i._execute((0,s.makeDeviceActionInternalApiMock)()).observable.subscribe({error:()=>a(),complete:()=>r(),next:()=>{}})}),expect(D).toHaveBeenCalledWith(new c(p))})}),describe("error cases",()=>{it("should error and output the error if the open app fails",()=>new Promise((i,r)=>{l(new C.UnknownDAError("Mocked error"));const a=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}},{status:n.DeviceActionStatus.Error,error:new C.UnknownDAError("Mocked error")}];(0,A.testDeviceActionStates)(new d.CallTaskInAppDeviceAction({input:{task:async m=>await m.sendCommand(new c(p)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}}),a,(0,s.makeDeviceActionInternalApiMock)(),{onDone:i,onError:r})})),it("should error and output an error if the call task fails",()=>new Promise((i,r)=>{l(),t.mockResolvedValue((0,u.CommandResultFactory)({error:new v.UnknownDeviceExchangeError("Mocked error")}));const a=new d.CallTaskInAppDeviceAction({input:{task:async f=>await f.sendCommand(new c(p)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}});vi.spyOn(a,"extractDependencies").mockImplementation(o);const m=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}},{status:n.DeviceActionStatus.Error,error:new v.UnknownDeviceExchangeError("Mocked error")}];(0,A.testDeviceActionStates)(a,m,(0,s.makeDeviceActionInternalApiMock)(),{onDone:i,onError:r})}))}),describe("success cases",()=>{it("should succeed and output the command result if the send command succeeds",()=>new Promise((i,r)=>{l(),t.mockResolvedValue((0,u.CommandResultFactory)({data:I}));const a=new d.CallTaskInAppDeviceAction({input:{task:async f=>await f.sendCommand(new c(p)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}});vi.spyOn(a,"extractDependencies").mockImplementation(o);const m=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}},{status:n.DeviceActionStatus.Completed,output:I}];(0,A.testDeviceActionStates)(a,m,(0,s.makeDeviceActionInternalApiMock)(),{onDone:i,onError:r})}))})});class c{params;constructor(o){this.params=o}getApdu(){return new w.ApduBuilder({cla:0,ins:1,p1:2,p2:3}).add32BitUIntToData(this.params.paramNumber).addAsciiStringToData(this.params.paramString).build()}parseResponse(){return(0,u.CommandResultFactory)({data:{aNumber:1,aString:"aString"}})}}
2
+ //# sourceMappingURL=CallTaskInAppDeviceAction.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.ts"],
4
+ "sourcesContent": ["/* eslint @typescript-eslint/consistent-type-imports:0 */\nimport { Left, Right } from \"purify-ts\";\nimport { type Mock } from \"vitest\";\nimport { assign, createMachine } from \"xstate\";\n\nimport { type Apdu } from \"@api/apdu/model/Apdu\";\nimport { ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nimport { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { testDeviceActionStates } from \"@api/device-action/__test-utils__/testDeviceActionStates\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nimport { type Command } from \"@api/types\";\nimport { UnknownDeviceExchangeError } from \"@root/src\";\n\nimport { CallTaskInAppDeviceAction } from \"./CallTaskInAppDeviceAction\";\nimport {\n type CallTaskInAppDAError,\n type CallTaskInAppDAIntermediateValue,\n type CallTaskInAppDAOutput,\n} from \"./CallTaskInAppDeviceActionTypes\";\n\nvi.mock(\n \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\",\n async (importOriginal) => {\n const original =\n await importOriginal<\n typeof import(\"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\")\n >();\n return {\n ...original,\n OpenAppDeviceAction: vi.fn(() => ({\n ...original.OpenAppDeviceAction,\n makeStateMachine: vi.fn(),\n })),\n };\n },\n);\n\nconst setupOpenAppDAMock = (error?: unknown) => {\n (OpenAppDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n initial: \"pending\",\n states: {\n pending: {\n entry: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n }),\n after: {\n 0: \"done\",\n },\n },\n done: {\n type: \"final\",\n },\n },\n output: () => (error ? Left(error) : Right(undefined)),\n }),\n ),\n }));\n};\n\ndescribe(\"CallTaskInAppDeviceAction\", () => {\n const callMyTask = vi.fn();\n\n const extractDependenciesMock = () => ({\n callTask: callMyTask,\n });\n\n const { sendCommand: apiSendCommandMock } = makeDeviceActionInternalApiMock();\n\n const commandParams = {\n paramString: \"aParameter\",\n paramNumber: 1234,\n };\n const mockedCommandResponse = {\n aNumber: 5678,\n aString: \"mockedResponseString\",\n };\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"without mocking extractDependencies\", () => {\n it(\"should call sendCommand on internalApi with the correct parameters\", async () => {\n setupOpenAppDAMock();\n apiSendCommandMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n\n const deviceAction = new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n await internalApi.sendCommand(new TestCommand(commandParams)),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n });\n await new Promise<void>((resolve, reject) => {\n deviceAction\n ._execute(makeDeviceActionInternalApiMock())\n .observable.subscribe({\n error: () => reject(),\n complete: () => resolve(),\n next: () => {},\n });\n });\n\n expect(apiSendCommandMock).toHaveBeenCalledWith(\n new TestCommand(commandParams),\n );\n });\n });\n\n describe(\"error cases\", () => {\n it(\"should error and output the error if the open app fails\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock(new UnknownDAError(\"Mocked error\"));\n\n const expectedStates: MyCommandCallTaskDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"Mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n await internalApi.sendCommand(new TestCommand(commandParams)),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n }),\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should error and output an error if the call task fails\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock();\n\n callMyTask.mockResolvedValue(\n CommandResultFactory({\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n }),\n );\n\n const deviceAction = new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n await internalApi.sendCommand(new TestCommand(commandParams)),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockImplementation(\n extractDependenciesMock,\n );\n\n const expectedStates: MyCommandCallTaskDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n\n describe(\"success cases\", () => {\n it(\"should succeed and output the command result if the send command succeeds\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock();\n\n callMyTask.mockResolvedValue(\n CommandResultFactory({ data: mockedCommandResponse }),\n );\n\n const deviceAction = new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n await internalApi.sendCommand(new TestCommand(commandParams)),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockImplementation(\n extractDependenciesMock,\n );\n\n const expectedStates: MyCommandCallTaskDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: mockedCommandResponse,\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n});\n\ntype MyCommandResponse = {\n aNumber: number;\n aString: string;\n};\n\ntype MyCommandParams = {\n paramString: string;\n paramNumber: number;\n};\n\nclass TestCommand implements Command<MyCommandResponse, MyCommandParams> {\n params: MyCommandParams;\n constructor(params: MyCommandParams) {\n this.params = params;\n }\n getApdu(): Apdu {\n return new ApduBuilder({ cla: 0x00, ins: 0x01, p1: 0x02, p2: 0x03 })\n .add32BitUIntToData(this.params.paramNumber)\n .addAsciiStringToData(this.params.paramString)\n .build();\n }\n parseResponse() {\n return CommandResultFactory({ data: { aNumber: 1, aString: \"aString\" } });\n }\n}\n\ntype MyCommandCallTaskDAState = DeviceActionState<\n CallTaskInAppDAOutput<MyCommandResponse>,\n CallTaskInAppDAError<UnknownDAError>,\n CallTaskInAppDAIntermediateValue<\n UserInteractionRequired.None | UserInteractionRequired.VerifyAddress\n >\n>;\n"],
5
+ "mappings": "aACA,IAAAA,EAA4B,qBAE5BC,EAAsC,kBAGtCC,EAA4B,uCAC5BC,EAAqC,4CACrCC,EAAgD,6DAChDC,EAAuC,oEACvCC,EAGO,sDACPC,EAAwC,4DACxCC,EAA+B,wCAC/BC,EAAoC,yEAEpCC,EAA2C,qBAE3CC,EAA0C,uCAO1C,GAAG,KACD,gEACA,MAAOC,GAAmB,CACxB,MAAMC,EACJ,MAAMD,EAEJ,EACJ,MAAO,CACL,GAAGC,EACH,oBAAqB,GAAG,GAAG,KAAO,CAChC,GAAGA,EAAS,oBACZ,iBAAkB,GAAG,GAAG,CAC1B,EAAE,CACJ,CACF,CACF,EAEA,MAAMC,EAAsBC,GAAoB,CAC7C,sBAA6B,mBAAmB,KAAO,CACtD,iBAAkB,GAAG,GAAG,EAAE,mBAAmB,OAC3C,iBAAc,CACZ,QAAS,UACT,OAAQ,CACN,QAAS,CACP,SAAO,UAAO,CACZ,kBAAmB,CACjB,wBAAyB,0BAAwB,cACnD,CACF,CAAC,EACD,MAAO,CACL,EAAG,MACL,CACF,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQ,IAAOA,KAAQ,QAAKA,CAAK,KAAI,SAAM,MAAS,CACtD,CAAC,CACH,CACF,EAAE,CACJ,EAEA,SAAS,4BAA6B,IAAM,CAC1C,MAAMC,EAAa,GAAG,GAAG,EAEnBC,EAA0B,KAAO,CACrC,SAAUD,CACZ,GAEM,CAAE,YAAaE,CAAmB,KAAI,mCAAgC,EAEtEC,EAAgB,CACpB,YAAa,aACb,YAAa,IACf,EACMC,EAAwB,CAC5B,QAAS,KACT,QAAS,sBACX,EACA,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,sCAAuC,IAAM,CACpD,GAAG,qEAAsE,SAAY,CACnFN,EAAmB,EACnBI,EAAmB,qBACjB,wBAAqB,CAAE,KAAM,MAAU,CAAC,CAC1C,EAEA,MAAMG,EAAe,IAAI,4BAA0B,CACjD,MAAO,CACL,KAAM,MAAOC,GACX,MAAMA,EAAY,YAAY,IAAIC,EAAYJ,CAAa,CAAC,EAC9D,QAAS,QACT,wBAAyB,0BAAwB,aACnD,CACF,CAAC,EACD,MAAM,IAAI,QAAc,CAACK,EAASC,IAAW,CAC3CJ,EACG,YAAS,mCAAgC,CAAC,EAC1C,WAAW,UAAU,CACpB,MAAO,IAAMI,EAAO,EACpB,SAAU,IAAMD,EAAQ,EACxB,KAAM,IAAM,CAAC,CACf,CAAC,CACL,CAAC,EAED,OAAON,CAAkB,EAAE,qBACzB,IAAIK,EAAYJ,CAAa,CAC/B,CACF,CAAC,CACH,CAAC,EAED,SAAS,cAAe,IAAM,CAC5B,GAAG,0DAA2D,IAC5D,IAAI,QAAc,CAACK,EAASC,IAAW,CACrCX,EAAmB,IAAI,iBAAe,cAAc,CAAC,EAErD,MAAMY,EAA6C,CACjD,CACE,OAAQ,qBAAmB,QAC3B,kBAAmB,CACjB,wBAAyB,0BAAwB,IACnD,CACF,EACA,CACE,OAAQ,qBAAmB,QAC3B,kBAAmB,CACjB,wBAAyB,0BAAwB,cACnD,CACF,EACA,CACE,OAAQ,qBAAmB,MAC3B,MAAO,IAAI,iBAAe,cAAc,CAC1C,CACF,KAEA,0BACE,IAAI,4BAA0B,CAC5B,MAAO,CACL,KAAM,MAAOJ,GACX,MAAMA,EAAY,YAAY,IAAIC,EAAYJ,CAAa,CAAC,EAC9D,QAAS,QACT,wBAAyB,0BAAwB,aACnD,CACF,CAAC,EACDO,KACA,mCAAgC,EAChC,CACE,OAAQF,EACR,QAASC,CACX,CACF,CACF,CAAC,CAAC,EAEJ,GAAG,0DAA2D,IAC5D,IAAI,QAAc,CAACD,EAASC,IAAW,CACrCX,EAAmB,EAEnBE,EAAW,qBACT,wBAAqB,CACnB,MAAO,IAAI,6BAA2B,cAAc,CACtD,CAAC,CACH,EAEA,MAAMK,EAAe,IAAI,4BAA0B,CACjD,MAAO,CACL,KAAM,MAAOC,GACX,MAAMA,EAAY,YAAY,IAAIC,EAAYJ,CAAa,CAAC,EAC9D,QAAS,QACT,wBAAyB,0BAAwB,aACnD,CACF,CAAC,EAED,GAAG,MAAME,EAAc,qBAAqB,EAAE,mBAC5CJ,CACF,EAEA,MAAMS,EAA6C,CACjD,CACE,OAAQ,qBAAmB,QAC3B,kBAAmB,CACjB,wBAAyB,0BAAwB,IACnD,CACF,EACA,CACE,OAAQ,qBAAmB,QAC3B,kBAAmB,CACjB,wBAAyB,0BAAwB,cACnD,CACF,EACA,CACE,OAAQ,qBAAmB,QAC3B,kBAAmB,CACjB,wBAAyB,0BAAwB,aACnD,CACF,EACA,CACE,OAAQ,qBAAmB,MAC3B,MAAO,IAAI,6BAA2B,cAAc,CACtD,CACF,KAEA,0BACEL,EACAK,KACA,mCAAgC,EAChC,CACE,OAAQF,EACR,QAASC,CACX,CACF,CACF,CAAC,CAAC,CACN,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,4EAA6E,IAC9E,IAAI,QAAc,CAACD,EAASC,IAAW,CACrCX,EAAmB,EAEnBE,EAAW,qBACT,wBAAqB,CAAE,KAAMI,CAAsB,CAAC,CACtD,EAEA,MAAMC,EAAe,IAAI,4BAA0B,CACjD,MAAO,CACL,KAAM,MAAOC,GACX,MAAMA,EAAY,YAAY,IAAIC,EAAYJ,CAAa,CAAC,EAC9D,QAAS,QACT,wBAAyB,0BAAwB,aACnD,CACF,CAAC,EAED,GAAG,MAAME,EAAc,qBAAqB,EAAE,mBAC5CJ,CACF,EAEA,MAAMS,EAA6C,CACjD,CACE,OAAQ,qBAAmB,QAC3B,kBAAmB,CACjB,wBAAyB,0BAAwB,IACnD,CACF,EACA,CACE,OAAQ,qBAAmB,QAC3B,kBAAmB,CACjB,wBAAyB,0BAAwB,cACnD,CACF,EACA,CACE,OAAQ,qBAAmB,QAC3B,kBAAmB,CACjB,wBAAyB,0BAAwB,aACnD,CACF,EACA,CACE,OAAQ,qBAAmB,UAC3B,OAAQN,CACV,CACF,KAEA,0BACEC,EACAK,KACA,mCAAgC,EAChC,CACE,OAAQF,EACR,QAASC,CACX,CACF,CACF,CAAC,CAAC,CACN,CAAC,CACH,CAAC,EAYD,MAAMF,CAAmE,CACvE,OACA,YAAYI,EAAyB,CACnC,KAAK,OAASA,CAChB,CACA,SAAgB,CACd,OAAO,IAAI,cAAY,CAAE,IAAK,EAAM,IAAK,EAAM,GAAI,EAAM,GAAI,CAAK,CAAC,EAChE,mBAAmB,KAAK,OAAO,WAAW,EAC1C,qBAAqB,KAAK,OAAO,WAAW,EAC5C,MAAM,CACX,CACA,eAAgB,CACd,SAAO,wBAAqB,CAAE,KAAM,CAAE,QAAS,EAAG,QAAS,SAAU,CAAE,CAAC,CAC1E,CACF",
6
+ "names": ["import_purify_ts", "import_xstate", "import_ApduBuilder", "import_CommandResult", "import_makeInternalApi", "import_testDeviceActionStates", "import_DeviceActionState", "import_UserInteractionRequired", "import_Errors", "import_OpenAppDeviceAction", "import_src", "import_CallTaskInAppDeviceAction", "importOriginal", "original", "setupOpenAppDAMock", "error", "callMyTask", "extractDependenciesMock", "apiSendCommandMock", "commandParams", "mockedCommandResponse", "deviceAction", "internalApi", "TestCommand", "resolve", "reject", "expectedStates", "params"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var t=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var A=(r,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of t(e))!l.call(r,p)&&p!==n&&o(r,p,{get:()=>e[p],enumerable:!(a=s(e,p))||a.enumerable});return r};var d=r=>A(o({},"__esModule",{value:!0}),r);var i={};module.exports=d(i);
2
+ //# sourceMappingURL=CallTaskInAppDeviceActionTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.ts"],
4
+ "sourcesContent": ["import {\n type CommandErrorResult,\n type CommandResult,\n} from \"@api/command/model/CommandResult\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport {\n type OpenAppDAError,\n type OpenAppDAIntermediateValue,\n} from \"@api/device-action/os/OpenAppDeviceAction/types\";\n\nexport type CallTaskInAppDAOutput<TaskResponse> = TaskResponse;\n\nexport type CallTaskInAppDAInput<\n TaskResponse,\n TaskErrorCodes,\n UserInteraction,\n> = {\n readonly task: (\n internalApi: InternalApi,\n ) => Promise<CommandResult<TaskResponse, TaskErrorCodes>>;\n readonly appName: string;\n readonly requiredUserInteraction: UserInteraction;\n readonly compatibleAppNames?: string[];\n};\n\nexport type CallTaskInAppDAError<TaskErrorCodes = void> =\n | OpenAppDAError\n | CommandErrorResult<TaskErrorCodes>[\"error\"];\n\nexport type CallTaskInAppDAIntermediateValue<UserInteraction> =\n | { readonly requiredUserInteraction: UserInteraction }\n | OpenAppDAIntermediateValue;\n\nexport type CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes> = {\n readonly taskResponse: TaskResponse | null;\n readonly error: CallTaskInAppDAError<TaskErrorCodes> | null;\n};\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["CallTaskInAppDeviceActionTypes_exports", "__toCommonJS"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var u=require("rxjs"),v=require("../../../command/model/CommandResult"),y=require("../../../command/utils/GlobalCommandError"),S=require("../../../device/DeviceModel"),i=require("../../../device/DeviceStatus"),a=require("../../../device-action/__test-utils__/makeInternalApi"),d=require("../../../device-action/__test-utils__/testDeviceActionStates"),t=require("../../../device-action/model/DeviceActionState"),c=require("../../../device-action/model/UserInteractionRequired"),D=require("../../../device-action/os/Errors"),o=require("../../../device-session/DeviceSessionState"),p=require("./GetDeviceStatusDeviceAction");describe("GetDeviceStatusDeviceAction",()=>{const k=jest.fn(),l=jest.fn(),h=jest.fn(),f=jest.fn(),O=jest.fn();function A(){return{getAppAndVersion:k,getDeviceSessionState:l,waitForDeviceUnlock:h,setDeviceSessionState:f,isDeviceOnboarded:O}}const{sendCommand:R,getDeviceSessionState:V,getDeviceSessionStateObservable:E}=(0,a.makeDeviceActionInternalApiMock)();beforeEach(()=>{jest.resetAllMocks(),O.mockReturnValue(!0)}),describe("without overriding `extractDependencies`",()=>{it("should run the device action with an unlocked device",r=>{const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});V.mockReturnValue({sessionStateType:o.DeviceSessionStateType.Connected,deviceStatus:i.DeviceStatus.CONNECTED,deviceModelId:S.DeviceModelId.FLEX}),R.mockResolvedValue((0,v.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.DeviceActionStatus.Completed}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)}),it("should run the device action with a locked device",r=>{const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});V.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:S.DeviceModelId.FLEX}),E.mockImplementation(()=>new u.Observable(s=>{const m=(0,u.interval)(50).subscribe({next:C=>{C>2?(s.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:S.DeviceModelId.FLEX}),s.complete()):s.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:S.DeviceModelId.FLEX})}});return()=>{m.unsubscribe()}})),R.mockResolvedValue((0,v.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.DeviceActionStatus.Completed}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)})}),describe("success cases",()=>{it("should return the device status if the device is unlocked",r=>{l.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),k.mockResolvedValue((0,v.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:void 0}});jest.spyOn(e,"extractDependencies").mockReturnValue(A());const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{status:t.DeviceActionStatus.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)}),it("should return the device status if the device is locked and the user unlocks the device",r=>{l.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),k.mockResolvedValue((0,v.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}})),h.mockImplementation(()=>new u.Observable(s=>{const m=(0,u.interval)(50).subscribe({next:C=>{C>2?(s.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),s.complete()):s.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{m.unsubscribe()}}));const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});jest.spyOn(e,"extractDependencies").mockReturnValue(A());const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{status:t.DeviceActionStatus.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)})}),describe("errors cases",()=>{it("should end in an error if the device is not onboarded",r=>{l.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),O.mockReturnValue(!1);const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});jest.spyOn(e,"extractDependencies").mockReturnValue(A());const n=[{error:new D.DeviceNotOnboardedError,status:t.DeviceActionStatus.Error}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)}),it("should end in an error if the device is locked and the user does not unlock",r=>{l.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),E.mockImplementation(()=>new u.Observable(s=>{const m=(0,u.interval)(200).subscribe({next:()=>{s.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:S.DeviceModelId.FLEX})}});return()=>{m.unsubscribe()}}));const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});jest.spyOn(e,"extractDependencies").mockReturnValue(A());const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{error:new D.DeviceLockedError("Device locked."),status:t.DeviceActionStatus.Error}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)}),it("should end in an error if the GetAppAndVersion command fails",r=>{l.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}});const e=new y.GlobalCommandError({...y.GLOBAL_ERRORS[5501],errorCode:"5501"});k.mockResolvedValue((0,v.CommandResultFactory)({error:e})),h.mockImplementation(()=>new u.Observable(m=>{const C=(0,u.interval)(50).subscribe({next:b=>{b>2?(m.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),m.complete()):m.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{C.unsubscribe()}}));const n=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});jest.spyOn(n,"extractDependencies").mockReturnValue(A());const s=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{error:e,status:t.DeviceActionStatus.Error}];(0,d.testDeviceActionStates)(n,s,(0,a.makeDeviceActionInternalApiMock)(),r)}),it("should end in an error if getAppAndVersion actor throws an error",r=>{l.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),k.mockImplementation(()=>{throw new D.UnknownDAError("error")}),h.mockImplementation(()=>new u.Observable(s=>{s.complete()}));const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});jest.spyOn(e,"extractDependencies").mockReturnValue(A());const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{error:new D.UnknownDAError("error"),status:t.DeviceActionStatus.Error}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)})}),it("should emit a stopped state if the action is cancelled",r=>{V.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:S.DeviceModelId.FLEX}),R.mockResolvedValue((0,v.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}}),n=[{status:t.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None}},{status:t.DeviceActionStatus.Stopped}],{cancel:s}=(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r);s()})});
1
+ "use strict";var d=require("rxjs"),S=require("../../../command/model/CommandResult"),y=require("../../../command/utils/GlobalCommandError"),D=require("../../../device/DeviceModel"),i=require("../../../device/DeviceStatus"),u=require("../../../device-action/__test-utils__/makeInternalApi"),p=require("../../../device-action/__test-utils__/testDeviceActionStates"),t=require("../../../device-action/model/DeviceActionState"),a=require("../../../device-action/model/UserInteractionRequired"),A=require("../../../device-action/os/Errors"),s=require("../../../device-session/DeviceSessionState"),l=require("./GetDeviceStatusDeviceAction");describe("GetDeviceStatusDeviceAction",()=>{const C=vi.fn(),v=vi.fn(),O=vi.fn(),f=vi.fn(),R=vi.fn();function k(){return{getAppAndVersion:C,getDeviceSessionState:v,waitForDeviceUnlock:O,setDeviceSessionState:f,isDeviceOnboarded:R}}const{sendCommand:V,getDeviceSessionState:w,getDeviceSessionStateObservable:E}=(0,u.makeDeviceActionInternalApiMock)();beforeEach(()=>{vi.resetAllMocks(),R.mockReturnValue(!0)}),describe("without overriding `extractDependencies`",()=>{it("should run the device action with an unlocked device",()=>new Promise((r,o)=>{const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});w.mockReturnValue({sessionStateType:s.DeviceSessionStateType.Connected,deviceStatus:i.DeviceStatus.CONNECTED,deviceModelId:D.DeviceModelId.NANO_X}),V.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.DeviceActionStatus.Completed}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})})),it("should run the device action with a locked device",()=>new Promise((r,o)=>{const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});w.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:D.DeviceModelId.NANO_X,isSecureConnectionAllowed:!1}),E.mockImplementation(()=>new d.Observable(c=>{const m=(0,d.interval)(50).subscribe({next:h=>{h>2?(c.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:D.DeviceModelId.NANO_X,isSecureConnectionAllowed:!1}),c.complete()):c.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:D.DeviceModelId.NANO_X,isSecureConnectionAllowed:!1})}});return()=>{m.unsubscribe()}})),V.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.DeviceActionStatus.Completed}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})}))}),describe("success cases",()=>{it("should return the device status if the device is unlocked",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),C.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:void 0}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{status:t.DeviceActionStatus.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})})),it("should return the device status if the device is locked and the user unlocks the device",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),C.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}})),O.mockImplementation(()=>new d.Observable(c=>{const m=(0,d.interval)(50).subscribe({next:h=>{h>2?(c.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),c.complete()):c.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{m.unsubscribe()}}));const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{status:t.DeviceActionStatus.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})}))}),describe("errors cases",()=>{it("should end in an error if the device is not onboarded",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),R.mockReturnValue(!1);const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{error:new A.DeviceNotOnboardedError,status:t.DeviceActionStatus.Error}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})})),it("should end in an error if the device is locked and the user does not unlock",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),E.mockImplementation(()=>new d.Observable(c=>{const m=(0,d.interval)(200).subscribe({next:()=>{c.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:D.DeviceModelId.NANO_X,isSecureConnectionAllowed:!1})}});return()=>{m.unsubscribe()}}));const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{error:new A.DeviceLockedError("Device locked."),status:t.DeviceActionStatus.Error}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})})),it("should end in an error if the GetAppAndVersion command fails",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}});const e=new y.GlobalCommandError({...y.GLOBAL_ERRORS[5501],errorCode:"5501"});C.mockResolvedValue((0,S.CommandResultFactory)({error:e})),O.mockImplementation(()=>new d.Observable(m=>{const h=(0,d.interval)(50).subscribe({next:b=>{b>2?(m.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),m.complete()):m.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{h.unsubscribe()}}));const n=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(n,"extractDependencies").mockReturnValue(k());const c=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{error:e,status:t.DeviceActionStatus.Error}];(0,p.testDeviceActionStates)(n,c,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})})),it("should end in an error if getAppAndVersion actor throws an error",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),C.mockImplementation(()=>{throw new A.UnknownDAError("error")}),O.mockImplementation(()=>new d.Observable(c=>{c.complete()}));const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{error:new A.UnknownDAError("error"),status:t.DeviceActionStatus.Error}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})}))}),it("should emit a stopped state if the action is cancelled",()=>new Promise((r,o)=>{w.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:D.DeviceModelId.NANO_X,isSecureConnectionAllowed:!1}),V.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}}),n=[{status:t.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None}},{status:t.DeviceActionStatus.Stopped}],{cancel:c}=(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o});c()}))});
2
2
  //# sourceMappingURL=GetDeviceStatusDeviceAction.test.js.map