@ledgerhq/device-management-kit 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (349) hide show
  1. package/lib/cjs/index.js.map +1 -1
  2. package/lib/cjs/package.json +4 -3
  3. package/lib/cjs/src/api/DeviceManagementKit.js +1 -1
  4. package/lib/cjs/src/api/DeviceManagementKit.js.map +2 -2
  5. package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
  6. package/lib/cjs/src/api/DeviceManagementKit.test.js.map +2 -2
  7. package/lib/cjs/src/api/command/os/GetOsVersionCommand.js +1 -1
  8. package/lib/cjs/src/api/command/os/GetOsVersionCommand.js.map +3 -3
  9. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.js +2 -0
  10. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.js.map +7 -0
  11. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.test.js +2 -0
  12. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.test.js.map +7 -0
  13. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  14. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  15. package/lib/cjs/src/api/device/SecureElementFlags.js +2 -0
  16. package/lib/cjs/src/api/device/SecureElementFlags.js.map +7 -0
  17. package/lib/cjs/src/api/device-action/DeviceAction.js +1 -1
  18. package/lib/cjs/src/api/device-action/DeviceAction.js.map +1 -1
  19. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  20. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  21. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +1 -1
  22. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  23. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
  24. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +1 -1
  25. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +2 -2
  26. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
  27. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +3 -3
  28. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +1 -1
  29. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +3 -3
  30. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  31. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +2 -2
  32. package/lib/cjs/src/api/device-session/DeviceSessionState.js +1 -1
  33. package/lib/cjs/src/api/device-session/DeviceSessionState.js.map +1 -1
  34. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.js +2 -0
  35. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.js.map +7 -0
  36. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js +2 -0
  37. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js.map +7 -0
  38. package/lib/cjs/src/api/index.js +1 -1
  39. package/lib/cjs/src/api/index.js.map +3 -3
  40. package/lib/cjs/src/api/secure-channel/constants.js +2 -0
  41. package/lib/cjs/src/api/secure-channel/constants.js.map +7 -0
  42. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +2 -0
  43. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +7 -0
  44. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js +2 -0
  45. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js.map +7 -0
  46. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js +2 -0
  47. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js.map +7 -0
  48. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +2 -0
  49. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +7 -0
  50. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +2 -0
  51. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +7 -0
  52. package/lib/cjs/src/api/secure-channel/task/types.js +2 -0
  53. package/lib/cjs/src/api/secure-channel/task/types.js.map +7 -0
  54. package/lib/cjs/src/api/secure-channel/types.js +2 -0
  55. package/lib/cjs/src/api/secure-channel/types.js.map +7 -0
  56. package/lib/cjs/src/api/secure-channel/utils.js +2 -0
  57. package/lib/cjs/src/api/secure-channel/utils.js.map +7 -0
  58. package/lib/cjs/src/api/secure-channel/utils.test.js +2 -0
  59. package/lib/cjs/src/api/secure-channel/utils.test.js.map +7 -0
  60. package/lib/cjs/src/api/transport/model/DiscoveredDevice.js +1 -1
  61. package/lib/cjs/src/api/transport/model/DiscoveredDevice.js.map +1 -1
  62. package/lib/cjs/src/api/transport/model/Errors.js.map +2 -2
  63. package/lib/cjs/src/api/transport/model/Transport.js.map +1 -1
  64. package/lib/cjs/src/api/transport/model/TransportDiscoveredDevice.js +1 -1
  65. package/lib/cjs/src/api/transport/model/TransportDiscoveredDevice.js.map +1 -1
  66. package/lib/cjs/src/api/transport/model/__mocks__/TransportMock.js +1 -1
  67. package/lib/cjs/src/api/transport/model/__mocks__/TransportMock.js.map +2 -2
  68. package/lib/cjs/src/api/types.js +1 -1
  69. package/lib/cjs/src/api/types.js.map +1 -1
  70. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +1 -1
  71. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  72. package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js +1 -1
  73. package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js.map +2 -2
  74. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  75. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
  76. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
  77. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js.map +2 -2
  78. package/lib/cjs/src/internal/device-session/service/RefresherService.js +2 -0
  79. package/lib/cjs/src/internal/device-session/service/RefresherService.js.map +7 -0
  80. package/lib/cjs/src/internal/device-session/service/RefresherService.test.js +2 -0
  81. package/lib/cjs/src/internal/device-session/service/RefresherService.test.js.map +7 -0
  82. package/lib/cjs/src/internal/discovery/di/discoveryModule.js +1 -1
  83. package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +3 -3
  84. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
  85. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +3 -3
  86. package/lib/cjs/src/internal/discovery/di/discoveryTypes.js +1 -1
  87. package/lib/cjs/src/internal/discovery/di/discoveryTypes.js.map +2 -2
  88. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  89. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js.map +2 -2
  90. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js +2 -0
  91. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js.map +7 -0
  92. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js +2 -0
  93. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js.map +7 -0
  94. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  95. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  96. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  97. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  98. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js +1 -1
  99. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js.map +1 -1
  100. package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js +1 -1
  101. package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
  102. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  103. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  104. package/lib/cjs/src/internal/manager-api/model/Application.js +1 -1
  105. package/lib/cjs/src/internal/manager-api/model/Application.js.map +1 -1
  106. package/lib/cjs/src/internal/manager-api/model/Params.js +2 -0
  107. package/lib/cjs/src/internal/manager-api/model/Params.js.map +7 -0
  108. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  109. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  110. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  111. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  112. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js +1 -1
  113. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js.map +1 -1
  114. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js +1 -1
  115. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js.map +2 -2
  116. package/lib/cjs/src/internal/secure-channel/data/SecureChannelDataSource.js.map +1 -1
  117. package/lib/cjs/src/internal/secure-channel/model/Errors.js +1 -1
  118. package/lib/cjs/src/internal/secure-channel/model/Errors.js.map +3 -3
  119. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js +1 -1
  120. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +3 -3
  121. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +1 -1
  122. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +2 -2
  123. package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js +1 -1
  124. package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js.map +1 -1
  125. package/lib/esm/package.json +4 -3
  126. package/lib/esm/src/api/DeviceManagementKit.js +1 -1
  127. package/lib/esm/src/api/DeviceManagementKit.js.map +2 -2
  128. package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
  129. package/lib/esm/src/api/DeviceManagementKit.test.js.map +2 -2
  130. package/lib/esm/src/api/command/os/GetOsVersionCommand.js +1 -1
  131. package/lib/esm/src/api/command/os/GetOsVersionCommand.js.map +3 -3
  132. package/lib/esm/src/api/command/os/SecureElementFlagsParser.js +2 -0
  133. package/lib/esm/src/api/command/os/SecureElementFlagsParser.js.map +7 -0
  134. package/lib/esm/src/api/command/os/SecureElementFlagsParser.test.js +2 -0
  135. package/lib/esm/src/api/command/os/SecureElementFlagsParser.test.js.map +7 -0
  136. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  137. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  138. package/lib/esm/src/api/device/SecureElementFlags.js +1 -0
  139. package/lib/esm/src/api/device/SecureElementFlags.js.map +7 -0
  140. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  141. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  142. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +1 -1
  143. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  144. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
  145. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +1 -1
  146. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +2 -2
  147. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
  148. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +3 -3
  149. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +1 -1
  150. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +3 -3
  151. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  152. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +2 -2
  153. package/lib/esm/src/api/device-session/DeviceSessionState.js.map +1 -1
  154. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.js +2 -0
  155. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.js.map +7 -0
  156. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js +2 -0
  157. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js.map +7 -0
  158. package/lib/esm/src/api/index.js +1 -1
  159. package/lib/esm/src/api/index.js.map +3 -3
  160. package/lib/esm/src/api/secure-channel/constants.js +2 -0
  161. package/lib/esm/src/api/secure-channel/constants.js.map +7 -0
  162. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +2 -0
  163. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +7 -0
  164. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js +2 -0
  165. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js.map +7 -0
  166. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/types.js +1 -0
  167. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/types.js.map +7 -0
  168. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +2 -0
  169. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +7 -0
  170. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +2 -0
  171. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +7 -0
  172. package/lib/esm/src/api/secure-channel/task/types.js +2 -0
  173. package/lib/esm/src/api/secure-channel/task/types.js.map +7 -0
  174. package/lib/esm/src/api/secure-channel/types.js +1 -0
  175. package/lib/esm/src/api/secure-channel/types.js.map +7 -0
  176. package/lib/esm/src/api/secure-channel/utils.js +2 -0
  177. package/lib/esm/src/api/secure-channel/utils.js.map +7 -0
  178. package/lib/esm/src/api/secure-channel/utils.test.js +2 -0
  179. package/lib/esm/src/api/secure-channel/utils.test.js.map +7 -0
  180. package/lib/esm/src/api/transport/model/Errors.js.map +2 -2
  181. package/lib/esm/src/api/transport/model/__mocks__/TransportMock.js +1 -1
  182. package/lib/esm/src/api/transport/model/__mocks__/TransportMock.js.map +2 -2
  183. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +1 -1
  184. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  185. package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js +1 -1
  186. package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js.map +2 -2
  187. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  188. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
  189. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
  190. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js.map +2 -2
  191. package/lib/esm/src/internal/device-session/service/RefresherService.js +2 -0
  192. package/lib/esm/src/internal/device-session/service/RefresherService.js.map +7 -0
  193. package/lib/esm/src/internal/device-session/service/RefresherService.test.js +2 -0
  194. package/lib/esm/src/internal/device-session/service/RefresherService.test.js.map +7 -0
  195. package/lib/esm/src/internal/discovery/di/discoveryModule.js +1 -1
  196. package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +3 -3
  197. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
  198. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +3 -3
  199. package/lib/esm/src/internal/discovery/di/discoveryTypes.js +1 -1
  200. package/lib/esm/src/internal/discovery/di/discoveryTypes.js.map +2 -2
  201. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  202. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js.map +2 -2
  203. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js +2 -0
  204. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js.map +7 -0
  205. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js +2 -0
  206. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js.map +7 -0
  207. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  208. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  209. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  210. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  211. package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
  212. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  213. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  214. package/lib/esm/src/internal/manager-api/model/Application.js.map +1 -1
  215. package/lib/esm/src/internal/manager-api/model/Params.js +1 -0
  216. package/lib/esm/src/internal/manager-api/model/Params.js.map +7 -0
  217. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  218. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  219. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  220. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  221. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js +1 -1
  222. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js.map +2 -2
  223. package/lib/esm/src/internal/secure-channel/model/Errors.js +1 -1
  224. package/lib/esm/src/internal/secure-channel/model/Errors.js.map +3 -3
  225. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js +1 -1
  226. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +3 -3
  227. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +1 -1
  228. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +2 -2
  229. package/lib/types/src/api/DeviceManagementKit.d.ts +10 -8
  230. package/lib/types/src/api/DeviceManagementKit.d.ts.map +1 -1
  231. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts +8 -2
  232. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts.map +1 -1
  233. package/lib/types/src/api/command/os/SecureElementFlagsParser.d.ts +43 -0
  234. package/lib/types/src/api/command/os/SecureElementFlagsParser.d.ts.map +1 -0
  235. package/lib/types/src/api/command/os/SecureElementFlagsParser.test.d.ts +2 -0
  236. package/lib/types/src/api/command/os/SecureElementFlagsParser.test.d.ts.map +1 -0
  237. package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
  238. package/lib/types/src/api/device/SecureElementFlags.d.ts +41 -0
  239. package/lib/types/src/api/device/SecureElementFlags.d.ts.map +1 -0
  240. package/lib/types/src/api/device-action/DeviceAction.d.ts +1 -0
  241. package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
  242. package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
  243. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +1 -1
  244. package/lib/types/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.d.ts +1 -1
  245. package/lib/types/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.d.ts.map +1 -1
  246. package/lib/types/src/api/device-session/DeviceSessionState.d.ts +4 -0
  247. package/lib/types/src/api/device-session/DeviceSessionState.d.ts.map +1 -1
  248. package/lib/types/src/api/device-session/use-case/{ToggleDeviceSessionRefresher.d.ts → DisableDeviceSessionRefresher.d.ts} +6 -6
  249. package/lib/types/src/api/device-session/use-case/DisableDeviceSessionRefresher.d.ts.map +1 -0
  250. package/lib/types/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.d.ts +2 -0
  251. package/lib/types/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.d.ts.map +1 -0
  252. package/lib/types/src/api/index.d.ts +1 -0
  253. package/lib/types/src/api/index.d.ts.map +1 -1
  254. package/lib/types/src/api/secure-channel/constants.d.ts +2 -0
  255. package/lib/types/src/api/secure-channel/constants.d.ts.map +1 -0
  256. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts +8 -0
  257. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts.map +1 -0
  258. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.d.ts +1 -0
  259. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.d.ts.map +1 -0
  260. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts +48 -0
  261. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts.map +1 -0
  262. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts +23 -0
  263. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -0
  264. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.test.d.ts +2 -0
  265. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.test.d.ts.map +1 -0
  266. package/lib/types/src/api/secure-channel/task/types.d.ts +105 -0
  267. package/lib/types/src/api/secure-channel/task/types.d.ts.map +1 -0
  268. package/lib/types/src/api/secure-channel/types.d.ts +4 -0
  269. package/lib/types/src/api/secure-channel/types.d.ts.map +1 -0
  270. package/lib/types/src/api/secure-channel/utils.d.ts +30 -0
  271. package/lib/types/src/api/secure-channel/utils.d.ts.map +1 -0
  272. package/lib/types/src/api/secure-channel/utils.test.d.ts +2 -0
  273. package/lib/types/src/api/secure-channel/utils.test.d.ts.map +1 -0
  274. package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts +2 -0
  275. package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts.map +1 -1
  276. package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
  277. package/lib/types/src/api/transport/model/Transport.d.ts +1 -1
  278. package/lib/types/src/api/transport/model/Transport.d.ts.map +1 -1
  279. package/lib/types/src/api/transport/model/TransportDiscoveredDevice.d.ts +2 -0
  280. package/lib/types/src/api/transport/model/TransportDiscoveredDevice.d.ts.map +1 -1
  281. package/lib/types/src/api/transport/model/__mocks__/TransportMock.d.ts +1 -1
  282. package/lib/types/src/api/transport/model/__mocks__/TransportMock.d.ts.map +1 -1
  283. package/lib/types/src/api/types.d.ts +1 -0
  284. package/lib/types/src/api/types.d.ts.map +1 -1
  285. package/lib/types/src/internal/device-session/di/deviceSessionTypes.d.ts +1 -1
  286. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts +4 -2
  287. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  288. package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts.map +1 -1
  289. package/lib/types/src/internal/device-session/service/RefresherService.d.ts +10 -0
  290. package/lib/types/src/internal/device-session/service/RefresherService.d.ts.map +1 -0
  291. package/lib/types/src/internal/device-session/service/RefresherService.test.d.ts +2 -0
  292. package/lib/types/src/internal/device-session/service/RefresherService.test.d.ts.map +1 -0
  293. package/lib/types/src/internal/discovery/di/discoveryTypes.d.ts +1 -1
  294. package/lib/types/src/internal/discovery/di/discoveryTypes.d.ts.map +1 -1
  295. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.d.ts +24 -0
  296. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.d.ts.map +1 -0
  297. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.d.ts +2 -0
  298. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.d.ts.map +1 -0
  299. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts +6 -5
  300. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts.map +1 -1
  301. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts +14 -9
  302. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts.map +1 -1
  303. package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts +4 -1
  304. package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts.map +1 -1
  305. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts +1 -0
  306. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts.map +1 -1
  307. package/lib/types/src/internal/manager-api/model/Application.d.ts +4 -1
  308. package/lib/types/src/internal/manager-api/model/Application.d.ts.map +1 -1
  309. package/lib/types/src/internal/manager-api/model/Params.d.ts +43 -0
  310. package/lib/types/src/internal/manager-api/model/Params.d.ts.map +1 -0
  311. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts +5 -5
  312. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts.map +1 -1
  313. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts +33 -2
  314. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts.map +1 -1
  315. package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.d.ts +3 -3
  316. package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.d.ts.map +1 -1
  317. package/lib/types/src/internal/secure-channel/data/SecureChannelDataSource.d.ts +13 -13
  318. package/lib/types/src/internal/secure-channel/data/SecureChannelDataSource.d.ts.map +1 -1
  319. package/lib/types/src/internal/secure-channel/model/Errors.d.ts +6 -0
  320. package/lib/types/src/internal/secure-channel/model/Errors.d.ts.map +1 -1
  321. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts +4 -3
  322. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts.map +1 -1
  323. package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts +5 -3
  324. package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts.map +1 -1
  325. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  326. package/package.json +4 -3
  327. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js +0 -2
  328. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js.map +0 -7
  329. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js +0 -2
  330. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js.map +0 -7
  331. package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js +0 -2
  332. package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js.map +0 -7
  333. package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js +0 -2
  334. package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js.map +0 -7
  335. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js +0 -2
  336. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js.map +0 -7
  337. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js +0 -2
  338. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js.map +0 -7
  339. package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js +0 -2
  340. package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js.map +0 -7
  341. package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js +0 -2
  342. package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js.map +0 -7
  343. package/lib/types/src/api/device-session/use-case/ToggleDeviceSessionRefresher.d.ts.map +0 -1
  344. package/lib/types/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.d.ts +0 -2
  345. package/lib/types/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.d.ts.map +0 -1
  346. package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.d.ts +0 -13
  347. package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.d.ts.map +0 -1
  348. package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.d.ts +0 -2
  349. package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.d.ts.map +0 -1
