@ledgerhq/device-management-kit 0.0.0-develop-20260904001312 → 0.0.0-develop-20260907001525

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 (32) hide show
  1. package/lib/cjs/package.json +1 -1
  2. package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js +1 -1
  3. package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js.map +2 -2
  4. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.js +1 -1
  5. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.js.map +2 -2
  6. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.test.js +1 -1
  7. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.test.js.map +3 -3
  8. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  9. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  10. package/lib/cjs/src/api/device/SecureElementFlags.js +1 -1
  11. package/lib/cjs/src/api/device/SecureElementFlags.js.map +3 -3
  12. package/lib/cjs/src/api/index.js +1 -1
  13. package/lib/cjs/src/api/index.js.map +2 -2
  14. package/lib/esm/package.json +1 -1
  15. package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js +1 -1
  16. package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js.map +3 -3
  17. package/lib/esm/src/api/command/os/SecureElementFlagsParser.js +1 -1
  18. package/lib/esm/src/api/command/os/SecureElementFlagsParser.js.map +3 -3
  19. package/lib/esm/src/api/command/os/SecureElementFlagsParser.test.js +1 -1
  20. package/lib/esm/src/api/command/os/SecureElementFlagsParser.test.js.map +3 -3
  21. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  22. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +3 -3
  23. package/lib/esm/src/api/device/SecureElementFlags.js +1 -1
  24. package/lib/esm/src/api/device/SecureElementFlags.js.map +3 -3
  25. package/lib/esm/src/api/index.js +1 -1
  26. package/lib/esm/src/api/index.js.map +3 -3
  27. package/lib/types/src/api/device/SecureElementFlags.d.ts +13 -1
  28. package/lib/types/src/api/device/SecureElementFlags.d.ts.map +1 -1
  29. package/lib/types/src/api/index.d.ts +1 -1
  30. package/lib/types/src/api/index.d.ts.map +1 -1
  31. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  32. package/package.json +3 -3
@@ -62,5 +62,5 @@
62
62
  "watch:builds": "pnpm ldmk-tool watch --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
63
63
  "watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\""
64
64
  },
65
- "version": "0.0.0-develop-20260904001312"
65
+ "version": "0.0.0-develop-20260907001525"
66
66
  }
@@ -1,2 +1,2 @@
1
- "use strict";var r=require("../../command/model/CommandResult"),s=require("../../device/DeviceModel"),a=require("../../device/SecureElementFlags"),o=require("../../device-session/ApduResponse"),i=require("./__mocks__/GetOsVersionCommand"),c=require("./GetOsVersionCommand");const u=Uint8Array.from([224,1,0,0,0]),l=Uint8Array.from([51,0,0,4,5,50,46,50,46,51,4,230,0,0,0,4,50,46,51,48,4,49,46,49,54,1,0,1,0,1,0,144,0]),p=new o.ApduResponse({statusCode:Uint8Array.from([144,0]),data:l}),f=new o.ApduResponse({statusCode:Uint8Array.from([144,0]),data:Uint8Array.from([51,0,0,4,5,50,46,50,46,51,0,4,50,46,51,48,4,49,46,49,54,1,0,1,0,1,0,144,0])}),S=Uint8Array.from([51,16,0,4,5,49,46,49,46,49,4,230,0,0,0,4,52,46,48,51,4,51,46,49,50,1,0,1,0,144,0]),m=new o.ApduResponse({statusCode:Uint8Array.from([144,0]),data:S}),A=Uint8Array.from([51,32,0,4,5,49,46,51,46,48,4,230,0,0,0,4,53,46,50,52,4,48,46,52,56,1,0,1,0,144,0]),O=new o.ApduResponse({statusCode:Uint8Array.from([144,0]),data:A}),E=Uint8Array.from([5,1,0,3,4,49,46,49,54,4,244,216,170,67,5,50,46,50,46,51,4,51,0,0,4,144,0]),_=new o.ApduResponse({statusCode:Uint8Array.from([144,0]),data:E}),h=Uint8Array.from([51,0,0,4,0,4,238,0,0,0,4,50,46,51,48,1,1,1,0,1,0,144,0]),N=new o.ApduResponse({statusCode:Uint8Array.from([144,0]),data:h});describe("GetOsVersionCommand",()=>{let x;beforeEach(()=>{x=new c.GetOsVersionCommand}),describe("name",()=>{it("should be 'getOsVersion'",()=>{expect(x.name).toBe("getOsVersion")})}),describe("getApdu",()=>{it("should return the GetOsVersion apdu",()=>{const e=x.getApdu();expect(e.getRawApdu()).toStrictEqual(u)})}),describe("parseResponse",()=>{describe("Nano X",()=>{it("should parse the LNX response",()=>{const e=x.parseResponse(p,s.DeviceModelId.NANO_X),t=(0,r.CommandResultFactory)({data:(0,i.getOsVersionCommandResponseMockBuilder)(s.DeviceModelId.NANO_X)});expect(e).toStrictEqual(t)}),it("should default parsed flags when the response contains empty SE flags",()=>{const e=x.parseResponse(f,s.DeviceModelId.NANO_X);expect((0,r.isSuccessCommandResult)(e)).toBe(!0),(0,r.isSuccessCommandResult)(e)&&(expect(e.data.seFlags).toStrictEqual(new Uint8Array),expect(e.data.secureElementFlags).toStrictEqual({isPinValidated:!1,hasMcuSerialNumber:!1,hasValidCertificate:!1,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!1,isMcuCodeSigned:!1,isInRecoveryMode:!1,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:24,currentWordIndex:0,onboardingState:a.OnboardingState.Unknown}))}),it.each([[11,a.OnboardingState.DeviceIsReady],[16,a.OnboardingState.RestoreWithRk]])("should parse SE flag byte 4 0x%s as %s",(e,t)=>{const d=Uint8Array.from(l);d[14]=e;const n=x.parseResponse(new o.ApduResponse({statusCode:Uint8Array.from([144,0]),data:d}),s.DeviceModelId.NANO_X);expect((0,r.isSuccessCommandResult)(n)).toBe(!0),(0,r.isSuccessCommandResult)(n)&&(expect(n.data.seFlags).toStrictEqual(new Uint8Array([230,0,0,e])),expect(n.data.secureElementFlags.onboardingState).toBe(t))})}),describe("Nano S Plus",()=>{it("should parse the LNSP response",()=>{const e=x.parseResponse(m,s.DeviceModelId.NANO_SP),t=(0,r.CommandResultFactory)({data:(0,i.getOsVersionCommandResponseMockBuilder)(s.DeviceModelId.NANO_SP)});expect(e).toStrictEqual(t)})}),describe("Stax",()=>{it("should parse the STAX response",()=>{const e=x.parseResponse(O,s.DeviceModelId.STAX),t=(0,r.CommandResultFactory)({data:(0,i.getOsVersionCommandResponseMockBuilder)(s.DeviceModelId.STAX)});expect(e).toStrictEqual(t)})}),describe("Bootloader",()=>{it("should parse the bootloader response",()=>{const e=x.parseResponse(_,s.DeviceModelId.STAX),t=(0,r.CommandResultFactory)({data:{isBootloader:!0,isOsu:!1,targetId:83951619,seTargetId:855638020,seVersion:"2.2.3",seFlags:new Uint8Array([244,216,170,67]),mcuTargetId:83951619,mcuSephVersion:"",mcuBootloaderVersion:"1.16",hwVersion:"",langId:void 0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!0,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!1,isInRecoveryMode:!1,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:18,currentWordIndex:10,onboardingState:a.OnboardingState.Unknown}}});expect(e).toStrictEqual(t)})}),describe("Old firmware",()=>{it("should parse the old firmware response",()=>{const e=x.parseResponse(N,s.DeviceModelId.NANO_X),t=(0,r.CommandResultFactory)({data:{isBootloader:!1,isOsu:!1,targetId:855638020,seTargetId:855638020,seVersion:"0.0.0",seFlags:new Uint8Array,mcuTargetId:void 0,mcuSephVersion:"2.30",mcuBootloaderVersion:"",hwVersion:"00",langId:void 0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!0,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:24,currentWordIndex:0,onboardingState:a.OnboardingState.Unknown}}});expect(e).toStrictEqual(t)})}),describe("Error handling",()=>{it("should return an error if the response is not successful",()=>{const e=new o.ApduResponse({statusCode:Uint8Array.from([110,128]),data:Uint8Array.from([])}),t=x.parseResponse(e,s.DeviceModelId.NANO_S);expect((0,r.isSuccessCommandResult)(t)).toBeFalsy()})})})});
1
+ "use strict";var r=require("../../command/model/CommandResult"),s=require("../../device/DeviceModel"),x=require("../../device/SecureElementFlags"),a=require("../../device-session/ApduResponse"),i=require("./__mocks__/GetOsVersionCommand"),c=require("./GetOsVersionCommand");const u=Uint8Array.from([224,1,0,0,0]),l=Uint8Array.from([51,0,0,4,5,50,46,50,46,51,4,230,0,0,0,4,50,46,51,48,4,49,46,49,54,1,0,1,0,1,0,144,0]),p=new a.ApduResponse({statusCode:Uint8Array.from([144,0]),data:l}),S=new a.ApduResponse({statusCode:Uint8Array.from([144,0]),data:Uint8Array.from([51,0,0,4,5,50,46,50,46,51,0,4,50,46,51,48,4,49,46,49,54,1,0,1,0,1,0,144,0])}),f=Uint8Array.from([51,16,0,4,5,49,46,49,46,49,4,230,0,0,0,4,52,46,48,51,4,51,46,49,50,1,0,1,0,144,0]),m=new a.ApduResponse({statusCode:Uint8Array.from([144,0]),data:f}),A=Uint8Array.from([51,32,0,4,5,49,46,51,46,48,4,230,0,0,0,4,53,46,50,52,4,48,46,52,56,1,0,1,0,144,0]),O=new a.ApduResponse({statusCode:Uint8Array.from([144,0]),data:A}),E=Uint8Array.from([5,1,0,3,4,49,46,49,54,4,244,216,170,67,5,50,46,50,46,51,4,51,0,0,4,144,0]),h=new a.ApduResponse({statusCode:Uint8Array.from([144,0]),data:E}),_=Uint8Array.from([51,0,0,4,0,4,238,0,0,0,4,50,46,51,48,1,1,1,0,1,0,144,0]),N=new a.ApduResponse({statusCode:Uint8Array.from([144,0]),data:_});describe("GetOsVersionCommand",()=>{let o;beforeEach(()=>{o=new c.GetOsVersionCommand}),describe("name",()=>{it("should be 'getOsVersion'",()=>{expect(o.name).toBe("getOsVersion")})}),describe("getApdu",()=>{it("should return the GetOsVersion apdu",()=>{const e=o.getApdu();expect(e.getRawApdu()).toStrictEqual(u)})}),describe("parseResponse",()=>{describe("Nano X",()=>{it("should parse the LNX response",()=>{const e=o.parseResponse(p,s.DeviceModelId.NANO_X),t=(0,r.CommandResultFactory)({data:(0,i.getOsVersionCommandResponseMockBuilder)(s.DeviceModelId.NANO_X)});expect(e).toStrictEqual(t)}),it("should default parsed flags when the response contains empty SE flags",()=>{const e=o.parseResponse(S,s.DeviceModelId.NANO_X);expect((0,r.isSuccessCommandResult)(e)).toBe(!0),(0,r.isSuccessCommandResult)(e)&&(expect(e.data.seFlags).toStrictEqual(new Uint8Array),expect(e.data.secureElementFlags).toStrictEqual({isPinValidated:!1,hasMcuSerialNumber:!1,hasValidCertificate:!1,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!1,isMcuCodeSigned:!1,isInRecoveryMode:!1,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:x.SeedWordCount.TwentyFour,currentWordIndex:0,onboardingState:x.OnboardingState.Unknown}))}),it.each([[11,x.OnboardingState.DeviceIsReady],[16,x.OnboardingState.RestoreWithRk]])("should parse SE flag byte 4 0x%s as %s",(e,t)=>{const d=Uint8Array.from(l);d[14]=e;const n=o.parseResponse(new a.ApduResponse({statusCode:Uint8Array.from([144,0]),data:d}),s.DeviceModelId.NANO_X);expect((0,r.isSuccessCommandResult)(n)).toBe(!0),(0,r.isSuccessCommandResult)(n)&&(expect(n.data.seFlags).toStrictEqual(new Uint8Array([230,0,0,e])),expect(n.data.secureElementFlags.onboardingState).toBe(t))})}),describe("Nano S Plus",()=>{it("should parse the LNSP response",()=>{const e=o.parseResponse(m,s.DeviceModelId.NANO_SP),t=(0,r.CommandResultFactory)({data:(0,i.getOsVersionCommandResponseMockBuilder)(s.DeviceModelId.NANO_SP)});expect(e).toStrictEqual(t)})}),describe("Stax",()=>{it("should parse the STAX response",()=>{const e=o.parseResponse(O,s.DeviceModelId.STAX),t=(0,r.CommandResultFactory)({data:(0,i.getOsVersionCommandResponseMockBuilder)(s.DeviceModelId.STAX)});expect(e).toStrictEqual(t)})}),describe("Bootloader",()=>{it("should parse the bootloader response",()=>{const e=o.parseResponse(h,s.DeviceModelId.STAX),t=(0,r.CommandResultFactory)({data:{isBootloader:!0,isOsu:!1,targetId:83951619,seTargetId:855638020,seVersion:"2.2.3",seFlags:new Uint8Array([244,216,170,67]),mcuTargetId:83951619,mcuSephVersion:"",mcuBootloaderVersion:"1.16",hwVersion:"",langId:void 0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!0,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!1,isInRecoveryMode:!1,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:x.SeedWordCount.Eighteen,currentWordIndex:10,onboardingState:x.OnboardingState.Unknown}}});expect(e).toStrictEqual(t)})}),describe("Old firmware",()=>{it("should parse the old firmware response",()=>{const e=o.parseResponse(N,s.DeviceModelId.NANO_X),t=(0,r.CommandResultFactory)({data:{isBootloader:!1,isOsu:!1,targetId:855638020,seTargetId:855638020,seVersion:"0.0.0",seFlags:new Uint8Array,mcuTargetId:void 0,mcuSephVersion:"2.30",mcuBootloaderVersion:"",hwVersion:"00",langId:void 0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!0,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:x.SeedWordCount.TwentyFour,currentWordIndex:0,onboardingState:x.OnboardingState.Unknown}}});expect(e).toStrictEqual(t)})}),describe("Error handling",()=>{it("should return an error if the response is not successful",()=>{const e=new a.ApduResponse({statusCode:Uint8Array.from([110,128]),data:Uint8Array.from([])}),t=o.parseResponse(e,s.DeviceModelId.NANO_S);expect((0,r.isSuccessCommandResult)(t)).toBeFalsy()})})})});
2
2
  //# sourceMappingURL=GetOsVersionCommand.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/command/os/GetOsVersionCommand.test.ts"],
