@ledgerhq/device-management-kit 0.0.0-signer-eth-20250122093657 → 0.0.0-signer-eth-plugin-fix-20250331141239

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 (777) hide show
  1. package/README.md +45 -33
  2. package/lib/cjs/index.js.map +1 -1
  3. package/lib/cjs/package.json +12 -11
  4. package/lib/cjs/src/api/DeviceManagementKit.js +1 -1
  5. package/lib/cjs/src/api/DeviceManagementKit.js.map +2 -2
  6. package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
  7. package/lib/cjs/src/api/DeviceManagementKit.test.js.map +2 -2
  8. package/lib/cjs/src/api/DeviceManagementKitBuilder.js +1 -1
  9. package/lib/cjs/src/api/DeviceManagementKitBuilder.js.map +2 -2
  10. package/lib/cjs/src/api/DeviceManagementKitBuilder.test.js +1 -1
  11. package/lib/cjs/src/api/DeviceManagementKitBuilder.test.js.map +2 -2
  12. package/lib/cjs/src/api/apdu/utils/ByteArrayParser.test.js +1 -1
  13. package/lib/cjs/src/api/apdu/utils/ByteArrayParser.test.js.map +2 -2
  14. package/lib/cjs/src/api/command/os/GetOsVersionCommand.js +1 -1
  15. package/lib/cjs/src/api/command/os/GetOsVersionCommand.js.map +3 -3
  16. package/lib/cjs/src/api/command/os/LoadCertificateCommand.js +2 -0
  17. package/lib/cjs/src/api/command/os/LoadCertificateCommand.js.map +7 -0
  18. package/lib/cjs/src/api/command/os/LoadCertificateCommand.test.js +2 -0
  19. package/lib/cjs/src/api/command/os/LoadCertificateCommand.test.js.map +7 -0
  20. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.js +2 -0
  21. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.js.map +7 -0
  22. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.test.js +2 -0
  23. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.test.js.map +7 -0
  24. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  25. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  26. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.test.js +1 -1
  27. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.test.js.map +3 -3
  28. package/lib/cjs/src/api/device/SecureElementFlags.js +2 -0
  29. package/lib/cjs/src/api/device/SecureElementFlags.js.map +7 -0
  30. package/lib/cjs/src/api/device-action/DeviceAction.js +1 -1
  31. package/lib/cjs/src/api/device-action/DeviceAction.js.map +1 -1
  32. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  33. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  34. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  35. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  36. package/lib/cjs/src/api/device-action/__test-utils__/testDeviceActionStates.js +1 -1
  37. package/lib/cjs/src/api/device-action/__test-utils__/testDeviceActionStates.js.map +3 -3
  38. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +1 -1
  39. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  40. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +2 -0
  41. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +7 -0
  42. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +2 -0
  43. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +7 -0
  44. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +2 -0
  45. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +7 -0
  46. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  47. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
  48. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +1 -1
  49. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +3 -3
  50. package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js +1 -1
  51. package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js.map +3 -3
  52. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
  53. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +3 -3
  54. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +1 -1
  55. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +3 -3
  56. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  57. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
  58. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  59. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +3 -3
  60. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  61. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +3 -3
  62. package/lib/cjs/src/api/device-session/DeviceSessionState.js +1 -1
  63. package/lib/cjs/src/api/device-session/DeviceSessionState.js.map +1 -1
  64. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.js +2 -0
  65. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.js.map +7 -0
  66. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js +2 -0
  67. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js.map +7 -0
  68. package/lib/cjs/src/api/index.js +1 -1
  69. package/lib/cjs/src/api/index.js.map +3 -3
  70. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.test.js +1 -1
  71. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.test.js.map +2 -2
  72. package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
  73. package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +3 -3
  74. package/lib/cjs/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.js +1 -1
  75. package/lib/cjs/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.js.map +2 -2
  76. package/lib/cjs/src/api/secure-channel/constants.js +2 -0
  77. package/lib/cjs/src/api/secure-channel/constants.js.map +7 -0
  78. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +2 -0
  79. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +7 -0
  80. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js +2 -0
  81. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js.map +7 -0
  82. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js +2 -0
  83. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js.map +7 -0
  84. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +2 -0
  85. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +7 -0
  86. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.js +2 -0
  87. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.js.map +7 -0
  88. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js +2 -0
  89. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js.map +7 -0
  90. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +2 -0
  91. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +7 -0
  92. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js +2 -0
  93. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js.map +7 -0
  94. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js +2 -0
  95. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +7 -0
  96. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +2 -0
  97. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +7 -0
  98. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.js +2 -0
  99. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.js.map +7 -0
  100. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js +2 -0
  101. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js.map +7 -0
  102. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +2 -0
  103. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +7 -0
  104. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +2 -0
  105. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +7 -0
  106. package/lib/cjs/src/api/secure-channel/task/types.js +2 -0
  107. package/lib/cjs/src/api/secure-channel/task/types.js.map +7 -0
  108. package/lib/cjs/src/api/secure-channel/types.js +2 -0
  109. package/lib/cjs/src/api/secure-channel/types.js.map +7 -0
  110. package/lib/cjs/src/api/secure-channel/utils.js +2 -0
  111. package/lib/cjs/src/api/secure-channel/utils.js.map +7 -0
  112. package/lib/cjs/src/api/secure-channel/utils.test.js +2 -0
  113. package/lib/cjs/src/api/secure-channel/utils.test.js.map +7 -0
  114. package/lib/cjs/src/api/transport/model/DeviceConnectionFactory.stub.js +1 -1
  115. package/lib/cjs/src/api/transport/model/DeviceConnectionFactory.stub.js.map +2 -2
  116. package/lib/cjs/src/api/transport/model/DiscoveredDevice.js +1 -1
  117. package/lib/cjs/src/api/transport/model/DiscoveredDevice.js.map +1 -1
  118. package/lib/cjs/src/api/transport/model/Errors.js.map +2 -2
  119. package/lib/cjs/src/api/transport/model/Transport.js.map +1 -1
  120. package/lib/cjs/src/api/transport/model/TransportConnectedDevice.stub.js +1 -1
  121. package/lib/cjs/src/api/transport/model/TransportConnectedDevice.stub.js.map +2 -2
  122. package/lib/cjs/src/api/transport/model/TransportConnectedDevice.test.js +1 -1
  123. package/lib/cjs/src/api/transport/model/TransportConnectedDevice.test.js.map +3 -3
  124. package/lib/cjs/src/api/transport/model/TransportDiscoveredDevice.js +1 -1
  125. package/lib/cjs/src/api/transport/model/TransportDiscoveredDevice.js.map +1 -1
  126. package/lib/cjs/src/api/transport/model/__mocks__/TransportMock.js +1 -1
  127. package/lib/cjs/src/api/transport/model/__mocks__/TransportMock.js.map +2 -2
  128. package/lib/cjs/src/api/types.js +1 -1
  129. package/lib/cjs/src/api/types.js.map +1 -1
  130. package/lib/cjs/src/api/utils/Base64String.test.js +1 -1
  131. package/lib/cjs/src/api/utils/Base64String.test.js.map +2 -2
  132. package/lib/cjs/src/api/utils/HexaString.js +1 -1
  133. package/lib/cjs/src/api/utils/HexaString.js.map +2 -2
  134. package/lib/cjs/src/api/utils/HexaString.test.js +1 -1
  135. package/lib/cjs/src/api/utils/HexaString.test.js.map +2 -2
  136. package/lib/cjs/src/di.js +1 -1
  137. package/lib/cjs/src/di.js.map +3 -3
  138. package/lib/cjs/src/di.stub.js +1 -1
  139. package/lib/cjs/src/di.stub.js.map +2 -2
  140. package/lib/cjs/src/internal/config/data/LocalConfigDataSource.test.js +1 -1
  141. package/lib/cjs/src/internal/config/data/LocalConfigDataSource.test.js.map +3 -3
  142. package/lib/cjs/src/internal/config/data/RemoteConfigDataSource.test.js +1 -1
  143. package/lib/cjs/src/internal/config/data/RemoteConfigDataSource.test.js.map +2 -2
  144. package/lib/cjs/src/internal/config/data/__mocks__/LocalConfigDataSource.js +1 -1
  145. package/lib/cjs/src/internal/config/data/__mocks__/LocalConfigDataSource.js.map +2 -2
  146. package/lib/cjs/src/internal/config/data/__mocks__/RemoteConfigDataSource.js +1 -1
  147. package/lib/cjs/src/internal/config/data/__mocks__/RemoteConfigDataSource.js.map +2 -2
  148. package/lib/cjs/src/internal/config/service/DefaultConfigService.test.js +1 -1
  149. package/lib/cjs/src/internal/config/service/DefaultConfigService.test.js.map +2 -2
  150. package/lib/cjs/src/internal/config/use-case/GetDmkVersionUseCase.test.js +1 -1
  151. package/lib/cjs/src/internal/config/use-case/GetDmkVersionUseCase.test.js.map +2 -2
  152. package/lib/cjs/src/internal/device-session/data/DeviceSessionRefresherConst.js +1 -1
  153. package/lib/cjs/src/internal/device-session/data/DeviceSessionRefresherConst.js.map +3 -3
  154. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +1 -1
  155. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  156. package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js +1 -1
  157. package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js.map +2 -2
  158. package/lib/cjs/src/internal/device-session/model/DevicePinger.js +2 -0
  159. package/lib/cjs/src/internal/device-session/model/DevicePinger.js.map +7 -0
  160. package/lib/cjs/src/internal/device-session/model/DevicePinger.test.js +2 -0
  161. package/lib/cjs/src/internal/device-session/model/DevicePinger.test.js.map +7 -0
  162. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  163. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
  164. package/lib/cjs/src/internal/device-session/model/DeviceSession.stub.js +1 -1
  165. package/lib/cjs/src/internal/device-session/model/DeviceSession.stub.js.map +3 -3
  166. package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.js +2 -0
  167. package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.js.map +7 -0
  168. package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.test.js +2 -0
  169. package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.test.js.map +7 -0
  170. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
  171. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js.map +3 -3
  172. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
  173. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +3 -3
  174. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js +2 -0
  175. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js.map +7 -0
  176. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js +2 -0
  177. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +7 -0
  178. package/lib/cjs/src/internal/device-session/service/DefaultApduReceiverService.test.js +1 -1
  179. package/lib/cjs/src/internal/device-session/service/DefaultApduReceiverService.test.js.map +2 -2
  180. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
  181. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
  182. package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
  183. package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +3 -3
  184. package/lib/cjs/src/internal/device-session/service/MutexService.js +2 -0
  185. package/lib/cjs/src/internal/device-session/service/MutexService.js.map +7 -0
  186. package/lib/cjs/src/internal/device-session/service/MutexService.test.js +2 -0
  187. package/lib/cjs/src/internal/device-session/service/MutexService.test.js.map +7 -0
  188. package/lib/cjs/src/internal/device-session/service/RefresherService.js +2 -0
  189. package/lib/cjs/src/internal/device-session/service/RefresherService.js.map +7 -0
  190. package/lib/cjs/src/internal/device-session/service/RefresherService.test.js +2 -0
  191. package/lib/cjs/src/internal/device-session/service/RefresherService.test.js.map +7 -0
  192. package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.test.js +1 -1
  193. package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.test.js.map +3 -3
  194. package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js +1 -1
  195. package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js.map +3 -3
  196. package/lib/cjs/src/internal/device-session/utils/deviceSessionUtils.js +2 -0
  197. package/lib/cjs/src/internal/device-session/utils/deviceSessionUtils.js.map +7 -0
  198. package/lib/cjs/src/internal/discovery/di/discoveryModule.js +1 -1
  199. package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +3 -3
  200. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
  201. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +3 -3
  202. package/lib/cjs/src/internal/discovery/di/discoveryTypes.js +1 -1
  203. package/lib/cjs/src/internal/discovery/di/discoveryTypes.js.map +2 -2
  204. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
  205. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
  206. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  207. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
  208. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
  209. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +3 -3
  210. package/lib/cjs/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js +1 -1
  211. package/lib/cjs/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js.map +3 -3
  212. package/lib/cjs/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js +1 -1
  213. package/lib/cjs/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js.map +3 -3
  214. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js +2 -0
  215. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js.map +7 -0
  216. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js +2 -0
  217. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js.map +7 -0
  218. package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js +1 -1
  219. package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js.map +3 -3
  220. package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js +1 -1
  221. package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js.map +3 -3
  222. package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js +1 -1
  223. package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js.map +3 -3
  224. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  225. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +2 -2
  226. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.js +1 -1
  227. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.js.map +2 -2
  228. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js +1 -1
  229. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js.map +2 -2
  230. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  231. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  232. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  233. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  234. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js +1 -1
  235. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js.map +1 -1
  236. package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js +1 -1
  237. package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
  238. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  239. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  240. package/lib/cjs/src/internal/manager-api/model/Application.js +1 -1
  241. package/lib/cjs/src/internal/manager-api/model/Application.js.map +1 -1
  242. package/lib/cjs/src/internal/manager-api/model/Const.js +1 -1
  243. package/lib/cjs/src/internal/manager-api/model/Const.js.map +3 -3
  244. package/lib/cjs/src/internal/manager-api/model/Errors.js +1 -1
  245. package/lib/cjs/src/internal/manager-api/model/Errors.js.map +3 -3
  246. package/lib/cjs/src/internal/manager-api/model/Firmware.js +1 -1
  247. package/lib/cjs/src/internal/manager-api/model/Firmware.js.map +1 -1
  248. package/lib/cjs/src/internal/manager-api/model/Params.js +1 -1
  249. package/lib/cjs/src/internal/manager-api/model/Params.js.map +1 -1
  250. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  251. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  252. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  253. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  254. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js +1 -1
  255. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js.map +1 -1
  256. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js +2 -0
  257. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js.map +7 -0
  258. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js +2 -0
  259. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js.map +7 -0
  260. package/lib/cjs/src/internal/secure-channel/data/SecureChannelDataSource.js +2 -0
  261. package/lib/cjs/src/internal/secure-channel/data/SecureChannelDataSource.js.map +7 -0
  262. package/lib/cjs/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js +2 -0
  263. package/lib/cjs/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js.map +7 -0
  264. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js +2 -0
  265. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js.map +7 -0
  266. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js +2 -0
  267. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js.map +7 -0
  268. package/lib/cjs/src/internal/secure-channel/di/secureChannelTypes.js +2 -0
  269. package/lib/cjs/src/internal/secure-channel/di/secureChannelTypes.js.map +7 -0
  270. package/lib/cjs/src/internal/secure-channel/model/Const.js +2 -0
  271. package/lib/cjs/src/internal/secure-channel/model/Const.js.map +7 -0
  272. package/lib/cjs/src/internal/secure-channel/model/Errors.js +2 -0
  273. package/lib/cjs/src/internal/secure-channel/model/Errors.js.map +7 -0
  274. package/lib/cjs/src/internal/secure-channel/model/Params.js +2 -0
  275. package/lib/cjs/src/internal/secure-channel/model/Params.js.map +7 -0
  276. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js +2 -0
  277. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +7 -0
  278. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +2 -0
  279. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +7 -0
  280. package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js +2 -0
  281. package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js.map +7 -0
  282. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
  283. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js.map +3 -3
  284. package/lib/cjs/src/internal/transport/di/transportModule.test.js +1 -1
  285. package/lib/cjs/src/internal/transport/di/transportModule.test.js.map +2 -2
  286. package/lib/cjs/src/internal/transport/service/DefaultTransportService.test.js +1 -1
  287. package/lib/cjs/src/internal/transport/service/DefaultTransportService.test.js.map +2 -2
  288. package/lib/cjs/src/internal/transport/service/__mocks__/DefaultTransportService.js +1 -1
  289. package/lib/cjs/src/internal/transport/service/__mocks__/DefaultTransportService.js.map +2 -2
  290. package/lib/esm/package.json +12 -11
  291. package/lib/esm/src/api/DeviceManagementKit.js +1 -1
  292. package/lib/esm/src/api/DeviceManagementKit.js.map +2 -2
  293. package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
  294. package/lib/esm/src/api/DeviceManagementKit.test.js.map +2 -2
  295. package/lib/esm/src/api/DeviceManagementKitBuilder.js +1 -1
  296. package/lib/esm/src/api/DeviceManagementKitBuilder.js.map +2 -2
  297. package/lib/esm/src/api/DeviceManagementKitBuilder.test.js +1 -1
  298. package/lib/esm/src/api/DeviceManagementKitBuilder.test.js.map +2 -2
  299. package/lib/esm/src/api/apdu/utils/ByteArrayParser.test.js +1 -1
  300. package/lib/esm/src/api/apdu/utils/ByteArrayParser.test.js.map +2 -2
  301. package/lib/esm/src/api/command/os/GetOsVersionCommand.js +1 -1
  302. package/lib/esm/src/api/command/os/GetOsVersionCommand.js.map +3 -3
  303. package/lib/esm/src/api/command/os/LoadCertificateCommand.js +2 -0
  304. package/lib/esm/src/api/command/os/LoadCertificateCommand.js.map +7 -0
  305. package/lib/esm/src/api/command/os/LoadCertificateCommand.test.js +2 -0
  306. package/lib/esm/src/api/command/os/LoadCertificateCommand.test.js.map +7 -0
  307. package/lib/esm/src/api/command/os/SecureElementFlagsParser.js +2 -0
  308. package/lib/esm/src/api/command/os/SecureElementFlagsParser.js.map +7 -0
  309. package/lib/esm/src/api/command/os/SecureElementFlagsParser.test.js +2 -0
  310. package/lib/esm/src/api/command/os/SecureElementFlagsParser.test.js.map +7 -0
  311. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  312. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  313. package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js +1 -1
  314. package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js.map +3 -3
  315. package/lib/esm/src/api/device/SecureElementFlags.js +1 -0
  316. package/lib/esm/src/api/device/SecureElementFlags.js.map +7 -0
  317. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  318. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  319. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  320. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  321. package/lib/esm/src/api/device-action/__test-utils__/testDeviceActionStates.js +1 -1
  322. package/lib/esm/src/api/device-action/__test-utils__/testDeviceActionStates.js.map +3 -3
  323. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
  324. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  325. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +2 -0
  326. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +7 -0
  327. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +2 -0
  328. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +7 -0
  329. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +1 -0
  330. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +7 -0
  331. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  332. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
  333. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +1 -1
  334. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +3 -3
  335. package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js +1 -1
  336. package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js.map +3 -3
  337. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
  338. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +3 -3
  339. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +1 -1
  340. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +3 -3
  341. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  342. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
  343. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  344. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +3 -3
  345. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  346. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +3 -3
  347. package/lib/esm/src/api/device-session/DeviceSessionState.js.map +1 -1
  348. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.js +2 -0
  349. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.js.map +7 -0
  350. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js +2 -0
  351. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js.map +7 -0
  352. package/lib/esm/src/api/index.js +1 -1
  353. package/lib/esm/src/api/index.js.map +3 -3
  354. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.test.js +1 -1
  355. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.test.js.map +2 -2
  356. package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
  357. package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +3 -3
  358. package/lib/esm/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.js +1 -1
  359. package/lib/esm/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.js.map +2 -2
  360. package/lib/esm/src/api/secure-channel/constants.js +2 -0
  361. package/lib/esm/src/api/secure-channel/constants.js.map +7 -0
  362. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +2 -0
  363. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +7 -0
  364. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js +2 -0
  365. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js.map +7 -0
  366. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/types.js +1 -0
  367. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/types.js.map +7 -0
  368. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +2 -0
  369. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +7 -0
  370. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.js +2 -0
  371. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.js.map +7 -0
  372. package/lib/esm/src/api/secure-channel/device-action/InstallApp/types.js +1 -0
  373. package/lib/esm/src/api/secure-channel/device-action/InstallApp/types.js.map +7 -0
  374. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +2 -0
  375. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +7 -0
  376. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js +2 -0
  377. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js.map +7 -0
  378. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js +2 -0
  379. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +7 -0
  380. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +2 -0
  381. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +7 -0
  382. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.js +2 -0
  383. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.js.map +7 -0
  384. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/types.js +1 -0
  385. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/types.js.map +7 -0
  386. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +2 -0
  387. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +7 -0
  388. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +2 -0
  389. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +7 -0
  390. package/lib/esm/src/api/secure-channel/task/types.js +2 -0
  391. package/lib/esm/src/api/secure-channel/task/types.js.map +7 -0
  392. package/lib/esm/src/api/secure-channel/types.js +1 -0
  393. package/lib/esm/src/api/secure-channel/types.js.map +7 -0
  394. package/lib/esm/src/api/secure-channel/utils.js +2 -0
  395. package/lib/esm/src/api/secure-channel/utils.js.map +7 -0
  396. package/lib/esm/src/api/secure-channel/utils.test.js +2 -0
  397. package/lib/esm/src/api/secure-channel/utils.test.js.map +7 -0
  398. package/lib/esm/src/api/transport/model/DeviceConnectionFactory.stub.js +1 -1
  399. package/lib/esm/src/api/transport/model/DeviceConnectionFactory.stub.js.map +2 -2
  400. package/lib/esm/src/api/transport/model/Errors.js.map +2 -2
  401. package/lib/esm/src/api/transport/model/TransportConnectedDevice.stub.js +1 -1
  402. package/lib/esm/src/api/transport/model/TransportConnectedDevice.stub.js.map +2 -2
  403. package/lib/esm/src/api/transport/model/TransportConnectedDevice.test.js +1 -1
  404. package/lib/esm/src/api/transport/model/TransportConnectedDevice.test.js.map +3 -3
  405. package/lib/esm/src/api/transport/model/__mocks__/TransportMock.js +1 -1
  406. package/lib/esm/src/api/transport/model/__mocks__/TransportMock.js.map +2 -2
  407. package/lib/esm/src/api/utils/Base64String.test.js +1 -1
  408. package/lib/esm/src/api/utils/Base64String.test.js.map +2 -2
  409. package/lib/esm/src/api/utils/HexaString.js +1 -1
  410. package/lib/esm/src/api/utils/HexaString.js.map +2 -2
  411. package/lib/esm/src/api/utils/HexaString.test.js +1 -1
  412. package/lib/esm/src/api/utils/HexaString.test.js.map +2 -2
  413. package/lib/esm/src/di.js +1 -1
  414. package/lib/esm/src/di.js.map +3 -3
  415. package/lib/esm/src/di.stub.js +1 -1
  416. package/lib/esm/src/di.stub.js.map +2 -2
  417. package/lib/esm/src/internal/config/data/LocalConfigDataSource.test.js +1 -1
  418. package/lib/esm/src/internal/config/data/LocalConfigDataSource.test.js.map +3 -3
  419. package/lib/esm/src/internal/config/data/RemoteConfigDataSource.test.js +1 -1
  420. package/lib/esm/src/internal/config/data/RemoteConfigDataSource.test.js.map +2 -2
  421. package/lib/esm/src/internal/config/data/__mocks__/LocalConfigDataSource.js +1 -1
  422. package/lib/esm/src/internal/config/data/__mocks__/LocalConfigDataSource.js.map +2 -2
  423. package/lib/esm/src/internal/config/data/__mocks__/RemoteConfigDataSource.js +1 -1
  424. package/lib/esm/src/internal/config/data/__mocks__/RemoteConfigDataSource.js.map +2 -2
  425. package/lib/esm/src/internal/config/service/DefaultConfigService.test.js +1 -1
  426. package/lib/esm/src/internal/config/service/DefaultConfigService.test.js.map +2 -2
  427. package/lib/esm/src/internal/config/use-case/GetDmkVersionUseCase.test.js +1 -1
  428. package/lib/esm/src/internal/config/use-case/GetDmkVersionUseCase.test.js.map +2 -2
  429. package/lib/esm/src/internal/device-session/data/DeviceSessionRefresherConst.js +1 -1
  430. package/lib/esm/src/internal/device-session/data/DeviceSessionRefresherConst.js.map +3 -3
  431. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +1 -1
  432. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  433. package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js +1 -1
  434. package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js.map +2 -2
  435. package/lib/esm/src/internal/device-session/model/DevicePinger.js +2 -0
  436. package/lib/esm/src/internal/device-session/model/DevicePinger.js.map +7 -0
  437. package/lib/esm/src/internal/device-session/model/DevicePinger.test.js +2 -0
  438. package/lib/esm/src/internal/device-session/model/DevicePinger.test.js.map +7 -0
  439. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  440. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
  441. package/lib/esm/src/internal/device-session/model/DeviceSession.stub.js +1 -1
  442. package/lib/esm/src/internal/device-session/model/DeviceSession.stub.js.map +3 -3
  443. package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.js +2 -0
  444. package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.js.map +7 -0
  445. package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.test.js +2 -0
  446. package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.test.js.map +7 -0
  447. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
  448. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js.map +3 -3
  449. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
  450. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +3 -3
  451. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js +2 -0
  452. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js.map +7 -0
  453. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js +2 -0
  454. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +7 -0
  455. package/lib/esm/src/internal/device-session/service/DefaultApduReceiverService.test.js +1 -1
  456. package/lib/esm/src/internal/device-session/service/DefaultApduReceiverService.test.js.map +2 -2
  457. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
  458. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
  459. package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
  460. package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +3 -3
  461. package/lib/esm/src/internal/device-session/service/MutexService.js +2 -0
  462. package/lib/esm/src/internal/device-session/service/MutexService.js.map +7 -0
  463. package/lib/esm/src/internal/device-session/service/MutexService.test.js +2 -0
  464. package/lib/esm/src/internal/device-session/service/MutexService.test.js.map +7 -0
  465. package/lib/esm/src/internal/device-session/service/RefresherService.js +2 -0
  466. package/lib/esm/src/internal/device-session/service/RefresherService.js.map +7 -0
  467. package/lib/esm/src/internal/device-session/service/RefresherService.test.js +2 -0
  468. package/lib/esm/src/internal/device-session/service/RefresherService.test.js.map +7 -0
  469. package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.test.js +1 -1
  470. package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.test.js.map +3 -3
  471. package/lib/esm/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js +1 -1
  472. package/lib/esm/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js.map +3 -3
  473. package/lib/esm/src/internal/device-session/utils/deviceSessionUtils.js +2 -0
  474. package/lib/esm/src/internal/device-session/utils/deviceSessionUtils.js.map +7 -0
  475. package/lib/esm/src/internal/discovery/di/discoveryModule.js +1 -1
  476. package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +3 -3
  477. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
  478. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +3 -3
  479. package/lib/esm/src/internal/discovery/di/discoveryTypes.js +1 -1
  480. package/lib/esm/src/internal/discovery/di/discoveryTypes.js.map +2 -2
  481. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
  482. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
  483. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  484. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
  485. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
  486. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +3 -3
  487. package/lib/esm/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js +1 -1
  488. package/lib/esm/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js.map +3 -3
  489. package/lib/esm/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js +1 -1
  490. package/lib/esm/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js.map +3 -3
  491. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js +2 -0
  492. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js.map +7 -0
  493. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js +2 -0
  494. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js.map +7 -0
  495. package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js +1 -1
  496. package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js.map +3 -3
  497. package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js +1 -1
  498. package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js.map +3 -3
  499. package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js +1 -1
  500. package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js.map +3 -3
  501. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  502. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +2 -2
  503. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.js +1 -1
  504. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.js.map +2 -2
  505. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js +1 -1
  506. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js.map +2 -2
  507. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  508. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  509. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  510. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  511. package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
  512. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  513. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  514. package/lib/esm/src/internal/manager-api/model/Application.js.map +1 -1
  515. package/lib/esm/src/internal/manager-api/model/Const.js +1 -1
  516. package/lib/esm/src/internal/manager-api/model/Const.js.map +3 -3
  517. package/lib/esm/src/internal/manager-api/model/Errors.js +1 -1
  518. package/lib/esm/src/internal/manager-api/model/Errors.js.map +3 -3
  519. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  520. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  521. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  522. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  523. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js +2 -0
  524. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js.map +7 -0
  525. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js +2 -0
  526. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js.map +7 -0
  527. package/lib/esm/src/internal/secure-channel/data/SecureChannelDataSource.js +1 -0
  528. package/lib/esm/src/internal/secure-channel/data/SecureChannelDataSource.js.map +7 -0
  529. package/lib/esm/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js +2 -0
  530. package/lib/esm/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js.map +7 -0
  531. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js +2 -0
  532. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js.map +7 -0
  533. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js +2 -0
  534. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js.map +7 -0
  535. package/lib/esm/src/internal/secure-channel/di/secureChannelTypes.js +2 -0
  536. package/lib/esm/src/internal/secure-channel/di/secureChannelTypes.js.map +7 -0
  537. package/lib/esm/src/internal/secure-channel/model/Const.js +2 -0
  538. package/lib/esm/src/internal/secure-channel/model/Const.js.map +7 -0
  539. package/lib/esm/src/internal/secure-channel/model/Errors.js +2 -0
  540. package/lib/esm/src/internal/secure-channel/model/Errors.js.map +7 -0
  541. package/lib/esm/src/internal/secure-channel/model/Params.js +1 -0
  542. package/lib/esm/src/internal/secure-channel/model/Params.js.map +7 -0
  543. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js +2 -0
  544. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +7 -0
  545. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +2 -0
  546. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +7 -0
  547. package/lib/esm/src/internal/secure-channel/service/SecureChannelService.js +1 -0
  548. package/lib/esm/src/internal/secure-channel/service/SecureChannelService.js.map +7 -0
  549. package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
  550. package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js.map +3 -3
  551. package/lib/esm/src/internal/transport/di/transportModule.test.js +1 -1
  552. package/lib/esm/src/internal/transport/di/transportModule.test.js.map +2 -2
  553. package/lib/esm/src/internal/transport/service/DefaultTransportService.test.js +1 -1
  554. package/lib/esm/src/internal/transport/service/DefaultTransportService.test.js.map +2 -2
  555. package/lib/esm/src/internal/transport/service/__mocks__/DefaultTransportService.js +1 -1
  556. package/lib/esm/src/internal/transport/service/__mocks__/DefaultTransportService.js.map +2 -2
  557. package/lib/types/src/api/DeviceManagementKit.d.ts +15 -9
  558. package/lib/types/src/api/DeviceManagementKit.d.ts.map +1 -1
  559. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts +8 -2
  560. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts.map +1 -1
  561. package/lib/types/src/api/command/os/LoadCertificateCommand.d.ts +25 -0
  562. package/lib/types/src/api/command/os/LoadCertificateCommand.d.ts.map +1 -0
  563. package/lib/types/src/api/command/os/LoadCertificateCommand.test.d.ts +2 -0
  564. package/lib/types/src/api/command/os/LoadCertificateCommand.test.d.ts.map +1 -0
  565. package/lib/types/src/api/command/os/SecureElementFlagsParser.d.ts +43 -0
  566. package/lib/types/src/api/command/os/SecureElementFlagsParser.d.ts.map +1 -0
  567. package/lib/types/src/api/command/os/SecureElementFlagsParser.test.d.ts +2 -0
  568. package/lib/types/src/api/command/os/SecureElementFlagsParser.test.d.ts.map +1 -0
  569. package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
  570. package/lib/types/src/api/device/SecureElementFlags.d.ts +41 -0
  571. package/lib/types/src/api/device/SecureElementFlags.d.ts.map +1 -0
  572. package/lib/types/src/api/device-action/DeviceAction.d.ts +6 -0
  573. package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
  574. package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts +2 -1
  575. package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
  576. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts +4 -0
  577. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
  578. package/lib/types/src/api/device-action/__test-utils__/testDeviceActionStates.d.ts +5 -2
  579. package/lib/types/src/api/device-action/__test-utils__/testDeviceActionStates.d.ts.map +1 -1
  580. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +3 -2
  581. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts.map +1 -1
  582. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts +40 -0
  583. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts.map +1 -0
  584. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.d.ts +2 -0
  585. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.d.ts.map +1 -0
  586. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts +19 -0
  587. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts.map +1 -0
  588. package/lib/types/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.d.ts +1 -1
  589. package/lib/types/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.d.ts.map +1 -1
  590. package/lib/types/src/api/device-session/DeviceSessionState.d.ts +4 -0
  591. package/lib/types/src/api/device-session/DeviceSessionState.d.ts.map +1 -1
  592. package/lib/types/src/api/device-session/use-case/{ToggleDeviceSessionRefresher.d.ts → DisableDeviceSessionRefresher.d.ts} +6 -6
  593. package/lib/types/src/api/device-session/use-case/DisableDeviceSessionRefresher.d.ts.map +1 -0
  594. package/lib/types/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.d.ts +2 -0
  595. package/lib/types/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.d.ts.map +1 -0
  596. package/lib/types/src/api/index.d.ts +6 -0
  597. package/lib/types/src/api/index.d.ts.map +1 -1
  598. package/lib/types/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.d.ts +1 -1
  599. package/lib/types/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.d.ts.map +1 -1
  600. package/lib/types/src/api/secure-channel/constants.d.ts +2 -0
  601. package/lib/types/src/api/secure-channel/constants.d.ts.map +1 -0
  602. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts +8 -0
  603. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts.map +1 -0
  604. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.d.ts +2 -0
  605. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.d.ts.map +1 -0
  606. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts +48 -0
  607. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts.map +1 -0
  608. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts +8 -0
  609. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts.map +1 -0
  610. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.d.ts +2 -0
  611. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.d.ts.map +1 -0
  612. package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts +44 -0
  613. package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts.map +1 -0
  614. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts +8 -0
  615. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts.map +1 -0
  616. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.d.ts +2 -0
  617. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.d.ts.map +1 -0
  618. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts +57 -0
  619. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts.map +1 -0
  620. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.d.ts +8 -0
  621. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.d.ts.map +1 -0
  622. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.d.ts +2 -0
  623. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.d.ts.map +1 -0
  624. package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts +41 -0
  625. package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts.map +1 -0
  626. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts +23 -0
  627. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -0
  628. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.test.d.ts +2 -0
  629. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.test.d.ts.map +1 -0
  630. package/lib/types/src/api/secure-channel/task/types.d.ts +105 -0
  631. package/lib/types/src/api/secure-channel/task/types.d.ts.map +1 -0
  632. package/lib/types/src/api/secure-channel/types.d.ts +4 -0
  633. package/lib/types/src/api/secure-channel/types.d.ts.map +1 -0
  634. package/lib/types/src/api/secure-channel/utils.d.ts +30 -0
  635. package/lib/types/src/api/secure-channel/utils.d.ts.map +1 -0
  636. package/lib/types/src/api/secure-channel/utils.test.d.ts +2 -0
  637. package/lib/types/src/api/secure-channel/utils.test.d.ts.map +1 -0
  638. package/lib/types/src/api/transport/model/DeviceConnectionFactory.stub.d.ts +1 -1
  639. package/lib/types/src/api/transport/model/DeviceConnectionFactory.stub.d.ts.map +1 -1
  640. package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts +2 -0
  641. package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts.map +1 -1
  642. package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
  643. package/lib/types/src/api/transport/model/Transport.d.ts +1 -1
  644. package/lib/types/src/api/transport/model/Transport.d.ts.map +1 -1
  645. package/lib/types/src/api/transport/model/TransportDiscoveredDevice.d.ts +2 -0
  646. package/lib/types/src/api/transport/model/TransportDiscoveredDevice.d.ts.map +1 -1
  647. package/lib/types/src/api/transport/model/__mocks__/TransportMock.d.ts +7 -7
  648. package/lib/types/src/api/transport/model/__mocks__/TransportMock.d.ts.map +1 -1
  649. package/lib/types/src/api/types.d.ts +4 -0
  650. package/lib/types/src/api/types.d.ts.map +1 -1
  651. package/lib/types/src/api/utils/HexaString.d.ts +1 -1
  652. package/lib/types/src/api/utils/HexaString.d.ts.map +1 -1
  653. package/lib/types/src/di.d.ts.map +1 -1
  654. package/lib/types/src/di.stub.d.ts +1 -1
  655. package/lib/types/src/di.stub.d.ts.map +1 -1
  656. package/lib/types/src/internal/config/data/__mocks__/LocalConfigDataSource.d.ts +1 -1
  657. package/lib/types/src/internal/config/data/__mocks__/LocalConfigDataSource.d.ts.map +1 -1
  658. package/lib/types/src/internal/config/data/__mocks__/RemoteConfigDataSource.d.ts +3 -3
  659. package/lib/types/src/internal/config/data/__mocks__/RemoteConfigDataSource.d.ts.map +1 -1
  660. package/lib/types/src/internal/device-session/data/DeviceSessionRefresherConst.d.ts +6 -1
  661. package/lib/types/src/internal/device-session/data/DeviceSessionRefresherConst.d.ts.map +1 -1
  662. package/lib/types/src/internal/device-session/di/deviceSessionTypes.d.ts +1 -1
  663. package/lib/types/src/internal/device-session/model/DevicePinger.d.ts +18 -0
  664. package/lib/types/src/internal/device-session/model/DevicePinger.d.ts.map +1 -0
  665. package/lib/types/src/internal/device-session/model/DevicePinger.test.d.ts +2 -0
  666. package/lib/types/src/internal/device-session/model/DevicePinger.test.d.ts.map +1 -0
  667. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts +27 -11
  668. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  669. package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts +3 -2
  670. package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts.map +1 -1
  671. package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.d.ts +35 -0
  672. package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.d.ts.map +1 -0
  673. package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.test.d.ts +2 -0
  674. package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.test.d.ts.map +1 -0
  675. package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts +17 -79
  676. package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts.map +1 -1
  677. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts +20 -0
  678. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts.map +1 -0
  679. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.test.d.ts +2 -0
  680. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.test.d.ts.map +1 -0
  681. package/lib/types/src/internal/device-session/service/MutexService.d.ts +6 -0
  682. package/lib/types/src/internal/device-session/service/MutexService.d.ts.map +1 -0
  683. package/lib/types/src/internal/device-session/service/MutexService.test.d.ts +2 -0
  684. package/lib/types/src/internal/device-session/service/MutexService.test.d.ts.map +1 -0
  685. package/lib/types/src/internal/device-session/service/RefresherService.d.ts +15 -0
  686. package/lib/types/src/internal/device-session/service/RefresherService.d.ts.map +1 -0
  687. package/lib/types/src/internal/device-session/service/RefresherService.test.d.ts +2 -0
  688. package/lib/types/src/internal/device-session/service/RefresherService.test.d.ts.map +1 -0
  689. package/lib/types/src/internal/device-session/utils/deviceSessionUtils.d.ts +3 -0
  690. package/lib/types/src/internal/device-session/utils/deviceSessionUtils.d.ts.map +1 -0
  691. package/lib/types/src/internal/discovery/di/discoveryTypes.d.ts +1 -1
  692. package/lib/types/src/internal/discovery/di/discoveryTypes.d.ts.map +1 -1
  693. package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts +11 -2
  694. package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts.map +1 -1
  695. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.d.ts +24 -0
  696. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.d.ts.map +1 -0
  697. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.d.ts +2 -0
  698. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.d.ts.map +1 -0
  699. package/lib/types/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.d.ts +1 -1
  700. package/lib/types/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.d.ts.map +1 -1
  701. package/lib/types/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.d.ts +5 -5
  702. package/lib/types/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.d.ts.map +1 -1
  703. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts +8 -16
  704. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts.map +1 -1
  705. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts +16 -55
  706. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts.map +1 -1
  707. package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts +4 -1
  708. package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts.map +1 -1
  709. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts +4 -9
  710. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts.map +1 -1
  711. package/lib/types/src/internal/manager-api/model/Application.d.ts +4 -1
  712. package/lib/types/src/internal/manager-api/model/Application.d.ts.map +1 -1
  713. package/lib/types/src/internal/manager-api/model/Const.d.ts +0 -1
  714. package/lib/types/src/internal/manager-api/model/Const.d.ts.map +1 -1
  715. package/lib/types/src/internal/manager-api/model/Errors.d.ts +0 -6
  716. package/lib/types/src/internal/manager-api/model/Errors.d.ts.map +1 -1
  717. package/lib/types/src/internal/manager-api/model/Firmware.d.ts +4 -0
  718. package/lib/types/src/internal/manager-api/model/Firmware.d.ts.map +1 -1
  719. package/lib/types/src/internal/manager-api/model/Params.d.ts +25 -68
  720. package/lib/types/src/internal/manager-api/model/Params.d.ts.map +1 -1
  721. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts +5 -5
  722. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts.map +1 -1
  723. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts +33 -2
  724. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts.map +1 -1
  725. package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.d.ts +18 -0
  726. package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.d.ts.map +1 -0
  727. package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.d.ts +2 -0
  728. package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.d.ts.map +1 -0
  729. package/lib/types/src/internal/secure-channel/data/SecureChannelDataSource.d.ts +52 -0
  730. package/lib/types/src/internal/secure-channel/data/SecureChannelDataSource.d.ts.map +1 -0
  731. package/lib/types/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.d.ts +10 -0
  732. package/lib/types/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.d.ts.map +1 -0
  733. package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts +9 -0
  734. package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts.map +1 -0
  735. package/lib/types/src/internal/secure-channel/di/secureChannelModule.test.d.ts +2 -0
  736. package/lib/types/src/internal/secure-channel/di/secureChannelModule.test.d.ts.map +1 -0
  737. package/lib/types/src/internal/secure-channel/di/secureChannelTypes.d.ts +6 -0
  738. package/lib/types/src/internal/secure-channel/di/secureChannelTypes.d.ts.map +1 -0
  739. package/lib/types/src/internal/secure-channel/model/Const.d.ts +2 -0
  740. package/lib/types/src/internal/secure-channel/model/Const.d.ts.map +1 -0
  741. package/lib/types/src/internal/secure-channel/model/Errors.d.ts +14 -0
  742. package/lib/types/src/internal/secure-channel/model/Errors.d.ts.map +1 -0
  743. package/lib/types/src/internal/secure-channel/model/Params.d.ts +84 -0
  744. package/lib/types/src/internal/secure-channel/model/Params.d.ts.map +1 -0
  745. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts +21 -0
  746. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts.map +1 -0
  747. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.test.d.ts +2 -0
  748. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.test.d.ts.map +1 -0
  749. package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts +56 -0
  750. package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts.map +1 -0
  751. package/lib/types/src/internal/transport/service/__mocks__/DefaultTransportService.d.ts +6 -6
  752. package/lib/types/src/internal/transport/service/__mocks__/DefaultTransportService.d.ts.map +1 -1
  753. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  754. package/package.json +13 -12
  755. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js +0 -2
  756. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js.map +0 -7
  757. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js +0 -2
  758. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js.map +0 -7
  759. package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js +0 -2
  760. package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js.map +0 -7
  761. package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js +0 -2
  762. package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js.map +0 -7
  763. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js +0 -2
  764. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js.map +0 -7
  765. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js +0 -2
  766. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js.map +0 -7
  767. package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js +0 -2
  768. package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js.map +0 -7
  769. package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js +0 -2
  770. package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js.map +0 -7
  771. package/lib/types/src/api/device-session/use-case/ToggleDeviceSessionRefresher.d.ts.map +0 -1
  772. package/lib/types/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.d.ts +0 -2
  773. package/lib/types/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.d.ts.map +0 -1
  774. package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.d.ts +0 -13
  775. package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.d.ts.map +0 -1
  776. package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.d.ts +0 -2
  777. package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.d.ts.map +0 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/model/DeviceSessionRefresher.ts"],