@@ -3,5 +3,5 @@
3
3
  "sources": ["../../index.ts"],
4
4
  "sourcesContent": ["export * from \"./src\";\n"],
5
5
  "mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAAAE,EAAAF,EAAc,iBAAd",
6
- "names": ["device_management_kit_exports", "__toCommonJS", "__reExport"]
6
+ "names": ["index_exports", "__toCommonJS", "__reExport"]
7
7
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/device-management-kit",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
@@ -40,12 +40,13 @@
40
40
  "purify-ts": "^2.1.0",
41
41
  "reflect-metadata": "^0.2.2",
42
42
  "semver": "^7.6.3",
43
+ "url": "^0.11.4",
43
44
  "uuid": "^11.0.3",
44
45
  "ws": "^8.18.0",
45
46
  "xstate": "^5.19.2"
46
47
  },
47
48
  "peerDependencies": {
48
- "rxjs": "^7.8.1"
49
+ "rxjs": "^7.8.2"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@ledgerhq/esbuild-tools": "workspace:*",
@@ -57,7 +58,7 @@
57
58
  "@types/semver": "^7.5.8",
58
59
  "@types/uuid": "^10.0.0",
59
60
  "@types/ws": "^8.5.14",
60
- "rxjs": "^7.8.1",
61
+ "rxjs": "^7.8.2",
61
62
  "ts-node": "^10.9.2"
62
63
  }
63
64
  }
@@ -1,2 +1,2 @@
1
- "use strict";var c=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var U=(t,e)=>{for(var n in e)c(t,n,{get:e[n],enumerable:!0})},g=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of D(e))!u.call(t,o)&&o!==n&&c(t,o,{get:()=>e[o],enumerable:!(i=v(e,o))||i.enumerable});return t};var y=t=>g(c({},"__esModule",{value:!0}),t);var f={};U(f,{DeviceManagementKit:()=>S});module.exports=y(f);var a=require("./command/di/commandTypes"),C=require("../internal/config/di/configTypes"),r=require("../internal/device-session/di/deviceSessionTypes"),s=require("../internal/discovery/di/discoveryTypes"),m=require("../internal/send/di/sendTypes"),p=require("../../src/di"),d=require("./device-action/di/deviceActionTypes");class S{container;constructor({stub:e,transports:n,loggers:i,config:o}={}){this.container=(0,p.makeContainer)({stub:e,transports:n,loggers:i,config:o})}getVersion(){return this.container.get(C.configTypes.GetDmkVersionUseCase).getDmkVersion()}startDiscovering(e){return this.container.get(s.discoveryTypes.StartDiscoveringUseCase).execute(e)}stopDiscovering(){return this.container.get(s.discoveryTypes.StopDiscoveringUseCase).execute()}listenToKnownDevices(){return this.container.get(s.discoveryTypes.ListenToKnownDevicesUseCase).execute()}connect(e){return this.container.get(s.discoveryTypes.ConnectUseCase).execute(e)}disconnect(e){return this.container.get(s.discoveryTypes.DisconnectUseCase).execute(e)}sendApdu(e){return this.container.get(m.sendTypes.SendApduUseCase).execute(e)}sendCommand(e){return this.container.get(a.commandTypes.SendCommandUseCase).execute(e)}executeDeviceAction(e){return this.container.get(d.deviceActionTypes.ExecuteDeviceActionUseCase).execute(e)}getConnectedDevice(e){return this.container.get(s.discoveryTypes.GetConnectedDeviceUseCase).execute(e)}getDeviceSessionState(e){return this.container.get(r.deviceSessionTypes.GetDeviceSessionStateUseCase).execute(e)}close(){return this.container.get(r.deviceSessionTypes.CloseSessionsUseCase).execute()}listConnectedDevices(){return this.container.get(s.discoveryTypes.ListConnectedDevicesUseCase).execute()}listenToConnectedDevice(){return this.container.get(s.discoveryTypes.ListenToConnectedDeviceUseCase).execute()}toggleDeviceSessionRefresher(e){return this.container.get(r.deviceSessionTypes.ToggleDeviceSessionRefresherUseCase).execute(e)}}0&&(module.exports={DeviceManagementKit});
1
+ "use strict";var c=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var U=(t,e)=>{for(var o in e)c(t,o,{get:e[o],enumerable:!0})},g=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of d(e))!u.call(t,i)&&i!==o&&c(t,i,{get:()=>e[i],enumerable:!(n=D(e,i))||n.enumerable});return t};var y=t=>g(c({},"__esModule",{value:!0}),t);var A={};U(A,{DeviceManagementKit:()=>S});module.exports=y(A);var a=require("./command/di/commandTypes"),C=require("../internal/config/di/configTypes"),r=require("../internal/device-session/di/deviceSessionTypes"),s=require("../internal/discovery/di/discoveryTypes"),p=require("../internal/send/di/sendTypes"),m=require("../../src/di"),v=require("./device-action/di/deviceActionTypes");class S{container;constructor({stub:e,transports:o,loggers:n,config:i}={}){this.container=(0,m.makeContainer)({stub:e,transports:o,loggers:n,config:i})}getVersion(){return this.container.get(C.configTypes.GetDmkVersionUseCase).getDmkVersion()}startDiscovering(e){return this.container.get(s.discoveryTypes.StartDiscoveringUseCase).execute(e)}stopDiscovering(){return this.container.get(s.discoveryTypes.StopDiscoveringUseCase).execute()}listenToAvailableDevices(e){return this.container.get(s.discoveryTypes.ListenToAvailableDevicesUseCase).execute(e)}connect(e){return this.container.get(s.discoveryTypes.ConnectUseCase).execute(e)}disconnect(e){return this.container.get(s.discoveryTypes.DisconnectUseCase).execute(e)}sendApdu(e){return this.container.get(p.sendTypes.SendApduUseCase).execute(e)}sendCommand(e){return this.container.get(a.commandTypes.SendCommandUseCase).execute(e)}executeDeviceAction(e){return this.container.get(v.deviceActionTypes.ExecuteDeviceActionUseCase).execute(e)}getConnectedDevice(e){return this.container.get(s.discoveryTypes.GetConnectedDeviceUseCase).execute(e)}getDeviceSessionState(e){return this.container.get(r.deviceSessionTypes.GetDeviceSessionStateUseCase).execute(e)}close(){return this.container.get(r.deviceSessionTypes.CloseSessionsUseCase).execute()}listConnectedDevices(){return this.container.get(s.discoveryTypes.ListConnectedDevicesUseCase).execute()}listenToConnectedDevice(){return this.container.get(s.discoveryTypes.ListenToConnectedDeviceUseCase).execute()}disableDeviceSessionRefresher(e){return this.container.get(r.deviceSessionTypes.DisableDeviceSessionRefresherUseCase).execute(e)}}0&&(module.exports={DeviceManagementKit});
2
2
  //# sourceMappingURL=DeviceManagementKit.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/DeviceManagementKit.ts"],
