@ledgerhq/device-management-kit 0.0.0-rnble-transport-20250303160138 → 0.0.0-rnble-transport-20250312161847

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 (126) hide show
  1. package/lib/cjs/package.json +2 -2
  2. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +1 -1
  3. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
  4. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +3 -3
  5. package/lib/cjs/src/api/index.js +1 -1
  6. package/lib/cjs/src/api/index.js.map +3 -3
  7. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
  8. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js +1 -1
  9. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js.map +1 -1
  10. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +2 -0
  11. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +7 -0
  12. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js +2 -0
  13. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js.map +7 -0
  14. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js +2 -0
  15. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +7 -0
  16. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
  17. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +2 -2
  18. package/lib/cjs/src/api/secure-channel/task/types.js +1 -1
  19. package/lib/cjs/src/api/secure-channel/task/types.js.map +1 -1
  20. package/lib/cjs/src/api/secure-channel/types.js +2 -0
  21. package/lib/cjs/src/api/secure-channel/types.js.map +7 -0
  22. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
  23. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js.map +2 -2
  24. package/lib/cjs/src/api/types.js +1 -1
  25. package/lib/cjs/src/api/types.js.map +1 -1
  26. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  27. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +2 -2
  28. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
  29. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
  30. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  31. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  32. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  33. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  34. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js +1 -1
  35. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js.map +1 -1
  36. package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js +1 -1
  37. package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
  38. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  39. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  40. package/lib/cjs/src/internal/manager-api/model/Application.js +1 -1
  41. package/lib/cjs/src/internal/manager-api/model/Application.js.map +1 -1
  42. package/lib/cjs/src/internal/manager-api/model/Params.js +2 -0
  43. package/lib/cjs/src/internal/manager-api/model/Params.js.map +7 -0
  44. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  45. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  46. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  47. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  48. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js +1 -1
  49. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js.map +1 -1
  50. package/lib/esm/package.json +2 -2
  51. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +1 -1
  52. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
  53. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +3 -3
  54. package/lib/esm/src/api/index.js +1 -1
  55. package/lib/esm/src/api/index.js.map +3 -3
  56. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
  57. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +2 -0
  58. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +7 -0
  59. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js +2 -0
  60. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js.map +7 -0
  61. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js +2 -0
  62. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +7 -0
  63. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
  64. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +2 -2
  65. package/lib/esm/src/api/secure-channel/task/types.js.map +1 -1
  66. package/lib/esm/src/api/secure-channel/types.js +1 -0
  67. package/lib/esm/src/api/secure-channel/types.js.map +7 -0
  68. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
  69. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js.map +2 -2
  70. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  71. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +2 -2
  72. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
  73. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
  74. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  75. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  76. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  77. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  78. package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
  79. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  80. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  81. package/lib/esm/src/internal/manager-api/model/Application.js.map +1 -1
  82. package/lib/esm/src/internal/manager-api/model/Params.js +1 -0
  83. package/lib/esm/src/internal/manager-api/model/Params.js.map +7 -0
  84. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  85. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  86. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  87. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  88. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +1 -1
  89. package/lib/types/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.d.ts.map +1 -1
  90. package/lib/types/src/api/index.d.ts +1 -0
  91. package/lib/types/src/api/index.d.ts.map +1 -1
  92. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts.map +1 -1
  93. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts +5 -7
  94. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts.map +1 -1
  95. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts +8 -0
  96. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts.map +1 -0
  97. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.d.ts +1 -0
  98. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.d.ts.map +1 -0
  99. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts +59 -0
  100. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts.map +1 -0
  101. package/lib/types/src/api/secure-channel/task/types.d.ts +1 -1
  102. package/lib/types/src/api/secure-channel/task/types.d.ts.map +1 -1
  103. package/lib/types/src/api/secure-channel/types.d.ts +4 -0
  104. package/lib/types/src/api/secure-channel/types.d.ts.map +1 -0
  105. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -1
  106. package/lib/types/src/api/types.d.ts +2 -1
  107. package/lib/types/src/api/types.d.ts.map +1 -1
  108. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  109. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts +6 -5
  110. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts.map +1 -1
  111. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts +14 -9
  112. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts.map +1 -1
  113. package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts +4 -1
  114. package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts.map +1 -1
  115. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts +1 -0
  116. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts.map +1 -1
  117. package/lib/types/src/internal/manager-api/model/Application.d.ts +4 -1
  118. package/lib/types/src/internal/manager-api/model/Application.d.ts.map +1 -1
  119. package/lib/types/src/internal/manager-api/model/Params.d.ts +43 -0
  120. package/lib/types/src/internal/manager-api/model/Params.d.ts.map +1 -0
  121. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts +5 -5
  122. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts.map +1 -1
  123. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts +33 -2
  124. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts.map +1 -1
  125. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  126. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/device-management-kit",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@sentry/minimal": "^6.19.7",
36
- "axios": "^1.7.9",
36
+ "axios": "^1.8.2",
37
37
  "inversify": "^6.2.2",
38
38
  "inversify-logger-middleware": "^3.1.0",
39
39
  "isomorphic-ws": "^5.0.0",
