@ledgerhq/device-management-kit 1.5.1 → 1.6.0

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 (59) hide show
  1. package/lib/cjs/package.json +1 -1
  2. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  3. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  4. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  5. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +3 -3
  6. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  7. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
  8. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
  9. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
  10. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  11. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
  12. package/lib/cjs/src/api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction.js +2 -0
  13. package/lib/cjs/src/api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction.js.map +7 -0
  14. package/lib/cjs/src/api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction.test.js +2 -0
  15. package/lib/cjs/src/api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction.test.js.map +7 -0
  16. package/lib/cjs/src/api/device-action/os/WaitForAppAndVersion/types.js +2 -0
  17. package/lib/cjs/src/api/device-action/os/WaitForAppAndVersion/types.js.map +7 -0
  18. package/lib/cjs/src/api/index.js +1 -1
  19. package/lib/cjs/src/api/index.js.map +3 -3
  20. package/lib/cjs/src/api/utils/AppName.js +1 -1
  21. package/lib/cjs/src/api/utils/AppName.js.map +3 -3
  22. package/lib/esm/package.json +1 -1
  23. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  24. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  25. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  26. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +3 -3
  27. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  28. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
  29. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
  30. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
  31. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  32. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
  33. package/lib/esm/src/api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction.js +2 -0
  34. package/lib/esm/src/api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction.js.map +7 -0
  35. package/lib/esm/src/api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction.test.js +2 -0
  36. package/lib/esm/src/api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction.test.js.map +7 -0
  37. package/lib/esm/src/api/device-action/os/WaitForAppAndVersion/types.js +2 -0
  38. package/lib/esm/src/api/device-action/os/WaitForAppAndVersion/types.js.map +7 -0
  39. package/lib/esm/src/api/index.js +1 -1
  40. package/lib/esm/src/api/index.js.map +3 -3
  41. package/lib/esm/src/api/utils/AppName.js +1 -1
  42. package/lib/esm/src/api/utils/AppName.js.map +3 -3
  43. package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
  44. package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts +3 -1
  45. package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts.map +1 -1
  46. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.d.ts +0 -1
  47. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.d.ts.map +1 -1
  48. package/lib/types/src/api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction.d.ts +25 -0
  49. package/lib/types/src/api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction.d.ts.map +1 -0
  50. package/lib/types/src/api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction.test.d.ts +2 -0
  51. package/lib/types/src/api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction.test.d.ts.map +1 -0
  52. package/lib/types/src/api/device-action/os/WaitForAppAndVersion/types.d.ts +22 -0
  53. package/lib/types/src/api/device-action/os/WaitForAppAndVersion/types.d.ts.map +1 -0
  54. package/lib/types/src/api/index.d.ts +2 -0
  55. package/lib/types/src/api/index.d.ts.map +1 -1
  56. package/lib/types/src/api/utils/AppName.d.ts +2 -1
  57. package/lib/types/src/api/utils/AppName.d.ts.map +1 -1
  58. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  59. package/package.json +3 -3
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction.test.ts"],
4
+ "sourcesContent": ["import { of, throwError } from \"rxjs\";\n\nimport { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport {\n GLOBAL_ERRORS,\n GlobalCommandError,\n} from \"@api/command/utils/GlobalCommandError\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { testDeviceActionStates } from \"@api/device-action/__test-utils__/testDeviceActionStates\";\nimport { DeviceActionStatus } from \"@api/device-action/model/DeviceActionState\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport {\n DeviceLockedError,\n UnknownDAError,\n} from \"@api/device-action/os/Errors\";\n\nimport {\n type WaitForAppAndVersionDAState,\n waitForAppAndVersionDAStateStep,\n} from \"./types\";\nimport { WaitForAppAndVersionDeviceAction } from \"./WaitForAppAndVersionDeviceAction\";\n\nconst appAndVersionResult = (name: string, version: string) =>\n CommandResultFactory({\n data: {\n name,\n version,\n },\n });\n\nconst lockedErrorResult = () =>\n CommandResultFactory({\n error: new GlobalCommandError({\n ...GLOBAL_ERRORS[\"5515\"],\n errorCode: \"5515\",\n }),\n });\n\nconst claNotSupportedErrorResult = () =>\n CommandResultFactory({\n error: new GlobalCommandError({\n ...GLOBAL_ERRORS[\"6e00\"],\n errorCode: \"6e00\",\n }),\n });\n\nconst getAppAndVersionPendingState = (): WaitForAppAndVersionDAState => ({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: waitForAppAndVersionDAStateStep.GET_APP_AND_VERSION,\n },\n status: DeviceActionStatus.Pending,\n});\n\nconst unlockRequestedPendingState = (): WaitForAppAndVersionDAState => ({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n step: waitForAppAndVersionDAStateStep.UNLOCK_DEVICE,\n },\n status: DeviceActionStatus.Pending,\n});\n\ndescribe(\"WaitForAppAndVersionDeviceAction\", () => {\n const getAppAndVersionMock = vi.fn();\n const waitForDeviceUnlockMock = vi.fn();\n\n function extractDependenciesMock() {\n return {\n getAppAndVersion: getAppAndVersionMock,\n waitForDeviceUnlock: waitForDeviceUnlockMock,\n };\n }\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n it(\"should succeed on the first call when the device is already unlocked\", () =>\n new Promise<void>((resolve, reject) => {\n getAppAndVersionMock.mockResolvedValue(\n appAndVersionResult(\"BOLOS\", \"1.0.0\"),\n );\n\n const deviceAction = new WaitForAppAndVersionDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<WaitForAppAndVersionDAState> = [\n getAppAndVersionPendingState(),\n {\n status: DeviceActionStatus.Completed,\n output: {\n name: \"BOLOS\",\n version: \"1.0.0\",\n },\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should wait for the device to be unlocked then succeed\", () =>\n new Promise<void>((resolve, reject) => {\n getAppAndVersionMock\n .mockResolvedValueOnce(lockedErrorResult())\n .mockResolvedValueOnce(appAndVersionResult(\"Bitcoin\", \"2.1.0\"));\n\n waitForDeviceUnlockMock.mockReturnValue(of(undefined));\n\n const deviceAction = new WaitForAppAndVersionDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<WaitForAppAndVersionDAState> = [\n getAppAndVersionPendingState(),\n unlockRequestedPendingState(),\n getAppAndVersionPendingState(),\n {\n status: DeviceActionStatus.Completed,\n output: {\n name: \"Bitcoin\",\n version: \"2.1.0\",\n },\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should consider the device on the dashboard of an old firmware when CLA is not supported\", () =>\n new Promise<void>((resolve, reject) => {\n getAppAndVersionMock.mockResolvedValue(claNotSupportedErrorResult());\n\n const deviceAction = new WaitForAppAndVersionDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<WaitForAppAndVersionDAState> = [\n getAppAndVersionPendingState(),\n {\n status: DeviceActionStatus.Completed,\n output: {\n name: \"BOLOS\",\n version: \"0.0.0\",\n },\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if the device stays locked until the unlock timeout\", () =>\n new Promise<void>((resolve, reject) => {\n getAppAndVersionMock.mockResolvedValue(lockedErrorResult());\n\n waitForDeviceUnlockMock.mockReturnValue(\n throwError(() => new DeviceLockedError()),\n );\n\n const deviceAction = new WaitForAppAndVersionDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<WaitForAppAndVersionDAState> = [\n getAppAndVersionPendingState(),\n unlockRequestedPendingState(),\n {\n status: DeviceActionStatus.Error,\n error: new DeviceLockedError(),\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if the GetAppAndVersion command fails with a non-locked error\", () =>\n new Promise<void>((resolve, reject) => {\n const error = new GlobalCommandError({\n ...GLOBAL_ERRORS[\"5501\"],\n errorCode: \"5501\",\n });\n\n getAppAndVersionMock.mockResolvedValue(CommandResultFactory({ error }));\n\n const deviceAction = new WaitForAppAndVersionDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<WaitForAppAndVersionDAState> = [\n getAppAndVersionPendingState(),\n {\n status: DeviceActionStatus.Error,\n error,\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if the getAppAndVersion actor throws an error\", () =>\n new Promise<void>((resolve, reject) => {\n getAppAndVersionMock.mockImplementation(() => {\n throw new UnknownDAError(\"error\");\n });\n\n const deviceAction = new WaitForAppAndVersionDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<WaitForAppAndVersionDAState> = [\n getAppAndVersionPendingState(),\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"error\"),\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA+B,gBAE/BC,EAAqC,4CACrCC,EAGO,iDACPC,EAAgD,6DAChDC,EAAuC,oEACvCC,EAAmC,sDACnCC,EAAwC,4DACxCC,EAGO,wCAEPC,EAGO,mBACPC,EAAiD,8CAEjD,MAAMC,EAAsB,CAACC,EAAcC,OACzC,wBAAqB,CACnB,KAAM,CACJ,KAAAD,EACA,QAAAC,CACF,CACF,CAAC,EAEGC,EAAoB,OACxB,wBAAqB,CACnB,MAAO,IAAI,qBAAmB,CAC5B,GAAG,gBAAc,IAAM,EACvB,UAAW,MACb,CAAC,CACH,CAAC,EAEGC,EAA6B,OACjC,wBAAqB,CACnB,MAAO,IAAI,qBAAmB,CAC5B,GAAG,gBAAc,MAAM,EACvB,UAAW,MACb,CAAC,CACH,CAAC,EAEGC,EAA+B,KAAoC,CACvE,kBAAmB,CACjB,wBAAyB,0BAAwB,KACjD,KAAM,kCAAgC,mBACxC,EACA,OAAQ,qBAAmB,OAC7B,GAEMC,EAA8B,KAAoC,CACtE,kBAAmB,CACjB,wBAAyB,0BAAwB,aACjD,KAAM,kCAAgC,aACxC,EACA,OAAQ,qBAAmB,OAC7B,GAEA,SAAS,mC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,EAEA,MAAMI,EAAqD,CACzDR,EAA6B,EAC7B,CACE,OAAQ,qBAAmB,MAC3B,MAAAS,CACF,CACF,KAEA,0BACEF,EACAC,KACA,mCAAgC,EAChC,CACE,OAAQH,EACR,QAASC,CACX,CACF,CACF,CAAC,CAAC,EAEJ,GAAG,uEAAwE,IACzE,IAAI,QAAc,CAACD,EAASC,IAAW,CACrCJ,EAAqB,mBAAmB,IAAM,CAC5C,MAAM,IAAI,iBAAe,OAAO,CAClC,CAAC,EAED,MAAMK,EAAe,IAAI,mCAAiC,CACxD,MAAO,CAAE,cAAe,GAAI,CAC9B,CAAC,EAED,GAAG,MAAMA,EAAc,qBAAqB,EAAE,gBAC5CH,EAAwB,CAC1B,EAEA,MAAMI,EAAqD,CACzDR,EAA6B,EAC7B,CACE,OAAQ,qBAAmB,MAC3B,MAAO,IAAI,iBAAe,OAAO,CACnC,CACF,KAEA,0BACEO,EACAC,KACA,mCAAgC,EAChC,CACE,OAAQH,EACR,QAASC,CACX,CACF,CACF,CAAC,CAAC,CACN,CAAC",
6
+ "names": ["import_rxjs", "import_CommandResult", "import_GlobalCommandError", "import_makeInternalApi", "import_testDeviceActionStates", "import_DeviceActionState", "import_UserInteractionRequired", "import_Errors", "import_types", "import_WaitForAppAndVersionDeviceAction", "appAndVersionResult", "name", "version", "lockedErrorResult", "claNotSupportedErrorResult", "getAppAndVersionPendingState", "unlockRequestedPendingState", "getAppAndVersionMock", "waitForDeviceUnlockMock", "extractDependenciesMock", "resolve", "reject", "deviceAction", "expectedStates", "error"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var p=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var a=(r,e)=>{for(var o in e)p(r,o,{get:e[o],enumerable:!0})},d=(r,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of A(e))!s.call(r,t)&&t!==o&&p(r,t,{get:()=>e[t],enumerable:!(n=i(e,t))||n.enumerable});return r};var D=r=>d(p({},"__esModule",{value:!0}),r);var c={};a(c,{waitForAppAndVersionDAStateStep:()=>V});module.exports=D(c);const V=Object.freeze({GET_APP_AND_VERSION:"os.waitForAppAndVersion.steps.getAppAndVersion",UNLOCK_DEVICE:"os.waitForAppAndVersion.steps.unlockDevice"});0&&(module.exports={waitForAppAndVersionDAStateStep});
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/os/WaitForAppAndVersion/types.ts"],
4
+ "sourcesContent": ["import { type CommandErrorResult } from \"@api/command/model/CommandResult\";\nimport { type GetAppAndVersionResponse } from \"@api/command/os/GetAppAndVersionCommand\";\nimport { type DeviceActionState } from \"@api/device-action/model/DeviceActionState\";\nimport { type UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport {\n type DeviceLockedError,\n type UnknownDAError,\n} from \"@api/device-action/os/Errors\";\n\nexport const waitForAppAndVersionDAStateStep = Object.freeze({\n GET_APP_AND_VERSION: \"os.waitForAppAndVersion.steps.getAppAndVersion\",\n UNLOCK_DEVICE: \"os.waitForAppAndVersion.steps.unlockDevice\",\n} as const);\n\nexport type WaitForAppAndVersionDAStateStep =\n (typeof waitForAppAndVersionDAStateStep)[keyof typeof waitForAppAndVersionDAStateStep];\n\nexport type WaitForAppAndVersionDAOutput = GetAppAndVersionResponse;\n\nexport type WaitForAppAndVersionDAInput = {\n readonly unlockTimeout?: number;\n};\n\nexport type WaitForAppAndVersionDAError =\n | DeviceLockedError\n | UnknownDAError\n | CommandErrorResult[\"error\"];\n\nexport type WaitForAppAndVersionDARequiredInteraction =\n | UserInteractionRequired.None\n | UserInteractionRequired.UnlockDevice;\n\nexport type WaitForAppAndVersionDAIntermediateValue = {\n requiredUserInteraction: WaitForAppAndVersionDARequiredInteraction;\n step: WaitForAppAndVersionDAStateStep;\n};\n\nexport type WaitForAppAndVersionDAState = DeviceActionState<\n WaitForAppAndVersionDAOutput,\n WaitForAppAndVersionDAError,\n WaitForAppAndVersionDAIntermediateValue\n>;\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,IAAA,eAAAC,EAAAH,GASO,MAAME,EAAkC,OAAO,OAAO,CAC3D,oBAAqB,iDACrB,cAAe,4CACjB,CAAU",
6
+ "names": ["types_exports", "__export", "waitForAppAndVersionDAStateStep", "__toCommonJS"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var L=Object.defineProperty;var Be=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var Pe=Object.prototype.hasOwnProperty;var Oe=(p,t)=>{for(var a in t)L(p,a,{get:t[a],enumerable:!0})},v=(p,t,a,k)=>{if(t&&typeof t=="object"||typeof t=="function")for(let f of Te(t))!Pe.call(p,f)&&f!==a&&L(p,f,{get:()=>t[f],enumerable:!(k=Be(t,f))||k.enumerable});return p},o=(p,t,a)=>(v(p,t,"default"),a&&v(a,t,"default"));var be=p=>v(L({},"__esModule",{value:!0}),p);var e={};Oe(e,{APDU_MAX_PAYLOAD:()=>A.APDU_MAX_PAYLOAD,Apdu:()=>R.Apdu,ApduBuilder:()=>A.ApduBuilder,ApduParser:()=>E.ApduParser,ApduResponse:()=>ae.ApduResponse,AppAlreadyInstalledDAError:()=>r.AppAlreadyInstalledDAError,ApplicationChecker:()=>Ie.ApplicationChecker,BackupAppStorageTask:()=>ee.BackupAppStorageTask,BackupStorageCommand:()=>B.BackupStorageCommand,BatteryStatusType:()=>g.BatteryStatusType,BleDeviceInfos:()=>te.BleDeviceInfos,ByteArrayBuilder:()=>G.ByteArrayBuilder,ByteArrayParser:()=>I.ByteArrayParser,CallTaskInAppDeviceAction:()=>K.CallTaskInAppDeviceAction,CloseAppCommand:()=>T.CloseAppCommand,CommandResultFactory:()=>m.CommandResultFactory,CommandResultStatus:()=>m.CommandResultStatus,CommandUtils:()=>_.CommandUtils,ConnectedDevice:()=>ke.ConnectedDevice,ConsoleLogger:()=>ye.ConsoleLogger,DEFAULT_UNLOCK_TIMEOUT_MS:()=>z.DEFAULT_UNLOCK_TIMEOUT_MS,DMK_STORAGE_PREFIX_KEY:()=>de.DMK_STORAGE_PREFIX_KEY,DefaultLogTagFormatter:()=>Ce.DefaultLogTagFormatter,DeleteLanguagePackCommand:()=>x.DeleteLanguagePackCommand,DeleteLanguagePackCommandError:()=>x.DeleteLanguagePackCommandError,DeleteLanguagePackDAError:()=>r.DeleteLanguagePackDAError,DeviceActionStatus:()=>w.DeviceActionStatus,DeviceConnectionStateMachine:()=>Re.DeviceConnectionStateMachine,DeviceLockedError:()=>r.DeviceLockedError,DeviceManagementKit:()=>De.DeviceManagementKit,DeviceManagementKitBuilder:()=>ge.DeviceManagementKitBuilder,DeviceModel:()=>i.DeviceModel,DeviceModelId:()=>i.DeviceModelId,DeviceNotOnboardedError:()=>r.DeviceNotOnboardedError,DeviceSessionStateType:()=>me.DeviceSessionStateType,DeviceStatus:()=>V.DeviceStatus,DmkNetworkClient:()=>ve.DmkNetworkClient,DmkNetworkClientError:()=>Le.DmkNetworkClientError,DmkResultFactory:()=>s.DmkResultFactory,DmkResultStatus:()=>s.DmkResultStatus,FramerUtils:()=>xe.FramerUtils,GLOBAL_ERRORS:()=>n.GLOBAL_ERRORS,GenuineCheckDeviceAction:()=>ne.GenuineCheckDeviceAction,GetAppAndVersionCommand:()=>P.GetAppAndVersionCommand,GetAppStorageInfoCommand:()=>O.GetAppStorageInfoCommand,GetApplicationsMetadataTaskError:()=>y.GetApplicationsMetadataTaskError,GetBackgroundImageSizeCommand:()=>D.GetBackgroundImageSizeCommand,GetBackgroundImageSizeCommandError:()=>D.GetBackgroundImageSizeCommandError,GetBatteryStatusCommand:()=>g.GetBatteryStatusCommand,GetDeviceMetadataDeviceAction:()=>W.GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction:()=>q.GetDeviceStatusDeviceAction,GetOsVersionCommand:()=>b.GetOsVersionCommand,GlobalCommandError:()=>n.GlobalCommandError,GlobalCommandErrorHandler:()=>n.GlobalCommandErrorHandler,GoToDashboardDeviceAction:()=>H.GoToDashboardDeviceAction,InstallAppDeviceAction:()=>ie.InstallAppDeviceAction,InstallLanguagePackageDeviceAction:()=>X.InstallLanguagePackageDeviceAction,InstallOrUpdateAppsDeviceAction:()=>Q.InstallOrUpdateAppsDeviceAction,InvalidGetFirmwareMetadataResponseError:()=>y.InvalidGetFirmwareMetadataResponseError,InvalidResponseFormatError:()=>u.InvalidResponseFormatError,InvalidStatusWordError:()=>u.InvalidStatusWordError,LEDGER_VENDOR_ID:()=>i.LEDGER_VENDOR_ID,ListAppsCommand:()=>h.ListAppsCommand,ListAppsDeviceAction:()=>Y.ListAppsDeviceAction,ListAppsWithMetadataDeviceAction:()=>j.ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction:()=>se.ListInstalledAppsDeviceAction,ListLanguagePackCommand:()=>l.ListLanguagePackCommand,ListLanguagePackCommandError:()=>l.ListLanguagePackCommandError,LoadCertificateCommand:()=>M.LoadCertificateCommand,LogLevel:()=>le.LogLevel,OpenAppCommand:()=>U.OpenAppCommand,OpenAppDeviceAction:()=>J.OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction:()=>Z.OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError:()=>r.OutOfMemoryDAError,RefusedByUserDAError:()=>r.RefusedByUserDAError,SecureChannelError:()=>fe.SecureChannelError,SendCommandInAppDeviceAction:()=>$.SendCommandInAppDeviceAction,StaticDeviceModelDataSource:()=>re.StaticDeviceModelDataSource,TransportConnectedDevice:()=>Ee.TransportConnectedDevice,TransportDeviceModel:()=>pe.TransportDeviceModel,UninstallAppDeviceAction:()=>ce.UninstallAppDeviceAction,UnknownDAError:()=>r.UnknownDAError,UnsupportedFirmwareDAError:()=>r.UnsupportedFirmwareDAError,UserInteractionRequired:()=>N.UserInteractionRequired,WebLogsExporterLogger:()=>Se.WebLogsExporterLogger,XStateDeviceAction:()=>oe.XStateDeviceAction,base64StringToBuffer:()=>c.base64StringToBuffer,bufferToBase64String:()=>c.bufferToBase64String,bufferToHexaString:()=>d.bufferToHexaString,connectedDeviceStubBuilder:()=>Ge.connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder:()=>Ae.defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder:()=>ue.defaultApduSenderServiceStubBuilder,formatApduReceivedLog:()=>S.formatApduReceivedLog,formatApduSentLog:()=>S.formatApduSentLog,hexaStringToBuffer:()=>d.hexaStringToBuffer,isBase64String:()=>c.isBase64String,isCommandErrorCode:()=>F.isCommandErrorCode,isHexaString:()=>d.isHexaString,isSuccessCommandResult:()=>m.isSuccessCommandResult,isSuccessDmkResult:()=>s.isSuccessDmkResult,noopLogger:()=>C.noopLogger,noopLoggerFactory:()=>C.noopLoggerFactory});module.exports=be(e);var R=require("./apdu/model/Apdu"),A=require("./apdu/utils/ApduBuilder"),E=require("./apdu/utils/ApduParser");o(e,require("./apdu/utils/AppBuilderError"),module.exports);var G=require("./apdu/utils/ByteArrayBuilder"),I=require("./apdu/utils/ByteArrayParser"),u=require("./command/Errors"),m=require("./command/model/CommandResult"),B=require("./command/os/BackupStorageCommand"),T=require("./command/os/CloseAppCommand"),x=require("./command/os/DeleteLanguagePackCommand"),P=require("./command/os/GetAppAndVersionCommand"),O=require("./command/os/GetAppStorageInfoCommand"),D=require("./command/os/GetBackgroundImageSizeCommand"),g=require("./command/os/GetBatteryStatusCommand"),b=require("./command/os/GetOsVersionCommand"),h=require("./command/os/ListAppsCommand"),l=require("./command/os/ListLanguagePackCommand"),M=require("./command/os/LoadCertificateCommand"),U=require("./command/os/OpenAppCommand"),F=require("./command/utils/CommandErrors"),_=require("./command/utils/CommandUtils"),n=require("./command/utils/GlobalCommandError"),i=require("./device/DeviceModel"),V=require("./device/DeviceStatus"),w=require("./device-action/model/DeviceActionState"),N=require("./device-action/model/UserInteractionRequired"),K=require("./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction"),z=require("./device-action/os/Const"),r=require("./device-action/os/Errors"),W=require("./device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction"),q=require("./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),H=require("./device-action/os/GoToDashboard/GoToDashboardDeviceAction"),X=require("./device-action/os/InstallLanguagePackage/InstallLanguagePackageDeviceAction"),Q=require("./device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction"),Y=require("./device-action/os/ListApps/ListAppsDeviceAction"),j=require("./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction"),J=require("./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),Z=require("./device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction"),$=require("./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction"),ee=require("./device-action/task/BackupAppStorageTask"),y=require("./device-action/task/Errors"),oe=require("./device-action/xstate-utils/XStateDeviceAction"),re=require("./device-model/data/StaticDeviceModelDataSource"),te=require("./device-model/model/BleDeviceInfos"),pe=require("./device-model/model/DeviceModel"),ae=require("./device-session/ApduResponse");o(e,require("./device-session/data/FramerConst"),module.exports);var me=require("./device-session/DeviceSessionState"),s=require("./model/DmkResult"),ne=require("./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction"),ie=require("./secure-channel/device-action/InstallApp/InstallAppDeviceAction"),se=require("./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction"),ce=require("./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction"),de=require("./storage/KeyValueStorage"),fe=require("../internal/secure-channel/model/Errors"),Ae=require("./device-session/service/DefaultApduReceiverService.stub"),ue=require("./device-session/service/DefaultApduSenderService.stub"),xe=require("./device-session/utils/FramerUtils"),De=require("./DeviceManagementKit"),ge=require("./DeviceManagementKitBuilder");o(e,require("./Error"),module.exports);var C=require("./logger-publisher/utils/noopLoggerFactory"),le=require("./logger-subscriber/model/LogLevel"),ye=require("./logger-subscriber/service/ConsoleLogger"),Ce=require("./logger-subscriber/service/DefaultLogTagFormatter"),Se=require("./logger-subscriber/service/WebLogsExporterLogger"),ve=require("./network/DmkNetworkClient"),Le=require("./network/DmkNetworkClientError"),ke=require("./transport/model/ConnectedDevice"),Re=require("./transport/model/DeviceConnectionStateMachine");o(e,require("./transport/model/Errors"),module.exports);var Ee=require("./transport/model/TransportConnectedDevice"),Ge=require("./transport/model/TransportConnectedDevice.stub");o(e,require("./types"),module.exports);var S=require("./utils/apduLogs"),Ie=require("./utils/ApplicationChecker"),c=require("./utils/Base64String"),d=require("./utils/HexaString");0&&(module.exports={APDU_MAX_PAYLOAD,Apdu,ApduBuilder,ApduParser,ApduResponse,AppAlreadyInstalledDAError,ApplicationChecker,BackupAppStorageTask,BackupStorageCommand,BatteryStatusType,BleDeviceInfos,ByteArrayBuilder,ByteArrayParser,CallTaskInAppDeviceAction,CloseAppCommand,CommandResultFactory,CommandResultStatus,CommandUtils,ConnectedDevice,ConsoleLogger,DEFAULT_UNLOCK_TIMEOUT_MS,DMK_STORAGE_PREFIX_KEY,DefaultLogTagFormatter,DeleteLanguagePackCommand,DeleteLanguagePackCommandError,DeleteLanguagePackDAError,DeviceActionStatus,DeviceConnectionStateMachine,DeviceLockedError,DeviceManagementKit,DeviceManagementKitBuilder,DeviceModel,DeviceModelId,DeviceNotOnboardedError,DeviceSessionStateType,DeviceStatus,DmkNetworkClient,DmkNetworkClientError,DmkResultFactory,DmkResultStatus,FramerUtils,GLOBAL_ERRORS,GenuineCheckDeviceAction,GetAppAndVersionCommand,GetAppStorageInfoCommand,GetApplicationsMetadataTaskError,GetBackgroundImageSizeCommand,GetBackgroundImageSizeCommandError,GetBatteryStatusCommand,GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction,GetOsVersionCommand,GlobalCommandError,GlobalCommandErrorHandler,GoToDashboardDeviceAction,InstallAppDeviceAction,InstallLanguagePackageDeviceAction,InstallOrUpdateAppsDeviceAction,InvalidGetFirmwareMetadataResponseError,InvalidResponseFormatError,InvalidStatusWordError,LEDGER_VENDOR_ID,ListAppsCommand,ListAppsDeviceAction,ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction,ListLanguagePackCommand,ListLanguagePackCommandError,LoadCertificateCommand,LogLevel,OpenAppCommand,OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError,RefusedByUserDAError,SecureChannelError,SendCommandInAppDeviceAction,StaticDeviceModelDataSource,TransportConnectedDevice,TransportDeviceModel,UninstallAppDeviceAction,UnknownDAError,UnsupportedFirmwareDAError,UserInteractionRequired,WebLogsExporterLogger,XStateDeviceAction,base64StringToBuffer,bufferToBase64String,bufferToHexaString,connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder,formatApduReceivedLog,formatApduSentLog,hexaStringToBuffer,isBase64String,isCommandErrorCode,isHexaString,isSuccessCommandResult,isSuccessDmkResult,noopLogger,noopLoggerFactory,...require("./apdu/utils/AppBuilderError"),...require("./device-session/data/FramerConst"),...require("./Error"),...require("./transport/model/Errors"),...require("./types")});
1
+ "use strict";var L=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var Oe=Object.prototype.hasOwnProperty;var Fe=(p,t)=>{for(var a in t)L(p,a,{get:t[a],enumerable:!0})},v=(p,t,a,k)=>{if(t&&typeof t=="object"||typeof t=="function")for(let A of Pe(t))!Oe.call(p,A)&&A!==a&&L(p,A,{get:()=>t[A],enumerable:!(k=Te(t,A))||k.enumerable});return p},o=(p,t,a)=>(v(p,t,"default"),a&&v(a,t,"default"));var be=p=>v(L({},"__esModule",{value:!0}),p);var e={};Fe(e,{APDU_MAX_PAYLOAD:()=>f.APDU_MAX_PAYLOAD,Apdu:()=>R.Apdu,ApduBuilder:()=>f.ApduBuilder,ApduParser:()=>E.ApduParser,ApduResponse:()=>ne.ApduResponse,AppAlreadyInstalledDAError:()=>r.AppAlreadyInstalledDAError,ApplicationChecker:()=>Be.ApplicationChecker,BackupAppStorageTask:()=>oe.BackupAppStorageTask,BackupStorageCommand:()=>B.BackupStorageCommand,BatteryStatusType:()=>g.BatteryStatusType,BleDeviceInfos:()=>pe.BleDeviceInfos,ByteArrayBuilder:()=>G.ByteArrayBuilder,ByteArrayParser:()=>I.ByteArrayParser,CallTaskInAppDeviceAction:()=>N.CallTaskInAppDeviceAction,CloseAppCommand:()=>T.CloseAppCommand,CommandResultFactory:()=>n.CommandResultFactory,CommandResultStatus:()=>n.CommandResultStatus,CommandUtils:()=>U.CommandUtils,ConnectedDevice:()=>Re.ConnectedDevice,ConsoleLogger:()=>Ce.ConsoleLogger,DEFAULT_UNLOCK_TIMEOUT_MS:()=>K.DEFAULT_UNLOCK_TIMEOUT_MS,DMK_STORAGE_PREFIX_KEY:()=>Ae.DMK_STORAGE_PREFIX_KEY,DefaultLogTagFormatter:()=>Se.DefaultLogTagFormatter,DeleteLanguagePackCommand:()=>D.DeleteLanguagePackCommand,DeleteLanguagePackCommandError:()=>D.DeleteLanguagePackCommandError,DeleteLanguagePackDAError:()=>r.DeleteLanguagePackDAError,DeviceActionStatus:()=>_.DeviceActionStatus,DeviceConnectionStateMachine:()=>Ee.DeviceConnectionStateMachine,DeviceLockedError:()=>r.DeviceLockedError,DeviceManagementKit:()=>ge.DeviceManagementKit,DeviceManagementKitBuilder:()=>le.DeviceManagementKitBuilder,DeviceModel:()=>i.DeviceModel,DeviceModelId:()=>i.DeviceModelId,DeviceNotOnboardedError:()=>r.DeviceNotOnboardedError,DeviceSessionStateType:()=>me.DeviceSessionStateType,DeviceStatus:()=>W.DeviceStatus,DmkNetworkClient:()=>Le.DmkNetworkClient,DmkNetworkClientError:()=>ke.DmkNetworkClientError,DmkResultFactory:()=>s.DmkResultFactory,DmkResultStatus:()=>s.DmkResultStatus,FramerUtils:()=>xe.FramerUtils,GLOBAL_ERRORS:()=>m.GLOBAL_ERRORS,GenuineCheckDeviceAction:()=>ie.GenuineCheckDeviceAction,GetAppAndVersionCommand:()=>P.GetAppAndVersionCommand,GetAppStorageInfoCommand:()=>O.GetAppStorageInfoCommand,GetApplicationsMetadataTaskError:()=>y.GetApplicationsMetadataTaskError,GetBackgroundImageSizeCommand:()=>x.GetBackgroundImageSizeCommand,GetBackgroundImageSizeCommandError:()=>x.GetBackgroundImageSizeCommandError,GetBatteryStatusCommand:()=>g.GetBatteryStatusCommand,GetDeviceMetadataDeviceAction:()=>z.GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction:()=>q.GetDeviceStatusDeviceAction,GetOsVersionCommand:()=>F.GetOsVersionCommand,GlobalCommandError:()=>m.GlobalCommandError,GlobalCommandErrorHandler:()=>m.GlobalCommandErrorHandler,GoToDashboardDeviceAction:()=>H.GoToDashboardDeviceAction,InstallAppDeviceAction:()=>se.InstallAppDeviceAction,InstallLanguagePackageDeviceAction:()=>X.InstallLanguagePackageDeviceAction,InstallOrUpdateAppsDeviceAction:()=>Q.InstallOrUpdateAppsDeviceAction,InvalidGetFirmwareMetadataResponseError:()=>y.InvalidGetFirmwareMetadataResponseError,InvalidResponseFormatError:()=>u.InvalidResponseFormatError,InvalidStatusWordError:()=>u.InvalidStatusWordError,LEDGER_VENDOR_ID:()=>i.LEDGER_VENDOR_ID,ListAppsCommand:()=>b.ListAppsCommand,ListAppsDeviceAction:()=>Y.ListAppsDeviceAction,ListAppsWithMetadataDeviceAction:()=>j.ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction:()=>ce.ListInstalledAppsDeviceAction,ListLanguagePackCommand:()=>l.ListLanguagePackCommand,ListLanguagePackCommandError:()=>l.ListLanguagePackCommandError,LoadCertificateCommand:()=>h.LoadCertificateCommand,LogLevel:()=>ye.LogLevel,OpenAppCommand:()=>M.OpenAppCommand,OpenAppDeviceAction:()=>J.OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction:()=>Z.OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError:()=>r.OutOfMemoryDAError,RefusedByUserDAError:()=>r.RefusedByUserDAError,SecureChannelError:()=>fe.SecureChannelError,SendCommandInAppDeviceAction:()=>$.SendCommandInAppDeviceAction,StaticDeviceModelDataSource:()=>te.StaticDeviceModelDataSource,TransportConnectedDevice:()=>Ge.TransportConnectedDevice,TransportDeviceModel:()=>ae.TransportDeviceModel,UninstallAppDeviceAction:()=>de.UninstallAppDeviceAction,UnknownDAError:()=>r.UnknownDAError,UnsupportedFirmwareDAError:()=>r.UnsupportedFirmwareDAError,UserInteractionRequired:()=>w.UserInteractionRequired,WaitForAppAndVersionDeviceAction:()=>ee.WaitForAppAndVersionDeviceAction,WebLogsExporterLogger:()=>ve.WebLogsExporterLogger,XStateDeviceAction:()=>re.XStateDeviceAction,base64StringToBuffer:()=>c.base64StringToBuffer,bufferToBase64String:()=>c.bufferToBase64String,bufferToHexaString:()=>d.bufferToHexaString,connectedDeviceStubBuilder:()=>Ie.connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder:()=>ue.defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder:()=>De.defaultApduSenderServiceStubBuilder,formatApduReceivedLog:()=>S.formatApduReceivedLog,formatApduSentLog:()=>S.formatApduSentLog,hexaStringToBuffer:()=>d.hexaStringToBuffer,isBase64String:()=>c.isBase64String,isCommandErrorCode:()=>V.isCommandErrorCode,isHexaString:()=>d.isHexaString,isSuccessCommandResult:()=>n.isSuccessCommandResult,isSuccessDmkResult:()=>s.isSuccessDmkResult,noopLogger:()=>C.noopLogger,noopLoggerFactory:()=>C.noopLoggerFactory});module.exports=be(e);var R=require("./apdu/model/Apdu"),f=require("./apdu/utils/ApduBuilder"),E=require("./apdu/utils/ApduParser");o(e,require("./apdu/utils/AppBuilderError"),module.exports);var G=require("./apdu/utils/ByteArrayBuilder"),I=require("./apdu/utils/ByteArrayParser"),u=require("./command/Errors"),n=require("./command/model/CommandResult"),B=require("./command/os/BackupStorageCommand"),T=require("./command/os/CloseAppCommand"),D=require("./command/os/DeleteLanguagePackCommand"),P=require("./command/os/GetAppAndVersionCommand"),O=require("./command/os/GetAppStorageInfoCommand"),x=require("./command/os/GetBackgroundImageSizeCommand"),g=require("./command/os/GetBatteryStatusCommand"),F=require("./command/os/GetOsVersionCommand"),b=require("./command/os/ListAppsCommand"),l=require("./command/os/ListLanguagePackCommand"),h=require("./command/os/LoadCertificateCommand"),M=require("./command/os/OpenAppCommand"),V=require("./command/utils/CommandErrors"),U=require("./command/utils/CommandUtils"),m=require("./command/utils/GlobalCommandError"),i=require("./device/DeviceModel"),W=require("./device/DeviceStatus"),_=require("./device-action/model/DeviceActionState"),w=require("./device-action/model/UserInteractionRequired"),N=require("./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction"),K=require("./device-action/os/Const"),r=require("./device-action/os/Errors"),z=require("./device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction"),q=require("./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),H=require("./device-action/os/GoToDashboard/GoToDashboardDeviceAction"),X=require("./device-action/os/InstallLanguagePackage/InstallLanguagePackageDeviceAction"),Q=require("./device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction"),Y=require("./device-action/os/ListApps/ListAppsDeviceAction"),j=require("./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction"),J=require("./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),Z=require("./device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction"),$=require("./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction"),ee=require("./device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction"),oe=require("./device-action/task/BackupAppStorageTask"),y=require("./device-action/task/Errors"),re=require("./device-action/xstate-utils/XStateDeviceAction"),te=require("./device-model/data/StaticDeviceModelDataSource"),pe=require("./device-model/model/BleDeviceInfos"),ae=require("./device-model/model/DeviceModel"),ne=require("./device-session/ApduResponse");o(e,require("./device-session/data/FramerConst"),module.exports);var me=require("./device-session/DeviceSessionState"),s=require("./model/DmkResult"),ie=require("./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction"),se=require("./secure-channel/device-action/InstallApp/InstallAppDeviceAction"),ce=require("./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction"),de=require("./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction"),Ae=require("./storage/KeyValueStorage"),fe=require("../internal/secure-channel/model/Errors"),ue=require("./device-session/service/DefaultApduReceiverService.stub"),De=require("./device-session/service/DefaultApduSenderService.stub"),xe=require("./device-session/utils/FramerUtils"),ge=require("./DeviceManagementKit"),le=require("./DeviceManagementKitBuilder");o(e,require("./Error"),module.exports);var C=require("./logger-publisher/utils/noopLoggerFactory"),ye=require("./logger-subscriber/model/LogLevel"),Ce=require("./logger-subscriber/service/ConsoleLogger"),Se=require("./logger-subscriber/service/DefaultLogTagFormatter"),ve=require("./logger-subscriber/service/WebLogsExporterLogger"),Le=require("./network/DmkNetworkClient"),ke=require("./network/DmkNetworkClientError"),Re=require("./transport/model/ConnectedDevice"),Ee=require("./transport/model/DeviceConnectionStateMachine");o(e,require("./transport/model/Errors"),module.exports);var Ge=require("./transport/model/TransportConnectedDevice"),Ie=require("./transport/model/TransportConnectedDevice.stub");o(e,require("./types"),module.exports);var S=require("./utils/apduLogs"),Be=require("./utils/ApplicationChecker"),c=require("./utils/Base64String"),d=require("./utils/HexaString");0&&(module.exports={APDU_MAX_PAYLOAD,Apdu,ApduBuilder,ApduParser,ApduResponse,AppAlreadyInstalledDAError,ApplicationChecker,BackupAppStorageTask,BackupStorageCommand,BatteryStatusType,BleDeviceInfos,ByteArrayBuilder,ByteArrayParser,CallTaskInAppDeviceAction,CloseAppCommand,CommandResultFactory,CommandResultStatus,CommandUtils,ConnectedDevice,ConsoleLogger,DEFAULT_UNLOCK_TIMEOUT_MS,DMK_STORAGE_PREFIX_KEY,DefaultLogTagFormatter,DeleteLanguagePackCommand,DeleteLanguagePackCommandError,DeleteLanguagePackDAError,DeviceActionStatus,DeviceConnectionStateMachine,DeviceLockedError,DeviceManagementKit,DeviceManagementKitBuilder,DeviceModel,DeviceModelId,DeviceNotOnboardedError,DeviceSessionStateType,DeviceStatus,DmkNetworkClient,DmkNetworkClientError,DmkResultFactory,DmkResultStatus,FramerUtils,GLOBAL_ERRORS,GenuineCheckDeviceAction,GetAppAndVersionCommand,GetAppStorageInfoCommand,GetApplicationsMetadataTaskError,GetBackgroundImageSizeCommand,GetBackgroundImageSizeCommandError,GetBatteryStatusCommand,GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction,GetOsVersionCommand,GlobalCommandError,GlobalCommandErrorHandler,GoToDashboardDeviceAction,InstallAppDeviceAction,InstallLanguagePackageDeviceAction,InstallOrUpdateAppsDeviceAction,InvalidGetFirmwareMetadataResponseError,InvalidResponseFormatError,InvalidStatusWordError,LEDGER_VENDOR_ID,ListAppsCommand,ListAppsDeviceAction,ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction,ListLanguagePackCommand,ListLanguagePackCommandError,LoadCertificateCommand,LogLevel,OpenAppCommand,OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError,RefusedByUserDAError,SecureChannelError,SendCommandInAppDeviceAction,StaticDeviceModelDataSource,TransportConnectedDevice,TransportDeviceModel,UninstallAppDeviceAction,UnknownDAError,UnsupportedFirmwareDAError,UserInteractionRequired,WaitForAppAndVersionDeviceAction,WebLogsExporterLogger,XStateDeviceAction,base64StringToBuffer,bufferToBase64String,bufferToHexaString,connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder,formatApduReceivedLog,formatApduSentLog,hexaStringToBuffer,isBase64String,isCommandErrorCode,isHexaString,isSuccessCommandResult,isSuccessDmkResult,noopLogger,noopLoggerFactory,...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 { type Command } from \"@api/command/Command\";\nexport {\n InvalidResponseFormatError,\n InvalidStatusWordError,\n} from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport {\n BackupStorageCommand,\n type BackupStorageCommandErrorCodes,\n type BackupStorageCommandResponse,\n type BackupStorageCommandResult,\n} from \"@api/command/os/BackupStorageCommand\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n DeleteLanguagePackCommand,\n type DeleteLanguagePackCommandArgs,\n DeleteLanguagePackCommandError,\n type DeleteLanguagePackCommandResult,\n type DeleteLanguagePackErrorCodes,\n} from \"@api/command/os/DeleteLanguagePackCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n GetAppStorageInfoCommand,\n type GetAppStorageInfoCommandArgs,\n type GetAppStorageInfoCommandErrorCodes,\n type GetAppStorageInfoCommandResponse,\n type GetAppStorageInfoCommandResult,\n} from \"@api/command/os/GetAppStorageInfoCommand\";\nexport {\n GetBackgroundImageSizeCommand,\n GetBackgroundImageSizeCommandError,\n type GetBackgroundImageSizeCommandResult,\n type GetBackgroundImageSizeErrorCodes,\n type GetBackgroundImageSizeResponse,\n} from \"@api/command/os/GetBackgroundImageSizeCommand\";\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 ListLanguagePackCommand,\n type ListLanguagePackCommandArgs,\n ListLanguagePackCommandError,\n type ListLanguagePackCommandResult,\n type ListLanguagePackErrorCodes,\n type ListLanguagePackResponse,\n} from \"@api/command/os/ListLanguagePackCommand\";\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 GLOBAL_ERRORS,\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 { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nexport {\n AppAlreadyInstalledDAError,\n DeleteLanguagePackDAError,\n DeviceLockedError,\n DeviceNotOnboardedError,\n OutOfMemoryDAError,\n RefusedByUserDAError,\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nexport { GetDeviceMetadataDeviceAction } from \"@api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport type {\n GoToDashboardDAError,\n GoToDashboardDAInput,\n GoToDashboardDAIntermediateValue,\n GoToDashboardDAOutput,\n GoToDashboardDARequiredInteraction,\n GoToDashboardDAState,\n} from \"@api/device-action/os/GoToDashboard/types\";\nexport { InstallLanguagePackageDeviceAction } from \"@api/device-action/os/InstallLanguagePackage/InstallLanguagePackageDeviceAction\";\nexport { InstallOrUpdateAppsDeviceAction } from \"@api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction\";\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 { OpenAppWithDependenciesDeviceAction } from \"@api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport { BackupAppStorageTask } from \"@api/device-action/task/BackupAppStorageTask\";\nexport {\n GetApplicationsMetadataTaskError,\n InvalidGetFirmwareMetadataResponseError,\n} from \"@api/device-action/task/Errors\";\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 {\n DmkResultFactory,\n DmkResultStatus,\n isSuccessDmkResult,\n} from \"@api/model/DmkResult\";\nexport { GenuineCheckDeviceAction } from \"@api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction\";\nexport { InstallAppDeviceAction } from \"@api/secure-channel/device-action/InstallApp/InstallAppDeviceAction\";\nexport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nexport type { InstalledApp } from \"@api/secure-channel/device-action/ListInstalledApps/types\";\nexport { UninstallAppDeviceAction } from \"@api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction\";\nexport {\n DMK_STORAGE_PREFIX_KEY,\n type KeyValueStorage,\n} from \"@api/storage/KeyValueStorage\";\nexport { SecureChannelError } from \"@internal/secure-channel/model/Errors\";\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 {\n noopLogger,\n noopLoggerFactory,\n} from \"@api/logger-publisher/utils/noopLoggerFactory\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { DefaultLogTagFormatter } from \"@api/logger-subscriber/service/DefaultLogTagFormatter\";\nexport { type LogTagFormatter } from \"@api/logger-subscriber/service/LogTagFormatter\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport {\n DmkNetworkClient,\n type DmkNetworkClientOptions,\n type DmkNetworkResponse,\n type DmkQueryParams,\n type DmkQueryParamValue,\n type DmkRequestConfig,\n type DmkResponseType,\n} from \"@api/network/DmkNetworkClient\";\nexport { DmkNetworkClientError } from \"@api/network/DmkNetworkClientError\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport {\n DeviceConnectionStateMachine,\n type DeviceConnectionStateMachineParams,\n} 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 { formatApduReceivedLog, formatApduSentLog } from \"@api/utils/apduLogs\";\nexport { ApplicationChecker } from \"@api/utils/ApplicationChecker\";\nexport {\n type AppConfig,\n type ApplicationResolver,\n type ResolvedApp,\n} from \"@api/utils/ApplicationResolver\";\nexport {\n base64StringToBuffer,\n bufferToBase64String,\n isBase64String,\n} 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,6+JAAAE,GAAAF,GAEA,IAAAG,EAAqB,gCACrBC,EAA8C,uCAC9CC,EAA2B,sCAC3BC,EAAAN,EAAc,2CALd,gBAMA,IAAAO,EAAiC,4CACjCC,EAAgC,2CAEhCC,EAGO,+BACPC,EAIO,4CACPC,EAKO,gDACPC,EAAgC,2CAChCC,EAMO,qDACPC,EAGO,mDACPC,EAMO,oDACPC,EAMO,yDACPC,EAKO,mDACPC,EAGO,+CACPC,EAKO,2CACPC,EAOO,mDACPC,EAIO,kDACPC,EAGO,0CACPC,EAAmC,4CACnCC,EAA6B,2CAC7BC,EAIO,iDACPC,EAIO,mCACPC,EAA6B,oCAE7BC,EAGO,sDACPC,EAAwC,4DACxCC,EAA0C,qFAC1CC,EAA0C,uCAC1CtB,EASO,wCACPuB,EAA8C,iFAC9CC,EAA4C,6EAC5CC,EAA0C,yEAS1CC,EAAmD,2FACnDC,EAAgD,qFAChDC,EAAqC,+DACrCC,EAAiD,uFACjDC,EAAoC,yEACpCC,EAAoD,6FACpDC,EAA6C,2FAC7CC,GAAqC,wDACrCjC,EAGO,0CACPkC,GAGO,8DACPC,GAA4C,8DAC5CC,GAA+B,kDAC/BnB,GAAqC,+CACrCoB,GAA6B,4CAC7BxC,EAAAN,EAAc,gDAjJd,gBAkJA,IAAA+C,GAGO,kDACPC,EAIO,gCACPC,GAAyC,mFACzCC,GAAuC,+EACvCC,GAA8C,6FAE9CC,GAAyC,mFACzCC,GAGO,wCACP5C,GAAmC,iDAEnC6C,GAAsD,uEACtDC,GAAoD,qEACpDC,GAA4B,iDAC5BC,GAAoC,oCACpCC,GAA2C,2CAC3CpD,EAAAN,EAAc,sBA3Kd,gBA4KA,IAAA2D,EAGO,yDACPC,GAAyB,iDACzBC,GAA8B,wDAC9BC,GAAuC,iEAEvCC,GAAsC,gEACtCC,GAQO,yCACPC,GAAsC,8CACtCC,GAAgC,gDAChCC,GAGO,6DACP7D,EAAAN,EAAc,uCApMd,gBAqMA,IAAAoE,GAAyC,yDACzCA,GAA2C,8DAC3C9D,EAAAN,EAAc,sBAvMd,gBAwMA,IAAAqE,EAAyD,+BACzDC,GAAmC,yCAMnCC,EAIO,mCACPC,EAIO",
6
- "names": ["api_exports", "__export", "__toCommonJS", "import_Apdu", "import_ApduBuilder", "import_ApduParser", "__reExport", "import_ByteArrayBuilder", "import_ByteArrayParser", "import_Errors", "import_CommandResult", "import_BackupStorageCommand", "import_CloseAppCommand", "import_DeleteLanguagePackCommand", "import_GetAppAndVersionCommand", "import_GetAppStorageInfoCommand", "import_GetBackgroundImageSizeCommand", "import_GetBatteryStatusCommand", "import_GetOsVersionCommand", "import_ListAppsCommand", "import_ListLanguagePackCommand", "import_LoadCertificateCommand", "import_OpenAppCommand", "import_CommandErrors", "import_CommandUtils", "import_GlobalCommandError", "import_DeviceModel", "import_DeviceStatus", "import_DeviceActionState", "import_UserInteractionRequired", "import_CallTaskInAppDeviceAction", "import_Const", "import_GetDeviceMetadataDeviceAction", "import_GetDeviceStatusDeviceAction", "import_GoToDashboardDeviceAction", "import_InstallLanguagePackageDeviceAction", "import_InstallOrUpdateAppsDeviceAction", "import_ListAppsDeviceAction", "import_ListAppsWithMetadataDeviceAction", "import_OpenAppDeviceAction", "import_OpenAppWithDependenciesDeviceAction", "import_SendCommandInAppDeviceAction", "import_BackupAppStorageTask", "import_XStateDeviceAction", "import_StaticDeviceModelDataSource", "import_BleDeviceInfos", "import_ApduResponse", "import_DeviceSessionState", "import_DmkResult", "import_GenuineCheckDeviceAction", "import_InstallAppDeviceAction", "import_ListInstalledAppsDeviceAction", "import_UninstallAppDeviceAction", "import_KeyValueStorage", "import_DefaultApduReceiverService", "import_DefaultApduSenderService", "import_FramerUtils", "import_DeviceManagementKit", "import_DeviceManagementKitBuilder", "import_noopLoggerFactory", "import_LogLevel", "import_ConsoleLogger", "import_DefaultLogTagFormatter", "import_WebLogsExporterLogger", "import_DmkNetworkClient", "import_DmkNetworkClientError", "import_ConnectedDevice", "import_DeviceConnectionStateMachine", "import_TransportConnectedDevice", "import_apduLogs", "import_ApplicationChecker", "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 { type Command } from \"@api/command/Command\";\nexport {\n InvalidResponseFormatError,\n InvalidStatusWordError,\n} from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport {\n BackupStorageCommand,\n type BackupStorageCommandErrorCodes,\n type BackupStorageCommandResponse,\n type BackupStorageCommandResult,\n} from \"@api/command/os/BackupStorageCommand\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n DeleteLanguagePackCommand,\n type DeleteLanguagePackCommandArgs,\n DeleteLanguagePackCommandError,\n type DeleteLanguagePackCommandResult,\n type DeleteLanguagePackErrorCodes,\n} from \"@api/command/os/DeleteLanguagePackCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n GetAppStorageInfoCommand,\n type GetAppStorageInfoCommandArgs,\n type GetAppStorageInfoCommandErrorCodes,\n type GetAppStorageInfoCommandResponse,\n type GetAppStorageInfoCommandResult,\n} from \"@api/command/os/GetAppStorageInfoCommand\";\nexport {\n GetBackgroundImageSizeCommand,\n GetBackgroundImageSizeCommandError,\n type GetBackgroundImageSizeCommandResult,\n type GetBackgroundImageSizeErrorCodes,\n type GetBackgroundImageSizeResponse,\n} from \"@api/command/os/GetBackgroundImageSizeCommand\";\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 ListLanguagePackCommand,\n type ListLanguagePackCommandArgs,\n ListLanguagePackCommandError,\n type ListLanguagePackCommandResult,\n type ListLanguagePackErrorCodes,\n type ListLanguagePackResponse,\n} from \"@api/command/os/ListLanguagePackCommand\";\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 GLOBAL_ERRORS,\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 { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nexport {\n AppAlreadyInstalledDAError,\n DeleteLanguagePackDAError,\n DeviceLockedError,\n DeviceNotOnboardedError,\n OutOfMemoryDAError,\n RefusedByUserDAError,\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nexport { GetDeviceMetadataDeviceAction } from \"@api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport type {\n GoToDashboardDAError,\n GoToDashboardDAInput,\n GoToDashboardDAIntermediateValue,\n GoToDashboardDAOutput,\n GoToDashboardDARequiredInteraction,\n GoToDashboardDAState,\n} from \"@api/device-action/os/GoToDashboard/types\";\nexport { InstallLanguagePackageDeviceAction } from \"@api/device-action/os/InstallLanguagePackage/InstallLanguagePackageDeviceAction\";\nexport { InstallOrUpdateAppsDeviceAction } from \"@api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction\";\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 { OpenAppWithDependenciesDeviceAction } from \"@api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport type {\n WaitForAppAndVersionDAError,\n WaitForAppAndVersionDAInput,\n WaitForAppAndVersionDAIntermediateValue,\n WaitForAppAndVersionDAOutput,\n WaitForAppAndVersionDARequiredInteraction,\n WaitForAppAndVersionDAState,\n} from \"@api/device-action/os/WaitForAppAndVersion/types\";\nexport { WaitForAppAndVersionDeviceAction } from \"@api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction\";\nexport { BackupAppStorageTask } from \"@api/device-action/task/BackupAppStorageTask\";\nexport {\n GetApplicationsMetadataTaskError,\n InvalidGetFirmwareMetadataResponseError,\n} from \"@api/device-action/task/Errors\";\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 {\n DmkResultFactory,\n DmkResultStatus,\n isSuccessDmkResult,\n} from \"@api/model/DmkResult\";\nexport { GenuineCheckDeviceAction } from \"@api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction\";\nexport { InstallAppDeviceAction } from \"@api/secure-channel/device-action/InstallApp/InstallAppDeviceAction\";\nexport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nexport type { InstalledApp } from \"@api/secure-channel/device-action/ListInstalledApps/types\";\nexport { UninstallAppDeviceAction } from \"@api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction\";\nexport {\n DMK_STORAGE_PREFIX_KEY,\n type KeyValueStorage,\n} from \"@api/storage/KeyValueStorage\";\nexport { SecureChannelError } from \"@internal/secure-channel/model/Errors\";\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 {\n noopLogger,\n noopLoggerFactory,\n} from \"@api/logger-publisher/utils/noopLoggerFactory\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { DefaultLogTagFormatter } from \"@api/logger-subscriber/service/DefaultLogTagFormatter\";\nexport { type LogTagFormatter } from \"@api/logger-subscriber/service/LogTagFormatter\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport {\n DmkNetworkClient,\n type DmkNetworkClientOptions,\n type DmkNetworkResponse,\n type DmkQueryParams,\n type DmkQueryParamValue,\n type DmkRequestConfig,\n type DmkResponseType,\n} from \"@api/network/DmkNetworkClient\";\nexport { DmkNetworkClientError } from \"@api/network/DmkNetworkClientError\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport {\n DeviceConnectionStateMachine,\n type DeviceConnectionStateMachineParams,\n} 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 { formatApduReceivedLog, formatApduSentLog } from \"@api/utils/apduLogs\";\nexport { ApplicationChecker } from \"@api/utils/ApplicationChecker\";\nexport {\n type AppConfig,\n type ApplicationResolver,\n type ResolvedApp,\n} from \"@api/utils/ApplicationResolver\";\nexport {\n base64StringToBuffer,\n bufferToBase64String,\n isBase64String,\n} 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,sjKAAAE,GAAAF,GAEA,IAAAG,EAAqB,gCACrBC,EAA8C,uCAC9CC,EAA2B,sCAC3BC,EAAAN,EAAc,2CALd,gBAMA,IAAAO,EAAiC,4CACjCC,EAAgC,2CAEhCC,EAGO,+BACPC,EAIO,4CACPC,EAKO,gDACPC,EAAgC,2CAChCC,EAMO,qDACPC,EAGO,mDACPC,EAMO,oDACPC,EAMO,yDACPC,EAKO,mDACPC,EAGO,+CACPC,EAKO,2CACPC,EAOO,mDACPC,EAIO,kDACPC,EAGO,0CACPC,EAAmC,4CACnCC,EAA6B,2CAC7BC,EAIO,iDACPC,EAIO,mCACPC,EAA6B,oCAE7BC,EAGO,sDACPC,EAAwC,4DACxCC,EAA0C,qFAC1CC,EAA0C,uCAC1CtB,EASO,wCACPuB,EAA8C,iFAC9CC,EAA4C,6EAC5CC,EAA0C,yEAS1CC,EAAmD,2FACnDC,EAAgD,qFAChDC,EAAqC,+DACrCC,EAAiD,uFACjDC,EAAoC,yEACpCC,EAAoD,6FACpDC,EAA6C,2FAS7CC,GAAiD,uFACjDC,GAAqC,wDACrClC,EAGO,0CACPmC,GAGO,8DACPC,GAA4C,8DAC5CC,GAA+B,kDAC/BpB,GAAqC,+CACrCqB,GAA6B,4CAC7BzC,EAAAN,EAAc,gDA1Jd,gBA2JA,IAAAgD,GAGO,kDACPC,EAIO,gCACPC,GAAyC,mFACzCC,GAAuC,+EACvCC,GAA8C,6FAE9CC,GAAyC,mFACzCC,GAGO,wCACP7C,GAAmC,iDAEnC8C,GAAsD,uEACtDC,GAAoD,qEACpDC,GAA4B,iDAC5BC,GAAoC,oCACpCC,GAA2C,2CAC3CrD,EAAAN,EAAc,sBApLd,gBAqLA,IAAA4D,EAGO,yDACPC,GAAyB,iDACzBC,GAA8B,wDAC9BC,GAAuC,iEAEvCC,GAAsC,gEACtCC,GAQO,yCACPC,GAAsC,8CACtCC,GAAgC,gDAChCC,GAGO,6DACP9D,EAAAN,EAAc,uCA7Md,gBA8MA,IAAAqE,GAAyC,yDACzCA,GAA2C,8DAC3C/D,EAAAN,EAAc,sBAhNd,gBAiNA,IAAAsE,EAAyD,+BACzDC,GAAmC,yCAMnCC,EAIO,mCACPC,EAIO",
6
+ "names": ["api_exports", "__export", "__toCommonJS", "import_Apdu", "import_ApduBuilder", "import_ApduParser", "__reExport", "import_ByteArrayBuilder", "import_ByteArrayParser", "import_Errors", "import_CommandResult", "import_BackupStorageCommand", "import_CloseAppCommand", "import_DeleteLanguagePackCommand", "import_GetAppAndVersionCommand", "import_GetAppStorageInfoCommand", "import_GetBackgroundImageSizeCommand", "import_GetBatteryStatusCommand", "import_GetOsVersionCommand", "import_ListAppsCommand", "import_ListLanguagePackCommand", "import_LoadCertificateCommand", "import_OpenAppCommand", "import_CommandErrors", "import_CommandUtils", "import_GlobalCommandError", "import_DeviceModel", "import_DeviceStatus", "import_DeviceActionState", "import_UserInteractionRequired", "import_CallTaskInAppDeviceAction", "import_Const", "import_GetDeviceMetadataDeviceAction", "import_GetDeviceStatusDeviceAction", "import_GoToDashboardDeviceAction", "import_InstallLanguagePackageDeviceAction", "import_InstallOrUpdateAppsDeviceAction", "import_ListAppsDeviceAction", "import_ListAppsWithMetadataDeviceAction", "import_OpenAppDeviceAction", "import_OpenAppWithDependenciesDeviceAction", "import_SendCommandInAppDeviceAction", "import_WaitForAppAndVersionDeviceAction", "import_BackupAppStorageTask", "import_XStateDeviceAction", "import_StaticDeviceModelDataSource", "import_BleDeviceInfos", "import_ApduResponse", "import_DeviceSessionState", "import_DmkResult", "import_GenuineCheckDeviceAction", "import_InstallAppDeviceAction", "import_ListInstalledAppsDeviceAction", "import_UninstallAppDeviceAction", "import_KeyValueStorage", "import_DefaultApduReceiverService", "import_DefaultApduSenderService", "import_FramerUtils", "import_DeviceManagementKit", "import_DeviceManagementKitBuilder", "import_noopLoggerFactory", "import_LogLevel", "import_ConsoleLogger", "import_DefaultLogTagFormatter", "import_WebLogsExporterLogger", "import_DmkNetworkClient", "import_DmkNetworkClientError", "import_ConnectedDevice", "import_DeviceConnectionStateMachine", "import_TransportConnectedDevice", "import_apduLogs", "import_ApplicationChecker", "import_Base64String", "import_HexaString"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var e=Object.prototype.hasOwnProperty;var i=(O,s)=>{for(var n in s)o(O,n,{get:s[n],enumerable:!0})},r=(O,s,n,t)=>{if(s&&typeof s=="object"||typeof s=="function")for(let S of c(s))!e.call(O,S)&&S!==n&&o(O,S,{get:()=>s[S],enumerable:!(t=a(s,S))||t.enumerable});return O};var A=O=>r(o({},"__esModule",{value:!0}),O);var d={};i(d,{isDashboardName:()=>L});module.exports=A(d);const D=["BOLOS","OLOS","OLOS\0"],L=O=>D.includes(O);0&&(module.exports={isDashboardName});
1
+ "use strict";var t=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var e=(O,n)=>{for(var o in n)t(O,o,{get:n[o],enumerable:!0})},i=(O,n,o,S)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of c(n))!d.call(O,s)&&s!==o&&t(O,s,{get:()=>n[s],enumerable:!(S=u(n,s))||S.enumerable});return O};var r=O=>i(t({},"__esModule",{value:!0}),O);var E={};e(E,{LEDGER_OS_NAME:()=>l,isDashboardName:()=>D});module.exports=r(E);const l="BOLOS",A=[l,"OLOS","OLOS\0"],D=O=>O!=null&&A.includes(O);0&&(module.exports={LEDGER_OS_NAME,isDashboardName});
2
2
  //# sourceMappingURL=AppName.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/api/utils/AppName.ts"],
4
- "sourcesContent": ["const DASHBOARD_NAMES = [\"BOLOS\", \"OLOS\", \"OLOS\\u0000\"];\n\nexport const isDashboardName = (name: string) => DASHBOARD_NAMES.includes(name);\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,MAAMI,EAAkB,CAAC,QAAS,OAAQ,QAAY,EAEzCF,EAAmBG,GAAiBD,EAAgB,SAASC,CAAI",
6
- "names": ["AppName_exports", "__export", "isDashboardName", "__toCommonJS", "DASHBOARD_NAMES", "name"]
4
+ "sourcesContent": ["// \"BOLOS\" is the legacy internal name of Ledger OS, still returned by the device.\n// When the current app name is Ledger OS, the device is on the dashboard (no app open).\nexport const LEDGER_OS_NAME = \"BOLOS\";\n\nconst DASHBOARD_NAMES = [LEDGER_OS_NAME, \"OLOS\", \"OLOS\\u0000\"];\n\nexport const isDashboardName = (name?: string | null) =>\n name !== undefined && name !== null && DASHBOARD_NAMES.includes(name);\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,oBAAAC,IAAA,eAAAC,EAAAJ,GAEO,MAAME,EAAiB,QAExBG,EAAkB,CAACH,EAAgB,OAAQ,QAAY,EAEhDC,EAAmBG,GACRA,GAAS,MAAQD,EAAgB,SAASC,CAAI",
6
+ "names": ["AppName_exports", "__export", "LEDGER_OS_NAME", "isDashboardName", "__toCommonJS", "DASHBOARD_NAMES", "name"]
7
7
  }
@@ -63,5 +63,5 @@
63
63
  "watch:builds": "pnpm ldmk-tool watch --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
64
64
  "watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\""
65
65
  },
66
- "version": "1.5.1"
66
+ "version": "1.6.0"
67
67
  }
@@ -1,2 +1,2 @@
1
- import{DeviceModelId as e}from"../../../device/DeviceModel";const o=(r=e.NANO_SP,s={})=>({[e.NANO_SP]:{isBootloader:!1,isOsu:!1,targetId:856686596,seTargetId:856686596,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"4.03",mcuBootloaderVersion:"3.12",hwVersion:"00",langId:0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...s},[e.NANO_S]:{isBootloader:!1,isOsu:!1,targetId:858783748,seTargetId:858783748,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...s},[e.NANO_X]:{isBootloader:!1,isOsu:!1,targetId:855638020,seTargetId:855638020,seVersion:"2.2.3",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"2.30",mcuBootloaderVersion:"1.16",hwVersion:"00",langId:0,recoverState:0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1}},[e.STAX]:{isBootloader:!1,isOsu:!1,targetId:857735172,seTargetId:857735172,seVersion:"1.3.0",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"5.24",mcuBootloaderVersion:"0.48",hwVersion:"00",langId:0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...s},[e.FLEX]:{isBootloader:!1,isOsu:!1,targetId:858783748,seTargetId:858783748,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:0,recoverState:0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...s},[e.APEX]:{isBootloader:!1,isOsu:!1,targetId:858783748,seTargetId:858783748,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:0,recoverState:0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1}}})[r];export{o as getOsVersionCommandResponseMockBuilder};
1
+ import{DeviceModelId as e}from"../../../device/DeviceModel";const o=(r=e.NANO_SP,s={})=>({[e.NANO_SP]:{isBootloader:!1,isOsu:!1,targetId:856686596,seTargetId:856686596,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"4.03",mcuBootloaderVersion:"3.12",hwVersion:"00",langId:0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...s},[e.NANO_S]:{isBootloader:!1,isOsu:!1,targetId:858783748,seTargetId:858783748,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...s},[e.NANO_X]:{isBootloader:!1,isOsu:!1,targetId:855638020,seTargetId:855638020,seVersion:"2.2.3",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"2.30",mcuBootloaderVersion:"1.16",hwVersion:"00",langId:0,recoverState:0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...s},[e.STAX]:{isBootloader:!1,isOsu:!1,targetId:857735172,seTargetId:857735172,seVersion:"1.3.0",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"5.24",mcuBootloaderVersion:"0.48",hwVersion:"00",langId:0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...s},[e.FLEX]:{isBootloader:!1,isOsu:!1,targetId:858783748,seTargetId:858783748,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:0,recoverState:0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...s},[e.APEX]:{isBootloader:!1,isOsu:!1,targetId:858783748,seTargetId:858783748,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:0,recoverState:0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1}}})[r];export{o as getOsVersionCommandResponseMockBuilder};
2
2
  //# sourceMappingURL=GetOsVersionCommand.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/command/os/__mocks__/GetOsVersionCommand.ts"],
4
- "sourcesContent": ["import { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\n\nexport const getOsVersionCommandResponseMockBuilder = (\n deviceModelId: DeviceModelId = DeviceModelId.NANO_SP,\n props: Partial<GetOsVersionResponse> = {},\n): GetOsVersionResponse =>\n ({\n [DeviceModelId.NANO_SP]: {\n isBootloader: false,\n isOsu: false,\n targetId: 856686596,\n seTargetId: 856686596,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"4.03\",\n mcuBootloaderVersion: \"3.12\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.NANO_S]: {\n isBootloader: false,\n isOsu: false,\n targetId: 858783748,\n seTargetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.NANO_X]: {\n isBootloader: false,\n isOsu: false,\n targetId: 855638020,\n seTargetId: 855638020,\n seVersion: \"2.2.3\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"2.30\",\n mcuBootloaderVersion: \"1.16\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: 0,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n },\n [DeviceModelId.STAX]: {\n isBootloader: false,\n isOsu: false,\n targetId: 857735172,\n seTargetId: 857735172,\n seVersion: \"1.3.0\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"5.24\",\n mcuBootloaderVersion: \"0.48\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.FLEX]: {\n isBootloader: false,\n isOsu: false,\n targetId: 858783748,\n seTargetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: 0,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.APEX]: {\n isBootloader: false,\n isOsu: false,\n targetId: 858783748,\n seTargetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: 0,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n },\n })[deviceModelId];\n"],
5
- "mappings": "AACA,OAAS,iBAAAA,MAAqB,0BAEvB,MAAMC,E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QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,YAAa,OACb,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,EACR,aAAc,OACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,EACA,GAAGG,CACL,EACA,CAACH,EAAc,IAAI,EAAG,CACpB,aAAc,GACd,MAAO,GACP,SAAU,UACV,WAAY,UACZ,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,YAAa,OACb,eAAgB,QAChB,qBAAsB,QACtB,UAAW,KACX,OAAQ,EACR,aAAc,EACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,EACA,GAAGG,CACL,EACA,CAACH,EAAc,IAAI,EAAG,CACpB,aAAc,GACd,MAAO,GACP,SAAU,UACV,WAAY,UACZ,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,YAAa,OACb,eAAgB,QAChB,qBAAsB,QACtB,UAAW,KACX,OAAQ,EACR,aAAc,EACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,CACF,CACF,GAAGE,CAAa",
4
+ "sourcesContent": ["import { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\n\nexport const getOsVersionCommandResponseMockBuilder = (\n deviceModelId: DeviceModelId = DeviceModelId.NANO_SP,\n props: Partial<GetOsVersionResponse> = {},\n): GetOsVersionResponse =>\n ({\n [DeviceModelId.NANO_SP]: {\n isBootloader: false,\n isOsu: false,\n targetId: 856686596,\n seTargetId: 856686596,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"4.03\",\n mcuBootloaderVersion: \"3.12\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.NANO_S]: {\n isBootloader: false,\n isOsu: false,\n targetId: 858783748,\n seTargetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.NANO_X]: {\n isBootloader: false,\n isOsu: false,\n targetId: 855638020,\n seTargetId: 855638020,\n seVersion: \"2.2.3\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"2.30\",\n mcuBootloaderVersion: \"1.16\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: 0,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.STAX]: {\n isBootloader: false,\n isOsu: false,\n targetId: 857735172,\n seTargetId: 857735172,\n seVersion: \"1.3.0\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"5.24\",\n mcuBootloaderVersion: \"0.48\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.FLEX]: {\n isBootloader: false,\n isOsu: false,\n targetId: 858783748,\n seTargetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: 0,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.APEX]: {\n isBootloader: false,\n isOsu: false,\n targetId: 858783748,\n seTargetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: 0,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n },\n })[de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,EAAc,IAAI,EAAG,CACpB,aAAc,GACd,MAAO,GACP,SAAU,UACV,WAAY,UACZ,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,YAAa,OACb,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,EACR,aAAc,OACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,EACA,GAAGG,CACL,EACA,CAACH,EAAc,IAAI,EAAG,CACpB,aAAc,GACd,MAAO,GACP,SAAU,UACV,WAAY,UACZ,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,YAAa,OACb,eAAgB,QAChB,qBAAsB,QACtB,UAAW,KACX,OAAQ,EACR,aAAc,EACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,EACA,GAAGG,CACL,EACA,CAACH,EAAc,IAAI,EAAG,CACpB,aAAc,GACd,MAAO,GACP,SAAU,UACV,WAAY,UACZ,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,YAAa,OACb,eAAgB,QAChB,qBAAsB,QACtB,UAAW,KACX,OAAQ,EACR,aAAc,EACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,CACF,CACF,GAAGE,CAAa",
6
6
  "names": ["DeviceModelId", "getOsVersionCommandResponseMockBuilder", "deviceModelId", "props"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Left as y,Right as k}from"purify-ts";import{EMPTY as g,from as f,interval as E,mergeMap as V,of as h,switchMap as C,take as U}from"rxjs";import{timeout as G}from"rxjs/operators";import{assign as r,fromObservable as O,fromPromise as b,setup as I}from"xstate";import{isSuccessCommandResult as S}from"../../../command/model/CommandResult";import{GetAppAndVersionCommand as v}from"../../../command/os/GetAppAndVersionCommand";import{DeviceStatus as x}from"../../../device/DeviceStatus";import{UserInteractionRequired as s}from"../../../device-action/model/UserInteractionRequired";import{DEFAULT_UNLOCK_TIMEOUT_MS as M}from"../../../device-action/os/Const";import{DeviceLockedError as T,DeviceNotOnboardedError as N}from"../../../device-action/os/Errors";import{XStateDeviceAction as w}from"../../../device-action/xstate-utils/XStateDeviceAction";import{DeviceSessionStateType as u}from"../../../device-session/DeviceSessionState";import{getDeviceStatusDAStateStep as p}from"./types";class J extends w{makeStateMachine(n){const{getAppAndVersion:d,getDeviceSessionState:c,setDeviceSessionState:i,waitForDeviceUnlock:o,isDeviceOnboarded:l}=this.extractDependencies(n),D=this.input.unlockTimeout??M;return I({types:{input:{unlockTimeout:D},context:{},output:{}},actors:{getAppAndVersion:b(d),waitForDeviceUnlock:O(o)},guards:{isDeviceOnboarded:()=>l(),isDeviceLocked:({context:e})=>e._internalState.locked,hasError:({context:e})=>e._internalState.error!==null},actions:{assignErrorDeviceNotOnboarded:r({_internalState:e=>({...e.context._internalState,error:new N})}),assignErrorDeviceLocked:r({_internalState:e=>({...e.context._internalState,error:new T}),intermediateValue:{requiredUserInteraction:s.UnlockDevice,step:p.UNLOCK_DEVICE}}),assignErrorFromEvent:r({_internalState:e=>({...e.context._internalState,error:e.event.error})}),assignNoUserActionNeeded:r({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:s.None})}),assignUserActionUnlockNeeded:r({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:s.UnlockDevice,step:p.UNLOCK_DEVICE})})}}).createMachine({id:"GetDeviceStatusDeviceAction",initial:"DeviceReady",context:e=>{const t=c(),{sessionStateType:a}=t;return{input:{unlockTimeout:e.input.unlockTimeout},intermediateValue:{requiredUserInteraction:s.None,step:p.ONBOARD_CHECK},_internalState:{onboarded:!1,locked:!1,currentApp:a===u.ReadyWithoutSecureChannel?t.currentApp.name:null,currentAppVersion:null,error:null}}},states:{DeviceReady:{always:{target:"OnboardingCheck"}},OnboardingCheck:{always:[{guard:{type:"isDeviceOnboarded"},target:"AppAndVersionCheck",actions:r({_internalState:e=>({...e.context._internalState,onboarded:!0})})},{target:"Error",actions:"assignErrorDeviceNotOnboarded"}]},UserActionUnlockDevice:{entry:"assignUserActionUnlockNeeded",exit:"assignNoUserActionNeeded",invoke:{id:"UserActionUnlockDevice",src:"waitForDeviceUnlock",input:e=>({unlockTimeout:D}),onDone:{target:"AppAndVersionCheck",actions:r({_internalState:e=>({...e.context._internalState,locked:!1})})},onError:{target:"Error",actions:"assignErrorDeviceLocked"}}},AppAndVersionCheck:{invoke:{src:"getAppAndVersion",onDone:{target:"ApplicationAvailableResultCheck",actions:r({_internalState:e=>{if(S(e.event.output)){const t=c();return t.sessionStateType!==u.Connected?i({...t,currentApp:e.event.output.data}):i({deviceModelId:t.deviceModelId,sessionStateType:u.ReadyWithoutSecureChannel,deviceStatus:x.CONNECTED,currentApp:e.event.output.data,installedApps:[],isSecureConnectionAllowed:!1}),{...e.context._internalState,locked:!1,currentApp:e.event.output.data.name,currentAppVersion:e.event.output.data.version}}if("errorCode"in e.event.output.error){if(e.event.output.error.errorCode==="5515")return{...e.context._internalState,locked:!0};if(e.event.output.error.errorCode==="6e00")return{...e.context._internalState,locked:!1,currentApp:"BOLOS",currentAppVersion:"0.0.0"}}return{...e.context._internalState,error:e.event.output.error}}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},ApplicationAvailableResultCheck:{always:[{guard:"hasError",target:"Error"},{target:"UserActionUnlockDevice",guard:"isDeviceLocked"},{target:"Success"}]},Success:{type:"final"},Error:{type:"final"}},output:e=>{const{context:t}=e,{error:a,currentApp:A,currentAppVersion:m}=t._internalState;return a?y(a):k({currentApp:A,currentAppVersion:m})}})}extractDependencies(n){return{getAppAndVersion:()=>n.sendCommand(new v),waitForDeviceUnlock:({input:i})=>E(1e3).pipe(C(()=>f(n.sendCommand(new v))),V(o=>!S(o)&&"errorCode"in o.error&&o.error.errorCode==="5515"?g:h(void 0)),U(1),G(i.unlockTimeout)),getDeviceSessionState:()=>n.getDeviceSessionState(),setDeviceSessionState:i=>n.setDeviceSessionState(i),isDeviceOnboarded:()=>!0}}}export{J as GetDeviceStatusDeviceAction};
1
+ import{Left as k,Right as E}from"purify-ts";import{EMPTY as f,from as O,interval as C,mergeMap as G,of as h,switchMap as U,take as b}from"rxjs";import{timeout as x}from"rxjs/operators";import{assign as r,fromObservable as I,fromPromise as v,setup as M}from"xstate";import{isSuccessCommandResult as p}from"../../../command/model/CommandResult";import{GetAppAndVersionCommand as A}from"../../../command/os/GetAppAndVersionCommand";import{GetOsVersionCommand as w}from"../../../command/os/GetOsVersionCommand";import{DeviceStatus as R}from"../../../device/DeviceStatus";import{UserInteractionRequired as c}from"../../../device-action/model/UserInteractionRequired";import{DEFAULT_UNLOCK_TIMEOUT_MS as N}from"../../../device-action/os/Const";import{DeviceLockedError as T,DeviceNotOnboardedError as F}from"../../../device-action/os/Errors";import{XStateDeviceAction as _}from"../../../device-action/xstate-utils/XStateDeviceAction";import{DeviceSessionStateType as u}from"../../../device-session/DeviceSessionState";import{isDashboardName as L,LEDGER_OS_NAME as q}from"../../../utils/AppName";import{getDeviceStatusDAStateStep as l}from"./types";const B=a=>({mcu:a.mcuSephVersion,bootloader:a.mcuBootloaderVersion,os:a.seVersion,metadata:a});class ne extends _{makeStateMachine(n){const{getAppAndVersion:d,getOsVersion:S,getDeviceSessionState:o,setDeviceSessionState:i,waitForDeviceUnlock:m}=this.extractDependencies(n),D=this.input.unlockTimeout??N,V=e=>{const t=o();t.sessionStateType!==u.Connected&&i({...t,firmwareVersion:B(e),isSecureConnectionAllowed:e.secureElementFlags.isSecureConnectionAllowed})};return M({types:{input:{unlockTimeout:D},context:{},output:{}},actors:{getAppAndVersion:v(d),getOsVersion:v(S),waitForDeviceUnlock:I(m)},guards:{isCurrentAppBolos:({context:e})=>L(e._internalState.currentApp),isOnboardedFromOsVersion:({context:e})=>e._internalState.osVersionMetadata?.secureElementFlags.isOnboarded===!0,isDeviceLocked:({context:e})=>e._internalState.locked,hasError:({context:e})=>e._internalState.error!==null},actions:{assignErrorDeviceNotOnboarded:r({_internalState:e=>({...e.context._internalState,error:new F})}),assignErrorDeviceLocked:r({_internalState:e=>({...e.context._internalState,error:new T}),intermediateValue:{requiredUserInteraction:c.UnlockDevice,step:l.UNLOCK_DEVICE}}),assignErrorFromEvent:r({_internalState:e=>({...e.context._internalState,error:e.event.error})}),assignNoUserActionNeeded:r({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:c.None})}),assignUserActionUnlockNeeded:r({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:c.UnlockDevice,step:l.UNLOCK_DEVICE})})}}).createMachine({id:"GetDeviceStatusDeviceAction",initial:"DeviceReady",context:e=>{const t=o(),{sessionStateType:s}=t;return{input:{unlockTimeout:e.input.unlockTimeout},intermediateValue:{requiredUserInteraction:c.None,step:l.ONBOARD_CHECK},_internalState:{onboarded:!1,locked:!1,currentApp:s===u.ReadyWithoutSecureChannel?t.currentApp.name:null,currentAppVersion:null,osVersionMetadata:null,error:null}}},states:{DeviceReady:{always:{target:"AppAndVersionCheck"}},AppAndVersionCheck:{invoke:{src:"getAppAndVersion",onDone:{target:"ApplicationAvailableResultCheck",actions:r({_internalState:e=>{if(p(e.event.output)){const t=o();return t.sessionStateType!==u.Connected?i({...t,currentApp:e.event.output.data}):i({deviceModelId:t.deviceModelId,sessionStateType:u.ReadyWithoutSecureChannel,deviceStatus:R.CONNECTED,currentApp:e.event.output.data,installedApps:[],isSecureConnectionAllowed:!1}),{...e.context._internalState,locked:!1,currentApp:e.event.output.data.name,currentAppVersion:e.event.output.data.version}}if("errorCode"in e.event.output.error){if(e.event.output.error.errorCode==="5515")return{...e.context._internalState,locked:!0};if(e.event.output.error.errorCode==="6e00")return{...e.context._internalState,locked:!1,currentApp:q,currentAppVersion:"0.0.0"}}return{...e.context._internalState,error:e.event.output.error}}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},ApplicationAvailableResultCheck:{always:[{guard:"hasError",target:"Error"},{target:"UserActionUnlockDevice",guard:"isDeviceLocked"},{target:"OnboardingCheck"}]},OnboardingCheck:{always:[{guard:"isCurrentAppBolos",target:"GetOsVersion"},{target:"Success",actions:r({_internalState:e=>({...e.context._internalState,onboarded:!0})})}]},GetOsVersion:{invoke:{src:"getOsVersion",onDone:{target:"OnboardingResultCheck",actions:r({_internalState:e=>p(e.event.output)?(V(e.event.output.data),{...e.context._internalState,osVersionMetadata:e.event.output.data}):{...e.context._internalState,error:e.event.output.error}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},OnboardingResultCheck:{always:[{guard:"hasError",target:"Error"},{guard:"isOnboardedFromOsVersion",target:"Success",actions:r({_internalState:e=>({...e.context._internalState,onboarded:!0})})},{target:"Error",actions:"assignErrorDeviceNotOnboarded"}]},UserActionUnlockDevice:{entry:"assignUserActionUnlockNeeded",exit:"assignNoUserActionNeeded",invoke:{id:"UserActionUnlockDevice",src:"waitForDeviceUnlock",input:e=>({unlockTimeout:D}),onDone:{target:"AppAndVersionCheck",actions:r({_internalState:e=>({...e.context._internalState,locked:!1})})},onError:{target:"Error",actions:"assignErrorDeviceLocked"}}},Success:{type:"final"},Error:{type:"final"}},output:e=>{const{context:t}=e,{error:s,currentApp:g,currentAppVersion:y}=t._internalState;return s?k(s):E({currentApp:g,currentAppVersion:y})}})}extractDependencies(n){return{getAppAndVersion:()=>n.sendCommand(new A),getOsVersion:()=>n.sendCommand(new w),waitForDeviceUnlock:({input:o})=>C(1e3).pipe(U(()=>O(n.sendCommand(new A))),G(i=>!p(i)&&"errorCode"in i.error&&i.error.errorCode==="5515"?f:h(void 0)),b(1),x(o.unlockTimeout)),getDeviceSessionState:()=>n.getDeviceSessionState(),setDeviceSessionState:o=>n.setDeviceSessionState(o)}}}export{ne as GetDeviceStatusDeviceAction};
2
2
  //# sourceMappingURL=GetDeviceStatusDeviceAction.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport {\n EMPTY,\n from,\n interval,\n mergeMap,\n type Observable,\n of,\n switchMap,\n take,\n} from \"rxjs\";\nimport { timeout } from \"rxjs/operators\";\nimport { assign, fromObservable, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n GetAppAndVersionCommand,\n type GetAppAndVersionCommandResult,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\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 {\n DeviceLockedError,\n DeviceNotOnboardedError,\n} from \"@api/device-action/os/Errors\";\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\";\n\nimport {\n type GetDeviceStatusDAError,\n type GetDeviceStatusDAInput,\n type GetDeviceStatusDAIntermediateValue,\n type GetDeviceStatusDAOutput,\n getDeviceStatusDAStateStep,\n} from \"./types\";\n\ntype GetDeviceStatusMachineInternalState = {\n readonly onboarded: boolean;\n readonly locked: boolean;\n readonly currentApp: string | null;\n readonly currentAppVersion: string | null;\n readonly error: GetDeviceStatusDAError | null;\n};\n\nexport type MachineDependencies = {\n readonly getAppAndVersion: () => Promise<GetAppAndVersionCommandResult>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly waitForDeviceUnlock: (args: {\n input: { unlockTimeout: number };\n }) => Observable<void>;\n readonly setDeviceSessionState: (\n state: DeviceSessionState,\n ) => DeviceSessionState;\n readonly isDeviceOnboarded: () => boolean;\n};\n\nexport type ExtractMachineDependencies = (\n internalApi: InternalApi,\n) => MachineDependencies;\n\nexport class GetDeviceStatusDeviceAction extends XStateDeviceAction<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n> {\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n > {\n type types = StateMachineTypes<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n >;\n\n const {\n getAppAndVersion,\n getDeviceSessionState,\n setDeviceSessionState,\n waitForDeviceUnlock,\n isDeviceOnboarded,\n } = this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\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 getAppAndVersion: fromPromise(getAppAndVersion),\n waitForDeviceUnlock: fromObservable(waitForDeviceUnlock),\n },\n guards: {\n isDeviceOnboarded: () => isDeviceOnboarded(), // TODO: we don't have this info for now, this can be derived from the \"flags\" obtained in the getVersion command\n isDeviceLocked: ({ context }) => context._internalState.locked,\n hasError: ({ context }) => context._internalState.error !== null,\n },\n actions: {\n assignErrorDeviceNotOnboarded: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: new DeviceNotOnboardedError(),\n }),\n }),\n assignErrorDeviceLocked: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: new DeviceLockedError(),\n }),\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n step: getDeviceStatusDAStateStep.UNLOCK_DEVICE,\n },\n }),\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 assignNoUserActionNeeded: assign({\n intermediateValue: (_) =>\n ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.None,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n assignUserActionUnlockNeeded: assign({\n intermediateValue: (_) =>\n ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n step: getDeviceStatusDAStateStep.UNLOCK_DEVICE,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QHEwBcAiYBuBLAxmAMpoCGaArrFnoQIL5q4D2AdgHQ0FgBKYpEAJ4BiANoAGALqJQAB2axcTNjJAAPRAFoArAHZx7AIwAmQ7oCcugMyHzANmMAWYwBoQgxI8vsAHOJM+VuLmVj5e2gC+EW6omDjcJORUXPSMLBwA8qwARsykAE4QuKxQAMIAFmD4ANZiUqryisqsqhoImo4O7OGhPj4h5n6Obh4IunZ2RoZ+ena6nYaGUTHoKcRklNTxqc3sWbkFRSUVVbWihtJIII1K6a1aVtoGTxOOjtbv84YjiObik7ofPM7GFDP9jNofMsQLE1olNmsGLsADLMGrFMqVGp1S5yBS3FRXNqaOzadjiHx2KyORbzcRBczmH4IbTOdjaabaKmdGy6XSRaIw1bbdZJLa0MBI9LsVHo45Ys4XBr45r3dps-n0ubaGxgx6PZlWULkkLBGmDCzGYzQ2Ei+HJEVStjsACqsDA+SdrB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viceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n const sessionState = getDeviceSessionState();\n const { sessionStateType } = sessionState;\n return {\n input: {\n unlockTimeout: _.input.unlockTimeout,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: getDeviceStatusDAStateStep.ONBOARD_CHECK,\n },\n _internalState: {\n onboarded: false, // we don't know how to check yet\n locked: false,\n currentApp:\n sessionStateType ===\n DeviceSessionStateType.ReadyWithoutSecureChannel\n ? sessionState.currentApp.name\n : null,\n currentAppVersion: null,\n error: null,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"OnboardingCheck\",\n },\n },\n OnboardingCheck: {\n // TODO: we don't have this info for now\n always: [\n {\n guard: {\n type: \"isDeviceOnboarded\",\n },\n target: \"AppAndVersionCheck\",\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n onboarded: true,\n }),\n }),\n },\n {\n target: \"Error\",\n actions: \"assignErrorDeviceNotOnboarded\",\n },\n ],\n },\n UserActionUnlockDevice: {\n // we wait for the device to be unlocked (default timeout is 15s)\n entry: \"assignUserActionUnlockNeeded\",\n exit: \"assignNoUserActionNeeded\",\n invoke: {\n id: \"UserActionUnlockDevice\",\n src: \"waitForDeviceUnlock\",\n input: (_) => ({\n unlockTimeout,\n }),\n onDone: {\n target: \"AppAndVersionCheck\",\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n locked: false,\n }),\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorDeviceLocked\",\n },\n },\n },\n AppAndVersionCheck: {\n // We check the current app and version using the getAppAndVersion command\n invoke: {\n src: \"getAppAndVersion\",\n onDone: {\n target: \"ApplicationAvailableResultCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n const state: DeviceSessionState = getDeviceSessionState();\n if (\n state.sessionStateType !==\n DeviceSessionStateType.Connected\n ) {\n // Update the current app\n setDeviceSessionState({\n ...state,\n currentApp: _.event.output.data,\n });\n } else {\n // The device can be set to Ready if GetAppAndVersionCommand was successful\n setDeviceSessionState({\n deviceModelId: state.deviceModelId,\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: _.event.output.data,\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n }\n return {\n ..._.context._internalState,\n locked: false,\n currentApp: _.event.output.data.name,\n currentAppVersion: _.event.output.data.version,\n };\n }\n if (\"errorCode\" in _.event.output.error) {\n if (_.event.output.error.errorCode === \"5515\") {\n // Locked device error\n return {\n ..._.context._internalState,\n locked: true,\n };\n } else if (_.event.output.error.errorCode === \"6e00\") {\n // CLA not supported\n // GetAppAndVersion should always be supported by the firmware or any app.\n // But on old firmware versions, that APDU was not supported in the dashboard.\n // On those firmwares, it fails with CLA_NOT_SUPPORTED in BOLOS, and INS_NOT_SUPPORTED\n // in applications. Therefore if CLA is not supported, we can consider we're on the\n // dashboard on an old firmware. We should therefore return that information to\n // ensure the user can still update his firmware and is not blocked at this step.\n return {\n ..._.context._internalState,\n locked: false,\n currentApp: \"BOLOS\",\n currentAppVersion: \"0.0.0\",\n };\n }\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n ApplicationAvailableResultCheck: {\n always: [\n {\n guard: \"hasError\",\n target: \"Error\",\n },\n {\n target: \"UserActionUnlockDevice\",\n guard: \"isDeviceLocked\",\n },\n {\n target: \"Success\",\n },\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (args) => {\n // TODO: instead we should rely on the current state (\"Success\" or \"Error\")\n const { context } = args;\n const { error, currentApp, currentAppVersion } = context._internalState;\n if (error) {\n return Left(error);\n }\n return Right<GetDeviceStatusDAOutput>({\n currentApp: currentApp!,\n currentAppVersion: currentAppVersion!,\n });\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n const getAppAndVersion = () => {\n return internalApi.sendCommand(new GetAppAndVersionCommand());\n };\n\n const waitForDeviceUnlock = ({\n input,\n }: {\n input: { unlockTimeout: number };\n }) =>\n interval(1000).pipe(\n switchMap(() =>\n from(internalApi.sendCommand(new GetAppAndVersionCommand())),\n ),\n mergeMap((output) => {\n const isLocked =\n !isSuccessCommandResult(output) &&\n \"errorCode\" in output.error &&\n output.error.errorCode === \"5515\";\n if (isLocked) {\n return EMPTY; // Continue the polling\n }\n return of(undefined); // Complete the observable\n }),\n take(1),\n timeout(input.unlockTimeout),\n );\n\n return {\n getAppAndVersion,\n waitForDeviceUnlock,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n isDeviceOnboarded: () => true, // TODO: we don't have this info for now\n };\n }\n}\n"],
5
- "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAC5B,OACE,SAAAC,EACA,QAAAC,EACA,YAAAC,EACA,YAAAC,EAEA,MAAAC,EACA,aAAAC,EACA,QAAAC,MACK,OACP,OAAS,WAAAC,MAAe,iBACxB,OAAS,UAAAC,EAAQ,kBAAAC,EAAgB,eAAAC,EAAa,SAAAC,MAAa,SAE3D,OAAS,0BAAAC,MAA8B,mCACvC,OACE,2BAAAC,MAEK,0CACP,OAAS,gBAAAC,MAAoB,2BAE7B,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,6BAAAC,MAAiC,8BAC1C,OACE,qBAAAC,EACA,2BAAAC,MACK,+BAEP,OAEE,sBAAAC,MACK,qDACP,OAEE,0BAAAC,MACK,yCAEP,OAKE,8BAAAC,MACK,UA0BA,MAAMC,UAAoCH,CAM/C,CACA,iBACEI,EAOA,CASA,KAAM,CACJ,iBAAAC,EACA,sBAAAC,EACA,sBAAAC,EACA,oBAAAC,EACA,kBAAAC,CACF,EAAI,KAAK,oBAAoBL,CAAW,EAElCM,EAAgB,KAAK,MAAM,eA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C,EAAQgC,EAAM,aAAa,CAC7B,EAKA,sBAAuB,IAAMhB,EAAY,sBAAsB,EAC/D,sBAAwBW,GACtBX,EAAY,sBAAsBW,CAAK,EACzC,kBAAmB,IAAM,EAC3B,CACF,CACF",
6
- "names": ["Left", "Right", "EMPTY", "from", "interval", "mergeMap", "of", "switchMap", "take", "timeout", "assign", "fromObservable", "fromPromise", "setup", "isSuccessCommandResult", "GetAppAndVersionCommand", "DeviceStatus", "UserInteractionRequired", "DEFAULT_UNLOCK_TIMEOUT_MS", "DeviceLockedError", "DeviceNotOnboardedError", "XStateDeviceAction", "DeviceSessionStateType", "getDeviceStatusDAStateStep", "GetDeviceStatusDeviceAction", "internalApi", "getAppAndVersion", "getDeviceSessionState", "setDeviceSessionState", "waitForDeviceUnlock", "isDeviceOnboarded", "unlockTimeout", "context", "_", "sessionState", "sessionStateType", "state", "args", "error", "currentApp", "currentAppVersion", "input", "output"]
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport {\n EMPTY,\n from,\n interval,\n mergeMap,\n type Observable,\n of,\n switchMap,\n take,\n} from \"rxjs\";\nimport { timeout } from \"rxjs/operators\";\nimport { assign, fromObservable, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n GetAppAndVersionCommand,\n type GetAppAndVersionCommandResult,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nimport {\n GetOsVersionCommand,\n type GetOsVersionCommandResult,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\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 {\n DeviceLockedError,\n DeviceNotOnboardedError,\n} from \"@api/device-action/os/Errors\";\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 type FirmwareVersion,\n} from \"@api/device-session/DeviceSessionState\";\nimport { isDashboardName, LEDGER_OS_NAME } from \"@api/utils/AppName\";\n\nimport {\n type GetDeviceStatusDAError,\n type GetDeviceStatusDAInput,\n type GetDeviceStatusDAIntermediateValue,\n type GetDeviceStatusDAOutput,\n getDeviceStatusDAStateStep,\n} from \"./types\";\n\ntype GetDeviceStatusMachineInternalState = {\n readonly onboarded: boolean;\n readonly locked: boolean;\n readonly currentApp: string | null;\n readonly currentAppVersion: string | null;\n readonly osVersionMetadata: GetOsVersionResponse | null;\n readonly error: GetDeviceStatusDAError | null;\n};\n\nexport type MachineDependencies = {\n readonly getAppAndVersion: () => Promise<GetAppAndVersionCommandResult>;\n readonly getOsVersion: () => Promise<GetOsVersionCommandResult>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly waitForDeviceUnlock: (args: {\n input: { unlockTimeout: number };\n }) => Observable<void>;\n readonly setDeviceSessionState: (\n state: DeviceSessionState,\n ) => DeviceSessionState;\n};\n\nconst firmwareVersionFromOsVersion = (\n data: GetOsVersionResponse,\n): FirmwareVersion => ({\n mcu: data.mcuSephVersion,\n bootloader: data.mcuBootloaderVersion,\n os: data.seVersion,\n metadata: data,\n});\n\nexport type ExtractMachineDependencies = (\n internalApi: InternalApi,\n) => MachineDependencies;\n\nexport class GetDeviceStatusDeviceAction extends XStateDeviceAction<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n> {\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n > {\n type types = StateMachineTypes<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n >;\n\n const {\n getAppAndVersion,\n getOsVersion,\n getDeviceSessionState,\n setDeviceSessionState,\n waitForDeviceUnlock,\n } = this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n const updateSessionFromOsVersion = (data: GetOsVersionResponse) => {\n const currentState = getDeviceSessionState();\n if (currentState.sessionStateType === DeviceSessionStateType.Connected) {\n return;\n }\n setDeviceSessionState({\n ...currentState,\n firmwareVersion: firmwareVersionFromOsVersion(data),\n isSecureConnectionAllowed:\n data.secureElementFlags.isSecureConnectionAllowed,\n });\n };\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 getAppAndVersion: fromPromise(getAppAndVersion),\n getOsVersion: fromPromise(getOsVersion),\n waitForDeviceUnlock: fromObservable(waitForDeviceUnlock),\n },\n guards: {\n isCurrentAppBolos: ({ context }) =>\n isDashboardName(context._internalState.currentApp),\n isOnboardedFromOsVersion: ({ context }) =>\n context._internalState.osVersionMetadata?.secureElementFlags\n .isOnboarded === true,\n isDeviceLocked: ({ context }) => context._internalState.locked,\n hasError: ({ context }) => context._internalState.error !== null,\n },\n actions: {\n assignErrorDeviceNotOnboarded: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: new DeviceNotOnboardedError(),\n }),\n }),\n assignErrorDeviceLocked: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: new DeviceLockedError(),\n }),\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n step: getDeviceStatusDAStateStep.UNLOCK_DEVICE,\n },\n }),\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 assignNoUserActionNeeded: assign({\n intermediateValue: (_) =>\n ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.None,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n assignUserActionUnlockNeeded: assign({\n intermediateValue: (_) =>\n ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n step: getDeviceStatusDAStateStep.UNLOCK_DEVICE,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QHEwBcAiYBuBLAxmAMpoCGaArrFnoQIL5q4D2AdgHQ0FgBKYpEAJ4BiANoAGALqJQAB2axcTNjJAAPRAFoArAHZx7AIwAmQ7oCcugMyHzANmMAWYwBoQgxI8vsAHOJM+VuLmVj5e2gC+EW6omDjcJORUXPSMLBwA8qwARsykAE4QuKxQAMIAFmD4ANZiUqryisqsqhoImo4O7OGhPj4h5n6Obh4IunZ2RoZ+ena6nYaGUTHoKcRklNTxqc3sWbkFRSUVVbWihtJIII1K6a1aVtoGTxOOjtbv84YjiObik7ofPM7GFDP9jNofMsQLE1olNmsGLsADLMGrFMqVGp1S5yBS3FRXNqaOzadjiHx2KyORbzcRBczmH4IbTOdjaabaKmdGy6XSRaIw1bbdZJLa0MBI9LsVHo45Ys4XBr45r3dps-n0ubaGxgx6PZlWULkkLBGmDCzGYzQ2Ei+HJEVStjsACqsDA+SdrBdrAANmjqmthBA2GB2MVsMxqmG3R6vT7-TU1hJcdcVXciYgglZycYQiYqRTQoZtMynDmbM4aW8rHYzD4BSs4hL7eLuF7Xe7PWk2AmA0GPflmPl2LJfeQAGbDgC2nbjPe9fv7IpTyqaGdAbXmxnZPkMNNM820VuZ+8M7Dsb3MznpwW31sFtpbGwdEo7dFksjorAgADUPYobAnNiIasGGEZRmGT4JC+bY7NKH5fj+-75IBrDAdUCAQfg5DpCmq5XDcqqZmMjgGDY-yGJeejjFRzJ2P47DZoEJb+Hyx42sKz5ioiC7sIh35-gB6QYcIg7DqO45oFO+SztBhCtrxuwCchwlAQqWGsJGOHNPh9SEemhKbogdLsIMTjmPuNF1nYZaOBW+5OPu9l1oCjZCs2ME8Y6fGIb6BC4WwdDYKQuDjtkvq8HAFC+mgokEXi65GeoiBguYZJOPSJa6Hm1hGsyuglkxxiUjYVjXlq7nyaKCI+cpn7+Tp6TBaF4WRXwsAxXFCpiEqBlJS0JFAo4vg+BCe55e8-QFUVVglVShjlWRtZ2FEgqsMwEBwKo1WKXVG5pgNaokmRZmQg4fyLHR7ieCNpjGPyx7aNo6UNo4nGeQpsFKdKax8AIoyJQSg3Ge0L07q9F3+Istk3Qg1IjUaZ7GNS-LlU4H1wt9+3OvseSFBiGFrsDx01mZ15mHooReFaVj0fZ5Jci5zissYIKY3a2NvnxsrVITCrE8RoMdDucxWgx1jpZCELDHDgKTC9jg6mNXKLDSHPcbV3O7LG3bNH2SYioLB3EmCI1-HuVL6Cj4hU6eNjsIVD3UrWfKXVCj5cV5Wvtr5n6CShaFE-1JMkWzPgXpCjh+Faw3Mjq5jdOlJhGvo-RzRr3uvr79VjgFzQtWFpARVFnWxcHQNCylCBm+eKPjJL4jWMEdNww4O46vSFVsfyD5Nlj3na9KRAUPghCwPAIdV20QIR7e-RzOYbNK98cN7ndgR-BSzgo+YmdfYPOfSgAovkQ75MbyVtItehmSrJgcijz2uHD+pmXyQSQnyVLs2tQA */\n id: \"GetDeviceStatusDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n const sessionState = getDeviceSessionState();\n const { sessionStateType } = sessionState;\n return {\n input: {\n unlockTimeout: _.input.unlockTimeout,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: getDeviceStatusDAStateStep.ONBOARD_CHECK,\n },\n _internalState: {\n onboarded: false,\n locked: false,\n currentApp:\n sessionStateType ===\n DeviceSessionStateType.ReadyWithoutSecureChannel\n ? sessionState.currentApp.name\n : null,\n currentAppVersion: null,\n osVersionMetadata: null,\n error: null,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"AppAndVersionCheck\",\n },\n },\n AppAndVersionCheck: {\n // We check the current app and version using the getAppAndVersion\n // command. This command is supported both on the dashboard (BOLOS)\n // and inside applications, so it is used to determine the currently\n // running app before deciding whether to read the OS version.\n invoke: {\n src: \"getAppAndVersion\",\n onDone: {\n target: \"ApplicationAvailableResultCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n const state: DeviceSessionState = getDeviceSessionState();\n if (\n state.sessionStateType !==\n DeviceSessionStateType.Connected\n ) {\n // Update the current app\n setDeviceSessionState({\n ...state,\n currentApp: _.event.output.data,\n });\n } else {\n // The device can be set to Ready if GetAppAndVersionCommand was successful.\n // The firmware version and secure connection flag are enriched later from\n // the OS version, which can only be read on the dashboard.\n setDeviceSessionState({\n deviceModelId: state.deviceModelId,\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: _.event.output.data,\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n }\n return {\n ..._.context._internalState,\n locked: false,\n currentApp: _.event.output.data.name,\n currentAppVersion: _.event.output.data.version,\n };\n }\n if (\"errorCode\" in _.event.output.error) {\n if (_.event.output.error.errorCode === \"5515\") {\n // Locked device error\n return {\n ..._.context._internalState,\n locked: true,\n };\n } else if (_.event.output.error.errorCode === \"6e00\") {\n // CLA not supported\n // GetAppAndVersion should always be supported by the firmware or any app.\n // But on old firmware versions, that APDU was not supported in the dashboard.\n // On those firmwares, it fails with CLA_NOT_SUPPORTED in BOLOS, and INS_NOT_SUPPORTED\n // in applications. Therefore if CLA is not supported, we can consider we're on the\n // dashboard on an old firmware. We should therefore return that information to\n // ensure the user can still update his firmware and is not blocked at this step.\n return {\n ..._.context._internalState,\n locked: false,\n currentApp: LEDGER_OS_NAME,\n currentAppVersion: \"0.0.0\",\n };\n }\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n ApplicationAvailableResultCheck: {\n always: [\n {\n guard: \"hasError\",\n target: \"Error\",\n },\n {\n target: \"UserActionUnlockDevice\",\n guard: \"isDeviceLocked\",\n },\n {\n target: \"OnboardingCheck\",\n },\n ],\n },\n OnboardingCheck: {\n always: [\n {\n // The OS version (and thus the onboarding flag) can only be read\n // on the dashboard. If we are inside an application, fetching it\n // would fail, so we only fetch it when the current app is BOLOS.\n guard: \"isCurrentAppBolos\",\n target: \"GetOsVersion\",\n },\n {\n // A non-BOLOS application can only run on an onboarded device, so\n // if an app is open we can safely consider the device onboarded\n // without reading the OS version.\n target: \"Success\",\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n onboarded: true,\n }),\n }),\n },\n ],\n },\n GetOsVersion: {\n invoke: {\n src: \"getOsVersion\",\n onDone: {\n target: \"OnboardingResultCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n updateSessionFromOsVersion(_.event.output.data);\n return {\n ..._.context._internalState,\n osVersionMetadata: _.event.output.data,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n OnboardingResultCheck: {\n always: [\n {\n guard: \"hasError\",\n target: \"Error\",\n },\n {\n guard: \"isOnboardedFromOsVersion\",\n target: \"Success\",\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n onboarded: true,\n }),\n }),\n },\n {\n target: \"Error\",\n actions: \"assignErrorDeviceNotOnboarded\",\n },\n ],\n },\n UserActionUnlockDevice: {\n // we wait for the device to be unlocked (default timeout is 15s)\n entry: \"assignUserActionUnlockNeeded\",\n exit: \"assignNoUserActionNeeded\",\n invoke: {\n id: \"UserActionUnlockDevice\",\n src: \"waitForDeviceUnlock\",\n input: (_) => ({\n unlockTimeout,\n }),\n onDone: {\n target: \"AppAndVersionCheck\",\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n locked: false,\n }),\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorDeviceLocked\",\n },\n },\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (args) => {\n // TODO: instead we should rely on the current state (\"Success\" or \"Error\")\n const { context } = args;\n const { error, currentApp, currentAppVersion } = context._internalState;\n if (error) {\n return Left(error);\n }\n return Right<GetDeviceStatusDAOutput>({\n currentApp: currentApp!,\n currentAppVersion: currentAppVersion!,\n });\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n const getAppAndVersion = () => {\n return internalApi.sendCommand(new GetAppAndVersionCommand());\n };\n\n const waitForDeviceUnlock = ({\n input,\n }: {\n input: { unlockTimeout: number };\n }) =>\n interval(1000).pipe(\n switchMap(() =>\n from(internalApi.sendCommand(new GetAppAndVersionCommand())),\n ),\n mergeMap((output) => {\n const isLocked =\n !isSuccessCommandResult(output) &&\n \"errorCode\" in output.error &&\n output.error.errorCode === \"5515\";\n if (isLocked) {\n return EMPTY; // Continue the polling\n }\n return of(undefined); // Complete the observable\n }),\n take(1),\n timeout(input.unlockTimeout),\n );\n\n return {\n getAppAndVersion,\n getOsVersion: () => internalApi.sendCommand(new GetOsVersionCommand()),\n waitForDeviceUnlock,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n };\n }\n}\n"],
5
+ "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAC5B,OACE,SAAAC,EACA,QAAAC,EACA,YAAAC,EACA,YAAAC,EAEA,MAAAC,EACA,aAAAC,EACA,QAAAC,MACK,OACP,OAAS,WAAAC,MAAe,iBACxB,OAAS,UAAAC,EAAQ,kBAAAC,EAAgB,eAAAC,EA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EA,oBAAoBjB,EAA+C,CA4BjE,MAAO,CACL,iBA5BuB,IAChBA,EAAY,YAAY,IAAIf,CAAyB,EA4B5D,aAAc,IAAMe,EAAY,YAAY,IAAId,CAAqB,EACrE,oBA1B0B,CAAC,CAC3B,MAAAgC,CACF,IAGE5C,EAAS,GAAI,EAAE,KACbG,EAAU,IACRJ,EAAK2B,EAAY,YAAY,IAAIf,CAAyB,CAAC,CAC7D,EACAV,EAAU4C,GAEN,CAACnC,EAAuBmC,CAAM,GAC9B,cAAeA,EAAO,OACtBA,EAAO,MAAM,YAAc,OAEpB/C,EAEFI,EAAG,MAAS,CACpB,EACDE,EAAK,CAAC,EACNC,EAAQuC,EAAM,aAAa,CAC7B,EAMA,sBAAuB,IAAMlB,EAAY,sBAAsB,EAC/D,sBAAwBa,GACtBb,EAAY,sBAAsBa,CAAK,CAC3C,CACF,CACF",
6
+ "names": ["Left", "Right", "EMPTY", "from", "interval", "mergeMap", "of", "switchMap", "take", "timeout", "assign", "fromObservable", "fromPromise", "setup", "isSuccessCommandResult", "GetAppAndVersionCommand", "GetOsVersionCommand", "DeviceStatus", "UserInteractionRequired", "DEFAULT_UNLOCK_TIMEOUT_MS", "DeviceLockedError", "DeviceNotOnboardedError", "XStateDeviceAction", "DeviceSessionStateType", "isDashboardName", "LEDGER_OS_NAME", "getDeviceStatusDAStateStep", "firmwareVersionFromOsVersion", "data", "GetDeviceStatusDeviceAction", "internalApi", "getAppAndVersion", "getOsVersion", "getDeviceSessionState", "setDeviceSessionState", "waitForDeviceUnlock", "unlockTimeout", "updateSessionFromOsVersion", "currentState", "context", "_", "sessionState", "sessionStateType", "state", "args", "error", "currentApp", "currentAppVersion", "input", "output"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{interval as T,Observable as R}from"rxjs";import{CommandResultFactory as u}from"../../../command/model/CommandResult";import{GLOBAL_ERRORS as C,GlobalCommandError as O}from"../../../command/utils/GlobalCommandError";import{DeviceModelId as k}from"../../../device/DeviceModel";import{DeviceStatus as i}from"../../../device/DeviceStatus";import{makeDeviceActionInternalApiMock as d}from"../../../device-action/__test-utils__/makeInternalApi";import{testDeviceActionStates as p}from"../../../device-action/__test-utils__/testDeviceActionStates";import{DeviceActionStatus as t}from"../../../device-action/model/DeviceActionState";import{UserInteractionRequired as c}from"../../../device-action/model/UserInteractionRequired";import{DeviceLockedError as f,DeviceNotOnboardedError as x,UnknownDAError as g}from"../../../device-action/os/Errors";import{DeviceSessionStateType as s}from"../../../device-session/DeviceSessionState";import{GetDeviceStatusDeviceAction as l}from"./GetDeviceStatusDeviceAction";import{getDeviceStatusDAStateStep as a}from"./types";describe("GetDeviceStatusDeviceAction",()=>{const S=vi.fn(),v=vi.fn(),V=vi.fn(),N=vi.fn(),y=vi.fn();function D(){return{getAppAndVersion:S,getDeviceSessionState:v,waitForDeviceUnlock:V,setDeviceSessionState:N,isDeviceOnboarded:y}}const{sendCommand:E,getDeviceSessionState:h,getDeviceSessionStateObservable:I}=d();beforeEach(()=>{vi.resetAllMocks(),y.mockReturnValue(!0)}),describe("without overriding `extractDependencies`",()=>{it("should run the device action with an unlocked device",()=>new Promise((r,o)=>{const e=new l({input:{unlockTimeout:500}});h.mockReturnValue({sessionStateType:s.Connected,deviceStatus:i.CONNECTED,deviceModelId:k.NANO_X}),E.mockResolvedValue(u({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:c.None,step:a.ONBOARD_CHECK},status:t.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.Completed}];p(e,n,d(),{onDone:r,onError:o})})),it("should run the device action with a locked device",()=>new Promise((r,o)=>{const e=new l({input:{unlockTimeout:1500}});h.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:k.NANO_X,isSecureConnectionAllowed:!1}),E.mockResolvedValueOnce(u({error:new O({...C[5515],errorCode:"5515"})})).mockResolvedValue(u({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:c.None,step:a.ONBOARD_CHECK},status:t.Pending},{intermediateValue:{requiredUserInteraction:c.UnlockDevice,step:a.UNLOCK_DEVICE},status:t.Pending},{intermediateValue:{requiredUserInteraction:c.None,step:a.UNLOCK_DEVICE},status:t.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.Completed}];p(e,n,d(),{onDone:r,onError:o})})),it("should timeout with a locked device",()=>new Promise((r,o)=>{const e=new l({input:{unlockTimeout:200}});h.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:k.NANO_X,isSecureConnectionAllowed:!1}),E.mockResolvedValueOnce(u({error:new O({...C[5515],errorCode:"5515"})})).mockResolvedValue(u({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:c.None,step:a.ONBOARD_CHECK},status:t.Pending},{intermediateValue:{requiredUserInteraction:c.UnlockDevice,step:a.UNLOCK_DEVICE},status:t.Pending},{error:new f("Device locked."),status:t.Error}];p(e,n,d(),{onDone:r,onError:o})})),it("should run the device action with an old firmware not supporting GetAppAndVersion",()=>new Promise((r,o)=>{const e=new l({input:{unlockTimeout:500}});h.mockReturnValue({sessionStateType:s.Connected,deviceStatus:i.CONNECTED,deviceModelId:k.NANO_X}),E.mockResolvedValue(u({error:new O({...C["6e00"],errorCode:"6e00"})}));const n=[{intermediateValue:{requiredUserInteraction:c.None,step:a.ONBOARD_CHECK},status:t.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"0.0.0"},status:t.Completed}];p(e,n,d(),{onDone:r,onError:o})}))}),describe("success cases",()=>{it("should return the device status if the device is unlocked",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),S.mockResolvedValue(u({data:{name:"BOLOS",version:"1.0.0"}}));const e=new l({input:{unlockTimeout:void 0}});vi.spyOn(e,"extractDependencies").mockReturnValue(D());const n=[{intermediateValue:{requiredUserInteraction:c.None,step:a.ONBOARD_CHECK},status:t.Pending},{status:t.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];p(e,n,d(),{onDone:()=>{expect(N).toHaveBeenCalledWith({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"BOLOS",version:"1.0.0"}}),r()},onError:o})})),it("should return the device status and update session if the device is not ready",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.Connected,deviceStatus:i.CONNECTED}),S.mockResolvedValue(u({data:{name:"BOLOS",version:"1.0.0"}}));const e=new l({input:{unlockTimeout:void 0}});vi.spyOn(e,"extractDependencies").mockReturnValue(D());const n=[{intermediateValue:{requiredUserInteraction:c.None,step:a.ONBOARD_CHECK},status:t.Pending},{status:t.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];p(e,n,d(),{onDone:()=>{expect(N).toHaveBeenCalledWith({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"BOLOS",version:"1.0.0"},installedApps:[],isSecureConnectionAllowed:!1}),r()},onError:o})})),it("should return the device status if the device is locked and the user unlocks the device",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),S.mockResolvedValueOnce(u({error:new O({...C[5515],errorCode:"5515"})})).mockResolvedValueOnce(u({data:{name:"BOLOS",version:"1.0.0"}})),V.mockImplementation(()=>new R(m=>{const A=T(50).subscribe({next:w=>{w>2?(m.next({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),m.complete()):m.next({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{A.unsubscribe()}}));const e=new l({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(D());const n=[{intermediateValue:{requiredUserInteraction:c.None,step:a.ONBOARD_CHECK},status:t.Pending},{intermediateValue:{requiredUserInteraction:c.UnlockDevice,step:a.UNLOCK_DEVICE},status:t.Pending},{intermediateValue:{requiredUserInteraction:c.None,step:a.UNLOCK_DEVICE},status:t.Pending},{status:t.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];p(e,n,d(),{onDone:r,onError:o})}))}),describe("errors cases",()=>{it("should end in an error if the device is not onboarded",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),y.mockReturnValue(!1);const e=new l({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(D());const n=[{error:new x,status:t.Error}];p(e,n,d(),{onDone:r,onError:o})})),it("should end in an error if the device is locked and the user does not unlock",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),S.mockResolvedValue(u({error:new O({...C[5515],errorCode:"5515"})})),I.mockImplementation(()=>new R(m=>{const A=T(200).subscribe({next:()=>{m.next({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:k.NANO_X,isSecureConnectionAllowed:!1})}});return()=>{A.unsubscribe()}}));const e=new l({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(D());const n=[{intermediateValue:{requiredUserInteraction:c.None,step:a.ONBOARD_CHECK},status:t.Pending},{intermediateValue:{requiredUserInteraction:c.UnlockDevice,step:a.UNLOCK_DEVICE},status:t.Pending},{error:new f("Device locked."),status:t.Error}];p(e,n,d(),{onDone:r,onError:o})})),it("should end in an error if the GetAppAndVersion command fails",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}});const e=new O({...C[5501],errorCode:"5501"});S.mockResolvedValue(u({error:e})),V.mockImplementation(()=>new R(A=>{const w=T(50).subscribe({next:L=>{L>2?(A.next({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),A.complete()):A.next({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{w.unsubscribe()}}));const n=new l({input:{unlockTimeout:500}});vi.spyOn(n,"extractDependencies").mockReturnValue(D());const m=[{intermediateValue:{requiredUserInteraction:c.None,step:a.ONBOARD_CHECK},status:t.Pending},{error:e,status:t.Error}];p(n,m,d(),{onDone:r,onError:o})})),it("should end in an error if getAppAndVersion actor throws an error",()=>new Promise((r,o)=>{v.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),S.mockImplementation(()=>{throw new g("error")}),V.mockImplementation(()=>new R(m=>{m.complete()}));const e=new l({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(D());const n=[{intermediateValue:{requiredUserInteraction:c.None,step:a.ONBOARD_CHECK},status:t.Pending},{error:new g("error"),status:t.Error}];p(e,n,d(),{onDone:r,onError:o})}))}),it("should emit a stopped state if the action is cancelled",()=>new Promise((r,o)=>{h.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:k.NANO_X,isSecureConnectionAllowed:!1}),E.mockResolvedValue(u({data:{name:"BOLOS",version:"1.0.0"}}));const e=new l({input:{unlockTimeout:500}}),n=[{status:t.Pending,intermediateValue:{requiredUserInteraction:c.None,step:a.ONBOARD_CHECK}},{status:t.Stopped}],{cancel:m}=p(e,n,d(),{onDone:r,onError:o});m()}))});
1
+ import{interval as B,Observable as E}from"rxjs";import{CommandResultFactory as y}from"../../../command/model/CommandResult";import{getOsVersionCommandResponseMockBuilder as P}from"../../../command/os/__mocks__/GetOsVersionCommand";import{GLOBAL_ERRORS as x,GlobalCommandError as L}from"../../../command/utils/GlobalCommandError";import{DeviceModelId as l}from"../../../device/DeviceModel";import{DeviceStatus as i}from"../../../device/DeviceStatus";import{makeDeviceActionInternalApiMock as a}from"../../../device-action/__test-utils__/makeInternalApi";import{testDeviceActionStates as d}from"../../../device-action/__test-utils__/testDeviceActionStates";import{DeviceActionStatus as c}from"../../../device-action/model/DeviceActionState";import{UserInteractionRequired as G}from"../../../device-action/model/UserInteractionRequired";import{DeviceLockedError as I,DeviceNotOnboardedError as _,UnknownDAError as M}from"../../../device-action/os/Errors";import{DeviceSessionStateType as s}from"../../../device-session/DeviceSessionState";import{GetDeviceStatusDeviceAction as p}from"./GetDeviceStatusDeviceAction";import{getDeviceStatusDAStateStep as b}from"./types";const O=(u={},D=l.NANO_X)=>y({data:P(D,u)}),k=(u,D)=>y({data:{name:u,version:D}}),f=()=>y({error:new L({...x[5515],errorCode:"5515"})}),v=()=>({intermediateValue:{requiredUserInteraction:G.None,step:b.ONBOARD_CHECK},status:c.Pending}),w=()=>[v(),v()],g=()=>({intermediateValue:{requiredUserInteraction:G.UnlockDevice,step:b.UNLOCK_DEVICE},status:c.Pending}),T=()=>({intermediateValue:{requiredUserInteraction:G.None,step:b.UNLOCK_DEVICE},status:c.Pending});describe("GetDeviceStatusDeviceAction",()=>{const u=vi.fn(),D=vi.fn(),S=vi.fn(),C=vi.fn(),R=vi.fn();function A(){return{getAppAndVersion:u,getOsVersion:D,getDeviceSessionState:S,waitForDeviceUnlock:C,setDeviceSessionState:R}}const{sendCommand:h,getDeviceSessionState:V,getDeviceSessionStateObservable:W}=a();beforeEach(()=>{vi.resetAllMocks(),D.mockResolvedValue(O())}),describe("without overriding `extractDependencies`",()=>{it("should run the device action with an unlocked device",()=>new Promise((o,r)=>{const e=new p({input:{unlockTimeout:500}});V.mockReturnValue({sessionStateType:s.Connected,deviceStatus:i.CONNECTED,deviceModelId:l.NANO_X}),h.mockImplementation(n=>n.name==="getOsVersion"?Promise.resolve(O()):Promise.resolve(k("BOLOS","1.0.0")));const t=[...w(),{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:c.Completed}];d(e,t,a(),{onDone:o,onError:r})})),it("should run the device action with a locked device",()=>new Promise((o,r)=>{const e=new p({input:{unlockTimeout:1500}});V.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:l.NANO_X,isSecureConnectionAllowed:!1});let t=0;h.mockImplementation(m=>m.name==="getOsVersion"?Promise.resolve(O()):(t+=1,t===1?Promise.resolve(f()):Promise.resolve(k("BOLOS","1.0.0"))));const n=[v(),g(),T(),T(),{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:c.Completed}];d(e,n,a(),{onDone:o,onError:r})})),it("should timeout with a locked device",()=>new Promise((o,r)=>{const e=new p({input:{unlockTimeout:200}});V.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:l.NANO_X,isSecureConnectionAllowed:!1}),h.mockImplementation(n=>n.name==="getOsVersion"?Promise.resolve(O()):Promise.resolve(f()));const t=[v(),g(),{error:new I("Device locked."),status:c.Error}];d(e,t,a(),{onDone:o,onError:r})})),it("should run the device action with an old firmware not supporting GetAppAndVersion",()=>new Promise((o,r)=>{const e=new p({input:{unlockTimeout:500}});V.mockReturnValue({sessionStateType:s.Connected,deviceStatus:i.CONNECTED,deviceModelId:l.NANO_X}),h.mockImplementation(n=>n.name==="getOsVersion"?Promise.resolve(O()):Promise.resolve(y({error:new L({...x["6e00"],errorCode:"6e00"})})));const t=[...w(),{output:{currentApp:"BOLOS",currentAppVersion:"0.0.0"},status:c.Completed}];d(e,t,a(),{onDone:o,onError:r})}))}),describe("success cases",()=>{it("should return the device status if the device is unlocked",()=>new Promise((o,r)=>{S.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),u.mockResolvedValue(k("BOLOS","1.0.0"));const e=new p({input:{unlockTimeout:void 0}});vi.spyOn(e,"extractDependencies").mockReturnValue(A());const t=[...w(),{status:c.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];d(e,t,a(),{onDone:()=>{expect(R).toHaveBeenCalledWith({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"BOLOS",version:"1.0.0"}}),o()},onError:r})})),it("should return the device status and update session if the device is not ready",()=>new Promise((o,r)=>{let e={sessionStateType:s.Connected,deviceStatus:i.CONNECTED,deviceModelId:l.NANO_X};S.mockImplementation(()=>e),R.mockImplementation(N=>(e=N,N)),u.mockResolvedValue(k("BOLOS","1.0.0"));const t=new p({input:{unlockTimeout:void 0}});vi.spyOn(t,"extractDependencies").mockReturnValue(A());const n=P(l.NANO_X),m=[...w(),{status:c.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];d(t,m,a(),{onDone:()=>{expect(R).toHaveBeenCalledWith({deviceModelId:l.NANO_X,sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"BOLOS",version:"1.0.0"},installedApps:[],isSecureConnectionAllowed:n.secureElementFlags.isSecureConnectionAllowed,firmwareVersion:{mcu:n.mcuSephVersion,bootloader:n.mcuBootloaderVersion,os:n.seVersion,metadata:n}}),o()},onError:r})})),it("should not fetch the OS version when an app other than BOLOS is open",()=>new Promise((o,r)=>{S.mockReturnValue({sessionStateType:s.Connected,deviceStatus:i.CONNECTED,deviceModelId:l.NANO_X}),u.mockResolvedValue(k("Bitcoin","2.1.0"));const e=new p({input:{unlockTimeout:void 0}});vi.spyOn(e,"extractDependencies").mockReturnValue(A());const t=[v(),{status:c.Completed,output:{currentApp:"Bitcoin",currentAppVersion:"2.1.0"}}];d(e,t,a(),{onDone:()=>{expect(D).not.toHaveBeenCalled(),o()},onError:r})})),it("should return the device status if the device is locked and the user unlocks the device",()=>new Promise((o,r)=>{S.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),u.mockResolvedValueOnce(f()).mockResolvedValueOnce(k("BOLOS","1.0.0")),C.mockImplementation(()=>new E(n=>{const m=B(50).subscribe({next:N=>{N>2?(n.next({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),n.complete()):n.next({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{m.unsubscribe()}}));const e=new p({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(A());const t=[v(),g(),T(),T(),{status:c.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];d(e,t,a(),{onDone:o,onError:r})}))}),describe("errors cases",()=>{it("should end in an error if the device is not onboarded",()=>new Promise((o,r)=>{S.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"BOLOS",version:"1.0.0"},installedApps:[],deviceModelId:l.NANO_X,isSecureConnectionAllowed:!1}),u.mockResolvedValue(k("BOLOS","1.0.0")),D.mockResolvedValue(O({secureElementFlags:{...P().secureElementFlags,isOnboarded:!1}}));const e=new p({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(A());const t=[...w(),{error:new _,status:c.Error}];d(e,t,a(),{onDone:o,onError:r})})),it("should end in an error if the device is locked and the user does not unlock",()=>new Promise((o,r)=>{S.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),u.mockResolvedValue(f()),C.mockImplementation(()=>new E(n=>{n.error(new I("Device locked."))})),W.mockImplementation(()=>new E(n=>{const m=B(200).subscribe({next:()=>{n.next({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:l.NANO_X,isSecureConnectionAllowed:!1})}});return()=>{m.unsubscribe()}}));const e=new p({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(A());const t=[v(),g(),{error:new I("Device locked."),status:c.Error}];d(e,t,a(),{onDone:o,onError:r})})),it("should end in an error if the GetAppAndVersion command fails",()=>new Promise((o,r)=>{S.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}});const e=new L({...x[5501],errorCode:"5501"});u.mockResolvedValue(y({error:e})),C.mockImplementation(()=>new E(m=>{m.complete()}));const t=new p({input:{unlockTimeout:500}});vi.spyOn(t,"extractDependencies").mockReturnValue(A());const n=[v(),{error:e,status:c.Error}];d(t,n,a(),{onDone:o,onError:r})})),it("should end in an error if getAppAndVersion actor throws an error",()=>new Promise((o,r)=>{S.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),u.mockImplementation(()=>{throw new M("error")}),C.mockImplementation(()=>new E(n=>{n.complete()}));const e=new p({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(A());const t=[v(),{error:new M("error"),status:c.Error}];d(e,t,a(),{onDone:o,onError:r})}))}),it("should emit a stopped state if the action is cancelled",()=>new Promise((o,r)=>{V.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:l.NANO_X,isSecureConnectionAllowed:!1}),h.mockImplementation(m=>m.name==="getOsVersion"?Promise.resolve(O()):Promise.resolve(k("BOLOS","1.0.0")));const e=new p({input:{unlockTimeout:500}}),t=[v(),{status:c.Stopped}],{cancel:n}=d(e,t,a(),{onDone:o,onError:r});n()}))});
2
2
  //# sourceMappingURL=GetDeviceStatusDeviceAction.test.js.map