4
- "sourcesContent": ["import { type Container } from \"inversify\";\nimport { type Observable } from \"rxjs\";\n\nimport { commandTypes } from \"@api/command/di/commandTypes\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport {\n type SendCommandUseCase,\n type SendCommandUseCaseArgs,\n} from \"@api/command/use-case/SendCommandUseCase\";\nimport {\n type ExecuteDeviceActionUseCase,\n type ExecuteDeviceActionUseCaseArgs,\n} from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type DeviceSessionId } from \"@api/device-session/types\";\nimport { type ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nimport {\n type ConnectUseCaseArgs,\n type DisconnectUseCaseArgs,\n type DiscoveredDevice,\n type GetConnectedDeviceUseCaseArgs,\n type SendApduUseCaseArgs,\n type StartDiscoveringUseCaseArgs,\n} from \"@api/types\";\nimport { configTypes } from \"@internal/config/di/configTypes\";\nimport { type GetDmkVersionUseCase } from \"@internal/config/use-case/GetDmkVersionUseCase\";\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport { type CloseSessionsUseCase } from \"@internal/device-session/use-case/CloseSessionsUseCase\";\nimport { type GetDeviceSessionStateUseCase } from \"@internal/device-session/use-case/GetDeviceSessionStateUseCase\";\nimport { discoveryTypes } from \"@internal/discovery/di/discoveryTypes\";\nimport { type ConnectUseCase } from \"@internal/discovery/use-case/ConnectUseCase\";\nimport { type DisconnectUseCase } from \"@internal/discovery/use-case/DisconnectUseCase\";\nimport { type GetConnectedDeviceUseCase } from \"@internal/discovery/use-case/GetConnectedDeviceUseCase\";\nimport { type ListConnectedDevicesUseCase } from \"@internal/discovery/use-case/ListConnectedDevicesUseCase\";\nimport { type ListenToConnectedDeviceUseCase } from \"@internal/discovery/use-case/ListenToConnectedDeviceUseCase\";\nimport { type ListenToKnownDevicesUseCase } from \"@internal/discovery/use-case/ListenToKnownDevicesUseCase\";\nimport type { StartDiscoveringUseCase } from \"@internal/discovery/use-case/StartDiscoveringUseCase\";\nimport type { StopDiscoveringUseCase } from \"@internal/discovery/use-case/StopDiscoveringUseCase\";\nimport { sendTypes } from \"@internal/send/di/sendTypes\";\nimport { type SendApduUseCase } from \"@internal/send/use-case/SendApduUseCase\";\nimport { makeContainer, type MakeContainerProps } from \"@root/src/di\";\n\nimport {\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n} from \"./device-action/DeviceAction\";\nimport { deviceActionTypes } from \"./device-action/di/deviceActionTypes\";\nimport { type ToggleDeviceSessionRefresherUseCase } from \"./device-session/use-case/ToggleDeviceSessionRefresher\";\nimport { type DmkError } from \"./Error\";\n\n/**\n * The main class to interact with the Device Management Kit.\n *\n * NB: do not instantiate this class directly, instead, use `LedgerDMKBuilder`.\n */\nexport class DeviceManagementKit {\n readonly container: Container;\n /** @internal */\n constructor({\n stub,\n transports,\n loggers,\n config,\n }: Partial<MakeContainerProps> = {}) {\n // NOTE: MakeContainerProps might not be the exact type here\n // For the init of the project this is sufficient, but we might need to\n // update the constructor arguments as we go (we might have more than just the container config)\n this.container = makeContainer({\n stub,\n transports,\n loggers,\n config,\n });\n }\n\n /**\n * Returns a promise resolving to the version of the SDK.\n */\n getVersion(): Promise<string> {\n return this.container\n .get<GetDmkVersionUseCase>(configTypes.GetDmkVersionUseCase)\n .getDmkVersion();\n }\n\n /**\n * Starts discovering devices connected.\n *\n * For the WeHID implementation, this use-case needs to be called as a result\n * of an user interaction (button \"click\" event for ex).\n *\n * @param {StartDiscoveringUseCaseArgs} args - The transport to use for discover, or undefined to discover from all transports.\n * @returns {Observable<DiscoveredDevice>} An observable of discovered devices.\n */\n startDiscovering(\n args: StartDiscoveringUseCaseArgs,\n ): Observable<DiscoveredDevice> {\n return this.container\n .get<StartDiscoveringUseCase>(discoveryTypes.StartDiscoveringUseCase)\n .execute(args);\n }\n\n /**\n * Stops discovering devices connected.\n */\n stopDiscovering() {\n return this.container\n .get<StopDiscoveringUseCase>(discoveryTypes.StopDiscoveringUseCase)\n .execute();\n }\n\n /**\n * Listen to list of known discovered devices (and later BLE).\n *\n * @returns {Observable<DiscoveredDevice[]>} An observable of known discovered devices.\n */\n listenToKnownDevices(): Observable<DiscoveredDevice[]> {\n return this.container\n .get<ListenToKnownDevicesUseCase>(\n discoveryTypes.ListenToKnownDevicesUseCase,\n )\n .execute();\n }\n\n /**\n * Connects to a device previously discovered with `DeviceManagementKit.startDiscovering`.\n * Creates a new device session which:\n * - Represents the connection to the device.\n * - Is terminated upon disconnection of the device.\n * - Exposes the device state through an observable (see `DeviceManagementKit.getDeviceSessionState`)\n * - Should be used for all subsequent communication with the device.\n *\n * @param {ConnectUseCaseArgs} args - The device ID (obtained in discovery) to connect to.\n * @returns The session ID to use for further communication with the device.\n */\n connect(args: ConnectUseCaseArgs): Promise<DeviceSessionId> {\n return this.container\n .get<ConnectUseCase>(discoveryTypes.ConnectUseCase)\n .execute(args);\n }\n\n /**\n * Disconnects to a discovered device.\n *\n * @param {DisconnectUseCaseArgs} args - The session ID to disconnect.\n */\n disconnect(args: DisconnectUseCaseArgs): Promise<void> {\n return this.container\n .get<DisconnectUseCase>(discoveryTypes.DisconnectUseCase)\n .execute(args);\n }\n\n /**\n * Sends an APDU command to a device through a device session.\n *\n * @param {SendApduUseCaseArgs} args - The device session ID and APDU command to send.\n */\n sendApdu(args: SendApduUseCaseArgs): Promise<ApduResponse> {\n return this.container\n .get<SendApduUseCase>(sendTypes.SendApduUseCase)\n .execute(args);\n }\n\n /**\n * Sends a command to a device through a device session.\n *\n * @param {SendCommandUseCaseArgs<Response, Args, ErrorCodes>} args - The device session ID, command, command error codes and command parameters to send.\n * @returns A promise resolving with the response from the command.\n */\n sendCommand<Response, Args, ErrorCodes>(\n args: SendCommandUseCaseArgs<Response, Args, ErrorCodes>,\n ): Promise<CommandResult<Response, ErrorCodes>> {\n return this.container\n .get<SendCommandUseCase>(commandTypes.SendCommandUseCase)\n .execute(args);\n }\n\n executeDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n >(\n args: ExecuteDeviceActionUseCaseArgs<\n Output,\n Input,\n Error,\n IntermediateValue\n >,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n return this.container\n .get<ExecuteDeviceActionUseCase>(\n deviceActionTypes.ExecuteDeviceActionUseCase,\n )\n .execute(args);\n }\n\n /**\n * Gets the connected from its device session ID.\n *\n * @param {GetConnectedDeviceUseCaseArgs} args - The device session ID.\n * @returns {ConnectedDevice} The connected device.\n */\n getConnectedDevice(args: GetConnectedDeviceUseCaseArgs): ConnectedDevice {\n return this.container\n .get<GetConnectedDeviceUseCase>(discoveryTypes.GetConnectedDeviceUseCase)\n .execute(args);\n }\n\n /**\n * Gets the device state of a session.\n *\n * @param {{DeviceSessionId}} args - The device session ID.\n * @returns {Observable<DeviceSessionState>} An observable of the session device state.\n */\n getDeviceSessionState(args: {\n sessionId: DeviceSessionId;\n }): Observable<DeviceSessionState> {\n return this.container\n .get<GetDeviceSessionStateUseCase>(\n deviceSessionTypes.GetDeviceSessionStateUseCase,\n )\n .execute(args);\n }\n\n /**\n * Close the Device Management kit.\n *\n */\n close() {\n return this.container\n .get<CloseSessionsUseCase>(deviceSessionTypes.CloseSessionsUseCase)\n .execute();\n }\n\n /**\n * Lists all connected devices.\n *\n * @returns {ConnectedDevice[]} The list of device sessions.\n */\n listConnectedDevices(): ConnectedDevice[] {\n return this.container\n .get<ListConnectedDevicesUseCase>(\n discoveryTypes.ListConnectedDevicesUseCase,\n )\n .execute();\n }\n\n /**\n * Listen to connected device.\n *\n * @returns {Observable<ConnectedDevice>} An observable of connected device.\n */\n listenToConnectedDevice(): Observable<ConnectedDevice> {\n return this.container\n .get<ListenToConnectedDeviceUseCase>(\n discoveryTypes.ListenToConnectedDeviceUseCase,\n )\n .execute();\n }\n\n /**\n * Toggle the device session refresher.\n *\n * @param {DeviceSessionId} args - The device session ID.\n */\n toggleDeviceSessionRefresher(args: {\n sessionId: DeviceSessionId;\n enabled: boolean;\n }) {\n return this.container\n .get<ToggleDeviceSessionRefresherUseCase>(\n deviceSessionTypes.ToggleDeviceSessionRefresherUseCase,\n )\n .execute(args);\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAGA,IAAAI,EAA6B,wCAsB7BC,EAA4B,2CAE5BC,EAAmC,0DAGnCC,EAA+B,iDAS/BC,EAA0B,uCAE1BC,EAAuD,wBAMvDC,EAAkC,gDAS3B,MAAMR,CAAoB,CACtB,UAET,YAAY,CACV,KAAAS,EACA,WAAAC,EACA,QAAAC,EACA,OAAAC,CACF,EAAiC,CAAC,EAAG,CAInC,KAAK,aAAY,iBAAc,CAC7B,KAAAH,EACA,WAAAC,EACA,QAAAC,EACA,OAAAC,CACF,CAAC,CACH,CAKA,YAA8B,CAC5B,OAAO,KAAK,UACT,IAA0B,cAAY,oBAAoB,EAC1D,cAAc,CACnB,CAWA,iBACEC,EAC8B,CAC9B,OAAO,KAAK,UACT,IAA6B,iBAAe,uBAAuB,EACnE,QAAQA,CAAI,CACjB,CAKA,iBAAkB,CAChB,OAAO,KAAK,UACT,IAA4B,iBAAe,sBAAsB,EACjE,QAAQ,CACb,CAOA,sBAAuD,CACrD,OAAO,KAAK,UACT,IACC,iBAAe,2BACjB,EACC,QAAQ,CACb,CAaA,QAAQA,EAAoD,CAC1D,OAAO,KAAK,UACT,IAAoB,iBAAe,cAAc,EACjD,QAAQA,CAAI,CACjB,CAOA,WAAWA,EAA4C,CACrD,OAAO,KAAK,UACT,IAAuB,iBAAe,iBAAiB,EACvD,QAAQA,CAAI,CACjB,CAOA,SAASA,EAAkD,CACzD,OAAO,KAAK,UACT,IAAqB,YAAU,eAAe,EAC9C,QAAQA,CAAI,CACjB,CAQA,YACEA,EAC8C,CAC9C,OAAO,KAAK,UACT,IAAwB,eAAa,kBAAkB,EACvD,QAAQA,CAAI,CACjB,CAEA,oBAMEA,EAMiE,CACjE,OAAO,KAAK,UACT,IACC,oBAAkB,0BACpB,EACC,QAAQA,CAAI,CACjB,CAQA,mBAAmBA,EAAsD,CACvE,OAAO,KAAK,UACT,IAA+B,iBAAe,yBAAyB,EACvE,QAAQA,CAAI,CACjB,CAQA,sBAAsBA,EAEa,CACjC,OAAO,KAAK,UACT,IACC,qBAAmB,4BACrB,EACC,QAAQA,CAAI,CACjB,CAMA,OAAQ,CACN,OAAO,KAAK,UACT,IAA0B,qBAAmB,oBAAoB,EACjE,QAAQ,CACb,CAOA,sBAA0C,CACxC,OAAO,KAAK,UACT,IACC,iBAAe,2BACjB,EACC,QAAQ,CACb,CAOA,yBAAuD,CACrD,OAAO,KAAK,UACT,IACC,iBAAe,8BACjB,EACC,QAAQ,CACb,CAOA,6BAA6BA,EAG1B,CACD,OAAO,KAAK,UACT,IACC,qBAAmB,mCACrB,EACC,QAAQA,CAAI,CACjB,CACF",
4
+ "sourcesContent": ["import { type Container } from \"inversify\";\nimport { type Observable } from \"rxjs\";\n\nimport { commandTypes } from \"@api/command/di/commandTypes\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport {\n type SendCommandUseCase,\n type SendCommandUseCaseArgs,\n} from \"@api/command/use-case/SendCommandUseCase\";\nimport {\n type ExecuteDeviceActionUseCase,\n type ExecuteDeviceActionUseCaseArgs,\n} from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type DeviceSessionId } from \"@api/device-session/types\";\nimport { type ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nimport {\n type ConnectUseCaseArgs,\n type DisconnectUseCaseArgs,\n type DiscoveredDevice,\n type GetConnectedDeviceUseCaseArgs,\n type SendApduUseCaseArgs,\n type StartDiscoveringUseCaseArgs,\n} from \"@api/types\";\nimport { configTypes } from \"@internal/config/di/configTypes\";\nimport { type GetDmkVersionUseCase } from \"@internal/config/use-case/GetDmkVersionUseCase\";\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport { type CloseSessionsUseCase } from \"@internal/device-session/use-case/CloseSessionsUseCase\";\nimport { type GetDeviceSessionStateUseCase } from \"@internal/device-session/use-case/GetDeviceSessionStateUseCase\";\nimport { discoveryTypes } from \"@internal/discovery/di/discoveryTypes\";\nimport { type ConnectUseCase } from \"@internal/discovery/use-case/ConnectUseCase\";\nimport { type DisconnectUseCase } from \"@internal/discovery/use-case/DisconnectUseCase\";\nimport { type GetConnectedDeviceUseCase } from \"@internal/discovery/use-case/GetConnectedDeviceUseCase\";\nimport { type ListConnectedDevicesUseCase } from \"@internal/discovery/use-case/ListConnectedDevicesUseCase\";\nimport {\n type ListenToAvailableDevicesUseCase,\n type ListenToAvailableDevicesUseCaseArgs,\n} from \"@internal/discovery/use-case/ListenToAvailableDevicesUseCase\";\nimport { type ListenToConnectedDeviceUseCase } from \"@internal/discovery/use-case/ListenToConnectedDeviceUseCase\";\nimport type { StartDiscoveringUseCase } from \"@internal/discovery/use-case/StartDiscoveringUseCase\";\nimport type { StopDiscoveringUseCase } from \"@internal/discovery/use-case/StopDiscoveringUseCase\";\nimport { sendTypes } from \"@internal/send/di/sendTypes\";\nimport { type SendApduUseCase } from \"@internal/send/use-case/SendApduUseCase\";\nimport { makeContainer, type MakeContainerProps } from \"@root/src/di\";\n\nimport {\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n} from \"./device-action/DeviceAction\";\nimport { deviceActionTypes } from \"./device-action/di/deviceActionTypes\";\nimport { type DisableDeviceSessionRefresherUseCase } from \"./device-session/use-case/DisableDeviceSessionRefresher\";\nimport { type DmkError } from \"./Error\";\n\n/**\n * The main class to interact with the Device Management Kit.\n *\n * NB: do not instantiate this class directly, instead, use `LedgerDMKBuilder`.\n */\nexport class DeviceManagementKit {\n readonly container: Container;\n /** @internal */\n constructor({\n stub,\n transports,\n loggers,\n config,\n }: Partial<MakeContainerProps> = {}) {\n // NOTE: MakeContainerProps might not be the exact type here\n // For the init of the project this is sufficient, but we might need to\n // update the constructor arguments as we go (we might have more than just the container config)\n this.container = makeContainer({\n stub,\n transports,\n loggers,\n config,\n });\n }\n\n /**\n * Returns a promise resolving to the version of the SDK.\n */\n getVersion(): Promise<string> {\n return this.container\n .get<GetDmkVersionUseCase>(configTypes.GetDmkVersionUseCase)\n .getDmkVersion();\n }\n\n /**\n * Starts discovering devices connected.\n *\n * For the WeHID implementation, this use-case needs to be called as a result\n * of an user interaction (button \"click\" event for ex).\n *\n * @param {StartDiscoveringUseCaseArgs} args - The transport to use for discover, or undefined to discover from all transports.\n * @returns {Observable<DiscoveredDevice>} An observable of discovered devices.\n */\n startDiscovering(\n args: StartDiscoveringUseCaseArgs,\n ): Observable<DiscoveredDevice> {\n return this.container\n .get<StartDiscoveringUseCase>(discoveryTypes.StartDiscoveringUseCase)\n .execute(args);\n }\n\n /**\n * Stops discovering devices connected.\n */\n stopDiscovering() {\n return this.container\n .get<StopDiscoveringUseCase>(discoveryTypes.StopDiscoveringUseCase)\n .execute();\n }\n\n /**\n * Listen to list of known discovered devices (and later BLE).\n * @param {ListenToAvailableDevicesUseCaseArgs} args - The transport to use for discover, or undefined to discover from all transports.\n * @returns {Observable<DiscoveredDevice[]>} An observable of known discovered devices.\n */\n listenToAvailableDevices(\n args: ListenToAvailableDevicesUseCaseArgs,\n ): Observable<DiscoveredDevice[]> {\n return this.container\n .get<ListenToAvailableDevicesUseCase>(\n discoveryTypes.ListenToAvailableDevicesUseCase,\n )\n .execute(args);\n }\n\n /**\n * Connects to a device previously discovered with `DeviceManagementKit.startDiscovering`.\n * Creates a new device session which:\n * - Represents the connection to the device.\n * - Is terminated upon disconnection of the device.\n * - Exposes the device state through an observable (see `DeviceManagementKit.getDeviceSessionState`)\n * - Should be used for all subsequent communication with the device.\n *\n * @param {ConnectUseCaseArgs} args - The device ID (obtained in discovery) to connect to.\n * @returns The session ID to use for further communication with the device.\n */\n connect(args: ConnectUseCaseArgs): Promise<DeviceSessionId> {\n return this.container\n .get<ConnectUseCase>(discoveryTypes.ConnectUseCase)\n .execute(args);\n }\n\n /**\n * Disconnects to a discovered device.\n *\n * @param {DisconnectUseCaseArgs} args - The session ID to disconnect.\n */\n disconnect(args: DisconnectUseCaseArgs): Promise<void> {\n return this.container\n .get<DisconnectUseCase>(discoveryTypes.DisconnectUseCase)\n .execute(args);\n }\n\n /**\n * Sends an APDU command to a device through a device session.\n *\n * @param {SendApduUseCaseArgs} args - The device session ID and APDU command to send.\n */\n sendApdu(args: SendApduUseCaseArgs): Promise<ApduResponse> {\n return this.container\n .get<SendApduUseCase>(sendTypes.SendApduUseCase)\n .execute(args);\n }\n\n /**\n * Sends a command to a device through a device session.\n *\n * @param {SendCommandUseCaseArgs<Response, Args, ErrorCodes>} args - The device session ID, command, command error codes and command parameters to send.\n * @returns A promise resolving with the response from the command.\n */\n sendCommand<Response, Args, ErrorCodes>(\n args: SendCommandUseCaseArgs<Response, Args, ErrorCodes>,\n ): Promise<CommandResult<Response, ErrorCodes>> {\n return this.container\n .get<SendCommandUseCase>(commandTypes.SendCommandUseCase)\n .execute(args);\n }\n\n executeDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n >(\n args: ExecuteDeviceActionUseCaseArgs<\n Output,\n Input,\n Error,\n IntermediateValue\n >,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n return this.container\n .get<ExecuteDeviceActionUseCase>(\n deviceActionTypes.ExecuteDeviceActionUseCase,\n )\n .execute(args);\n }\n\n /**\n * Gets the connected from its device session ID.\n *\n * @param {GetConnectedDeviceUseCaseArgs} args - The device session ID.\n * @returns {ConnectedDevice} The connected device.\n */\n getConnectedDevice(args: GetConnectedDeviceUseCaseArgs): ConnectedDevice {\n return this.container\n .get<GetConnectedDeviceUseCase>(discoveryTypes.GetConnectedDeviceUseCase)\n .execute(args);\n }\n\n /**\n * Gets the device state of a session.\n *\n * @param {{ sessionId: DeviceSessionId }} args - The device session ID.\n * @returns {Observable<DeviceSessionState>} An observable of the session device state.\n */\n getDeviceSessionState(args: {\n sessionId: DeviceSessionId;\n }): Observable<DeviceSessionState> {\n return this.container\n .get<GetDeviceSessionStateUseCase>(\n deviceSessionTypes.GetDeviceSessionStateUseCase,\n )\n .execute(args);\n }\n\n /**\n * Close the Device Management kit.\n *\n */\n close() {\n return this.container\n .get<CloseSessionsUseCase>(deviceSessionTypes.CloseSessionsUseCase)\n .execute();\n }\n\n /**\n * Lists all connected devices.\n *\n * @returns {ConnectedDevice[]} The list of device sessions.\n */\n listConnectedDevices(): ConnectedDevice[] {\n return this.container\n .get<ListConnectedDevicesUseCase>(\n discoveryTypes.ListConnectedDevicesUseCase,\n )\n .execute();\n }\n\n /**\n * Listen to connected device.\n *\n * @returns {Observable<ConnectedDevice>} An observable of connected device.\n */\n listenToConnectedDevice(): Observable<ConnectedDevice> {\n return this.container\n .get<ListenToConnectedDeviceUseCase>(\n discoveryTypes.ListenToConnectedDeviceUseCase,\n )\n .execute();\n }\n\n /**\n * Disable the device session refresher.\n *\n * @param {DisableDeviceSessionRefresherUseCaseArgs} args - The device session ID and a string to identify the blocker.\n * @returns {() => void} A function to reenable the device session refresher.\n */\n disableDeviceSessionRefresher(args: {\n sessionId: DeviceSessionId;\n blockerId: string;\n }) {\n return this.container\n .get<DisableDeviceSessionRefresherUseCase>(\n deviceSessionTypes.DisableDeviceSessionRefresherUseCase,\n )\n .execute(args);\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAGA,IAAAI,EAA6B,wCAsB7BC,EAA4B,2CAE5BC,EAAmC,0DAGnCC,EAA+B,iDAY/BC,EAA0B,uCAE1BC,EAAuD,wBAMvDC,EAAkC,gDAS3B,MAAMR,CAAoB,CACtB,UAET,YAAY,CACV,KAAAS,EACA,WAAAC,EACA,QAAAC,EACA,OAAAC,CACF,EAAiC,CAAC,EAAG,CAInC,KAAK,aAAY,iBAAc,CAC7B,KAAAH,EACA,WAAAC,EACA,QAAAC,EACA,OAAAC,CACF,CAAC,CACH,CAKA,YAA8B,CAC5B,OAAO,KAAK,UACT,IAA0B,cAAY,oBAAoB,EAC1D,cAAc,CACnB,CAWA,iBACEC,EAC8B,CAC9B,OAAO,KAAK,UACT,IAA6B,iBAAe,uBAAuB,EACnE,QAAQA,CAAI,CACjB,CAKA,iBAAkB,CAChB,OAAO,KAAK,UACT,IAA4B,iBAAe,sBAAsB,EACjE,QAAQ,CACb,CAOA,yBACEA,EACgC,CAChC,OAAO,KAAK,UACT,IACC,iBAAe,+BACjB,EACC,QAAQA,CAAI,CACjB,CAaA,QAAQA,EAAoD,CAC1D,OAAO,KAAK,UACT,IAAoB,iBAAe,cAAc,EACjD,QAAQA,CAAI,CACjB,CAOA,WAAWA,EAA4C,CACrD,OAAO,KAAK,UACT,IAAuB,iBAAe,iBAAiB,EACvD,QAAQA,CAAI,CACjB,CAOA,SAASA,EAAkD,CACzD,OAAO,KAAK,UACT,IAAqB,YAAU,eAAe,EAC9C,QAAQA,CAAI,CACjB,CAQA,YACEA,EAC8C,CAC9C,OAAO,KAAK,UACT,IAAwB,eAAa,kBAAkB,EACvD,QAAQA,CAAI,CACjB,CAEA,oBAMEA,EAMiE,CACjE,OAAO,KAAK,UACT,IACC,oBAAkB,0BACpB,EACC,QAAQA,CAAI,CACjB,CAQA,mBAAmBA,EAAsD,CACvE,OAAO,KAAK,UACT,IAA+B,iBAAe,yBAAyB,EACvE,QAAQA,CAAI,CACjB,CAQA,sBAAsBA,EAEa,CACjC,OAAO,KAAK,UACT,IACC,qBAAmB,4BACrB,EACC,QAAQA,CAAI,CACjB,CAMA,OAAQ,CACN,OAAO,KAAK,UACT,IAA0B,qBAAmB,oBAAoB,EACjE,QAAQ,CACb,CAOA,sBAA0C,CACxC,OAAO,KAAK,UACT,IACC,iBAAe,2BACjB,EACC,QAAQ,CACb,CAOA,yBAAuD,CACrD,OAAO,KAAK,UACT,IACC,iBAAe,8BACjB,EACC,QAAQ,CACb,CAQA,8BAA8BA,EAG3B,CACD,OAAO,KAAK,UACT,IACC,qBAAmB,oCACrB,EACC,QAAQA,CAAI,CACjB,CACF",
6
6
  "names": ["DeviceManagementKit_exports", "__export", "DeviceManagementKit", "__toCommonJS", "import_commandTypes", "import_configTypes", "import_deviceSessionTypes", "import_discoveryTypes", "import_sendTypes", "import_di", "import_deviceActionTypes", "stub", "transports", "loggers", "config", "args"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var D=Object.create;var a=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var U=(t,o,n,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of b(o))!x.call(t,i)&&i!==n&&a(t,i,{get:()=>o[i],enumerable:!(r=C(o,i))||r.enumerable});return t};var k=(t,o,n)=>(n=t!=null?D(S(t)):{},U(o||!t||!t.__esModule?a(n,"default",{value:t,enumerable:!0}):n,t));var m=require("../internal/config/data/LocalConfigDataSource.stub"),p=require("../internal/config/di/configTypes"),f=require("../internal/device-session/di/deviceSessionTypes"),s=require("../internal/discovery/di/discoveryTypes"),l=require("../internal/send/di/sendTypes"),u=k(require("../../package.json")),h=require("../../src/di.stub"),g=require("./command/di/commandTypes"),v=require("./logger-subscriber/service/ConsoleLogger"),c=require("./DeviceManagementKit");vi.mock("./logger-subscriber/service/ConsoleLogger");let e,d;describe("DeviceManagementKit",()=>{describe("clean",()=>{beforeEach(()=>{d=new v.ConsoleLogger,e=new c.DeviceManagementKit({stub:!1,loggers:[d],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url"}})}),it("should create an instance",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(c.DeviceManagementKit)}),it("should return a clean `version`",async()=>{expect(await e.getVersion()).toBe(u.default.version)}),it("should have startDiscovery method",()=>{expect(e.startDiscovering).toBeDefined()}),it("should have stopDiscovery method",()=>{expect(e.stopDiscovering).toBeDefined()}),it("should have connect method",()=>{expect(e.connect).toBeDefined()}),it("should have sendApdu method",()=>{expect(e.sendApdu).toBeDefined()}),it("should have getConnectedDevice method",()=>{expect(e.getConnectedDevice).toBeDefined()}),it("should have sendCommand method",()=>{expect(e.sendCommand).toBeDefined()}),it("should have listConnectedDevices method",()=>{expect(e.listConnectedDevices).toBeDefined()}),it("should have listenToConnectedDevice method",()=>{expect(e.listenToConnectedDevice).toBeDefined()}),it("should have toggleDeviceSessionRefresher method",()=>{expect(e.toggleDeviceSessionRefresher).toBeDefined()})}),describe("stubbed",()=>{beforeEach(()=>{e=new c.DeviceManagementKit({stub:!0,loggers:[],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url"}})}),it("should create a stubbed dmk",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(c.DeviceManagementKit)}),it("should return a stubbed config",()=>{expect(e.container.get(p.configTypes.LocalConfigDataSource)).toBeInstanceOf(m.StubLocalConfigDataSource)}),it("should return a stubbed version",async()=>{expect(await e.getVersion()).toBe("0.0.0-stub.1")}),it.each([[s.discoveryTypes.StartDiscoveringUseCase],[s.discoveryTypes.StopDiscoveringUseCase],[s.discoveryTypes.ConnectUseCase],[l.sendTypes.SendApduUseCase],[g.commandTypes.SendCommandUseCase],[s.discoveryTypes.GetConnectedDeviceUseCase],[s.discoveryTypes.DisconnectUseCase],[f.deviceSessionTypes.GetDeviceSessionStateUseCase],[s.discoveryTypes.ListConnectedDevicesUseCase],[s.discoveryTypes.ListenToConnectedDeviceUseCase]])("should have %s use case",t=>{const o=e.container.get(t);expect(o).toBeInstanceOf(h.StubUseCase),expect(o.execute()).toBe("stub")})})});