4
- "sourcesContent": ["import {\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { OnboardingState } from \"@api/device/SecureElementFlags\";\nimport { ApduResponse } from \"@api/device-session/ApduResponse\";\n\nimport { getOsVersionCommandResponseMockBuilder } from \"./__mocks__/GetOsVersionCommand\";\nimport { GetOsVersionCommand } from \"./GetOsVersionCommand\";\n\nconst GET_OS_VERSION_APDU = Uint8Array.from([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\nconst LNX_RESPONSE_DATA_GOOD = Uint8Array.from([\n 0x33, 0x00, 0x00, 0x04, 0x05, 0x32, 0x2e, 0x32, 0x2e, 0x33, 0x04, 0xe6, 0x00,\n 0x00, 0x00, 0x04, 0x32, 0x2e, 0x33, 0x30, 0x04, 0x31, 0x2e, 0x31, 0x36, 0x01,\n 0x00, 0x01, 0x00, 0x01, 0x00, 0x90, 0x00,\n]);\nconst LNX_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: LNX_RESPONSE_DATA_GOOD,\n});\n\nconst LNX_RESPONSE_WITH_EMPTY_SE_FLAGS = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: Uint8Array.from([\n 0x33, 0x00, 0x00, 0x04, 0x05, 0x32, 0x2e, 0x32, 0x2e, 0x33, 0x00, 0x04,\n 0x32, 0x2e, 0x33, 0x30, 0x04, 0x31, 0x2e, 0x31, 0x36, 0x01, 0x00, 0x01,\n 0x00, 0x01, 0x00, 0x90, 0x00,\n ]),\n});\n\nconst LNSP_REPONSE_DATA_GOOD = Uint8Array.from([\n 0x33, 0x10, 0x00, 0x04, 0x05, 0x31, 0x2e, 0x31, 0x2e, 0x31, 0x04, 0xe6, 0x00,\n 0x00, 0x00, 0x04, 0x34, 0x2e, 0x30, 0x33, 0x04, 0x33, 0x2e, 0x31, 0x32, 0x01,\n 0x00, 0x01, 0x00, 0x90, 0x00,\n]);\nconst LNSP_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: LNSP_REPONSE_DATA_GOOD,\n});\n\nconst STAX_RESPONSE_DATA_GOOD = Uint8Array.from([\n 0x33, 0x20, 0x00, 0x04, 0x05, 0x31, 0x2e, 0x33, 0x2e, 0x30, 0x04, 0xe6, 0x00,\n 0x00, 0x00, 0x04, 0x35, 0x2e, 0x32, 0x34, 0x04, 0x30, 0x2e, 0x34, 0x38, 0x01,\n 0x00, 0x01, 0x00, 0x90, 0x00,\n]);\nconst STAX_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: STAX_RESPONSE_DATA_GOOD,\n});\n\nconst BL_RESPONSE_DATA_GOOD = Uint8Array.from([\n 0x05, 0x01, 0x00, 0x03, 0x04, 0x31, 0x2e, 0x31, 0x36, 0x04, 0xf4, 0xd8, 0xaa,\n 0x43, 0x05, 0x32, 0x2e, 0x32, 0x2e, 0x33, 0x04, 0x33, 0x00, 0x00, 0x04, 0x90,\n 0x00,\n]);\nconst BL_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: BL_RESPONSE_DATA_GOOD,\n});\n\nconst OLD_FM_RESPONSE_DATA_GOOD = Uint8Array.from([\n 0x33, 0x00, 0x00, 0x04, 0x00, 0x04, 0xee, 0x00, 0x00, 0x00, 0x04, 0x32, 0x2e,\n 0x33, 0x30, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x90, 0x00,\n]);\nconst OLD_FM_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: OLD_FM_RESPONSE_DATA_GOOD,\n});\n\ndescribe(\"GetOsVersionCommand\", () => {\n let command: GetOsVersionCommand;\n\n beforeEach(() => {\n command = new GetOsVersionCommand();\n });\n\n describe(\"name\", () => {\n it(\"should be 'getOsVersion'\", () => {\n expect(command.name).toBe(\"getOsVersion\");\n });\n });\n\n describe(\"getApdu\", () => {\n it(\"should return the GetOsVersion apdu\", () => {\n const apdu = command.getApdu();\n expect(apdu.getRawApdu()).toStrictEqual(GET_OS_VERSION_APDU);\n });\n });\n\n describe(\"parseResponse\", () => {\n describe(\"Nano X\", () => {\n it(\"should parse the LNX response\", () => {\n const parsed = command.parseResponse(\n LNX_RESPONSE_GOOD,\n DeviceModelId.NANO_X,\n );\n\n const expected = CommandResultFactory({\n data: getOsVersionCommandResponseMockBuilder(DeviceModelId.NANO_X),\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n\n it(\"should default parsed flags when the response contains empty SE flags\", () => {\n const parsed = command.parseResponse(\n LNX_RESPONSE_WITH_EMPTY_SE_FLAGS,\n DeviceModelId.NANO_X,\n );\n\n expect(isSuccessCommandResult(parsed)).toBe(true);\n if (!isSuccessCommandResult(parsed)) {\n return;\n }\n expect(parsed.data.seFlags).toStrictEqual(new Uint8Array());\n expect(parsed.data.secureElementFlags).toStrictEqual({\n isPinValidated: false,\n hasMcuSerialNumber: false,\n hasValidCertificate: false,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: false,\n isMcuCodeSigned: false,\n isInRecoveryMode: false,\n hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: 24,\n currentWordIndex: 0,\n onboardingState: OnboardingState.Unknown,\n });\n });\n\n it.each([\n [0x0b, OnboardingState.DeviceIsReady],\n [0x10, OnboardingState.RestoreWithRk],\n ] as const)(\n \"should parse SE flag byte 4 0x%s as %s\",\n (onboardingByte, onboardingState) => {\n const data = Uint8Array.from(LNX_RESPONSE_DATA_GOOD);\n data[14] = onboardingByte;\n const parsed = command.parseResponse(\n new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data,\n }),\n DeviceModelId.NANO_X,\n );\n\n expect(isSuccessCommandResult(parsed)).toBe(true);\n if (!isSuccessCommandResult(parsed)) {\n return;\n }\n expect(parsed.data.seFlags).toStrictEqual(\n new Uint8Array([0xe6, 0x00, 0x00, onboardingByte]),\n );\n expect(parsed.data.secureElementFlags.onboardingState).toBe(\n onboardingState,\n );\n },\n );\n });\n\n describe(\"Nano S Plus\", () => {\n it(\"should parse the LNSP response\", () => {\n const parsed = command.parseResponse(\n LNSP_RESPONSE_GOOD,\n DeviceModelId.NANO_SP,\n );\n\n const expected = CommandResultFactory({\n data: getOsVersionCommandResponseMockBuilder(DeviceModelId.NANO_SP),\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n });\n\n describe(\"Stax\", () => {\n it(\"should parse the STAX response\", () => {\n const parsed = command.parseResponse(\n STAX_RESPONSE_GOOD,\n DeviceModelId.STAX,\n );\n\n const expected = CommandResultFactory({\n data: getOsVersionCommandResponseMockBuilder(DeviceModelId.STAX),\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n });\n\n describe(\"Bootloader\", () => {\n it(\"should parse the bootloader response\", () => {\n const parsed = command.parseResponse(\n BL_RESPONSE_GOOD,\n DeviceModelId.STAX,\n );\n\n const expected = CommandResultFactory({\n data: {\n isBootloader: true,\n isOsu: false,\n targetId: 83951619,\n seTargetId: 855638020,\n seVersion: \"2.2.3\",\n seFlags: new Uint8Array([0xf4, 0xd8, 0xaa, 0x43]),\n mcuTargetId: 83951619,\n mcuSephVersion: \"\",\n mcuBootloaderVersion: \"1.16\",\n hwVersion: \"\",\n langId: undefined,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: true,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: false,\n isInRecoveryMode: false,\n hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: 18,\n currentWordIndex: 10,\n onboardingState: OnboardingState.Unknown,\n },\n },\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n });\n\n describe(\"Old firmware\", () => {\n it(\"should parse the old firmware response\", () => {\n const parsed = command.parseResponse(\n OLD_FM_RESPONSE_GOOD,\n DeviceModelId.NANO_X,\n );\n\n const expected = CommandResultFactory({\n data: {\n isBootloader: false,\n isOsu: false,\n targetId: 855638020,\n seTargetId: 855638020,\n seVersion: \"0.0.0\",\n seFlags: new Uint8Array(),\n mcuTargetId: undefined,\n mcuSephVersion: \"2.30\",\n mcuBootloaderVersion: \"\",\n hwVersion: \"00\",\n langId: undefined,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: true,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: 24,\n currentWordIndex: 0,\n onboardingState: OnboardingState.Unknown,\n },\n },\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n });\n\n describe(\"Error handling\", () => {\n it(\"should return an error if the response is not successful\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6e, 0x80]),\n data: Uint8Array.from([]),\n });\n const result = command.parseResponse(response, DeviceModelId.NANO_S);\n\n expect(isSuccessCommandResult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,KAAW,wBAAqB,CACpC,KAAM,CACJ,aAAc,GACd,MAAO,GACP,SAAU,UACV,WAAY,UACZ,UAAW,QACX,QAAS,IAAI,WACb,YAAa,OACb,eAAgB,OAChB,qBAAsB,GACtB,UAAW,KACX,OAAQ,OACR,aAAc,OACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,GAClB,iCAAkC,GAClC,iCAAkC,GAClC,cAAe,GACf,iBAAkB,EAClB,gBAAiB,kBAAgB,OACnC,CACF,CACF,CAAC,EAED,OAAOD,CAAM,EAAE,cAAcC,CAAQ,CACvC,CAAC,CACH,CAAC,EAED,SAAS,iBAAkB,IAAM,CAC/B,GAAG,2DAA4D,IAAM,CACnE,MAAMI,EAAW,IAAI,eAAa,CAChC,WAAY,WAAW,KAAK,CAAC,IAAM,GAAI,CAAC,EACxC,KAAM,WAAW,KAAK,CAAC,CAAC,CAC1B,CAAC,EACKC,EAASR,EAAQ,cAAcO,EAAU,gBAAc,MAAM,EAEnE,UAAO,0BAAuBC,CAAM,CAAC,EAAE,UAAU,CACnD,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import {\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { OnboardingState, SeedWordCount } from \"@api/device/SecureElementFlags\";\nimport { ApduResponse } from \"@api/device-session/ApduResponse\";\n\nimport { getOsVersionCommandResponseMockBuilder } from \"./__mocks__/GetOsVersionCommand\";\nimport { GetOsVersionCommand } from \"./GetOsVersionCommand\";\n\nconst GET_OS_VERSION_APDU = Uint8Array.from([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\nconst LNX_RESPONSE_DATA_GOOD = Uint8Array.from([\n 0x33, 0x00, 0x00, 0x04, 0x05, 0x32, 0x2e, 0x32, 0x2e, 0x33, 0x04, 0xe6, 0x00,\n 0x00, 0x00, 0x04, 0x32, 0x2e, 0x33, 0x30, 0x04, 0x31, 0x2e, 0x31, 0x36, 0x01,\n 0x00, 0x01, 0x00, 0x01, 0x00, 0x90, 0x00,\n]);\nconst LNX_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: LNX_RESPONSE_DATA_GOOD,\n});\n\nconst LNX_RESPONSE_WITH_EMPTY_SE_FLAGS = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: Uint8Array.from([\n 0x33, 0x00, 0x00, 0x04, 0x05, 0x32, 0x2e, 0x32, 0x2e, 0x33, 0x00, 0x04,\n 0x32, 0x2e, 0x33, 0x30, 0x04, 0x31, 0x2e, 0x31, 0x36, 0x01, 0x00, 0x01,\n 0x00, 0x01, 0x00, 0x90, 0x00,\n ]),\n});\n\nconst LNSP_REPONSE_DATA_GOOD = Uint8Array.from([\n 0x33, 0x10, 0x00, 0x04, 0x05, 0x31, 0x2e, 0x31, 0x2e, 0x31, 0x04, 0xe6, 0x00,\n 0x00, 0x00, 0x04, 0x34, 0x2e, 0x30, 0x33, 0x04, 0x33, 0x2e, 0x31, 0x32, 0x01,\n 0x00, 0x01, 0x00, 0x90, 0x00,\n]);\nconst LNSP_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: LNSP_REPONSE_DATA_GOOD,\n});\n\nconst STAX_RESPONSE_DATA_GOOD = Uint8Array.from([\n 0x33, 0x20, 0x00, 0x04, 0x05, 0x31, 0x2e, 0x33, 0x2e, 0x30, 0x04, 0xe6, 0x00,\n 0x00, 0x00, 0x04, 0x35, 0x2e, 0x32, 0x34, 0x04, 0x30, 0x2e, 0x34, 0x38, 0x01,\n 0x00, 0x01, 0x00, 0x90, 0x00,\n]);\nconst STAX_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: STAX_RESPONSE_DATA_GOOD,\n});\n\nconst BL_RESPONSE_DATA_GOOD = Uint8Array.from([\n 0x05, 0x01, 0x00, 0x03, 0x04, 0x31, 0x2e, 0x31, 0x36, 0x04, 0xf4, 0xd8, 0xaa,\n 0x43, 0x05, 0x32, 0x2e, 0x32, 0x2e, 0x33, 0x04, 0x33, 0x00, 0x00, 0x04, 0x90,\n 0x00,\n]);\nconst BL_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: BL_RESPONSE_DATA_GOOD,\n});\n\nconst OLD_FM_RESPONSE_DATA_GOOD = Uint8Array.from([\n 0x33, 0x00, 0x00, 0x04, 0x00, 0x04, 0xee, 0x00, 0x00, 0x00, 0x04, 0x32, 0x2e,\n 0x33, 0x30, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x90, 0x00,\n]);\nconst OLD_FM_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: OLD_FM_RESPONSE_DATA_GOOD,\n});\n\ndescribe(\"GetOsVersionCommand\", () => {\n let command: GetOsVersionCommand;\n\n beforeEach(() => {\n command = new GetOsVersionCommand();\n });\n\n describe(\"name\", () => {\n it(\"should be 'getOsVersion'\", () => {\n expect(command.name).toBe(\"getOsVersion\");\n });\n });\n\n describe(\"getApdu\", () => {\n it(\"should return the GetOsVersion apdu\", () => {\n const apdu = command.getApdu();\n expect(apdu.getRawApdu()).toStrictEqual(GET_OS_VERSION_APDU);\n });\n });\n\n describe(\"parseResponse\", () => {\n describe(\"Nano X\", () => {\n it(\"should parse the LNX response\", () => {\n const parsed = command.parseResponse(\n LNX_RESPONSE_GOOD,\n DeviceModelId.NANO_X,\n );\n\n const expected = CommandResultFactory({\n data: getOsVersionCommandResponseMockBuilder(DeviceModelId.NANO_X),\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n\n it(\"should default parsed flags when the response contains empty SE flags\", () => {\n const parsed = command.parseResponse(\n LNX_RESPONSE_WITH_EMPTY_SE_FLAGS,\n DeviceModelId.NANO_X,\n );\n\n expect(isSuccessCommandResult(parsed)).toBe(true);\n if (!isSuccessCommandResult(parsed)) {\n return;\n }\n expect(parsed.data.seFlags).toStrictEqual(new Uint8Array());\n expect(parsed.data.secureElementFlags).toStrictEqual({\n isPinValidated: false,\n hasMcuSerialNumber: false,\n hasValidCertificate: false,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: false,\n isMcuCodeSigned: false,\n isInRecoveryMode: false,\n hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: SeedWordCount.TwentyFour,\n currentWordIndex: 0,\n onboardingState: OnboardingState.Unknown,\n });\n });\n\n it.each([\n [0x0b, OnboardingState.DeviceIsReady],\n [0x10, OnboardingState.RestoreWithRk],\n ] as const)(\n \"should parse SE flag byte 4 0x%s as %s\",\n (onboardingByte, onboardingState) => {\n const data = Uint8Array.from(LNX_RESPONSE_DATA_GOOD);\n data[14] = onboardingByte;\n const parsed = command.parseResponse(\n new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data,\n }),\n DeviceModelId.NANO_X,\n );\n\n expect(isSuccessCommandResult(parsed)).toBe(true);\n if (!isSuccessCommandResult(parsed)) {\n return;\n }\n expect(parsed.data.seFlags).toStrictEqual(\n new Uint8Array([0xe6, 0x00, 0x00, onboardingByte]),\n );\n expect(parsed.data.secureElementFlags.onboardingState).toBe(\n onboardingState,\n );\n },\n );\n });\n\n describe(\"Nano S Plus\", () => {\n it(\"should parse the LNSP response\", () => {\n const parsed = command.parseResponse(\n LNSP_RESPONSE_GOOD,\n DeviceModelId.NANO_SP,\n );\n\n const expected = CommandResultFactory({\n data: getOsVersionCommandResponseMockBuilder(DeviceModelId.NANO_SP),\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n });\n\n describe(\"Stax\", () => {\n it(\"should parse the STAX response\", () => {\n const parsed = command.parseResponse(\n STAX_RESPONSE_GOOD,\n DeviceModelId.STAX,\n );\n\n const expected = CommandResultFactory({\n data: getOsVersionCommandResponseMockBuilder(DeviceModelId.STAX),\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n });\n\n describe(\"Bootloader\", () => {\n it(\"should parse the bootloader response\", () => {\n const parsed = command.parseResponse(\n BL_RESPONSE_GOOD,\n DeviceModelId.STAX,\n );\n\n const expected = CommandResultFactory({\n data: {\n isBootloader: true,\n isOsu: false,\n targetId: 83951619,\n seTargetId: 855638020,\n seVersion: \"2.2.3\",\n seFlags: new Uint8Array([0xf4, 0xd8, 0xaa, 0x43]),\n mcuTargetId: 83951619,\n mcuSephVersion: \"\",\n mcuBootloaderVersion: \"1.16\",\n hwVersion: \"\",\n langId: undefined,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: true,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: false,\n isInRecoveryMode: false,\n hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: SeedWordCount.Eighteen,\n currentWordIndex: 10,\n onboardingState: OnboardingState.Unknown,\n },\n },\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n });\n\n describe(\"Old firmware\", () => {\n it(\"should parse the old firmware response\", () => {\n const parsed = command.parseResponse(\n OLD_FM_RESPONSE_GOOD,\n DeviceModelId.NANO_X,\n );\n\n const expected = CommandResultFactory({\n data: {\n isBootloader: false,\n isOsu: false,\n targetId: 855638020,\n seTargetId: 855638020,\n seVersion: \"0.0.0\",\n seFlags: new Uint8Array(),\n mcuTargetId: undefined,\n mcuSephVersion: \"2.30\",\n mcuBootloaderVersion: \"\",\n hwVersion: \"00\",\n langId: undefined,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: true,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: SeedWordCount.TwentyFour,\n currentWordIndex: 0,\n onboardingState: OnboardingState.Unknown,\n },\n },\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n });\n\n describe(\"Error handling\", () => {\n it(\"should return an error if the response is not successful\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6e, 0x80]),\n data: Uint8Array.from([]),\n });\n const result = command.parseResponse(response, DeviceModelId.NANO_S);\n\n expect(isSuccessCommandResult(result)).toBeFalsy();\n });\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAGO,4CACPC,EAA8B,mCAC9BC,EAA+C,0CAC/CC,EAA6B,4CAE7BC,EAAuD,2CACvDA,EAAoC,iCAEpC,MAAMC,EAAsB,WAAW,KAAK,CAAC,IAAM,EAAM,EAAM,EAAM,CAAI,CAAC,EAEpEC,EAAyB,WAAW,KAAK,CAC7C,GAAM,EAAM,EAAM,EAAM,EAAM,GAAM,GAAM,GAAM,GAAM,GAAM,EAAM,IAAM,EACxE,EAAM,EAAM,EAAM,GAAM,GAAM,GAAM,GAAM,EAAM,GAAM,GAAM,GAAM,GAAM,EACxE,EAAM,EAAM,EAAM,EAAM,EAAM,IAAM,CACtC,CAAC,EACKC,EAAoB,IAAI,eAAa,CACzC,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,EACxC,KAAMD,CACR,CAAC,EAEKE,EAAmC,IAAI,eAAa,CACxD,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,EACxC,KAAM,WAAW,KAAK,CACpB,GAAM,EAAM,EAAM,EAAM,EAAM,GAAM,GAAM,GAAM,GAAM,GAAM,EAAM,EAClE,GAAM,GAAM,GAAM,GAAM,EAAM,GAAM,GAAM,GAAM,GAAM,EAAM,EAAM,EAClE,EAAM,EAAM,EAAM,IAAM,CAC1B,CAAC,CACH,CAAC,EAEKC,E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B,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,GAClB,iCAAkC,GAClC,iCAAkC,GAClC,cAAe,gBAAc,SAC7B,iBAAkB,GAClB,gBAAiB,kBAAgB,OACnC,CACF,CACF,CAAC,EAED,OAAOD,CAAM,EAAE,cAAcC,CAAQ,CACvC,CAAC,CACH,CAAC,EAED,SAAS,eAAgB,IAAM,CAC7B,GAAG,yCAA0C,IAAM,CACjD,MAAMD,EAASF,EAAQ,cACrBD,EACA,gBAAc,MAChB,EAEMI,KAAW,wBAAqB,CACpC,KAAM,CACJ,aAAc,GACd,MAAO,GACP,SAAU,UACV,WAAY,UACZ,UAAW,QACX,QAAS,IAAI,WACb,YAAa,OACb,eAAgB,OAChB,qBAAsB,GACtB,UAAW,KACX,OAAQ,OACR,aAAc,OACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,GAClB,iCAAkC,GAClC,iCAAkC,GAClC,cAAe,gBAAc,WAC7B,iBAAkB,EAClB,gBAAiB,kBAAgB,OACnC,CACF,CACF,CAAC,EAED,OAAOD,CAAM,EAAE,cAAcC,CAAQ,CACvC,CAAC,CACH,CAAC,EAED,SAAS,iBAAkB,IAAM,CAC/B,GAAG,2DAA4D,IAAM,CACnE,MAAMI,EAAW,IAAI,eAAa,CAChC,WAAY,WAAW,KAAK,CAAC,IAAM,GAAI,CAAC,EACxC,KAAM,WAAW,KAAK,CAAC,CAAC,CAC1B,CAAC,EACKC,EAASR,EAAQ,cAAcO,EAAU,gBAAc,MAAM,EAEnE,UAAO,0BAAuBC,CAAM,CAAC,EAAE,UAAU,CACnD,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_CommandResult", "import_DeviceModel", "import_SecureElementFlags", "import_ApduResponse", "import_GetOsVersionCommand", "GET_OS_VERSION_APDU", "LNX_RESPONSE_DATA_GOOD", "LNX_RESPONSE_GOOD", "LNX_RESPONSE_WITH_EMPTY_SE_FLAGS", "LNSP_REPONSE_DATA_GOOD", "LNSP_RESPONSE_GOOD", "STAX_RESPONSE_DATA_GOOD", "STAX_RESPONSE_GOOD", "BL_RESPONSE_DATA_GOOD", "BL_RESPONSE_GOOD", "OLD_FM_RESPONSE_DATA_GOOD", "OLD_FM_RESPONSE_GOOD", "command", "apdu", "parsed", "expected", "onboardingByte", "onboardingState", "data", "response", "result"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var h=(n,e)=>{for(var r in e)i(n,r,{get:e[r],enumerable:!0})},l=(n,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of c(e))!d.call(n,o)&&o!==r&&i(n,o,{get:()=>e[o],enumerable:!(s=a(e,o))||s.enumerable});return n};var u=n=>l(i({},"__esModule",{value:!0}),n);var S={};h(S,{SecureElementFlagsParser:()=>m});module.exports=u(S);var t=require("../../device/SecureElementFlags");const y={1:t.OnboardingState.WelcomeScreen1,2:t.OnboardingState.WelcomeScreen2,3:t.OnboardingState.WelcomeScreen3,4:t.OnboardingState.WelcomeScreen4,5:t.OnboardingState.WelcomeScreenReminder,6:t.OnboardingState.SetupChoice,7:t.OnboardingState.NewDevice,8:t.OnboardingState.ConfirmNewDevice,9:t.OnboardingState.RestoreRecoveryPhrase,10:t.OnboardingState.SafetyWarning,11:t.OnboardingState.DeviceIsReady,12:t.OnboardingState.ChooseName,13:t.OnboardingState.RestoreRecoverBackup,14:t.OnboardingState.SetupRestoreChoice,15:t.OnboardingState.OnboardingStatusCheck,16:t.OnboardingState.RestoreWithRk};class m{seFlags;constructor(e){this.seFlags=new Uint8Array(4),this.seFlags.set(e.subarray(0,this.seFlags.length))}generalDeviceState(){const e=this.seFlags[0]??0;return{isPinValidated:this._checkNthBitInByte(e,1),hasMcuSerialNumber:this._checkNthBitInByte(e,2),hasValidCertificate:this._checkNthBitInByte(e,3),isCustomAuthorityConnectionAllowed:this._checkNthBitInByte(e,4),isSecureConnectionAllowed:this._checkNthBitInByte(e,5),isOnboarded:this._checkNthBitInByte(e,6),isMcuCodeSigned:this._checkNthBitInByte(e,7),isInRecoveryMode:this._checkNthBitInByte(e,8)}}endorsementInformation(){const e=this.seFlags[1]??0;return{hasEndorsementCertificateInSlot1:(e&1)!==0,hasEndorsementCertificateInSlot2:(e&2)!==0}}wordsInformation(){const e=this.seFlags[2]??0,r=e>>5&3;return{numberOfWords:[24,18,12,void 0][r],currentWordIndex:e&31}}onboardingStatus(){const e=this.seFlags[3]??0;return{onboardingState:y[e]??t.OnboardingState.Unknown}}_checkNthBitInByte(e,r){return(e>>8-r&1)===1}}0&&(module.exports={SecureElementFlagsParser});
1
+ "use strict";var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var h=(n,e)=>{for(var r in e)i(n,r,{get:e[r],enumerable:!0})},l=(n,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of c(e))!d.call(n,o)&&o!==r&&i(n,o,{get:()=>e[o],enumerable:!(s=a(e,o))||s.enumerable});return n};var u=n=>l(i({},"__esModule",{value:!0}),n);var S={};h(S,{SecureElementFlagsParser:()=>m});module.exports=u(S);var t=require("../../device/SecureElementFlags");const y={1:t.OnboardingState.WelcomeScreen1,2:t.OnboardingState.WelcomeScreen2,3:t.OnboardingState.WelcomeScreen3,4:t.OnboardingState.WelcomeScreen4,5:t.OnboardingState.WelcomeScreenReminder,6:t.OnboardingState.SetupChoice,7:t.OnboardingState.NewDevice,8:t.OnboardingState.ConfirmNewDevice,9:t.OnboardingState.RestoreRecoveryPhrase,10:t.OnboardingState.SafetyWarning,11:t.OnboardingState.DeviceIsReady,12:t.OnboardingState.ChooseName,13:t.OnboardingState.RestoreRecoverBackup,14:t.OnboardingState.SetupRestoreChoice,15:t.OnboardingState.OnboardingStatusCheck,16:t.OnboardingState.RestoreWithRk};class m{seFlags;constructor(e){this.seFlags=new Uint8Array(4),this.seFlags.set(e.subarray(0,this.seFlags.length))}generalDeviceState(){const e=this.seFlags[0]??0;return{isPinValidated:this._checkNthBitInByte(e,1),hasMcuSerialNumber:this._checkNthBitInByte(e,2),hasValidCertificate:this._checkNthBitInByte(e,3),isCustomAuthorityConnectionAllowed:this._checkNthBitInByte(e,4),isSecureConnectionAllowed:this._checkNthBitInByte(e,5),isOnboarded:this._checkNthBitInByte(e,6),isMcuCodeSigned:this._checkNthBitInByte(e,7),isInRecoveryMode:this._checkNthBitInByte(e,8)}}endorsementInformation(){const e=this.seFlags[1]??0;return{hasEndorsementCertificateInSlot1:(e&1)!==0,hasEndorsementCertificateInSlot2:(e&2)!==0}}wordsInformation(){const e=this.seFlags[2]??0,r=e>>5&3;return{numberOfWords:[t.SeedWordCount.TwentyFour,t.SeedWordCount.Eighteen,t.SeedWordCount.Twelve,void 0][r],currentWordIndex:e&31}}onboardingStatus(){const e=this.seFlags[3]??0;return{onboardingState:y[e]??t.OnboardingState.Unknown}}_checkNthBitInByte(e,r){return(e>>8-r&1)===1}}0&&(module.exports={SecureElementFlagsParser});
2
2
  //# sourceMappingURL=SecureElementFlagsParser.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/command/os/SecureElementFlagsParser.ts"],