4
- "sourcesContent": ["import { injectable } from \"inversify\";\nimport { Either } from \"purify-ts\";\nimport {\n delay,\n filter,\n from,\n interval,\n map,\n Observable,\n of,\n race,\n Subscription,\n switchMap,\n} from \"rxjs\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n GetAppAndVersionCommand,\n GetAppAndVersionCommandResult,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nimport { GetOsVersionCommand } from \"@api/command/os/GetOsVersionCommand\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { ApduResponse } from \"@api/device-session/ApduResponse\";\nimport {\n DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nimport { DmkError } from \"@api/Error\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { SendApduFnType } from \"@api/transport/model/DeviceConnection\";\n\ntype UpdateStateFnType = (\n callback: (state: DeviceSessionState) => DeviceSessionState,\n) => void;\n\n/**\n * The arguments for the DeviceSessionRefresher.\n */\nexport type DeviceSessionRefresherArgs = {\n /**\n * The refresh interval in milliseconds.\n */\n refreshInterval: number;\n\n /**\n * The current device status when the refresher is created.\n */\n deviceStatus: Exclude<DeviceStatus, DeviceStatus.NOT_CONNECTED>;\n\n /**\n * The function used to send APDU commands to the device.\n */\n sendApduFn: (rawApdu: Uint8Array) => Promise<Either<DmkError, ApduResponse>>;\n\n /**\n * Callback that updates the state of the device session with\n * polling response.\n * @param callback - A function that will take the previous state and return the new state.\n * @returns void\n */\n updateStateFn: UpdateStateFnType;\n\n /**\n * Device model to handle NanoS specific refresher\n */\n deviceModelId: DeviceModelId;\n};\n\n/**\n * The session refresher that periodically sends a command to refresh the session.\n */\n@injectable()\nexport class DeviceSessionRefresher {\n private readonly _logger: LoggerPublisherService;\n private readonly _getAppAndVersionCommand = new GetAppAndVersionCommand();\n private readonly _getOsVersionCommand = new GetOsVersionCommand();\n private _deviceStatus: DeviceStatus;\n private _subscription?: Subscription;\n private readonly _refreshInterval: number;\n private readonly _deviceModelId: DeviceModelId;\n private readonly _sendApduFn: SendApduFnType;\n private readonly _updateStateFn: UpdateStateFnType;\n\n constructor(\n {\n refreshInterval,\n deviceStatus,\n sendApduFn,\n updateStateFn,\n deviceModelId,\n }: DeviceSessionRefresherArgs,\n logger: LoggerPublisherService,\n ) {\n this._deviceStatus = deviceStatus;\n this._logger = logger;\n this._sendApduFn = sendApduFn;\n this._updateStateFn = updateStateFn;\n this._refreshInterval = refreshInterval;\n this._deviceModelId = deviceModelId;\n\n this.start();\n }\n\n /**\n * Start the session refresher.\n * The refresher will send commands to refresh the session.\n */\n start() {\n if (this._subscription && !this._subscription.closed) {\n this._logger.warn(\"Refresher already started\");\n return;\n }\n\n // NanoS has a specific refresher that sends GetAppAndVersion and GetOsVersion commands\n const refreshObservable =\n this._deviceModelId === DeviceModelId.NANO_S\n ? this._getNanoSRefreshObservable(this._refreshInterval * 2)\n : this._getDefaultRefreshObservable(interval(this._refreshInterval));\n\n this._subscription = refreshObservable.subscribe((parsedResponse) => {\n if (!parsedResponse || !isSuccessCommandResult(parsedResponse)) {\n return;\n }\n // `batteryStatus` and `firmwareVersion` are not available in the polling response.\n this._updateStateFn((state) => ({\n ...state,\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: this._deviceStatus,\n currentApp: parsedResponse.data,\n installedApps: \"installedApps\" in state ? state.installedApps : [],\n }));\n });\n }\n\n /**\n * Creates an observable that refreshes a device state with GetAppAndVersion command result.\n *\n * @param {ObservableInput<number>} parentObservable - The parent observable to base the refresh observable on. Defaults to an array with a single number [0].\n * @return {Observable<GetAppAndVersionCommandResult>} An observable that emits the result of the GetAppAndVersionCommand.\n */\n private _getDefaultRefreshObservable(\n parentObservable: Observable<number> = from([0]),\n ): Observable<GetAppAndVersionCommandResult> {\n return parentObservable.pipe(\n filter(\n () =>\n ![DeviceStatus.BUSY, DeviceStatus.NOT_CONNECTED].includes(\n this._deviceStatus,\n ),\n ),\n switchMap(async () => {\n const rawApdu = this._getAppAndVersionCommand.getApdu().getRawApdu();\n return await this._sendApduFn(rawApdu);\n }),\n map((resp) =>\n resp.caseOf({\n Left: (error) => {\n this._logger.error(\"Error in sending APDU when polling\", {\n data: { error },\n });\n return null;\n },\n Right: (data: ApduResponse) => {\n try {\n return this._getAppAndVersionCommand.parseResponse(data);\n } catch (error) {\n this._logger.error(\"Error in parsing APDU response\", {\n data: { error },\n });\n return null;\n }\n },\n }),\n ),\n filter((parsedResponse) => parsedResponse !== null),\n );\n }\n\n /**\n * Creates an observable that emits events to refresh the NanoS device state.\n *\n * @param {number} refreshInterval - The interval, in milliseconds, at which the NanoS state should be refreshed.\n * @return {Observable<GetAppAndVersionCommandResult | void>} An observable that emits events to refresh the NanoS device state and handle timeout scenarios.\n */\n private _getNanoSRefreshObservable(\n refreshInterval: number,\n ): Observable<GetAppAndVersionCommandResult | void> {\n const nanoSRefreshObservable = this._getDefaultRefreshObservable().pipe(\n switchMap(async (resp) => {\n const rawApdu = this._getOsVersionCommand.getApdu().getRawApdu();\n await this._sendApduFn(rawApdu);\n return resp;\n }),\n );\n const timeoutObservable = of(null).pipe(\n delay(refreshInterval),\n map((_) => {\n this._logger.warn(\n \"Nanos refresh timeout, setting device status to LOCKED\",\n );\n this._updateStateFn((state) => ({\n ...state,\n deviceStatus: DeviceStatus.LOCKED,\n }));\n }),\n );\n return interval(refreshInterval + 100).pipe(\n switchMap(() => race(nanoSRefreshObservable, timeoutObservable)),\n );\n }\n\n /**\n * Maintain a device status to prevent sending APDU when the device is busy.\n *\n * @param {DeviceStatus} deviceStatus - The new device status.\n */\n setDeviceStatus(deviceStatus: DeviceStatus) {\n if (deviceStatus === DeviceStatus.NOT_CONNECTED) {\n this.stop();\n }\n this._deviceStatus = deviceStatus;\n }\n\n /**\n * Stops the session refresher.\n * The refresher will no longer send commands to refresh the session.\n */\n stop() {\n if (!this._subscription || this._subscription.closed) {\n return;\n }\n this._subscription.unsubscribe();\n this._subscription = undefined;\n }\n}\n"],
5
- "mappings": "wMAAA,OAAS,cAAAA,MAAkB,YAE3B,OACE,SAAAC,EACA,UAAAC,EACA,QAAAC,EACA,YAAAC,EACA,OAAAC,EAEA,MAAAC,EACA,QAAAC,EAEA,aAAAC,MACK,OAEP,OAAS,0BAAAC,MAA8B,mCACvC,OACE,2BAAAC,MAEK,0CACP,OAAS,uBAAAC,MAA2B,sCACpC,OAAS,iBAAAC,MAAqB,0BAC9B,OAAS,gBAAAC,MAAoB,2BAE7B,OAEE,0BAAAC,MACK,yCA8CA,IAAMC,EAAN,KAA6B,CACjB,QACA,yBAA2B,IAAIC,EAC/B,qBAAuB,IAAIC,EACpC,cACA,cACS,iBACA,eACA,YACA,eAEjB,YACE,CACE,gBAAAC,EACA,aAAAC,EACA,WAAAC,EACA,cAAAC,EACA,cAAAC,CACF,EACAC,EACA,CACA,KAAK,cAAgBJ,EACrB,KAAK,QAAUI,EACf,KAAK,YAAcH,EACnB,KAAK,eAAiBC,EACtB,KAAK,iBAAmBH,EACxB,KAAK,eAAiBI,EAEtB,KAAK,MAAM,CACb,CAMA,OAAQ,CACN,GAAI,KAAK,eAAiB,CAAC,KAAK,cAAc,OAAQ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D,aAAM,KAAK,YAAYA,CAAO,EACvBE,CACT,CAAC,CACH,EACMI,EAAoBC,EAAG,IAAI,EAAE,KACjCC,EAAM1B,CAAe,EACrBmB,EAAKQ,GAAM,CACT,KAAK,QAAQ,KACX,wDACF,EACA,KAAK,eAAgBhB,IAAW,CAC9B,GAAGA,EACH,aAAcK,EAAa,MAC7B,EAAE,CACJ,CAAC,CACH,EACA,OAAOR,EAASR,EAAkB,GAAG,EAAE,KACrCiB,EAAU,IAAMW,EAAKL,EAAwBC,CAAiB,CAAC,CACjE,CACF,CAOA,gBAAgBvB,EAA4B,CACtCA,IAAiBe,EAAa,eAChC,KAAK,KAAK,EAEZ,KAAK,cAAgBf,CACvB,CAMA,MAAO,CACD,CAAC,KAAK,eAAiB,KAAK,cAAc,SAG9C,KAAK,cAAc,YAAY,EAC/B,KAAK,cAAgB,OACvB,CACF,EAlKaJ,EAANgC,EAAA,CADNC,EAAW,GACCjC",
6
- "names": ["injectable", "delay", "filter", "from", "interval", "map", "of", "race", "switchMap", "isSuccessCommandResult", "GetAppAndVersionCommand", "GetOsVersionCommand", "DeviceModelId", "DeviceStatus", "DeviceSessionStateType", "DeviceSessionRefresher", "GetAppAndVersionCommand", "GetOsVersionCommand", "refreshInterval", "deviceStatus", "sendApduFn", "updateStateFn", "deviceModelId", "logger", "refreshObservable", "DeviceModelId", "interval", "parsedResponse", "isSuccessCommandResult", "state", "DeviceSessionStateType", "parentObservable", "from", "filter", "DeviceStatus", "switchMap", "rawApdu", "map", "resp", "error", "data", "nanoSRefreshObservable", "timeoutObservable", "of", "delay", "_", "race", "__decorateClass", "injectable"]
4
+ "sourcesContent": ["import { type Subscription, timer } from \"rxjs\";\n\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { type TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nimport { type LoggerPublisherService } from \"@api/types\";\nimport {\n DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL,\n DEVICE_SESSION_REFRESHER_POLLING_INTERVAL,\n} from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport {\n type DeviceSessionEventDispatcher,\n SessionEvents,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\n\nexport interface DeviceSessionRefresherOptions {\n isRefresherDisabled: boolean;\n pollingInterval?: number;\n}\n\nexport class DeviceSessionRefresher {\n private _refresherSubscription!: Subscription | undefined;\n private _refresherOptions: DeviceSessionRefresherOptions;\n private readonly _logger: LoggerPublisherService;\n private _connectedDeviceID: DeviceModelId;\n\n constructor(\n loggerModuleFactory: (tag: string) => LoggerPublisherService,\n refresherOptions: DeviceSessionRefresherOptions,\n private _sessionEventDispatcher: DeviceSessionEventDispatcher,\n connectedDevice: TransportConnectedDevice,\n ) {\n this._refresherOptions = refresherOptions;\n this._logger = loggerModuleFactory(\"device-session-refresher\");\n this._connectedDeviceID = connectedDevice.deviceModel.id;\n }\n\n public startRefresher(): void {\n if (this._refresherOptions.isRefresherDisabled) return;\n\n const pollingInterval =\n this.getValidPollingInterval(this._refresherOptions, this._logger) * 2;\n\n this._refresherSubscription = timer(0, pollingInterval).subscribe(() => {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.REFRESH_NEEDED,\n });\n });\n }\n\n public stopRefresher(): void {\n if (this._refresherSubscription) {\n this._refresherSubscription.unsubscribe();\n this._refresherSubscription = undefined;\n this._logger.info(\"Refresher stopped.\");\n }\n }\n\n public restartRefresher(): void {\n this.stopRefresher();\n this.startRefresher();\n this._logger.info(\"Refresher restarted.\");\n }\n\n public destroy(): void {\n this.stopRefresher();\n }\n\n private getValidPollingInterval = (\n refresherOptions: DeviceSessionRefresherOptions,\n logger: LoggerPublisherService,\n ): number => {\n const { pollingInterval } = refresherOptions;\n switch (this._connectedDeviceID) {\n case DeviceModelId.NANO_S: {\n const defaultNanoPollingInterval =\n DEVICE_SESSION_REFRESHER_POLLING_INTERVAL * 2;\n if (\n pollingInterval !== undefined &&\n pollingInterval < defaultNanoPollingInterval\n ) {\n logger.warn(\n `Polling interval of ${pollingInterval} is too low, setting to minimum as ${defaultNanoPollingInterval}`,\n );\n return defaultNanoPollingInterval;\n }\n return pollingInterval ?? defaultNanoPollingInterval;\n }\n default:\n if (\n pollingInterval !== undefined &&\n pollingInterval < DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL\n ) {\n logger.warn(\n `Polling interval of ${pollingInterval} is too low, setting to minimum as ${DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL}`,\n );\n return DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL;\n }\n\n return pollingInterval ?? DEVICE_SESSION_REFRESHER_POLLING_INTERVAL;\n }\n };\n}\n"],
5
+ "mappings": "AAAA,OAA4B,SAAAA,MAAa,OAEzC,OAAS,iBAAAC,MAAqB,0BAG9B,OACE,qDAAAC,EACA,6CAAAC,MACK,4DACP,OAEE,iBAAAC,MACK,8DAOA,MAAMC,CAAuB,CAMlC,YACEC,EACAC,EACQC,EACRC,EACA,CAFQ,6BAAAD,EAGR,KAAK,kBAAoBD,EACzB,KAAK,QAAUD,EAAoB,0BAA0B,EAC7D,KAAK,mBAAqBG,EAAgB,YAAY,EACxD,CAdQ,uBACA,kBACS,QACT,mBAaD,gBAAuB,CAC5B,GAAI,KAAK,kBAAkB,oBAAqB,OAEhD,MAAMC,EACJ,KAAK,wBAAwB,KAAK,kBAAmB,KAAK,OAAO,EAAI,EAEvE,KAAK,uBAAyBV,EAAM,EAAGU,CAAe,EAAE,UAAU,IAAM,CACtE,KAAK,wBAAwB,SAAS,CACpC,UAAWN,EAAc,cAC3B,CAAC,CACH,CAAC,CACH,CAEO,eAAsB,CACvB,KAAK,yBACP,KAAK,uBAAuB,YAAY,EACxC,KAAK,uBAAyB,OAC9B,KAAK,QAAQ,KAAK,oBAAoB,EAE1C,CAEO,kBAAyB,CAC9B,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,QAAQ,KAAK,sBAAsB,CAC1C,CAEO,SAAgB,CACrB,KAAK,cAAc,CACrB,CAEQ,wBAA0B,CAChCG,EACAI,IACW,CACX,KAAM,CAAE,gBAAAD,CAAgB,EAAIH,EAC5B,OAAQ,KAAK,mBAAoB,CAC/B,KAAKN,EAAc,OAAQ,CACzB,MAAMW,EACJT,EAA4C,EAC9C,OACEO,IAAoB,QACpBA,EAAkBE,GAElBD,EAAO,KACL,uBAAuBD,CAAe,sCAAsCE,CAA0B,EACxG,EACOA,GAEFF,GAAmBE,CAC5B,CACA,QACE,OACEF,IAAoB,QACpBA,EAAkBR,GAElBS,EAAO,KACL,uBAAuBD,CAAe,sCAAsCR,CAAiD,EAC/H,EACOA,GAGFQ,GAAmBP,CAC9B,CACF,CACF",
6
+ "names": ["timer", "DeviceModelId", "DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL", "DEVICE_SESSION_REFRESHER_POLLING_INTERVAL", "SessionEvents", "DeviceSessionRefresher", "loggerModuleFactory", "refresherOptions", "_sessionEventDispatcher", "connectedDevice", "pollingInterval", "logger", "defaultNanoPollingInterval"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Left as v,Right as m}from"purify-ts";import{CommandResultFactory as u}from"../../../api/command/model/CommandResult";import{GetAppAndVersionCommand as l}from"../../../api/command/os/GetAppAndVersionCommand";import{GetOsVersionCommand as p}from"../../../api/command/os/GetOsVersionCommand";import{DeviceModelId as n}from"../../../api/device/DeviceModel";import{DeviceStatus as a}from"../../../api/device/DeviceStatus";import{DEVICE_SESSION_REFRESH_INTERVAL as s}from"../../device-session/data/DeviceSessionRefresherConst";import{DefaultLoggerPublisherService as h}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{DeviceSessionRefresher as c}from"./DeviceSessionRefresher";const t=jest.fn().mockResolvedValue(Promise.resolve(m({}))),i=jest.fn().mockImplementation(()=>{});jest.useFakeTimers();describe("DeviceSessionRefresher",()=>{let e,r;beforeEach(()=>{jest.spyOn(l.prototype,"parseResponse").mockReturnValueOnce(u({data:{name:"testAppName"}})),jest.spyOn(p.prototype,"parseResponse").mockReturnValueOnce(u({data:{}})),r=new h([],"DeviceSessionRefresherTest")}),describe("With a modern device",()=>{beforeEach(()=>{const o=Object.values(n).filter(d=>d!==n.NANO_S);e=new c({refreshInterval:s,deviceStatus:a.CONNECTED,sendApduFn:t,updateStateFn:i,deviceModelId:o[Math.floor(Math.random()*o.length)]},r)}),afterEach(()=>{e.stop(),jest.clearAllMocks()}),it("should poll by calling sendApduFn 2 times",()=>{jest.advanceTimersByTime(s*2),expect(t).toHaveBeenCalledTimes(2)}),it("should not poll when device is busy",()=>{e.setDeviceStatus(a.BUSY),jest.advanceTimersByTime(s),expect(t).not.toHaveBeenCalled()}),it("should not poll when device is disconnected",()=>{e.setDeviceStatus(a.NOT_CONNECTED),jest.advanceTimersByTime(s),expect(t).not.toHaveBeenCalled()}),it("should update device session state by calling updateStateFn",async()=>{jest.advanceTimersByTime(s),await expect(t()).resolves.toEqual(m({})),expect(t).toHaveBeenCalled(),expect(i).toHaveBeenCalled()}),it("should not update device session state with failed polling response",async()=>{t.mockResolvedValueOnce(Promise.resolve(v("error")));const o=jest.spyOn(r,"error");jest.advanceTimersByTime(s),await t(),await expect(i).not.toHaveBeenCalled(),expect(o).toHaveBeenCalled()}),it("should stop the refresher when device is disconnected",()=>{const o=jest.spyOn(e,"stop");e.setDeviceStatus(a.NOT_CONNECTED),expect(o).toHaveBeenCalledTimes(1)}),it("should not throw error if stop is called on a stopped refresher",()=>{e.stop(),expect(()=>e.stop()).not.toThrow()}),it("should not throw error if start is called on a started refresher",()=>{e.start(),expect(()=>e.start()).not.toThrow()})}),describe("With a NanoS device",()=>{afterEach(()=>{e.stop(),jest.clearAllMocks()}),it("should call sendApduFn 2 times and update state 1 time for a single interval",async()=>{e=new c({refreshInterval:s,deviceStatus:a.CONNECTED,sendApduFn:t,updateStateFn:i,deviceModelId:n.NANO_S},r),jest.advanceTimersByTime(s*2+100),await Promise.resolve(),expect(t).toHaveBeenNthCalledWith(1,new l().getApdu().getRawApdu()),await Promise.resolve(),expect(t).toHaveBeenLastCalledWith(new p().getApdu().getRawApdu()),await Promise.resolve(),expect(t).toHaveBeenCalledTimes(2),await Promise.resolve(),expect(i).toHaveBeenCalledTimes(1)}),it("should set device locked when get os version times out",async()=>{t.mockImplementation(o=>o.toString()===new p().getApdu().getRawApdu().toString()?new Promise(d=>setTimeout(()=>d(v("timeout")),s*10)):Promise.resolve(m({}))),i.mockImplementation(o=>{e.setDeviceStatus(o().deviceStatus)}),e=new c({refreshInterval:s,deviceStatus:a.CONNECTED,sendApduFn:t,updateStateFn:i,deviceModelId:n.NANO_S},r),jest.spyOn(e,"setDeviceStatus"),jest.advanceTimersByTime(s*5+100),await Promise.resolve(),expect(t).toHaveBeenNthCalledWith(1,new l().getApdu().getRawApdu()),await Promise.resolve(),expect(e.setDeviceStatus).toHaveBeenCalledWith(a.LOCKED)})})});
1
+ import{Subject as u}from"rxjs";import{afterEach as D,beforeEach as S,describe as y,expect as n,it as l,vi as t}from"vitest";import{DeviceModelId as h}from"../../../api/device/DeviceModel";import{DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL as p,DEVICE_SESSION_REFRESHER_POLLING_INTERVAL as E}from"../../device-session/data/DeviceSessionRefresherConst";import{SessionEvents as w}from"../../device-session/model/DeviceSessionEventDispatcher";import{DeviceSessionRefresher as c}from"./DeviceSessionRefresher";y("DeviceSessionRefresher",()=>{let d,s,o;const f={deviceModel:{id:h.FLEX}},m={deviceModel:{id:h.NANO_S}},i=t.fn(()=>o);let e;S(()=>{t.useFakeTimers(),d=new u,s={listen:()=>d.asObservable(),dispatch:t.fn()},o={info:t.fn(),warn:t.fn(),error:t.fn(),debug:t.fn(),subscribers:[]}}),D(()=>{e?.destroy(),t.useRealTimers(),t.restoreAllMocks()}),l("should not start refresher if disabled",()=>{const r={isRefresherDisabled:!0,pollingInterval:1e3};e=new c(i,r,s,f),e.startRefresher(),t.advanceTimersByTime(2e3),n(s.dispatch).not.toHaveBeenCalled()}),l("should warn and use minimum polling interval for default device when provided interval is too low",()=>{const r=p-100,a={isRefresherDisabled:!1,pollingInterval:r};e=new c(i,a,s,f),e.startRefresher();const v=`Polling interval of ${r} is too low, setting to minimum as ${p}`;n(o.warn).toHaveBeenCalledWith(v)}),l("should warn and use minimum polling interval for NANO_S device when provided interval is too low",()=>{const r=E*2,a=r-100,v={isRefresherDisabled:!1,pollingInterval:a};e=new c(i,v,s,m),e.startRefresher();const R=`Polling interval of ${a} is too low, setting to minimum as ${r}`;n(o.warn).toHaveBeenCalledWith(R)}),l("should not warn when provided polling interval is valid for default device",()=>{const a={isRefresherDisabled:!1,pollingInterval:p+100};e=new c(i,a,s,f),e.startRefresher(),n(o.warn).not.toHaveBeenCalled()}),l("should dispatch refresh event on timer ticks",()=>{const r=p+100,a={isRefresherDisabled:!1,pollingInterval:r};e=new c(i,a,s,f),e.startRefresher();const v=r*2;t.advanceTimersByTime(v*3),n(s.dispatch.mock.calls.length).toBe(4),n(s.dispatch.mock.calls[0][0]).toEqual({eventName:w.REFRESH_NEEDED})}),l("should stop refresher",()=>{const r={isRefresherDisabled:!1,pollingInterval:1e3};e=new c(i,r,s,f),e.startRefresher(),s.dispatch.mockClear(),e.stopRefresher(),t.advanceTimersByTime(2e3),n(s.dispatch).not.toHaveBeenCalled(),n(o.info).toHaveBeenCalledWith("Refresher stopped.")}),l("should restart refresher",()=>{const r={isRefresherDisabled:!1,pollingInterval:1e3};e=new c(i,r,s,f),e.startRefresher(),s.dispatch.mockClear(),t.clearAllTimers(),e.restartRefresher(),n(o.info).toHaveBeenCalledWith("Refresher stopped."),n(o.info).toHaveBeenCalledWith("Refresher restarted."),t.advanceTimersByTime(2e3),n(s.dispatch.mock.calls.length).toBeGreaterThan(0)}),l("should destroy refresher",()=>{const r={isRefresherDisabled:!1,pollingInterval:1e3};e=new c(i,r,s,f),e.startRefresher(),e.destroy(),t.advanceTimersByTime(2e3),n(s.dispatch).not.toHaveBeenCalled()})});
2
2
  //# sourceMappingURL=DeviceSessionRefresher.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/model/DeviceSessionRefresher.test.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nimport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { DEVICE_SESSION_REFRESH_INTERVAL } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\n\nimport { DeviceSessionRefresher } from \"./DeviceSessionRefresher\";\n\nconst mockSendApduFn = jest\n .fn()\n .mockResolvedValue(Promise.resolve(Right({} as ApduResponse)));\nconst mockUpdateStateFn = jest.fn().mockImplementation(() => undefined);\n\njest.useFakeTimers();\n\ndescribe(\"DeviceSessionRefresher\", () => {\n let deviceSessionRefresher: DeviceSessionRefresher;\n let logger: LoggerPublisherService;\n\n beforeEach(() => {\n jest\n .spyOn(GetAppAndVersionCommand.prototype, \"parseResponse\")\n .mockReturnValueOnce(\n CommandResultFactory({\n data: {\n name: \"testAppName\",\n } as GetAppAndVersionResponse,\n }),\n );\n jest\n .spyOn(GetOsVersionCommand.prototype, \"parseResponse\")\n .mockReturnValueOnce(\n CommandResultFactory({\n data: {} as GetOsVersionResponse,\n }),\n );\n logger = new DefaultLoggerPublisherService(\n [],\n \"DeviceSessionRefresherTest\",\n );\n });\n\n describe(\"With a modern device\", () => {\n beforeEach(() => {\n const deviceIds = Object.values(DeviceModelId).filter(\n (id) => id !== DeviceModelId.NANO_S,\n );\n deviceSessionRefresher = new DeviceSessionRefresher(\n {\n refreshInterval: DEVICE_SESSION_REFRESH_INTERVAL,\n deviceStatus: DeviceStatus.CONNECTED,\n sendApduFn: mockSendApduFn,\n updateStateFn: mockUpdateStateFn,\n deviceModelId:\n deviceIds[Math.floor(Math.random() * deviceIds.length)]!,\n },\n logger,\n );\n });\n\n afterEach(() => {\n deviceSessionRefresher.stop();\n jest.clearAllMocks();\n });\n\n it(\"should poll by calling sendApduFn 2 times\", () => {\n jest.advanceTimersByTime(DEVICE_SESSION_REFRESH_INTERVAL * 2);\n expect(mockSendApduFn).toHaveBeenCalledTimes(2);\n });\n\n it(\"should not poll when device is busy\", () => {\n deviceSessionRefresher.setDeviceStatus(DeviceStatus.BUSY);\n\n jest.advanceTimersByTime(DEVICE_SESSION_REFRESH_INTERVAL);\n\n expect(mockSendApduFn).not.toHaveBeenCalled();\n });\n\n it(\"should not poll when device is disconnected\", () => {\n deviceSessionRefresher.setDeviceStatus(DeviceStatus.NOT_CONNECTED);\n\n jest.advanceTimersByTime(DEVICE_SESSION_REFRESH_INTERVAL);\n\n expect(mockSendApduFn).not.toHaveBeenCalled();\n });\n\n it(\"should update device session state by calling updateStateFn\", async () => {\n jest.advanceTimersByTime(DEVICE_SESSION_REFRESH_INTERVAL);\n\n await expect(mockSendApduFn()).resolves.toEqual(Right({}));\n expect(mockSendApduFn).toHaveBeenCalled();\n expect(mockUpdateStateFn).toHaveBeenCalled();\n });\n\n it(\"should not update device session state with failed polling response\", async () => {\n mockSendApduFn.mockResolvedValueOnce(Promise.resolve(Left(\"error\")));\n const spy = jest.spyOn(logger, \"error\");\n\n jest.advanceTimersByTime(DEVICE_SESSION_REFRESH_INTERVAL);\n await mockSendApduFn();\n\n await expect(mockUpdateStateFn).not.toHaveBeenCalled();\n expect(spy).toHaveBeenCalled();\n });\n\n it(\"should stop the refresher when device is disconnected\", () => {\n const spy = jest.spyOn(deviceSessionRefresher, \"stop\");\n deviceSessionRefresher.setDeviceStatus(DeviceStatus.NOT_CONNECTED);\n expect(spy).toHaveBeenCalledTimes(1);\n });\n\n it(\"should not throw error if stop is called on a stopped refresher\", () => {\n deviceSessionRefresher.stop();\n expect(() => deviceSessionRefresher.stop()).not.toThrow();\n });\n\n it(\"should not throw error if start is called on a started refresher\", () => {\n deviceSessionRefresher.start();\n expect(() => deviceSessionRefresher.start()).not.toThrow();\n });\n });\n\n describe(\"With a NanoS device\", () => {\n afterEach(() => {\n deviceSessionRefresher.stop();\n jest.clearAllMocks();\n });\n\n it(\"should call sendApduFn 2 times and update state 1 time for a single interval\", async () => {\n deviceSessionRefresher = new DeviceSessionRefresher(\n {\n refreshInterval: DEVICE_SESSION_REFRESH_INTERVAL,\n deviceStatus: DeviceStatus.CONNECTED,\n sendApduFn: mockSendApduFn,\n updateStateFn: mockUpdateStateFn,\n deviceModelId: DeviceModelId.NANO_S,\n },\n logger,\n );\n jest.advanceTimersByTime(DEVICE_SESSION_REFRESH_INTERVAL * 2 + 100);\n\n await Promise.resolve();\n expect(mockSendApduFn).toHaveBeenNthCalledWith(\n 1,\n new GetAppAndVersionCommand().getApdu().getRawApdu(),\n );\n await Promise.resolve();\n expect(mockSendApduFn).toHaveBeenLastCalledWith(\n new GetOsVersionCommand().getApdu().getRawApdu(),\n );\n await Promise.resolve();\n expect(mockSendApduFn).toHaveBeenCalledTimes(2);\n await Promise.resolve();\n expect(mockUpdateStateFn).toHaveBeenCalledTimes(1);\n });\n\n it(\"should set device locked when get os version times out\", async () => {\n mockSendApduFn.mockImplementation((apdu) => {\n if (\n apdu.toString() ===\n new GetOsVersionCommand().getApdu().getRawApdu().toString()\n ) {\n return new Promise((resolve) =>\n setTimeout(\n () => resolve(Left(\"timeout\")),\n DEVICE_SESSION_REFRESH_INTERVAL * 10,\n ),\n );\n }\n return Promise.resolve(Right({}));\n });\n mockUpdateStateFn.mockImplementation(\n (getState: () => DeviceSessionState) => {\n deviceSessionRefresher.setDeviceStatus(getState().deviceStatus);\n },\n );\n deviceSessionRefresher = new DeviceSessionRefresher(\n {\n refreshInterval: DEVICE_SESSION_REFRESH_INTERVAL,\n deviceStatus: DeviceStatus.CONNECTED,\n sendApduFn: mockSendApduFn,\n updateStateFn: mockUpdateStateFn,\n deviceModelId: DeviceModelId.NANO_S,\n },\n logger,\n );\n jest.spyOn(deviceSessionRefresher, \"setDeviceStatus\");\n jest.advanceTimersByTime(DEVICE_SESSION_REFRESH_INTERVAL * 5 + 100);\n await Promise.resolve();\n expect(mockSendApduFn).toHaveBeenNthCalledWith(\n 1,\n new GetAppAndVersionCommand().getApdu().getRawApdu(),\n );\n await Promise.resolve();\n expect(deviceSessionRefresher.setDeviceStatus).toHaveBeenCalledWith(\n DeviceStatus.LOCKED,\n );\n });\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAE5B,OAAS,wBAAAC,MAA4B,mCACrC,OACE,2BAAAC,MAEK,0CACP,OACE,uBAAAC,MAEK,sCACP,OAAS,iBAAAC,MAAqB,0BAC9B,OAAS,gBAAAC,MAAoB,2BAI7B,OAAS,mCAAAC,MAAuC,4DAChD,OAAS,iCAAAC,MAAqC,mEAE9C,OAAS,0BAAAC,MAA8B,2BAEvC,MAAMC,EAAiB,KACpB,GAAG,EACH,kBAAkB,QAAQ,QAAQT,EAAM,CAAC,CAAiB,CAAC,CAAC,EACzDU,EAAoB,KAAK,GAAG,EAAE,mBAAmB,IAAG,EAAY,EAEtE,KAAK,cAAc,EAEnB,SAAS,yBAA0B,IAAM,CACvC,IAAIC,EACAC,EAEJ,WAAW,IAAM,CACf,KACG,MAAMV,EAAwB,UAAW,eAAe,EACxD,oBACCD,EAAqB,CACnB,KAAM,CACJ,KAAM,aACR,CACF,CAAC,CACH,EACF,KACG,MAAME,EAAoB,UAAW,eAAe,EACpD,oBACCF,EAA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EAAK,SAAS,IACd,IAAIb,EAAoB,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAEnD,IAAI,QAASc,GAClB,WACE,IAAMA,EAAQlB,EAAK,SAAS,CAAC,EAC7BO,EAAkC,EACpC,CACF,EAEK,QAAQ,QAAQN,EAAM,CAAC,CAAC,CAAC,CACjC,EACDU,EAAkB,mBACfQ,GAAuC,CACtCP,EAAuB,gBAAgBO,EAAS,EAAE,YAAY,CAChE,CACF,EACAP,EAAyB,IAAIH,EAC3B,CACE,gBAAiBF,EACjB,aAAcD,EAAa,UAC3B,WAAYI,EACZ,cAAeC,EACf,cAAeN,EAAc,MAC/B,EACAQ,CACF,EACA,KAAK,MAAMD,EAAwB,iBAAiB,EACpD,KAAK,oBAAoBL,EAAkC,EAAI,GAAG,EAClE,MAAM,QAAQ,QAAQ,EACtB,OAAOG,CAAc,EAAE,wBACrB,EACA,IAAIP,EAAwB,EAAE,QAAQ,EAAE,WAAW,CACrD,EACA,MAAM,QAAQ,QAAQ,EACtB,OAAOS,EAAuB,eAAe,EAAE,qBAC7CN,EAAa,MACf,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["Left", "Right", "CommandResultFactory", "GetAppAndVersionCommand", "GetOsVersionCommand", "DeviceModelId", "DeviceStatus", "DEVICE_SESSION_REFRESH_INTERVAL", "DefaultLoggerPublisherService", "DeviceSessionRefresher", "mockSendApduFn", "mockUpdateStateFn", "deviceSessionRefresher", "logger", "deviceIds", "id", "spy", "apdu", "resolve", "getState"]