1
+ "use strict";var D=Object.create;var a=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var U=(t,o,i,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of b(o))!x.call(t,n)&&n!==i&&a(t,n,{get:()=>o[n],enumerable:!(r=C(o,n))||r.enumerable});return t};var k=(t,o,i)=>(i=t!=null?D(S(t)):{},U(o||!t||!t.__esModule?a(i,"default",{value:t,enumerable:!0}):i,t));var m=require("../internal/config/data/LocalConfigDataSource.stub"),p=require("../internal/config/di/configTypes"),f=require("../internal/device-session/di/deviceSessionTypes"),s=require("../internal/discovery/di/discoveryTypes"),l=require("../internal/send/di/sendTypes"),u=k(require("../../package.json")),h=require("../../src/di.stub"),v=require("./command/di/commandTypes"),g=require("./logger-subscriber/service/ConsoleLogger"),c=require("./DeviceManagementKit");vi.mock("./logger-subscriber/service/ConsoleLogger");let e,d;describe("DeviceManagementKit",()=>{describe("clean",()=>{beforeEach(()=>{d=new g.ConsoleLogger,e=new c.DeviceManagementKit({stub:!1,loggers:[d],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url"}})}),it("should create an instance",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(c.DeviceManagementKit)}),it("should return a clean `version`",async()=>{expect(await e.getVersion()).toBe(u.default.version)}),it("should have startDiscovery method",()=>{expect(e.startDiscovering).toBeDefined()}),it("should have stopDiscovery method",()=>{expect(e.stopDiscovering).toBeDefined()}),it("should have connect method",()=>{expect(e.connect).toBeDefined()}),it("should have sendApdu method",()=>{expect(e.sendApdu).toBeDefined()}),it("should have getConnectedDevice method",()=>{expect(e.getConnectedDevice).toBeDefined()}),it("should have sendCommand method",()=>{expect(e.sendCommand).toBeDefined()}),it("should have listConnectedDevices method",()=>{expect(e.listConnectedDevices).toBeDefined()}),it("should have listenToConnectedDevice method",()=>{expect(e.listenToConnectedDevice).toBeDefined()}),it("should have disableDeviceSessionRefresher method",()=>{expect(e.disableDeviceSessionRefresher).toBeDefined()})}),describe("stubbed",()=>{beforeEach(()=>{e=new c.DeviceManagementKit({stub:!0,loggers:[],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url"}})}),it("should create a stubbed dmk",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(c.DeviceManagementKit)}),it("should return a stubbed config",()=>{expect(e.container.get(p.configTypes.LocalConfigDataSource)).toBeInstanceOf(m.StubLocalConfigDataSource)}),it("should return a stubbed version",async()=>{expect(await e.getVersion()).toBe("0.0.0-stub.1")}),it.each([[s.discoveryTypes.StartDiscoveringUseCase],[s.discoveryTypes.StopDiscoveringUseCase],[s.discoveryTypes.ConnectUseCase],[l.sendTypes.SendApduUseCase],[v.commandTypes.SendCommandUseCase],[s.discoveryTypes.GetConnectedDeviceUseCase],[s.discoveryTypes.DisconnectUseCase],[f.deviceSessionTypes.GetDeviceSessionStateUseCase],[s.discoveryTypes.ListConnectedDevicesUseCase],[s.discoveryTypes.ListenToConnectedDeviceUseCase]])("should have %s use case",t=>{const o=e.container.get(t);expect(o).toBeInstanceOf(h.StubUseCase),expect(o.execute()).toBe("stub")})})});
2
2
  //# sourceMappingURL=DeviceManagementKit.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/DeviceManagementKit.test.ts"],
4
- "sourcesContent": ["import { type interfaces } from \"inversify\";\n\nimport { type LocalConfigDataSource } from \"@internal/config/data/ConfigDataSource\";\nimport { StubLocalConfigDataSource } from \"@internal/config/data/LocalConfigDataSource.stub\";\nimport { configTypes } from \"@internal/config/di/configTypes\";\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport { discoveryTypes } from \"@internal/discovery/di/discoveryTypes\";\nimport { sendTypes } from \"@internal/send/di/sendTypes\";\nimport pkg from \"@root/package.json\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandTypes } from \"./command/di/commandTypes\";\nimport { ConsoleLogger } from \"./logger-subscriber/service/ConsoleLogger\";\nimport { DeviceManagementKit } from \"./DeviceManagementKit\";\n\nvi.mock(\"./logger-subscriber/service/ConsoleLogger\");\n\nlet dmk: DeviceManagementKit;\nlet logger: ConsoleLogger;\ndescribe(\"DeviceManagementKit\", () => {\n describe(\"clean\", () => {\n beforeEach(() => {\n logger = new ConsoleLogger();\n dmk = new DeviceManagementKit({\n stub: false,\n loggers: [logger],\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n },\n });\n });\n\n it(\"should create an instance\", () => {\n expect(dmk).toBeDefined();\n expect(dmk).toBeInstanceOf(DeviceManagementKit);\n });\n\n it(\"should return a clean `version`\", async () => {\n expect(await dmk.getVersion()).toBe(pkg.version);\n });\n\n it(\"should have startDiscovery method\", () => {\n expect(dmk.startDiscovering).toBeDefined();\n });\n\n it(\"should have stopDiscovery method\", () => {\n expect(dmk.stopDiscovering).toBeDefined();\n });\n\n it(\"should have connect method\", () => {\n expect(dmk.connect).toBeDefined();\n });\n\n it(\"should have sendApdu method\", () => {\n expect(dmk.sendApdu).toBeDefined();\n });\n\n it(\"should have getConnectedDevice method\", () => {\n expect(dmk.getConnectedDevice).toBeDefined();\n });\n\n it(\"should have sendCommand method\", () => {\n expect(dmk.sendCommand).toBeDefined();\n });\n\n it(\"should have listConnectedDevices method\", () => {\n expect(dmk.listConnectedDevices).toBeDefined();\n });\n\n it(\"should have listenToConnectedDevice method\", () => {\n expect(dmk.listenToConnectedDevice).toBeDefined();\n });\n\n it(\"should have toggleDeviceSessionRefresher method\", () => {\n expect(dmk.toggleDeviceSessionRefresher).toBeDefined();\n });\n });\n\n describe(\"stubbed\", () => {\n beforeEach(() => {\n dmk = new DeviceManagementKit({\n stub: true,\n loggers: [],\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n },\n });\n });\n\n it(\"should create a stubbed dmk\", () => {\n expect(dmk).toBeDefined();\n expect(dmk).toBeInstanceOf(DeviceManagementKit);\n });\n\n it(\"should return a stubbed config\", () => {\n expect(\n dmk.container.get<LocalConfigDataSource>(\n configTypes.LocalConfigDataSource,\n ),\n ).toBeInstanceOf(StubLocalConfigDataSource);\n });\n\n it(\"should return a stubbed version\", async () => {\n expect(await dmk.getVersion()).toBe(\"0.0.0-stub.1\");\n });\n\n it.each([\n [discoveryTypes.StartDiscoveringUseCase],\n [discoveryTypes.StopDiscoveringUseCase],\n [discoveryTypes.ConnectUseCase],\n [sendTypes.SendApduUseCase],\n [commandTypes.SendCommandUseCase],\n [discoveryTypes.GetConnectedDeviceUseCase],\n [discoveryTypes.DisconnectUseCase],\n [deviceSessionTypes.GetDeviceSessionStateUseCase],\n [discoveryTypes.ListConnectedDevicesUseCase],\n [discoveryTypes.ListenToConnectedDeviceUseCase],\n ])(\n \"should have %s use case\",\n (diSymbol: interfaces.ServiceIdentifier<StubUseCase>) => {\n const uc = dmk.container.get<StubUseCase>(diSymbol);\n expect(uc).toBeInstanceOf(StubUseCase);\n expect(uc.execute()).toBe(\"stub\");\n },\n );\n });\n});\n"],
5
- "mappings": "wdAGA,IAAAA,EAA0C,4DAC1CC,EAA4B,2CAC5BC,EAAmC,0DACnCC,EAA+B,iDAC/BC,EAA0B,uCAC1BC,EAAgB,iCAChBC,EAA4B,6BAE5BC,EAA6B,qCAC7BC,EAA8B,qDAC9BC,EAAoC,iCAEpC,GAAG,KAAK,2CAA2C,EAEnD,IAAIC,EACAC,EACJ,SAAS,sBAAuB,IAAM,CACpC,SAAS,QAAS,IAAM,CACtB,WAAW,IAAM,CACfA,EAAS,IAAI,gBACbD,EAAM,IAAI,sBAAoB,CAC5B,KAAM,GACN,QAAS,CAACC,CAAM,EAChB,OAAQ,CACN,cAAe,kBACf,QAAS,uBACT,aAAc,2BAChB,CACF,CAAC,CACH,CAAC,EAED,GAAG,4BAA6B,IAAM,CACpC,OAAOD,CAAG,EAAE,YAAY,EACxB,OAAOA,CAAG,EAAE,eAAe,qBAAmB,CAChD,CAAC,EAED,GAAG,kCAAmC,SAAY,CAChD,OAAO,MAAMA,EAAI,WAAW,CAAC,EAAE,KAAK,EAAAE,QAAI,OAAO,CACjD,CAAC,EAED,GAAG,oCAAqC,IAAM,CAC5C,OAAOF,EAAI,gBAAgB,EAAE,YAAY,CAC3C,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,OAAOA,EAAI,eAAe,EAAE,YAAY,CAC1C,CAAC,EAED,GAAG,6BAA8B,IAAM,CACrC,OAAOA,EAAI,OAAO,EAAE,YAAY,CAClC,CAAC,EAED,GAAG,8BAA+B,IAAM,CACtC,OAAOA,EAAI,QAAQ,EAAE,YAAY,CACnC,CAAC,EAED,GAAG,wCAAyC,IAAM,CAChD,OAAOA,EAAI,kBAAkB,EAAE,YAAY,CAC7C,CAAC,EAED,GAAG,iCAAkC,IAAM,CACzC,OAAOA,EAAI,WAAW,EAAE,YAAY,CACtC,CAAC,EAED,GAAG,0CAA2C,IAAM,CAClD,OAAOA,EAAI,oBAAoB,EAAE,YAAY,CAC/C,CAAC,EAED,GAAG,6CAA8C,IAAM,CACrD,OAAOA,EAAI,uBAAuB,EAAE,YAAY,CAClD,CAAC,EAED,GAAG,kDAAmD,IAAM,CAC1D,OAAOA,EAAI,4BAA4B,EAAE,YAAY,CACvD,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,WAAW,IAAM,CACfA,EAAM,IAAI,sBAAoB,CAC5B,KAAM,GACN,QAAS,CAAC,EACV,OAAQ,CACN,cAAe,kBACf,QAAS,uBACT,aAAc,2BAChB,CACF,CAAC,CACH,CAAC,EAED,GAAG,8BAA+B,IAAM,CACtC,OAAOA,CAAG,EAAE,YAAY,EACxB,OAAOA,CAAG,EAAE,eAAe,qBAAmB,CAChD,CAAC,EAED,GAAG,iCAAkC,IAAM,CACzC,OACEA,EAAI,UAAU,IACZ,cAAY,qBACd,CACF,EAAE,eAAe,2BAAyB,CAC5C,CAAC,EAED,GAAG,kCAAmC,SAAY,CAChD,OAAO,MAAMA,EAAI,WAAW,CAAC,EAAE,KAAK,cAAc,CACpD,CAAC,EAED,GAAG,KAAK,CACN,CAAC,iBAAe,uBAAuB,EACvC,CAAC,iBAAe,sBAAsB,EACtC,CAAC,iBAAe,cAAc,EAC9B,CAAC,YAAU,eAAe,EAC1B,CAAC,eAAa,kBAAkB,EAChC,CAAC,iBAAe,yBAAyB,EACzC,CAAC,iBAAe,iBAAiB,EACjC,CAAC,qBAAmB,4BAA4B,EAChD,CAAC,iBAAe,2BAA2B,EAC3C,CAAC,iBAAe,8BAA8B,CAChD,CAAC,EACC,0BACCG,GAAwD,CACvD,MAAMC,EAAKJ,EAAI,UAAU,IAAiBG,CAAQ,EAClD,OAAOC,CAAE,EAAE,eAAe,aAAW,EACrC,OAAOA,EAAG,QAAQ,CAAC,EAAE,KAAK,MAAM,CAClC,CACF,CACF,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { type interfaces } from \"inversify\";\n\nimport { type LocalConfigDataSource } from \"@internal/config/data/ConfigDataSource\";\nimport { StubLocalConfigDataSource } from \"@internal/config/data/LocalConfigDataSource.stub\";\nimport { configTypes } from \"@internal/config/di/configTypes\";\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport { discoveryTypes } from \"@internal/discovery/di/discoveryTypes\";\nimport { sendTypes } from \"@internal/send/di/sendTypes\";\nimport pkg from \"@root/package.json\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandTypes } from \"./command/di/commandTypes\";\nimport { ConsoleLogger } from \"./logger-subscriber/service/ConsoleLogger\";\nimport { DeviceManagementKit } from \"./DeviceManagementKit\";\n\nvi.mock(\"./logger-subscriber/service/ConsoleLogger\");\n\nlet dmk: DeviceManagementKit;\nlet logger: ConsoleLogger;\ndescribe(\"DeviceManagementKit\", () => {\n describe(\"clean\", () => {\n beforeEach(() => {\n logger = new ConsoleLogger();\n dmk = new DeviceManagementKit({\n stub: false,\n loggers: [logger],\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n },\n });\n });\n\n it(\"should create an instance\", () => {\n expect(dmk).toBeDefined();\n expect(dmk).toBeInstanceOf(DeviceManagementKit);\n });\n\n it(\"should return a clean `version`\", async () => {\n expect(await dmk.getVersion()).toBe(pkg.version);\n });\n\n it(\"should have startDiscovery method\", () => {\n expect(dmk.startDiscovering).toBeDefined();\n });\n\n it(\"should have stopDiscovery method\", () => {\n expect(dmk.stopDiscovering).toBeDefined();\n });\n\n it(\"should have connect method\", () => {\n expect(dmk.connect).toBeDefined();\n });\n\n it(\"should have sendApdu method\", () => {\n expect(dmk.sendApdu).toBeDefined();\n });\n\n it(\"should have getConnectedDevice method\", () => {\n expect(dmk.getConnectedDevice).toBeDefined();\n });\n\n it(\"should have sendCommand method\", () => {\n expect(dmk.sendCommand).toBeDefined();\n });\n\n it(\"should have listConnectedDevices method\", () => {\n expect(dmk.listConnectedDevices).toBeDefined();\n });\n\n it(\"should have listenToConnectedDevice method\", () => {\n expect(dmk.listenToConnectedDevice).toBeDefined();\n });\n\n it(\"should have disableDeviceSessionRefresher method\", () => {\n expect(dmk.disableDeviceSessionRefresher).toBeDefined();\n });\n });\n\n describe(\"stubbed\", () => {\n beforeEach(() => {\n dmk = new DeviceManagementKit({\n stub: true,\n loggers: [],\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n },\n });\n });\n\n it(\"should create a stubbed dmk\", () => {\n expect(dmk).toBeDefined();\n expect(dmk).toBeInstanceOf(DeviceManagementKit);\n });\n\n it(\"should return a stubbed config\", () => {\n expect(\n dmk.container.get<LocalConfigDataSource>(\n configTypes.LocalConfigDataSource,\n ),\n ).toBeInstanceOf(StubLocalConfigDataSource);\n });\n\n it(\"should return a stubbed version\", async () => {\n expect(await dmk.getVersion()).toBe(\"0.0.0-stub.1\");\n });\n\n it.each([\n [discoveryTypes.StartDiscoveringUseCase],\n [discoveryTypes.StopDiscoveringUseCase],\n [discoveryTypes.ConnectUseCase],\n [sendTypes.SendApduUseCase],\n [commandTypes.SendCommandUseCase],\n [discoveryTypes.GetConnectedDeviceUseCase],\n [discoveryTypes.DisconnectUseCase],\n [deviceSessionTypes.GetDeviceSessionStateUseCase],\n [discoveryTypes.ListConnectedDevicesUseCase],\n [discoveryTypes.ListenToConnectedDeviceUseCase],\n ])(\n \"should have %s use case\",\n (diSymbol: interfaces.ServiceIdentifier<StubUseCase>) => {\n const uc = dmk.container.get<StubUseCase>(diSymbol);\n expect(uc).toBeInstanceOf(StubUseCase);\n expect(uc.execute()).toBe(\"stub\");\n },\n );\n });\n});\n"],
5
+ "mappings": "wdAGA,IAAAA,EAA0C,4DAC1CC,EAA4B,2CAC5BC,EAAmC,0DACnCC,EAA+B,iDAC/BC,EAA0B,uCAC1BC,EAAgB,iCAChBC,EAA4B,6BAE5BC,EAA6B,qCAC7BC,EAA8B,qDAC9BC,EAAoC,iCAEpC,GAAG,KAAK,2CAA2C,EAEnD,IAAIC,EACAC,EACJ,SAAS,sBAAuB,IAAM,CACpC,SAAS,QAAS,IAAM,CACtB,WAAW,IAAM,CACfA,EAAS,IAAI,gBACbD,EAAM,IAAI,sBAAoB,CAC5B,KAAM,GACN,QAAS,CAACC,CAAM,EAChB,OAAQ,CACN,cAAe,kBACf,QAAS,uBACT,aAAc,2BAChB,CACF,CAAC,CACH,CAAC,EAED,GAAG,4BAA6B,IAAM,CACpC,OAAOD,CAAG,EAAE,YAAY,EACxB,OAAOA,CAAG,EAAE,eAAe,qBAAmB,CAChD,CAAC,EAED,GAAG,kCAAmC,SAAY,CAChD,OAAO,MAAMA,EAAI,WAAW,CAAC,EAAE,KAAK,EAAAE,QAAI,OAAO,CACjD,CAAC,EAED,GAAG,oCAAqC,IAAM,CAC5C,OAAOF,EAAI,gBAAgB,EAAE,YAAY,CAC3C,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,OAAOA,EAAI,eAAe,EAAE,YAAY,CAC1C,CAAC,EAED,GAAG,6BAA8B,IAAM,CACrC,OAAOA,EAAI,OAAO,EAAE,YAAY,CAClC,CAAC,EAED,GAAG,8BAA+B,IAAM,CACtC,OAAOA,EAAI,QAAQ,EAAE,YAAY,CACnC,CAAC,EAED,GAAG,wCAAyC,IAAM,CAChD,OAAOA,EAAI,kBAAkB,EAAE,YAAY,CAC7C,CAAC,EAED,GAAG,iCAAkC,IAAM,CACzC,OAAOA,EAAI,WAAW,EAAE,YAAY,CACtC,CAAC,EAED,GAAG,0CAA2C,IAAM,CAClD,OAAOA,EAAI,oBAAoB,EAAE,YAAY,CAC/C,CAAC,EAED,GAAG,6CAA8C,IAAM,CACrD,OAAOA,EAAI,uBAAuB,EAAE,YAAY,CAClD,CAAC,EAED,GAAG,mDAAoD,IAAM,CAC3D,OAAOA,EAAI,6BAA6B,EAAE,YAAY,CACxD,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,WAAW,IAAM,CACfA,EAAM,IAAI,sBAAoB,CAC5B,KAAM,GACN,QAAS,CAAC,EACV,OAAQ,CACN,cAAe,kBACf,QAAS,uBACT,aAAc,2BAChB,CACF,CAAC,CACH,CAAC,EAED,GAAG,8BAA+B,IAAM,CACtC,OAAOA,CAAG,EAAE,YAAY,EACxB,OAAOA,CAAG,EAAE,eAAe,qBAAmB,CAChD,CAAC,EAED,GAAG,iCAAkC,IAAM,CACzC,OACEA,EAAI,UAAU,IACZ,cAAY,qBACd,CACF,EAAE,eAAe,2BAAyB,CAC5C,CAAC,EAED,GAAG,kCAAmC,SAAY,CAChD,OAAO,MAAMA,EAAI,WAAW,CAAC,EAAE,KAAK,cAAc,CACpD,CAAC,EAED,GAAG,KAAK,CACN,CAAC,iBAAe,uBAAuB,EACvC,CAAC,iBAAe,sBAAsB,EACtC,CAAC,iBAAe,cAAc,EAC9B,CAAC,YAAU,eAAe,EAC1B,CAAC,eAAa,kBAAkB,EAChC,CAAC,iBAAe,yBAAyB,EACzC,CAAC,iBAAe,iBAAiB,EACjC,CAAC,qBAAmB,4BAA4B,EAChD,CAAC,iBAAe,2BAA2B,EAC3C,CAAC,iBAAe,8BAA8B,CAChD,CAAC,EACC,0BACCG,GAAwD,CACvD,MAAMC,EAAKJ,EAAI,UAAU,IAAiBG,CAAQ,EAClD,OAAOC,CAAE,EAAE,eAAe,aAAW,EACrC,OAAOA,EAAG,QAAQ,CAAC,EAAE,KAAK,MAAM,CAClC,CACF,CACF,CAAC,CACH,CAAC",
6
6
  "names": ["import_LocalConfigDataSource", "import_configTypes", "import_deviceSessionTypes", "import_discoveryTypes", "import_sendTypes", "import_package", "import_di", "import_commandTypes", "import_ConsoleLogger", "import_DeviceManagementKit", "dmk", "logger", "pkg", "diSymbol", "uc"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var d=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var C=(o,r)=>{for(var t in r)d(o,t,{get:r[t],enumerable:!0})},E=(o,r,t,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of f(r))!F.call(o,n)&&n!==t&&d(o,n,{get:()=>r[n],enumerable:!(e=A(r,n))||e.enumerable});return o};var I=o=>E(d({},"__esModule",{value:!0}),o);var R={};C(R,{GetOsVersionCommand:()=>L});module.exports=I(R);var c=require("../../apdu/utils/ApduBuilder"),m=require("../../apdu/utils/ApduParser"),s=require("../../command/model/CommandResult"),l=require("../../command/utils/CommandUtils"),p=require("../../command/utils/GlobalCommandError"),g=require("../../device/DeviceModel");class L{args=void 0;getApdu(){const r={cla:224,ins:1,p1:0,p2:0};return new c.ApduBuilder(r).build()}parseResponse(r,t){if(!l.CommandUtils.isSuccessResponse(r))return(0,s.CommandResultFactory)({error:p.GlobalCommandErrorHandler.handle(r)});const e=new m.ApduParser(r),n=parseInt(e.encodeToHexaString(e.extractFieldByLength(4)),16),u=e.encodeToString(e.extractFieldLVEncoded()),V=parseInt(e.encodeToHexaString(e.extractFieldLVEncoded()).toString(),16),x=e.encodeToString(e.extractFieldLVEncoded()),y=e.encodeToString(e.extractFieldLVEncoded());let i="00";t===g.DeviceModelId.NANO_X&&(i=e.encodeToHexaString(e.extractFieldLVEncoded()));const S=e.encodeToHexaString(e.extractFieldLVEncoded()),a=e.encodeToHexaString(e.extractFieldLVEncoded());return(0,s.CommandResultFactory)({data:{targetId:n,seVersion:u,seFlags:V,mcuSephVersion:x,mcuBootloaderVersion:y,hwVersion:i,langId:S,recoverState:a||"0"}})}}0&&(module.exports={GetOsVersionCommand});