4
- "sourcesContent": ["import {\n type DeviceGeneralState,\n type EndorsementInformation,\n OnboardingState,\n type OnboardingStatus,\n type SeedWordCount,\n type WordsInformation,\n} from \"@api/device/SecureElementFlags\";\n\nconst ONBOARDING_STATE_BY_VALUE: Readonly<Record<number, OnboardingState>> = {\n 0x01: OnboardingState.WelcomeScreen1,\n 0x02: OnboardingState.WelcomeScreen2,\n 0x03: OnboardingState.WelcomeScreen3,\n 0x04: OnboardingState.WelcomeScreen4,\n 0x05: OnboardingState.WelcomeScreenReminder,\n 0x06: OnboardingState.SetupChoice,\n 0x07: OnboardingState.NewDevice,\n 0x08: OnboardingState.ConfirmNewDevice,\n 0x09: OnboardingState.RestoreRecoveryPhrase,\n 0x0a: OnboardingState.SafetyWarning,\n 0x0b: OnboardingState.DeviceIsReady,\n 0x0c: OnboardingState.ChooseName,\n 0x0d: OnboardingState.RestoreRecoverBackup,\n 0x0e: OnboardingState.SetupRestoreChoice,\n 0x0f: OnboardingState.OnboardingStatusCheck,\n 0x10: OnboardingState.RestoreWithRk,\n};\n\n/**\n * Secure element flags parser class.\n */\nexport class SecureElementFlagsParser {\n private readonly seFlags: Uint8Array;\n\n /**\n * Creates an instance of SecureElementFlags parser.\n * @param seFlags - The secure element flags as an Uint8Array, it comes from the response of the GetOsVersionCommand.\n */\n constructor(seFlags: Uint8Array) {\n this.seFlags = new Uint8Array(4);\n this.seFlags.set(seFlags.subarray(0, this.seFlags.length));\n }\n\n /**\n * Retrieves the general device state based on the secure element flags, which is the first byte of the flags.\n * @returns {DeviceGeneralState}\n */\n generalDeviceState(): DeviceGeneralState {\n const firstByte = this.seFlags[0] ?? 0x00;\n\n return {\n isPinValidated: this._checkNthBitInByte(firstByte, 1),\n hasMcuSerialNumber: this._checkNthBitInByte(firstByte, 2),\n hasValidCertificate: this._checkNthBitInByte(firstByte, 3),\n isCustomAuthorityConnectionAllowed: this._checkNthBitInByte(firstByte, 4),\n isSecureConnectionAllowed: this._checkNthBitInByte(firstByte, 5),\n isOnboarded: this._checkNthBitInByte(firstByte, 6),\n isMcuCodeSigned: this._checkNthBitInByte(firstByte, 7),\n isInRecoveryMode: this._checkNthBitInByte(firstByte, 8),\n };\n }\n\n /**\n * Retrieves the endorsement information based on the secure element flags, which is the second byte of the flags.\n * @returns {EndorsementInformation}\n */\n endorsementInformation(): EndorsementInformation {\n const secondByte = this.seFlags[1] ?? 0x00;\n\n return {\n hasEndorsementCertificateInSlot1: (secondByte & 0x01) !== 0,\n hasEndorsementCertificateInSlot2: (secondByte & 0x02) !== 0,\n };\n }\n\n /**\n * Retrieves the words information based on the secure element flags, which is the third byte of the flags.\n * @returns {WordsInformation}\n */\n wordsInformation(): WordsInformation {\n const thirdByte = this.seFlags[2] ?? 0x00;\n const wordCountValue = (thirdByte >> 5) & 0x03;\n const wordCounts: ReadonlyArray<SeedWordCount | undefined> = [\n 24,\n 18,\n 12,\n undefined,\n ];\n\n return {\n numberOfWords: wordCounts[wordCountValue],\n currentWordIndex: thirdByte & 0x1f,\n };\n }\n\n /**\n * Retrieves the onboarding status based on the secure element flags, which is the fourth byte of the flags.\n * @returns {OnboardingStatus}\n */\n onboardingStatus(): OnboardingStatus {\n const value = this.seFlags[3] ?? 0x00;\n\n return {\n onboardingState:\n ONBOARDING_STATE_BY_VALUE[value] ?? OnboardingState.Unknown,\n };\n }\n\n /**\n * Check the nth bit in a byte, returns true if the bit is set, false otherwise.\n * @param byte - The byte to check.\n * @param n - The bit number to check.\n * @returns {boolean} - True if the bit is set, false otherwise.\n */\n _checkNthBitInByte(byte: number, n: number): boolean {\n return ((byte >> (8 - n)) & 1) === 1;\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAOO,0CAEP,MAAMC,EAAuE,CAC3E,EAAM,kBAAgB,eACtB,EAAM,kBAAgB,eACtB,EAAM,kBAAgB,eACtB,EAAM,kBAAgB,eACtB,EAAM,kBAAgB,sBACtB,EAAM,kBAAgB,YACtB,EAAM,kBAAgB,UACtB,EAAM,kBAAgB,iBACtB,EAAM,kBAAgB,sBACtB,GAAM,kBAAgB,cACtB,GAAM,kBAAgB,cACtB,GAAM,kBAAgB,WACtB,GAAM,kBAAgB,qBACtB,GAAM,kBAAgB,mBACtB,GAAM,kBAAgB,sBACtB,GAAM,kBAAgB,aACxB,EAKO,MAAMH,CAAyB,CACnB,QAMjB,YAAYI,EAAqB,CAC/B,KAAK,QAAU,IAAI,WAAW,CAAC,EAC/B,KAAK,QAAQ,IAAIA,EAAQ,SAAS,EAAG,KAAK,QAAQ,MAAM,CAAC,CAC3D,CAMA,oBAAyC,CACvC,MAAMC,EAAY,KAAK,QAAQ,CAAC,GAAK,EAErC,MAAO,CACL,eAAgB,KAAK,mBAAmBA,EAAW,CAAC,EACpD,mBAAoB,KAAK,mBAAmBA,EAAW,CAAC,EACxD,oBAAqB,KAAK,mBAAmBA,EAAW,CAAC,EACzD,mCAAoC,KAAK,mBAAmBA,EAAW,CAAC,EACxE,0BAA2B,KAAK,mBAAmBA,EAAW,CAAC,EAC/D,YAAa,KAAK,mBAAmBA,EAAW,CAAC,EACjD,gBAAiB,KAAK,mBAAmBA,EAAW,CAAC,EACrD,iBAAkB,KAAK,mBAAmBA,EAAW,CAAC,CACxD,CACF,CAMA,wBAAiD,CAC/C,MAAMC,EAAa,KAAK,QAAQ,CAAC,GAAK,EAEtC,MAAO,CACL,kCAAmCA,EAAa,KAAU,EAC1D,kCAAmCA,EAAa,KAAU,CAC5D,CACF,CAMA,kBAAqC,CACnC,MAAMC,EAAY,KAAK,QAAQ,CAAC,GAAK,EAC/BC,EAAkBD,GAAa,EAAK,EAQ1C,MAAO,CACL,cAR2D,CAC3D,GACA,GACA,GACA,MACF,EAG4BC,CAAc,EACxC,iBAAkBD,EAAY,EAChC,CACF,CAMA,kBAAqC,CACnC,MAAME,EAAQ,KAAK,QAAQ,CAAC,GAAK,EAEjC,MAAO,CACL,gBACEN,EAA0BM,CAAK,GAAK,kBAAgB,OACxD,CACF,CAQA,mBAAmBC,EAAcC,EAAoB,CACnD,OAASD,GAAS,EAAIC,EAAM,KAAO,CACrC,CACF",
4
+ "sourcesContent": ["import {\n type DeviceGeneralState,\n type EndorsementInformation,\n OnboardingState,\n type OnboardingStatus,\n SeedWordCount,\n type WordsInformation,\n} from \"@api/device/SecureElementFlags\";\n\nconst ONBOARDING_STATE_BY_VALUE: Readonly<Record<number, OnboardingState>> = {\n 0x01: OnboardingState.WelcomeScreen1,\n 0x02: OnboardingState.WelcomeScreen2,\n 0x03: OnboardingState.WelcomeScreen3,\n 0x04: OnboardingState.WelcomeScreen4,\n 0x05: OnboardingState.WelcomeScreenReminder,\n 0x06: OnboardingState.SetupChoice,\n 0x07: OnboardingState.NewDevice,\n 0x08: OnboardingState.ConfirmNewDevice,\n 0x09: OnboardingState.RestoreRecoveryPhrase,\n 0x0a: OnboardingState.SafetyWarning,\n 0x0b: OnboardingState.DeviceIsReady,\n 0x0c: OnboardingState.ChooseName,\n 0x0d: OnboardingState.RestoreRecoverBackup,\n 0x0e: OnboardingState.SetupRestoreChoice,\n 0x0f: OnboardingState.OnboardingStatusCheck,\n 0x10: OnboardingState.RestoreWithRk,\n};\n\n/**\n * Secure element flags parser class.\n */\nexport class SecureElementFlagsParser {\n private readonly seFlags: Uint8Array;\n\n /**\n * Creates an instance of SecureElementFlags parser.\n * @param seFlags - The secure element flags as an Uint8Array, it comes from the response of the GetOsVersionCommand.\n */\n constructor(seFlags: Uint8Array) {\n this.seFlags = new Uint8Array(4);\n this.seFlags.set(seFlags.subarray(0, this.seFlags.length));\n }\n\n /**\n * Retrieves the general device state based on the secure element flags, which is the first byte of the flags.\n * @returns {DeviceGeneralState}\n */\n generalDeviceState(): DeviceGeneralState {\n const firstByte = this.seFlags[0] ?? 0x00;\n\n return {\n isPinValidated: this._checkNthBitInByte(firstByte, 1),\n hasMcuSerialNumber: this._checkNthBitInByte(firstByte, 2),\n hasValidCertificate: this._checkNthBitInByte(firstByte, 3),\n isCustomAuthorityConnectionAllowed: this._checkNthBitInByte(firstByte, 4),\n isSecureConnectionAllowed: this._checkNthBitInByte(firstByte, 5),\n isOnboarded: this._checkNthBitInByte(firstByte, 6),\n isMcuCodeSigned: this._checkNthBitInByte(firstByte, 7),\n isInRecoveryMode: this._checkNthBitInByte(firstByte, 8),\n };\n }\n\n /**\n * Retrieves the endorsement information based on the secure element flags, which is the second byte of the flags.\n * @returns {EndorsementInformation}\n */\n endorsementInformation(): EndorsementInformation {\n const secondByte = this.seFlags[1] ?? 0x00;\n\n return {\n hasEndorsementCertificateInSlot1: (secondByte & 0x01) !== 0,\n hasEndorsementCertificateInSlot2: (secondByte & 0x02) !== 0,\n };\n }\n\n /**\n * Retrieves the words information based on the secure element flags, which is the third byte of the flags.\n * @returns {WordsInformation}\n */\n wordsInformation(): WordsInformation {\n const thirdByte = this.seFlags[2] ?? 0x00;\n const wordCountValue = (thirdByte >> 5) & 0x03;\n const wordCounts: ReadonlyArray<SeedWordCount | undefined> = [\n SeedWordCount.TwentyFour,\n SeedWordCount.Eighteen,\n SeedWordCount.Twelve,\n undefined,\n ];\n\n return {\n numberOfWords: wordCounts[wordCountValue],\n currentWordIndex: thirdByte & 0x1f,\n };\n }\n\n /**\n * Retrieves the onboarding status based on the secure element flags, which is the fourth byte of the flags.\n * @returns {OnboardingStatus}\n */\n onboardingStatus(): OnboardingStatus {\n const value = this.seFlags[3] ?? 0x00;\n\n return {\n onboardingState:\n ONBOARDING_STATE_BY_VALUE[value] ?? OnboardingState.Unknown,\n };\n }\n\n /**\n * Check the nth bit in a byte, returns true if the bit is set, false otherwise.\n * @param byte - The byte to check.\n * @param n - The bit number to check.\n * @returns {boolean} - True if the bit is set, false otherwise.\n */\n _checkNthBitInByte(byte: number, n: number): boolean {\n return ((byte >> (8 - n)) & 1) === 1;\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAOO,0CAEP,MAAMC,EAAuE,CAC3E,EAAM,kBAAgB,eACtB,EAAM,kBAAgB,eACtB,EAAM,kBAAgB,eACtB,EAAM,kBAAgB,eACtB,EAAM,kBAAgB,sBACtB,EAAM,kBAAgB,YACtB,EAAM,kBAAgB,UACtB,EAAM,kBAAgB,iBACtB,EAAM,kBAAgB,sBACtB,GAAM,kBAAgB,cACt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AAIC,EAAM,KAAO,CACrC,CACF",
6
6
  "names": ["SecureElementFlagsParser_exports", "__export", "SecureElementFlagsParser", "__toCommonJS", "import_SecureElementFlags", "ONBOARDING_STATE_BY_VALUE", "seFlags", "firstByte", "secondByte", "thirdByte", "wordCountValue", "value", "byte", "n"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("vitest"),t=require("../../device/SecureElementFlags"),a=require("./SecureElementFlagsParser");(0,e.describe)("SecureElementFlagsParser",()=>{(0,e.it)("should default missing secure element flag bytes to zero",()=>{const r=new a.SecureElementFlagsParser(new Uint8Array([224]));(0,e.expect)(r.generalDeviceState().isPinValidated).toBe(!0),(0,e.expect)(r.endorsementInformation()).toEqual({hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1}),(0,e.expect)(r.wordsInformation()).toEqual({numberOfWords:24,currentWordIndex:0}),(0,e.expect)(r.onboardingStatus()).toEqual({onboardingState:t.OnboardingState.Unknown})}),(0,e.it)("should correctly parse the general device state",()=>{const r=new Uint8Array([170,0,0,0]),n=new a.SecureElementFlagsParser(r),o={isPinValidated:!0,hasMcuSerialNumber:!1,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!0,isOnboarded:!1,isMcuCodeSigned:!0,isInRecoveryMode:!1};(0,e.expect)(n.generalDeviceState()).toEqual(o)}),e.it.each([[0,!1,!1],[1,!0,!1],[2,!1,!0],[3,!0,!0]])("should parse endorsement information value %#",(r,n,o)=>{const s=new a.SecureElementFlagsParser(new Uint8Array([0,r,0,0]));(0,e.expect)(s.endorsementInformation()).toEqual({hasEndorsementCertificateInSlot1:n,hasEndorsementCertificateInSlot2:o})}),e.it.each([[0,24,0],[37,18,5],[81,12,17],[127,void 0,31]])("should parse words information value %#",(r,n,o)=>{const s=new a.SecureElementFlagsParser(new Uint8Array([0,0,r,0]));(0,e.expect)(s.wordsInformation()).toEqual({numberOfWords:n,currentWordIndex:o})}),(0,e.it)("should ignore the reserved most-significant bit in words information",()=>{const r=new a.SecureElementFlagsParser(new Uint8Array([0,0,165,0]));(0,e.expect)(r.wordsInformation()).toEqual({numberOfWords:18,currentWordIndex:5})}),(0,e.describe)("onboardingStatus",()=>{e.it.each([[0,t.OnboardingState.Unknown],[1,t.OnboardingState.WelcomeScreen1],[2,t.OnboardingState.WelcomeScreen2],[3,t.OnboardingState.WelcomeScreen3],[4,t.OnboardingState.WelcomeScreen4],[5,t.OnboardingState.WelcomeScreenReminder],[6,t.OnboardingState.SetupChoice],[7,t.OnboardingState.NewDevice],[8,t.OnboardingState.ConfirmNewDevice],[9,t.OnboardingState.RestoreRecoveryPhrase],[10,t.OnboardingState.SafetyWarning],[11,t.OnboardingState.DeviceIsReady],[12,t.OnboardingState.ChooseName],[13,t.OnboardingState.RestoreRecoverBackup],[14,t.OnboardingState.SetupRestoreChoice],[15,t.OnboardingState.OnboardingStatusCheck],[16,t.OnboardingState.RestoreWithRk],[17,t.OnboardingState.Unknown],[67,t.OnboardingState.Unknown],[255,t.OnboardingState.Unknown]])("should parse byte 0x%s as %s",(r,n)=>{const o=new a.SecureElementFlagsParser(new Uint8Array([0,0,0,r]));(0,e.expect)(o.onboardingStatus()).toEqual({onboardingState:n})}),(0,e.it)("should always expose a defined onboarding state so it survives serialization",()=>{const n=new a.SecureElementFlagsParser(new Uint8Array([0,0,0,0])).onboardingStatus();(0,e.expect)(n.onboardingState).toBe(t.OnboardingState.Unknown),(0,e.expect)(JSON.parse(JSON.stringify(n))).toEqual({onboardingState:t.OnboardingState.Unknown})}),(0,e.it)("should map every documented GET VERSION byte to a distinct OnboardingState",()=>{const n=Array.from({length:16},(o,s)=>s+1).map(o=>new a.SecureElementFlagsParser(new Uint8Array([0,0,0,o])).onboardingStatus().onboardingState);(0,e.expect)(n).toEqual(Object.values(t.OnboardingState).filter(o=>o!==t.OnboardingState.Unknown))})}),(0,e.it)("should correctly check the nth bit in a byte",()=>{const r=new Uint8Array([0,0,0,0]),n=new a.SecureElementFlagsParser(r),o=170;(0,e.expect)(n._checkNthBitInByte(o,1)).toBe(!0),(0,e.expect)(n._checkNthBitInByte(o,2)).toBe(!1),(0,e.expect)(n._checkNthBitInByte(o,3)).toBe(!0),(0,e.expect)(n._checkNthBitInByte(o,4)).toBe(!1),(0,e.expect)(n._checkNthBitInByte(o,5)).toBe(!0),(0,e.expect)(n._checkNthBitInByte(o,6)).toBe(!1),(0,e.expect)(n._checkNthBitInByte(o,7)).toBe(!0),(0,e.expect)(n._checkNthBitInByte(o,8)).toBe(!1)})});
1
+ "use strict";var e=require("vitest"),t=require("../../device/SecureElementFlags"),a=require("./SecureElementFlagsParser");(0,e.describe)("SecureElementFlagsParser",()=>{(0,e.it)("should default missing secure element flag bytes to zero",()=>{const o=new a.SecureElementFlagsParser(new Uint8Array([224]));(0,e.expect)(o.generalDeviceState().isPinValidated).toBe(!0),(0,e.expect)(o.endorsementInformation()).toEqual({hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1}),(0,e.expect)(o.wordsInformation()).toEqual({numberOfWords:t.SeedWordCount.TwentyFour,currentWordIndex:0}),(0,e.expect)(o.onboardingStatus()).toEqual({onboardingState:t.OnboardingState.Unknown})}),(0,e.it)("should correctly parse the general device state",()=>{const o=new Uint8Array([170,0,0,0]),n=new a.SecureElementFlagsParser(o),r={isPinValidated:!0,hasMcuSerialNumber:!1,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!0,isOnboarded:!1,isMcuCodeSigned:!0,isInRecoveryMode:!1};(0,e.expect)(n.generalDeviceState()).toEqual(r)}),e.it.each([[0,!1,!1],[1,!0,!1],[2,!1,!0],[3,!0,!0]])("should parse endorsement information value %#",(o,n,r)=>{const s=new a.SecureElementFlagsParser(new Uint8Array([0,o,0,0]));(0,e.expect)(s.endorsementInformation()).toEqual({hasEndorsementCertificateInSlot1:n,hasEndorsementCertificateInSlot2:r})}),e.it.each([[0,t.SeedWordCount.TwentyFour,0],[37,t.SeedWordCount.Eighteen,5],[81,t.SeedWordCount.Twelve,17],[127,void 0,31]])("should parse words information value %#",(o,n,r)=>{const s=new a.SecureElementFlagsParser(new Uint8Array([0,0,o,0]));(0,e.expect)(s.wordsInformation()).toEqual({numberOfWords:n,currentWordIndex:r})}),(0,e.it)("should ignore the reserved most-significant bit in words information",()=>{const o=new a.SecureElementFlagsParser(new Uint8Array([0,0,165,0]));(0,e.expect)(o.wordsInformation()).toEqual({numberOfWords:t.SeedWordCount.Eighteen,currentWordIndex:5})}),(0,e.it)("should expose numeric seed word counts so they survive serialization",()=>{const n=new a.SecureElementFlagsParser(new Uint8Array([0,0,0,0])).wordsInformation();(0,e.expect)(n.numberOfWords).toBe(t.SeedWordCount.TwentyFour),(0,e.expect)(JSON.parse(JSON.stringify(n))).toEqual({numberOfWords:t.SeedWordCount.TwentyFour,currentWordIndex:0})}),(0,e.it)("should keep SeedWordCount as 12 | 18 | 24, not an open numeric enum",()=>{const o=t.SeedWordCount.Twelve;(0,e.expect)(o).toBe(12),(0,e.expect)(typeof 15).toBe("number")}),(0,e.describe)("onboardingStatus",()=>{e.it.each([[0,t.OnboardingState.Unknown],[1,t.OnboardingState.WelcomeScreen1],[2,t.OnboardingState.WelcomeScreen2],[3,t.OnboardingState.WelcomeScreen3],[4,t.OnboardingState.WelcomeScreen4],[5,t.OnboardingState.WelcomeScreenReminder],[6,t.OnboardingState.SetupChoice],[7,t.OnboardingState.NewDevice],[8,t.OnboardingState.ConfirmNewDevice],[9,t.OnboardingState.RestoreRecoveryPhrase],[10,t.OnboardingState.SafetyWarning],[11,t.OnboardingState.DeviceIsReady],[12,t.OnboardingState.ChooseName],[13,t.OnboardingState.RestoreRecoverBackup],[14,t.OnboardingState.SetupRestoreChoice],[15,t.OnboardingState.OnboardingStatusCheck],[16,t.OnboardingState.RestoreWithRk],[17,t.OnboardingState.Unknown],[67,t.OnboardingState.Unknown],[255,t.OnboardingState.Unknown]])("should parse byte 0x%s as %s",(o,n)=>{const r=new a.SecureElementFlagsParser(new Uint8Array([0,0,0,o]));(0,e.expect)(r.onboardingStatus()).toEqual({onboardingState:n})}),(0,e.it)("should always expose a defined onboarding state so it survives serialization",()=>{const n=new a.SecureElementFlagsParser(new Uint8Array([0,0,0,0])).onboardingStatus();(0,e.expect)(n.onboardingState).toBe(t.OnboardingState.Unknown),(0,e.expect)(JSON.parse(JSON.stringify(n))).toEqual({onboardingState:t.OnboardingState.Unknown})}),(0,e.it)("should map every documented GET VERSION byte to a distinct OnboardingState",()=>{const n=Array.from({length:16},(r,s)=>s+1).map(r=>new a.SecureElementFlagsParser(new Uint8Array([0,0,0,r])).onboardingStatus().onboardingState);(0,e.expect)(n).toEqual(Object.values(t.OnboardingState).filter(r=>r!==t.OnboardingState.Unknown))})}),(0,e.it)("should correctly check the nth bit in a byte",()=>{const o=new Uint8Array([0,0,0,0]),n=new a.SecureElementFlagsParser(o),r=170;(0,e.expect)(n._checkNthBitInByte(r,1)).toBe(!0),(0,e.expect)(n._checkNthBitInByte(r,2)).toBe(!1),(0,e.expect)(n._checkNthBitInByte(r,3)).toBe(!0),(0,e.expect)(n._checkNthBitInByte(r,4)).toBe(!1),(0,e.expect)(n._checkNthBitInByte(r,5)).toBe(!0),(0,e.expect)(n._checkNthBitInByte(r,6)).toBe(!1),(0,e.expect)(n._checkNthBitInByte(r,7)).toBe(!0),(0,e.expect)(n._checkNthBitInByte(r,8)).toBe(!1)})});
2
2
  //# sourceMappingURL=SecureElementFlagsParser.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/command/os/SecureElementFlagsParser.test.ts"],
4
- "sourcesContent": ["import { describe, expect, it } from \"vitest\";\n\nimport {\n type DeviceGeneralState,\n OnboardingState,\n} from \"@api/device/SecureElementFlags\";\n\nimport { SecureElementFlagsParser } from \"./SecureElementFlagsParser\";\n\ndescribe(\"SecureElementFlagsParser\", () => {\n it(\"should default missing secure element flag bytes to zero\", () => {\n const parser = new SecureElementFlagsParser(new Uint8Array([0xe0]));\n\n expect(parser.generalDeviceState().isPinValidated).toBe(true);\n expect(parser.endorsementInformation()).toEqual({\n hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n });\n expect(parser.wordsInformation()).toEqual({\n numberOfWords: 24,\n currentWordIndex: 0,\n });\n expect(parser.onboardingStatus()).toEqual({\n onboardingState: OnboardingState.Unknown,\n });\n });\n\n it(\"should correctly parse the general device state\", () => {\n const seFlags = new Uint8Array([0b10101010, 0x00, 0x00, 0x00]);\n const parser = new SecureElementFlagsParser(seFlags);\n const expectedState: DeviceGeneralState = {\n isPinValidated: true,\n hasMcuSerialNumber: false,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: true,\n isOnboarded: false,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n };\n expect(parser.generalDeviceState()).toEqual(expectedState);\n });\n\n it.each([\n [0x00, false, false],\n [0x01, true, false],\n [0x02, false, true],\n [0x03, true, true],\n ])(\n \"should parse endorsement information value %#\",\n (value, hasSlot1, hasSlot2) => {\n const parser = new SecureElementFlagsParser(\n new Uint8Array([0x00, value, 0x00, 0x00]),\n );\n\n expect(parser.endorsementInformation()).toEqual({\n hasEndorsementCertificateInSlot1: hasSlot1,\n hasEndorsementCertificateInSlot2: hasSlot2,\n });\n },\n );\n\n it.each([\n [0b00000000, 24, 0],\n [0b00100101, 18, 5],\n [0b01010001, 12, 17],\n [0b01111111, undefined, 31],\n ])(\n \"should parse words information value %#\",\n (value, numberOfWords, currentWordIndex) => {\n const parser = new SecureElementFlagsParser(\n new Uint8Array([0x00, 0x00, value, 0x00]),\n );\n\n expect(parser.wordsInformation()).toEqual({\n numberOfWords,\n currentWordIndex,\n });\n },\n );\n\n it(\"should ignore the reserved most-significant bit in words information\", () => {\n const parser = new SecureElementFlagsParser(\n new Uint8Array([0x00, 0x00, 0b10100101, 0x00]),\n );\n\n expect(parser.wordsInformation()).toEqual({\n numberOfWords: 18,\n currentWordIndex: 5,\n });\n });\n\n describe(\"onboardingStatus\", () => {\n it.each([\n [0x00, OnboardingState.Unknown],\n [0x01, OnboardingState.WelcomeScreen1],\n [0x02, OnboardingState.WelcomeScreen2],\n [0x03, OnboardingState.WelcomeScreen3],\n [0x04, OnboardingState.WelcomeScreen4],\n [0x05, OnboardingState.WelcomeScreenReminder],\n [0x06, OnboardingState.SetupChoice],\n [0x07, OnboardingState.NewDevice],\n [0x08, OnboardingState.ConfirmNewDevice],\n [0x09, OnboardingState.RestoreRecoveryPhrase],\n [0x0a, OnboardingState.SafetyWarning],\n [0x0b, OnboardingState.DeviceIsReady],\n [0x0c, OnboardingState.ChooseName],\n [0x0d, OnboardingState.RestoreRecoverBackup],\n [0x0e, OnboardingState.SetupRestoreChoice],\n [0x0f, OnboardingState.OnboardingStatusCheck],\n [0x10, OnboardingState.RestoreWithRk],\n [0x11, OnboardingState.Unknown],\n [0x43, OnboardingState.Unknown],\n [0xff, OnboardingState.Unknown],\n ] as const)(\"should parse byte 0x%s as %s\", (value, onboardingState) => {\n const parser = new SecureElementFlagsParser(\n new Uint8Array([0x00, 0x00, 0x00, value]),\n );\n\n expect(parser.onboardingStatus()).toEqual({ onboardingState });\n });\n\n it(\"should always expose a defined onboarding state so it survives serialization\", () => {\n const parser = new SecureElementFlagsParser(\n new Uint8Array([0x00, 0x00, 0x00, 0x00]),\n );\n\n const status = parser.onboardingStatus();\n\n expect(status.onboardingState).toBe(OnboardingState.Unknown);\n expect(JSON.parse(JSON.stringify(status))).toEqual({\n onboardingState: OnboardingState.Unknown,\n });\n });\n\n it(\"should map every documented GET VERSION byte to a distinct OnboardingState\", () => {\n const documentedBytes = Array.from(\n { length: 0x10 },\n (_, index) => index + 1,\n );\n const parsedStates = documentedBytes.map(\n (value) =>\n new SecureElementFlagsParser(\n new Uint8Array([0x00, 0x00, 0x00, value]),\n ).onboardingStatus().onboardingState,\n );\n\n expect(parsedStates).toEqual(\n Object.values(OnboardingState).filter(\n (state) => state !== OnboardingState.Unknown,\n ),\n );\n });\n });\n\n it(\"should correctly check the nth bit in a byte\", () => {\n const seFlags = new Uint8Array([0x00, 0x00, 0x00, 0x00]);\n const parser = new SecureElementFlagsParser(seFlags);\n const byte = 0b10101010;\n expect(parser._checkNthBitInByte(byte, 1)).toBe(true);\n expect(parser._checkNthBitInByte(byte, 2)).toBe(false);\n expect(parser._checkNthBitInByte(byte, 3)).toBe(true);\n expect(parser._checkNthBitInByte(byte, 4)).toBe(false);\n expect(parser._checkNthBitInByte(byte, 5)).toBe(true);\n expect(parser._checkNthBitInByte(byte, 6)).toBe(false);\n expect(parser._checkNthBitInByte(byte, 7)).toBe(true);\n expect(parser._checkNthBitInByte(byte, 8)).toBe(false);\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAAqC,kBAErCC,EAGO,0CAEPC,EAAyC,yCAEzC,YAAS,2BAA4B,IAAM,IACzC,MAAG,2DAA4D,IAAM,CACnE,MAAMC,EAAS,IAAI,2BAAyB,IAAI,WAAW,CAAC,GAAI,CAAC,CAAC,KAElE,UAAOA,EAAO,mBAAmB,EAAE,cAAc,EAAE,KAAK,EAAI,KAC5D,UAAOA,EAAO,uBAAuB,CAAC,EAAE,QAAQ,CAC9C,iCAAkC,GAClC,iCAAkC,EACpC,CAAC,KACD,UAAOA,EAAO,iBAAiB,CAAC,EAAE,QAAQ,CACxC,cAAe,GACf,iBAAkB,CACpB,CAAC,KACD,UAAOA,EAAO,iBAAiB,CAAC,EAAE,QAAQ,CACxC,gBAAiB,kBAAgB,OACnC,CAAC,CACH,CAAC,KAED,MAAG,kDAAmD,IAAM,CAC1D,MAAMC,EAAU,IAAI,WAAW,CAAC,IAAY,EAAM,EAAM,CAAI,CAAC,EACvDD,EAAS,IAAI,2BAAyBC,CAAO,EAC7CC,EAAoC,CACxC,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iB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CAAC,CAC1C,EAAE,iBAAiB,EAAE,eACzB,KAEA,UAAOO,CAAY,EAAE,QACnB,OAAO,OAAO,iBAAe,EAAE,OAC5BG,GAAUA,IAAU,kBAAgB,OACvC,CACF,CACF,CAAC,CACH,CAAC,KAED,MAAG,+CAAgD,IAAM,CACvD,MAAMZ,EAAU,IAAI,WAAW,CAAC,EAAM,EAAM,EAAM,CAAI,CAAC,EACjDD,EAAS,IAAI,2BAAyBC,CAAO,EAC7Ca,EAAO,OACb,UAAOd,EAAO,mBAAmBc,EAAM,CAAC,CAAC,EAAE,KAAK,EAAI,KACpD,UAAOd,EAAO,mBAAmBc,EAAM,CAAC,CAAC,EAAE,KAAK,EAAK,KACrD,UAAOd,EAAO,mBAAmBc,EAAM,CAAC,CAAC,EAAE,KAAK,EAAI,KACpD,UAAOd,EAAO,mBAAmBc,EAAM,CAAC,CAAC,EAAE,KAAK,EAAK,KACrD,UAAOd,EAAO,mBAAmBc,EAAM,CAAC,CAAC,EAAE,KAAK,EAAI,KACpD,UAAOd,EAAO,mBAAmBc,EAAM,CAAC,CAAC,EAAE,KAAK,EAAK,KACrD,UAAOd,EAAO,mBAAmBc,EAAM,CAAC,CAAC,EAAE,KAAK,EAAI,KACpD,UAAOd,EAAO,mBAAmBc,EAAM,CAAC,CAAC,EAAE,KAAK,EAAK,CACvD,CAAC,CACH,CAAC",
6
- "names": ["import_vitest", "import_SecureElementFlags", "import_SecureElementFlagsParser", "parser", "seFlags", "expectedState", "value", "hasSlot1", "hasSlot2", "numberOfWords", "currentWordIndex", "onboardingState", "status", "parsedStates", "_", "index", "state", "byte"]
4
+ "sourcesContent": ["import { describe, expect, it } from \"vitest\";\n\nimport {\n type DeviceGeneralState,\n OnboardingState,\n SeedWordCount,\n} from \"@api/device/SecureElementFlags\";\n\nimport { SecureElementFlagsParser } from \"./SecureElementFlagsParser\";\n\ndescribe(\"SecureElementFlagsParser\", () => {\n it(\"should default missing secure element flag bytes to zero\", () => {\n const parser = new SecureElementFlagsParser(new Uint8Array([0xe0]));\n\n expect(parser.generalDeviceState().isPinValidated).toBe(true);\n expect(parser.endorsementInformation()).toEqual({\n hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n });\n expect(parser.wordsInformation()).toEqual({\n numberOfWords: SeedWordCount.TwentyFour,\n currentWordIndex: 0,\n });\n expect(parser.onboardingStatus()).toEqual({\n onboardingState: OnboardingState.Unknown,\n });\n });\n\n it(\"should correctly parse the general device state\", () => {\n const seFlags = new Uint8Array([0b10101010, 0x00, 0x00, 0x00]);\n const parser = new SecureElementFlagsParser(seFlags);\n const expectedState: DeviceGeneralState = {\n isPinValidated: true,\n hasMcuSerialNumber: false,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: true,\n isOnboarded: false,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n };\n expect(parser.generalDeviceState()).toEqual(expectedState);\n });\n\n it.each([\n [0x00, false, false],\n [0x01, true, false],\n [0x02, false, true],\n [0x03, true, true],\n ])(\n \"should parse endorsement information value %#\",\n (value, hasSlot1, hasSlot2) => {\n const parser = new SecureElementFlagsParser(\n new Uint8Array([0x00, value, 0x00, 0x00]),\n );\n\n expect(parser.endorsementInformation()).toEqual({\n hasEndorsementCertificateInSlot1: hasSlot1,\n hasEndorsementCertificateInSlot2: hasSlot2,\n });\n },\n );\n\n it.each([\n [0b00000000, SeedWordCount.TwentyFour, 0],\n [0b00100101, SeedWordCount.Eighteen, 5],\n [0b01010001, SeedWordCount.Twelve, 17],\n [0b01111111, undefined, 31],\n ])(\n \"should parse words information value %#\",\n (value, numberOfWords, currentWordIndex) => {\n const parser = new SecureElementFlagsParser(\n new Uint8Array([0x00, 0x00, value, 0x00]),\n );\n\n expect(parser.wordsInformation()).toEqual({\n numberOfWords,\n currentWordIndex,\n });\n },\n );\n\n it(\"should ignore the reserved most-significant bit in words information\", () => {\n const parser = new SecureElementFlagsParser(\n new Uint8Array([0x00, 0x00, 0b10100101, 0x00]),\n );\n\n expect(parser.wordsInformation()).toEqual({\n numberOfWords: SeedWordCount.Eighteen,\n currentWordIndex: 5,\n });\n });\n\n it(\"should expose numeric seed word counts so they survive serialization\", () => {\n const parser = new SecureElementFlagsParser(\n new Uint8Array([0x00, 0x00, 0x00, 0x00]),\n );\n\n const words = parser.wordsInformation();\n\n expect(words.numberOfWords).toBe(SeedWordCount.TwentyFour);\n expect(JSON.parse(JSON.stringify(words))).toEqual({\n numberOfWords: SeedWordCount.TwentyFour,\n currentWordIndex: 0,\n });\n });\n\n it(\"should keep SeedWordCount as 12 | 18 | 24, not an open numeric enum\", () => {\n const valid: SeedWordCount = SeedWordCount.Twelve;\n expect(valid).toBe(12);\n\n // @ts-expect-error arbitrary numbers are not valid seed word counts\n const invalid: SeedWordCount = 15;\n expect(typeof invalid).toBe(\"number\");\n });\n\n describe(\"onboardingStatus\", () => {\n it.each([\n [0x00, OnboardingState.Unknown],\n [0x01, OnboardingState.WelcomeScreen1],\n [0x02, OnboardingState.WelcomeScreen2],\n [0x03, OnboardingState.WelcomeScreen3],\n [0x04, OnboardingState.WelcomeScreen4],\n [0x05, OnboardingState.WelcomeScreenReminder],\n [0x06, OnboardingState.SetupChoice],\n [0x07, OnboardingState.NewDevice],\n [0x08, OnboardingState.ConfirmNewDevice],\n [0x09, OnboardingState.RestoreRecoveryPhrase],\n [0x0a, OnboardingState.SafetyWarning],\n [0x0b, OnboardingState.DeviceIsReady],\n [0x0c, OnboardingState.ChooseName],\n [0x0d, OnboardingState.RestoreRecoverBackup],\n [0x0e, OnboardingState.SetupRestoreChoice],\n [0x0f, OnboardingState.OnboardingStatusCheck],\n [0x10, OnboardingState.RestoreWithRk],\n [0x11, OnboardingState.Unknown],\n [0x43, OnboardingState.Unknown],\n [0xff, OnboardingState.Unknown],\n ] as const)(\"should parse byte 0x%s as %s\", (value, onboardingState) => {\n const parser = new SecureElementFlagsParser(\n new Uint8Array([0x00, 0x00, 0x00, value]),\n );\n\n expect(parser.onboardingStatus()).toEqual({ onboardingState });\n });\n\n it(\"should always expose a defined onboarding state so it survives serialization\", () => {\n const parser = new SecureElementFlagsParser(\n new Uint8Array([0x00, 0x00, 0x00, 0x00]),\n );\n\n const status = parser.onboardingStatus();\n\n expect(status.onboardingState).toBe(OnboardingState.Unknown);\n expect(JSON.parse(JSON.stringify(status))).toEqual({\n onboardingState: OnboardingState.Unknown,\n });\n });\n\n it(\"should map every documented GET VERSION byte to a distinct OnboardingState\", () => {\n const documentedBytes = Array.from(\n { length: 0x10 },\n (_, index) => index + 1,\n );\n const parsedStates = documentedBytes.map(\n (value) =>\n new SecureElementFlagsParser(\n new Uint8Array([0x00, 0x00, 0x00, value]),\n ).onboardingStatus().onboardingState,\n );\n\n expect(parsedStates).toEqual(\n Object.values(OnboardingState).filter(\n (state) => state !== OnboardingState.Unknown,\n ),\n );\n });\n });\n\n it(\"should correctly check the nth bit in a byte\", () => {\n const seFlags = new Uint8Array([0x00, 0x00, 0x00, 0x00]);\n const parser = new SecureElementFlagsParser(seFlags);\n const byte = 0b10101010;\n expect(parser._checkNthBitInByte(byte, 1)).toBe(true);\n expect(parser._checkNthBitInByte(byte, 2)).toBe(false);\n expect(parser._checkNthBitInByte(byte, 3)).toBe(true);\n expect(parser._checkNthBitInByte(byte, 4)).toBe(false);\n expect(parser._checkNthBitInByte(byte, 5)).toBe(true);\n expect(parser._checkNthBitInByte(byte, 6)).toBe(false);\n expect(parser._checkNthBitInByte(byte, 7)).toBe(true);\n expect(parser._checkNthBitInByte(byte, 8)).toBe(false);\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAAqC,kBAErCC,EAIO,0CAEPC,EAAyC,yCAEzC,YAAS,2BAA4B,IAAM,IACzC,MAAG,2DAA4D,IAAM,CACnE,MAAMC,EAAS,IAAI,2BAAyB,IAAI,WAAW,CAAC,GAAI,CAAC,CAAC,KAElE,UAAOA,EAAO,mBAAmB,EAAE,cAAc,EAAE,KAAK,EAAI,KAC5D,UAAOA,E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AM,CAAI,CAAC,EACjDD,EAAS,IAAI,2BAAyBC,CAAO,EAC7Ce,EAAO,OACb,UAAOhB,EAAO,mBAAmBgB,EAAM,CAAC,CAAC,EAAE,KAAK,EAAI,KACpD,UAAOhB,EAAO,mBAAmBgB,EAAM,CAAC,CAAC,EAAE,KAAK,EAAK,KACrD,UAAOhB,EAAO,mBAAmBgB,EAAM,CAAC,CAAC,EAAE,KAAK,EAAI,KACpD,UAAOhB,EAAO,mBAAmBgB,EAAM,CAAC,CAAC,EAAE,KAAK,EAAK,KACrD,UAAOhB,EAAO,mBAAmBgB,EAAM,CAAC,CAAC,EAAE,KAAK,EAAI,KACpD,UAAOhB,EAAO,mBAAmBgB,EAAM,CAAC,CAAC,EAAE,KAAK,EAAK,KACrD,UAAOhB,EAAO,mBAAmBgB,EAAM,CAAC,CAAC,EAAE,KAAK,EAAI,KACpD,UAAOhB,EAAO,mBAAmBgB,EAAM,CAAC,CAAC,EAAE,KAAK,EAAK,CACvD,CAAC,CACH,CAAC",
6
+ "names": ["import_vitest", "import_SecureElementFlags", "import_SecureElementFlagsParser", "parser", "seFlags", "expectedState", "value", "hasSlot1", "hasSlot2", "numberOfWords", "currentWordIndex", "words", "valid", "onboardingState", "status", "parsedStates", "_", "index", "state", "byte"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var c=(s,e)=>{for(var o in e)a(s,o,{get:e[o],enumerable:!0})},f=(s,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of l(e))!u.call(s,t)&&t!==o&&a(s,t,{get:()=>e[t],enumerable:!(i=d(e,t))||i.enumerable});return s};var m=s=>f(a({},"__esModule",{value:!0}),s);var g={};c(g,{getOsVersionCommandResponseMockBuilder:()=>S});module.exports=m(g);var n=require("../../../device/DeviceModel"),r=require("../../../device/SecureElementFlags");const S=(s=n.DeviceModelId.NANO_SP,e={})=>({[n.DeviceModelId.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,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:24,currentWordIndex:0,onboardingState:r.OnboardingState.Unknown},...e},[n.DeviceModelId.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,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:24,currentWordIndex:0,onboardingState:r.OnboardingState.Unknown},...e},[n.DeviceModelId.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,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:24,currentWordIndex:0,onboardingState:r.OnboardingState.Unknown},...e},[n.DeviceModelId.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,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:24,currentWordIndex:0,onboardingState:r.OnboardingState.Unknown},...e},[n.DeviceModelId.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,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:24,currentWordIndex:0,onboardingState:r.OnboardingState.Unknown},...e},[n.DeviceModelId.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,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:24,currentWordIndex:0,onboardingState:r.OnboardingState.Unknown}}})[s];0&&(module.exports={getOsVersionCommandResponseMockBuilder});
1
+ "use strict";var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var c=(n,e)=>{for(var s in e)a(n,s,{get:e[s],enumerable:!0})},f=(n,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of l(e))!u.call(n,o)&&o!==s&&a(n,o,{get:()=>e[o],enumerable:!(i=d(e,o))||i.enumerable});return n};var m=n=>f(a({},"__esModule",{value:!0}),n);var g={};c(g,{getOsVersionCommandResponseMockBuilder:()=>S});module.exports=m(g);var t=require("../../../device/DeviceModel"),r=require("../../../device/SecureElementFlags");const S=(n=t.DeviceModelId.NANO_SP,e={})=>({[t.DeviceModelId.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,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:r.SeedWordCount.TwentyFour,currentWordIndex:0,onboardingState:r.OnboardingState.Unknown},...e},[t.DeviceModelId.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,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:r.SeedWordCount.TwentyFour,currentWordIndex:0,onboardingState:r.OnboardingState.Unknown},...e},[t.DeviceModelId.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,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:r.SeedWordCount.TwentyFour,currentWordIndex:0,onboardingState:r.OnboardingState.Unknown},...e},[t.DeviceModelId.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,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:r.SeedWordCount.TwentyFour,currentWordIndex:0,onboardingState:r.OnboardingState.Unknown},...e},[t.DeviceModelId.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,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:r.SeedWordCount.TwentyFour,currentWordIndex:0,onboardingState:r.OnboardingState.Unknown},...e},[t.DeviceModelId.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,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:r.SeedWordCount.TwentyFour,currentWordIndex:0,onboardingState:r.OnboardingState.Unknown}}})[n];0&&(module.exports={getOsVersionCommandResponseMockBuilder});
2
2
  //# sourceMappingURL=GetOsVersionCommand.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/command/os/__mocks__/GetOsVersionCommand.ts"],