4
+ "sourcesContent": ["import { Subject } from \"rxjs\";\nimport { afterEach, beforeEach, describe, expect, it, vi } from \"vitest\";\n\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { type TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nimport type { LoggerPublisherService } from \"@api/types\";\nimport {\n DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL,\n DEVICE_SESSION_REFRESHER_POLLING_INTERVAL,\n} from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport type {\n DeviceSessionEventDispatcher,\n NewEvent,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\nimport { SessionEvents } from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\n\nimport {\n DeviceSessionRefresher,\n type DeviceSessionRefresherOptions,\n} from \"./DeviceSessionRefresher\";\n\ndescribe(\"DeviceSessionRefresher\", () => {\n let subject: Subject<NewEvent>;\n let mockSessionEventDispatcher: DeviceSessionEventDispatcher;\n let mockLogger: LoggerPublisherService & {\n info: ReturnType<typeof vi.fn>;\n warn: ReturnType<typeof vi.fn>;\n error: ReturnType<typeof vi.fn>;\n debug: ReturnType<typeof vi.fn>;\n subscribers?: unknown[];\n };\n\n const stubDefaultDevice = {\n deviceModel: {\n id: DeviceModelId.FLEX,\n },\n } as TransportConnectedDevice;\n\n const stubNanoSDevice = {\n deviceModel: {\n id: DeviceModelId.NANO_S,\n },\n } as TransportConnectedDevice;\n\n const mockedLoggerModuleFactory = vi.fn(() => mockLogger);\n let refresher: DeviceSessionRefresher;\n\n beforeEach(() => {\n vi.useFakeTimers();\n subject = new Subject<NewEvent>();\n mockSessionEventDispatcher = {\n listen: () => subject.asObservable(),\n dispatch: vi.fn(),\n } as unknown as DeviceSessionEventDispatcher;\n mockLogger = {\n info: vi.fn(),\n warn: vi.fn(),\n error: vi.fn(),\n debug: vi.fn(),\n subscribers: [],\n };\n });\n\n afterEach(() => {\n refresher?.destroy();\n vi.useRealTimers();\n vi.restoreAllMocks();\n });\n\n it(\"should not start refresher if disabled\", () => {\n const options: DeviceSessionRefresherOptions = {\n isRefresherDisabled: true,\n pollingInterval: 1000,\n };\n\n refresher = new DeviceSessionRefresher(\n mockedLoggerModuleFactory,\n options,\n mockSessionEventDispatcher,\n stubDefaultDevice,\n );\n refresher.startRefresher();\n vi.advanceTimersByTime(2000);\n\n expect(mockSessionEventDispatcher.dispatch).not.toHaveBeenCalled();\n });\n\n it(\"should warn and use minimum polling interval for default device when provided interval is too low\", () => {\n const lowInterval = DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL - 100;\n const options: DeviceSessionRefresherOptions = {\n isRefresherDisabled: false,\n pollingInterval: lowInterval,\n };\n\n refresher = new DeviceSessionRefresher(\n mockedLoggerModuleFactory,\n options,\n mockSessionEventDispatcher,\n stubDefaultDevice,\n );\n refresher.startRefresher();\n\n const expectedMessage = `Polling interval of ${lowInterval} is too low, setting to minimum as ${DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL}`;\n expect(mockLogger.warn).toHaveBeenCalledWith(expectedMessage);\n });\n\n it(\"should warn and use minimum polling interval for NANO_S device when provided interval is too low\", () => {\n const defaultNanoPollingInterval =\n DEVICE_SESSION_REFRESHER_POLLING_INTERVAL * 2;\n const lowInterval = defaultNanoPollingInterval - 100;\n const options: DeviceSessionRefresherOptions = {\n isRefresherDisabled: false,\n pollingInterval: lowInterval,\n };\n\n refresher = new DeviceSessionRefresher(\n mockedLoggerModuleFactory,\n options,\n mockSessionEventDispatcher,\n stubNanoSDevice,\n );\n refresher.startRefresher();\n\n const expectedMessage = `Polling interval of ${lowInterval} is too low, setting to minimum as ${defaultNanoPollingInterval}`;\n expect(mockLogger.warn).toHaveBeenCalledWith(expectedMessage);\n });\n\n it(\"should not warn when provided polling interval is valid for default device\", () => {\n const validInterval =\n DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL + 100;\n const options: DeviceSessionRefresherOptions = {\n isRefresherDisabled: false,\n pollingInterval: validInterval,\n };\n\n refresher = new DeviceSessionRefresher(\n mockedLoggerModuleFactory,\n options,\n mockSessionEventDispatcher,\n stubDefaultDevice,\n );\n refresher.startRefresher();\n\n expect(mockLogger.warn).not.toHaveBeenCalled();\n });\n\n it(\"should dispatch refresh event on timer ticks\", () => {\n const validInterval =\n DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL + 100;\n const options: DeviceSessionRefresherOptions = {\n isRefresherDisabled: false,\n pollingInterval: validInterval,\n };\n\n refresher = new DeviceSessionRefresher(\n mockedLoggerModuleFactory,\n options,\n mockSessionEventDispatcher,\n stubDefaultDevice,\n );\n refresher.startRefresher();\n\n const timerInterval = validInterval * 2;\n\n vi.advanceTimersByTime(timerInterval * 3);\n\n expect(\n (mockSessionEventDispatcher.dispatch as ReturnType<typeof vi.fn>).mock\n .calls.length,\n ).toBe(4);\n expect(\n (mockSessionEventDispatcher.dispatch as ReturnType<typeof vi.fn>).mock\n .calls[0]![0],\n ).toEqual({\n eventName: SessionEvents.REFRESH_NEEDED,\n });\n });\n\n it(\"should stop refresher\", () => {\n const options: DeviceSessionRefresherOptions = {\n isRefresherDisabled: false,\n pollingInterval: 1000,\n };\n refresher = new DeviceSessionRefresher(\n mockedLoggerModuleFactory,\n options,\n mockSessionEventDispatcher,\n stubDefaultDevice,\n );\n refresher.startRefresher();\n (\n mockSessionEventDispatcher.dispatch as ReturnType<typeof vi.fn>\n ).mockClear();\n\n refresher.stopRefresher();\n vi.advanceTimersByTime(2000);\n\n expect(mockSessionEventDispatcher.dispatch).not.toHaveBeenCalled();\n expect(mockLogger.info).toHaveBeenCalledWith(\"Refresher stopped.\");\n });\n\n it(\"should restart refresher\", () => {\n const options: DeviceSessionRefresherOptions = {\n isRefresherDisabled: false,\n pollingInterval: 1000,\n };\n refresher = new DeviceSessionRefresher(\n mockedLoggerModuleFactory,\n options,\n mockSessionEventDispatcher,\n stubDefaultDevice,\n );\n refresher.startRefresher();\n (\n mockSessionEventDispatcher.dispatch as ReturnType<typeof vi.fn>\n ).mockClear();\n vi.clearAllTimers();\n\n refresher.restartRefresher();\n expect(mockLogger.info).toHaveBeenCalledWith(\"Refresher stopped.\");\n expect(mockLogger.info).toHaveBeenCalledWith(\"Refresher restarted.\");\n\n vi.advanceTimersByTime(2000);\n expect(\n (mockSessionEventDispatcher.dispatch as ReturnType<typeof vi.fn>).mock\n .calls.length,\n ).toBeGreaterThan(0);\n });\n\n it(\"should destroy refresher\", () => {\n const options: DeviceSessionRefresherOptions = {\n isRefresherDisabled: false,\n pollingInterval: 1000,\n };\n refresher = new DeviceSessionRefresher(\n mockedLoggerModuleFactory,\n options,\n mockSessionEventDispatcher,\n stubDefaultDevice,\n );\n refresher.startRefresher();\n\n refresher.destroy();\n vi.advanceTimersByTime(2000);\n\n expect(mockSessionEventDispatcher.dispatch).not.toHaveBeenCalled();\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,WAAAA,MAAe,OACxB,OAAS,aAAAC,EAAW,cAAAC,EAAY,YAAAC,EAAU,UAAAC,EAAQ,MAAAC,EAAI,MAAAC,MAAU,SAEhE,OAAS,iBAAAC,MAAqB,0BAG9B,OACE,qDAAAC,EACA,6CAAAC,MACK,4DAKP,OAAS,iBAAAC,MAAqB,8DAE9B,OACE,0BAAAC,MAEK,2BAEPR,EAAS,yBAA0B,IAAM,CACvC,IAAIS,EACAC,EACAC,EAQJ,MAAMC,EAAoB,CACxB,YAAa,CACX,GAAIR,EAAc,IACpB,CACF,EAEMS,EAAkB,CACtB,YAAa,CACX,GAAIT,EAAc,MACpB,CACF,EAEMU,EAA4BX,EAAG,GAAG,IAAMQ,CAAU,EACxD,IAAII,EAEJhB,EAAW,IAAM,CACfI,EAAG,cAAc,EACjBM,EAAU,IAAIZ,EACda,EAA6B,CAC3B,OAAQ,IAAMD,EAAQ,aAAa,EACnC,SAAUN,EAAG,GAAG,CAClB,EACAQ,EAAa,CACX,KAAMR,EAAG,GAAG,EACZ,KAAMA,EAAG,GAAG,EACZ,MAAOA,EAAG,GAAG,EACb,MAAOA,EAAG,GAAG,EACb,YAAa,CAAC,CAChB,CACF,CAAC,EAEDL,EAAU,IAAM,CACdiB,GAAW,QAAQ,EACnBZ,EAAG,cAAc,EACjBA,EAAG,gBAAgB,CACrB,CAAC,EAEDD,EAAG,yCAA0C,IAAM,CACjD,MAAMc,EAAyC,CAC7C,oBAAqB,GACrB,gBAAiB,GACnB,EAEAD,EAAY,IAAIP,EACdM,EACAE,E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", "expect", "it", "vi", "DeviceModelId", "DEVICE_SESSION_REFRESHER_MINIMUM_POLLING_INTERVAL", "DEVICE_SESSION_REFRESHER_POLLING_INTERVAL", "SessionEvents", "DeviceSessionRefresher", "subject", "mockSessionEventDispatcher", "mockLogger", "stubDefaultDevice", "stubNanoSDevice", "mockedLoggerModuleFactory", "refresher", "options", "lowInterval", "expectedMessage", "defaultNanoPollingInterval", "validInterval", "timerInterval"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ import{DeviceSessionStateType as o,DeviceStatus as t,isSuccessCommandResult as v}from"../../../api/index";import{SessionEvents as i}from"../../device-session/model/DeviceSessionEventDispatcher";class D{constructor(e,s,n,r,a){this._sessionEventDispatcher=s;this._connectedDevice=n;this._deviceState=r;this.setDeviceSessionState=a;this._subscription=this._sessionEventDispatcher.listen().subscribe(c=>this.mapEventAction(c)),this._logger=e("device-session-state-handler")}_subscription;_logger;_updateDeviceState(e){const s=this._parseDeviceStatus(e);if(s){const{sessionStateType:n,deviceStatus:r,currentApp:a}=s;this.setDeviceSessionState({sessionStateType:n,deviceStatus:r,deviceModelId:this._connectedDevice.deviceModel.id,currentApp:a,installedApps:[],isSecureConnectionAllowed:!1})}}mapEventAction=e=>{switch(e.eventName){case i.COMMAND_SUCCEEDED:return this._updateDeviceState(e.eventData);case i.DEVICE_STATE_UPDATE_BUSY:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:t.BUSY});case i.DEVICE_STATE_UPDATE_LOCKED:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:t.LOCKED});case i.DEVICE_STATE_UPDATE_CONNECTED:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:t.CONNECTED});default:return null}};_parseDeviceStatus(e){return v(e)?{sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:t.CONNECTED,currentApp:{name:e.data.name,version:e.data.version}}:(this._logger.error("Error while parsing APDU response",{data:{parsedResponse:e}}),null)}unsubscribe(){this._subscription.unsubscribe()}}export{D as DeviceSessionStateHandler};
2
+ //# sourceMappingURL=DeviceSessionStateHandler.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/internal/device-session/model/DeviceSessionStateHandler.ts"],
4
+ "sourcesContent": ["import { type BehaviorSubject, type Subscription } from \"rxjs\";\n\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport {\n DeviceSessionStateType,\n DeviceStatus,\n type GetAppAndVersionResponse,\n isSuccessCommandResult,\n type TransportConnectedDevice,\n} from \"@api/index\";\nimport { type CommandResult, type LoggerPublisherService } from \"@api/types\";\nimport {\n type DeviceSessionEventDispatcher,\n type NewEvent,\n SessionEvents,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\n\nexport type SetDeviceSessionStateFn = (state: DeviceSessionState) => void;\n\ntype NewDeviceStatus = {\n sessionStateType: DeviceSessionStateType;\n deviceStatus: DeviceStatus;\n currentApp: {\n name: string;\n version: string;\n };\n};\n\nexport class DeviceSessionStateHandler {\n private _subscription: Subscription;\n private readonly _logger: LoggerPublisherService;\n\n constructor(\n loggerModuleFactory: (tag: string) => LoggerPublisherService,\n private _sessionEventDispatcher: DeviceSessionEventDispatcher,\n private _connectedDevice: TransportConnectedDevice,\n private _deviceState: BehaviorSubject<DeviceSessionState>,\n private setDeviceSessionState: SetDeviceSessionStateFn,\n ) {\n this._subscription = this._sessionEventDispatcher\n .listen()\n .subscribe((event) => this.mapEventAction(event));\n this._logger = loggerModuleFactory(\"device-session-state-handler\");\n }\n\n private _updateDeviceState(\n parsedResponse: CommandResult<GetAppAndVersionResponse>,\n ): void {\n const newDeviceStatus = this._parseDeviceStatus(parsedResponse);\n\n if (newDeviceStatus) {\n const { sessionStateType, deviceStatus, currentApp } = newDeviceStatus;\n\n this.setDeviceSessionState({\n sessionStateType,\n deviceStatus,\n deviceModelId: this._connectedDevice.deviceModel.id,\n currentApp,\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n }\n }\n\n private mapEventAction = (event: NewEvent) => {\n switch (event.eventName) {\n case SessionEvents.COMMAND_SUCCEEDED:\n return this._updateDeviceState(event.eventData);\n case SessionEvents.DEVICE_STATE_UPDATE_BUSY:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.BUSY,\n });\n case SessionEvents.DEVICE_STATE_UPDATE_LOCKED:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.LOCKED,\n });\n case SessionEvents.DEVICE_STATE_UPDATE_CONNECTED:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.CONNECTED,\n });\n default:\n return null;\n }\n };\n\n private _parseDeviceStatus(\n parsedResponse: CommandResult<GetAppAndVersionResponse>,\n ): NewDeviceStatus | null {\n if (isSuccessCommandResult(parsedResponse)) {\n return {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: {\n name: parsedResponse.data.name,\n version: parsedResponse.data.version,\n },\n };\n } else {\n this._logger.error(\"Error while parsing APDU response\", {\n data: { parsedResponse },\n });\n return null;\n }\n }\n\n public unsubscribe(): void {\n this._subscription.unsubscribe();\n }\n}\n"],
5
+ "mappings": "AAGA,OACE,0BAAAA,EACA,gBAAAC,EAEA,0BAAAC,MAEK,aAEP,OAGE,iBAAAC,MACK,8DAaA,MAAMC,CAA0B,CAIrC,YACEC,EACQC,EACAC,EACAC,EACAC,EACR,CAJQ,6BAAAH,EACA,sBAAAC,EACA,kBAAAC,EACA,2BAAAC,EAER,KAAK,cAAgB,KAAK,wBACvB,OAAO,EACP,UAAWC,GAAU,KAAK,eAAeA,CAAK,CAAC,EAClD,KAAK,QAAUL,EAAoB,8BAA8B,CACnE,CAdQ,cACS,QAeT,mBACNM,EACM,CACN,MAAMC,EAAkB,KAAK,mBAAmBD,CAAc,EAE9D,GAAIC,EAAiB,CACnB,KAAM,CAAE,iBAAAC,EAAkB,aAAAC,EAAc,WAAAC,CAAW,EAAIH,EAEvD,KAAK,sBAAsB,CACzB,iBAAAC,EACA,aAAAC,EACA,cAAe,KAAK,iBAAiB,YAAY,GACjD,WAAAC,EACA,cAAe,CAAC,EAChB,0BAA2B,EAC7B,CAAC,CACH,CACF,CAEQ,eAAkBL,GAAoB,CAC5C,OAAQA,EAAM,UAAW,CACvB,KAAKP,EAAc,kBACjB,OAAO,KAAK,mBAAmBO,EAAM,SAAS,EAChD,KAAKP,EAAc,yBACjB,OAAO,KAAK,sBAAsB,CAChC,GAAG,KAAK,aAAa,SAAS,EAC9B,aAAcF,EAAa,IAC7B,CAAC,EACH,KAAKE,EAAc,2BACjB,OAAO,KAAK,sBAAsB,CAChC,GAAG,KAAK,aAAa,SAAS,EAC9B,aAAcF,EAAa,MAC7B,CAAC,EACH,KAAKE,EAAc,8BACjB,OAAO,KAAK,sBAAsB,CAChC,GAAG,KAAK,aAAa,SAAS,EAC9B,aAAcF,EAAa,SAC7B,CAAC,EACH,QACE,OAAO,IACX,CACF,EAEQ,mBACNU,EACwB,CACxB,OAAIT,EAAuBS,CAAc,EAChC,CACL,iBAAkBX,EAAuB,0BACzC,aAAcC,EAAa,UAC3B,WAAY,CACV,KAAMU,EAAe,KAAK,KAC1B,QAASA,EAAe,KAAK,OAC/B,CACF,GAEA,KAAK,QAAQ,MAAM,oCAAqC,CACtD,KAAM,CAAE,eAAAA,CAAe,CACzB,CAAC,EACM,KAEX,CAEO,aAAoB,CACzB,KAAK,cAAc,YAAY,CACjC,CACF",
6
+ "names": ["DeviceSessionStateType", "DeviceStatus", "isSuccessCommandResult", "SessionEvents", "DeviceSessionStateHandler", "loggerModuleFactory", "_sessionEventDispatcher", "_connectedDevice", "_deviceState", "setDeviceSessionState", "event", "parsedResponse", "newDeviceStatus", "sessionStateType", "deviceStatus", "currentApp"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{BehaviorSubject as E,Subject as S}from"rxjs";import{CommandResultStatus as u,DeviceModelId as p,DeviceSessionStateType as l,DeviceStatus as o}from"../../../api/index";import{SessionEvents as s}from"../../device-session/model/DeviceSessionEventDispatcher";import{DeviceSessionStateHandler as D}from"./DeviceSessionStateHandler";describe("DeviceSessionStateHandler",()=>{let n,c,i;const v=vi.fn(()=>i);let r,d,t,a;beforeEach(()=>{n=new S,c={listen:()=>n,dispatch:vi.fn()},i={error:vi.fn()},r={deviceModel:{id:"device-model-1"}},d=new E({sessionStateType:l.ReadyWithoutSecureChannel,deviceStatus:o.CONNECTED,deviceModelId:p.NANO_X,currentApp:{name:"",version:""},installedApps:[],isSecureConnectionAllowed:!1}),t=vi.fn(),a=new D(v,c,r,d,t)}),afterEach(()=>{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}),it("updates device state on COMMAND_SUCCEEDED event with a successful response",()=>{const e={data:{name:"TestApp",version:"1.0.0"},status:u.Success};n.next({eventName:s.COMMAND_SUCCEEDED,eventData:e}),expect(t).toHaveBeenCalledWith({sessionStateType:l.ReadyWithoutSecureChannel,deviceStatus:o.CONNECTED,deviceModelId:"device-model-1",currentApp:{name:"TestApp",version:"1.0.0"},installedApps:[],isSecureConnectionAllowed:!1})}),it("updates device state on DEVICE_STATE_UPDATE_BUSY event",()=>{n.next({eventName:s.DEVICE_STATE_UPDATE_BUSY}),expect(t).toHaveBeenCalled();const e=t.mock.calls[0][0];expect(e.deviceStatus).toBe(o.BUSY)}),it("updates device state on DEVICE_STATE_UPDATE_CONNECTED event",()=>{n.next({eventName:s.DEVICE_STATE_UPDATE_CONNECTED}),expect(t).toHaveBeenCalled();const e=t.mock.calls[0][0];expect(e.deviceStatus).toBe(o.CONNECTED)}),it("logs error and does not update state if command result is unsuccessful",()=>{const e={data:null,error:{_tag:"SomeOtherError"}};n.next({eventName:s.COMMAND_SUCCEEDED,eventData:e}),expect(i.error).toHaveBeenCalledWith("Error while parsing APDU response",{data:{parsedResponse:e}}),expect(t).not.toHaveBeenCalled()}),it("does not update state if command result is not a success",()=>{const e={data:null,error:{_tag:"SomeOtherError"}};n.next({eventName:s.COMMAND_SUCCEEDED,eventData:e}),expect(t).not.toHaveBeenCalled()})});
2
+ //# sourceMappingURL=DeviceSessionStateHandler.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/internal/device-session/model/DeviceSessionStateHandler.test.ts"],
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\nimport { BehaviorSubject, Subject } from \"rxjs\";\n\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport {\n CommandResultStatus,\n DeviceModelId,\n DeviceSessionStateType,\n DeviceStatus,\n} from \"@api/index\";\nimport {\n type DeviceSessionEventDispatcher,\n type NewEvent,\n SessionEvents,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\n\nimport { DeviceSessionStateHandler } from \"./DeviceSessionStateHandler\";\n\ndescribe(\"DeviceSessionStateHandler\", () => {\n let fakeEventSubject: Subject<NewEvent>;\n let fakeSessionEventDispatcher: DeviceSessionEventDispatcher;\n let mockLogger: {\n error: (message: string, meta?: Record<string, unknown>) => void;\n };\n const mockLoggerModuleFactory = vi.fn(() => mockLogger);\n let fakeConnectedDevice: { deviceModel: { id: string } };\n let deviceState: BehaviorSubject<DeviceSessionState>;\n let setDeviceSessionState: any;\n let handler: DeviceSessionStateHandler;\n\n beforeEach(() => {\n fakeEventSubject = new Subject<NewEvent>();\n //@ts-expect-error mock\n fakeSessionEventDispatcher = {\n listen: () => fakeEventSubject,\n dispatch: vi.fn(),\n };\n\n mockLogger = {\n error: vi.fn(),\n };\n\n fakeConnectedDevice = {\n deviceModel: {\n id: \"device-model-1\",\n },\n };\n\n deviceState = new BehaviorSubject<DeviceSessionState>({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: DeviceModelId.NANO_X,\n currentApp: { name: \"\", version: \"\" },\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n\n setDeviceSessionState = vi.fn();\n\n handler = new DeviceSessionStateHandler(\n //@ts-expect-error mock\n mockLoggerModuleFactory,\n fakeSessionEventDispatcher,\n fakeConnectedDevice,\n deviceState,\n setDeviceSessionState,\n );\n });\n\n afterEach(() => {\n if (handler && typeof handler.unsubscribe === \"function\") {\n handler.unsubscribe();\n }\n });\n\n it(\"updates device state on COMMAND_SUCCEEDED event with a successful response\", () => {\n // Given\n const fakeCommandResult = {\n data: {\n name: \"TestApp\",\n version: \"1.0.0\",\n },\n status: CommandResultStatus.Success,\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeCommandResult,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalledWith({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: \"device-model-1\",\n currentApp: { name: \"TestApp\", version: \"1.0.0\" },\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n });\n\n it(\"updates device state on DEVICE_STATE_UPDATE_BUSY event\", () => {\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_BUSY,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalled();\n const callArg = setDeviceSessionState.mock.calls[0][0];\n expect(callArg.deviceStatus).toBe(DeviceStatus.BUSY);\n });\n\n it(\"updates device state on DEVICE_STATE_UPDATE_CONNECTED event\", () => {\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalled();\n const callArg = setDeviceSessionState.mock.calls[0][0];\n expect(callArg.deviceStatus).toBe(DeviceStatus.CONNECTED);\n });\n\n it(\"logs error and does not update state if command result is unsuccessful\", () => {\n // Given\n const fakeErrorCommandResult = {\n data: null,\n error: { _tag: \"SomeOtherError\" },\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeErrorCommandResult,\n });\n\n // Then\n expect(mockLogger.error).toHaveBeenCalledWith(\n \"Error while parsing APDU response\",\n { data: { parsedResponse: fakeErrorCommandResult } },\n );\n expect(setDeviceSessionState).not.toHaveBeenCalled();\n });\n\n it(\"does not update state if command result is not a success\", () => {\n // Given\n const fakeErrorCommandResult = {\n data: null,\n error: { _tag: \"SomeOtherError\" },\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeErrorCommandResult,\n });\n\n // Then\n expect(setDeviceSessionState).not.toHaveBeenCalled();\n });\n});\n"],
5
+ "mappings": "AAGA,OAAS,mBAAAA,EAAiB,WAAAC,MAAe,OAGzC,OACE,uBAAAC,EACA,iBAAAC,EACA,0BAAAC,EACA,gBAAAC,MACK,aACP,OAGE,iBAAAC,MACK,8DAEP,OAAS,6BAAAC,MAAiC,8BAE1C,SAAS,4BAA6B,IAAM,CAC1C,IAAIC,EACAC,EACAC,EAGJ,MAAMC,EAA0B,GAAG,GAAG,IAAMD,CAAU,EACtD,IAAIE,EACAC,EACAC,EACAC,EAEJ,WAAW,IAAM,CACfP,EAAmB,IAAIP,EAEvBQ,EAA6B,CAC3B,OAAQ,IAAMD,EACd,SAAU,GAAG,GAAG,CAClB,EAEAE,EAAa,CACX,MAAO,GAAG,GAAG,CACf,EAEAE,EAAsB,CACpB,YAAa,CACX,GAAI,gBACN,CACF,EAEAC,EAAc,IAAIb,EAAoC,CACpD,iBAAkBI,EAAuB,0BACzC,aAAcC,EAAa,UAC3B,cAAeF,EAAc,OAC7B,WAAY,CAAE,KAAM,GAAI,QAAS,EAAG,EACpC,cAAe,CAAC,EAChB,0BAA2B,EAC7B,CAAC,EAEDW,EAAwB,GAAG,GAAG,EAE9BC,EAAU,IAAIR,EAEZI,EACAF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AAOJ,CAAqB,EAAE,IAAI,iBAAiB,CACrD,CAAC,EAED,GAAG,2DAA4D,IAAM,CAEnE,MAAMI,EAAyB,CAC7B,KAAM,KACN,MAAO,CAAE,KAAM,gBAAiB,CAClC,EAGAV,EAAiB,KAAK,CACpB,UAAWF,EAAc,kBAEzB,UAAWY,CACb,CAAC,EAGD,OAAOJ,CAAqB,EAAE,IAAI,iBAAiB,CACrD,CAAC,CACH,CAAC",
6
+ "names": ["BehaviorSubject", "Subject", "CommandResultStatus", "DeviceModelId", "DeviceSessionStateType", "DeviceStatus", "SessionEvents", "DeviceSessionStateHandler", "fakeEventSubject", "fakeSessionEventDispatcher", "mockLogger", "mockLoggerModuleFactory", "fakeConnectedDevice", "deviceState", "setDeviceSessionState", "handler", "fakeCommandResult", "callArg", "fakeErrorCommandResult"]
7
+ }
@@ -1,2 +1,2 @@
1
- import{Just as t,Left as l,Nothing as c,Right as d}from"purify-ts";import{ApduResponse as s}from"../../../api/device-session/ApduResponse";import{ReceiverApduError as u}from"../../device-session/model/Errors";import{DefaultLoggerPublisherService as b}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{DefaultApduReceiverService as f}from"./DefaultApduReceiverService";jest.mock("uuid");const h=new b([],"frame"),o=new Uint8Array([170,170,5,0,0,0,33,51,0,0,4,5,50,46,50,46,51,4,230,0,0,0,4,50,46,51,48,4,49,46,49,54,1,1,1,0,1,0,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),m=new Uint8Array([170,170,5,0,0,0,2,85,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),r=[new Uint8Array([170,170,5,0,0,0,158,1,77,0,19,202,80,250,161,145,64,154,107,250,108,15,187,178,231,196,169,207,229,87,65,0,93,189,132,171,154,189,102,199,108,144,221,8,121,13,8,71,185,58,143,167,111,96,51,174,211,37,215,177,229,124,235,215]),new Uint8Array([170,170,5,0,1,75,46,44,159,180,70,120,222,5,95,158,128,10,7,66,105,116,99,111,105,110,78,0,21,202,64,6,3,40,248,143,198,214,66,152,208,73,0,199,4,152,25,27,108,235,237,216,203,132,93,245,75,227,189,187,37,122,63,111]),new Uint8Array([170,170,5,0,2,104,143,84,239,127,170,196,34,170,84,231,184,10,200,163,47,150,229,94,67,45,243,163,69,141,142,170,241,78,209,30,8,69,116,104,101,114,101,117,109,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])];describe("DefaultApduReceiverService",()=>{let a;beforeAll(()=>{jest.mock("uuid",()=>({v4:jest.fn().mockReturnValue("42")}))}),describe("without dataSize",()=>{beforeEach(()=>{a=new f({channel:t(new Uint8Array([170,170]))},()=>h)}),it("should return a left error when the first frame has no dataSize",()=>{const x=r[1],e=a.handleFrame(x);expect(e).toEqual(l(new u))})}),describe("[USB] With padding and channel",()=>{beforeEach(()=>{a=new f({channel:t(new Uint8Array([170,170]))},()=>h)}),it("should return a response directly when a frame is complete",()=>{const x=o,e=a.handleFrame(x);expect(e).toEqual(d(t(new s({data:o.slice(7,38),statusCode:new Uint8Array([144,0])}))))}),it("should return a response on a third frame when the two first are not complete",()=>{const x=[...r];let e=c;const n=[];for(;e.isNothing();){const i=x.shift();a.handleFrame(i).map(p=>{e=p,n.push(e)})}expect(n).toEqual([c,c,t(new s({data:new Uint8Array([...Array.from(r[0].slice(7)),...Array.from(r[1].slice(5)),...Array.from(r[2]).slice(5,45)]),statusCode:new Uint8Array([144,0])}))])}),it("should return two response directly when each frame is complete",()=>{const x=m,e=o,n=a.handleFrame(x),i=a.handleFrame(e);expect(n).toEqual(d(t(new s({data:new Uint8Array([]),statusCode:new Uint8Array([85,21])})))),expect(i).toEqual(d(t(new s({data:o.slice(7,38),statusCode:new Uint8Array([144,0])}))))}),it("should return an error if the frame is without index",()=>{const x=r[0].slice(0,4),e=a.handleFrame(x);expect(e).toEqual(l(new u("Unable to parse header from apdu")))}),it("should return an error if the frame is without datasize",()=>{const x=r[0].slice(0,6),e=a.handleFrame(x);expect(e).toEqual(l(new u("Unable to parse header from apdu")))})}),describe("[BLE] Without padding nor channel",()=>{beforeEach(()=>{a=new f({},()=>h)}),it("should return a response directly when a frame is complete",()=>{const x=o.slice(2,40),e=a.handleFrame(x);expect(e).toEqual(d(t(new s({data:o.slice(7,38),statusCode:new Uint8Array([144,0])}))))}),it("should return a response on a third frame when the two first are not complete",()=>{const x=[r[0].slice(2),r[1].slice(2),r[2].slice(2,47)];let e=c;const n=[];for(;e.isNothing();){const i=x.shift();a.handleFrame(i).map(p=>{e=p,n.push(e)})}expect(n).toEqual([c,c,t(new s({data:new Uint8Array([...Array.from(r[0].slice(7)),...Array.from(r[1].slice(5)),...Array.from(r[2]).slice(5,45)]),statusCode:new Uint8Array([144,0])}))])}),it("should return two response directly when each frame is complete",()=>{const x=m.slice(2,9),e=o.slice(2,40),n=a.handleFrame(x),i=a.handleFrame(e);expect(n).toEqual(d(t(new s({data:new Uint8Array([]),statusCode:new Uint8Array([85,21])})))),expect(i).toEqual(d(t(new s({data:o.slice(7,38),statusCode:new Uint8Array([144,0])}))))}),it("should return an error if the frame is without index",()=>{const x=r[0].slice(2,4),e=a.handleFrame(x);expect(e).toEqual(l(new u("Unable to parse header from apdu")))}),it("should return an error if the frame is without datasize",()=>{const x=r[0].slice(2,6),e=a.handleFrame(x);expect(e).toEqual(l(new u("Unable to parse header from apdu")))})})});
1
+ import{Just as t,Left as l,Nothing as c,Right as d}from"purify-ts";import{ApduResponse as s}from"../../../api/device-session/ApduResponse";import{ReceiverApduError as u}from"../../device-session/model/Errors";import{DefaultLoggerPublisherService as b}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{DefaultApduReceiverService as f}from"./DefaultApduReceiverService";vi.mock("uuid");const h=new b([],"frame"),o=new Uint8Array([170,170,5,0,0,0,33,51,0,0,4,5,50,46,50,46,51,4,230,0,0,0,4,50,46,51,48,4,49,46,49,54,1,1,1,0,1,0,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),m=new Uint8Array([170,170,5,0,0,0,2,85,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),r=[new Uint8Array([170,170,5,0,0,0,158,1,77,0,19,202,80,250,161,145,64,154,107,250,108,15,187,178,231,196,169,207,229,87,65,0,93,189,132,171,154,189,102,199,108,144,221,8,121,13,8,71,185,58,143,167,111,96,51,174,211,37,215,177,229,124,235,215]),new Uint8Array([170,170,5,0,1,75,46,44,159,180,70,120,222,5,95,158,128,10,7,66,105,116,99,111,105,110,78,0,21,202,64,6,3,40,248,143,198,214,66,152,208,73,0,199,4,152,25,27,108,235,237,216,203,132,93,245,75,227,189,187,37,122,63,111]),new Uint8Array([170,170,5,0,2,104,143,84,239,127,170,196,34,170,84,231,184,10,200,163,47,150,229,94,67,45,243,163,69,141,142,170,241,78,209,30,8,69,116,104,101,114,101,117,109,144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])];describe("DefaultApduReceiverService",()=>{let a;beforeAll(()=>{vi.mock("uuid",()=>({v4:vi.fn().mockReturnValue("42")}))}),describe("without dataSize",()=>{beforeEach(()=>{a=new f({channel:t(new Uint8Array([170,170]))},()=>h)}),it("should return a left error when the first frame has no dataSize",()=>{const x=r[1],e=a.handleFrame(x);expect(e).toEqual(l(new u))})}),describe("[USB] With padding and channel",()=>{beforeEach(()=>{a=new f({channel:t(new Uint8Array([170,170]))},()=>h)}),it("should return a response directly when a frame is complete",()=>{const x=o,e=a.handleFrame(x);expect(e).toEqual(d(t(new s({data:o.slice(7,38),statusCode:new Uint8Array([144,0])}))))}),it("should return a response on a third frame when the two first are not complete",()=>{const x=[...r];let e=c;const n=[];for(;e.isNothing();){const i=x.shift();a.handleFrame(i).map(p=>{e=p,n.push(e)})}expect(n).toEqual([c,c,t(new s({data:new Uint8Array([...Array.from(r[0].slice(7)),...Array.from(r[1].slice(5)),...Array.from(r[2]).slice(5,45)]),statusCode:new Uint8Array([144,0])}))])}),it("should return two response directly when each frame is complete",()=>{const x=m,e=o,n=a.handleFrame(x),i=a.handleFrame(e);expect(n).toEqual(d(t(new s({data:new Uint8Array([]),statusCode:new Uint8Array([85,21])})))),expect(i).toEqual(d(t(new s({data:o.slice(7,38),statusCode:new Uint8Array([144,0])}))))}),it("should return an error if the frame is without index",()=>{const x=r[0].slice(0,4),e=a.handleFrame(x);expect(e).toEqual(l(new u("Unable to parse header from apdu")))}),it("should return an error if the frame is without datasize",()=>{const x=r[0].slice(0,6),e=a.handleFrame(x);expect(e).toEqual(l(new u("Unable to parse header from apdu")))})}),describe("[BLE] Without padding nor channel",()=>{beforeEach(()=>{a=new f({},()=>h)}),it("should return a response directly when a frame is complete",()=>{const x=o.slice(2,40),e=a.handleFrame(x);expect(e).toEqual(d(t(new s({data:o.slice(7,38),statusCode:new Uint8Array([144,0])}))))}),it("should return a response on a third frame when the two first are not complete",()=>{const x=[r[0].slice(2),r[1].slice(2),r[2].slice(2,47)];let e=c;const n=[];for(;e.isNothing();){const i=x.shift();a.handleFrame(i).map(p=>{e=p,n.push(e)})}expect(n).toEqual([c,c,t(new s({data:new Uint8Array([...Array.from(r[0].slice(7)),...Array.from(r[1].slice(5)),...Array.from(r[2]).slice(5,45)]),statusCode:new Uint8Array([144,0])}))])}),it("should return two response directly when each frame is complete",()=>{const x=m.slice(2,9),e=o.slice(2,40),n=a.handleFrame(x),i=a.handleFrame(e);expect(n).toEqual(d(t(new s({data:new Uint8Array([]),statusCode:new Uint8Array([85,21])})))),expect(i).toEqual(d(t(new s({data:o.slice(7,38),statusCode:new Uint8Array([144,0])}))))}),it("should return an error if the frame is without index",()=>{const x=r[0].slice(2,4),e=a.handleFrame(x);expect(e).toEqual(l(new u("Unable to parse header from apdu")))}),it("should return an error if the frame is without datasize",()=>{const x=r[0].slice(2,6),e=a.handleFrame(x);expect(e).toEqual(l(new u("Unable to parse header from apdu")))})})});
2
2
  //# sourceMappingURL=DefaultApduReceiverService.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/service/DefaultApduReceiverService.test.ts"],
4
- "sourcesContent": ["jest.mock(\"uuid\");\n\nimport { Just, Left, type Maybe, Nothing, Right } from \"purify-ts\";\n\nimport { ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type ApduReceiverService } from \"@api/device-session/service/ApduReceiverService\";\nimport { ReceiverApduError } from \"@internal/device-session/model/Errors\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\n\nimport { DefaultApduReceiverService } from \"./DefaultApduReceiverService\";\n\nconst loggerService = new DefaultLoggerPublisherService([], \"frame\");\n\nconst RESPONSE_GET_VERSION = new Uint8Array([\n 0xaa, 0xaa, 0x05, 0x00, 0x00, 0x00, 0x21, 0x33, 0x00, 0x00, 0x04, 0x05, 0x32,\n 0x2e, 0x32, 0x2e, 0x33, 0x04, 0xe6, 0x00, 0x00, 0x00, 0x04, 0x32, 0x2e, 0x33,\n 0x30, 0x04, 0x31, 0x2e, 0x31, 0x36, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x90,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n]);\n\nconst RESPONSE_LOCKED_DEVICE = new Uint8Array([\n 0xaa, 0xaa, 0x05, 0x00, 0x00, 0x00, 0x02, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n]);\n\nconst RESPONSE_LIST_APPS = [\n new Uint8Array([\n 0xaa, 0xaa, 0x05, 0x00, 0x00, 0x00, 0x9e, 0x01, 0x4d, 0x00, 0x13, 0xca,\n 0x50, 0xfa, 0xa1, 0x91, 0x40, 0x9a, 0x6b, 0xfa, 0x6c, 0x0f, 0xbb, 0xb2,\n 0xe7, 0xc4, 0xa9, 0xcf, 0xe5, 0x57, 0x41, 0x00, 0x5d, 0xbd, 0x84, 0xab,\n 0x9a, 0xbd, 0x66, 0xc7, 0x6c, 0x90, 0xdd, 0x08, 0x79, 0x0d, 0x08, 0x47,\n 0xb9, 0x3a, 0x8f, 0xa7, 0x6f, 0x60, 0x33, 0xae, 0xd3, 0x25, 0xd7, 0xb1,\n 0xe5, 0x7c, 0xeb, 0xd7,\n ]),\n new Uint8Array([\n 0xaa, 0xaa, 0x05, 0x00, 0x01, 0x4b, 0x2e, 0x2c, 0x9f, 0xb4, 0x46, 0x78,\n 0xde, 0x05, 0x5f, 0x9e, 0x80, 0x0a, 0x07, 0x42, 0x69, 0x74, 0x63, 0x6f,\n 0x69, 0x6e, 0x4e, 0x00, 0x15, 0xca, 0x40, 0x06, 0x03, 0x28, 0xf8, 0x8f,\n 0xc6, 0xd6, 0x42, 0x98, 0xd0, 0x49, 0x00, 0xc7, 0x04, 0x98, 0x19, 0x1b,\n 0x6c, 0xeb, 0xed, 0xd8, 0xcb, 0x84, 0x5d, 0xf5, 0x4b, 0xe3, 0xbd, 0xbb,\n 0x25, 0x7a, 0x3f, 0x6f,\n ]),\n new Uint8Array([\n 0xaa, 0xaa, 0x05, 0x00, 0x02, 0x68, 0x8f, 0x54, 0xef, 0x7f, 0xaa, 0xc4,\n 0x22, 0xaa, 0x54, 0xe7, 0xb8, 0x0a, 0xc8, 0xa3, 0x2f, 0x96, 0xe5, 0x5e,\n 0x43, 0x2d, 0xf3, 0xa3, 0x45, 0x8d, 0x8e, 0xaa, 0xf1, 0x4e, 0xd1, 0x1e,\n 0x08, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x90, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00,\n ]),\n];\n\ndescribe(\"DefaultApduReceiverService\", () => {\n let service: ApduReceiverService;\n\n beforeAll(() => {\n jest.mock(\"uuid\", () => ({\n v4: jest.fn().mockReturnValue(\"42\"),\n }));\n });\n\n describe(\"without dataSize\", () => {\n beforeEach(() => {\n service = new DefaultApduReceiverService(\n { channel: Just(new Uint8Array([0xaa, 0xaa])) },\n () => loggerService,\n );\n });\n\n it(\"should return a left error when the first frame has no dataSize\", () => {\n //given\n const frame = RESPONSE_LIST_APPS[1]!;\n\n //when\n const apdu = service.handleFrame(frame);\n\n //then\n expect(apdu).toEqual(Left(new ReceiverApduError()));\n });\n });\n\n describe(\"[USB] With padding and channel\", () => {\n beforeEach(() => {\n service = new DefaultApduReceiverService(\n { channel: Just(new Uint8Array([0xaa, 0xaa])) },\n () => loggerService,\n );\n });\n\n it(\"should return a response directly when a frame is complete\", () => {\n // given\n const frame = RESPONSE_GET_VERSION;\n\n // when\n const apdu = service.handleFrame(frame);\n\n // then\n expect(apdu).toEqual(\n Right(\n Just(\n new ApduResponse({\n data: RESPONSE_GET_VERSION.slice(7, 38),\n statusCode: new Uint8Array([0x90, 0x00]),\n }),\n ),\n ),\n );\n });\n\n it(\"should return a response on a third frame when the two first are not complete\", () => {\n //given\n const apdus = [...RESPONSE_LIST_APPS];\n\n //when\n let response: Maybe<ApduResponse> = Nothing;\n const responses: Maybe<ApduResponse>[] = [];\n while (response.isNothing()) {\n const apdu = apdus.shift()!;\n const either = service.handleFrame(apdu);\n\n either.map((value) => {\n response = value;\n responses.push(response);\n });\n }\n\n //then\n expect(responses).toEqual([\n Nothing,\n Nothing,\n Just(\n new ApduResponse({\n data: new Uint8Array([\n ...Array.from(RESPONSE_LIST_APPS[0]!.slice(7)),\n ...Array.from(RESPONSE_LIST_APPS[1]!.slice(5)),\n ...Array.from(RESPONSE_LIST_APPS[2]!).slice(5, 45),\n ]),\n statusCode: new Uint8Array([0x90, 0x00]),\n }),\n ),\n ]);\n });\n\n it(\"should return two response directly when each frame is complete\", () => {\n // given\n const firstFrame = RESPONSE_LOCKED_DEVICE;\n const secondFrame = RESPONSE_GET_VERSION;\n\n // when\n const firstResponse = service.handleFrame(firstFrame);\n const secondResponse = service.handleFrame(secondFrame);\n\n // then\n expect(firstResponse).toEqual(\n Right(\n Just(\n new ApduResponse({\n data: new Uint8Array([]),\n statusCode: new Uint8Array([0x55, 0x15]),\n }),\n ),\n ),\n );\n expect(secondResponse).toEqual(\n Right(\n Just(\n new ApduResponse({\n data: RESPONSE_GET_VERSION.slice(7, 38),\n statusCode: new Uint8Array([0x90, 0x00]),\n }),\n ),\n ),\n );\n });\n\n it(\"should return an error if the frame is without index\", () => {\n //given\n //frame with channelId, headTag, and partial Index only\n const frame = RESPONSE_LIST_APPS[0]!.slice(0, 4);\n\n //when\n const apdu = service.handleFrame(frame);\n\n //then\n expect(apdu).toEqual(\n Left(new ReceiverApduError(\"Unable to parse header from apdu\")),\n );\n });\n\n it(\"should return an error if the frame is without datasize\", () => {\n //given\n //frame with channelId, headTag, and Index and partial dataSize only\n const frame = RESPONSE_LIST_APPS[0]!.slice(0, 6);\n\n //when\n const apdu = service.handleFrame(frame);\n\n //then\n expect(apdu).toEqual(\n Left(new ReceiverApduError(\"Unable to parse header from apdu\")),\n );\n });\n });\n\n describe(\"[BLE] Without padding nor channel\", () => {\n beforeEach(() => {\n service = new DefaultApduReceiverService({}, () => loggerService);\n });\n\n it(\"should return a response directly when a frame is complete\", () => {\n // given\n const frame = RESPONSE_GET_VERSION.slice(2, 40);\n\n // when\n const apdu = service.handleFrame(frame);\n\n // then\n expect(apdu).toEqual(\n Right(\n Just(\n new ApduResponse({\n data: RESPONSE_GET_VERSION.slice(7, 38),\n statusCode: new Uint8Array([0x90, 0x00]),\n }),\n ),\n ),\n );\n });\n\n it(\"should return a response on a third frame when the two first are not complete\", () => {\n //given\n const apdus = [\n RESPONSE_LIST_APPS[0]!.slice(2),\n RESPONSE_LIST_APPS[1]!.slice(2),\n RESPONSE_LIST_APPS[2]!.slice(2, 47),\n ];\n\n //when\n let response: Maybe<ApduResponse> = Nothing;\n const responses: Maybe<ApduResponse>[] = [];\n while (response.isNothing()) {\n const apdu = apdus.shift()!;\n const either = service.handleFrame(apdu);\n\n either.map((value) => {\n response = value;\n responses.push(response);\n });\n }\n\n //then\n expect(responses).toEqual([\n Nothing,\n Nothing,\n Just(\n new ApduResponse({\n data: new Uint8Array([\n ...Array.from(RESPONSE_LIST_APPS[0]!.slice(7)),\n ...Array.from(RESPONSE_LIST_APPS[1]!.slice(5)),\n ...Array.from(RESPONSE_LIST_APPS[2]!).slice(5, 45),\n ]),\n statusCode: new Uint8Array([0x90, 0x00]),\n }),\n ),\n ]);\n });\n\n it(\"should return two response directly when each frame is complete\", () => {\n // given\n const firstFrame = RESPONSE_LOCKED_DEVICE.slice(2, 9);\n const secondFrame = RESPONSE_GET_VERSION.slice(2, 40);\n\n // when\n const firstResponse = service.handleFrame(firstFrame);\n const secondResponse = service.handleFrame(secondFrame);\n\n // then\n expect(firstResponse).toEqual(\n Right(\n Just(\n new ApduResponse({\n data: new Uint8Array([]),\n statusCode: new Uint8Array([0x55, 0x15]),\n }),\n ),\n ),\n );\n expect(secondResponse).toEqual(\n Right(\n Just(\n new ApduResponse({\n data: RESPONSE_GET_VERSION.slice(7, 38),\n statusCode: new Uint8Array([0x90, 0x00]),\n }),\n ),\n ),\n );\n });\n\n it(\"should return an error if the frame is without index\", () => {\n //given\n //frame with channelId, headTag, and partial Index only\n const frame = RESPONSE_LIST_APPS[0]!.slice(2, 4);\n\n //when\n const apdu = service.handleFrame(frame);\n\n //then\n expect(apdu).toEqual(\n Left(new ReceiverApduError(\"Unable to parse header from apdu\")),\n );\n });\n\n it(\"should return an error if the frame is without datasize\", () => {\n //given\n //frame with channelId, headTag, and Index and partial dataSize only\n const frame = RESPONSE_LIST_APPS[0]!.slice(2, 6);\n\n //when\n const apdu = service.handleFrame(frame);\n\n //then\n expect(apdu).toEqual(\n Left(new ReceiverApduError(\"Unable to parse header from apdu\")),\n );\n });\n });\n});\n"],
5
- "mappings": "AAEA,OAAS,QAAAA,EAAM,QAAAC,EAAkB,WAAAC,EAAS,SAAAC,MAAa,YAEvD,OAAS,gBAAAC,MAAoB,mCAE7B,OAAS,qBAAAC,MAAyB,wCAClC,OAAS,iCAAAC,MAAqC,mEAE9C,OAAS,8BAAAC,MAAkC,+BAT3C,KAAK,KAAK,MAAM,EAWhB,MAAMC,EAAgB,IAAIF,EAA8B,CAAC,EAAG,OAAO,EAE7DG,EAAuB,IAAI,WAAW,CAC1C,IAAM,IAAM,EAAM,EAAM,EAAM,EAAM,GAAM,GAAM,EAAM,EAAM,EAAM,EAAM,GACxE,GAAM,GAAM,GAAM,GAAM,EAAM,IAAM,EAAM,EAAM,EAAM,EAAM,GAAM,GAAM,GACxE,GAAM,EAAM,GAAM,GAAM,GAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,IACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CACxD,CAAC,EAEKC,EAAyB,IAAI,WAAW,CAC5C,IAAM,IAAM,EAAM,EAAM,EAAM,EAAM,EAAM,GAAM,GAAM,EAAM,EAAM,EAAM,EACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,E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import { Just, Left, type Maybe, Nothing, Right } from \"purify-ts\";\n\nimport { ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type ApduReceiverService } from \"@api/device-session/service/ApduReceiverService\";\nimport { ReceiverApduError } from \"@internal/device-session/model/Errors\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\n\nimport { DefaultApduReceiverService } from \"./DefaultApduReceiverService\";\n\nconst loggerService = new DefaultLoggerPublisherService([], \"frame\");\n\nconst RESPONSE_GET_VERSION = new Uint8Array([\n 0xaa, 0xaa, 0x05, 0x00, 0x00, 0x00, 0x21, 0x33, 0x00, 0x00, 0x04, 0x05, 0x32,\n 0x2e, 0x32, 0x2e, 0x33, 0x04, 0xe6, 0x00, 0x00, 0x00, 0x04, 0x32, 0x2e, 0x33,\n 0x30, 0x04, 0x31, 0x2e, 0x31, 0x36, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x90,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n]);\n\nconst RESPONSE_LOCKED_DEVICE = new Uint8Array([\n 0xaa, 0xaa, 0x05, 0x00, 0x00, 0x00, 0x02, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n]);\n\nconst RESPONSE_LIST_APPS = [\n new Uint8Array([\n 0xaa, 0xaa, 0x05, 0x00, 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00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00,\n ]),\n];\n\ndescribe(\"DefaultApduReceiverService\", () => {\n let service: ApduReceiverService;\n\n beforeAll(() => {\n vi.mock(\"uuid\", () => ({\n v4: vi.fn().mockReturnValue(\"42\"),\n }));\n });\n\n describe(\"without dataSize\", () => {\n beforeEach(() => {\n service = new DefaultApduReceiverService(\n { channel: Just(new Uint8Array([0xaa, 0xaa])) },\n () => loggerService,\n );\n });\n\n it(\"should return a left error when the first frame has no dataSize\", () => {\n //given\n const frame = RESPONSE_LIST_APPS[1]!;\n\n //when\n const apdu = service.handleFrame(frame);\n\n //then\n expect(apdu).toEqual(Left(new ReceiverApduError()));\n });\n });\n\n describe(\"[USB] With padding and channel\", () => {\n beforeEach(() => {\n service = new DefaultApduReceiverService(\n { channel: Just(new Uint8Array([0xaa, 0xaa])) },\n () => loggerService,\n );\n });\n\n it(\"should return a response directly when a frame is complete\", () => {\n // given\n const frame = RESPONSE_GET_VERSION;\n\n // when\n const apdu = service.handleFrame(frame);\n\n // then\n expect(apdu).toEqual(\n Right(\n Just(\n new ApduResponse({\n data: RESPONSE_GET_VERSION.slice(7, 38),\n statusCode: new Uint8Array([0x90, 0x00]),\n }),\n ),\n ),\n );\n });\n\n it(\"should return a response on a third frame when the two first are not complete\", () => {\n //given\n const apdus = [...RESPONSE_LIST_APPS];\n\n //when\n let response: Maybe<ApduResponse> = Nothing;\n const responses: Maybe<ApduResponse>[] = [];\n while (response.isNothing()) {\n const apdu = apdus.shift()!;\n const either = service.handleFrame(apdu);\n\n either.map((value) => {\n response = value;\n responses.push(response);\n });\n }\n\n //then\n expect(responses).toEqual([\n Nothing,\n Nothing,\n Just(\n new ApduResponse({\n data: new Uint8Array([\n ...Array.from(RESPONSE_LIST_APPS[0]!.slice(7)),\n ...Array.from(RESPONSE_LIST_APPS[1]!.slice(5)),\n ...Array.from(RESPONSE_LIST_APPS[2]!).slice(5, 45),\n ]),\n statusCode: new Uint8Array([0x90, 0x00]),\n }),\n ),\n ]);\n });\n\n it(\"should return two response directly when each frame is complete\", () => {\n // given\n const firstFrame = RESPONSE_LOCKED_DEVICE;\n const secondFrame = RESPONSE_GET_VERSION;\n\n // when\n const firstResponse = service.handleFrame(firstFrame);\n const secondResponse = service.handleFrame(secondFrame);\n\n // then\n expect(firstResponse).toEqual(\n Right(\n Just(\n new ApduResponse({\n data: new Uint8Array([]),\n statusCode: new Uint8Array([0x55, 0x15]),\n }),\n ),\n ),\n );\n expect(secondResponse).toEqual(\n Right(\n Just(\n new ApduResponse({\n data: RESPONSE_GET_VERSION.slice(7, 38),\n statusCode: new Uint8Array([0x90, 0x00]),\n }),\n ),\n ),\n );\n });\n\n it(\"should return an error if the frame is without index\", () => {\n //given\n //frame with channelId, headTag, and partial Index only\n const frame = RESPONSE_LIST_APPS[0]!.slice(0, 4);\n\n //when\n const apdu = service.handleFrame(frame);\n\n //then\n expect(apdu).toEqual(\n Left(new ReceiverApduError(\"Unable to parse header from apdu\")),\n );\n });\n\n it(\"should return an error if the frame is without datasize\", () => {\n //given\n //frame with channelId, headTag, and Index and partial dataSize only\n const frame = RESPONSE_LIST_APPS[0]!.slice(0, 6);\n\n //when\n const apdu = service.handleFrame(frame);\n\n //then\n expect(apdu).toEqual(\n Left(new ReceiverApduError(\"Unable to parse header from apdu\")),\n );\n });\n });\n\n describe(\"[BLE] Without padding nor channel\", () => {\n beforeEach(() => {\n service = new DefaultApduReceiverService({}, () => loggerService);\n });\n\n it(\"should return a response directly when a frame is complete\", () => {\n // given\n const frame = RESPONSE_GET_VERSION.slice(2, 40);\n\n // when\n const apdu = service.handleFrame(frame);\n\n // then\n expect(apdu).toEqual(\n Right(\n Just(\n new ApduResponse({\n data: RESPONSE_GET_VERSION.slice(7, 38),\n statusCode: new Uint8Array([0x90, 0x00]),\n }),\n ),\n ),\n );\n });\n\n it(\"should return a response on a third frame when the two first are not complete\", () => {\n //given\n const apdus = [\n RESPONSE_LIST_APPS[0]!.slice(2),\n RESPONSE_LIST_APPS[1]!.slice(2),\n RESPONSE_LIST_APPS[2]!.slice(2, 47),\n ];\n\n //when\n let response: Maybe<ApduResponse> = Nothing;\n const responses: Maybe<ApduResponse>[] = [];\n while (response.isNothing()) {\n const apdu = apdus.shift()!;\n const either = service.handleFrame(apdu);\n\n either.map((value) => {\n response = value;\n responses.push(response);\n });\n }\n\n //then\n expect(responses).toEqual([\n Nothing,\n Nothing,\n Just(\n new ApduResponse({\n data: new Uint8Array([\n ...Array.from(RESPONSE_LIST_APPS[0]!.slice(7)),\n ...Array.from(RESPONSE_LIST_APPS[1]!.slice(5)),\n ...Array.from(RESPONSE_LIST_APPS[2]!).slice(5, 45),\n ]),\n statusCode: new Uint8Array([0x90, 0x00]),\n }),\n ),\n ]);\n });\n\n it(\"should return two response directly when each frame is complete\", () => {\n // given\n const firstFrame = RESPONSE_LOCKED_DEVICE.slice(2, 9);\n const secondFrame = RESPONSE_GET_VERSION.slice(2, 40);\n\n // when\n const firstResponse = service.handleFrame(firstFrame);\n const secondResponse = service.handleFrame(secondFrame);\n\n // then\n expect(firstResponse).toEqual(\n Right(\n Just(\n new ApduResponse({\n data: new Uint8Array([]),\n statusCode: new Uint8Array([0x55, 0x15]),\n }),\n ),\n ),\n );\n expect(secondResponse).toEqual(\n Right(\n Just(\n new ApduResponse({\n data: RESPONSE_GET_VERSION.slice(7, 38),\n statusCode: new Uint8Array([0x90, 0x00]),\n }),\n ),\n ),\n );\n });\n\n it(\"should return an error if the frame is without index\", () => {\n //given\n //frame with channelId, headTag, and partial Index only\n const frame = RESPONSE_LIST_APPS[0]!.slice(2, 4);\n\n //when\n const apdu = service.handleFrame(frame);\n\n //then\n expect(apdu).toEqual(\n Left(new ReceiverApduError(\"Unable to parse header from apdu\")),\n );\n });\n\n it(\"should return an error if the frame is without datasize\", () => {\n //given\n //frame with channelId, headTag, and Index and partial dataSize only\n const frame = RESPONSE_LIST_APPS[0]!.slice(2, 6);\n\n //when\n const apdu = service.handleFrame(frame);\n\n //then\n expect(apdu).toEqual(\n Left(new ReceiverApduError(\"Unable to parse header from apdu\")),\n );\n });\n });\n});\n"],
5
+ "mappings": "AAEA,OAAS,QAAAA,EAAM,QAAAC,EAAkB,WAAAC,EAAS,SAAAC,MAAa,YAEvD,OAAS,gBAAAC,MAAoB,mCAE7B,OAAS,qBAAAC,MAAyB,wCAClC,OAAS,iCAAAC,MAAqC,mEAE9C,OAAS,8BAAAC,MAAkC,+BAT3C,GAAG,KAAK,MAAM,EAWd,MAAMC,EAAgB,IAAIF,EAA8B,CAAC,EAAG,OAAO,EAE7DG,EAAuB,IAAI,WAAW,CAC1C,IAAM,IAAM,EAAM,EAAM,EAAM,EAAM,GAAM,GAAM,EAAM,EAAM,EAAM,EAAM,GACxE,GAAM,GAAM,GAAM,GAAM,EAAM,IAAM,EAAM,EAAM,EAAM,EAAM,GAAM,GAAM,GACxE,GAAM,EAAM,GAAM,GAAM,GAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,IACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CACxD,CAAC,EAEKC,EAAyB,IAAI,WAAW,CAC5C,IAAM,IAAM,EAAM,EAAM,EAAM,EAAM,EAAM,GAAM,GAAM,EAAM,EAAM,EAAM,EACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EACxE,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAClD,CAAC,EAEKC,EAAqB,CACzB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IAAM,CAE1E,MAAMQ,EAAaT,EAAuB,MAAM,EAAG,CAAC,EAC9CU,EAAcX,EAAqB,MAAM,EAAG,EAAE,EAG9CY,EAAgBT,EAAQ,YAAYO,CAAU,EAC9CG,EAAiBV,EAAQ,YAAYQ,CAAW,EAGtD,OAAOC,CAAa,EAAE,QACpBlB,EACEH,EACE,IAAII,EAAa,CACf,KAAM,IAAI,WAAW,CAAC,CAAC,EACvB,WAAY,IAAI,WAAW,CAAC,GAAM,EAAI,CAAC,CACzC,CAAC,CACH,CACF,CACF,EACA,OAAOkB,CAAc,EAAE,QACrBnB,EACEH,EACE,IAAII,EAAa,CACf,KAAMK,EAAqB,MAAM,EAAG,EAAE,EACtC,WAAY,IAAI,WAAW,CAAC,IAAM,CAAI,CAAC,CACzC,CAAC,CACH,CACF,CACF,CACF,CAAC,EAED,GAAG,uDAAwD,IAAM,CAG/D,MAAMI,EAAQF,EAAmB,CAAC,EAAG,MAAM,EAAG,CAAC,EAGzCG,EAAOF,EAAQ,YAAYC,CAAK,EAGtC,OAAOC,CAAI,EAAE,QACXb,EAAK,IAAII,EAAkB,kCAAkC,CAAC,CAChE,CACF,CAAC,EAED,GAAG,0DAA2D,IAAM,CAGlE,MAAMQ,EAAQF,EAAmB,CAAC,EAAG,MAAM,EAAG,CAAC,EAGzCG,EAAOF,EAAQ,YAAYC,CAAK,EAGtC,OAAOC,CAAI,EAAE,QACXb,EAAK,IAAII,EAAkB,kCAAkC,CAAC,CAChE,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["Just", "Left", "Nothing", "Right", "ApduResponse", "ReceiverApduError", "DefaultLoggerPublisherService", "DefaultApduReceiverService", "loggerService", "RESPONSE_GET_VERSION", "RESPONSE_LOCKED_DEVICE", "RESPONSE_LIST_APPS", "service", "frame", "apdu", "apdus", "response", "responses", "value", "firstFrame", "secondFrame", "firstResponse", "secondResponse"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Maybe as x}from"purify-ts";import{Frame as t}from"../../device-session/model/Frame";import{FrameHeader as i}from"../../device-session/model/FrameHeader";import{DefaultLoggerPublisherService as w}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{DefaultApduSenderService as d}from"./DefaultApduSenderService";jest.mock("uuid",()=>({v4:jest.fn().mockReturnValue("42")}));const o=new w([],"frame");describe("DefaultApduSenderService",()=>{describe("[USB] With padding and channel",()=>{it("should return 1 frame",()=>{const n=x.of(new Uint8Array([18,52])),a=new d({frameSize:64,padding:!0,channel:n},()=>o),e=new Uint8Array([224,1,0,0,0]),r=a.getFrames(e);expect(r).toEqual([new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,5])),index:new Uint8Array([0,0]),length:7}),data:new Uint8Array([224,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])})]),expect(r.map(c=>c.getRawData())).toEqual([new Uint8Array([18,52,5,0,0,0,5,224,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])])}),it("should return 2 frames",()=>{const n=x.of(new Uint8Array([18,52])),a=new d({frameSize:64,padding:!0,channel:n},()=>o),e=new Uint8Array([224,212,0,0,64,84,111,102,117,73,115,78,117,116,114,105,116,105,111,117,115,65,110,100,66,114,105,110,103,115,74,111,121,68,101,108,105,103,104,116,72,101,97,108,116,104,105,110,101,115,115,72,97,114,109,111,110,121,73,110,69,118,101,114,121,66,105,116,101]),r=a.getFrames(e);expect(r).toEqual([new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,69])),index:new Uint8Array([0,0]),length:7}),data:new Uint8Array([224,212,0,0,64,84,111,102,117,73,115,78,117,116,114,105,116,105,111,117,115,65,110,100,66,114,105,110,103,115,74,111,121,68,101,108,105,103,104,116,72,101,97,108,116,104,105,110,101,115,115,72,97,114,109,111,110])}),new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),index:new Uint8Array([0,1]),length:5,dataSize:x.zero()}),data:new Uint8Array([121,73,110,69,118,101,114,121,66,105,116,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])})]),expect(r.map(c=>c.getRawData())).toEqual([new Uint8Array([18,52,5,0,0,0,69,224,212,0,0,64,84,111,102,117,73,115,78,117,116,114,105,116,105,111,117,115,65,110,100,66,114,105,110,103,115,74,111,121,68,101,108,105,103,104,116,72,101,97,108,116,104,105,110,101,115,115,72,97,114,109,111,110]),new Uint8Array([18,52,5,0,1,121,73,110,69,118,101,114,121,66,105,116,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])])})}),describe("[BLE] Without padding nor channel",()=>{it("should return 1 frame",()=>{const n=new d({frameSize:123},()=>o),a=new Uint8Array([224,1,0,0,0]),e=n.getFrames(a);expect(e).toEqual([new t({header:new i({uuid:"42",channel:x.zero(),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,5])),index:new Uint8Array([0,0]),length:5}),data:new Uint8Array([224,1,0,0,0])})]),expect(e.map(r=>r.getRawData())).toEqual([new Uint8Array([5,0,0,0,5,224,1,0,0,0])])}),it("should return 3 frames",()=>{const n=new d({frameSize:10},()=>o),a=new Uint8Array([1,5,79,76,79,83,0,7,46,50,46,52,45,50,0,144,0]),e=n.getFrames(a);expect(e).toEqual([new t({header:new i({uuid:"42",channel:x.zero(),headTag:new Uint8Array([5]),index:new Uint8Array([0,0]),dataSize:x.of(new Uint8Array([0,17])),length:5}),data:new Uint8Array([1,5,79,76,79])}),new t({header:new i({uuid:"42",channel:x.zero(),headTag:new Uint8Array([5]),dataSize:x.zero(),index:new Uint8Array([0,1]),length:3}),data:new Uint8Array([83,0,7,46,50,46,52])}),new t({header:new i({uuid:"42",channel:x.zero(),headTag:new Uint8Array([5]),dataSize:x.zero(),index:new Uint8Array([0,2]),length:3}),data:new Uint8Array([45,50,0,144,0])})]),expect(e.map(r=>r.getRawData())).toEqual([new Uint8Array([5,0,0,0,17,1,5,79,76,79]),new Uint8Array([5,0,1,83,0,7,46,50,46,52]),new Uint8Array([5,0,2,45,50,0,144,0])])})}),describe("Errors",()=>{it("should return a well formatted header with very big channel",()=>{const n=new d({frameSize:64,channel:x.of(new Uint8Array([1193012,214084,353364,30788,590916]))},()=>o),a=new Uint8Array([224,1,0,0,0]),e=n.getFrames(a);expect(e).toEqual([new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([68,68])),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,5])),index:new Uint8Array([0,0]),length:7}),data:new Uint8Array([224,1,0,0,0])})]),expect(e.map(r=>r.getRawData())).toEqual([new Uint8Array([68,68,5,0,0,0,5,224,1,0,0,0])])}),it("should return empty if packet size smaller than header size",()=>{const n=new d({frameSize:Math.random()&4,channel:x.of(new Uint8Array([18,52]))},()=>o),a=new Uint8Array([224,1,0,0,0]),e=n.getFrames(a);expect(e.length).toEqual(0)}),it("should return empty if no apdu length",()=>{const n=new d({frameSize:Math.random()&255,padding:Math.random()>.5,channel:x.of(new Uint8Array([18,52]))},()=>o),a=new Uint8Array([]),e=n.getFrames(a);expect(e.length).toEqual(0)})})});
1
+ import{Maybe as x}from"purify-ts";import{Frame as t}from"../../device-session/model/Frame";import{FrameHeader as i}from"../../device-session/model/FrameHeader";import{DefaultLoggerPublisherService as w}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{DefaultApduSenderService as d}from"./DefaultApduSenderService";vi.mock("uuid",()=>({v4:vi.fn().mockReturnValue("42")}));const o=new w([],"frame");describe("DefaultApduSenderService",()=>{describe("[USB] With padding and channel",()=>{it("should return 1 frame",()=>{const n=x.of(new Uint8Array([18,52])),a=new d({frameSize:64,padding:!0,channel:n},()=>o),e=new Uint8Array([224,1,0,0,0]),r=a.getFrames(e);expect(r).toEqual([new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,5])),index:new Uint8Array([0,0]),length:7}),data:new Uint8Array([224,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])})]),expect(r.map(c=>c.getRawData())).toEqual([new Uint8Array([18,52,5,0,0,0,5,224,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])])}),it("should return 2 frames",()=>{const n=x.of(new Uint8Array([18,52])),a=new d({frameSize:64,padding:!0,channel:n},()=>o),e=new Uint8Array([224,212,0,0,64,84,111,102,117,73,115,78,117,116,114,105,116,105,111,117,115,65,110,100,66,114,105,110,103,115,74,111,121,68,101,108,105,103,104,116,72,101,97,108,116,104,105,110,101,115,115,72,97,114,109,111,110,121,73,110,69,118,101,114,121,66,105,116,101]),r=a.getFrames(e);expect(r).toEqual([new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,69])),index:new Uint8Array([0,0]),length:7}),data:new Uint8Array([224,212,0,0,64,84,111,102,117,73,115,78,117,116,114,105,116,105,111,117,115,65,110,100,66,114,105,110,103,115,74,111,121,68,101,108,105,103,104,116,72,101,97,108,116,104,105,110,101,115,115,72,97,114,109,111,110])}),new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),index:new Uint8Array([0,1]),length:5,dataSize:x.zero()}),data:new Uint8Array([121,73,110,69,118,101,114,121,66,105,116,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])})]),expect(r.map(c=>c.getRawData())).toEqual([new Uint8Array([18,52,5,0,0,0,69,224,212,0,0,64,84,111,102,117,73,115,78,117,116,114,105,116,105,111,117,115,65,110,100,66,114,105,110,103,115,74,111,121,68,101,108,105,103,104,116,72,101,97,108,116,104,105,110,101,115,115,72,97,114,109,111,110]),new Uint8Array([18,52,5,0,1,121,73,110,69,118,101,114,121,66,105,116,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])])})}),describe("[BLE] Without padding nor channel",()=>{it("should return 1 frame",()=>{const n=new d({frameSize:123},()=>o),a=new Uint8Array([224,1,0,0,0]),e=n.getFrames(a);expect(e).toEqual([new t({header:new i({uuid:"42",channel:x.zero(),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,5])),index:new Uint8Array([0,0]),length:5}),data:new Uint8Array([224,1,0,0,0])})]),expect(e.map(r=>r.getRawData())).toEqual([new Uint8Array([5,0,0,0,5,224,1,0,0,0])])}),it("should return 3 frames",()=>{const n=new d({frameSize:10},()=>o),a=new Uint8Array([1,5,79,76,79,83,0,7,46,50,46,52,45,50,0,144,0]),e=n.getFrames(a);expect(e).toEqual([new t({header:new i({uuid:"42",channel:x.zero(),headTag:new Uint8Array([5]),index:new Uint8Array([0,0]),dataSize:x.of(new Uint8Array([0,17])),length:5}),data:new Uint8Array([1,5,79,76,79])}),new t({header:new i({uuid:"42",channel:x.zero(),headTag:new Uint8Array([5]),dataSize:x.zero(),index:new Uint8Array([0,1]),length:3}),data:new Uint8Array([83,0,7,46,50,46,52])}),new t({header:new i({uuid:"42",channel:x.zero(),headTag:new Uint8Array([5]),dataSize:x.zero(),index:new Uint8Array([0,2]),length:3}),data:new Uint8Array([45,50,0,144,0])})]),expect(e.map(r=>r.getRawData())).toEqual([new Uint8Array([5,0,0,0,17,1,5,79,76,79]),new Uint8Array([5,0,1,83,0,7,46,50,46,52]),new Uint8Array([5,0,2,45,50,0,144,0])])})}),describe("Errors",()=>{it("should return a well formatted header with very big channel",()=>{const n=new d({frameSize:64,channel:x.of(new Uint8Array([1193012,214084,353364,30788,590916]))},()=>o),a=new Uint8Array([224,1,0,0,0]),e=n.getFrames(a);expect(e).toEqual([new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([68,68])),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,5])),index:new Uint8Array([0,0]),length:7}),data:new Uint8Array([224,1,0,0,0])})]),expect(e.map(r=>r.getRawData())).toEqual([new Uint8Array([68,68,5,0,0,0,5,224,1,0,0,0])])}),it("should return empty if packet size smaller than header size",()=>{const n=new d({frameSize:Math.random()&4,channel:x.of(new Uint8Array([18,52]))},()=>o),a=new Uint8Array([224,1,0,0,0]),e=n.getFrames(a);expect(e.length).toEqual(0)}),it("should return empty if no apdu length",()=>{const n=new d({frameSize:Math.random()&255,padding:Math.random()>.5,channel:x.of(new Uint8Array([18,52]))},()=>o),a=new Uint8Array([]),e=n.getFrames(a);expect(e.length).toEqual(0)})})});
2
2
  //# sourceMappingURL=DefaultApduSenderService.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/service/DefaultApduSenderService.test.ts"],