1
+ "use strict";var s=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var C=(o,r)=>{for(var n in r)s(o,n,{get:r[n],enumerable:!0})},O=(o,r,n,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of E(r))!I.call(o,t)&&t!==n&&s(o,t,{get:()=>r[t],enumerable:!(e=F(r,t))||e.enumerable});return o};var R=o=>O(s({},"__esModule",{value:!0}),o);var v={};C(v,{GetOsVersionCommand:()=>G});module.exports=R(v);var l=require("../../apdu/utils/ApduBuilder"),c=require("../../apdu/utils/ApduParser"),d=require("../../command/model/CommandResult"),p=require("../../command/utils/CommandUtils"),g=require("../../command/utils/GlobalCommandError"),u=require("../../device/DeviceModel"),y=require("./SecureElementFlagsParser");class G{args=void 0;getApdu(){const r={cla:224,ins:1,p1:0,p2:0};return new l.ApduBuilder(r).build()}parseResponse(r,n){if(!p.CommandUtils.isSuccessResponse(r))return(0,d.CommandResultFactory)({error:g.GlobalCommandErrorHandler.handle(r)});const e=new c.ApduParser(r),t=parseInt(e.encodeToHexaString(e.extractFieldByLength(4)),16),V=e.encodeToString(e.extractFieldLVEncoded()),a=e.extractFieldLVEncoded()??new Uint8Array(0),x={...new y.SecureElementFlagsParser(a).generalDeviceState()},S=e.encodeToString(e.extractFieldLVEncoded()),f=e.encodeToString(e.extractFieldLVEncoded());let i="00";n===u.DeviceModelId.NANO_X&&(i=e.encodeToHexaString(e.extractFieldLVEncoded()));const A=e.encodeToHexaString(e.extractFieldLVEncoded()),m=e.encodeToHexaString(e.extractFieldLVEncoded());return(0,d.CommandResultFactory)({data:{targetId:t,seVersion:V,seFlags:a,mcuSephVersion:S,mcuBootloaderVersion:f,hwVersion:i,langId:A,recoverState:m||"0",secureElementFlags:x}})}}0&&(module.exports={GetOsVersionCommand});
2
2
  //# sourceMappingURL=GetOsVersionCommand.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/command/os/GetOsVersionCommand.ts"],