4
- "sourcesContent": ["import { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { OnboardingState } from \"@api/device/SecureElementFlags\";\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 hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: 24 as const,\n currentWordIndex: 0,\n onboardingState: OnboardingState.Unknown,\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 hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: 24 as const,\n currentWordIndex: 0,\n onboardingState: OnboardingState.Unknown,\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 hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: 24 as const,\n currentWordIndex: 0,\n onboardingState: OnboardingState.Unknown,\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 hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: 24 as const,\n currentWordIndex: 0,\n onboardingState: OnboardingState.Unknown,\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 hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: 24 as const,\n currentWordIndex: 0,\n onboardingState: OnboardingState.Unknown,\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 hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: 24 as const,\n currentWordIndex: 0,\n onboardingState: OnboardingState.Unknown,\n },\n },\n })[deviceModelId];\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4CAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAA8B,mCAC9BC,EAAgC,0CAEzB,MAAMH,EAAyC,CACpDI,EAA+B,gBAAc,QAC7CC,EAAuC,CAAC,KAEvC,CACC,CAAC,gBAAc,OAAO,EAAG,CACvB,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,GAClB,iCAAkC,GAClC,iCAAkC,GAClC,cAAe,GAC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,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,GAClB,iCAAkC,GAClC,iCAAkC,GAClC,cAAe,GACf,iBAAkB,EAClB,gBAAiB,kBAAgB,OACnC,EACA,GAAGA,CACL,EACA,CAAC,gBAAc,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,GAClB,iCAAkC,GAClC,iCAAkC,GAClC,cAAe,GACf,iBAAkB,EAClB,gBAAiB,kBAAgB,OACnC,EACA,GAAGA,CACL,EACA,CAAC,gBAAc,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,GAClB,iCAAkC,GAClC,iCAAkC,GAClC,cAAe,GACf,iBAAkB,EAClB,gBAAiB,kBAAgB,OACnC,CACF,CACF,GAAGD,CAAa",
4
+ "sourcesContent": ["import { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { OnboardingState, SeedWordCount } from \"@api/device/SecureElementFlags\";\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 hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: SeedWordCount.TwentyFour,\n currentWordIndex: 0,\n onboardingState: OnboardingState.Unknown,\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 hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: SeedWordCount.TwentyFour,\n currentWordIndex: 0,\n onboardingState: OnboardingState.Unknown,\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 hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: SeedWordCount.TwentyFour,\n currentWordIndex: 0,\n onboardingState: OnboardingState.Unknown,\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 hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: SeedWordCount.TwentyFour,\n currentWordIndex: 0,\n onboardingState: OnboardingState.Unknown,\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 hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: SeedWordCount.TwentyFour,\n currentWordIndex: 0,\n onboardingState: OnboardingState.Unknown,\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 hasEndorsementCertificateInSlot1: false,\n hasEndorsementCertificateInSlot2: false,\n numberOfWords: SeedWordCount.TwentyFour,\n currentWordIndex: 0,\n onboardingState: OnboardingState.Unknown,\n },\n },\n })[deviceModelId];\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4CAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAA8B,mCAC9BC,EAA+C,0CAExC,MAAMH,EAAyC,CACpDI,EAA+B,gBAAc,QAC7CC,EAAuC,CAAC,KAEvC,CACC,CAAC,gBAAc,OAAO,EAAG,CACvB,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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gB,OACnC,CACF,CACF,GAAGD,CAAa",
6
6
  "names": ["GetOsVersionCommand_exports", "__export", "getOsVersionCommandResponseMockBuilder", "__toCommonJS", "import_DeviceModel", "import_SecureElementFlags", "deviceModelId", "props"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var a=(r,o)=>{for(var n in o)s(r,n,{get:o[n],enumerable:!0})},d=(r,o,n,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of m(o))!u.call(r,c)&&c!==n&&s(r,c,{get:()=>o[c],enumerable:!(t=l(o,c))||t.enumerable});return r};var p=r=>d(s({},"__esModule",{value:!0}),r);var h={};a(h,{OnboardingState:()=>i});module.exports=p(h);var i=(e=>(e.Unknown="unknown",e.WelcomeScreen1="welcome-screen-1",e.WelcomeScreen2="welcome-screen-2",e.WelcomeScreen3="welcome-screen-3",e.WelcomeScreen4="welcome-screen-4",e.WelcomeScreenReminder="welcome-screen-reminder",e.SetupChoice="setup-choice",e.NewDevice="new-device",e.ConfirmNewDevice="confirm-new-device",e.RestoreRecoveryPhrase="restore-recovery-phrase",e.SafetyWarning="safety-warning",e.DeviceIsReady="device-is-ready",e.ChooseName="choose-name",e.RestoreRecoverBackup="restore-recover-backup",e.SetupRestoreChoice="setup-restore-choice",e.OnboardingStatusCheck="onboarding-status-check",e.RestoreWithRk="restore-with-rk",e))(i||{});0&&(module.exports={OnboardingState});
1
+ "use strict";var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var d=(r,o)=>{for(var c in o)s(r,c,{get:o[c],enumerable:!0})},p=(r,o,c,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of m(o))!u.call(r,n)&&n!==c&&s(r,n,{get:()=>o[n],enumerable:!(t=l(o,n))||t.enumerable});return r};var a=r=>p(s({},"__esModule",{value:!0}),r);var y={};d(y,{OnboardingState:()=>i,SeedWordCount:()=>h});module.exports=a(y);const h={Twelve:12,Eighteen:18,TwentyFour:24};var i=(e=>(e.Unknown="unknown",e.WelcomeScreen1="welcome-screen-1",e.WelcomeScreen2="welcome-screen-2",e.WelcomeScreen3="welcome-screen-3",e.WelcomeScreen4="welcome-screen-4",e.WelcomeScreenReminder="welcome-screen-reminder",e.SetupChoice="setup-choice",e.NewDevice="new-device",e.ConfirmNewDevice="confirm-new-device",e.RestoreRecoveryPhrase="restore-recovery-phrase",e.SafetyWarning="safety-warning",e.DeviceIsReady="device-is-ready",e.ChooseName="choose-name",e.RestoreRecoverBackup="restore-recover-backup",e.SetupRestoreChoice="setup-restore-choice",e.OnboardingStatusCheck="onboarding-status-check",e.RestoreWithRk="restore-with-rk",e))(i||{});0&&(module.exports={OnboardingState,SeedWordCount});
2
2
  //# sourceMappingURL=SecureElementFlags.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/api/device/SecureElementFlags.ts"],
4
- "sourcesContent": ["/**\n * Represents the general state of a device, the information comes from the first byte of the secure element flags.\n */\nexport type DeviceGeneralState = {\n /**\n * Indicates whether the device's PIN has been validated.\n */\n isPinValidated: boolean;\n\n /**\n * Indicates whether the device has a MCU serial number.\n */\n hasMcuSerialNumber: boolean;\n\n /**\n * Indicates whether the device has a personalized valid Ledger certificate.\n */\n hasValidCertificate: boolean;\n\n /**\n * Indicates whether the device is allowed to connect with a custom certificate authority.\n */\n isCustomAuthorityConnectionAllowed: boolean;\n\n /**\n * Indicates whether the device is allowed to commnunicate with secure connection.\n */\n isSecureConnectionAllowed: boolean;\n\n /**\n * Indicates whether the device has been onboarded.\n */\n isOnboarded: boolean;\n\n /**\n * Indicates whether the MCU code on the device is signed.\n */\n isMcuCodeSigned: boolean;\n\n /**\n * Indicates whether the device is in recovery mode.\n */\n isInRecoveryMode: boolean;\n};\n\n/**\n * Represents which endorsement certificate slots are populated.\n * This information comes from the second byte of the secure element flags.\n */\nexport type EndorsementInformation = {\n hasEndorsementCertificateInSlot1: boolean;\n hasEndorsementCertificateInSlot2: boolean;\n};\n\nexport type SeedWordCount = 12 | 18 | 24;\n\n/**\n * Represents the seed phrase setup progress.\n * This information comes from the third byte of the secure element flags.\n */\nexport type WordsInformation = {\n /**\n * Number of seed words selected by the user.\n * `undefined` represents a reserved or unknown encoding.\n */\n numberOfWords: SeedWordCount | undefined;\n /**\n * Zero-based index of the word currently being entered or confirmed.\n */\n currentWordIndex: number;\n};\n\n/**\n * Onboarding screen encoded in the fourth secure element flag byte.\n * Values follow GET VERSION byte 4 (0x01 to 0x10).\n */\nexport enum OnboardingState {\n /**\n * The byte is 0x00 or an encoding not covered by the specification, which\n * future firmware versions may introduce.\n */\n Unknown = \"unknown\",\n WelcomeScreen1 = \"welcome-screen-1\",\n WelcomeScreen2 = \"welcome-screen-2\",\n WelcomeScreen3 = \"welcome-screen-3\",\n WelcomeScreen4 = \"welcome-screen-4\",\n WelcomeScreenReminder = \"welcome-screen-reminder\",\n SetupChoice = \"setup-choice\",\n NewDevice = \"new-device\",\n ConfirmNewDevice = \"confirm-new-device\",\n RestoreRecoveryPhrase = \"restore-recovery-phrase\",\n SafetyWarning = \"safety-warning\",\n DeviceIsReady = \"device-is-ready\",\n ChooseName = \"choose-name\",\n RestoreRecoverBackup = \"restore-recover-backup\",\n SetupRestoreChoice = \"setup-restore-choice\",\n OnboardingStatusCheck = \"onboarding-status-check\",\n RestoreWithRk = \"restore-with-rk\",\n}\n\n/**\n * Represents the current onboarding state.\n * This information comes from the fourth byte of the secure element flags.\n */\nexport type OnboardingStatus = {\n /**\n * Parsed onboarding state, `OnboardingState.Unknown` for unmapped bytes.\n */\n onboardingState: OnboardingState;\n};\n\n/**\n * Parsed secure element flags from a Get OS version response.\n */\nexport type SecureElementFlags = DeviceGeneralState &\n EndorsementInformation &\n WordsInformation &\n OnboardingStatus;\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GA4EO,IAAKE,OAKVA,EAAA,QAAU,UACVA,EAAA,eAAiB,mBACjBA,EAAA,eAAiB,mBACjBA,EAAA,eAAiB,mBACjBA,EAAA,eAAiB,mBACjBA,EAAA,sBAAwB,0BACxBA,EAAA,YAAc,eACdA,EAAA,UAAY,aACZA,EAAA,iBAAmB,qBACnBA,EAAA,sBAAwB,0BACxBA,EAAA,cAAgB,iBAChBA,EAAA,cAAgB,kBAChBA,EAAA,WAAa,cACbA,EAAA,qBAAuB,yBACvBA,EAAA,mBAAqB,uBACrBA,EAAA,sBAAwB,0BACxBA,EAAA,cAAgB,kBArBNA,OAAA",
6
- "names": ["SecureElementFlags_exports", "__export", "OnboardingState", "__toCommonJS"]
4
+ "sourcesContent": ["/**\n * Represents the general state of a device, the information comes from the first byte of the secure element flags.\n */\nexport type DeviceGeneralState = {\n /**\n * Indicates whether the device's PIN has been validated.\n */\n isPinValidated: boolean;\n\n /**\n * Indicates whether the device has a MCU serial number.\n */\n hasMcuSerialNumber: boolean;\n\n /**\n * Indicates whether the device has a personalized valid Ledger certificate.\n */\n hasValidCertificate: boolean;\n\n /**\n * Indicates whether the device is allowed to connect with a custom certificate authority.\n */\n isCustomAuthorityConnectionAllowed: boolean;\n\n /**\n * Indicates whether the device is allowed to commnunicate with secure connection.\n */\n isSecureConnectionAllowed: boolean;\n\n /**\n * Indicates whether the device has been onboarded.\n */\n isOnboarded: boolean;\n\n /**\n * Indicates whether the MCU code on the device is signed.\n */\n isMcuCodeSigned: boolean;\n\n /**\n * Indicates whether the device is in recovery mode.\n */\n isInRecoveryMode: boolean;\n};\n\n/**\n * Represents which endorsement certificate slots are populated.\n * This information comes from the second byte of the secure element flags.\n */\nexport type EndorsementInformation = {\n hasEndorsementCertificateInSlot1: boolean;\n hasEndorsementCertificateInSlot2: boolean;\n};\n\n/**\n * Number of seed words selected during onboarding.\n * Values follow GET VERSION byte 3 (bits 5\u20136): 24, 18, or 12.\n *\n * Defined as a const object rather than a numeric enum so the type stays\n * `12 | 18 | 24` and is not assignable from an arbitrary `number`.\n */\nexport const SeedWordCount = {\n Twelve: 12,\n Eighteen: 18,\n TwentyFour: 24,\n} as const;\n\nexport type SeedWordCount = (typeof SeedWordCount)[keyof typeof SeedWordCount];\n\n/**\n * Represents the seed phrase setup progress.\n * This information comes from the third byte of the secure element flags.\n */\nexport type WordsInformation = {\n /**\n * Number of seed words selected by the user.\n * `undefined` represents a reserved or unknown encoding.\n */\n numberOfWords: SeedWordCount | undefined;\n /**\n * Zero-based index of the word currently being entered or confirmed.\n */\n currentWordIndex: number;\n};\n\n/**\n * Onboarding screen encoded in the fourth secure element flag byte.\n * Values follow GET VERSION byte 4 (0x01 to 0x10).\n */\nexport enum OnboardingState {\n /**\n * The byte is 0x00 or an encoding not covered by the specification, which\n * future firmware versions may introduce.\n */\n Unknown = \"unknown\",\n WelcomeScreen1 = \"welcome-screen-1\",\n WelcomeScreen2 = \"welcome-screen-2\",\n WelcomeScreen3 = \"welcome-screen-3\",\n WelcomeScreen4 = \"welcome-screen-4\",\n WelcomeScreenReminder = \"welcome-screen-reminder\",\n SetupChoice = \"setup-choice\",\n NewDevice = \"new-device\",\n ConfirmNewDevice = \"confirm-new-device\",\n RestoreRecoveryPhrase = \"restore-recovery-phrase\",\n SafetyWarning = \"safety-warning\",\n DeviceIsReady = \"device-is-ready\",\n ChooseName = \"choose-name\",\n RestoreRecoverBackup = \"restore-recover-backup\",\n SetupRestoreChoice = \"setup-restore-choice\",\n OnboardingStatusCheck = \"onboarding-status-check\",\n RestoreWithRk = \"restore-with-rk\",\n}\n\n/**\n * Represents the current onboarding state.\n * This information comes from the fourth byte of the secure element flags.\n */\nexport type OnboardingStatus = {\n /**\n * Parsed onboarding state, `OnboardingState.Unknown` for unmapped bytes.\n */\n onboardingState: OnboardingState;\n};\n\n/**\n * Parsed secure element flags from a Get OS version response.\n */\nexport type SecureElementFlags = DeviceGeneralState &\n EndorsementInformation &\n WordsInformation &\n OnboardingStatus;\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,kBAAAC,IAAA,eAAAC,EAAAJ,GA6DO,MAAMG,EAAgB,CAC3B,OAAQ,GACR,SAAU,GACV,WAAY,EACd,EAwBO,IAAKD,OAKVA,EAAA,QAAU,UACVA,EAAA,eAAiB,mBACjBA,EAAA,eAAiB,mBACjBA,EAAA,eAAiB,mBACjBA,EAAA,eAAiB,mBACjBA,EAAA,sBAAwB,0BACxBA,EAAA,YAAc,eACdA,EAAA,UAAY,aACZA,EAAA,iBAAmB,qBACnBA,EAAA,sBAAwB,0BACxBA,EAAA,cAAgB,iBAChBA,EAAA,cAAgB,kBAChBA,EAAA,WAAa,cACbA,EAAA,qBAAuB,yBACvBA,EAAA,mBAAqB,uBACrBA,EAAA,sBAAwB,0BACxBA,EAAA,cAAgB,kBArBNA,OAAA",
6
+ "names": ["SecureElementFlags_exports", "__export", "OnboardingState", "SeedWordCount", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var L=Object.defineProperty;var Be=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var be=Object.prototype.hasOwnProperty;var he=(p,t)=>{for(var a in t)L(p,a,{get:t[a],enumerable:!0})},S=(p,t,a,k)=>{if(t&&typeof t=="object"||typeof t=="function")for(let f of Oe(t))!be.call(p,f)&&f!==a&&L(p,f,{get:()=>t[f],enumerable:!(k=Be(t,f))||k.enumerable});return p},o=(p,t,a)=>(S(p,t,"default"),a&&S(a,t,"default"));var Pe=p=>S(L({},"__esModule",{value:!0}),p);var e={};he(e,{APDU_MAX_PAYLOAD:()=>A.APDU_MAX_PAYLOAD,Apdu:()=>E.Apdu,ApduBuilder:()=>A.ApduBuilder,ApduParser:()=>R.ApduParser,ApduResponse:()=>pe.ApduResponse,AppAlreadyInstalledDAError:()=>r.AppAlreadyInstalledDAError,ApplicationChecker:()=>Ie.ApplicationChecker,BatteryStatusType:()=>l.BatteryStatusType,BleDeviceInfos:()=>re.BleDeviceInfos,ByteArrayBuilder:()=>G.ByteArrayBuilder,ByteArrayParser:()=>I.ByteArrayParser,CallTaskInAppDeviceAction:()=>_.CallTaskInAppDeviceAction,CloseAppCommand:()=>T.CloseAppCommand,CommandResultFactory:()=>n.CommandResultFactory,CommandResultStatus:()=>n.CommandResultStatus,CommandUtils:()=>M.CommandUtils,ConnectToSecureChannelTask:()=>ce.ConnectToSecureChannelTask,ConnectedDevice:()=>ke.ConnectedDevice,ConsoleLogger:()=>ye.ConsoleLogger,DEFAULT_UNLOCK_TIMEOUT_MS:()=>w.DEFAULT_UNLOCK_TIMEOUT_MS,DefaultLogTagFormatter:()=>Ce.DefaultLogTagFormatter,DeleteLanguagePackCommand:()=>u.DeleteLanguagePackCommand,DeleteLanguagePackCommandError:()=>u.DeleteLanguagePackCommandError,DeleteLanguagePackDAError:()=>r.DeleteLanguagePackDAError,DeviceActionStatus:()=>U.DeviceActionStatus,DeviceConnectionStateMachine:()=>Ee.DeviceConnectionStateMachine,DeviceLockedError:()=>r.DeviceLockedError,DeviceManagementKit:()=>xe.DeviceManagementKit,DeviceManagementKitBuilder:()=>le.DeviceManagementKitBuilder,DeviceModel:()=>m.DeviceModel,DeviceModelId:()=>m.DeviceModelId,DeviceNotOnboardedError:()=>r.DeviceNotOnboardedError,DeviceSessionStateType:()=>ae.DeviceSessionStateType,DeviceStatus:()=>V.DeviceStatus,DmkNetworkClient:()=>Se.DmkNetworkClient,DmkNetworkClientError:()=>Le.DmkNetworkClientError,DmkResultFactory:()=>s.DmkResultFactory,DmkResultStatus:()=>s.DmkResultStatus,FramerUtils:()=>ue.FramerUtils,GLOBAL_ERRORS:()=>i.GLOBAL_ERRORS,GenuineCheckDeviceAction:()=>ne.GenuineCheckDeviceAction,GetAppAndVersionCommand:()=>B.GetAppAndVersionCommand,GetApplicationsMetadataTaskError:()=>y.GetApplicationsMetadataTaskError,GetBackgroundImageSizeCommand:()=>x.GetBackgroundImageSizeCommand,GetBackgroundImageSizeCommandError:()=>x.GetBackgroundImageSizeCommandError,GetBatteryStatusCommand:()=>l.GetBatteryStatusCommand,GetDeviceMetadataDeviceAction:()=>z.GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction:()=>q.GetDeviceStatusDeviceAction,GetOsVersionCommand:()=>O.GetOsVersionCommand,GlobalCommandError:()=>i.GlobalCommandError,GlobalCommandErrorHandler:()=>i.GlobalCommandErrorHandler,GoToDashboardDeviceAction:()=>H.GoToDashboardDeviceAction,InstallAppDeviceAction:()=>ie.InstallAppDeviceAction,InstallLanguagePackageDeviceAction:()=>K.InstallLanguagePackageDeviceAction,InstallOrUpdateAppsDeviceAction:()=>Q.InstallOrUpdateAppsDeviceAction,InvalidGetFirmwareMetadataResponseError:()=>y.InvalidGetFirmwareMetadataResponseError,InvalidResponseFormatError:()=>D.InvalidResponseFormatError,InvalidStatusWordError:()=>D.InvalidStatusWordError,LEDGER_VENDOR_ID:()=>m.LEDGER_VENDOR_ID,ListAppsCommand:()=>b.ListAppsCommand,ListAppsDeviceAction:()=>X.ListAppsDeviceAction,ListAppsWithMetadataDeviceAction:()=>Y.ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction:()=>me.ListInstalledAppsDeviceAction,ListLanguagePackCommand:()=>g.ListLanguagePackCommand,ListLanguagePackCommandError:()=>g.ListLanguagePackCommandError,LoadCertificateCommand:()=>h.LoadCertificateCommand,LogLevel:()=>ge.LogLevel,OnboardingState:()=>W.OnboardingState,OpenAppCommand:()=>P.OpenAppCommand,OpenAppDeviceAction:()=>j.OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction:()=>J.OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError:()=>r.OutOfMemoryDAError,RefusedByUserDAError:()=>r.RefusedByUserDAError,SecureChannelError:()=>fe.SecureChannelError,SecureChannelEventType:()=>de.SecureChannelEventType,SendCommandInAppDeviceAction:()=>Z.SendCommandInAppDeviceAction,StaticDeviceModelDataSource:()=>oe.StaticDeviceModelDataSource,TransportConnectedDevice:()=>Re.TransportConnectedDevice,TransportDeviceModel:()=>te.TransportDeviceModel,UninstallAppDeviceAction:()=>se.UninstallAppDeviceAction,UnknownDAError:()=>r.UnknownDAError,UnsupportedFirmwareDAError:()=>r.UnsupportedFirmwareDAError,UserInteractionRequired:()=>N.UserInteractionRequired,WaitForAppAndVersionDeviceAction:()=>$.WaitForAppAndVersionDeviceAction,WebLogsExporterLogger:()=>ve.WebLogsExporterLogger,XStateDeviceAction:()=>ee.XStateDeviceAction,base64StringToBuffer:()=>c.base64StringToBuffer,bufferToBase64String:()=>c.bufferToBase64String,bufferToHexaString:()=>d.bufferToHexaString,connectedDeviceStubBuilder:()=>Ge.connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder:()=>Ae.defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder:()=>De.defaultApduSenderServiceStubBuilder,formatApduReceivedLog:()=>v.formatApduReceivedLog,formatApduSentLog:()=>v.formatApduSentLog,hexaStringToBuffer:()=>d.hexaStringToBuffer,isBase64String:()=>c.isBase64String,isCommandErrorCode:()=>F.isCommandErrorCode,isDashboardName:()=>Te.isDashboardName,isHexaString:()=>d.isHexaString,isSuccessCommandResult:()=>n.isSuccessCommandResult,isSuccessDmkResult:()=>s.isSuccessDmkResult,noopLogger:()=>C.noopLogger,noopLoggerFactory:()=>C.noopLoggerFactory});module.exports=Pe(e);var E=require("./apdu/model/Apdu"),A=require("./apdu/utils/ApduBuilder"),R=require("./apdu/utils/ApduParser");o(e,require("./apdu/utils/AppBuilderError"),module.exports);var G=require("./apdu/utils/ByteArrayBuilder"),I=require("./apdu/utils/ByteArrayParser"),D=require("./command/Errors"),n=require("./command/model/CommandResult"),T=require("./command/os/CloseAppCommand"),u=require("./command/os/DeleteLanguagePackCommand"),B=require("./command/os/GetAppAndVersionCommand"),x=require("./command/os/GetBackgroundImageSizeCommand"),l=require("./command/os/GetBatteryStatusCommand"),O=require("./command/os/GetOsVersionCommand"),b=require("./command/os/ListAppsCommand"),g=require("./command/os/ListLanguagePackCommand"),h=require("./command/os/LoadCertificateCommand"),P=require("./command/os/OpenAppCommand"),F=require("./command/utils/CommandErrors"),M=require("./command/utils/CommandUtils"),i=require("./command/utils/GlobalCommandError"),m=require("./device/DeviceModel"),V=require("./device/DeviceStatus"),W=require("./device/SecureElementFlags"),U=require("./device-action/model/DeviceActionState"),N=require("./device-action/model/UserInteractionRequired"),_=require("./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction"),w=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"),K=require("./device-action/os/InstallLanguagePackage/InstallLanguagePackageDeviceAction"),Q=require("./device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction"),X=require("./device-action/os/ListApps/ListAppsDeviceAction"),Y=require("./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction"),j=require("./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),J=require("./device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction"),Z=require("./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction"),$=require("./device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction"),y=require("./device-action/task/Errors"),ee=require("./device-action/xstate-utils/XStateDeviceAction"),oe=require("./device-model/data/StaticDeviceModelDataSource"),re=require("./device-model/model/BleDeviceInfos"),te=require("./device-model/model/DeviceModel"),pe=require("./device-session/ApduResponse");o(e,require("./device-session/data/FramerConst"),module.exports);var ae=require("./device-session/DeviceSessionState"),s=require("./model/DmkResult"),ne=require("./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction"),ie=require("./secure-channel/device-action/InstallApp/InstallAppDeviceAction"),me=require("./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction"),se=require("./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction"),ce=require("./secure-channel/task/ConnectToSecureChannelTask"),de=require("./secure-channel/task/types"),fe=require("../internal/secure-channel/model/Errors"),Ae=require("./device-session/service/DefaultApduReceiverService.stub"),De=require("./device-session/service/DefaultApduSenderService.stub"),ue=require("./device-session/utils/FramerUtils"),xe=require("./DeviceManagementKit"),le=require("./DeviceManagementKitBuilder");o(e,require("./Error"),module.exports);var C=require("./logger-publisher/utils/noopLoggerFactory"),ge=require("./logger-subscriber/model/LogLevel"),ye=require("./logger-subscriber/service/ConsoleLogger"),Ce=require("./logger-subscriber/service/DefaultLogTagFormatter"),ve=require("./logger-subscriber/service/WebLogsExporterLogger"),Se=require("./network/DmkNetworkClient"),Le=require("./network/DmkNetworkClientError"),ke=require("./transport/model/ConnectedDevice"),Ee=require("./transport/model/DeviceConnectionStateMachine");o(e,require("./transport/model/Errors"),module.exports);var Re=require("./transport/model/TransportConnectedDevice"),Ge=require("./transport/model/TransportConnectedDevice.stub");o(e,require("./types"),module.exports);var v=require("./utils/apduLogs"),Ie=require("./utils/ApplicationChecker"),Te=require("./utils/AppName"),c=require("./utils/Base64String"),d=require("./utils/HexaString");0&&(module.exports={APDU_MAX_PAYLOAD,Apdu,ApduBuilder,ApduParser,ApduResponse,AppAlreadyInstalledDAError,ApplicationChecker,BatteryStatusType,BleDeviceInfos,ByteArrayBuilder,ByteArrayParser,CallTaskInAppDeviceAction,CloseAppCommand,CommandResultFactory,CommandResultStatus,CommandUtils,ConnectToSecureChannelTask,ConnectedDevice,ConsoleLogger,DEFAULT_UNLOCK_TIMEOUT_MS,DefaultLogTagFormatter,DeleteLanguagePackCommand,DeleteLanguagePackCommandError,DeleteLanguagePackDAError,DeviceActionStatus,DeviceConnectionStateMachine,DeviceLockedError,DeviceManagementKit,DeviceManagementKitBuilder,DeviceModel,DeviceModelId,DeviceNotOnboardedError,DeviceSessionStateType,DeviceStatus,DmkNetworkClient,DmkNetworkClientError,DmkResultFactory,DmkResultStatus,FramerUtils,GLOBAL_ERRORS,GenuineCheckDeviceAction,GetAppAndVersionCommand,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,OnboardingState,OpenAppCommand,OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError,RefusedByUserDAError,SecureChannelError,SecureChannelEventType,SendCommandInAppDeviceAction,StaticDeviceModelDataSource,TransportConnectedDevice,TransportDeviceModel,UninstallAppDeviceAction,UnknownDAError,UnsupportedFirmwareDAError,UserInteractionRequired,WaitForAppAndVersionDeviceAction,WebLogsExporterLogger,XStateDeviceAction,base64StringToBuffer,bufferToBase64String,bufferToHexaString,connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder,formatApduReceivedLog,formatApduSentLog,hexaStringToBuffer,isBase64String,isCommandErrorCode,isDashboardName,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 k=Object.defineProperty;var Be=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var be=Object.prototype.hasOwnProperty;var he=(p,t)=>{for(var a in t)k(p,a,{get:t[a],enumerable:!0})},L=(p,t,a,E)=>{if(t&&typeof t=="object"||typeof t=="function")for(let f of Oe(t))!be.call(p,f)&&f!==a&&k(p,f,{get:()=>t[f],enumerable:!(E=Be(t,f))||E.enumerable});return p},o=(p,t,a)=>(L(p,t,"default"),a&&L(a,t,"default"));var Pe=p=>L(k({},"__esModule",{value:!0}),p);var e={};he(e,{APDU_MAX_PAYLOAD:()=>A.APDU_MAX_PAYLOAD,Apdu:()=>R.Apdu,ApduBuilder:()=>A.ApduBuilder,ApduParser:()=>G.ApduParser,ApduResponse:()=>pe.ApduResponse,AppAlreadyInstalledDAError:()=>r.AppAlreadyInstalledDAError,ApplicationChecker:()=>Ie.ApplicationChecker,BatteryStatusType:()=>l.BatteryStatusType,BleDeviceInfos:()=>re.BleDeviceInfos,ByteArrayBuilder:()=>I.ByteArrayBuilder,ByteArrayParser:()=>T.ByteArrayParser,CallTaskInAppDeviceAction:()=>_.CallTaskInAppDeviceAction,CloseAppCommand:()=>B.CloseAppCommand,CommandResultFactory:()=>n.CommandResultFactory,CommandResultStatus:()=>n.CommandResultStatus,CommandUtils:()=>V.CommandUtils,ConnectToSecureChannelTask:()=>ce.ConnectToSecureChannelTask,ConnectedDevice:()=>ke.ConnectedDevice,ConsoleLogger:()=>ye.ConsoleLogger,DEFAULT_UNLOCK_TIMEOUT_MS:()=>w.DEFAULT_UNLOCK_TIMEOUT_MS,DefaultLogTagFormatter:()=>Ce.DefaultLogTagFormatter,DeleteLanguagePackCommand:()=>u.DeleteLanguagePackCommand,DeleteLanguagePackCommandError:()=>u.DeleteLanguagePackCommandError,DeleteLanguagePackDAError:()=>r.DeleteLanguagePackDAError,DeviceActionStatus:()=>U.DeviceActionStatus,DeviceConnectionStateMachine:()=>Ee.DeviceConnectionStateMachine,DeviceLockedError:()=>r.DeviceLockedError,DeviceManagementKit:()=>xe.DeviceManagementKit,DeviceManagementKitBuilder:()=>le.DeviceManagementKitBuilder,DeviceModel:()=>m.DeviceModel,DeviceModelId:()=>m.DeviceModelId,DeviceNotOnboardedError:()=>r.DeviceNotOnboardedError,DeviceSessionStateType:()=>ae.DeviceSessionStateType,DeviceStatus:()=>W.DeviceStatus,DmkNetworkClient:()=>Se.DmkNetworkClient,DmkNetworkClientError:()=>Le.DmkNetworkClientError,DmkResultFactory:()=>s.DmkResultFactory,DmkResultStatus:()=>s.DmkResultStatus,FramerUtils:()=>ue.FramerUtils,GLOBAL_ERRORS:()=>i.GLOBAL_ERRORS,GenuineCheckDeviceAction:()=>ne.GenuineCheckDeviceAction,GetAppAndVersionCommand:()=>O.GetAppAndVersionCommand,GetApplicationsMetadataTaskError:()=>C.GetApplicationsMetadataTaskError,GetBackgroundImageSizeCommand:()=>x.GetBackgroundImageSizeCommand,GetBackgroundImageSizeCommandError:()=>x.GetBackgroundImageSizeCommandError,GetBatteryStatusCommand:()=>l.GetBatteryStatusCommand,GetDeviceMetadataDeviceAction:()=>z.GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction:()=>q.GetDeviceStatusDeviceAction,GetOsVersionCommand:()=>b.GetOsVersionCommand,GlobalCommandError:()=>i.GlobalCommandError,GlobalCommandErrorHandler:()=>i.GlobalCommandErrorHandler,GoToDashboardDeviceAction:()=>H.GoToDashboardDeviceAction,InstallAppDeviceAction:()=>ie.InstallAppDeviceAction,InstallLanguagePackageDeviceAction:()=>K.InstallLanguagePackageDeviceAction,InstallOrUpdateAppsDeviceAction:()=>Q.InstallOrUpdateAppsDeviceAction,InvalidGetFirmwareMetadataResponseError:()=>C.InvalidGetFirmwareMetadataResponseError,InvalidResponseFormatError:()=>D.InvalidResponseFormatError,InvalidStatusWordError:()=>D.InvalidStatusWordError,LEDGER_VENDOR_ID:()=>m.LEDGER_VENDOR_ID,ListAppsCommand:()=>h.ListAppsCommand,ListAppsDeviceAction:()=>X.ListAppsDeviceAction,ListAppsWithMetadataDeviceAction:()=>Y.ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction:()=>me.ListInstalledAppsDeviceAction,ListLanguagePackCommand:()=>g.ListLanguagePackCommand,ListLanguagePackCommandError:()=>g.ListLanguagePackCommandError,LoadCertificateCommand:()=>P.LoadCertificateCommand,LogLevel:()=>ge.LogLevel,OnboardingState:()=>y.OnboardingState,OpenAppCommand:()=>F.OpenAppCommand,OpenAppDeviceAction:()=>j.OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction:()=>J.OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError:()=>r.OutOfMemoryDAError,RefusedByUserDAError:()=>r.RefusedByUserDAError,SecureChannelError:()=>fe.SecureChannelError,SecureChannelEventType:()=>de.SecureChannelEventType,SeedWordCount:()=>y.SeedWordCount,SendCommandInAppDeviceAction:()=>Z.SendCommandInAppDeviceAction,StaticDeviceModelDataSource:()=>oe.StaticDeviceModelDataSource,TransportConnectedDevice:()=>Re.TransportConnectedDevice,TransportDeviceModel:()=>te.TransportDeviceModel,UninstallAppDeviceAction:()=>se.UninstallAppDeviceAction,UnknownDAError:()=>r.UnknownDAError,UnsupportedFirmwareDAError:()=>r.UnsupportedFirmwareDAError,UserInteractionRequired:()=>N.UserInteractionRequired,WaitForAppAndVersionDeviceAction:()=>$.WaitForAppAndVersionDeviceAction,WebLogsExporterLogger:()=>ve.WebLogsExporterLogger,XStateDeviceAction:()=>ee.XStateDeviceAction,base64StringToBuffer:()=>c.base64StringToBuffer,bufferToBase64String:()=>c.bufferToBase64String,bufferToHexaString:()=>d.bufferToHexaString,connectedDeviceStubBuilder:()=>Ge.connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder:()=>Ae.defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder:()=>De.defaultApduSenderServiceStubBuilder,formatApduReceivedLog:()=>S.formatApduReceivedLog,formatApduSentLog:()=>S.formatApduSentLog,hexaStringToBuffer:()=>d.hexaStringToBuffer,isBase64String:()=>c.isBase64String,isCommandErrorCode:()=>M.isCommandErrorCode,isDashboardName:()=>Te.isDashboardName,isHexaString:()=>d.isHexaString,isSuccessCommandResult:()=>n.isSuccessCommandResult,isSuccessDmkResult:()=>s.isSuccessDmkResult,noopLogger:()=>v.noopLogger,noopLoggerFactory:()=>v.noopLoggerFactory});module.exports=Pe(e);var R=require("./apdu/model/Apdu"),A=require("./apdu/utils/ApduBuilder"),G=require("./apdu/utils/ApduParser");o(e,require("./apdu/utils/AppBuilderError"),module.exports);var I=require("./apdu/utils/ByteArrayBuilder"),T=require("./apdu/utils/ByteArrayParser"),D=require("./command/Errors"),n=require("./command/model/CommandResult"),B=require("./command/os/CloseAppCommand"),u=require("./command/os/DeleteLanguagePackCommand"),O=require("./command/os/GetAppAndVersionCommand"),x=require("./command/os/GetBackgroundImageSizeCommand"),l=require("./command/os/GetBatteryStatusCommand"),b=require("./command/os/GetOsVersionCommand"),h=require("./command/os/ListAppsCommand"),g=require("./command/os/ListLanguagePackCommand"),P=require("./command/os/LoadCertificateCommand"),F=require("./command/os/OpenAppCommand"),M=require("./command/utils/CommandErrors"),V=require("./command/utils/CommandUtils"),i=require("./command/utils/GlobalCommandError"),m=require("./device/DeviceModel"),W=require("./device/DeviceStatus"),y=require("./device/SecureElementFlags"),U=require("./device-action/model/DeviceActionState"),N=require("./device-action/model/UserInteractionRequired"),_=require("./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction"),w=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"),K=require("./device-action/os/InstallLanguagePackage/InstallLanguagePackageDeviceAction"),Q=require("./device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction"),X=require("./device-action/os/ListApps/ListAppsDeviceAction"),Y=require("./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction"),j=require("./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),J=require("./device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction"),Z=require("./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction"),$=require("./device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction"),C=require("./device-action/task/Errors"),ee=require("./device-action/xstate-utils/XStateDeviceAction"),oe=require("./device-model/data/StaticDeviceModelDataSource"),re=require("./device-model/model/BleDeviceInfos"),te=require("./device-model/model/DeviceModel"),pe=require("./device-session/ApduResponse");o(e,require("./device-session/data/FramerConst"),module.exports);var ae=require("./device-session/DeviceSessionState"),s=require("./model/DmkResult"),ne=require("./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction"),ie=require("./secure-channel/device-action/InstallApp/InstallAppDeviceAction"),me=require("./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction"),se=require("./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction"),ce=require("./secure-channel/task/ConnectToSecureChannelTask"),de=require("./secure-channel/task/types"),fe=require("../internal/secure-channel/model/Errors"),Ae=require("./device-session/service/DefaultApduReceiverService.stub"),De=require("./device-session/service/DefaultApduSenderService.stub"),ue=require("./device-session/utils/FramerUtils"),xe=require("./DeviceManagementKit"),le=require("./DeviceManagementKitBuilder");o(e,require("./Error"),module.exports);var v=require("./logger-publisher/utils/noopLoggerFactory"),ge=require("./logger-subscriber/model/LogLevel"),ye=require("./logger-subscriber/service/ConsoleLogger"),Ce=require("./logger-subscriber/service/DefaultLogTagFormatter"),ve=require("./logger-subscriber/service/WebLogsExporterLogger"),Se=require("./network/DmkNetworkClient"),Le=require("./network/DmkNetworkClientError"),ke=require("./transport/model/ConnectedDevice"),Ee=require("./transport/model/DeviceConnectionStateMachine");o(e,require("./transport/model/Errors"),module.exports);var Re=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"),Te=require("./utils/AppName"),c=require("./utils/Base64String"),d=require("./utils/HexaString");0&&(module.exports={APDU_MAX_PAYLOAD,Apdu,ApduBuilder,ApduParser,ApduResponse,AppAlreadyInstalledDAError,ApplicationChecker,BatteryStatusType,BleDeviceInfos,ByteArrayBuilder,ByteArrayParser,CallTaskInAppDeviceAction,CloseAppCommand,CommandResultFactory,CommandResultStatus,CommandUtils,ConnectToSecureChannelTask,ConnectedDevice,ConsoleLogger,DEFAULT_UNLOCK_TIMEOUT_MS,DefaultLogTagFormatter,DeleteLanguagePackCommand,DeleteLanguagePackCommandError,DeleteLanguagePackDAError,DeviceActionStatus,DeviceConnectionStateMachine,DeviceLockedError,DeviceManagementKit,DeviceManagementKitBuilder,DeviceModel,DeviceModelId,DeviceNotOnboardedError,DeviceSessionStateType,DeviceStatus,DmkNetworkClient,DmkNetworkClientError,DmkResultFactory,DmkResultStatus,FramerUtils,GLOBAL_ERRORS,GenuineCheckDeviceAction,GetAppAndVersionCommand,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,OnboardingState,OpenAppCommand,OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError,RefusedByUserDAError,SecureChannelError,SecureChannelEventType,SeedWordCount,SendCommandInAppDeviceAction,StaticDeviceModelDataSource,TransportConnectedDevice,TransportDeviceModel,UninstallAppDeviceAction,UnknownDAError,UnsupportedFirmwareDAError,UserInteractionRequired,WaitForAppAndVersionDeviceAction,WebLogsExporterLogger,XStateDeviceAction,base64StringToBuffer,bufferToBase64String,bufferToHexaString,connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder,formatApduReceivedLog,formatApduSentLog,hexaStringToBuffer,isBase64String,isCommandErrorCode,isDashboardName,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 { 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 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 GetOsVersionCommandResult,\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 {\n type DeviceGeneralState,\n type EndorsementInformation,\n OnboardingState,\n type OnboardingStatus,\n type SecureElementFlags,\n type SeedWordCount,\n type WordsInformation,\n} from \"@api/device/SecureElementFlags\";\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 {\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 { ConnectToSecureChannelTask } from \"@api/secure-channel/task/ConnectToSecureChannelTask\";\nexport { SecureChannelEventType } from \"@api/secure-channel/task/types\";\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 { isDashboardName } from \"@api/utils/AppName\";\nexport {\n base64StringToBuffer,\n bufferToBase64String,\n isBase64String,\n} from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaString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ACPC,GAAsC,8CACtCC,GAAgC,gDAChCC,GAGO,6DACP7D,EAAAN,EAAc,uCAvMd,gBAwMA,IAAAoE,GAAyC,yDACzCA,GAA2C,8DAC3C9D,EAAAN,EAAc,sBA1Md,gBA2MA,IAAAqE,EAAyD,+BACzDC,GAAmC,yCAMnCC,GAAgC,8BAChCC,EAIO,mCACPC,EAIO",
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 { 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 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 GetOsVersionCommandResult,\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 {\n type DeviceGeneralState,\n type EndorsementInformation,\n OnboardingState,\n type OnboardingStatus,\n type SecureElementFlags,\n SeedWordCount,\n type WordsInformation,\n} from \"@api/device/SecureElementFlags\";\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 {\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 { ConnectToSecureChannelTask } from \"@api/secure-channel/task/ConnectToSecureChannelTask\";\nexport { SecureChannelEventType } from \"@api/secure-channel/task/types\";\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 { isDashboardName } from \"@api/utils/AppName\";\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,wkKAAAE,GAAAF,GAEA,IAAAG,EAAqB,gCACrBC,EAA8C,uCAC9CC,EAA2B,sCAC3BC,EAAAN,EAAc,2C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nCC,GAAgC,8BAChCC,EAIO,mCACPC,EAIO",
6
6
  "names": ["api_exports", "__export", "__toCommonJS", "import_Apdu", "import_ApduBuilder", "import_ApduParser", "__reExport", "import_ByteArrayBuilder", "import_ByteArrayParser", "import_Errors", "import_CommandResult", "import_CloseAppCommand", "import_DeleteLanguagePackCommand", "import_GetAppAndVersionCommand", "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_SecureElementFlags", "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_XStateDeviceAction", "import_StaticDeviceModelDataSource", "import_BleDeviceInfos", "import_ApduResponse", "import_DeviceSessionState", "import_DmkResult", "import_GenuineCheckDeviceAction", "import_InstallAppDeviceAction", "import_ListInstalledAppsDeviceAction", "import_UninstallAppDeviceAction", "import_ConnectToSecureChannelTask", "import_types", "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_AppName", "import_Base64String", "import_HexaString"]
7
7
  }
@@ -62,5 +62,5 @@
62
62
  "watch:builds": "pnpm ldmk-tool watch --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
63
63
  "watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\""
64
64
  },
65
- "version": "0.0.0-develop-20260904001312"
65
+ "version": "0.0.0-develop-20260907001525"
66
66
  }
@@ -1,2 +1,2 @@
1
- import{CommandResultFactory as o,isSuccessCommandResult as a}from"../../command/model/CommandResult";import{DeviceModelId as r}from"../../device/DeviceModel";import{OnboardingState as n}from"../../device/SecureElementFlags";import{ApduResponse as x}from"../../device-session/ApduResponse";import{getOsVersionCommandResponseMockBuilder as d}from"./__mocks__/GetOsVersionCommand";import{GetOsVersionCommand as u}from"./GetOsVersionCommand";const p=Uint8Array.from([224,1,0,0,0]),l=Uint8Array.from([51,0,0,4,5,50,46,50,46,51,4,230,0,0,0,4,50,46,51,48,4,49,46,49,54,1,0,1,0,1,0,144,0]),f=new x({statusCode:Uint8Array.from([144,0]),data:l}),S=new x({statusCode:Uint8Array.from([144,0]),data:Uint8Array.from([51,0,0,4,5,50,46,50,46,51,0,4,50,46,51,48,4,49,46,49,54,1,0,1,0,1,0,144,0])}),m=Uint8Array.from([51,16,0,4,5,49,46,49,46,49,4,230,0,0,0,4,52,46,48,51,4,51,46,49,50,1,0,1,0,144,0]),A=new x({statusCode:Uint8Array.from([144,0]),data:m}),O=Uint8Array.from([51,32,0,4,5,49,46,51,46,48,4,230,0,0,0,4,53,46,50,52,4,48,46,52,56,1,0,1,0,144,0]),E=new x({statusCode:Uint8Array.from([144,0]),data:O}),_=Uint8Array.from([5,1,0,3,4,49,46,49,54,4,244,216,170,67,5,50,46,50,46,51,4,51,0,0,4,144,0]),h=new x({statusCode:Uint8Array.from([144,0]),data:_}),N=Uint8Array.from([51,0,0,4,0,4,238,0,0,0,4,50,46,51,48,1,1,1,0,1,0,144,0]),C=new x({statusCode:Uint8Array.from([144,0]),data:N});describe("GetOsVersionCommand",()=>{let s;beforeEach(()=>{s=new u}),describe("name",()=>{it("should be 'getOsVersion'",()=>{expect(s.name).toBe("getOsVersion")})}),describe("getApdu",()=>{it("should return the GetOsVersion apdu",()=>{const e=s.getApdu();expect(e.getRawApdu()).toStrictEqual(p)})}),describe("parseResponse",()=>{describe("Nano X",()=>{it("should parse the LNX response",()=>{const e=s.parseResponse(f,r.NANO_X),t=o({data:d(r.NANO_X)});expect(e).toStrictEqual(t)}),it("should default parsed flags when the response contains empty SE flags",()=>{const e=s.parseResponse(S,r.NANO_X);expect(a(e)).toBe(!0),a(e)&&(expect(e.data.seFlags).toStrictEqual(new Uint8Array),expect(e.data.secureElementFlags).toStrictEqual({isPinValidated:!1,hasMcuSerialNumber:!1,hasValidCertificate:!1,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!1,isMcuCodeSigned:!1,isInRecoveryMode:!1,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:24,currentWordIndex:0,onboardingState:n.Unknown}))}),it.each([[11,n.DeviceIsReady],[16,n.RestoreWithRk]])("should parse SE flag byte 4 0x%s as %s",(e,t)=>{const c=Uint8Array.from(l);c[14]=e;const i=s.parseResponse(new x({statusCode:Uint8Array.from([144,0]),data:c}),r.NANO_X);expect(a(i)).toBe(!0),a(i)&&(expect(i.data.seFlags).toStrictEqual(new Uint8Array([230,0,0,e])),expect(i.data.secureElementFlags.onboardingState).toBe(t))})}),describe("Nano S Plus",()=>{it("should parse the LNSP response",()=>{const e=s.parseResponse(A,r.NANO_SP),t=o({data:d(r.NANO_SP)});expect(e).toStrictEqual(t)})}),describe("Stax",()=>{it("should parse the STAX response",()=>{const e=s.parseResponse(E,r.STAX),t=o({data:d(r.STAX)});expect(e).toStrictEqual(t)})}),describe("Bootloader",()=>{it("should parse the bootloader response",()=>{const e=s.parseResponse(h,r.STAX),t=o({data:{isBootloader:!0,isOsu:!1,targetId:83951619,seTargetId:855638020,seVersion:"2.2.3",seFlags:new Uint8Array([244,216,170,67]),mcuTargetId:83951619,mcuSephVersion:"",mcuBootloaderVersion:"1.16",hwVersion:"",langId:void 0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!0,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!1,isInRecoveryMode:!1,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:18,currentWordIndex:10,onboardingState:n.Unknown}}});expect(e).toStrictEqual(t)})}),describe("Old firmware",()=>{it("should parse the old firmware response",()=>{const e=s.parseResponse(C,r.NANO_X),t=o({data:{isBootloader:!1,isOsu:!1,targetId:855638020,seTargetId:855638020,seVersion:"0.0.0",seFlags:new Uint8Array,mcuTargetId:void 0,mcuSephVersion:"2.30",mcuBootloaderVersion:"",hwVersion:"00",langId:void 0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!0,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:24,currentWordIndex:0,onboardingState:n.Unknown}}});expect(e).toStrictEqual(t)})}),describe("Error handling",()=>{it("should return an error if the response is not successful",()=>{const e=new x({statusCode:Uint8Array.from([110,128]),data:Uint8Array.from([])}),t=s.parseResponse(e,r.NANO_S);expect(a(t)).toBeFalsy()})})})});
1
+ import{CommandResultFactory as x,isSuccessCommandResult as a}from"../../command/model/CommandResult";import{DeviceModelId as r}from"../../device/DeviceModel";import{OnboardingState as n,SeedWordCount as d}from"../../device/SecureElementFlags";import{ApduResponse as o}from"../../device-session/ApduResponse";import{getOsVersionCommandResponseMockBuilder as c}from"./__mocks__/GetOsVersionCommand";import{GetOsVersionCommand as p}from"./GetOsVersionCommand";const S=Uint8Array.from([224,1,0,0,0]),u=Uint8Array.from([51,0,0,4,5,50,46,50,46,51,4,230,0,0,0,4,50,46,51,48,4,49,46,49,54,1,0,1,0,1,0,144,0]),f=new o({statusCode:Uint8Array.from([144,0]),data:u}),m=new o({statusCode:Uint8Array.from([144,0]),data:Uint8Array.from([51,0,0,4,5,50,46,50,46,51,0,4,50,46,51,48,4,49,46,49,54,1,0,1,0,1,0,144,0])}),A=Uint8Array.from([51,16,0,4,5,49,46,49,46,49,4,230,0,0,0,4,52,46,48,51,4,51,46,49,50,1,0,1,0,144,0]),O=new o({statusCode:Uint8Array.from([144,0]),data:A}),E=Uint8Array.from([51,32,0,4,5,49,46,51,46,48,4,230,0,0,0,4,53,46,50,52,4,48,46,52,56,1,0,1,0,144,0]),h=new o({statusCode:Uint8Array.from([144,0]),data:E}),_=Uint8Array.from([5,1,0,3,4,49,46,49,54,4,244,216,170,67,5,50,46,50,46,51,4,51,0,0,4,144,0]),N=new o({statusCode:Uint8Array.from([144,0]),data:_}),C=Uint8Array.from([51,0,0,4,0,4,238,0,0,0,4,50,46,51,48,1,1,1,0,1,0,144,0]),g=new o({statusCode:Uint8Array.from([144,0]),data:C});describe("GetOsVersionCommand",()=>{let s;beforeEach(()=>{s=new p}),describe("name",()=>{it("should be 'getOsVersion'",()=>{expect(s.name).toBe("getOsVersion")})}),describe("getApdu",()=>{it("should return the GetOsVersion apdu",()=>{const e=s.getApdu();expect(e.getRawApdu()).toStrictEqual(S)})}),describe("parseResponse",()=>{describe("Nano X",()=>{it("should parse the LNX response",()=>{const e=s.parseResponse(f,r.NANO_X),t=x({data:c(r.NANO_X)});expect(e).toStrictEqual(t)}),it("should default parsed flags when the response contains empty SE flags",()=>{const e=s.parseResponse(m,r.NANO_X);expect(a(e)).toBe(!0),a(e)&&(expect(e.data.seFlags).toStrictEqual(new Uint8Array),expect(e.data.secureElementFlags).toStrictEqual({isPinValidated:!1,hasMcuSerialNumber:!1,hasValidCertificate:!1,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!1,isMcuCodeSigned:!1,isInRecoveryMode:!1,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:d.TwentyFour,currentWordIndex:0,onboardingState:n.Unknown}))}),it.each([[11,n.DeviceIsReady],[16,n.RestoreWithRk]])("should parse SE flag byte 4 0x%s as %s",(e,t)=>{const l=Uint8Array.from(u);l[14]=e;const i=s.parseResponse(new o({statusCode:Uint8Array.from([144,0]),data:l}),r.NANO_X);expect(a(i)).toBe(!0),a(i)&&(expect(i.data.seFlags).toStrictEqual(new Uint8Array([230,0,0,e])),expect(i.data.secureElementFlags.onboardingState).toBe(t))})}),describe("Nano S Plus",()=>{it("should parse the LNSP response",()=>{const e=s.parseResponse(O,r.NANO_SP),t=x({data:c(r.NANO_SP)});expect(e).toStrictEqual(t)})}),describe("Stax",()=>{it("should parse the STAX response",()=>{const e=s.parseResponse(h,r.STAX),t=x({data:c(r.STAX)});expect(e).toStrictEqual(t)})}),describe("Bootloader",()=>{it("should parse the bootloader response",()=>{const e=s.parseResponse(N,r.STAX),t=x({data:{isBootloader:!0,isOsu:!1,targetId:83951619,seTargetId:855638020,seVersion:"2.2.3",seFlags:new Uint8Array([244,216,170,67]),mcuTargetId:83951619,mcuSephVersion:"",mcuBootloaderVersion:"1.16",hwVersion:"",langId:void 0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!0,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!1,isInRecoveryMode:!1,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:d.Eighteen,currentWordIndex:10,onboardingState:n.Unknown}}});expect(e).toStrictEqual(t)})}),describe("Old firmware",()=>{it("should parse the old firmware response",()=>{const e=s.parseResponse(g,r.NANO_X),t=x({data:{isBootloader:!1,isOsu:!1,targetId:855638020,seTargetId:855638020,seVersion:"0.0.0",seFlags:new Uint8Array,mcuTargetId:void 0,mcuSephVersion:"2.30",mcuBootloaderVersion:"",hwVersion:"00",langId:void 0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!0,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1,hasEndorsementCertificateInSlot1:!1,hasEndorsementCertificateInSlot2:!1,numberOfWords:d.TwentyFour,currentWordIndex:0,onboardingState:n.Unknown}}});expect(e).toStrictEqual(t)})}),describe("Error handling",()=>{it("should return an error if the response is not successful",()=>{const e=new o({statusCode:Uint8Array.from([110,128]),data:Uint8Array.from([])}),t=s.parseResponse(e,r.NANO_S);expect(a(t)).toBeFalsy()})})})});
2
2
  //# sourceMappingURL=GetOsVersionCommand.test.js.map