@@ -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 u=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var W=(n,e)=>{for(var i in e)u(n,i,{get:e[i],enumerable:!0})},E=(n,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of L(e))!g.call(n,p)&&p!==i&&u(n,p,{get:()=>e[p],enumerable:!(r=v(e,p))||r.enumerable});return n};var f=n=>E(u({},"__esModule",{value:!0}),n);var I={};W(I,{ListAppsWithMetadataDeviceAction:()=>x});module.exports=f(I);var o=require("purify-ts"),a=require("xstate"),A=require("../../../device-action/model/UserInteractionRequired"),d=require("../../../device-action/os/Const"),S=require("../../../device-action/os/ListApps/ListAppsDeviceAction"),l=require("../../../device-action/xstate-utils/XStateDeviceAction");class x extends l.XStateDeviceAction{makeStateMachine(e){const{getAppsByHash:i,setDeviceSessionState:r,getDeviceSessionState:p}=this.extractDependencies(e),h=this.input.unlockTimeout??d.DEFAULT_UNLOCK_TIMEOUT_MS,M=new S.ListAppsDeviceAction({input:{unlockTimeout:h}}).makeStateMachine(e);return(0,a.setup)({types:{input:{unlockTimeout:h},context:{},output:{}},actors:{listApps:M,getAppsByHash:(0,a.fromPromise)(i),updateDeviceSessionState:(0,a.fromCallback)(({input:t,sendBack:s})=>{const{appsWithMetadata:D}=t,y=D.filter(c=>c!==null),m={...p(),installedApps:y};try{r(m),s({type:"done"})}catch(c){s({type:"error",error:c})}})},guards:{hasError:({context:t})=>t._internalState.error!==null,hasNoAppsInstalled:({context:t})=>t._internalState.apps.length===0},actions:{assignErrorFromEvent:(0,a.assign)({_internalState:t=>({...t.context._internalState,error:t.event.error})})}}).createMachine({id:"ListAppsWithMetadataDeviceAction",initial:"DeviceReady",context:t=>({input:t.input,_internalState:{error:null,apps:[],appsWithMetadata:[]},intermediateValue:{requiredUserInteraction:A.UserInteractionRequired.None}}),states:{DeviceReady:{always:{target:"ListApps"}},ListApps:{invoke:{id:"listApps",src:"listApps",input:t=>({unlockTimeout:t.context.input.unlockTimeout}),onSnapshot:{actions:(0,a.assign)({intermediateValue:t=>t.event.snapshot.context.intermediateValue})},onDone:{target:"ListAppsCheck",actions:(0,a.assign)({intermediateValue:t=>({requiredUserInteraction:A.UserInteractionRequired.None}),_internalState:t=>t.event.output.caseOf({Right:s=>({...t.context._internalState,apps:s}),Left:s=>({...t.context._internalState,error:s})})})}}},ListAppsCheck:{always:[{target:"Error",guard:"hasError"},{target:"Success",guard:"hasNoAppsInstalled",actions:(0,a.assign)({_internalState:t=>({...t.context._internalState,appsWithMetadata:[]})})},{target:"FetchMetadata"}]},FetchMetadata:{invoke:{id:"getAppsByHash",src:"getAppsByHash",input:t=>t.context._internalState.apps,onDone:{target:"FetchMetadataCheck",actions:(0,a.assign)({_internalState:t=>t.event.output.caseOf({Right:s=>({...t.context._internalState,appsWithMetadata:s}),Left:s=>({...t.context._internalState,error:s})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},FetchMetadataCheck:{always:[{target:"Error",guard:"hasError"},{target:"SaveSession"}]},SaveSession:{invoke:{src:"updateDeviceSessionState",input:t=>({appsWithMetadata:t.context._internalState.appsWithMetadata})},on:{done:{target:"Success"},error:{target:"Error",actions:"assignErrorFromEvent"}}},Success:{type:"final"},Error:{type:"final"}},output:t=>t.context._internalState.error?(0,o.Left)(t.context._internalState.error):(0,o.Right)(t.context._internalState.appsWithMetadata)})}extractDependencies(e){return{getAppsByHash:({input:i})=>e.getManagerApiService().getAppsByHash(i),getDeviceSessionState:()=>e.getDeviceSessionState(),setDeviceSessionState:i=>e.setDeviceSessionState(i)}}}0&&(module.exports={ListAppsWithMetadataDeviceAction});
1
+ "use strict";var h=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var W=(n,e)=>{for(var r in e)h(n,r,{get:e[r],enumerable:!0})},E=(n,e,r,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of L(e))!g.call(n,s)&&s!==r&&h(n,s,{get:()=>e[s],enumerable:!(p=v(e,s))||p.enumerable});return n};var f=n=>E(h({},"__esModule",{value:!0}),n);var I={};W(I,{ListAppsWithMetadataDeviceAction:()=>x});module.exports=f(I);var u=require("purify-ts"),a=require("xstate"),l=require("../../../device-action/model/UserInteractionRequired"),d=require("../../../device-action/os/Const"),S=require("../../../device-action/os/ListApps/ListAppsDeviceAction"),M=require("../../../device-action/xstate-utils/XStateDeviceAction");class x extends M.XStateDeviceAction{makeStateMachine(e){const{getAppsByHash:r,setDeviceSessionState:p,getDeviceSessionState:s}=this.extractDependencies(e),o=this.input.unlockTimeout??d.DEFAULT_UNLOCK_TIMEOUT_MS,c=new S.ListAppsDeviceAction({input:{unlockTimeout:o}}).makeStateMachine(e);return(0,a.setup)({types:{input:{unlockTimeout:o},context:{},output:{}},actors:{listApps:c,getAppsByHash:(0,a.fromPromise)(r),updateDeviceSessionState:(0,a.fromCallback)(({input:t,sendBack:i})=>{const{appsWithMetadata:D}=t,y=D.filter(A=>A!==null),m={...s(),installedApps:y};try{p(m),i({type:"done"})}catch(A){i({type:"error",error:A})}})},guards:{hasError:({context:t})=>t._internalState.error!==null,hasNoAppsInstalled:({context:t})=>t._internalState.apps.length===0},actions:{assignErrorFromEvent:(0,a.assign)({_internalState:t=>({...t.context._internalState,error:t.event.error})})}}).createMachine({id:"ListAppsWithMetadataDeviceAction",initial:"DeviceReady",context:t=>({input:t.input,_internalState:{error:null,apps:[],appsWithMetadata:[]},intermediateValue:{requiredUserInteraction:l.UserInteractionRequired.None}}),states:{DeviceReady:{always:{target:"ListApps"}},ListApps:{invoke:{id:"listApps",src:"listApps",input:t=>({unlockTimeout:t.context.input.unlockTimeout}),onSnapshot:{actions:(0,a.assign)({intermediateValue:t=>t.event.snapshot.context.intermediateValue})},onDone:{target:"ListAppsCheck",actions:(0,a.assign)({intermediateValue:t=>({requiredUserInteraction:l.UserInteractionRequired.None}),_internalState:t=>t.event.output.caseOf({Right:i=>({...t.context._internalState,apps:i}),Left:i=>({...t.context._internalState,error:i})})})}}},ListAppsCheck:{always:[{target:"Error",guard:"hasError"},{target:"Success",guard:"hasNoAppsInstalled",actions:(0,a.assign)({_internalState:t=>({...t.context._internalState,appsWithMetadata:[]})})},{target:"FetchMetadata"}]},FetchMetadata:{invoke:{id:"getAppsByHash",src:"getAppsByHash",input:t=>t.context._internalState.apps,onDone:{target:"FetchMetadataCheck",actions:(0,a.assign)({_internalState:t=>t.event.output.caseOf({Right:i=>({...t.context._internalState,appsWithMetadata:i}),Left:i=>({...t.context._internalState,error:i})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},FetchMetadataCheck:{always:[{target:"Error",guard:"hasError"},{target:"SaveSession"}]},SaveSession:{invoke:{src:"updateDeviceSessionState",input:t=>({appsWithMetadata:t.context._internalState.appsWithMetadata})},on:{done:{target:"Success"},error:{target:"Error",actions:"assignErrorFromEvent"}}},Success:{type:"final"},Error:{type:"final"}},output:t=>t.context._internalState.error?(0,u.Left)(t.context._internalState.error):(0,u.Right)(t.context._internalState.appsWithMetadata)})}extractDependencies(e){return{getAppsByHash:({input:p})=>{const s=p.reduce((o,c)=>c.appFullHash?o.concat(c.appFullHash):o,[]);return e.getManagerApiService().getAppsByHash(s)},getDeviceSessionState:()=>e.getDeviceSessionState(),setDeviceSessionState:p=>e.setDeviceSessionState(p)}}}0&&(module.exports={ListAppsWithMetadataDeviceAction});
2
2
  //# sourceMappingURL=ListAppsWithMetadataDeviceAction.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.ts"],
4
- "sourcesContent": ["import { type EitherAsync, Left, Right } from \"purify-ts\";\nimport {\n type AnyEventObject,\n assign,\n fromCallback,\n fromPromise,\n setup,\n} from \"xstate\";\n\nimport { type ListAppsResponse } from \"@api/command/os/ListAppsCommand\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nimport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nimport { type ListAppsDAOutput } from \"@api/device-action/os/ListApps/types\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type Application } from \"@internal/manager-api/model/Application\";\nimport { type HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\n\nimport {\n type ListAppsWithMetadataDAError,\n type ListAppsWithMetadataDAInput,\n type ListAppsWithMetadataDAIntermediateValue,\n type ListAppsWithMetadataDAOutput,\n} from \"./types\";\n\ntype ListAppsWithMetadataMachineInternalState = {\n error: ListAppsWithMetadataDAError | null;\n apps: ListAppsResponse;\n appsWithMetadata: ListAppsWithMetadataDAOutput;\n};\n\nexport type MachineDependencies = {\n getAppsByHash: ({\n input,\n }: {\n input: ListAppsDAOutput;\n }) => EitherAsync<HttpFetchApiError, Array<Application | null>>;\n getDeviceSessionState: () => DeviceSessionState;\n setDeviceSessionState: (state: DeviceSessionState) => DeviceSessionState;\n};\n\nexport class ListAppsWithMetadataDeviceAction extends XStateDeviceAction<\n ListAppsWithMetadataDAOutput,\n ListAppsWithMetadataDAInput,\n ListAppsWithMetadataDAError,\n ListAppsWithMetadataDAIntermediateValue,\n ListAppsWithMetadataMachineInternalState\n> {\n makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n ListAppsWithMetadataDAOutput,\n ListAppsWithMetadataDAInput,\n ListAppsWithMetadataDAError,\n ListAppsWithMetadataDAIntermediateValue,\n ListAppsWithMetadataMachineInternalState\n > {\n type types = StateMachineTypes<\n ListAppsWithMetadataDAOutput,\n ListAppsWithMetadataDAInput,\n ListAppsWithMetadataDAError,\n ListAppsWithMetadataDAIntermediateValue,\n ListAppsWithMetadataMachineInternalState\n >;\n\n const { getAppsByHash, setDeviceSessionState, getDeviceSessionState } =\n this.extractDependencies(internalAPI);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n const listAppsMachine = new ListAppsDeviceAction({\n input: {\n unlockTimeout,\n },\n }).makeStateMachine(internalAPI);\n\n return setup({\n types: {\n input: {\n unlockTimeout,\n } as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n listApps: listAppsMachine,\n getAppsByHash: fromPromise(getAppsByHash),\n updateDeviceSessionState: fromCallback(\n ({\n input,\n sendBack,\n }: {\n sendBack: (event: AnyEventObject) => void;\n input: {\n appsWithMetadata: Array<Application | null>;\n };\n }) => {\n const { appsWithMetadata } = input;\n\n const filterted = appsWithMetadata.filter((app) => app !== null);\n\n const sessionState = getDeviceSessionState();\n const updatedState = {\n ...sessionState,\n installedApps: filterted,\n };\n try {\n setDeviceSessionState(updatedState);\n sendBack({ type: \"done\" });\n } catch (error) {\n sendBack({ type: \"error\", error });\n }\n },\n ),\n },\n guards: {\n hasError: ({ context }: { context: types[\"context\"] }) => {\n return context._internalState.error !== null;\n },\n hasNoAppsInstalled: ({ context }: { context: types[\"context\"] }) =>\n context._internalState.apps.length === 0,\n },\n actions: {\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // NOTE: it should never happen, the error is not typed anymore here\n }),\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QBkCWsAuBBADj2A6qhgBYCyYGAhhFdQCJgBuqAxmFqxqgPYB2AOkYt2AJTA0AngGIA2gAYAuolA4esYrz4qQAD0QBGAJzyBADgBsAdgNWAzPIAs8+TceOANCEmILAJjMBKwsHOyMjAzN7SIBfGK80TFx8IlIKaloGZjYOLi0BROw8WGkIfjABVD4mHgBrCoAbdCL8BWUkEDUNbn4dfQQAVgCBIz9IgacQ6z8-Lx8Ef1N5OwsBlbs7dyNHCziE5uTCYnJKGjoqYRzOHsFCw+kwACdHnkeBHAa6ADNXgFsBJpJYptHRdTS9Dr9IaBUbjSYrKwzOaIMwGAQTFx2MxmOx+AYDKxGAZ7EB3YqpE4Zc6XdjXfJk-AAYRIYFYtTkSlB6nB2khKKGAj89jCRjCFmWdmRCD8LiCGIMMysqIsCpJDKOaVOmQu2VpeX4BQOxWZrPZsgM7VU3JufX5fkFwvCYolUqVjkFyxlA3FeO9VjVRpSx3SZyyIlyN0NQKZLLZcj8ls61q0toQZgFQo2TqM4o2UosjjsQRC8iFa1GfiJAejGspoZ14bpBoAYpRWHXtaVypVqnUKjAWrAAEKSAASVFgJBBHTBNr5CAM7gsAkcY3TZmW-iMiPzm0Flkc2PX8gMTmrg4pIe1NIj+VbGHbV-OD2er3enwwP0e-wHhxH48nacrW6FN50XHYVzXAYNxWSsd28RA7GMQUMUcaCLFFTZdniUlA1rJ8wyufVBHvR8tXOE04yApMQIhUB+kiVYBFLTYbBmPwCwsKUdjRRxghVMwAlWSIjHPQ5L3Iwi9UjUiOwo2MzQtLlaN5ejDEsAZmL8ViFRmTj8wLSDt3kbFtzGZYxPJYNJIbIjIwAZSoJgwHsuANH4Ls+DAajZ1AtTpQ4wJnH8UyHB9fNgiMjCzCdcUzEcSyg01KkpNvA1HOc1zYHcvgXxeR4fOTOi9EQPSgvkEKYrC0spQJIwRn4pw8QLAwQjiHC+B4CA4B0dUJJS2zpL8mieVTABaLiEIQMbNPCOb5vmyxEvwmybybQQb3EKRlNG+dV3zIVizCxwc3sPxlv6+s1uIqNBx2ud-ICWa1lPexsWMb18ycQUS3FfEFTsb0LusgbrsjdVKNqe7hv6CwogECwCxPQGhSsNCjHzVdmIMMKBgMBV8eMYHkqu3U0pIts5OoaHioY093QCEwMNFJV5Gg-NInRHGKoqnNSzR4mqcG8mBFkgiqEhmnVJKhdVndQTlncKxXCsfF829H6HFsEJvSFbD9hrS7rzJ9aBAyly3OG3zadK-nzAGUUzKsQlxQxqaQnq2xt1XNnnBMuxBfFsH8nsgBXVh2GyqXUzxCqBEB7YxlXGLIisV0cy5sLlcR53RUD1aTZugBRV9Hmj+dY+XBPV0XRnU9qyxzGiiqNwmOxgnamIgA */\n id: \"ListAppsWithMetadataDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n return {\n input: _.input,\n _internalState: {\n error: null,\n apps: [],\n appsWithMetadata: [],\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"ListApps\",\n },\n },\n ListApps: {\n invoke: {\n id: \"listApps\",\n src: \"listApps\",\n input: (_) => ({\n unlockTimeout: _.context.input.unlockTimeout,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) =>\n _.event.snapshot.context.intermediateValue,\n }),\n },\n onDone: {\n target: \"ListAppsCheck\",\n actions: assign({\n intermediateValue: (_) => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n _internalState: (_) => {\n return _.event.output.caseOf({\n Right: (apps) => ({\n ..._.context._internalState,\n apps,\n }),\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n });\n },\n }),\n },\n },\n },\n ListAppsCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"Success\",\n guard: \"hasNoAppsInstalled\",\n actions: assign({\n _internalState: (_) => {\n return {\n ..._.context._internalState,\n appsWithMetadata: [],\n };\n },\n }),\n },\n {\n target: \"FetchMetadata\",\n },\n ],\n },\n FetchMetadata: {\n invoke: {\n id: \"getAppsByHash\",\n src: \"getAppsByHash\",\n input: (_) => _.context._internalState.apps,\n onDone: {\n target: \"FetchMetadataCheck\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf({\n Right: (appsWithMetadata) => ({\n ..._.context._internalState,\n appsWithMetadata,\n }),\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n });\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n FetchMetadataCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"SaveSession\",\n },\n ],\n },\n SaveSession: {\n invoke: {\n src: \"updateDeviceSessionState\",\n input: (_) => ({\n appsWithMetadata: _.context._internalState.appsWithMetadata,\n }),\n },\n on: {\n done: {\n target: \"Success\",\n },\n error: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (_) => {\n if (_.context._internalState.error) {\n return Left(_.context._internalState.error);\n }\n\n return Right(_.context._internalState.appsWithMetadata);\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n return {\n getAppsByHash: ({ input }) =>\n internalApi.getManagerApiService().getAppsByHash(input),\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n };\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA8C,qBAC9CC,EAMO,kBAIPC,EAAwC,4DACxCC,EAA0C,uCAC1CC,EAAqC,+DAGrCC,EAGO,8DA4BA,MAAMP,UAAyC,oBAMpD,CACA,iBACEQ,EAOA,CASA,KAAM,CAAE,cAAAC,EAAe,sBAAAC,EAAuB,sBAAAC,CAAsB,EAClE,KAAK,oBAAoBH,CAAW,EAEhCI,EAAgB,KAAK,MAAM,eAAiB,4BAE5CC,EAAkB,IAAI,uBAAqB,CAC/C,MAAO,CACL,cAAAD,CACF,CACF,CAAC,EAAE,iBAAiBJ,CAAW,EAE/B,SAAO,SAAM,CACX,MAAO,CACL,MAAO,CACL,cAAAI,CACF,EACA,QAAS,CAAC,EACV,OAAQ,CAAC,CACX,EACA,OAAQ,CACN,SAAUC,EACV,iBAAe,eAAYJ,CAAa,EACxC,4BAA0B,gBACxB,CAAC,CACC,MAAAK,EACA,SAAAC,CACF,IAKM,CACJ,KAAM,CAAE,iBAAAC,CAAiB,EAAIF,EAEvBG,EAAYD,EAAiB,OAAQE,GAAQA,IAAQ,IAAI,EAGzDC,EAAe,CACnB,GAFmBR,EAAsB,EAGzC,cAAeM,CACjB,EACA,GAAI,CACFP,EAAsBS,CAAY,EAClCJ,EAAS,CAAE,KAAM,MAAO,CAAC,CAC3B,OAASK,EAAO,CACdL,EAAS,CAAE,KAAM,QAAS,MAAAK,CAAM,CAAC,CACnC,CACF,CACF,CACF,EACA,OAAQ,CACN,SAAU,CAAC,CAAE,QAAAC,CAAQ,IACZA,EAAQ,eAAe,QAAU,KAE1C,mBAAoB,CAAC,CAAE,QAAAA,CAAQ,IAC7BA,EAAQ,eAAe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UAAO,CACd,eAAiBA,GACRA,EAAE,MAAM,OAAO,OAAO,CAC3B,MAAQN,IAAsB,CAC5B,GAAGM,EAAE,QAAQ,eACb,iBAAAN,CACF,GACA,KAAOI,IAAW,CAChB,GAAGE,EAAE,QAAQ,eACb,MAAAF,CACF,EACF,CAAC,CAEL,CAAC,CACH,EACA,QAAS,CACP,OAAQ,QACR,QAAS,sBACX,CACF,CACF,EACA,mBAAoB,CAClB,OAAQ,CACN,CACE,OAAQ,QACR,MAAO,UACT,EACA,CACE,OAAQ,aACV,CACF,CACF,EACA,YAAa,CACX,OAAQ,CACN,IAAK,2BACL,MAAQE,IAAO,CACb,iBAAkBA,EAAE,QAAQ,eAAe,gBAC7C,EACF,EACA,GAAI,CACF,KAAM,CACJ,OAAQ,SACV,EACA,MAAO,CACL,OAAQ,QACR,QAAS,sBACX,CACF,CACF,EACA,QAAS,CACP,KAAM,OACR,EACA,MAAO,CACL,KAAM,OACR,CACF,EACA,OAASA,GACHA,EAAE,QAAQ,eAAe,SACpB,QAAKA,EAAE,QAAQ,eAAe,KAAK,KAGrC,SAAMA,EAAE,QAAQ,eAAe,gBAAgB,CAE1D,CAAC,CACH,CAEA,oBAAoBE,EAA+C,CACjE,MAAO,CACL,cAAe,CAAC,CAAE,MAAAV,CAAM,IACtBU,EAAY,qBAAqB,EAAE,cAAcV,CAAK,EACxD,sBAAuB,IAAMU,EAAY,sBAAsB,EAC/D,sBAAwBC,GACtBD,EAAY,sBAAsBC,CAAK,CAC3C,CACF,CACF",
6
- "names": ["ListAppsWithMetadataDeviceAction_exports", "__export", "ListAppsWithMetadataDeviceAction", "__toCommonJS", "import_purify_ts", "import_xstate", "import_UserInteractionRequired", "import_Const", "import_ListAppsDeviceAction", "import_XStateDeviceAction", "internalAPI", "getAppsByHash", "setDeviceSessionState", "getDeviceSessionState", "unlockTimeout", "listAppsMachine", "input", "sendBack", "appsWithMetadata", "filterted", "app", "updatedState", "error", "context", "_", "apps", "internalApi", "state"]
4
+ "sourcesContent": ["import { type EitherAsync, Left, Right } from \"purify-ts\";\nimport {\n type AnyEventObject,\n assign,\n fromCallback,\n fromPromise,\n setup,\n} from \"xstate\";\n\nimport { type ListAppsResponse } from \"@api/command/os/ListAppsCommand\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nimport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nimport { type ListAppsDAOutput } from \"@api/device-action/os/ListApps/types\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type Application } from \"@internal/manager-api/model/Application\";\nimport { type HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\n\nimport {\n type ListAppsWithMetadataDAError,\n type ListAppsWithMetadataDAInput,\n type ListAppsWithMetadataDAIntermediateValue,\n type ListAppsWithMetadataDAOutput,\n} from \"./types\";\n\ntype ListAppsWithMetadataMachineInternalState = {\n error: ListAppsWithMetadataDAError | null;\n apps: ListAppsResponse;\n appsWithMetadata: ListAppsWithMetadataDAOutput;\n};\n\nexport type MachineDependencies = {\n getAppsByHash: ({\n input,\n }: {\n input: ListAppsDAOutput;\n }) => EitherAsync<HttpFetchApiError, Array<Application | null>>;\n getDeviceSessionState: () => DeviceSessionState;\n setDeviceSessionState: (state: DeviceSessionState) => DeviceSessionState;\n};\n\nexport class ListAppsWithMetadataDeviceAction extends XStateDeviceAction<\n ListAppsWithMetadataDAOutput,\n ListAppsWithMetadataDAInput,\n ListAppsWithMetadataDAError,\n ListAppsWithMetadataDAIntermediateValue,\n ListAppsWithMetadataMachineInternalState\n> {\n makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n ListAppsWithMetadataDAOutput,\n ListAppsWithMetadataDAInput,\n ListAppsWithMetadataDAError,\n ListAppsWithMetadataDAIntermediateValue,\n ListAppsWithMetadataMachineInternalState\n > {\n type types = StateMachineTypes<\n ListAppsWithMetadataDAOutput,\n ListAppsWithMetadataDAInput,\n ListAppsWithMetadataDAError,\n ListAppsWithMetadataDAIntermediateValue,\n ListAppsWithMetadataMachineInternalState\n >;\n\n const { getAppsByHash, setDeviceSessionState, getDeviceSessionState } =\n this.extractDependencies(internalAPI);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n const listAppsMachine = new ListAppsDeviceAction({\n input: {\n unlockTimeout,\n },\n }).makeStateMachine(internalAPI);\n\n return setup({\n types: {\n input: {\n unlockTimeout,\n } as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n listApps: listAppsMachine,\n getAppsByHash: fromPromise(getAppsByHash),\n updateDeviceSessionState: fromCallback(\n ({\n input,\n sendBack,\n }: {\n sendBack: (event: AnyEventObject) => void;\n input: {\n appsWithMetadata: Array<Application | null>;\n };\n }) => {\n const { appsWithMetadata } = input;\n\n const filterted = appsWithMetadata.filter((app) => app !== null);\n\n const sessionState = getDeviceSessionState();\n const updatedState = {\n ...sessionState,\n installedApps: filterted,\n };\n try {\n setDeviceSessionState(updatedState);\n sendBack({ type: \"done\" });\n } catch (error) {\n sendBack({ type: \"error\", error });\n }\n },\n ),\n },\n guards: {\n hasError: ({ context }: { context: types[\"context\"] }) => {\n return context._internalState.error !== null;\n },\n hasNoAppsInstalled: ({ context }: { context: types[\"context\"] }) =>\n context._internalState.apps.length === 0,\n },\n actions: {\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // NOTE: it should never happen, the error is not typed anymore here\n }),\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QBkCWsAuBBADj2A6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Bx2ud-ICWa1lPexsWMb18ycQUS3FfEFTsb0LusgbrsjdVKNqe7hv6CwogECwCxPQGhSsNCjHzVdmIMMKBgMBV8eMYHkqu3U0pIts5OoaHioY093QCEwMNFJV5Gg-NInRHGKoqnNSzR4mqcG8mBFkgiqEhmnVJKhdVndQTlncKxXCsfF829H6HFsEJvSFbD9hrS7rzJ9aBAyly3OG3zadK-nzAGUUzKsQlxQxqaQnq2xt1XNnnBMuxBfFsH8nsgBXVh2GyqXUzxCqBEB7YxlXGLIisV0cy5sLlcR53RUD1aTZugBRV9Hmj+dY+XBPV0XRnU9qyxzGiiqNwmOxgnamIgA */\n id: \"ListAppsWithMetadataDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n return {\n input: _.input,\n _internalState: {\n error: null,\n apps: [],\n appsWithMetadata: [],\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"ListApps\",\n },\n },\n ListApps: {\n invoke: {\n id: \"listApps\",\n src: \"listApps\",\n input: (_) => ({\n unlockTimeout: _.context.input.unlockTimeout,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) =>\n _.event.snapshot.context.intermediateValue,\n }),\n },\n onDone: {\n target: \"ListAppsCheck\",\n actions: assign({\n intermediateValue: (_) => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n _internalState: (_) => {\n return _.event.output.caseOf({\n Right: (apps) => ({\n ..._.context._internalState,\n apps,\n }),\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n });\n },\n }),\n },\n },\n },\n ListAppsCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"Success\",\n guard: \"hasNoAppsInstalled\",\n actions: assign({\n _internalState: (_) => {\n return {\n ..._.context._internalState,\n appsWithMetadata: [],\n };\n },\n }),\n },\n {\n target: \"FetchMetadata\",\n },\n ],\n },\n FetchMetadata: {\n invoke: {\n id: \"getAppsByHash\",\n src: \"getAppsByHash\",\n input: (_) => _.context._internalState.apps,\n onDone: {\n target: \"FetchMetadataCheck\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf({\n Right: (appsWithMetadata) => ({\n ..._.context._internalState,\n appsWithMetadata,\n }),\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n });\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n FetchMetadataCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"SaveSession\",\n },\n ],\n },\n SaveSession: {\n invoke: {\n src: \"updateDeviceSessionState\",\n input: (_) => ({\n appsWithMetadata: _.context._internalState.appsWithMetadata,\n }),\n },\n on: {\n done: {\n target: \"Success\",\n },\n error: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (_) => {\n if (_.context._internalState.error) {\n return Left(_.context._internalState.error);\n }\n\n return Right(_.context._internalState.appsWithMetadata);\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n const getAppsByHash = ({ input }: { input: ListAppsDAOutput }) => {\n const appHashes = input.reduce<string[]>((acc, app) => {\n if (app.appFullHash) {\n return acc.concat(app.appFullHash);\n }\n return acc;\n }, []);\n return internalApi.getManagerApiService().getAppsByHash(appHashes);\n };\n return {\n getAppsByHash,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n };\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA8C,qBAC9CC,EAMO,kBAIPC,EAAwC,4DACxCC,EAA0C,uCAC1CC,EAAqC,+DAGrCC,EAGO,8DA4BA,MAAMP,UAAyC,oBAMpD,CACA,iBACEQ,EAOA,C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,OAAQ,CACN,IAAK,2BACL,MAAQE,IAAO,CACb,iBAAkBA,EAAE,QAAQ,eAAe,gBAC7C,EACF,EACA,GAAI,CACF,KAAM,CACJ,OAAQ,SACV,EACA,MAAO,CACL,OAAQ,QACR,QAAS,sBACX,CACF,CACF,EACA,QAAS,CACP,KAAM,OACR,EACA,MAAO,CACL,KAAM,OACR,CACF,EACA,OAASA,GACHA,EAAE,QAAQ,eAAe,SACpB,QAAKA,EAAE,QAAQ,eAAe,KAAK,KAGrC,SAAMA,EAAE,QAAQ,eAAe,gBAAgB,CAE1D,CAAC,CACH,CAEA,oBAAoBE,EAA+C,CAUjE,MAAO,CACL,cAVoB,CAAC,CAAE,MAAAV,CAAM,IAAmC,CAChE,MAAMW,EAAYX,EAAM,OAAiB,CAACY,EAAKR,IACzCA,EAAI,YACCQ,EAAI,OAAOR,EAAI,WAAW,EAE5BQ,EACN,CAAC,CAAC,EACL,OAAOF,EAAY,qBAAqB,EAAE,cAAcC,CAAS,CACnE,EAGE,sBAAuB,IAAMD,EAAY,sBAAsB,EAC/D,sBAAwBG,GACtBH,EAAY,sBAAsBG,CAAK,CAC3C,CACF,CACF",
6
+ "names": ["ListAppsWithMetadataDeviceAction_exports", "__export", "ListAppsWithMetadataDeviceAction", "__toCommonJS", "import_purify_ts", "import_xstate", "import_UserInteractionRequired", "import_Const", "import_ListAppsDeviceAction", "import_XStateDeviceAction", "internalAPI", "getAppsByHash", "setDeviceSessionState", "getDeviceSessionState", "unlockTimeout", "listAppsMachine", "input", "sendBack", "appsWithMetadata", "filterted", "app", "updatedState", "error", "context", "_", "apps", "internalApi", "appHashes", "acc", "state"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var A=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ne=Object.prototype.hasOwnProperty;var ae=(t,r)=>{for(var p in r)A(t,p,{get:r[p],enumerable:!0})},d=(t,r,p,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of me(r))!ne.call(t,a)&&a!==p&&A(t,a,{get:()=>r[a],enumerable:!(u=ie(r,a))||u.enumerable});return t},o=(t,r,p)=>(d(t,r,"default"),p&&d(p,r,"default"));var se=t=>d(A({},"__esModule",{value:!0}),t);var e={};ae(e,{APDU_MAX_PAYLOAD:()=>s.APDU_MAX_PAYLOAD,Apdu:()=>D.Apdu,ApduBuilder:()=>s.ApduBuilder,ApduParser:()=>v.ApduParser,ApduResponse:()=>q.ApduResponse,BatteryStatusType:()=>f.BatteryStatusType,BleDeviceInfos:()=>K.BleDeviceInfos,ByteArrayBuilder:()=>S.ByteArrayBuilder,ByteArrayParser:()=>l.ByteArrayParser,CallTaskInAppDeviceAction:()=>O.CallTaskInAppDeviceAction,CloseAppCommand:()=>y.CloseAppCommand,CommandResultFactory:()=>i.CommandResultFactory,CommandResultStatus:()=>i.CommandResultStatus,CommandUtils:()=>M.CommandUtils,ConnectedDevice:()=>oe.ConnectedDevice,ConsoleLogger:()=>$.ConsoleLogger,DeviceActionStatus:()=>T.DeviceActionStatus,DeviceConnectionStateMachine:()=>re.DeviceConnectionStateMachine,DeviceManagementKit:()=>J.DeviceManagementKit,DeviceManagementKitBuilder:()=>Q.DeviceManagementKitBuilder,DeviceModel:()=>m.DeviceModel,DeviceModelId:()=>m.DeviceModelId,DeviceSessionStateType:()=>w.DeviceSessionStateType,DeviceStatus:()=>b.DeviceStatus,FramerUtils:()=>z.FramerUtils,GenuineCheckDeviceAction:()=>N.GenuineCheckDeviceAction,GetAppAndVersionCommand:()=>g.GetAppAndVersionCommand,GetBatteryStatusCommand:()=>f.GetBatteryStatusCommand,GetDeviceStatusDeviceAction:()=>U.GetDeviceStatusDeviceAction,GetOsVersionCommand:()=>B.GetOsVersionCommand,GlobalCommandError:()=>c.GlobalCommandError,GlobalCommandErrorHandler:()=>c.GlobalCommandErrorHandler,GoToDashboardDeviceAction:()=>V.GoToDashboardDeviceAction,InvalidStatusWordError:()=>C.InvalidStatusWordError,LEDGER_VENDOR_ID:()=>m.LEDGER_VENDOR_ID,ListAppsCommand:()=>L.ListAppsCommand,ListAppsDeviceAction:()=>P.ListAppsDeviceAction,ListAppsWithMetadataDeviceAction:()=>_.ListAppsWithMetadataDeviceAction,LoadCertificateCommand:()=>G.LoadCertificateCommand,LogLevel:()=>Z.LogLevel,OpenAppCommand:()=>R.OpenAppCommand,OpenAppDeviceAction:()=>k.OpenAppDeviceAction,SendCommandInAppDeviceAction:()=>H.SendCommandInAppDeviceAction,StaticDeviceModelDataSource:()=>F.StaticDeviceModelDataSource,TransportConnectedDevice:()=>te.TransportConnectedDevice,TransportDeviceModel:()=>X.TransportDeviceModel,UnknownDAError:()=>h.UnknownDAError,UserInteractionRequired:()=>I.UserInteractionRequired,WebLogsExporterLogger:()=>ee.WebLogsExporterLogger,XStateDeviceAction:()=>W.XStateDeviceAction,base64StringToBuffer:()=>x.base64StringToBuffer,bufferToHexaString:()=>n.bufferToHexaString,connectedDeviceStubBuilder:()=>pe.connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder:()=>Y.defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder:()=>j.defaultApduSenderServiceStubBuilder,hexaStringToBuffer:()=>n.hexaStringToBuffer,isBase64String:()=>x.isBase64String,isCommandErrorCode:()=>E.isCommandErrorCode,isHexaString:()=>n.isHexaString,isSuccessCommandResult:()=>i.isSuccessCommandResult});module.exports=se(e);var D=require("./apdu/model/Apdu"),s=require("./apdu/utils/ApduBuilder"),v=require("./apdu/utils/ApduParser");o(e,require("./apdu/utils/AppBuilderError"),module.exports);var S=require("./apdu/utils/ByteArrayBuilder"),l=require("./apdu/utils/ByteArrayParser"),C=require("./command/Errors"),i=require("./command/model/CommandResult"),y=require("./command/os/CloseAppCommand"),g=require("./command/os/GetAppAndVersionCommand"),f=require("./command/os/GetBatteryStatusCommand"),B=require("./command/os/GetOsVersionCommand"),L=require("./command/os/ListAppsCommand"),G=require("./command/os/LoadCertificateCommand"),R=require("./command/os/OpenAppCommand"),E=require("./command/utils/CommandErrors"),M=require("./command/utils/CommandUtils"),c=require("./command/utils/GlobalCommandError"),m=require("./device/DeviceModel"),b=require("./device/DeviceStatus"),T=require("./device-action/model/DeviceActionState"),I=require("./device-action/model/UserInteractionRequired"),O=require("./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction"),h=require("./device-action/os/Errors"),U=require("./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),V=require("./device-action/os/GoToDashboard/GoToDashboardDeviceAction"),P=require("./device-action/os/ListApps/ListAppsDeviceAction"),_=require("./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction"),k=require("./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),H=require("./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction"),W=require("./device-action/xstate-utils/XStateDeviceAction"),F=require("./device-model/data/StaticDeviceModelDataSource"),K=require("./device-model/model/BleDeviceInfos"),X=require("./device-model/model/DeviceModel"),q=require("./device-session/ApduResponse");o(e,require("./device-session/data/FramerConst"),module.exports);var w=require("./device-session/DeviceSessionState"),N=require("./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction"),Y=require("./device-session/service/DefaultApduReceiverService.stub"),j=require("./device-session/service/DefaultApduSenderService.stub"),z=require("./device-session/utils/FramerUtils"),J=require("./DeviceManagementKit"),Q=require("./DeviceManagementKitBuilder");o(e,require("./Error"),module.exports);var Z=require("./logger-subscriber/model/LogLevel"),$=require("./logger-subscriber/service/ConsoleLogger"),ee=require("./logger-subscriber/service/WebLogsExporterLogger"),oe=require("./transport/model/ConnectedDevice"),re=require("./transport/model/DeviceConnectionStateMachine");o(e,require("./transport/model/Errors"),module.exports);var te=require("./transport/model/TransportConnectedDevice"),pe=require("./transport/model/TransportConnectedDevice.stub");o(e,require("./types"),module.exports);var x=require("./utils/Base64String"),n=require("./utils/HexaString");0&&(module.exports={APDU_MAX_PAYLOAD,Apdu,ApduBuilder,ApduParser,ApduResponse,BatteryStatusType,BleDeviceInfos,ByteArrayBuilder,ByteArrayParser,CallTaskInAppDeviceAction,CloseAppCommand,CommandResultFactory,CommandResultStatus,CommandUtils,ConnectedDevice,ConsoleLogger,DeviceActionStatus,DeviceConnectionStateMachine,DeviceManagementKit,DeviceManagementKitBuilder,DeviceModel,DeviceModelId,DeviceSessionStateType,DeviceStatus,FramerUtils,GenuineCheckDeviceAction,GetAppAndVersionCommand,GetBatteryStatusCommand,GetDeviceStatusDeviceAction,GetOsVersionCommand,GlobalCommandError,GlobalCommandErrorHandler,GoToDashboardDeviceAction,InvalidStatusWordError,LEDGER_VENDOR_ID,ListAppsCommand,ListAppsDeviceAction,ListAppsWithMetadataDeviceAction,LoadCertificateCommand,LogLevel,OpenAppCommand,OpenAppDeviceAction,SendCommandInAppDeviceAction,StaticDeviceModelDataSource,TransportConnectedDevice,TransportDeviceModel,UnknownDAError,UserInteractionRequired,WebLogsExporterLogger,XStateDeviceAction,base64StringToBuffer,bufferToHexaString,connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder,hexaStringToBuffer,isBase64String,isCommandErrorCode,isHexaString,isSuccessCommandResult,...require("./apdu/utils/AppBuilderError"),...require("./device-session/data/FramerConst"),...require("./Error"),...require("./transport/model/Errors"),...require("./types")});
1
+ "use strict";var A=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var ae=Object.prototype.hasOwnProperty;var se=(t,r)=>{for(var p in r)A(t,p,{get:r[p],enumerable:!0})},d=(t,r,p,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of ne(r))!ae.call(t,a)&&a!==p&&A(t,a,{get:()=>r[a],enumerable:!(u=me(r,a))||u.enumerable});return t},o=(t,r,p)=>(d(t,r,"default"),p&&d(p,r,"default"));var fe=t=>d(A({},"__esModule",{value:!0}),t);var e={};se(e,{APDU_MAX_PAYLOAD:()=>s.APDU_MAX_PAYLOAD,Apdu:()=>D.Apdu,ApduBuilder:()=>s.ApduBuilder,ApduParser:()=>v.ApduParser,ApduResponse:()=>q.ApduResponse,BatteryStatusType:()=>f.BatteryStatusType,BleDeviceInfos:()=>K.BleDeviceInfos,ByteArrayBuilder:()=>l.ByteArrayBuilder,ByteArrayParser:()=>S.ByteArrayParser,CallTaskInAppDeviceAction:()=>O.CallTaskInAppDeviceAction,CloseAppCommand:()=>y.CloseAppCommand,CommandResultFactory:()=>i.CommandResultFactory,CommandResultStatus:()=>i.CommandResultStatus,CommandUtils:()=>M.CommandUtils,ConnectedDevice:()=>re.ConnectedDevice,ConsoleLogger:()=>ee.ConsoleLogger,DeviceActionStatus:()=>I.DeviceActionStatus,DeviceConnectionStateMachine:()=>te.DeviceConnectionStateMachine,DeviceManagementKit:()=>Q.DeviceManagementKit,DeviceManagementKitBuilder:()=>Z.DeviceManagementKitBuilder,DeviceModel:()=>m.DeviceModel,DeviceModelId:()=>m.DeviceModelId,DeviceSessionStateType:()=>w.DeviceSessionStateType,DeviceStatus:()=>b.DeviceStatus,FramerUtils:()=>J.FramerUtils,GenuineCheckDeviceAction:()=>N.GenuineCheckDeviceAction,GetAppAndVersionCommand:()=>g.GetAppAndVersionCommand,GetBatteryStatusCommand:()=>f.GetBatteryStatusCommand,GetDeviceStatusDeviceAction:()=>U.GetDeviceStatusDeviceAction,GetOsVersionCommand:()=>L.GetOsVersionCommand,GlobalCommandError:()=>c.GlobalCommandError,GlobalCommandErrorHandler:()=>c.GlobalCommandErrorHandler,GoToDashboardDeviceAction:()=>V.GoToDashboardDeviceAction,InvalidStatusWordError:()=>C.InvalidStatusWordError,LEDGER_VENDOR_ID:()=>m.LEDGER_VENDOR_ID,ListAppsCommand:()=>B.ListAppsCommand,ListAppsDeviceAction:()=>P.ListAppsDeviceAction,ListAppsWithMetadataDeviceAction:()=>_.ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction:()=>Y.ListInstalledAppsDeviceAction,LoadCertificateCommand:()=>G.LoadCertificateCommand,LogLevel:()=>$.LogLevel,OpenAppCommand:()=>R.OpenAppCommand,OpenAppDeviceAction:()=>k.OpenAppDeviceAction,SendCommandInAppDeviceAction:()=>H.SendCommandInAppDeviceAction,StaticDeviceModelDataSource:()=>F.StaticDeviceModelDataSource,TransportConnectedDevice:()=>pe.TransportConnectedDevice,TransportDeviceModel:()=>X.TransportDeviceModel,UnknownDAError:()=>h.UnknownDAError,UserInteractionRequired:()=>T.UserInteractionRequired,WebLogsExporterLogger:()=>oe.WebLogsExporterLogger,XStateDeviceAction:()=>W.XStateDeviceAction,base64StringToBuffer:()=>x.base64StringToBuffer,bufferToHexaString:()=>n.bufferToHexaString,connectedDeviceStubBuilder:()=>ie.connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder:()=>j.defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder:()=>z.defaultApduSenderServiceStubBuilder,hexaStringToBuffer:()=>n.hexaStringToBuffer,isBase64String:()=>x.isBase64String,isCommandErrorCode:()=>E.isCommandErrorCode,isHexaString:()=>n.isHexaString,isSuccessCommandResult:()=>i.isSuccessCommandResult});module.exports=fe(e);var D=require("./apdu/model/Apdu"),s=require("./apdu/utils/ApduBuilder"),v=require("./apdu/utils/ApduParser");o(e,require("./apdu/utils/AppBuilderError"),module.exports);var l=require("./apdu/utils/ByteArrayBuilder"),S=require("./apdu/utils/ByteArrayParser"),C=require("./command/Errors"),i=require("./command/model/CommandResult"),y=require("./command/os/CloseAppCommand"),g=require("./command/os/GetAppAndVersionCommand"),f=require("./command/os/GetBatteryStatusCommand"),L=require("./command/os/GetOsVersionCommand"),B=require("./command/os/ListAppsCommand"),G=require("./command/os/LoadCertificateCommand"),R=require("./command/os/OpenAppCommand"),E=require("./command/utils/CommandErrors"),M=require("./command/utils/CommandUtils"),c=require("./command/utils/GlobalCommandError"),m=require("./device/DeviceModel"),b=require("./device/DeviceStatus"),I=require("./device-action/model/DeviceActionState"),T=require("./device-action/model/UserInteractionRequired"),O=require("./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction"),h=require("./device-action/os/Errors"),U=require("./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),V=require("./device-action/os/GoToDashboard/GoToDashboardDeviceAction"),P=require("./device-action/os/ListApps/ListAppsDeviceAction"),_=require("./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction"),k=require("./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),H=require("./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction"),W=require("./device-action/xstate-utils/XStateDeviceAction"),F=require("./device-model/data/StaticDeviceModelDataSource"),K=require("./device-model/model/BleDeviceInfos"),X=require("./device-model/model/DeviceModel"),q=require("./device-session/ApduResponse");o(e,require("./device-session/data/FramerConst"),module.exports);var w=require("./device-session/DeviceSessionState"),N=require("./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction"),Y=require("./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction"),j=require("./device-session/service/DefaultApduReceiverService.stub"),z=require("./device-session/service/DefaultApduSenderService.stub"),J=require("./device-session/utils/FramerUtils"),Q=require("./DeviceManagementKit"),Z=require("./DeviceManagementKitBuilder");o(e,require("./Error"),module.exports);var $=require("./logger-subscriber/model/LogLevel"),ee=require("./logger-subscriber/service/ConsoleLogger"),oe=require("./logger-subscriber/service/WebLogsExporterLogger"),re=require("./transport/model/ConnectedDevice"),te=require("./transport/model/DeviceConnectionStateMachine");o(e,require("./transport/model/Errors"),module.exports);var pe=require("./transport/model/TransportConnectedDevice"),ie=require("./transport/model/TransportConnectedDevice.stub");o(e,require("./types"),module.exports);var x=require("./utils/Base64String"),n=require("./utils/HexaString");0&&(module.exports={APDU_MAX_PAYLOAD,Apdu,ApduBuilder,ApduParser,ApduResponse,BatteryStatusType,BleDeviceInfos,ByteArrayBuilder,ByteArrayParser,CallTaskInAppDeviceAction,CloseAppCommand,CommandResultFactory,CommandResultStatus,CommandUtils,ConnectedDevice,ConsoleLogger,DeviceActionStatus,DeviceConnectionStateMachine,DeviceManagementKit,DeviceManagementKitBuilder,DeviceModel,DeviceModelId,DeviceSessionStateType,DeviceStatus,FramerUtils,GenuineCheckDeviceAction,GetAppAndVersionCommand,GetBatteryStatusCommand,GetDeviceStatusDeviceAction,GetOsVersionCommand,GlobalCommandError,GlobalCommandErrorHandler,GoToDashboardDeviceAction,InvalidStatusWordError,LEDGER_VENDOR_ID,ListAppsCommand,ListAppsDeviceAction,ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction,LoadCertificateCommand,LogLevel,OpenAppCommand,OpenAppDeviceAction,SendCommandInAppDeviceAction,StaticDeviceModelDataSource,TransportConnectedDevice,TransportDeviceModel,UnknownDAError,UserInteractionRequired,WebLogsExporterLogger,XStateDeviceAction,base64StringToBuffer,bufferToHexaString,connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder,hexaStringToBuffer,isBase64String,isCommandErrorCode,isHexaString,isSuccessCommandResult,...require("./apdu/utils/AppBuilderError"),...require("./device-session/data/FramerConst"),...require("./Error"),...require("./transport/model/Errors"),...require("./types")});
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/index.ts"],
4
- "sourcesContent": ["\"use strict\";\n\nexport { Apdu } from \"@api/apdu/model/Apdu\";\nexport { APDU_MAX_PAYLOAD, ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nexport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nexport * from \"@api/apdu/utils/AppBuilderError\";\nexport { ByteArrayBuilder } from \"@api/apdu/utils/ByteArrayBuilder\";\nexport { ByteArrayParser } from \"@api/apdu/utils/ByteArrayParser\";\nexport { InvalidStatusWordError } from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n BatteryStatusType,\n type GetBatteryStatusArgs,\n GetBatteryStatusCommand,\n type GetBatteryStatusResponse,\n} from \"@api/command/os/GetBatteryStatusCommand\";\nexport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n type LoadCertificateArgs,\n LoadCertificateCommand,\n type LoadCertificateErrorCodes,\n} from \"@api/command/os/LoadCertificateCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { CallTaskInAppDeviceAction } from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction\";\nexport { UnknownDAError } from \"@api/device-action/os/Errors\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nexport { StaticDeviceModelDataSource } from \"@api/device-model/data/StaticDeviceModelDataSource\";\nexport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nexport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nexport { ApduResponse } from \"@api/device-session/ApduResponse\";\nexport * from \"@api/device-session/data/FramerConst\";\nexport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nexport { GenuineCheckDeviceAction } from \"@api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction\";\n// TODO: remove from exported\nexport { defaultApduReceiverServiceStubBuilder } from \"@api/device-session/service/DefaultApduReceiverService.stub\";\nexport { defaultApduSenderServiceStubBuilder } from \"@api/device-session/service/DefaultApduSenderService.stub\";\nexport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nexport { DeviceManagementKit } from \"@api/DeviceManagementKit\";\nexport { DeviceManagementKitBuilder } from \"@api/DeviceManagementKitBuilder\";\nexport * from \"@api/Error\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport { DeviceConnectionStateMachine } from \"@api/transport/model/DeviceConnectionStateMachine\";\nexport * from \"@api/transport/model/Errors\";\nexport { TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nexport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nexport * from \"@api/types\";\nexport { base64StringToBuffer, isBase64String } from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@api/utils/HexaString\";\n"],
5
- "mappings": "meAAA,IAAAA,EAAA,GAAAC,GAAAD,EAAA,iuFAAAE,GAAAF,GAEA,IAAAG,EAAqB,gCACrBC,EAA8C,uCAC9CC,EAA2B,sCAC3BC,EAAAN,EAAc,2CALd,gBAMA,IAAAO,EAAiC,4CACjCC,EAAgC,2CAChCC,EAAuC,+BACvCC,EAIO,4CACPC,EAAgC,2CAChCC,EAGO,mDACPC,EAKO,mDACPC,EAGO,+CACPC,EAKO,2CACPC,EAIO,kDACPC,EAGO,0CACPC,EAAmC,4CACnCC,EAA6B,2CAC7BC,EAGO,iDACPC,EAIO,mCACPC,EAA6B,oCAE7BC,EAGO,sDACPC,EAAwC,4DACxCC,EAA0C,qFAC1ChB,EAA+B,wCAC/BiB,EAA4C,6EAC5CC,EAA0C,yEAC1CC,EAAqC,+DACrCC,EAAiD,uFACjDC,EAAoC,yEACpCC,EAA6C,2FAC7CC,EAGO,8DACPC,EAA4C,8DAC5CC,EAA+B,kDAC/Bb,EAAqC,+CACrCc,EAA6B,4CAC7B7B,EAAAN,EAAc,gDA9Ed,gBA+EA,IAAAoC,EAGO,kDACPC,EAAyC,mFAEzCC,EAAsD,uEACtDC,EAAoD,qEACpDC,EAA4B,iDAC5BC,EAAoC,oCACpCC,EAA2C,2CAC3CpC,EAAAN,EAAc,sBA1Fd,gBA2FA,IAAA2C,EAAyB,iDACzBC,EAA8B,wDAC9BC,GAAsC,gEACtCC,GAAgC,gDAChCC,GAA6C,6DAC7CzC,EAAAN,EAAc,uCAhGd,gBAiGA,IAAAgD,GAAyC,yDACzCA,GAA2C,8DAC3C1C,EAAAN,EAAc,sBAnGd,gBAoGA,IAAAiD,EAAqD,mCACrDC,EAIO",
6
- "names": ["api_exports", "__export", "__toCommonJS", "import_Apdu", "import_ApduBuilder", "import_ApduParser", "__reExport", "import_ByteArrayBuilder", "import_ByteArrayParser", "import_Errors", "import_CommandResult", "import_CloseAppCommand", "import_GetAppAndVersionCommand", "import_GetBatteryStatusCommand", "import_GetOsVersionCommand", "import_ListAppsCommand", "import_LoadCertificateCommand", "import_OpenAppCommand", "import_CommandErrors", "import_CommandUtils", "import_GlobalCommandError", "import_DeviceModel", "import_DeviceStatus", "import_DeviceActionState", "import_UserInteractionRequired", "import_CallTaskInAppDeviceAction", "import_GetDeviceStatusDeviceAction", "import_GoToDashboardDeviceAction", "import_ListAppsDeviceAction", "import_ListAppsWithMetadataDeviceAction", "import_OpenAppDeviceAction", "import_SendCommandInAppDeviceAction", "import_XStateDeviceAction", "import_StaticDeviceModelDataSource", "import_BleDeviceInfos", "import_ApduResponse", "import_DeviceSessionState", "import_GenuineCheckDeviceAction", "import_DefaultApduReceiverService", "import_DefaultApduSenderService", "import_FramerUtils", "import_DeviceManagementKit", "import_DeviceManagementKitBuilder", "import_LogLevel", "import_ConsoleLogger", "import_WebLogsExporterLogger", "import_ConnectedDevice", "import_DeviceConnectionStateMachine", "import_TransportConnectedDevice", "import_Base64String", "import_HexaString"]
4
+ "sourcesContent": ["\"use strict\";\n\nexport { Apdu } from \"@api/apdu/model/Apdu\";\nexport { APDU_MAX_PAYLOAD, ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nexport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nexport * from \"@api/apdu/utils/AppBuilderError\";\nexport { ByteArrayBuilder } from \"@api/apdu/utils/ByteArrayBuilder\";\nexport { ByteArrayParser } from \"@api/apdu/utils/ByteArrayParser\";\nexport { InvalidStatusWordError } from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n BatteryStatusType,\n type GetBatteryStatusArgs,\n GetBatteryStatusCommand,\n type GetBatteryStatusResponse,\n} from \"@api/command/os/GetBatteryStatusCommand\";\nexport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n type LoadCertificateArgs,\n LoadCertificateCommand,\n type LoadCertificateErrorCodes,\n} from \"@api/command/os/LoadCertificateCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { CallTaskInAppDeviceAction } from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction\";\nexport { UnknownDAError } from \"@api/device-action/os/Errors\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nexport { StaticDeviceModelDataSource } from \"@api/device-model/data/StaticDeviceModelDataSource\";\nexport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nexport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nexport { ApduResponse } from \"@api/device-session/ApduResponse\";\nexport * from \"@api/device-session/data/FramerConst\";\nexport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nexport { GenuineCheckDeviceAction } from \"@api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction\";\nexport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\n// TODO: remove from exported\nexport { defaultApduReceiverServiceStubBuilder } from \"@api/device-session/service/DefaultApduReceiverService.stub\";\nexport { defaultApduSenderServiceStubBuilder } from \"@api/device-session/service/DefaultApduSenderService.stub\";\nexport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nexport { DeviceManagementKit } from \"@api/DeviceManagementKit\";\nexport { DeviceManagementKitBuilder } from \"@api/DeviceManagementKitBuilder\";\nexport * from \"@api/Error\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport { DeviceConnectionStateMachine } from \"@api/transport/model/DeviceConnectionStateMachine\";\nexport * from \"@api/transport/model/Errors\";\nexport { TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nexport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nexport * from \"@api/types\";\nexport { base64StringToBuffer, isBase64String } from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@api/utils/HexaString\";\n"],
5
+ "mappings": "meAAA,IAAAA,EAAA,GAAAC,GAAAD,EAAA,oyFAAAE,GAAAF,GAEA,IAAAG,EAAqB,gCACrBC,EAA8C,uCAC9CC,EAA2B,sCAC3BC,EAAAN,EAAc,2CALd,gBAMA,IAAAO,EAAiC,4CACjCC,EAAgC,2CAChCC,EAAuC,+BACvCC,EAIO,4CACPC,EAAgC,2CAChCC,EAGO,mDACPC,EAKO,mDACPC,EAGO,+CACPC,EAKO,2CACPC,EAIO,kDACPC,EAGO,0CACPC,EAAmC,4CACnCC,EAA6B,2CAC7BC,EAGO,iDACPC,EAIO,mCACPC,EAA6B,oCAE7BC,EAGO,sDACPC,EAAwC,4DACxCC,EAA0C,qFAC1ChB,EAA+B,wCAC/BiB,EAA4C,6EAC5CC,EAA0C,yEAC1CC,EAAqC,+DACrCC,EAAiD,uFACjDC,EAAoC,yEACpCC,EAA6C,2FAC7CC,EAGO,8DACPC,EAA4C,8DAC5CC,EAA+B,kDAC/Bb,EAAqC,+CACrCc,EAA6B,4CAC7B7B,EAAAN,EAAc,gDA9Ed,gBA+EA,IAAAoC,EAGO,kDACPC,EAAyC,mFACzCC,EAA8C,6FAE9CC,EAAsD,uEACtDC,EAAoD,qEACpDC,EAA4B,iDAC5BC,EAAoC,oCACpCC,EAA2C,2CAC3CrC,EAAAN,EAAc,sBA3Fd,gBA4FA,IAAA4C,EAAyB,iDACzBC,GAA8B,wDAC9BC,GAAsC,gEACtCC,GAAgC,gDAChCC,GAA6C,6DAC7C1C,EAAAN,EAAc,uCAjGd,gBAkGA,IAAAiD,GAAyC,yDACzCA,GAA2C,8DAC3C3C,EAAAN,EAAc,sBApGd,gBAqGA,IAAAkD,EAAqD,mCACrDC,EAIO",
6
+ "names": ["api_exports", "__export", "__toCommonJS", "import_Apdu", "import_ApduBuilder", "import_ApduParser", "__reExport", "import_ByteArrayBuilder", "import_ByteArrayParser", "import_Errors", "import_CommandResult", "import_CloseAppCommand", "import_GetAppAndVersionCommand", "import_GetBatteryStatusCommand", "import_GetOsVersionCommand", "import_ListAppsCommand", "import_LoadCertificateCommand", "import_OpenAppCommand", "import_CommandErrors", "import_CommandUtils", "import_GlobalCommandError", "import_DeviceModel", "import_DeviceStatus", "import_DeviceActionState", "import_UserInteractionRequired", "import_CallTaskInAppDeviceAction", "import_GetDeviceStatusDeviceAction", "import_GoToDashboardDeviceAction", "import_ListAppsDeviceAction", "import_ListAppsWithMetadataDeviceAction", "import_OpenAppDeviceAction", "import_SendCommandInAppDeviceAction", "import_XStateDeviceAction", "import_StaticDeviceModelDataSource", "import_BleDeviceInfos", "import_ApduResponse", "import_DeviceSessionState", "import_GenuineCheckDeviceAction", "import_ListInstalledAppsDeviceAction", "import_DefaultApduReceiverService", "import_DefaultApduSenderService", "import_FramerUtils", "import_DeviceManagementKit", "import_DeviceManagementKitBuilder", "import_LogLevel", "import_ConsoleLogger", "import_WebLogsExporterLogger", "import_ConnectedDevice", "import_DeviceConnectionStateMachine", "import_TransportConnectedDevice", "import_Base64String", "import_HexaString"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromObservable, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nimport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nimport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nimport {\n type GenuineCheckDAError,\n type GenuineCheckDAInput,\n type GenuineCheckDAIntermediateValue,\n type GenuineCheckDAOutput,\n type GenuineCheckStateMachineInternalState,\n type Input,\n type MachineDependencies,\n} from \"@api/secure-channel/device-action/GenuineCheck/types\";\nimport { ConnectToSecureChannelTask } from \"@api/secure-channel/task/ConnectToSecureChannelTask\";\nimport { SecureChannelEventType } from \"@api/secure-channel/task/types\";\nimport { isDeviceGenuine } from \"@api/secure-channel/utils\";\nimport { type DeviceVersion } from \"@internal/manager-api/model/Device\";\nimport { type FinalFirmware } from \"@internal/manager-api/model/Firmware\";\n\nexport class GenuineCheckDeviceAction extends XStateDeviceAction<\n GenuineCheckDAOutput,\n GenuineCheckDAInput,\n GenuineCheckDAError,\n GenuineCheckDAIntermediateValue,\n GenuineCheckStateMachineInternalState\n> {\n protected override makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n GenuineCheckDAOutput,\n GenuineCheckDAInput,\n GenuineCheckDAError,\n GenuineCheckDAIntermediateValue,\n GenuineCheckStateMachineInternalState\n > {\n type types = StateMachineTypes<\n GenuineCheckDAOutput,\n GenuineCheckDAInput,\n GenuineCheckDAError,\n GenuineCheckDAIntermediateValue,\n GenuineCheckStateMachineInternalState\n >;\n\n const {\n getOsVersion,\n getDeviceVersion,\n getFirmwareVersion,\n genuineCheck,\n getDeviceSessionState,\n setDeviceSessionState,\n } = this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n const goToDashboardMachine = new GoToDashboardDeviceAction({\n input: {\n unlockTimeout,\n },\n }).makeStateMachine(internalApi);\n\n return setup({\n types: {\n input: {} as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n goToDashboard: goToDashboardMachine,\n getOsVersion: fromPromise(getOsVersion),\n getDeviceVersion: fromPromise(getDeviceVersion),\n getFirmwareVersion: fromPromise(getFirmwareVersion),\n genuineCheck: fromObservable(genuineCheck),\n },\n guards: {\n hasError: (_) => _.context._internalState.error !== null,\n },\n actions: {\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"],\n }),\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QHEwDsCuBLNYDCAFmAMYDWAImAG5bFgCCxALlgPZoB0lNdASmAEMIATwDEAbQAMAXUSgADq1hYW7OSAAeiAIwB2AGwAWDvskBOAKwAmC9YvbJADkMAaEMMQBmT2ZPazuo6SFp6SDpKG+gC+UW6omDj4RGTctAzMbJzIrAAqrOQCsAQARqwCAE4QohDsYBw4VKykdVC5+YUlZZVSskggisqqaOpaCFaGntocEwaOFkYR2oa6bh4IZsEcuta6Nmbajp76tjFx6Ni4hCQU1GmMQxzZeQVFpRVVYOXlrOUc8gA2AiYADMfgBbDitZ4dN7dGTqAYqTIjRDjSbTTyzeaGRbLVaIOa6LY7PYHI4nWIgeIXJLXVJ0e6ZR5tF6dd5XMgSeF9RFDFFjQ5WExhXQbYKGRxWKwrdyoo4cbT+UUOQz+UyeU5U86JDk3HjpB5PdqvLoQXUSbS9BRKJFqPqjKyC4V6MUWCVSmVrfySBVKsxSyxmAKSaKU6k65J6u4ZdiPMBMADysAAap9lOxqrV6mhGs1IfGk6nyum0D0ETa+favJFPNNDBtHAcQ8cQ-j1qEOJ43d5JMFG8dDJrw5dI-SDUzUImU2nMuayzyK8iq2NDELtoFVWZ9JilmY2-X9BxnNvbLYjBMzEPtSO6bcGTGsgXp8XZ5GLVb+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AqSUuh971iPk7AkbEOCq28KBYmjttFa10UpEshjCajBxCZeqngaL2BCttGxBV-C1kpm6L2U8kZQMSjA86qUPGvmuF4-kh8pgGCahEJqsNTyVSmPMZu9VoqQK1BHSh-t3rTRuhI-uyD-p022PYkKys3YKIASfMCxhljRT0OYfex0b7xMqWInmtT9H0PqYw1EIVRYYL0MFJqRwtrSnHs3BwmIQiOFcZ3ISFS0kx3mMA221hHDnJqjiOm9dHasRqmVR0cx+w7OGa1URXcKkGOmVIhAkhR5Q1Yvwt0JTmL1ReXEt5OjYwAGUMDEDoLAeA3yjFjEsD0+Yug9AzFhp4ECBghQ4qMuclsl9dmwM4AAUQeuUQ5+VvA1S2JKbOzEWZ1xPm6Q8QiJSSwdkcDUMQohAA */\n id: \"GenuineCheckDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n return {\n input: {\n unlockTimeout: _.input.unlockTimeout,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n error: null,\n result: { isGenuine: false },\n getOsVersionResponse: null,\n deviceVersion: null,\n firmwareVersion: null,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"GoToDashboard\",\n },\n },\n GoToDashboard: {\n invoke: {\n id: \"goToDashboard\",\n src: \"goToDashboard\",\n input: (_) => ({\n unlockTimeout: _.context.input.unlockTimeout,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) => ({\n ..._.context.intermediateValue,\n requiredUserInteraction:\n _.event.snapshot.context.intermediateValue\n .requiredUserInteraction,\n }),\n }),\n },\n onDone: {\n target: \"GoToDashboardCheck\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<GenuineCheckStateMachineInternalState>(\n {\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n },\n );\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GoToDashboardCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"GetOsVersion\",\n },\n ],\n },\n GetOsVersion: {\n invoke: {\n id: \"getOsVersion\",\n src: \"getOsVersion\",\n input: (_) => undefined,\n onDone: {\n target: \"GetOsVersionCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n const currentState: DeviceSessionState =\n getDeviceSessionState();\n const isSecureConnectionAllowed =\n _.event.output.data.secureElementFlags\n .isSecureConnectionAllowed;\n if (\n currentState.sessionStateType !==\n DeviceSessionStateType.Connected\n ) {\n setDeviceSessionState({\n ...currentState,\n isSecureConnectionAllowed,\n });\n }\n return {\n ..._.context._internalState,\n getOsVersionResponse: _.event.output.data,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n },\n },\n GetOsVersionCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"GetDeviceVersion\",\n },\n ],\n },\n GetDeviceVersion: {\n invoke: {\n id: \"getDeviceVersion\",\n src: \"getDeviceVersion\",\n input: (_) => ({\n deviceInfo: _.context._internalState.getOsVersionResponse!,\n }),\n onDone: {\n target: \"GetDeviceVersionCheck\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<GenuineCheckStateMachineInternalState>(\n {\n Right: (deviceVersion) => ({\n ..._.context._internalState,\n deviceVersion,\n }),\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n },\n );\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GetDeviceVersionCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n { target: \"GetFirmwareVersion\" },\n ],\n },\n GetFirmwareVersion: {\n invoke: {\n id: \"getFirmwareVersion\",\n src: \"getFirmwareVersion\",\n input: (_) => ({\n deviceInfo: _.context._internalState.getOsVersionResponse!,\n deviceVersion: _.context._internalState.deviceVersion!,\n }),\n onDone: {\n target: \"GetFirmwareVersionCheck\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<GenuineCheckStateMachineInternalState>(\n {\n Right: (firmwareVersion) => ({\n ..._.context._internalState,\n firmwareVersion,\n }),\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n },\n );\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GetFirmwareVersionCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n { target: \"GenuineCheck\" },\n ],\n },\n GenuineCheck: {\n invoke: {\n id: \"genuineCheck\",\n src: \"genuineCheck\",\n input: (_) => ({\n deviceInfo: _.context._internalState.getOsVersionResponse!,\n finalFirmware: _.context._internalState.firmwareVersion!,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) => {\n switch (_.event.snapshot.context?.type) {\n case SecureChannelEventType.PermissionRequested: {\n return {\n requiredUserInteraction:\n UserInteractionRequired.AllowSecureConnection,\n };\n }\n case SecureChannelEventType.PermissionGranted: {\n return {\n requiredUserInteraction: UserInteractionRequired.None,\n };\n }\n default:\n return {\n ..._.context.intermediateValue,\n };\n }\n },\n _internalState: (_) => {\n if (\n _.event.snapshot.context?.type ===\n SecureChannelEventType.Result\n ) {\n return {\n ..._.context._internalState,\n result: {\n isGenuine: isDeviceGenuine(\n _.event.snapshot.context.payload,\n ),\n },\n };\n }\n return _.context._internalState;\n },\n }),\n },\n onDone: {\n target: \"GenuineCheckCheck\",\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GenuineCheckCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"Success\",\n },\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (_) => {\n if (_.context._internalState.error) {\n return Left(_.context._internalState.error);\n } else {\n return Right(_.context._internalState.result);\n }\n },\n });\n }\n\n private extractDependencies(internalApi: InternalApi): MachineDependencies {\n const provider = 1; // TODO: get the provider from user configuration\n\n const getOsVersion = () =>\n internalApi.sendCommand(new GetOsVersionCommand());\n\n const getDeviceVersion = ({\n input,\n }: Input<{ deviceInfo: GetOsVersionResponse }>) => {\n const { deviceInfo } = input;\n return internalApi\n .getManagerApiService()\n .getDeviceVersion(deviceInfo, provider);\n };\n\n const getFirmwareVersion = ({\n input,\n }: Input<{\n deviceInfo: GetOsVersionResponse;\n deviceVersion: DeviceVersion;\n }>) => {\n const { deviceInfo, deviceVersion } = input;\n return internalApi\n .getManagerApiService()\n .getFirmwareVersion(deviceInfo, deviceVersion, provider);\n };\n\n const genuineCheck = ({\n input,\n }: Input<{\n deviceInfo: GetOsVersionResponse;\n finalFirmware: FinalFirmware;\n }>) => {\n const { deviceInfo, finalFirmware } = input;\n const eitherConnection = internalApi\n .getSecureChannelService()\n .genuineCheck(deviceInfo, finalFirmware);\n return new ConnectToSecureChannelTask(internalApi, {\n connection: eitherConnection,\n }).run();\n };\n\n return {\n getOsVersion,\n getDeviceVersion,\n getFirmwareVersion,\n genuineCheck,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n };\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4B,qBAC5BC,EAA2D,kBAE3DC,EAAuC,4CACvCC,EAGO,+CAEPC,EAAwC,4DACxCC,EAA0C,uCAC1CC,EAA0C,yEAE1CC,EAGO,8DACPC,EAGO,kDAUPC,EAA2C,+DAC3CC,EAAuC,0CACvCC,EAAgC,qCAIzB,MAAMb,UAAiC,oBAM5C,CACmB,iBACjBc,EAOA,CASA,KAAM,CACJ,aAAAC,EACA,iBAAAC,EACA,mBAAAC,EACA,aAAAC,EACA,sBAAAC,EACA,sBAAAC,CACF,EAAI,KAAK,oBAAoBN,CAAW,EAElCO,EAAgB,KAAK,MAAM,eAAiB,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QACR,QAAS,sBACX,CACF,CACF,EACA,kBAAmB,CACjB,OAAQ,CACN,CACE,OAAQ,QACR,MAAO,UACT,EACA,CACE,OAAQ,SACV,CACF,CACF,EACA,QAAS,CACP,KAAM,OACR,EACA,MAAO,CACL,KAAM,OACR,CACF,EACA,OAASA,GACHA,EAAE,QAAQ,eAAe,SACpB,QAAKA,EAAE,QAAQ,eAAe,KAAK,KAEnC,SAAMA,EAAE,QAAQ,eAAe,MAAM,CAGlD,CAAC,CACH,CAEQ,oBAAoBT,EAA+C,CA0CzE,MAAO,CACL,aAxCmB,IACnBA,EAAY,YAAY,IAAI,qBAAqB,EAwCjD,iBAtCuB,CAAC,CACxB,MAAAe,CACF,IAAmD,CACjD,KAAM,CAAE,WAAAC,CAAW,EAAID,EACvB,OAAOf,EACJ,qBAAqB,EACrB,iBAAiBgB,EAAY,CAAQ,CAC1C,EAgCE,mBA9ByB,CAAC,CAC1B,MAAAD,CACF,IAGO,CACL,KAAM,CAAE,WAAAC,EAAY,cAAAH,CAAc,EAAIE,EACtC,OAAOf,EACJ,qBAAqB,EACrB,mBAAmBgB,EAAYH,EAAe,CAAQ,CAC3D,EAqBE,aAnBmB,CAAC,CACpB,MAAAE,CACF,IAGO,CACL,KAAM,CAAE,WAAAC,EAAY,cAAAC,CAAc,EAAIF,EAChCG,EAAmBlB,EACtB,wBAAwB,EACxB,aAAagB,EAAYC,CAAa,EACzC,OAAO,IAAI,6BAA2BjB,EAAa,CACjD,WAAYkB,CACd,CAAC,EAAE,IAAI,CACT,EAOE,sBAAuB,IAAMlB,EAAY,sBAAsB,EAC/D,sBAAwBmB,GACtBnB,EAAY,sBAAsBmB,CAAK,CAC3C,CACF,CACF",
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromObservable, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nimport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nimport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nimport {\n type GenuineCheckDAError,\n type GenuineCheckDAInput,\n type GenuineCheckDAIntermediateValue,\n type GenuineCheckDAOutput,\n type GenuineCheckStateMachineInternalState,\n type MachineDependencies,\n} from \"@api/secure-channel/device-action/GenuineCheck/types\";\nimport { ConnectToSecureChannelTask } from \"@api/secure-channel/task/ConnectToSecureChannelTask\";\nimport { SecureChannelEventType } from \"@api/secure-channel/task/types\";\nimport { type Input } from \"@api/secure-channel/types\";\nimport { isDeviceGenuine } from \"@api/secure-channel/utils\";\nimport { type DeviceVersion } from \"@internal/manager-api/model/Device\";\nimport { type FinalFirmware } from \"@internal/manager-api/model/Firmware\";\n\nexport class GenuineCheckDeviceAction extends XStateDeviceAction<\n GenuineCheckDAOutput,\n GenuineCheckDAInput,\n GenuineCheckDAError,\n GenuineCheckDAIntermediateValue,\n GenuineCheckStateMachineInternalState\n> {\n protected override makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n GenuineCheckDAOutput,\n GenuineCheckDAInput,\n GenuineCheckDAError,\n GenuineCheckDAIntermediateValue,\n GenuineCheckStateMachineInternalState\n > {\n type types = StateMachineTypes<\n GenuineCheckDAOutput,\n GenuineCheckDAInput,\n GenuineCheckDAError,\n GenuineCheckDAIntermediateValue,\n GenuineCheckStateMachineInternalState\n >;\n\n const {\n getOsVersion,\n getDeviceVersion,\n getFirmwareVersion,\n genuineCheck,\n getDeviceSessionState,\n setDeviceSessionState,\n } = this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n const goToDashboardMachine = new GoToDashboardDeviceAction({\n input: {\n unlockTimeout,\n },\n }).makeStateMachine(internalApi);\n\n return setup({\n types: {\n input: {} as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n goToDashboard: goToDashboardMachine,\n getOsVersion: fromPromise(getOsVersion),\n getDeviceVersion: fromPromise(getDeviceVersion),\n getFirmwareVersion: fromPromise(getFirmwareVersion),\n genuineCheck: fromObservable(genuineCheck),\n },\n guards: {\n hasError: (_) => _.context._internalState.error !== null,\n },\n actions: {\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"],\n }),\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QHEwDsCuBLNYDCAFmAMYDWAImAG5bFgCCxALlgPZoB0lNdASmAEMIATwDEAbQAMAXUSgADq1hYW7OSAAeiAIwB2AGwAWDvskBOAKwAmC9YvbJADkMAaEMMQBmT2ZPazuo6SFp6SDpKG+gC+UW6omDj4RGTctAzMbJzIrAAqrOQCsAQARqwCAE4QohDsYBw4VKykdVC5+YUlZZVSskggisqqaOpaCFaGntocEwaOFkYR2oa6bh4IZsEcuta6Nmbajp76tjFx6Ni4hCQU1GmMQxzZeQVFpRVVYOXlrOUc8gA2AiYADMfgBbDitZ4dN7dGTqAYqTIjRDjSbTTyzeaGRbLVaIOa6LY7PYHI4nWIgeIXJLXVJ0e6ZR5tF6dd5XMgSeF9RFDFFjQ5WExhXQbYKGRxWKwrdyoo4cbT+UUOQz+UyeU5U86JDk3HjpB5PdqvLoQXUSbS9BRKJFqPqjKyC4V6MUWCVSmVrfySBVKsxSyxmAKSaKU6k65J6u4ZdiPMBMADysAAap9lOxqrV6mhGs1IfGk6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jxBDSYJlFQBBKtsMCbsJjtzOlzI0rJYRmkjEg9eDomq+HJqYUUQYKoQw9BwSwoR9DSgONTO2FC0YdSnENBhb8vD+GAV2ckLME72H3GLaYtUdJBjFjXERK8u7iNcrqSRQtEAb0lAqSUuh971iPk7AkbEOCq28KBYmjttFa10UpEshjCajBxCZeqngaL2BCttGxBV-C1kpm6L2U8kZQMSjA86qUPGvmuF4-kh8pgGCahEJqsNTyVSmPMZu9VoqQK1BHSh-t3rTRuhI-uyD-p022PYkKys3YKIASfMCxhljRT0OYfex0b7xMqWInmtT9H0PqYw1EIVRYYL0MFJqRwtrSnHs3BwmIQiOFcZ3ISFS0kx3mMA221hHDnJqjiOm9dHasRqmVR0cx+w7OGa1URXcKkGOmVIhAkhR5Q1Yvwt0JTmL1ReXEt5OjYwAGUMDEDoLAeA3yjFjEsD0+Yug9AzFhp4ECBghQ4qMuclsl9dmwM4AAUQeuUQ5+VvA1S2JKbOzEWZ1xPm6Q8QiJSSwdkcDUMQohAA */\n id: \"GenuineCheckDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n return {\n input: {\n unlockTimeout: _.input.unlockTimeout,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n error: null,\n result: { isGenuine: false },\n getOsVersionResponse: null,\n deviceVersion: null,\n firmwareVersion: null,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"GoToDashboard\",\n },\n },\n GoToDashboard: {\n invoke: {\n id: \"goToDashboard\",\n src: \"goToDashboard\",\n input: (_) => ({\n unlockTimeout: _.context.input.unlockTimeout,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) => ({\n ..._.context.intermediateValue,\n requiredUserInteraction:\n _.event.snapshot.context.intermediateValue\n .requiredUserInteraction,\n }),\n }),\n },\n onDone: {\n target: \"GoToDashboardCheck\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<GenuineCheckStateMachineInternalState>(\n {\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n },\n );\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GoToDashboardCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"GetOsVersion\",\n },\n ],\n },\n GetOsVersion: {\n invoke: {\n id: \"getOsVersion\",\n src: \"getOsVersion\",\n input: (_) => undefined,\n onDone: {\n target: \"GetOsVersionCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n const currentState: DeviceSessionState =\n getDeviceSessionState();\n const isSecureConnectionAllowed =\n _.event.output.data.secureElementFlags\n .isSecureConnectionAllowed;\n if (\n currentState.sessionStateType !==\n DeviceSessionStateType.Connected\n ) {\n setDeviceSessionState({\n ...currentState,\n isSecureConnectionAllowed,\n });\n }\n return {\n ..._.context._internalState,\n getOsVersionResponse: _.event.output.data,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n },\n },\n GetOsVersionCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"GetDeviceVersion\",\n },\n ],\n },\n GetDeviceVersion: {\n invoke: {\n id: \"getDeviceVersion\",\n src: \"getDeviceVersion\",\n input: (_) => ({\n deviceInfo: _.context._internalState.getOsVersionResponse!,\n }),\n onDone: {\n target: \"GetDeviceVersionCheck\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<GenuineCheckStateMachineInternalState>(\n {\n Right: (deviceVersion) => ({\n ..._.context._internalState,\n deviceVersion,\n }),\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n },\n );\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GetDeviceVersionCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n { target: \"GetFirmwareVersion\" },\n ],\n },\n GetFirmwareVersion: {\n invoke: {\n id: \"getFirmwareVersion\",\n src: \"getFirmwareVersion\",\n input: (_) => ({\n deviceInfo: _.context._internalState.getOsVersionResponse!,\n deviceVersion: _.context._internalState.deviceVersion!,\n }),\n onDone: {\n target: \"GetFirmwareVersionCheck\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<GenuineCheckStateMachineInternalState>(\n {\n Right: (firmwareVersion) => ({\n ..._.context._internalState,\n firmwareVersion,\n }),\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n },\n );\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GetFirmwareVersionCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n { target: \"GenuineCheck\" },\n ],\n },\n GenuineCheck: {\n invoke: {\n id: \"genuineCheck\",\n src: \"genuineCheck\",\n input: (_) => ({\n deviceInfo: _.context._internalState.getOsVersionResponse!,\n finalFirmware: _.context._internalState.firmwareVersion!,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) => {\n switch (_.event.snapshot.context?.type) {\n case SecureChannelEventType.PermissionRequested: {\n return {\n requiredUserInteraction:\n UserInteractionRequired.AllowSecureConnection,\n };\n }\n case SecureChannelEventType.PermissionGranted: {\n return {\n requiredUserInteraction: UserInteractionRequired.None,\n };\n }\n default:\n return {\n ..._.context.intermediateValue,\n };\n }\n },\n _internalState: (_) => {\n if (\n _.event.snapshot.context?.type ===\n SecureChannelEventType.Result\n ) {\n return {\n ..._.context._internalState,\n result: {\n isGenuine: isDeviceGenuine(\n _.event.snapshot.context.payload,\n ),\n },\n };\n }\n return _.context._internalState;\n },\n }),\n },\n onDone: {\n target: \"GenuineCheckCheck\",\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GenuineCheckCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"Success\",\n },\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (_) => {\n if (_.context._internalState.error) {\n return Left(_.context._internalState.error);\n } else {\n return Right(_.context._internalState.result);\n }\n },\n });\n }\n\n private extractDependencies(internalApi: InternalApi): MachineDependencies {\n const provider = 1; // TODO: get the provider from user configuration\n\n const getOsVersion = () =>\n internalApi.sendCommand(new GetOsVersionCommand());\n\n const getDeviceVersion = ({\n input,\n }: Input<{ deviceInfo: GetOsVersionResponse }>) => {\n const { deviceInfo } = input;\n return internalApi\n .getManagerApiService()\n .getDeviceVersion(deviceInfo, provider);\n };\n\n const getFirmwareVersion = ({\n input,\n }: Input<{\n deviceInfo: GetOsVersionResponse;\n deviceVersion: DeviceVersion;\n }>) => {\n const { deviceInfo, deviceVersion } = input;\n return internalApi\n .getManagerApiService()\n .getFirmwareVersion(deviceInfo, deviceVersion, provider);\n };\n\n const genuineCheck = ({\n input,\n }: Input<{\n deviceInfo: GetOsVersionResponse;\n finalFirmware: FinalFirmware;\n }>) => {\n const { deviceInfo, finalFirmware } = input;\n const eitherConnection = internalApi\n .getSecureChannelService()\n .genuineCheck(deviceInfo, finalFirmware);\n return new ConnectToSecureChannelTask(internalApi, {\n connection: eitherConnection,\n }).run();\n };\n\n return {\n getOsVersion,\n getDeviceVersion,\n getFirmwareVersion,\n genuineCheck,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n };\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4B,qBAC5BC,EAA2D,kBAE3DC,EAAuC,4CACvCC,EAGO,+CAEPC,EAAwC,4DACxCC,EAA0C,uCAC1CC,EAA0C,yEAE1CC,EAGO,8DACPC,EAGO,kDASPC,EAA2C,+DAC3CC,EAAuC,0CAEvCC,EAAgC,qCAIzB,MAAMb,UAAiC,oBAM5C,CACmB,iBACjBc,EAOA,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ction_exports", "__export", "GenuineCheckDeviceAction", "__toCommonJS", "import_purify_ts", "import_xstate", "import_CommandResult", "import_GetOsVersionCommand", "import_UserInteractionRequired", "import_Const", "import_GoToDashboardDeviceAction", "import_XStateDeviceAction", "import_DeviceSessionState", "import_ConnectToSecureChannelTask", "import_types", "import_utils", "internalApi", "getOsVersion", "getDeviceVersion", "getFirmwareVersion", "genuineCheck", "getDeviceSessionState", "setDeviceSessionState", "unlockTimeout", "goToDashboardMachine", "_", "error", "currentState", "isSecureConnectionAllowed", "deviceVersion", "firmwareVersion", "input", "deviceInfo", "finalFirmware", "eitherConnection", "state"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var c=(r,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of p(e))!a.call(r,t)&&t!==o&&i(r,t,{get:()=>e[t],enumerable:!(n=s(e,t))||n.enumerable});return r};var u=r=>c(i({},"__esModule",{value:!0}),r);var m={};module.exports=u(m);
1
+ "use strict";var o=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var c=(r,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of p(e))!a.call(r,t)&&t!==i&&o(r,t,{get:()=>e[t],enumerable:!(n=s(e,t))||n.enumerable});return r};var u=r=>c(o({},"__esModule",{value:!0}),r);var m={};module.exports=u(m);
2
2
  //# sourceMappingURL=types.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/secure-channel/device-action/GenuineCheck/types.ts"],
4
- "sourcesContent": ["import { type EitherAsync } from \"purify-ts\";\nimport { type Observable } from \"rxjs\";\n\nimport {\n type GetOsVersionCommandResult,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nimport { type DeviceActionState } from \"@api/device-action/model/DeviceActionState\";\nimport { type UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { type UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { type SecureChannelEvent } from \"@api/secure-channel/task/types\";\nimport {\n type CommandErrorResult,\n type DeviceSessionState,\n type GoToDashboardDAError,\n type GoToDashboardDAInput,\n} from \"@api/types\";\nimport { type DeviceVersion } from \"@internal/manager-api/model/Device\";\nimport { type HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\nimport { type FinalFirmware } from \"@internal/manager-api/model/Firmware\";\n\nexport type Input<T> = { input: T };\n\nexport type GenuineCheckDAOutput = { isGenuine: boolean };\n\nexport type GenuineCheckDAInput = GoToDashboardDAInput;\n\nexport type GenuineCheckDAError =\n | CommandErrorResult[\"error\"]\n | GoToDashboardDAError\n | HttpFetchApiError\n | UnknownDAError;\n\nexport type GenuineCheckDARequiredInteraction =\n | UserInteractionRequired.None\n | UserInteractionRequired.UnlockDevice\n | UserInteractionRequired.AllowSecureConnection;\n\nexport type GenuineCheckDAIntermediateValue = {\n requiredUserInteraction: GenuineCheckDARequiredInteraction;\n};\n\nexport type GenuineCheckDAState = DeviceActionState<\n GenuineCheckDAOutput,\n GenuineCheckDAError,\n GenuineCheckDAIntermediateValue\n>;\n\nexport type GenuineCheckStateMachineInternalState = {\n result: { isGenuine: boolean };\n error: GenuineCheckDAError | null;\n getOsVersionResponse: GetOsVersionResponse | null;\n deviceVersion: DeviceVersion | null;\n firmwareVersion: FinalFirmware | null;\n};\n\nexport type MachineDependencies = {\n getOsVersion: () => Promise<GetOsVersionCommandResult>;\n getDeviceVersion: ({\n input,\n }: Input<{ deviceInfo: GetOsVersionResponse }>) => EitherAsync<\n HttpFetchApiError,\n DeviceVersion\n >;\n getFirmwareVersion: ({\n input,\n }: Input<{\n deviceInfo: GetOsVersionResponse;\n deviceVersion: DeviceVersion;\n }>) => EitherAsync<HttpFetchApiError, FinalFirmware>;\n genuineCheck: ({\n input,\n }: Input<{\n deviceInfo: GetOsVersionResponse;\n finalFirmware: FinalFirmware;\n }>) => Observable<SecureChannelEvent>;\n getDeviceSessionState: () => DeviceSessionState;\n setDeviceSessionState: (state: DeviceSessionState) => DeviceSessionState;\n};\n"],
4
+ "sourcesContent": ["import { type EitherAsync } from \"purify-ts\";\nimport { type Observable } from \"rxjs\";\n\nimport {\n type GetOsVersionCommandResult,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nimport { type DeviceActionState } from \"@api/device-action/model/DeviceActionState\";\nimport { type UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { type UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { type SecureChannelEvent } from \"@api/secure-channel/task/types\";\nimport { type Input } from \"@api/secure-channel/types\";\nimport {\n type CommandErrorResult,\n type DeviceSessionState,\n type GoToDashboardDAError,\n type GoToDashboardDAInput,\n} from \"@api/types\";\nimport { type DeviceVersion } from \"@internal/manager-api/model/Device\";\nimport { type HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\nimport { type FinalFirmware } from \"@internal/manager-api/model/Firmware\";\n\nexport type GenuineCheckDAOutput = { isGenuine: boolean };\n\nexport type GenuineCheckDAInput = GoToDashboardDAInput;\n\nexport type GenuineCheckDAError =\n | CommandErrorResult[\"error\"]\n | GoToDashboardDAError\n | HttpFetchApiError\n | UnknownDAError;\n\nexport type GenuineCheckDARequiredInteraction =\n | UserInteractionRequired.None\n | UserInteractionRequired.UnlockDevice\n | UserInteractionRequired.AllowSecureConnection;\n\nexport type GenuineCheckDAIntermediateValue = {\n requiredUserInteraction: GenuineCheckDARequiredInteraction;\n};\n\nexport type GenuineCheckDAState = DeviceActionState<\n GenuineCheckDAOutput,\n GenuineCheckDAError,\n GenuineCheckDAIntermediateValue\n>;\n\nexport type GenuineCheckStateMachineInternalState = {\n error: GenuineCheckDAError | null;\n result: { isGenuine: boolean };\n getOsVersionResponse: GetOsVersionResponse | null;\n deviceVersion: DeviceVersion | null;\n firmwareVersion: FinalFirmware | null;\n};\n\nexport type MachineDependencies = {\n getOsVersion: () => Promise<GetOsVersionCommandResult>;\n getDeviceVersion: (\n args: Input<{ deviceInfo: GetOsVersionResponse }>,\n ) => EitherAsync<HttpFetchApiError, DeviceVersion>;\n getFirmwareVersion: (\n args: Input<{\n deviceInfo: GetOsVersionResponse;\n deviceVersion: DeviceVersion;\n }>,\n ) => EitherAsync<HttpFetchApiError, FinalFirmware>;\n genuineCheck: (\n args: Input<{\n deviceInfo: GetOsVersionResponse;\n finalFirmware: FinalFirmware;\n }>,\n ) => Observable<SecureChannelEvent>;\n getDeviceSessionState: () => DeviceSessionState;\n setDeviceSessionState: (state: DeviceSessionState) => DeviceSessionState;\n};\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["types_exports", "__toCommonJS"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var S=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var F=(i,t)=>{for(var a in t)S(i,a,{get:t[a],enumerable:!0})},T=(i,t,a,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of w(t))!O.call(i,o)&&o!==a&&S(i,o,{get:()=>t[o],enumerable:!(p=L(t,o))||p.enumerable});return i};var G=i=>T(S({},"__esModule",{value:!0}),i);var C={};F(C,{ListInstalledAppsDeviceAction:()=>k});module.exports=G(C);var m=require("purify-ts"),n=require("xstate"),I=require("../../../command/model/CommandResult"),D=require("../../../command/os/GetOsVersionCommand"),u=require("../../../device-action/model/UserInteractionRequired"),A=require("../../../device-action/os/Const"),h=require("../../../device-action/os/GoToDashboard/GoToDashboardDeviceAction"),V=require("../../../device-action/xstate-utils/XStateDeviceAction"),f=require("../../../device-session/DeviceSessionState"),y=require("../../../secure-channel/task/ConnectToSecureChannelTask"),d=require("../../../secure-channel/task/types"),E=require("./types");class k extends V.XStateDeviceAction{makeStateMachine(t){const{getOsVersion:a,getDeviceVersion:p,getFirmwareVersion:o,listInstalledApps:v,getDeviceSessionState:g,setDeviceSessionState:s}=this.extractDependencies(t),c=this.input.unlockTimeout??A.DEFAULT_UNLOCK_TIMEOUT_MS,l=new h.GoToDashboardDeviceAction({input:{unlockTimeout:c}}).makeStateMachine(t);return(0,n.setup)({types:{input:{},context:{},output:{}},actors:{goToDashboard:l,getOsVersion:(0,n.fromPromise)(a),getDeviceVersion:(0,n.fromPromise)(p),getFirmwareVersion:(0,n.fromPromise)(o),listInstalledApps:(0,n.fromObservable)(v)},guards:{hasError:e=>e.context._internalState.error!==null},actions:{assignErrorFromEvent:(0,n.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"ListInstalledAppsDeviceAction",initial:"DeviceReady",context:e=>({input:{unlockTimeout:e.input.unlockTimeout},intermediateValue:{requiredUserInteraction:u.UserInteractionRequired.None},_internalState:{error:null,getOsVersionResponse:null,deviceVersion:null,firmwareVersion:null,result:{installedApps:[]}}}),states:{DeviceReady:{always:{target:"GoToDashboard"}},GoToDashboard:{invoke:{id:"goToDashboard",src:"goToDashboard",input:e=>({unlockTimeout:e.context.input.unlockTimeout}),onSnapshot:{actions:(0,n.assign)({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:e.event.snapshot.context.intermediateValue.requiredUserInteraction})})},onDone:{target:"GoToDashboardCheck",actions:(0,n.assign)({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:r=>({...e.context._internalState,error:r})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GoToDashboardCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetOsVersion"}]},GetOsVersion:{invoke:{id:"getOsVersion",src:"getOsVersion",input:e=>{},onDone:{target:"GetOsVersionCheck",actions:(0,n.assign)({_internalState:e=>{if((0,I.isSuccessCommandResult)(e.event.output)){const r=g(),x=e.event.output.data.secureElementFlags.isSecureConnectionAllowed;return r.sessionStateType!==f.DeviceSessionStateType.Connected&&s({...r,isSecureConnectionAllowed:x}),{...e.context._internalState,getOsVersionResponse:e.event.output.data}}return{...e.context._internalState,error:e.event.output.error}}})}}},GetOsVersionCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetDeviceVersion"}]},GetDeviceVersion:{invoke:{id:"getDeviceVersion",src:"getDeviceVersion",input:e=>({deviceInfo:e.context._internalState.getOsVersionResponse}),onDone:{target:"GetDeviceVersionCheck",actions:(0,n.assign)({_internalState:e=>e.event.output.caseOf({Right:r=>({...e.context._internalState,deviceVersion:r}),Left:r=>({...e.context._internalState,error:r})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetDeviceVersionCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetFirmwareVersion"}]},GetFirmwareVersion:{invoke:{id:"getFirmwareVersion",src:"getFirmwareVersion",input:e=>({deviceInfo:e.context._internalState.getOsVersionResponse,deviceVersion:e.context._internalState.deviceVersion}),onDone:{target:"GetFirmwareVersionCheck",actions:(0,n.assign)({_internalState:e=>e.event.output.caseOf({Right:r=>({...e.context._internalState,firmwareVersion:r}),Left:r=>({...e.context._internalState,error:r})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetFirmwareVersionCheck:{always:[{target:"Error",guard:"hasError"},{target:"ListInstalledApps"}]},ListInstalledApps:{invoke:{id:"listInstalledApps",src:"listInstalledApps",input:e=>({deviceInfo:e.context._internalState.getOsVersionResponse,finalFirmware:e.context._internalState.firmwareVersion}),onSnapshot:{actions:(0,n.assign)({intermediateValue:e=>{switch(e.event.snapshot.context?.type){case d.SecureChannelEventType.PermissionRequested:return{requiredUserInteraction:u.UserInteractionRequired.AllowSecureConnection};case d.SecureChannelEventType.PermissionGranted:return{requiredUserInteraction:u.UserInteractionRequired.None};default:return{...e.context.intermediateValue}}},_internalState:e=>{if(e.event.snapshot.context?.type===d.SecureChannelEventType.Result){if((0,E.installedAppResultGuard)(e.event.snapshot.context.payload))return{...e.context._internalState,result:{installedApps:e.event.snapshot.context.payload}};throw new Error(`Invalid result ${JSON.stringify(e.event.snapshot.context.payload)}`)}return{...e.context._internalState}}})},onDone:{target:"Success"},onError:{target:"Error",actions:"assignErrorFromEvent"}}},ListInstalledAppsCheck:{always:[{target:"Error",guard:"hasError"},{target:"Success"}]},Success:{type:"final"},Error:{type:"final"}},output:e=>e.context._internalState.error?(0,m.Left)(e.context._internalState.error):(0,m.Right)(e.context._internalState.result)})}extractDependencies(t){return{getOsVersion:()=>t.sendCommand(new D.GetOsVersionCommand),getDeviceVersion:({input:s})=>{const{deviceInfo:c}=s;return t.getManagerApiService().getDeviceVersion(c,1)},getFirmwareVersion:({input:s})=>{const{deviceInfo:c,deviceVersion:l}=s;return t.getManagerApiService().getFirmwareVersion(c,l,1)},listInstalledApps:({input:s})=>{const{deviceInfo:c,finalFirmware:l}=s,e=t.getSecureChannelService().listInstalledApps(c,l);return new y.ConnectToSecureChannelTask(t,{connection:e}).run()},getDeviceSessionState:()=>t.getDeviceSessionState(),setDeviceSessionState:s=>t.setDeviceSessionState(s)}}}0&&(module.exports={ListInstalledAppsDeviceAction});
2
+ //# sourceMappingURL=ListInstalledAppsDeviceAction.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.ts"],
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromObservable, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nimport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nimport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nimport { ConnectToSecureChannelTask } from \"@api/secure-channel/task/ConnectToSecureChannelTask\";\nimport { SecureChannelEventType } from \"@api/secure-channel/task/types\";\nimport { type DeviceVersion } from \"@internal/manager-api/model/Device\";\nimport { type FinalFirmware } from \"@internal/manager-api/model/Firmware\";\n\nimport {\n type Input,\n installedAppResultGuard,\n type ListInstalledAppsDAError,\n type ListInstalledAppsDAInput,\n type ListInstalledAppsDAIntermediateValue,\n type ListInstalledAppsDAOutput,\n type ListInstalledAppsStateMachineInternalState,\n type MachineDependencies,\n} from \"./types\";\n\nexport class ListInstalledAppsDeviceAction extends XStateDeviceAction<\n ListInstalledAppsDAOutput,\n ListInstalledAppsDAInput,\n ListInstalledAppsDAError,\n ListInstalledAppsDAIntermediateValue,\n ListInstalledAppsStateMachineInternalState\n> {\n protected override makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n ListInstalledAppsDAOutput,\n ListInstalledAppsDAInput,\n ListInstalledAppsDAError,\n ListInstalledAppsDAIntermediateValue,\n ListInstalledAppsStateMachineInternalState\n > {\n type types = StateMachineTypes<\n ListInstalledAppsDAOutput,\n ListInstalledAppsDAInput,\n ListInstalledAppsDAError,\n ListInstalledAppsDAIntermediateValue,\n ListInstalledAppsStateMachineInternalState\n >;\n\n const {\n getOsVersion,\n getDeviceVersion,\n getFirmwareVersion,\n listInstalledApps,\n getDeviceSessionState,\n setDeviceSessionState,\n } = this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n const goToDashboardMachine = new GoToDashboardDeviceAction({\n input: {\n unlockTimeout,\n },\n }).makeStateMachine(internalApi);\n\n return setup({\n types: {\n input: {} as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n goToDashboard: goToDashboardMachine,\n getOsVersion: fromPromise(getOsVersion),\n getDeviceVersion: fromPromise(getDeviceVersion),\n getFirmwareVersion: fromPromise(getFirmwareVersion),\n listInstalledApps: fromObservable(listInstalledApps),\n },\n guards: {\n hasError: (_) => _.context._internalState.error !== null,\n },\n actions: {\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"],\n }),\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QEkB2sAuBDANjgggA6EAiYAbgJYDGY+1GlA9qgHRlW0BKYWEAngGIA2gAYAuolCEmsSoxZSQAD0QBGAJyjWADgDsAFg0A2HSb2iArMbUBmADQh+iAExrjrS6KuWNtte7Glga2AL6hjmiYuATEHDR0DMxsAOJMACpMJFiwABYARkxYAE4QghAsYKyUqORMANZVUBlZOQVFpWKSSCAycgqoSqoIxi6WrKJq1rYGNgaiBrOOzgi2th5qonouorYuo9YBBuGR6Nh4RKQUCfQDrGmZ2XmFJWVgxcVMxayEOFgYADMvgBbVjNR5tF6dCRKPryZJDRAHCZTYwzOYLJZOdR6DSeFy2MwBPaaXzGE4gKLnWJXTiJO4PVrPDoQADCuTA1HqIhhPThA0RCE2XlY+0semMomMBgsOjMyyRoh0E28BmClhc+0mxwilLOMUu8Vot2S9xaT3ar3ZnO5wjU3Wksnhih6w2F2jFEqlMqV8uxq0stlYgTlGg02wJOjCuqpBri12NSRY9zAGAA8rAAGrvOQscqVaq1BpNVMZ7PFXOoLqwp0C13qDVqVhaIK+HSifazNQK1YuPHGLTWQxabaLSwU2MXeN0k3JlKlrM55LWrk8h29WsI+tCjRqAysebSvY6TWagw6HvnvFeDsaGX6UR+Wx6Cf6qe0m5J1IL8uVle2+0a36LdQDdXd90PEIXBPU9zx7dFWD0LwxgMHYFkmckYzfGkjXpU15wwS4ABlKEwfNUCqGo6kaFNCOIEjMGrPlNxdUDXFscVRR0VFxXDJCL39PYgxcPRbD8NQ9DUOV9BfLDonfXDZ2-OjCAYjB-zXIDnUGbcRIkxDNEfEIwwCFx4MDYNjFMMxw01Qlo1OeScITPC51TYjSPUjlVztdd+RAlRXEkvQDK0O8xN3NQzP9HR9xvKxCT0E9Jj0WTdVQJgIDgJRJ2cmcvy0us2IQABaYwezK18nMNFylPYFyeD4FZHWA1jAoQVCezccYb02JDDPcQkqupGr8oZc1IRZQqAuGaDxhMfQxjsKMlQcf1NBcFVdlmPs9wJNVhrjD9E3GiFmStbz6mmtrhijTaFu4tZRJMSZzJCqNnyS9x5m2DRDoU2qv1osslza-ybvUNwg02DRLFi+YZnbSx4JE5sJO8Xc3CsWZMMckbp0-Bkf1B1B-2unTiokuxWGlJULHWWwOzGcymwMKnULEuzRn+vLCfw9z6M88nBR2VLRWQ6xxR0GxRhRpsb2fNYjDcXFZLxo7FKBgiPMwMnmNain2rGDiD01PdUs0NVu0EtUtq8KydginV1YBsbTQAZQAV2oWhYHgfXtJFsxtGsXbuMsCPdh7bjPG8AkNFi70-B50a+eTABRD4vmF3Tg88UZd3DyO1pWDj9wlCwLFMDQ+1xcdwlCIA */\n id: \"ListInstalledAppsDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n return {\n input: {\n unlockTimeout: _.input.unlockTimeout,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n error: null,\n getOsVersionResponse: null,\n deviceVersion: null,\n firmwareVersion: null,\n result: { installedApps: [] },\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"GoToDashboard\",\n },\n },\n GoToDashboard: {\n invoke: {\n id: \"goToDashboard\",\n src: \"goToDashboard\",\n input: (_) => ({\n unlockTimeout: _.context.input.unlockTimeout,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) => ({\n ..._.context.intermediateValue,\n requiredUserInteraction:\n _.event.snapshot.context.intermediateValue\n .requiredUserInteraction,\n }),\n }),\n },\n onDone: {\n target: \"GoToDashboardCheck\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<ListInstalledAppsStateMachineInternalState>(\n {\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n },\n );\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GoToDashboardCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"GetOsVersion\",\n },\n ],\n },\n GetOsVersion: {\n invoke: {\n id: \"getOsVersion\",\n src: \"getOsVersion\",\n input: (_) => undefined,\n onDone: {\n target: \"GetOsVersionCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n const currentState: DeviceSessionState =\n getDeviceSessionState();\n const isSecureConnectionAllowed =\n _.event.output.data.secureElementFlags\n .isSecureConnectionAllowed;\n if (\n currentState.sessionStateType !==\n DeviceSessionStateType.Connected\n ) {\n setDeviceSessionState({\n ...currentState,\n isSecureConnectionAllowed,\n });\n }\n return {\n ..._.context._internalState,\n getOsVersionResponse: _.event.output.data,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n },\n },\n GetOsVersionCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"GetDeviceVersion\",\n },\n ],\n },\n GetDeviceVersion: {\n invoke: {\n id: \"getDeviceVersion\",\n src: \"getDeviceVersion\",\n input: (_) => ({\n deviceInfo: _.context._internalState.getOsVersionResponse!,\n }),\n onDone: {\n target: \"GetDeviceVersionCheck\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<ListInstalledAppsStateMachineInternalState>(\n {\n Right: (deviceVersion) => ({\n ..._.context._internalState,\n deviceVersion,\n }),\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n },\n );\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GetDeviceVersionCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n { target: \"GetFirmwareVersion\" },\n ],\n },\n GetFirmwareVersion: {\n invoke: {\n id: \"getFirmwareVersion\",\n src: \"getFirmwareVersion\",\n input: (_) => ({\n deviceInfo: _.context._internalState.getOsVersionResponse!,\n deviceVersion: _.context._internalState.deviceVersion!,\n }),\n onDone: {\n target: \"GetFirmwareVersionCheck\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<ListInstalledAppsStateMachineInternalState>(\n {\n Right: (firmwareVersion) => ({\n ..._.context._internalState,\n firmwareVersion,\n }),\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n },\n );\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GetFirmwareVersionCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n { target: \"ListInstalledApps\" },\n ],\n },\n ListInstalledApps: {\n invoke: {\n id: \"listInstalledApps\",\n src: \"listInstalledApps\",\n input: (_) => ({\n deviceInfo: _.context._internalState.getOsVersionResponse!,\n finalFirmware: _.context._internalState.firmwareVersion!,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) => {\n switch (_.event.snapshot.context?.type) {\n case SecureChannelEventType.PermissionRequested: {\n return {\n requiredUserInteraction:\n UserInteractionRequired.AllowSecureConnection,\n };\n }\n case SecureChannelEventType.PermissionGranted: {\n return {\n requiredUserInteraction: UserInteractionRequired.None,\n };\n }\n default:\n return {\n ..._.context.intermediateValue,\n };\n }\n },\n _internalState: (_) => {\n if (\n _.event.snapshot.context?.type ===\n SecureChannelEventType.Result\n ) {\n if (\n installedAppResultGuard(_.event.snapshot.context.payload)\n ) {\n return {\n ..._.context._internalState,\n result: {\n installedApps: _.event.snapshot.context.payload,\n },\n };\n }\n throw new Error(\n `Invalid result ${JSON.stringify(_.event.snapshot.context.payload)}`,\n );\n }\n return { ..._.context._internalState };\n },\n }),\n },\n onDone: {\n target: \"Success\",\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n ListInstalledAppsCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"Success\",\n },\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (_) => {\n if (_.context._internalState.error) {\n return Left(_.context._internalState.error);\n } else {\n return Right(_.context._internalState.result);\n }\n },\n });\n }\n\n private extractDependencies(internalApi: InternalApi): MachineDependencies {\n const provider = 1; // TODO: get the provider from user configuration\n\n const getOsVersion = () =>\n internalApi.sendCommand(new GetOsVersionCommand());\n\n const getDeviceVersion = ({\n input,\n }: Input<{ deviceInfo: GetOsVersionResponse }>) => {\n const { deviceInfo } = input;\n return internalApi\n .getManagerApiService()\n .getDeviceVersion(deviceInfo, provider);\n };\n\n const getFirmwareVersion = ({\n input,\n }: Input<{\n deviceInfo: GetOsVersionResponse;\n deviceVersion: DeviceVersion;\n }>) => {\n const { deviceInfo, deviceVersion } = input;\n return internalApi\n .getManagerApiService()\n .getFirmwareVersion(deviceInfo, deviceVersion, provider);\n };\n\n const listInstalledApps = ({\n input,\n }: Input<{\n deviceInfo: GetOsVersionResponse;\n finalFirmware: FinalFirmware;\n }>) => {\n const { deviceInfo, finalFirmware } = input;\n const eitherConnection = internalApi\n .getSecureChannelService()\n .listInstalledApps(deviceInfo, finalFirmware);\n return new ConnectToSecureChannelTask(internalApi, {\n connection: eitherConnection,\n }).run();\n };\n\n return {\n getOsVersion,\n getDeviceVersion,\n getFirmwareVersion,\n listInstalledApps,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state) =>\n internalApi.setDeviceSessionState(state),\n };\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4B,qBAC5BC,EAA2D,kBAE3DC,EAA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AYH,EAAe,CAAQ,CAC3D,EAqBE,kBAnBwB,CAAC,CACzB,MAAAE,CACF,IAGO,CACL,KAAM,CAAE,WAAAC,EAAY,cAAAC,CAAc,EAAIF,EAChCG,EAAmBlB,EACtB,wBAAwB,EACxB,kBAAkBgB,EAAYC,CAAa,EAC9C,OAAO,IAAI,6BAA2BjB,EAAa,CACjD,WAAYkB,CACd,CAAC,EAAE,IAAI,CACT,EAOE,sBAAuB,IAAMlB,EAAY,sBAAsB,EAC/D,sBAAwBmB,GACtBnB,EAAY,sBAAsBmB,CAAK,CAC3C,CACF,CACF",
6
+ "names": ["ListInstalledAppsDeviceAction_exports", "__export", "ListInstalledAppsDeviceAction", "__toCommonJS", "import_purify_ts", "import_xstate", "import_CommandResult", "import_GetOsVersionCommand", "import_UserInteractionRequired", "import_Const", "import_GoToDashboardDeviceAction", "import_XStateDeviceAction", "import_DeviceSessionState", "import_ConnectToSecureChannelTask", "import_types", "internalApi", "getOsVersion", "getDeviceVersion", "getFirmwareVersion", "listInstalledApps", "getDeviceSessionState", "setDeviceSessionState", "unlockTimeout", "goToDashboardMachine", "_", "error", "currentState", "isSecureConnectionAllowed", "deviceVersion", "firmwareVersion", "input", "deviceInfo", "finalFirmware", "eitherConnection", "state"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";describe.todo("ListInstalledAppsDeviceAction");
2
+ //# sourceMappingURL=ListInstalledAppsDeviceAction.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.ts"],
4
+ "sourcesContent": ["describe.todo(\"ListInstalledAppsDeviceAction\");\n"],
5
+ "mappings": "aAAA,SAAS,KAAK,+BAA+B",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var n=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var s in e)n(t,s,{get:e[s],enumerable:!0})},A=(t,e,s,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of i(e))!a.call(t,r)&&r!==s&&n(t,r,{get:()=>e[r],enumerable:!(o=p(e,r))||o.enumerable});return t};var d=t=>A(n({},"__esModule",{value:!0}),t);var u={};l(u,{installedAppResultGuard:()=>c});module.exports=d(u);function c(t){return Array.isArray(t)&&t.every(e=>typeof e=="object"&&e!==null&&"flags"in e&&"hash"in e&&"hash_code_data"in e&&"name"in e&&typeof e.flags=="number"&&typeof e.hash=="string"&&typeof e.hash_code_data=="string"&&typeof e.name=="string")}0&&(module.exports={installedAppResultGuard});
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/secure-channel/device-action/ListInstalledApps/types.ts"],
4
+ "sourcesContent": ["import { type EitherAsync } from \"purify-ts\";\nimport { type Observable } from \"rxjs\";\n\nimport { type CommandErrorResult } from \"@api/command/model/CommandResult\";\nimport {\n type GetOsVersionCommandResult,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nimport { type DeviceActionState } from \"@api/device-action/model/DeviceActionState\";\nimport { type UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { type UnknownDAError } from \"@api/device-action/os/Errors\";\nimport {\n type GoToDashboardDAError,\n type GoToDashboardDAInput,\n} from \"@api/device-action/os/GoToDashboard/types\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type SecureChannelEvent } from \"@api/secure-channel/task/types\";\nimport { type DeviceVersion } from \"@internal/manager-api/model/Device\";\nimport { type HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\nimport { type FinalFirmware } from \"@internal/manager-api/model/Firmware\";\n\nexport type Input<T> = { input: T };\n\nexport type ListInstalledAppsDAOutput = {\n installedApps: Array<InstalledApp>;\n};\n\nexport type ListInstalledAppsDAInput = GoToDashboardDAInput;\n\nexport type ListInstalledAppsDAError =\n | CommandErrorResult[\"error\"]\n | GoToDashboardDAError\n | HttpFetchApiError\n | UnknownDAError;\n\nexport type ListInstalledAppsDARequiredInteraction =\n | UserInteractionRequired.None\n | UserInteractionRequired.UnlockDevice\n | UserInteractionRequired.AllowSecureConnection;\n\nexport type ListInstalledAppsDAIntermediateValue = {\n requiredUserInteraction: ListInstalledAppsDARequiredInteraction;\n};\n\nexport type ListInstalledAppsDAState = DeviceActionState<\n ListInstalledAppsDAOutput,\n ListInstalledAppsDAError,\n ListInstalledAppsDAIntermediateValue\n>;\n\nexport type ListInstalledAppsStateMachineInternalState = {\n error: ListInstalledAppsDAError | null;\n result: { installedApps: Array<InstalledApp> };\n getOsVersionResponse: GetOsVersionResponse | null;\n deviceVersion: DeviceVersion | null;\n firmwareVersion: FinalFirmware | null;\n};\n\nexport type MachineDependencies = {\n getOsVersion: () => Promise<GetOsVersionCommandResult>;\n getDeviceVersion: (\n args: Input<{ deviceInfo: GetOsVersionResponse }>,\n ) => EitherAsync<HttpFetchApiError, DeviceVersion>;\n getFirmwareVersion: (\n args: Input<{\n deviceInfo: GetOsVersionResponse;\n deviceVersion: DeviceVersion;\n }>,\n ) => EitherAsync<HttpFetchApiError, FinalFirmware>;\n listInstalledApps: (\n args: Input<{\n deviceInfo: GetOsVersionResponse;\n finalFirmware: FinalFirmware;\n }>,\n ) => Observable<SecureChannelEvent>;\n getDeviceSessionState: () => DeviceSessionState;\n setDeviceSessionState: (state: DeviceSessionState) => DeviceSessionState;\n};\n\nexport type InstalledApp = {\n flags: number;\n hash: string;\n hash_code_data: string;\n name: string;\n};\n\nexport function installedAppResultGuard(\n value: unknown,\n): value is ListInstalledAppsDAOutput[\"installedApps\"] {\n return (\n Array.isArray(value) &&\n value.every(\n (item) =>\n typeof item === \"object\" &&\n item !== null &&\n \"flags\" in item &&\n \"hash\" in item &&\n \"hash_code_data\" in item &&\n \"name\" in item &&\n typeof item.flags === \"number\" &&\n typeof item.hash === \"string\" &&\n typeof item.hash_code_data === \"string\" &&\n typeof item.name === \"string\",\n )\n );\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAsFO,SAASE,EACdE,EACqD,CACrD,OACE,MAAM,QAAQA,CAAK,GACnBA,EAAM,MACHC,GACC,OAAOA,GAAS,UAChBA,IAAS,MACT,UAAWA,GACX,SAAUA,GACV,mBAAoBA,GACpB,SAAUA,GACV,OAAOA,EAAK,OAAU,UACtB,OAAOA,EAAK,MAAS,UACrB,OAAOA,EAAK,gBAAmB,UAC/B,OAAOA,EAAK,MAAS,QACzB,CAEJ",
6
+ "names": ["types_exports", "__export", "installedAppResultGuard", "__toCommonJS", "value", "item"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var x=Object.create;var g=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var I=(r,t)=>{for(var c in t)g(r,c,{get:t[c],enumerable:!0})},_=(r,t,c,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of M(t))!O.call(r,l)&&l!==c&&g(r,l,{get:()=>t[l],enumerable:!(e=R(t,l))||e.enumerable});return r};var U=(r,t,c)=>(c=r!=null?x(T(r)):{},_(t||!r||!r.__esModule?g(c,"default",{value:r,enumerable:!0}):c,r)),N=r=>_(g({},"__esModule",{value:!0}),r);var P={};I(P,{ConnectToSecureChannelTask:()=>W});module.exports=N(P);var w=U(require("isomorphic-ws")),A=require("rxjs"),E=require("../../command/utils/CommandUtils"),n=require("../../secure-channel/task/types"),S=require("../../secure-channel/utils"),h=require("../../utils/HexaString"),i=require("../../../internal/secure-channel/model/Errors");class W{constructor(t,c){this._api=t;this._args=c;if(this._args.connection.isRight())this._connection=this._args.connection.extract();else throw new i.SecureChannelError(`Invalid WebSocket connection: ${String(this._args.connection.extract())}`)}_connection;run(){const t=this._api.disableRefresher("connectToSecureChannel");return new A.Observable(e=>{let l=!1,u=!1,m=!1,y=null,f=!1;return this._connection.onopen=()=>{e.next({type:n.SecureChannelEventType.Opened})},this._connection.onerror=C=>{u||e.error(new i.SecureChannelError({url:this._connection.url,errorMessage:C.message}))},this._connection.onclose=()=>{u||(m?(e.next({type:n.SecureChannelEventType.Closed}),e.complete()):e.error(new i.SecureChannelError(y??{url:this._connection.url,errorMessage:"Connection closed unexpectedly"})))},this._connection.onmessage=async C=>{if(!l){y=null;try{const a=JSON.parse(String(C.data));switch(a.query){case n.InMessageQueryEnum.EXCHANGE:{const{nonce:d}=a;if(Array.isArray(a.data)){e.error(new i.SecureChannelError(`${n.InMessageQueryEnum.EXCHANGE} data type should not be Array`));break}const o=(0,h.hexaStringToBuffer)(a.data);if(o===null||o.length<5){e.error(new i.SecureChannelError(`Received invalid APDU data: ${a.data}`));break}e.next({type:n.SecureChannelEventType.PreExchange,payload:{nonce:d,apdu:o}}),(0,S.willRequestPermission)(o)&&!this.isSecureConnectionAllowed()&&(f=!0,e.next({type:n.SecureChannelEventType.PermissionRequested}));const p=await this._api.sendApdu(o);if(l)return;p.caseOf({Left:s=>{e.error(new i.SecureChannelError(s))},Right:s=>{let k;if(E.CommandUtils.isSuccessResponse(s))k=n.OutMessageResponseEnum.SUCCESS,e.next({type:n.SecureChannelEventType.Exchange,payload:{nonce:d,apdu:o,data:s.data,status:s.statusCode}});else{if(k=n.OutMessageResponseEnum.ERROR,y=new i.SecureChannelError({url:this._connection.url,errorMessage:`Invalid status code: ${(0,h.bufferToHexaString)(s.statusCode)}`}),E.CommandUtils.isLockedDeviceResponse(s)){e.error(new i.SecureChannelError({url:this._connection.url,errorMessage:"Device is locked"}));return}if((0,S.isRefusedByUser)(s.statusCode)&&f){e.error(new i.SecureChannelError({url:this._connection.url,errorMessage:"User refused on the device"}));return}}f&&(e.next({type:n.SecureChannelEventType.PermissionGranted}),f=!1);const v={nonce:d,response:k,data:(0,h.bufferToHexaString)(s.data).slice(2)};this._connection.send(JSON.stringify(v))}});break}case n.InMessageQueryEnum.BULK:{if(u=!0,this._connection.close(),!Array.isArray(a.data)||a.data.length===0){e.error(new i.SecureChannelError("Invalid bulk data received"));break}const d=a.data.reduce((o,p)=>{const s=(0,h.hexaStringToBuffer)(p);return s===null?o:[...o,s]},[]);for(let o=0,p=d.length;o<p;o++){if(await this._api.sendApdu(d[o]),l){e.error(new i.SecureChannelError("Bulk sending cancelled by unsubscribing"));break}e.next({type:n.SecureChannelEventType.Progress,payload:{progress:+Number((o+1)/p).toFixed(2),index:o,total:p}})}m=!0,e.complete();break}case n.InMessageQueryEnum.SUCCESS:{if(u)break;const d=a.result??a.data;d&&e.next({type:n.SecureChannelEventType.Result,payload:String(d??"")}),m=!0,e.complete();break}case n.InMessageQueryEnum.WARNING:{if(u)break;e.next({type:n.SecureChannelEventType.Warning,payload:{message:String(a.data)}});break}case n.InMessageQueryEnum.ERROR:{if(u)break;e.error(new i.SecureChannelError({url:this._connection.url,errorMessage:String(a.data)}))}}}catch(a){y=new i.SecureChannelError(a),e.error(y)}}},()=>{t(),l=!0,this._connection.readyState===w.default.OPEN&&this._connection.close()}})}isSecureConnectionAllowed(){const t=this._api.getDeviceSessionState();return"isSecureConnectionAllowed"in t&&t.isSecureConnectionAllowed}}0&&(module.exports={ConnectToSecureChannelTask});
1
+ "use strict";var x=Object.create;var g=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var I=(o,t)=>{for(var c in t)g(o,c,{get:t[c],enumerable:!0})},_=(o,t,c,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of M(t))!O.call(o,l)&&l!==c&&g(o,l,{get:()=>t[l],enumerable:!(e=R(t,l))||e.enumerable});return o};var U=(o,t,c)=>(c=o!=null?x(T(o)):{},_(t||!o||!o.__esModule?g(c,"default",{value:o,enumerable:!0}):c,o)),N=o=>_(g({},"__esModule",{value:!0}),o);var P={};I(P,{ConnectToSecureChannelTask:()=>W});module.exports=N(P);var w=U(require("isomorphic-ws")),A=require("rxjs"),E=require("../../command/utils/CommandUtils"),n=require("../../secure-channel/task/types"),S=require("../../secure-channel/utils"),h=require("../../utils/HexaString"),i=require("../../../internal/secure-channel/model/Errors");class W{constructor(t,c){this._api=t;this._args=c;if(this._args.connection.isRight())this._connection=this._args.connection.extract();else throw new i.SecureChannelError(`Invalid WebSocket connection: ${String(this._args.connection.extract())}`)}_connection;run(){const t=this._api.disableRefresher("connectToSecureChannel");return new A.Observable(e=>{let l=!1,u=!1,m=!1,y=null,f=!1;return this._connection.onopen=()=>{e.next({type:n.SecureChannelEventType.Opened})},this._connection.onerror=C=>{u||e.error(new i.SecureChannelError({url:this._connection.url,errorMessage:C.message}))},this._connection.onclose=()=>{u||(m?(e.next({type:n.SecureChannelEventType.Closed}),e.complete()):e.error(new i.SecureChannelError(y??{url:this._connection.url,errorMessage:"Connection closed unexpectedly"})))},this._connection.onmessage=async C=>{if(!l){y=null;try{const a=JSON.parse(String(C.data));switch(a.query){case n.InMessageQueryEnum.EXCHANGE:{const{nonce:d}=a;if(Array.isArray(a.data)){e.error(new i.SecureChannelError(`${n.InMessageQueryEnum.EXCHANGE} data type should not be Array`));break}const r=(0,h.hexaStringToBuffer)(a.data);if(r===null||r.length<5){e.error(new i.SecureChannelError(`Received invalid APDU data: ${a.data}`));break}e.next({type:n.SecureChannelEventType.PreExchange,payload:{nonce:d,apdu:r}}),(0,S.willRequestPermission)(r)&&!this.isSecureConnectionAllowed()&&(f=!0,e.next({type:n.SecureChannelEventType.PermissionRequested}));const p=await this._api.sendApdu(r);if(l)return;p.caseOf({Left:s=>{e.error(new i.SecureChannelError(s))},Right:s=>{let k;if(E.CommandUtils.isSuccessResponse(s))k=n.OutMessageResponseEnum.SUCCESS,e.next({type:n.SecureChannelEventType.Exchange,payload:{nonce:d,apdu:r,data:s.data,status:s.statusCode}});else{if(k=n.OutMessageResponseEnum.ERROR,y=new i.SecureChannelError({url:this._connection.url,errorMessage:`Invalid status code: ${(0,h.bufferToHexaString)(s.statusCode)}`}),E.CommandUtils.isLockedDeviceResponse(s)){e.error(new i.SecureChannelError({url:this._connection.url,errorMessage:"Device is locked"}));return}if((0,S.isRefusedByUser)(s.statusCode)&&f){e.error(new i.SecureChannelError({url:this._connection.url,errorMessage:"User refused on the device"}));return}}f&&(e.next({type:n.SecureChannelEventType.PermissionGranted}),f=!1);const v={nonce:d,response:k,data:(0,h.bufferToHexaString)(s.data).slice(2)};this._connection.send(JSON.stringify(v))}});break}case n.InMessageQueryEnum.BULK:{if(u=!0,this._connection.close(),!Array.isArray(a.data)||a.data.length===0){e.error(new i.SecureChannelError("Invalid bulk data received"));break}const d=a.data.reduce((r,p)=>{const s=(0,h.hexaStringToBuffer)(p);return s===null?r:[...r,s]},[]);for(let r=0,p=d.length;r<p;r++){if(await this._api.sendApdu(d[r]),l){e.error(new i.SecureChannelError("Bulk sending cancelled by unsubscribing"));break}e.next({type:n.SecureChannelEventType.Progress,payload:{progress:+Number((r+1)/p).toFixed(2),index:r,total:p}})}m=!0,e.complete();break}case n.InMessageQueryEnum.SUCCESS:{if(u)break;const d=a.result??a.data;d&&e.next({type:n.SecureChannelEventType.Result,payload:d??""}),m=!0,e.complete();break}case n.InMessageQueryEnum.WARNING:{if(u)break;e.next({type:n.SecureChannelEventType.Warning,payload:{message:String(a.data)}});break}case n.InMessageQueryEnum.ERROR:{if(u)break;e.error(new i.SecureChannelError({url:this._connection.url,errorMessage:String(a.data)}))}}}catch(a){y=new i.SecureChannelError(a),e.error(y)}}},()=>{t(),l=!0,this._connection.readyState===w.default.OPEN&&this._connection.close()}})}isSecureConnectionAllowed(){const t=this._api.getDeviceSessionState();return"isSecureConnectionAllowed"in t&&t.isSecureConnectionAllowed}}0&&(module.exports={ConnectToSecureChannelTask});
2
2
  //# sourceMappingURL=ConnectToSecureChannelTask.js.map