4
- "sourcesContent": ["import { type Apdu } from \"@api/apdu/model/Apdu\";\nimport { ApduBuilder, type ApduBuilderArgs } from \"@api/apdu/utils/ApduBuilder\";\nimport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nimport { type Command } from \"@api/command/Command\";\nimport {\n type CommandResult,\n CommandResultFactory,\n} from \"@api/command/model/CommandResult\";\nimport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nimport { GlobalCommandErrorHandler } from \"@api/command/utils/GlobalCommandError\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\n\n/**\n * Response of the GetOsVersionCommand.\n */\nexport type GetOsVersionResponse = {\n /**\n * Target identifier.\n */\n readonly targetId: number;\n\n /**\n * Version of BOLOS on the secure element (SE).\n * {@link https://developers.ledger.com/docs/device-app/architecture/bolos/hardware-architecture | Hardware Architecture}\n */\n readonly seVersion: string;\n\n /**\n * Secure element flags.\n * Used to represent the current state of the secure element.\n */\n readonly seFlags: number;\n\n /**\n * Version of the microcontroller unit (MCU) SEPH, which is the SE-MCU link protocol.\n * {@link https://developers.ledger.com/docs/device-app/architecture/bolos/hardware-architecture | Hardware Architecture}\n */\n readonly mcuSephVersion: string;\n\n /**\n * Version of the MCU bootloader.\n */\n readonly mcuBootloaderVersion: string;\n\n /**\n * Hardware revision version.\n * Only available for Ledger Nano X in which case it's \"00\" or \"01\".\n */\n readonly hwVersion: string;\n\n /**\n * Identifier of the installed language pack.\n * Can be one of:\n * - \"00\": English\n * - \"01\": French\n * - \"02\": Spanish\n */\n readonly langId: string; // [SHOULD] be an enum\n\n /**\n * State for Ledger Recover. // [SHOULD] Add more information about this field\n */\n readonly recoverState: string;\n};\n\n/**\n * Command to get information about the device firmware.\n */\nexport class GetOsVersionCommand implements Command<GetOsVersionResponse> {\n readonly args = undefined;\n\n getApdu(): Apdu {\n const getOsVersionApduArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x01,\n p1: 0x00,\n p2: 0x00,\n };\n return new ApduBuilder(getOsVersionApduArgs).build();\n }\n\n parseResponse(\n apduResponse: ApduResponse,\n deviceModelId: DeviceModelId,\n ): CommandResult<GetOsVersionResponse> {\n if (!CommandUtils.isSuccessResponse(apduResponse)) {\n return CommandResultFactory({\n error: GlobalCommandErrorHandler.handle(apduResponse),\n });\n }\n const parser = new ApduParser(apduResponse);\n\n const targetId = parseInt(\n parser.encodeToHexaString(parser.extractFieldByLength(4)),\n 16,\n );\n const seVersion = parser.encodeToString(parser.extractFieldLVEncoded());\n const seFlags = parseInt(\n parser.encodeToHexaString(parser.extractFieldLVEncoded()).toString(),\n 16,\n );\n const mcuSephVersion = parser.encodeToString(\n parser.extractFieldLVEncoded(),\n );\n const mcuBootloaderVersion = parser.encodeToString(\n parser.extractFieldLVEncoded(),\n );\n\n let hwVersion = \"00\";\n if (deviceModelId === DeviceModelId.NANO_X) {\n hwVersion = parser.encodeToHexaString(parser.extractFieldLVEncoded());\n }\n\n const langId = parser.encodeToHexaString(parser.extractFieldLVEncoded());\n const recoverState = parser.encodeToHexaString(\n parser.extractFieldLVEncoded(),\n );\n\n return CommandResultFactory({\n data: {\n targetId,\n seVersion,\n seFlags,\n mcuSephVersion,\n mcuBootloaderVersion,\n hwVersion,\n langId,\n recoverState: recoverState ? recoverState : \"0\",\n },\n });\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAkD,uCAClDC,EAA2B,sCAE3BC,EAGO,4CACPC,EAA6B,2CAC7BC,EAA0C,iDAC1CC,EAA8B,mCA2DvB,MAAMP,CAA6D,CAC/D,KAAO,OAEhB,SAAgB,CACd,MAAMQ,EAAwC,CAC5C,IAAK,IACL,IAAK,EACL,GAAI,EACJ,GAAI,CACN,EACA,OAAO,IAAI,cAAYA,CAAoB,EAAE,MAAM,CACrD,CAEA,cACEC,EACAC,EACqC,CACrC,GAAI,CAAC,eAAa,kBAAkBD,CAAY,EAC9C,SAAO,wBAAqB,CAC1B,MAAO,4BAA0B,OAAOA,CAAY,CACtD,CAAC,EAEH,MAAME,EAAS,IAAI,aAAWF,CAAY,EAEpCG,EAAW,SACfD,EAAO,mBAAmBA,EAAO,qBAAqB,CAAC,CAAC,EACxD,EACF,EACME,EAAYF,EAAO,eAAeA,EAAO,sBAAsB,CAAC,EAChEG,EAAU,SACdH,EAAO,mBAAmBA,EAAO,sBAAsB,CAAC,EAAE,SAAS,EACnE,EACF,EACMI,EAAiBJ,EAAO,eAC5BA,EAAO,sBAAsB,CAC/B,EACMK,EAAuBL,EAAO,eAClCA,EAAO,sBAAsB,CAC/B,EAEA,IAAIM,EAAY,KACZP,IAAkB,gBAAc,SAClCO,EAAYN,EAAO,mBAAmBA,EAAO,sBAAsB,CAAC,GAGtE,MAAMO,EAASP,EAAO,mBAAmBA,EAAO,sBAAsB,CAAC,EACjEQ,EAAeR,EAAO,mBAC1BA,EAAO,sBAAsB,CAC/B,EAEA,SAAO,wBAAqB,CAC1B,KAAM,CACJ,SAAAC,EACA,UAAAC,EACA,QAAAC,EACA,eAAAC,EACA,qBAAAC,EACA,UAAAC,EACA,OAAAC,EACA,aAAcC,GAA8B,GAC9C,CACF,CAAC,CACH,CACF",
6
- "names": ["GetOsVersionCommand_exports", "__export", "GetOsVersionCommand", "__toCommonJS", "import_ApduBuilder", "import_ApduParser", "import_CommandResult", "import_CommandUtils", "import_GlobalCommandError", "import_DeviceModel", "getOsVersionApduArgs", "apduResponse", "deviceModelId", "parser", "targetId", "seVersion", "seFlags", "mcuSephVersion", "mcuBootloaderVersion", "hwVersion", "langId", "recoverState"]
4
+ "sourcesContent": ["import { type Apdu } from \"@api/apdu/model/Apdu\";\nimport { ApduBuilder, type ApduBuilderArgs } from \"@api/apdu/utils/ApduBuilder\";\nimport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nimport { type Command } from \"@api/command/Command\";\nimport {\n type CommandResult,\n CommandResultFactory,\n} from \"@api/command/model/CommandResult\";\nimport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nimport { GlobalCommandErrorHandler } from \"@api/command/utils/GlobalCommandError\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport {\n type DeviceGeneralState,\n type EndorsementInformation,\n type OnboardingStatus,\n type WordsInformation,\n} from \"@api/device/SecureElementFlags\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\n\nimport { SecureElementFlagsParser } from \"./SecureElementFlagsParser\";\n\n/**\n * Response of the GetOsVersionCommand.\n */\nexport type GetOsVersionResponse = {\n /**\n * Target identifier.\n */\n readonly targetId: number;\n\n /**\n * Version of BOLOS on the secure element (SE).\n * {@link https://developers.ledger.com/docs/device-app/architecture/bolos/hardware-architecture | Hardware Architecture}\n */\n readonly seVersion: string;\n\n /**\n * Secure element flags.\n * Used to represent the current state of the secure element.\n */\n readonly seFlags: Uint8Array;\n\n /**\n * Version of the microcontroller unit (MCU) SEPH, which is the SE-MCU link protocol.\n * {@link https://developers.ledger.com/docs/device-app/architecture/bolos/hardware-architecture | Hardware Architecture}\n */\n readonly mcuSephVersion: string;\n\n /**\n * Version of the MCU bootloader.\n */\n readonly mcuBootloaderVersion: string;\n\n /**\n * Hardware revision version.\n * Only available for Ledger Nano X in which case it's \"00\" or \"01\".\n */\n readonly hwVersion: string;\n\n /**\n * Identifier of the installed language pack.\n * Can be one of:\n * - \"00\": English\n * - \"01\": French\n * - \"02\": Spanish\n */\n readonly langId: string; // [SHOULD] be an enum\n\n /**\n * State for Ledger Recover. // [SHOULD] Add more information about this field\n */\n readonly recoverState: string;\n\n /**\n * The parsed secure element flags.\n */\n readonly secureElementFlags: DeviceGeneralState &\n EndorsementInformation &\n WordsInformation &\n OnboardingStatus;\n};\n\nexport type GetOsVersionCommandResult = CommandResult<GetOsVersionResponse>;\n\n/**\n * Command to get information about the device firmware.\n */\nexport class GetOsVersionCommand implements Command<GetOsVersionResponse> {\n readonly args = undefined;\n\n getApdu(): Apdu {\n const getOsVersionApduArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x01,\n p1: 0x00,\n p2: 0x00,\n };\n return new ApduBuilder(getOsVersionApduArgs).build();\n }\n\n parseResponse(\n apduResponse: ApduResponse,\n deviceModelId: DeviceModelId,\n ): GetOsVersionCommandResult {\n if (!CommandUtils.isSuccessResponse(apduResponse)) {\n return CommandResultFactory({\n error: GlobalCommandErrorHandler.handle(apduResponse),\n });\n }\n const parser = new ApduParser(apduResponse);\n\n const targetId = parseInt(\n parser.encodeToHexaString(parser.extractFieldByLength(4)),\n 16,\n );\n const seVersion = parser.encodeToString(parser.extractFieldLVEncoded());\n const seFlags = parser.extractFieldLVEncoded() ?? new Uint8Array(0);\n const seFlagsParser = new SecureElementFlagsParser(seFlags);\n // This is the parsed secure element flags.\n const secureElementFlags = { ...seFlagsParser.generalDeviceState() };\n\n const mcuSephVersion = parser.encodeToString(\n parser.extractFieldLVEncoded(),\n );\n const mcuBootloaderVersion = parser.encodeToString(\n parser.extractFieldLVEncoded(),\n );\n\n let hwVersion = \"00\";\n if (deviceModelId === DeviceModelId.NANO_X) {\n hwVersion = parser.encodeToHexaString(parser.extractFieldLVEncoded());\n }\n\n const langId = parser.encodeToHexaString(parser.extractFieldLVEncoded());\n const recoverState = parser.encodeToHexaString(\n parser.extractFieldLVEncoded(),\n );\n\n return CommandResultFactory({\n data: {\n targetId,\n seVersion,\n seFlags,\n mcuSephVersion,\n mcuBootloaderVersion,\n hwVersion,\n langId,\n recoverState: recoverState ? recoverState : \"0\",\n secureElementFlags,\n },\n });\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAkD,uCAClDC,EAA2B,sCAE3BC,EAGO,4CACPC,EAA6B,2CAC7BC,EAA0C,iDAC1CC,EAA8B,mCAS9BC,EAAyC,sCAoElC,MAAMR,CAA6D,CAC/D,KAAO,OAEhB,SAAgB,CACd,MAAMS,EAAwC,CAC5C,IAAK,IACL,IAAK,EACL,GAAI,EACJ,GAAI,CACN,EACA,OAAO,IAAI,cAAYA,CAAoB,EAAE,MAAM,CACrD,CAEA,cACEC,EACAC,EAC2B,CAC3B,GAAI,CAAC,eAAa,kBAAkBD,CAAY,EAC9C,SAAO,wBAAqB,CAC1B,MAAO,4BAA0B,OAAOA,CAAY,CACtD,CAAC,EAEH,MAAME,EAAS,IAAI,aAAWF,CAAY,EAEpCG,EAAW,SACfD,EAAO,mBAAmBA,EAAO,qBAAqB,CAAC,CAAC,EACxD,EACF,EACME,EAAYF,EAAO,eAAeA,EAAO,sBAAsB,CAAC,EAChEG,EAAUH,EAAO,sBAAsB,GAAK,IAAI,WAAW,CAAC,EAG5DI,EAAqB,CAAE,GAFP,IAAI,2BAAyBD,CAAO,EAEZ,mBAAmB,CAAE,EAE7DE,EAAiBL,EAAO,eAC5BA,EAAO,sBAAsB,CAC/B,EACMM,EAAuBN,EAAO,eAClCA,EAAO,sBAAsB,CAC/B,EAEA,IAAIO,EAAY,KACZR,IAAkB,gBAAc,SAClCQ,EAAYP,EAAO,mBAAmBA,EAAO,sBAAsB,CAAC,GAGtE,MAAMQ,EAASR,EAAO,mBAAmBA,EAAO,sBAAsB,CAAC,EACjES,EAAeT,EAAO,mBAC1BA,EAAO,sBAAsB,CAC/B,EAEA,SAAO,wBAAqB,CAC1B,KAAM,CACJ,SAAAC,EACA,UAAAC,EACA,QAAAC,EACA,eAAAE,EACA,qBAAAC,EACA,UAAAC,EACA,OAAAC,EACA,aAAcC,GAA8B,IAC5C,mBAAAL,CACF,CACF,CAAC,CACH,CACF",
6
+ "names": ["GetOsVersionCommand_exports", "__export", "GetOsVersionCommand", "__toCommonJS", "import_ApduBuilder", "import_ApduParser", "import_CommandResult", "import_CommandUtils", "import_GlobalCommandError", "import_DeviceModel", "import_SecureElementFlagsParser", "getOsVersionApduArgs", "apduResponse", "deviceModelId", "parser", "targetId", "seVersion", "seFlags", "secureElementFlags", "mcuSephVersion", "mcuBootloaderVersion", "hwVersion", "langId", "recoverState"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var c=(t,e)=>{for(var n in e)i(t,n,{get:e[n],enumerable:!0})},l=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of a(e))!h.call(t,r)&&r!==n&&i(t,r,{get:()=>e[r],enumerable:!(o=s(e,r))||o.enumerable});return t};var d=t=>l(i({},"__esModule",{value:!0}),t);var B={};c(B,{SecureElementFlagsParser:()=>m});module.exports=d(B);class m{constructor(e){this.seFlags=e;if(this.seFlags.length!==4)throw new Error("Invalid secure element flags length")}generalDeviceState(){const e=this.seFlags[0]??0;return{isPinValidated:this._checkNthBitInByte(e,1),hasMcuSerialNumber:this._checkNthBitInByte(e,2),hasValidCertificate:this._checkNthBitInByte(e,3),isCustomAuthorityConnectionAllowed:this._checkNthBitInByte(e,4),isSecureConnectionAllowed:this._checkNthBitInByte(e,5),isOnboarded:this._checkNthBitInByte(e,6),isMcuCodeSigned:this._checkNthBitInByte(e,7),isInRecoveryMode:this._checkNthBitInByte(e,8)}}endorsementInformation(){throw new Error("Not implemented")}wordsInformation(){throw new Error("Not implemented")}onboardingStatus(){throw new Error("Not implemented")}_checkNthBitInByte(e,n){return(e>>8-n&1)===1}}0&&(module.exports={SecureElementFlagsParser});
2
+ //# sourceMappingURL=SecureElementFlagsParser.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/command/os/SecureElementFlagsParser.ts"],
4
+ "sourcesContent": ["import {\n type DeviceGeneralState,\n type EndorsementInformation,\n type OnboardingStatus,\n type WordsInformation,\n} from \"@api/device/SecureElementFlags\";\n\n/**\n * Secure element flags parser class.\n */\nexport class SecureElementFlagsParser {\n /**\n * Creates an instance of SecureElementFlags parser.\n * @param seFlags - The secure element flags as an Uint8Array, it comes from the response of the GetOsVersionCommand.\n */\n constructor(private readonly seFlags: Uint8Array) {\n if (this.seFlags.length !== 4) {\n throw new Error(\"Invalid secure element flags length\");\n }\n }\n\n /**\n * Retrieves the general device state based on the secure element flags, which is the first byte of the flags.\n * @returns {DeviceGeneralState}\n */\n generalDeviceState(): DeviceGeneralState {\n const firstByte = this.seFlags[0] ?? 0x00;\n\n return {\n isPinValidated: this._checkNthBitInByte(firstByte, 1),\n hasMcuSerialNumber: this._checkNthBitInByte(firstByte, 2),\n hasValidCertificate: this._checkNthBitInByte(firstByte, 3),\n isCustomAuthorityConnectionAllowed: this._checkNthBitInByte(firstByte, 4),\n isSecureConnectionAllowed: this._checkNthBitInByte(firstByte, 5),\n isOnboarded: this._checkNthBitInByte(firstByte, 6),\n isMcuCodeSigned: this._checkNthBitInByte(firstByte, 7),\n isInRecoveryMode: this._checkNthBitInByte(firstByte, 8),\n };\n }\n\n /**\n * Retrieves the endorsement information based on the secure element flags, which is the second byte of the flags.\n * @returns {EndorsementInformation}\n * @throws Will throw an error if the method is not implemented.\n */\n endorsementInformation(): EndorsementInformation {\n throw new Error(\"Not implemented\");\n }\n\n /**\n * Retrieves the words information based on the secure element flags, which is the third byte of the flags.\n * @returns {WordsInformation}\n * @throws Will throw an error if the method is not implemented.\n */\n wordsInformation(): WordsInformation {\n throw new Error(\"Not implemented\");\n }\n\n /**\n * Retrieves the onboarding status based on the secure element flags, which is the fourth byte of the flags.\n * @returns {OnboardingStatus}\n * @throws Will throw an error if the method is not implemented.\n */\n onboardingStatus(): OnboardingStatus {\n throw new Error(\"Not implemented\");\n }\n\n /**\n * Check the nth bit in a byte, returns true if the bit is set, false otherwise.\n * @param byte - The byte to check.\n * @param n - The bit number to check.\n * @returns {boolean} - True if the bit is set, false otherwise.\n */\n _checkNthBitInByte(byte: number, n: number): boolean {\n return ((byte >> (8 - n)) & 1) === 1;\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAUO,MAAME,CAAyB,CAKpC,YAA6BE,EAAqB,CAArB,aAAAA,EAC3B,GAAI,KAAK,QAAQ,SAAW,EAC1B,MAAM,IAAI,MAAM,qCAAqC,CAEzD,CAMA,oBAAyC,CACvC,MAAMC,EAAY,KAAK,QAAQ,CAAC,GAAK,EAErC,MAAO,CACL,eAAgB,KAAK,mBAAmBA,EAAW,CAAC,EACpD,mBAAoB,KAAK,mBAAmBA,EAAW,CAAC,EACxD,oBAAqB,KAAK,mBAAmBA,EAAW,CAAC,EACzD,mCAAoC,KAAK,mBAAmBA,EAAW,CAAC,EACxE,0BAA2B,KAAK,mBAAmBA,EAAW,CAAC,EAC/D,YAAa,KAAK,mBAAmBA,EAAW,CAAC,EACjD,gBAAiB,KAAK,mBAAmBA,EAAW,CAAC,EACrD,iBAAkB,KAAK,mBAAmBA,EAAW,CAAC,CACxD,CACF,CAOA,wBAAiD,CAC/C,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAOA,kBAAqC,CACnC,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAOA,kBAAqC,CACnC,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAQA,mBAAmBC,EAAc,EAAoB,CACnD,OAASA,GAAS,EAAI,EAAM,KAAO,CACrC,CACF",
6
+ "names": ["SecureElementFlagsParser_exports", "__export", "SecureElementFlagsParser", "__toCommonJS", "seFlags", "firstByte", "byte"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("vitest"),n=require("./SecureElementFlagsParser");(0,e.describe)("SecureElementFlagsParser",()=>{(0,e.it)("should throw an error if the secure element flags length is not 4",()=>{(0,e.expect)(()=>new n.SecureElementFlagsParser(new Uint8Array([0,1,2]))).toThrow("Invalid secure element flags length")}),(0,e.it)("should correctly parse the general device state",()=>{const o=new Uint8Array([170,0,0,0]),t=new n.SecureElementFlagsParser(o),r={isPinValidated:!0,hasMcuSerialNumber:!1,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!0,isOnboarded:!1,isMcuCodeSigned:!0,isInRecoveryMode:!1};(0,e.expect)(t.generalDeviceState()).toEqual(r)}),(0,e.it)("should throw an error for endorsementInformation method",()=>{const o=new Uint8Array([0,0,0,0]),t=new n.SecureElementFlagsParser(o);(0,e.expect)(()=>t.endorsementInformation()).toThrow("Not implemented")}),(0,e.it)("should throw an error for wordsInformation method",()=>{const o=new Uint8Array([0,0,0,0]),t=new n.SecureElementFlagsParser(o);(0,e.expect)(()=>t.wordsInformation()).toThrow("Not implemented")}),(0,e.it)("should throw an error for onboardingStatus method",()=>{const o=new Uint8Array([0,0,0,0]),t=new n.SecureElementFlagsParser(o);(0,e.expect)(()=>t.onboardingStatus()).toThrow("Not implemented")}),(0,e.it)("should correctly check the nth bit in a byte",()=>{const o=new Uint8Array([0,0,0,0]),t=new n.SecureElementFlagsParser(o),r=170;(0,e.expect)(t._checkNthBitInByte(r,1)).toBe(!0),(0,e.expect)(t._checkNthBitInByte(r,2)).toBe(!1),(0,e.expect)(t._checkNthBitInByte(r,3)).toBe(!0),(0,e.expect)(t._checkNthBitInByte(r,4)).toBe(!1),(0,e.expect)(t._checkNthBitInByte(r,5)).toBe(!0),(0,e.expect)(t._checkNthBitInByte(r,6)).toBe(!1),(0,e.expect)(t._checkNthBitInByte(r,7)).toBe(!0),(0,e.expect)(t._checkNthBitInByte(r,8)).toBe(!1)})});
2
+ //# sourceMappingURL=SecureElementFlagsParser.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/command/os/SecureElementFlagsParser.test.ts"],
4
+ "sourcesContent": ["import { describe, expect, it } from \"vitest\";\n\nimport { type DeviceGeneralState } from \"@api/device/SecureElementFlags\";\n\nimport { SecureElementFlagsParser } from \"./SecureElementFlagsParser\";\n\ndescribe(\"SecureElementFlagsParser\", () => {\n it(\"should throw an error if the secure element flags length is not 4\", () => {\n expect(\n () => new SecureElementFlagsParser(new Uint8Array([0x00, 0x01, 0x02])),\n ).toThrow(\"Invalid secure element flags length\");\n });\n\n it(\"should correctly parse the general device state\", () => {\n const seFlags = new Uint8Array([0b10101010, 0x00, 0x00, 0x00]);\n const parser = new SecureElementFlagsParser(seFlags);\n const expectedState: DeviceGeneralState = {\n isPinValidated: true,\n hasMcuSerialNumber: false,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: true,\n isOnboarded: false,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n };\n expect(parser.generalDeviceState()).toEqual(expectedState);\n });\n\n it(\"should throw an error for endorsementInformation method\", () => {\n const seFlags = new Uint8Array([0x00, 0x00, 0x00, 0x00]);\n const parser = new SecureElementFlagsParser(seFlags);\n expect(() => parser.endorsementInformation()).toThrow(\"Not implemented\");\n });\n\n it(\"should throw an error for wordsInformation method\", () => {\n const seFlags = new Uint8Array([0x00, 0x00, 0x00, 0x00]);\n const parser = new SecureElementFlagsParser(seFlags);\n expect(() => parser.wordsInformation()).toThrow(\"Not implemented\");\n });\n\n it(\"should throw an error for onboardingStatus method\", () => {\n const seFlags = new Uint8Array([0x00, 0x00, 0x00, 0x00]);\n const parser = new SecureElementFlagsParser(seFlags);\n expect(() => parser.onboardingStatus()).toThrow(\"Not implemented\");\n });\n\n it(\"should correctly check the nth bit in a byte\", () => {\n const seFlags = new Uint8Array([0x00, 0x00, 0x00, 0x00]);\n const parser = new SecureElementFlagsParser(seFlags);\n const byte = 0b10101010;\n expect(parser._checkNthBitInByte(byte, 1)).toBe(true);\n expect(parser._checkNthBitInByte(byte, 2)).toBe(false);\n expect(parser._checkNthBitInByte(byte, 3)).toBe(true);\n expect(parser._checkNthBitInByte(byte, 4)).toBe(false);\n expect(parser._checkNthBitInByte(byte, 5)).toBe(true);\n expect(parser._checkNthBitInByte(byte, 6)).toBe(false);\n expect(parser._checkNthBitInByte(byte, 7)).toBe(true);\n expect(parser._checkNthBitInByte(byte, 8)).toBe(false);\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAAqC,kBAIrCC,EAAyC,yCAEzC,YAAS,2BAA4B,IAAM,IACzC,MAAG,oEAAqE,IAAM,IAC5E,UACE,IAAM,IAAI,2BAAyB,IAAI,WAAW,CAAC,EAAM,EAAM,CAAI,CAAC,CAAC,CACvE,EAAE,QAAQ,qCAAqC,CACjD,CAAC,KAED,MAAG,kDAAmD,IAAM,CAC1D,MAAMC,EAAU,IAAI,WAAW,CAAC,IAAY,EAAM,EAAM,CAAI,CAAC,EACvDC,EAAS,IAAI,2BAAyBD,CAAO,EAC7CE,EAAoC,CACxC,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,KACA,UAAOD,EAAO,mBAAmB,CAAC,EAAE,QAAQC,CAAa,CAC3D,CAAC,KAED,MAAG,0DAA2D,IAAM,CAClE,MAAMF,EAAU,IAAI,WAAW,CAAC,EAAM,EAAM,EAAM,CAAI,CAAC,EACjDC,EAAS,IAAI,2BAAyBD,CAAO,KACnD,UAAO,IAAMC,EAAO,uBAAuB,CAAC,EAAE,QAAQ,iBAAiB,CACzE,CAAC,KAED,MAAG,oDAAqD,IAAM,CAC5D,MAAMD,EAAU,IAAI,WAAW,CAAC,EAAM,EAAM,EAAM,CAAI,CAAC,EACjDC,EAAS,IAAI,2BAAyBD,CAAO,KACnD,UAAO,IAAMC,EAAO,iBAAiB,CAAC,EAAE,QAAQ,iBAAiB,CACnE,CAAC,KAED,MAAG,oDAAqD,IAAM,CAC5D,MAAMD,EAAU,IAAI,WAAW,CAAC,EAAM,EAAM,EAAM,CAAI,CAAC,EACjDC,EAAS,IAAI,2BAAyBD,CAAO,KACnD,UAAO,IAAMC,EAAO,iBAAiB,CAAC,EAAE,QAAQ,iBAAiB,CACnE,CAAC,KAED,MAAG,+CAAgD,IAAM,CACvD,MAAMD,EAAU,IAAI,WAAW,CAAC,EAAM,EAAM,EAAM,CAAI,CAAC,EACjDC,EAAS,IAAI,2BAAyBD,CAAO,EAC7CG,EAAO,OACb,UAAOF,EAAO,mBAAmBE,EAAM,CAAC,CAAC,EAAE,KAAK,EAAI,KACpD,UAAOF,EAAO,mBAAmBE,EAAM,CAAC,CAAC,EAAE,KAAK,EAAK,KACrD,UAAOF,EAAO,mBAAmBE,EAAM,CAAC,CAAC,EAAE,KAAK,EAAI,KACpD,UAAOF,EAAO,mBAAmBE,EAAM,CAAC,CAAC,EAAE,KAAK,EAAK,KACrD,UAAOF,EAAO,mBAAmBE,EAAM,CAAC,CAAC,EAAE,KAAK,EAAI,KACpD,UAAOF,EAAO,mBAAmBE,EAAM,CAAC,CAAC,EAAE,KAAK,EAAK,KACrD,UAAOF,EAAO,mBAAmBE,EAAM,CAAC,CAAC,EAAE,KAAK,EAAI,KACpD,UAAOF,EAAO,mBAAmBE,EAAM,CAAC,CAAC,EAAE,KAAK,EAAK,CACvD,CAAC,CACH,CAAC",
6
+ "names": ["import_vitest", "import_SecureElementFlagsParser", "seFlags", "parser", "expectedState", "byte"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var c=(o,e)=>{for(var n in e)t(o,n,{get:e[n],enumerable:!0})},l=(o,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of V(e))!d.call(o,r)&&r!==n&&t(o,r,{get:()=>e[r],enumerable:!(i=a(e,r))||i.enumerable});return o};var g=o=>l(t({},"__esModule",{value:!0}),o);var S={};c(S,{getOsVersionCommandResponseMockBuilder:()=>m});module.exports=g(S);var s=require("../../../device/DeviceModel");const m=(o=s.DeviceModelId.NANO_SP,e={})=>({[s.DeviceModelId.NANO_SP]:{targetId:856686596,seVersion:"1.1.1",seFlags:3858759680,mcuSephVersion:"4.03",mcuBootloaderVersion:"3.12",hwVersion:"00",langId:"00",recoverState:"00",...e},[s.DeviceModelId.NANO_S]:{targetId:858783748,seVersion:"1.1.1",seFlags:3858759680,mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:"00",recoverState:"00",...e},[s.DeviceModelId.NANO_X]:{targetId:855638020,seVersion:"2.2.3",seFlags:3858759680,mcuSephVersion:"2.30",mcuBootloaderVersion:"1.16",hwVersion:"00",langId:"00",recoverState:"00"},[s.DeviceModelId.STAX]:{targetId:857735172,seVersion:"1.3.0",seFlags:3858759680,mcuSephVersion:"5.24",mcuBootloaderVersion:"0.48",hwVersion:"00",langId:"00",recoverState:"00",...e},[s.DeviceModelId.FLEX]:{targetId:858783748,seVersion:"1.1.1",seFlags:3858759680,mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:"00",recoverState:"00",...e}})[o];0&&(module.exports={getOsVersionCommandResponseMockBuilder});
1
+ "use strict";var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var u=(r,e)=>{for(var o in e)t(r,o,{get:e[o],enumerable:!0})},c=(r,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!d.call(r,i)&&i!==o&&t(r,i,{get:()=>e[i],enumerable:!(n=a(e,i))||n.enumerable});return r};var V=r=>c(t({},"__esModule",{value:!0}),r);var S={};u(S,{getOsVersionCommandResponseMockBuilder:()=>m});module.exports=V(S);var s=require("../../../device/DeviceModel");const m=(r=s.DeviceModelId.NANO_SP,e={})=>({[s.DeviceModelId.NANO_SP]:{targetId:856686596,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuSephVersion:"4.03",mcuBootloaderVersion:"3.12",hwVersion:"00",langId:"00",recoverState:"00",secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...e},[s.DeviceModelId.NANO_S]:{targetId:858783748,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:"00",recoverState:"00",secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...e},[s.DeviceModelId.NANO_X]:{targetId:855638020,seVersion:"2.2.3",seFlags:new Uint8Array([230,0,0,0]),mcuSephVersion:"2.30",mcuBootloaderVersion:"1.16",hwVersion:"00",langId:"00",recoverState:"00",secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1}},[s.DeviceModelId.STAX]:{targetId:857735172,seVersion:"1.3.0",seFlags:new Uint8Array([230,0,0,0]),mcuSephVersion:"5.24",mcuBootloaderVersion:"0.48",hwVersion:"00",langId:"00",recoverState:"00",secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...e},[s.DeviceModelId.FLEX]:{targetId:858783748,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:"00",recoverState:"00",secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...e}})[r];0&&(module.exports={getOsVersionCommandResponseMockBuilder});
2
2
  //# sourceMappingURL=GetOsVersionCommand.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/command/os/__mocks__/GetOsVersionCommand.ts"],
4
- "sourcesContent": ["import { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\n\nexport const getOsVersionCommandResponseMockBuilder = (\n deviceModelId: DeviceModelId = DeviceModelId.NANO_SP,\n props: Partial<GetOsVersionResponse> = {},\n): GetOsVersionResponse =>\n ({\n [DeviceModelId.NANO_SP]: {\n targetId: 856686596,\n seVersion: \"1.1.1\",\n seFlags: 3858759680,\n mcuSephVersion: \"4.03\",\n mcuBootloaderVersion: \"3.12\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n ...props,\n },\n [DeviceModelId.NANO_S]: {\n targetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: 3858759680,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n ...props,\n },\n [DeviceModelId.NANO_X]: {\n targetId: 855638020,\n seVersion: \"2.2.3\",\n seFlags: 3858759680,\n mcuSephVersion: \"2.30\",\n mcuBootloaderVersion: \"1.16\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n },\n [DeviceModelId.STAX]: {\n targetId: 857735172,\n seVersion: \"1.3.0\",\n seFlags: 3858759680,\n mcuSephVersion: \"5.24\",\n mcuBootloaderVersion: \"0.48\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n ...props,\n },\n [DeviceModelId.FLEX]: {\n targetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: 3858759680,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n ...props,\n },\n })[deviceModelId];\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4CAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAA8B,mCAEvB,MAAMF,EAAyC,CACpDG,EAA+B,gBAAc,QAC7CC,EAAuC,CAAC,KAEvC,CACC,CAAC,gBAAc,OAAO,EAAG,CACvB,SAAU,UACV,UAAW,QACX,QAAS,WACT,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,GAAGA,CACL,EACA,CAAC,gBAAc,MAAM,EAAG,CACtB,SAAU,UACV,UAAW,QACX,QAAS,WACT,eAAgB,QAChB,qBAAsB,QACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,GAAGA,CACL,EACA,CAAC,gBAAc,MAAM,EAAG,CACtB,SAAU,UACV,UAAW,QACX,QAAS,WACT,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,KACR,aAAc,IAChB,EACA,CAAC,gBAAc,IAAI,EAAG,CACpB,SAAU,UACV,UAAW,QACX,QAAS,WACT,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,GAAGA,CACL,EACA,CAAC,gBAAc,IAAI,EAAG,CACpB,SAAU,UACV,UAAW,QACX,QAAS,WACT,eAAgB,QAChB,qBAAsB,QACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,GAAGA,CACL,CACF,GAAGD,CAAa",
4
+ "sourcesContent": ["import { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\n\nexport const getOsVersionCommandResponseMockBuilder = (\n deviceModelId: DeviceModelId = DeviceModelId.NANO_SP,\n props: Partial<GetOsVersionResponse> = {},\n): GetOsVersionResponse =>\n ({\n [DeviceModelId.NANO_SP]: {\n targetId: 856686596,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuSephVersion: \"4.03\",\n mcuBootloaderVersion: \"3.12\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.NANO_S]: {\n targetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.NANO_X]: {\n targetId: 855638020,\n seVersion: \"2.2.3\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuSephVersion: \"2.30\",\n mcuBootloaderVersion: \"1.16\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n },\n [DeviceModelId.STAX]: {\n targetId: 857735172,\n seVersion: \"1.3.0\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuSephVersion: \"5.24\",\n mcuBootloaderVersion: \"0.48\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.FLEX]: {\n targetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: \"00\",\n recoverState: \"00\",\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n })[deviceModelId];\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4CAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAA8B,mCAEvB,MAAMF,EAAyC,CACpDG,EAA+B,gBAAc,QAC7CC,EAAuC,CAAC,KAEvC,CACC,CAAC,gBAAc,OAAO,EAAG,CACvB,SAAU,UACV,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,EACA,GAAGA,CACL,EACA,CAAC,gBAAc,MAAM,EAAG,CACtB,SAAU,UACV,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,eAAgB,QAChB,qBAAsB,QACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,EACA,GAAGA,CACL,EACA,CAAC,gBAAc,MAAM,EAAG,CACtB,SAAU,UACV,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,CACF,EACA,CAAC,gBAAc,IAAI,EAAG,CACpB,SAAU,UACV,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,EACA,GAAGA,CACL,EACA,CAAC,gBAAc,IAAI,EAAG,CACpB,SAAU,UACV,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,eAAgB,QAChB,qBAAsB,QACtB,UAAW,KACX,OAAQ,KACR,aAAc,KACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,EACA,GAAGA,CACL,CACF,GAAGD,CAAa",
6
6
  "names": ["GetOsVersionCommand_exports", "__export", "getOsVersionCommandResponseMockBuilder", "__toCommonJS", "import_DeviceModel", "deviceModelId", "props"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var a=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var s=(e,o,i,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of l(o))!d.call(e,n)&&n!==i&&a(e,n,{get:()=>o[n],enumerable:!(t=r(o,n))||t.enumerable});return e};var b=e=>s(a({},"__esModule",{value:!0}),e);var u={};module.exports=b(u);
2
+ //# sourceMappingURL=SecureElementFlags.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/api/device/SecureElementFlags.ts"],
4
+ "sourcesContent": ["/**\n * Represents the general state of a device, the information comes from the first byte of the secure element flags.\n */\nexport type DeviceGeneralState = {\n /**\n * Indicates whether the device's PIN has been validated.\n */\n isPinValidated: boolean;\n\n /**\n * Indicates whether the device has a MCU serial number.\n */\n hasMcuSerialNumber: boolean;\n\n /**\n * Indicates whether the device has a personalized valid Ledger certificate.\n */\n hasValidCertificate: boolean;\n\n /**\n * Indicates whether the device is allowed to connect with a custom certificate authority.\n */\n isCustomAuthorityConnectionAllowed: boolean;\n\n /**\n * Indicates whether the device is allowed to commnunicate with secure connection.\n */\n isSecureConnectionAllowed: boolean;\n\n /**\n * Indicates whether the device has been onboarded.\n */\n isOnboarded: boolean;\n\n /**\n * Indicates whether the MCU code on the device is signed.\n */\n isMcuCodeSigned: boolean;\n\n /**\n * Indicates whether the device is in recovery mode.\n */\n isInRecoveryMode: boolean;\n};\n\n// 2nd byte of the secure element flags, placeholder for the endorsement information\nexport type EndorsementInformation = unknown;\n\n// 3rd byte of the secure element flags, placeholder for the words information\nexport type WordsInformation = unknown;\n\n// 4th byte of the secure element flags, placeholder for the onboarding status\nexport type OnboardingStatus = unknown;\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["SecureElementFlags_exports", "__toCommonJS"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var m=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of s(e))!p.call(t,r)&&r!==i&&n(t,r,{get:()=>e[r],enumerable:!(o=a(e,r))||o.enumerable});return t};var c=t=>m(n({},"__esModule",{value:!0}),t);var d={};module.exports=c(d);
1
+ "use strict";var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var m=(r,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of s(e))!p.call(r,t)&&t!==i&&n(r,t,{get:()=>e[t],enumerable:!(o=a(e,t))||o.enumerable});return r};var c=r=>m(n({},"__esModule",{value:!0}),r);var d={};module.exports=c(d);
2
2
  //# sourceMappingURL=DeviceAction.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/api/device-action/DeviceAction.ts"],
4
- "sourcesContent": ["import { type Either } from \"purify-ts\";\nimport { type Observable } from \"rxjs\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type DmkError } from \"@api/Error\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { type DeviceActionState } from \"./model/DeviceActionState\";\n\nexport type InternalApi = {\n readonly sendApdu: (\n apdu: Uint8Array,\n ) => Promise<Either<DmkError, ApduResponse>>;\n readonly sendCommand: <Response, Args, ErrorStatusCodes>(\n command: Command<Response, Args, ErrorStatusCodes>,\n ) => Promise<CommandResult<Response, ErrorStatusCodes>>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly getDeviceSessionStateObservable: () => Observable<DeviceSessionState>;\n readonly setDeviceSessionState: (\n state: DeviceSessionState,\n ) => DeviceSessionState;\n readonly getManagerApiService: () => ManagerApiService;\n readonly getSecureChannelService: () => SecureChannelService;\n};\n\nexport type DeviceActionIntermediateValue = {\n readonly requiredUserInteraction: string;\n};\n\nexport type ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> = {\n readonly observable: Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >;\n cancel(): void;\n};\n\nexport interface DeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n> {\n readonly input: Input;\n\n _execute(\n params: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue>;\n}\n"],
4
+ "sourcesContent": ["import { type Either } from \"purify-ts\";\nimport { type Observable } from \"rxjs\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type DmkError } from \"@api/Error\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { type DeviceActionState } from \"./model/DeviceActionState\";\n\nexport type InternalApi = {\n readonly sendApdu: (\n apdu: Uint8Array,\n ) => Promise<Either<DmkError, ApduResponse>>;\n readonly sendCommand: <Response, Args, ErrorStatusCodes>(\n command: Command<Response, Args, ErrorStatusCodes>,\n ) => Promise<CommandResult<Response, ErrorStatusCodes>>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly getDeviceSessionStateObservable: () => Observable<DeviceSessionState>;\n readonly setDeviceSessionState: (\n state: DeviceSessionState,\n ) => DeviceSessionState;\n readonly disableRefresher: (blockerId: string) => () => void;\n readonly getManagerApiService: () => ManagerApiService;\n readonly getSecureChannelService: () => SecureChannelService;\n};\n\nexport type DeviceActionIntermediateValue = {\n readonly requiredUserInteraction: string;\n};\n\nexport type ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> = {\n readonly observable: Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >;\n cancel(): void;\n};\n\nexport interface DeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n> {\n readonly input: Input;\n\n _execute(\n params: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue>;\n}\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["DeviceAction_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var c=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var v=(n,e)=>{for(var i in e)c(n,i,{get:e[i],enumerable:!0})},S=(n,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of a(e))!r.call(n,t)&&t!==i&&c(n,t,{get:()=>e[t],enumerable:!(o=s(e,t))||o.enumerable});return n};var p=n=>S(c({},"__esModule",{value:!0}),n);var D={};v(D,{makeDeviceActionInternalApiMock:()=>l});module.exports=p(D);const M=vi.fn(),k=vi.fn(),d=vi.fn(),f=vi.fn(),m=vi.fn(),g=vi.fn(),A=vi.fn();function l(){return{sendApdu:M,sendCommand:k,getDeviceSessionState:d,getDeviceSessionStateObservable:f,setDeviceSessionState:m,getManagerApiService:g,getSecureChannelService:A}}0&&(module.exports={makeDeviceActionInternalApiMock});
1
+ "use strict";var c=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var v=(n,e)=>{for(var i in e)c(n,i,{get:e[i],enumerable:!0})},S=(n,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of a(e))!r.call(n,t)&&t!==i&&c(n,t,{get:()=>e[t],enumerable:!(o=s(e,t))||o.enumerable});return n};var p=n=>S(c({},"__esModule",{value:!0}),n);var b={};v(b,{makeDeviceActionInternalApiMock:()=>D});module.exports=p(b);const f=vi.fn(),M=vi.fn(),d=vi.fn(),k=vi.fn(),l=vi.fn(),m=vi.fn(),g=vi.fn(),A=vi.fn();function D(){return{sendApdu:f,sendCommand:M,getDeviceSessionState:d,getDeviceSessionStateObservable:k,setDeviceSessionState:l,getManagerApiService:m,getSecureChannelService:g,disableRefresher:A}}0&&(module.exports={makeDeviceActionInternalApiMock});
2
2
  //# sourceMappingURL=makeInternalApi.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/__test-utils__/makeInternalApi.ts"],
4
- "sourcesContent": ["import { type Mocked } from \"vitest\";\n\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\n\nconst sendApduMock = vi.fn();\nconst sendCommandMock = vi.fn();\nconst apiGetDeviceSessionStateMock = vi.fn();\nconst apiGetDeviceSessionStateObservableMock = vi.fn();\nconst setDeviceSessionStateMock = vi.fn();\nconst getManagerApiServiceMock = vi.fn();\nconst getSecureChannelServiceMock = vi.fn();\n\nexport function makeDeviceActionInternalApiMock(): Mocked<InternalApi> {\n return {\n sendApdu: sendApduMock,\n sendCommand: sendCommandMock,\n getDeviceSessionState: apiGetDeviceSessionStateMock,\n getDeviceSessionStateObservable: apiGetDeviceSessionStateObservableMock,\n setDeviceSessionState: setDeviceSessionStateMock,\n getManagerApiService: getManagerApiServiceMock,\n getSecureChannelService: getSecureChannelServiceMock,\n };\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,IAAA,eAAAC,EAAAH,GAIA,MAAMI,EAAe,GAAG,GAAG,EACrBC,EAAkB,GAAG,GAAG,EACxBC,EAA+B,GAAG,GAAG,EACrCC,EAAyC,GAAG,GAAG,EAC/CC,EAA4B,GAAG,GAAG,EAClCC,EAA2B,GAAG,GAAG,EACjCC,EAA8B,GAAG,GAAG,EAEnC,SAASR,GAAuD,CACrE,MAAO,CACL,SAAUE,EACV,YAAaC,EACb,sBAAuBC,EACvB,gCAAiCC,EACjC,sBAAuBC,EACvB,qBAAsBC,EACtB,wBAAyBC,CAC3B,CACF",
6
- "names": ["makeInternalApi_exports", "__export", "makeDeviceActionInternalApiMock", "__toCommonJS", "sendApduMock", "sendCommandMock", "apiGetDeviceSessionStateMock", "apiGetDeviceSessionStateObservableMock", "setDeviceSessionStateMock", "getManagerApiServiceMock", "getSecureChannelServiceMock"]
4
+ "sourcesContent": ["import { type Mocked } from \"vitest\";\n\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\n\nconst sendApduMock = vi.fn();\nconst sendCommandMock = vi.fn();\nconst apiGetDeviceSessionStateMock = vi.fn();\nconst apiGetDeviceSessionStateObservableMock = vi.fn();\nconst setDeviceSessionStateMock = vi.fn();\nconst getManagerApiServiceMock = vi.fn();\nconst getSecureChannelServiceMock = vi.fn();\nconst disableRefresherMock = vi.fn();\n\nexport function makeDeviceActionInternalApiMock(): Mocked<InternalApi> {\n return {\n sendApdu: sendApduMock,\n sendCommand: sendCommandMock,\n getDeviceSessionState: apiGetDeviceSessionStateMock,\n getDeviceSessionStateObservable: apiGetDeviceSessionStateObservableMock,\n setDeviceSessionState: setDeviceSessionStateMock,\n getManagerApiService: getManagerApiServiceMock,\n getSecureChannelService: getSecureChannelServiceMock,\n disableRefresher: disableRefresherMock,\n };\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,IAAA,eAAAC,EAAAH,GAIA,MAAMI,EAAe,GAAG,GAAG,EACrBC,EAAkB,GAAG,GAAG,EACxBC,EAA+B,GAAG,GAAG,EACrCC,EAAyC,GAAG,GAAG,EAC/CC,EAA4B,GAAG,GAAG,EAClCC,EAA2B,GAAG,GAAG,EACjCC,EAA8B,GAAG,GAAG,EACpCC,EAAuB,GAAG,GAAG,EAE5B,SAAST,GAAuD,CACrE,MAAO,CACL,SAAUE,EACV,YAAaC,EACb,sBAAuBC,EACvB,gCAAiCC,EACjC,sBAAuBC,EACvB,qBAAsBC,EACtB,wBAAyBC,EACzB,iBAAkBC,CACpB,CACF",
6
+ "names": ["makeInternalApi_exports", "__export", "makeDeviceActionInternalApiMock", "__toCommonJS", "sendApduMock", "sendCommandMock", "apiGetDeviceSessionStateMock", "apiGetDeviceSessionStateObservableMock", "setDeviceSessionStateMock", "getManagerApiServiceMock", "getSecureChannelServiceMock", "disableRefresherMock"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/model/UserInteractionRequired.ts"],
4
- "sourcesContent": ["/**\n * The user interaction required on the device to move further in a device action.\n * This is used to inform the user about the action they need to take on the device.\n */\nexport enum UserInteractionRequired {\n None = \"none\",\n UnlockDevice = \"unlock-device\",\n AllowSecureConnection = \"allow-secure-connection\",\n ConfirmOpenApp = \"confirm-open-app\",\n SignTransaction = \"sign-transaction\",\n SignTypedData = \"sign-typed-data\",\n AllowListApps = \"allow-list-apps\",\n VerifyAddress = \"verify-address\",\n SignPersonalMessage = \"sign-personal-message\",\n}\n"],
4
+ "sourcesContent": ["/**\n * The user interaction required on the device to move further in a device action.\n * This is used to inform the users about the action they need to take on the device.\n */\nexport enum UserInteractionRequired {\n None = \"none\",\n UnlockDevice = \"unlock-device\",\n AllowSecureConnection = \"allow-secure-connection\",\n ConfirmOpenApp = \"confirm-open-app\",\n SignTransaction = \"sign-transaction\",\n SignTypedData = \"sign-typed-data\",\n AllowListApps = \"allow-list-apps\",\n VerifyAddress = \"verify-address\",\n SignPersonalMessage = \"sign-personal-message\",\n}\n"],
5
5
  "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAIO,IAAKE,OACVA,EAAA,KAAO,OACPA,EAAA,aAAe,gBACfA,EAAA,sBAAwB,0BACxBA,EAAA,eAAiB,mBACjBA,EAAA,gBAAkB,mBAClBA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,iBAChBA,EAAA,oBAAsB,wBATZA,OAAA",
6
6
  "names": ["UserInteractionRequired_exports", "__export", "UserInteractionRequired", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var d=require("rxjs"),S=require("../../../command/model/CommandResult"),y=require("../../../command/utils/GlobalCommandError"),D=require("../../../device/DeviceModel"),i=require("../../../device/DeviceStatus"),u=require("../../../device-action/__test-utils__/makeInternalApi"),p=require("../../../device-action/__test-utils__/testDeviceActionStates"),t=require("../../../device-action/model/DeviceActionState"),a=require("../../../device-action/model/UserInteractionRequired"),A=require("../../../device-action/os/Errors"),s=require("../../../device-session/DeviceSessionState"),m=require("./GetDeviceStatusDeviceAction");describe("GetDeviceStatusDeviceAction",()=>{const C=vi.fn(),l=vi.fn(),O=vi.fn(),f=vi.fn(),R=vi.fn();function k(){return{getAppAndVersion:C,getDeviceSessionState:l,waitForDeviceUnlock:O,setDeviceSessionState:f,isDeviceOnboarded:R}}const{sendCommand:V,getDeviceSessionState:E,getDeviceSessionStateObservable:w}=(0,u.makeDeviceActionInternalApiMock)();beforeEach(()=>{vi.resetAllMocks(),R.mockReturnValue(!0)}),describe("without overriding `extractDependencies`",()=>{it("should run the device action with an unlocked device",()=>new Promise((r,o)=>{const e=new m.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});E.mockReturnValue({sessionStateType:s.DeviceSessionStateType.Connected,deviceStatus:i.DeviceStatus.CONNECTED,deviceModelId:D.DeviceModelId.NANO_X}),V.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.DeviceActionStatus.Completed}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})})),it("should run the device action with a locked device",()=>new Promise((r,o)=>{const e=new m.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});E.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:D.DeviceModelId.NANO_X}),w.mockImplementation(()=>new d.Observable(c=>{const v=(0,d.interval)(50).subscribe({next:h=>{h>2?(c.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:D.DeviceModelId.NANO_X}),c.complete()):c.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:D.DeviceModelId.NANO_X})}});return()=>{v.unsubscribe()}})),V.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.DeviceActionStatus.Completed}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})}))}),describe("success cases",()=>{it("should return the device status if the device is unlocked",()=>new Promise((r,o)=>{l.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),C.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const e=new m.GetDeviceStatusDeviceAction({input:{unlockTimeout:void 0}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{status:t.DeviceActionStatus.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})})),it("should return the device status if the device is locked and the user unlocks the device",()=>new Promise((r,o)=>{l.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),C.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}})),O.mockImplementation(()=>new d.Observable(c=>{const v=(0,d.interval)(50).subscribe({next:h=>{h>2?(c.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),c.complete()):c.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{v.unsubscribe()}}));const e=new m.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{status:t.DeviceActionStatus.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})}))}),describe("errors cases",()=>{it("should end in an error if the device is not onboarded",()=>new Promise((r,o)=>{l.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),R.mockReturnValue(!1);const e=new m.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{error:new A.DeviceNotOnboardedError,status:t.DeviceActionStatus.Error}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})})),it("should end in an error if the device is locked and the user does not unlock",()=>new Promise((r,o)=>{l.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),w.mockImplementation(()=>new d.Observable(c=>{const v=(0,d.interval)(200).subscribe({next:()=>{c.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:D.DeviceModelId.NANO_X})}});return()=>{v.unsubscribe()}}));const e=new m.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{error:new A.DeviceLockedError("Device locked."),status:t.DeviceActionStatus.Error}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})})),it("should end in an error if the GetAppAndVersion command fails",()=>new Promise((r,o)=>{l.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}});const e=new y.GlobalCommandError({...y.GLOBAL_ERRORS[5501],errorCode:"5501"});C.mockResolvedValue((0,S.CommandResultFactory)({error:e})),O.mockImplementation(()=>new d.Observable(v=>{const h=(0,d.interval)(50).subscribe({next:b=>{b>2?(v.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),v.complete()):v.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{h.unsubscribe()}}));const n=new m.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(n,"extractDependencies").mockReturnValue(k());const c=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{error:e,status:t.DeviceActionStatus.Error}];(0,p.testDeviceActionStates)(n,c,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})})),it("should end in an error if getAppAndVersion actor throws an error",()=>new Promise((r,o)=>{l.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),C.mockImplementation(()=>{throw new A.UnknownDAError("error")}),O.mockImplementation(()=>new d.Observable(c=>{c.complete()}));const e=new m.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{error:new A.UnknownDAError("error"),status:t.DeviceActionStatus.Error}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})}))}),it("should emit a stopped state if the action is cancelled",()=>new Promise((r,o)=>{E.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:D.DeviceModelId.NANO_X}),V.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const e=new m.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}}),n=[{status:t.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None}},{status:t.DeviceActionStatus.Stopped}],{cancel:c}=(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o});c()}))});