4
- "sourcesContent": ["jest.mock(\"uuid\", () => ({\n v4: jest.fn().mockReturnValue(\"42\"),\n}));\n\nimport { Maybe } from \"purify-ts\";\n\nimport { Frame } from \"@internal/device-session/model/Frame\";\nimport { FrameHeader } from \"@internal/device-session/model/FrameHeader\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\n\nimport { DefaultApduSenderService } from \"./DefaultApduSenderService\";\n\nconst loggerService = new DefaultLoggerPublisherService([], \"frame\");\n\ndescribe(\"DefaultApduSenderService\", () => {\n describe(\"[USB] With padding and channel\", () => {\n it(\"should return 1 frame\", () => {\n // given\n const channel = Maybe.of(new Uint8Array([0x12, 0x34]));\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 64,\n padding: true,\n channel,\n },\n () => loggerService,\n );\n // getVersion APDU\n const apdu = new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\n // when\n const frames = apduSenderService.getFrames(apdu);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0, 0x05])),\n index: new Uint8Array([0, 0]),\n length: 7,\n }),\n data: new Uint8Array([\n 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00,\n ]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x12, 0x34, 0x05, 0x00, 0x00, 0x00, 0x05, 0xe0, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n ]),\n ]);\n });\n\n it(\"should return 2 frames\", () => {\n // given\n const channel = Maybe.of(new Uint8Array([0x12, 0x34]));\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 64,\n padding: true,\n channel,\n },\n () => loggerService,\n );\n const apdu = new Uint8Array([\n // editDeviceName APDU\n 0xe0, 0xd4, 0x00, 0x00, 0x40,\n // editDeviceNameData\n 0x54, 0x6f, 0x66, 0x75, 0x49, 0x73, 0x4e, 0x75, 0x74, 0x72, 0x69, 0x74,\n 0x69, 0x6f, 0x75, 0x73, 0x41, 0x6e, 0x64, 0x42, 0x72, 0x69, 0x6e, 0x67,\n 0x73, 0x4a, 0x6f, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x48,\n 0x65, 0x61, 0x6c, 0x74, 0x68, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x48, 0x61,\n 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x49, 0x6e, 0x45, 0x76, 0x65, 0x72, 0x79,\n 0x42, 0x69, 0x74, 0x65,\n ]);\n\n // when\n const frames = apduSenderService.getFrames(apdu);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0x00, 0x45])),\n index: new Uint8Array([0x00, 0x00]),\n length: 7,\n }),\n data: new Uint8Array([\n 0xe0, 0xd4, 0x00, 0x00, 0x40, 0x54, 0x6f, 0x66, 0x75, 0x49, 0x73,\n 0x4e, 0x75, 0x74, 0x72, 0x69, 0x74, 0x69, 0x6f, 0x75, 0x73, 0x41,\n 0x6e, 0x64, 0x42, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x4a, 0x6f, 0x79,\n 0x44, 0x65, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x48, 0x65, 0x61, 0x6c,\n 0x74, 0x68, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x48, 0x61, 0x72, 0x6d,\n 0x6f, 0x6e,\n ]),\n }),\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n headTag: new Uint8Array([0x05]),\n index: new Uint8Array([0x00, 0x01]),\n length: 5,\n dataSize: Maybe.zero(),\n }),\n data: new Uint8Array([\n 0x79, 0x49, 0x6e, 0x45, 0x76, 0x65, 0x72, 0x79, 0x42, 0x69, 0x74,\n 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n ]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x12, 0x34, 0x05, 0x00, 0x00, 0x00, 0x45, 0xe0, 0xd4, 0x00, 0x00,\n 0x40, 0x54, 0x6f, 0x66, 0x75, 0x49, 0x73, 0x4e, 0x75, 0x74, 0x72,\n 0x69, 0x74, 0x69, 0x6f, 0x75, 0x73, 0x41, 0x6e, 0x64, 0x42, 0x72,\n 0x69, 0x6e, 0x67, 0x73, 0x4a, 0x6f, 0x79, 0x44, 0x65, 0x6c, 0x69,\n 0x67, 0x68, 0x74, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x69, 0x6e,\n 0x65, 0x73, 0x73, 0x48, 0x61, 0x72, 0x6d, 0x6f, 0x6e,\n ]),\n new Uint8Array([\n 0x12, 0x34, 0x05, 0x00, 0x01, 0x79, 0x49, 0x6e, 0x45, 0x76, 0x65,\n 0x72, 0x79, 0x42, 0x69, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n ]),\n ]);\n });\n });\n\n describe(\"[BLE] Without padding nor channel\", () => {\n it(\"should return 1 frame\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 123,\n },\n () => loggerService,\n );\n const command = new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.zero(),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0, 5])),\n index: new Uint8Array([0, 0]),\n length: 5,\n }),\n data: new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x05, 0x00, 0x00, 0x00, 0x05, 0xe0, 0x01, 0x00, 0x00, 0x00,\n ]),\n ]);\n });\n\n it(\"should return 3 frames\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 10,\n },\n () => loggerService,\n );\n const command = new Uint8Array([\n 0x01, 0x05, 0x4f, 0x4c, 0x4f, 0x53, 0x00, 0x07, 0x2e, 0x32, 0x2e, 0x34,\n 0x2d, 0x32, 0x00, 0x90, 0x00,\n ]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.zero(),\n headTag: new Uint8Array([0x05]),\n index: new Uint8Array([0, 0]),\n dataSize: Maybe.of(new Uint8Array([0, 0x11])),\n length: 5,\n }),\n data: new Uint8Array([0x01, 0x05, 0x4f, 0x4c, 0x4f]),\n }),\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.zero(),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.zero(),\n index: new Uint8Array([0, 0x01]),\n length: 3,\n }),\n data: new Uint8Array([0x53, 0x00, 0x07, 0x2e, 0x32, 0x2e, 0x34]),\n }),\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.zero(),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.zero(),\n index: new Uint8Array([0, 0x02]),\n length: 3,\n }),\n data: new Uint8Array([0x2d, 0x32, 0x00, 0x90, 0x00]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x05, 0x00, 0x00, 0x00, 0x11, 0x01, 0x05, 0x4f, 0x4c, 0x4f,\n ]),\n new Uint8Array([\n 0x05, 0x00, 0x01, 0x53, 0x00, 0x07, 0x2e, 0x32, 0x2e, 0x34,\n ]),\n new Uint8Array([0x05, 0x00, 0x02, 0x2d, 0x32, 0x00, 0x90, 0x00]),\n ]);\n });\n });\n\n describe(\"Errors\", () => {\n it(\"should return a well formatted header with very big channel\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 64,\n channel: Maybe.of(\n new Uint8Array([0x123434, 0x34444, 0x56454, 0x7844, 0x90444]),\n ),\n },\n () => loggerService,\n );\n const command = new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x44, 0x44])),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0, 0x05])),\n index: new Uint8Array([0, 0]),\n length: 7,\n }),\n data: new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x44, 0x44, 0x05, 0x00, 0x00, 0x00, 0x05, 0xe0, 0x01, 0x00, 0x00,\n 0x00,\n ]),\n ]);\n });\n it(\"should return empty if packet size smaller than header size\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: Math.random() & 4,\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n },\n () => loggerService,\n );\n const command = new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames.length).toEqual(0);\n });\n\n it(\"should return empty if no apdu length\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n // random frameSize < 0xff\n frameSize: Math.random() & 0xff,\n // random padding boolean\n padding: Math.random() > 0.5,\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n },\n () => loggerService,\n );\n const command = new Uint8Array([]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames.length).toEqual(0);\n });\n });\n});\n"],
5
- "mappings": "AAIA,OAAS,SAAAA,MAAa,YAEtB,OAAS,SAAAC,MAAa,uCACtB,OAAS,eAAAC,MAAmB,6CAC5B,OAAS,iCAAAC,MAAqC,mEAE9C,OAAS,4BAAAC,MAAgC,6BAVzC,KAAK,KAAK,OAAQ,KAAO,CACvB,GAAI,KAAK,GAAG,EAAE,gBAAgB,IAAI,CACpC,EAAE,EAUF,MAAMC,EAAgB,IAAIF,EAA8B,CAAC,EAAG,OAAO,EAEnE,SAAS,2BAA4B,IAAM,CACzC,SAAS,iCAAkC,I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sourcesContent": ["import { Maybe } from \"purify-ts\";\n\nimport { Frame } from \"@internal/device-session/model/Frame\";\nimport { FrameHeader } from \"@internal/device-session/model/FrameHeader\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\n\nimport { DefaultApduSenderService } from \"./DefaultApduSenderService\";\n\nvi.mock(\"uuid\", () => ({\n v4: vi.fn().mockReturnValue(\"42\"),\n}));\n\nconst loggerService = new DefaultLoggerPublisherService([], \"frame\");\n\ndescribe(\"DefaultApduSenderService\", () => {\n describe(\"[USB] With padding and channel\", () => {\n it(\"should return 1 frame\", () => {\n // given\n const channel = Maybe.of(new Uint8Array([0x12, 0x34]));\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 64,\n padding: true,\n channel,\n },\n () => loggerService,\n );\n // getVersion APDU\n const apdu = new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\n // when\n const frames = apduSenderService.getFrames(apdu);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0, 0x05])),\n index: new Uint8Array([0, 0]),\n length: 7,\n }),\n data: new Uint8Array([\n 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00,\n ]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x12, 0x34, 0x05, 0x00, 0x00, 0x00, 0x05, 0xe0, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n ]),\n ]);\n });\n\n it(\"should return 2 frames\", () => {\n // given\n const channel = Maybe.of(new Uint8Array([0x12, 0x34]));\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 64,\n padding: true,\n channel,\n },\n () => loggerService,\n );\n const apdu = new Uint8Array([\n // editDeviceName APDU\n 0xe0, 0xd4, 0x00, 0x00, 0x40,\n // editDeviceNameData\n 0x54, 0x6f, 0x66, 0x75, 0x49, 0x73, 0x4e, 0x75, 0x74, 0x72, 0x69, 0x74,\n 0x69, 0x6f, 0x75, 0x73, 0x41, 0x6e, 0x64, 0x42, 0x72, 0x69, 0x6e, 0x67,\n 0x73, 0x4a, 0x6f, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x48,\n 0x65, 0x61, 0x6c, 0x74, 0x68, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x48, 0x61,\n 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x49, 0x6e, 0x45, 0x76, 0x65, 0x72, 0x79,\n 0x42, 0x69, 0x74, 0x65,\n ]);\n\n // when\n const frames = apduSenderService.getFrames(apdu);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0x00, 0x45])),\n index: new Uint8Array([0x00, 0x00]),\n length: 7,\n }),\n data: new Uint8Array([\n 0xe0, 0xd4, 0x00, 0x00, 0x40, 0x54, 0x6f, 0x66, 0x75, 0x49, 0x73,\n 0x4e, 0x75, 0x74, 0x72, 0x69, 0x74, 0x69, 0x6f, 0x75, 0x73, 0x41,\n 0x6e, 0x64, 0x42, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x4a, 0x6f, 0x79,\n 0x44, 0x65, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x48, 0x65, 0x61, 0x6c,\n 0x74, 0x68, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x48, 0x61, 0x72, 0x6d,\n 0x6f, 0x6e,\n ]),\n }),\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n headTag: new Uint8Array([0x05]),\n index: new Uint8Array([0x00, 0x01]),\n length: 5,\n dataSize: Maybe.zero(),\n }),\n data: new Uint8Array([\n 0x79, 0x49, 0x6e, 0x45, 0x76, 0x65, 0x72, 0x79, 0x42, 0x69, 0x74,\n 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n ]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x12, 0x34, 0x05, 0x00, 0x00, 0x00, 0x45, 0xe0, 0xd4, 0x00, 0x00,\n 0x40, 0x54, 0x6f, 0x66, 0x75, 0x49, 0x73, 0x4e, 0x75, 0x74, 0x72,\n 0x69, 0x74, 0x69, 0x6f, 0x75, 0x73, 0x41, 0x6e, 0x64, 0x42, 0x72,\n 0x69, 0x6e, 0x67, 0x73, 0x4a, 0x6f, 0x79, 0x44, 0x65, 0x6c, 0x69,\n 0x67, 0x68, 0x74, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x69, 0x6e,\n 0x65, 0x73, 0x73, 0x48, 0x61, 0x72, 0x6d, 0x6f, 0x6e,\n ]),\n new Uint8Array([\n 0x12, 0x34, 0x05, 0x00, 0x01, 0x79, 0x49, 0x6e, 0x45, 0x76, 0x65,\n 0x72, 0x79, 0x42, 0x69, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n ]),\n ]);\n });\n });\n\n describe(\"[BLE] Without padding nor channel\", () => {\n it(\"should return 1 frame\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 123,\n },\n () => loggerService,\n );\n const command = new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.zero(),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0, 5])),\n index: new Uint8Array([0, 0]),\n length: 5,\n }),\n data: new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x05, 0x00, 0x00, 0x00, 0x05, 0xe0, 0x01, 0x00, 0x00, 0x00,\n ]),\n ]);\n });\n\n it(\"should return 3 frames\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 10,\n },\n () => loggerService,\n );\n const command = new Uint8Array([\n 0x01, 0x05, 0x4f, 0x4c, 0x4f, 0x53, 0x00, 0x07, 0x2e, 0x32, 0x2e, 0x34,\n 0x2d, 0x32, 0x00, 0x90, 0x00,\n ]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.zero(),\n headTag: new Uint8Array([0x05]),\n index: new Uint8Array([0, 0]),\n dataSize: Maybe.of(new Uint8Array([0, 0x11])),\n length: 5,\n }),\n data: new Uint8Array([0x01, 0x05, 0x4f, 0x4c, 0x4f]),\n }),\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.zero(),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.zero(),\n index: new Uint8Array([0, 0x01]),\n length: 3,\n }),\n data: new Uint8Array([0x53, 0x00, 0x07, 0x2e, 0x32, 0x2e, 0x34]),\n }),\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.zero(),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.zero(),\n index: new Uint8Array([0, 0x02]),\n length: 3,\n }),\n data: new Uint8Array([0x2d, 0x32, 0x00, 0x90, 0x00]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x05, 0x00, 0x00, 0x00, 0x11, 0x01, 0x05, 0x4f, 0x4c, 0x4f,\n ]),\n new Uint8Array([\n 0x05, 0x00, 0x01, 0x53, 0x00, 0x07, 0x2e, 0x32, 0x2e, 0x34,\n ]),\n new Uint8Array([0x05, 0x00, 0x02, 0x2d, 0x32, 0x00, 0x90, 0x00]),\n ]);\n });\n });\n\n describe(\"Errors\", () => {\n it(\"should return a well formatted header with very big channel\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 64,\n channel: Maybe.of(\n new Uint8Array([0x123434, 0x34444, 0x56454, 0x7844, 0x90444]),\n ),\n },\n () => loggerService,\n );\n const command = new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x44, 0x44])),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0, 0x05])),\n index: new Uint8Array([0, 0]),\n length: 7,\n }),\n data: new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x44, 0x44, 0x05, 0x00, 0x00, 0x00, 0x05, 0xe0, 0x01, 0x00, 0x00,\n 0x00,\n ]),\n ]);\n });\n it(\"should return empty if packet size smaller than header size\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: Math.random() & 4,\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n },\n () => loggerService,\n );\n const command = new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames.length).toEqual(0);\n });\n\n it(\"should return empty if no apdu length\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n // random frameSize < 0xff\n frameSize: Math.random() & 0xff,\n // random padding boolean\n padding: Math.random() > 0.5,\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n },\n () => loggerService,\n );\n const command = new Uint8Array([]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames.length).toEqual(0);\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,SAAAA,MAAa,YAEtB,OAAS,SAAAC,MAAa,uCACtB,OAAS,eAAAC,MAAmB,6CAC5B,OAAS,iCAAAC,MAAqC,mEAE9C,OAAS,4BAAAC,MAAgC,6BAEzC,GAAG,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ChD,EACA,IAAMK,CACR,EACMM,EAAU,IAAI,WAAW,CAAC,CAAC,EAG3BF,EAASF,EAAkB,UAAUI,CAAO,EAGlD,OAAOF,EAAO,MAAM,EAAE,QAAQ,CAAC,CACjC,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["Maybe", "Frame", "FrameHeader", "DefaultLoggerPublisherService", "DefaultApduSenderService", "loggerService", "channel", "apduSenderService", "apdu", "frames", "fr", "command"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Either as v,Left as S}from"purify-ts";import{Observable as l}from"rxjs";import{deviceSessionStubBuilder as a}from"../../device-session/model/DeviceSession.stub";import{DeviceSessionNotFound as u}from"../../device-session/model/Errors";import{DefaultLoggerPublisherService as p}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{AxiosManagerApiDataSource as D}from"../../manager-api/data/AxiosManagerApiDataSource";import{DefaultManagerApiService as m}from"../../manager-api/service/DefaultManagerApiService";import{DefaultDeviceSessionService as g}from"./DefaultDeviceSessionService";jest.mock("@internal/logger-publisher/service/DefaultLoggerPublisherService");jest.mock("@internal/manager-api/data/AxiosManagerApiDataSource");let e,t,s,r,c;describe("DefaultDeviceSessionService",()=>{beforeEach(()=>{jest.restoreAllMocks(),t=new p([],"deviceSession"),e=new g(()=>t),c=new D({}),r=new m(c),s=a({},()=>t,r)}),afterEach(()=>{s.close()}),it("should have an empty sessions list",()=>{expect(e.getDeviceSessions()).toEqual([])}),it("should add a deviceSession",()=>{e.addDeviceSession(s),expect(e.getDeviceSessions()).toEqual([s])}),it("should not add a deviceSession if it already exists",()=>{e.addDeviceSession(s),e.addDeviceSession(s),expect(e.getDeviceSessions()).toEqual([s])}),it("should remove a deviceSession",()=>{e.addDeviceSession(s),e.removeDeviceSession(s.id),expect(e.getDeviceSessions()).toEqual([])}),it("should not remove a deviceSession if it does not exist",()=>{e.removeDeviceSession(s.id),expect(e.getDeviceSessions()).toEqual([])}),it("should get a deviceSession",()=>{e.addDeviceSession(s),expect(e.getDeviceSessionById(s.id)).toEqual(v.of(s))}),it("should not get a deviceSession if it does not exist",()=>{expect(e.getDeviceSessionById(s.id)).toEqual(S(new u))}),it("should get all sessions",()=>{e.addDeviceSession(s),expect(e.getDeviceSessions()).toEqual([s])}),it("should retrieve sessionObs",()=>{expect(e.sessionsObs).toBeInstanceOf(l)}),it("should emit new session",i=>{const o=e.sessionsObs.subscribe({next(n){expect(n).toStrictEqual(s),o.unsubscribe(),i()}});e.addDeviceSession(s)}),it("should emit previous added session",()=>{const i=a({id:"last-session"},()=>t,r),o=[];e.addDeviceSession(s),e.addDeviceSession(i);const n=e.sessionsObs.subscribe({next(d){o.push(d)}});i.close(),expect(o).toEqual([s,i]),n.unsubscribe()})});
1
+ import{Either as m,Left as p}from"purify-ts";import{Observable as D}from"rxjs";import{DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS as S}from"../../device-session/data/DeviceSessionRefresherConst";import{deviceSessionStubBuilder as l}from"../../device-session/model/DeviceSession.stub";import{DeviceSessionNotFound as f}from"../../device-session/model/Errors";import{DefaultLoggerPublisherService as g}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{AxiosManagerApiDataSource as h}from"../../manager-api/data/AxiosManagerApiDataSource";import{DefaultManagerApiService as b}from"../../manager-api/service/DefaultManagerApiService";import{DefaultSecureChannelDataSource as E}from"../../secure-channel/data/DefaultSecureChannelDataSource";import{DefaultSecureChannelService as x}from"../../secure-channel/service/DefaultSecureChannelService";import{DefaultDeviceSessionService as A}from"./DefaultDeviceSessionService";vi.mock("@internal/logger-publisher/service/DefaultLoggerPublisherService");vi.mock("@internal/manager-api/data/AxiosManagerApiDataSource");let e,t,i,v,a,u,c;describe("DefaultDeviceSessionService",()=>{beforeEach(()=>{vi.restoreAllMocks(),t=new g([],"deviceSession"),e=new A(()=>t),v=new h({}),a=new b(v),u=new E({}),c=new x(u),i=l({},()=>t,a,c,S)}),afterEach(()=>{i.close()}),it("should have an empty sessions list",()=>{expect(e.getDeviceSessions()).toEqual([])}),it("should add a deviceSession",()=>{e.addDeviceSession(i),expect(e.getDeviceSessions()).toEqual([i])}),it("should not add a deviceSession if it already exists",()=>{e.addDeviceSession(i),e.addDeviceSession(i),expect(e.getDeviceSessions()).toEqual([i])}),it("should remove a deviceSession",()=>{e.addDeviceSession(i),e.removeDeviceSession(i.id),expect(e.getDeviceSessions()).toEqual([])}),it("should not remove a deviceSession if it does not exist",()=>{e.removeDeviceSession(i.id),expect(e.getDeviceSessions()).toEqual([])}),it("should get a deviceSession",()=>{e.addDeviceSession(i),expect(e.getDeviceSessionById(i.id)).toEqual(m.of(i))}),it("should not get a deviceSession if it does not exist",()=>{expect(e.getDeviceSessionById(i.id)).toEqual(p(new f))}),it("should get all sessions",()=>{e.addDeviceSession(i),expect(e.getDeviceSessions()).toEqual([i])}),it("should retrieve sessionObs",()=>{expect(e.sessionsObs).toBeInstanceOf(D)}),it("should emit new session",()=>new Promise((s,o)=>{const r=e.sessionsObs.subscribe({next(n){try{expect(n).toStrictEqual(i),r.unsubscribe(),s()}catch(d){o(d)}}});e.addDeviceSession(i)})),it("should emit previous added session",()=>{const s=l({id:"last-session"},()=>t,a,c,S),o=[];e.addDeviceSession(i),e.addDeviceSession(s);const r=e.sessionsObs.subscribe({next(n){o.push(n)}});s.close(),expect(o).toEqual([i,s]),r.unsubscribe()})});
2
2
  //# sourceMappingURL=DefaultDeviceSessionService.test.js.map