1
+ "use strict";var d=require("rxjs"),S=require("../../../command/model/CommandResult"),y=require("../../../command/utils/GlobalCommandError"),D=require("../../../device/DeviceModel"),i=require("../../../device/DeviceStatus"),u=require("../../../device-action/__test-utils__/makeInternalApi"),p=require("../../../device-action/__test-utils__/testDeviceActionStates"),t=require("../../../device-action/model/DeviceActionState"),a=require("../../../device-action/model/UserInteractionRequired"),A=require("../../../device-action/os/Errors"),s=require("../../../device-session/DeviceSessionState"),l=require("./GetDeviceStatusDeviceAction");describe("GetDeviceStatusDeviceAction",()=>{const C=vi.fn(),v=vi.fn(),O=vi.fn(),f=vi.fn(),R=vi.fn();function k(){return{getAppAndVersion:C,getDeviceSessionState:v,waitForDeviceUnlock:O,setDeviceSessionState:f,isDeviceOnboarded:R}}const{sendCommand:V,getDeviceSessionState:w,getDeviceSessionStateObservable:E}=(0,u.makeDeviceActionInternalApiMock)();beforeEach(()=>{vi.resetAllMocks(),R.mockReturnValue(!0)}),describe("without overriding `extractDependencies`",()=>{it("should run the device action with an unlocked device",()=>new Promise((r,o)=>{const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});w.mockReturnValue({sessionStateType:s.DeviceSessionStateType.Connected,deviceStatus:i.DeviceStatus.CONNECTED,deviceModelId:D.DeviceModelId.NANO_X}),V.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.DeviceActionStatus.Completed}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})})),it("should run the device action with a locked device",()=>new Promise((r,o)=>{const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});w.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:D.DeviceModelId.NANO_X,isSecureConnectionAllowed:!1}),E.mockImplementation(()=>new d.Observable(c=>{const m=(0,d.interval)(50).subscribe({next:h=>{h>2?(c.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:D.DeviceModelId.NANO_X,isSecureConnectionAllowed:!1}),c.complete()):c.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:D.DeviceModelId.NANO_X,isSecureConnectionAllowed:!1})}});return()=>{m.unsubscribe()}})),V.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.DeviceActionStatus.Completed}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})}))}),describe("success cases",()=>{it("should return the device status if the device is unlocked",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),C.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:void 0}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{status:t.DeviceActionStatus.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})})),it("should return the device status if the device is locked and the user unlocks the device",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),C.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}})),O.mockImplementation(()=>new d.Observable(c=>{const m=(0,d.interval)(50).subscribe({next:h=>{h>2?(c.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),c.complete()):c.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{m.unsubscribe()}}));const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{status:t.DeviceActionStatus.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})}))}),describe("errors cases",()=>{it("should end in an error if the device is not onboarded",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),R.mockReturnValue(!1);const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{error:new A.DeviceNotOnboardedError,status:t.DeviceActionStatus.Error}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})})),it("should end in an error if the device is locked and the user does not unlock",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),E.mockImplementation(()=>new d.Observable(c=>{const m=(0,d.interval)(200).subscribe({next:()=>{c.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:D.DeviceModelId.NANO_X,isSecureConnectionAllowed:!1})}});return()=>{m.unsubscribe()}}));const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{error:new A.DeviceLockedError("Device locked."),status:t.DeviceActionStatus.Error}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})})),it("should end in an error if the GetAppAndVersion command fails",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}});const e=new y.GlobalCommandError({...y.GLOBAL_ERRORS[5501],errorCode:"5501"});C.mockResolvedValue((0,S.CommandResultFactory)({error:e})),O.mockImplementation(()=>new d.Observable(m=>{const h=(0,d.interval)(50).subscribe({next:b=>{b>2?(m.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),m.complete()):m.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{h.unsubscribe()}}));const n=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(n,"extractDependencies").mockReturnValue(k());const c=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{error:e,status:t.DeviceActionStatus.Error}];(0,p.testDeviceActionStates)(n,c,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})})),it("should end in an error if getAppAndVersion actor throws an error",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),C.mockImplementation(()=>{throw new A.UnknownDAError("error")}),O.mockImplementation(()=>new d.Observable(c=>{c.complete()}));const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{error:new A.UnknownDAError("error"),status:t.DeviceActionStatus.Error}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o})}))}),it("should emit a stopped state if the action is cancelled",()=>new Promise((r,o)=>{w.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:D.DeviceModelId.NANO_X,isSecureConnectionAllowed:!1}),V.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}}),n=[{status:t.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None}},{status:t.DeviceActionStatus.Stopped}],{cancel:c}=(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:r,onError:o});c()}))});
2
2
  //# sourceMappingURL=GetDeviceStatusDeviceAction.test.js.map