@ledgerhq/device-management-kit 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/src/api/DeviceManagementKit.js +1 -1
- package/lib/cjs/src/api/DeviceManagementKit.js.map +3 -3
- package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
- package/lib/cjs/src/api/DeviceManagementKit.test.js.map +3 -3
- package/lib/cjs/src/api/command/os/GetOsVersionCommand.js +1 -1
- package/lib/cjs/src/api/command/os/GetOsVersionCommand.js.map +3 -3
- package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js +1 -1
- package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js.map +3 -3
- package/lib/cjs/src/api/command/os/SecureElementFlagsParser.js +1 -1
- package/lib/cjs/src/api/command/os/SecureElementFlagsParser.js.map +3 -3
- package/lib/cjs/src/api/command/os/SecureElementFlagsParser.test.js +1 -1
- package/lib/cjs/src/api/command/os/SecureElementFlagsParser.test.js.map +3 -3
- package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
- package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +3 -3
- package/lib/cjs/src/api/device/SecureElementFlags.js +1 -1
- package/lib/cjs/src/api/device/SecureElementFlags.js.map +3 -3
- package/lib/cjs/src/api/index.js +1 -1
- package/lib/cjs/src/api/index.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/data/HttpManagerApiDataSource.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/HttpManagerApiDataSource.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/data/HttpManagerApiDataSource.test.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/HttpManagerApiDataSource.test.js.map +3 -3
- package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js +1 -1
- package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js.map +2 -2
- package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js +1 -1
- package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js.map +2 -2
- package/lib/cjs/src/internal/secure-channel/data/SecureChannelDataSource.js +1 -1
- package/lib/cjs/src/internal/secure-channel/data/SecureChannelDataSource.js.map +1 -1
- package/lib/cjs/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js +1 -1
- package/lib/cjs/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js.map +2 -2
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js +1 -1
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js.map +3 -3
- package/lib/cjs/src/internal/secure-channel/di/secureChannelTypes.js +1 -1
- package/lib/cjs/src/internal/secure-channel/di/secureChannelTypes.js.map +2 -2
- package/lib/cjs/src/internal/secure-channel/use-case/SetWebSocketUrlUseCase.js +2 -0
- package/lib/cjs/src/internal/secure-channel/use-case/SetWebSocketUrlUseCase.js.map +7 -0
- package/lib/cjs/src/internal/secure-channel/use-case/SetWebSocketUrlUseCase.test.js +2 -0
- package/lib/cjs/src/internal/secure-channel/use-case/SetWebSocketUrlUseCase.test.js.map +7 -0
- package/lib/esm/package.json +1 -1
- package/lib/esm/src/api/DeviceManagementKit.js +1 -1
- package/lib/esm/src/api/DeviceManagementKit.js.map +3 -3
- package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
- package/lib/esm/src/api/DeviceManagementKit.test.js.map +3 -3
- package/lib/esm/src/api/command/os/GetOsVersionCommand.js +1 -1
- package/lib/esm/src/api/command/os/GetOsVersionCommand.js.map +3 -3
- package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js +1 -1
- package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js.map +3 -3
- package/lib/esm/src/api/command/os/SecureElementFlagsParser.js +1 -1
- package/lib/esm/src/api/command/os/SecureElementFlagsParser.js.map +3 -3
- package/lib/esm/src/api/command/os/SecureElementFlagsParser.test.js +1 -1
- package/lib/esm/src/api/command/os/SecureElementFlagsParser.test.js.map +3 -3
- package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
- package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +3 -3
- package/lib/esm/src/api/device/SecureElementFlags.js +1 -0
- package/lib/esm/src/api/device/SecureElementFlags.js.map +4 -4
- package/lib/esm/src/api/index.js +1 -1
- package/lib/esm/src/api/index.js.map +3 -3
- package/lib/esm/src/internal/manager-api/data/HttpManagerApiDataSource.js +1 -1
- package/lib/esm/src/internal/manager-api/data/HttpManagerApiDataSource.js.map +3 -3
- package/lib/esm/src/internal/manager-api/data/HttpManagerApiDataSource.test.js +1 -1
- package/lib/esm/src/internal/manager-api/data/HttpManagerApiDataSource.test.js.map +3 -3
- package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js +1 -1
- package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js.map +2 -2
- package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js +1 -1
- package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js.map +2 -2
- package/lib/esm/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js +1 -1
- package/lib/esm/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js.map +2 -2
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js +1 -1
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js.map +3 -3
- package/lib/esm/src/internal/secure-channel/di/secureChannelTypes.js +1 -1
- package/lib/esm/src/internal/secure-channel/di/secureChannelTypes.js.map +2 -2
- package/lib/esm/src/internal/secure-channel/use-case/SetWebSocketUrlUseCase.js +2 -0
- package/lib/esm/src/internal/secure-channel/use-case/SetWebSocketUrlUseCase.js.map +7 -0
- package/lib/esm/src/internal/secure-channel/use-case/SetWebSocketUrlUseCase.test.js +2 -0
- package/lib/esm/src/internal/secure-channel/use-case/SetWebSocketUrlUseCase.test.js.map +7 -0
- package/lib/types/src/api/DeviceManagementKit.d.ts +10 -0
- package/lib/types/src/api/DeviceManagementKit.d.ts.map +1 -1
- package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts +2 -2
- package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts.map +1 -1
- package/lib/types/src/api/command/os/SecureElementFlagsParser.d.ts +0 -3
- package/lib/types/src/api/command/os/SecureElementFlagsParser.d.ts.map +1 -1
- package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
- package/lib/types/src/api/device/SecureElementFlags.d.ts +78 -3
- package/lib/types/src/api/device/SecureElementFlags.d.ts.map +1 -1
- package/lib/types/src/api/index.d.ts +2 -1
- package/lib/types/src/api/index.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/HttpManagerApiDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.d.ts +3 -1
- package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/data/SecureChannelDataSource.d.ts +10 -0
- package/lib/types/src/internal/secure-channel/data/SecureChannelDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.d.ts +2 -0
- package/lib/types/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/di/secureChannelTypes.d.ts +1 -0
- package/lib/types/src/internal/secure-channel/di/secureChannelTypes.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/use-case/SetWebSocketUrlUseCase.d.ts +10 -0
- package/lib/types/src/internal/secure-channel/use-case/SetWebSocketUrlUseCase.d.ts.map +1 -0
- package/lib/types/src/internal/secure-channel/use-case/SetWebSocketUrlUseCase.test.d.ts +2 -0
- package/lib/types/src/internal/secure-channel/use-case/SetWebSocketUrlUseCase.test.d.ts.map +1 -0
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -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 {
|
|
5
|
-
"mappings": "aAAA,IAAAA,EAAqC,
|
|
6
|
-
"names": ["import_vitest", "
|
|
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.WelcomeScreen1,\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.WelcomeScreen1],\n [0x01, OnboardingState.WelcomeScreen2],\n [0x02, OnboardingState.WelcomeScreen3],\n [0x03, OnboardingState.WelcomeScreen4],\n [0x04, OnboardingState.WelcomeScreenReminder],\n [0x05, OnboardingState.SetupChoice],\n [0x06, OnboardingState.Pin],\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, 0x11]),\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({ length: 0x11 }, (_, index) => index);\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,EAAO,uBAAuB,CAAC,EAAE,QAAQ,CAC9C,iCAAkC,GAClC,iCAAkC,EACpC,CAAC,KACD,UAAOA,EAAO,iBAAiB,CAAC,EAAE,QAAQ,CACxC,cAAe,gBAAc,WAC7B,iBAAkB,CACpB,CAAC,KACD,UAAOA,EAAO,iBAAiB,CAAC,EAAE,QAAQ,CACxC,gBAAiB,kBAAgB,cACnC,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,mBAA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M,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
|
|
1
|
+
"use strict";var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var c=(t,e)=>{for(var s in e)a(t,s,{get:e[s],enumerable:!0})},f=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of l(e))!u.call(t,o)&&o!==s&&a(t,o,{get:()=>e[o],enumerable:!(i=d(e,o))||i.enumerable});return t};var m=t=>f(a({},"__esModule",{value:!0}),t);var g={};c(g,{getOsVersionCommandResponseMockBuilder:()=>S});module.exports=m(g);var n=require("../../../device/DeviceModel"),r=require("../../../device/SecureElementFlags");const S=(t=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:r.SeedWordCount.TwentyFour,currentWordIndex:0,onboardingState:r.OnboardingState.WelcomeScreen1},...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:r.SeedWordCount.TwentyFour,currentWordIndex:0,onboardingState:r.OnboardingState.WelcomeScreen1},...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:r.SeedWordCount.TwentyFour,currentWordIndex:0,onboardingState:r.OnboardingState.WelcomeScreen1},...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:r.SeedWordCount.TwentyFour,currentWordIndex:0,onboardingState:r.OnboardingState.WelcomeScreen1},...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:r.SeedWordCount.TwentyFour,currentWordIndex:0,onboardingState:r.OnboardingState.WelcomeScreen1},...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:r.SeedWordCount.TwentyFour,currentWordIndex:0,onboardingState:r.OnboardingState.WelcomeScreen1}}})[t];0&&(module.exports={getOsVersionCommandResponseMockBuilder});
|
|
2
2
|
//# sourceMappingURL=GetOsVersionCommand.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/api/command/os/__mocks__/GetOsVersionCommand.ts"],
|
|
4
|
-
"sourcesContent": ["import { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\n\nexport const getOsVersionCommandResponseMockBuilder = (\n deviceModelId: DeviceModelId = DeviceModelId.NANO_SP,\n props: Partial<GetOsVersionResponse> = {},\n): GetOsVersionResponse =>\n ({\n [DeviceModelId.NANO_SP]: {\n isBootloader: false,\n isOsu: false,\n targetId: 856686596,\n seTargetId: 856686596,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"4.03\",\n mcuBootloaderVersion: \"3.12\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.NANO_S]: {\n isBootloader: false,\n isOsu: false,\n targetId: 858783748,\n seTargetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.NANO_X]: {\n isBootloader: false,\n isOsu: false,\n targetId: 855638020,\n seTargetId: 855638020,\n seVersion: \"2.2.3\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"2.30\",\n mcuBootloaderVersion: \"1.16\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: 0,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.STAX]: {\n isBootloader: false,\n isOsu: false,\n targetId: 857735172,\n seTargetId: 857735172,\n seVersion: \"1.3.0\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"5.24\",\n mcuBootloaderVersion: \"0.48\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.FLEX]: {\n isBootloader: false,\n isOsu: false,\n targetId: 858783748,\n seTargetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: 0,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.APEX]: {\n isBootloader: false,\n isOsu: false,\n targetId: 858783748,\n seTargetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: 0,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n },\n })[deviceModelId];\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4CAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAA8B,
|
|
6
|
-
"names": ["GetOsVersionCommand_exports", "__export", "getOsVersionCommandResponseMockBuilder", "__toCommonJS", "import_DeviceModel", "deviceModelId", "props"]
|
|
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.WelcomeScreen1,\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.WelcomeScreen1,\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.WelcomeScreen1,\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.WelcomeScreen1,\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.WelcomeScreen1,\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.WelcomeScreen1,\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,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,cACnC,EACA,GAAGA,CACL,EACA,CAAC,gBAAc,MAAM,EAAG,CACtB,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,OACd,mBAAoB,CAClB,eAAgB,GACh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,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,gBAAc,WAC7B,iBAAkB,EAClB,gBAAiB,kBAAgB,cACnC,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,gBAAc,WAC7B,iBAAkB,EAClB,gBAAiB,kBAAgB,cACnC,CACF,CACF,GAAGD,CAAa",
|
|
6
|
+
"names": ["GetOsVersionCommand_exports", "__export", "getOsVersionCommandResponseMockBuilder", "__toCommonJS", "import_DeviceModel", "import_SecureElementFlags", "deviceModelId", "props"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
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.Pin="pin",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
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["SecureElementFlags_exports", "__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 (0x00 to 0x10).\n */\nexport enum OnboardingState {\n /**\n * An encoding not covered by the specification (any byte outside 0x00\u20130x10),\n * which 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 Pin = \"pin\",\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,IAAM,MACNA,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,kBAtBNA,OAAA",
|
|
6
|
+
"names": ["SecureElementFlags_exports", "__export", "OnboardingState", "SeedWordCount", "__toCommonJS"]
|
|
7
7
|
}
|
package/lib/cjs/src/api/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var L=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var he=Object.prototype.hasOwnProperty;var Pe=(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 Be(t))!he.call(p,f)&&f!==a&&L(p,f,{get:()=>t[f],enumerable:!(k=Te(t,f))||k.enumerable});return p},o=(p,t,a)=>(S(p,t,"default"),a&&S(a,t,"default"));var be=p=>S(L({},"__esModule",{value:!0}),p);var e={};Pe(e,{APDU_MAX_PAYLOAD:()=>A.APDU_MAX_PAYLOAD,Apdu:()=>E.Apdu,ApduBuilder:()=>A.ApduBuilder,ApduParser:()=>R.ApduParser,ApduResponse:()=>te.ApduResponse,AppAlreadyInstalledDAError:()=>r.AppAlreadyInstalledDAError,ApplicationChecker:()=>Ge.ApplicationChecker,BatteryStatusType:()=>l.BatteryStatusType,BleDeviceInfos:()=>oe.BleDeviceInfos,ByteArrayBuilder:()=>G.ByteArrayBuilder,ByteArrayParser:()=>I.ByteArrayParser,CallTaskInAppDeviceAction:()=>N.CallTaskInAppDeviceAction,CloseAppCommand:()=>T.CloseAppCommand,CommandResultFactory:()=>n.CommandResultFactory,CommandResultStatus:()=>n.CommandResultStatus,CommandUtils:()=>M.CommandUtils,ConnectToSecureChannelTask:()=>se.ConnectToSecureChannelTask,ConnectedDevice:()=>Le.ConnectedDevice,ConsoleLogger:()=>ge.ConsoleLogger,DEFAULT_UNLOCK_TIMEOUT_MS:()=>_.DEFAULT_UNLOCK_TIMEOUT_MS,DefaultLogTagFormatter:()=>ye.DefaultLogTagFormatter,DeleteLanguagePackCommand:()=>x.DeleteLanguagePackCommand,DeleteLanguagePackCommandError:()=>x.DeleteLanguagePackCommandError,DeleteLanguagePackDAError:()=>r.DeleteLanguagePackDAError,DeviceActionStatus:()=>U.DeviceActionStatus,DeviceConnectionStateMachine:()=>ke.DeviceConnectionStateMachine,DeviceLockedError:()=>r.DeviceLockedError,DeviceManagementKit:()=>xe.DeviceManagementKit,DeviceManagementKitBuilder:()=>ue.DeviceManagementKitBuilder,DeviceModel:()=>m.DeviceModel,DeviceModelId:()=>m.DeviceModelId,DeviceNotOnboardedError:()=>r.DeviceNotOnboardedError,DeviceSessionStateType:()=>pe.DeviceSessionStateType,DeviceStatus:()=>V.DeviceStatus,DmkNetworkClient:()=>ve.DmkNetworkClient,DmkNetworkClientError:()=>Se.DmkNetworkClientError,DmkResultFactory:()=>s.DmkResultFactory,DmkResultStatus:()=>s.DmkResultStatus,FramerUtils:()=>De.FramerUtils,GLOBAL_ERRORS:()=>i.GLOBAL_ERRORS,GenuineCheckDeviceAction:()=>ae.GenuineCheckDeviceAction,GetAppAndVersionCommand:()=>B.GetAppAndVersionCommand,GetApplicationsMetadataTaskError:()=>y.GetApplicationsMetadataTaskError,GetBackgroundImageSizeCommand:()=>u.GetBackgroundImageSizeCommand,GetBackgroundImageSizeCommandError:()=>u.GetBackgroundImageSizeCommandError,GetBatteryStatusCommand:()=>l.GetBatteryStatusCommand,GetDeviceMetadataDeviceAction:()=>w.GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction:()=>z.GetDeviceStatusDeviceAction,GetOsVersionCommand:()=>h.GetOsVersionCommand,GlobalCommandError:()=>i.GlobalCommandError,GlobalCommandErrorHandler:()=>i.GlobalCommandErrorHandler,GoToDashboardDeviceAction:()=>q.GoToDashboardDeviceAction,InstallAppDeviceAction:()=>ne.InstallAppDeviceAction,InstallLanguagePackageDeviceAction:()=>H.InstallLanguagePackageDeviceAction,InstallOrUpdateAppsDeviceAction:()=>K.InstallOrUpdateAppsDeviceAction,InvalidGetFirmwareMetadataResponseError:()=>y.InvalidGetFirmwareMetadataResponseError,InvalidResponseFormatError:()=>D.InvalidResponseFormatError,InvalidStatusWordError:()=>D.InvalidStatusWordError,LEDGER_VENDOR_ID:()=>m.LEDGER_VENDOR_ID,ListAppsCommand:()=>P.ListAppsCommand,ListAppsDeviceAction:()=>Q.ListAppsDeviceAction,ListAppsWithMetadataDeviceAction:()=>X.ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction:()=>ie.ListInstalledAppsDeviceAction,ListLanguagePackCommand:()=>g.ListLanguagePackCommand,ListLanguagePackCommandError:()=>g.ListLanguagePackCommandError,LoadCertificateCommand:()=>b.LoadCertificateCommand,LogLevel:()=>le.LogLevel,OpenAppCommand:()=>O.OpenAppCommand,OpenAppDeviceAction:()=>Y.OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction:()=>j.OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError:()=>r.OutOfMemoryDAError,RefusedByUserDAError:()=>r.RefusedByUserDAError,SecureChannelError:()=>de.SecureChannelError,SecureChannelEventType:()=>ce.SecureChannelEventType,SendCommandInAppDeviceAction:()=>J.SendCommandInAppDeviceAction,StaticDeviceModelDataSource:()=>ee.StaticDeviceModelDataSource,TransportConnectedDevice:()=>Ee.TransportConnectedDevice,TransportDeviceModel:()=>re.TransportDeviceModel,UninstallAppDeviceAction:()=>me.UninstallAppDeviceAction,UnknownDAError:()=>r.UnknownDAError,UnsupportedFirmwareDAError:()=>r.UnsupportedFirmwareDAError,UserInteractionRequired:()=>W.UserInteractionRequired,WaitForAppAndVersionDeviceAction:()=>Z.WaitForAppAndVersionDeviceAction,WebLogsExporterLogger:()=>Ce.WebLogsExporterLogger,XStateDeviceAction:()=>$.XStateDeviceAction,base64StringToBuffer:()=>c.base64StringToBuffer,bufferToBase64String:()=>c.bufferToBase64String,bufferToHexaString:()=>d.bufferToHexaString,connectedDeviceStubBuilder:()=>Re.connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder:()=>fe.defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder:()=>Ae.defaultApduSenderServiceStubBuilder,formatApduReceivedLog:()=>v.formatApduReceivedLog,formatApduSentLog:()=>v.formatApduSentLog,hexaStringToBuffer:()=>d.hexaStringToBuffer,isBase64String:()=>c.isBase64String,isCommandErrorCode:()=>F.isCommandErrorCode,isDashboardName:()=>Ie.isDashboardName,isHexaString:()=>d.isHexaString,isSuccessCommandResult:()=>n.isSuccessCommandResult,isSuccessDmkResult:()=>s.isSuccessDmkResult,noopLogger:()=>C.noopLogger,noopLoggerFactory:()=>C.noopLoggerFactory});module.exports=be(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"),x=require("./command/os/DeleteLanguagePackCommand"),B=require("./command/os/GetAppAndVersionCommand"),u=require("./command/os/GetBackgroundImageSizeCommand"),l=require("./command/os/GetBatteryStatusCommand"),h=require("./command/os/GetOsVersionCommand"),P=require("./command/os/ListAppsCommand"),g=require("./command/os/ListLanguagePackCommand"),b=require("./command/os/LoadCertificateCommand"),O=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"),U=require("./device-action/model/DeviceActionState"),W=require("./device-action/model/UserInteractionRequired"),N=require("./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction"),_=require("./device-action/os/Const"),r=require("./device-action/os/Errors"),w=require("./device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction"),z=require("./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),q=require("./device-action/os/GoToDashboard/GoToDashboardDeviceAction"),H=require("./device-action/os/InstallLanguagePackage/InstallLanguagePackageDeviceAction"),K=require("./device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction"),Q=require("./device-action/os/ListApps/ListAppsDeviceAction"),X=require("./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction"),Y=require("./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),j=require("./device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction"),J=require("./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction"),Z=require("./device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction"),y=require("./device-action/task/Errors"),$=require("./device-action/xstate-utils/XStateDeviceAction"),ee=require("./device-model/data/StaticDeviceModelDataSource"),oe=require("./device-model/model/BleDeviceInfos"),re=require("./device-model/model/DeviceModel"),te=require("./device-session/ApduResponse");o(e,require("./device-session/data/FramerConst"),module.exports);var pe=require("./device-session/DeviceSessionState"),s=require("./model/DmkResult"),ae=require("./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction"),ne=require("./secure-channel/device-action/InstallApp/InstallAppDeviceAction"),ie=require("./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction"),me=require("./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction"),se=require("./secure-channel/task/ConnectToSecureChannelTask"),ce=require("./secure-channel/task/types"),de=require("../internal/secure-channel/model/Errors"),fe=require("./device-session/service/DefaultApduReceiverService.stub"),Ae=require("./device-session/service/DefaultApduSenderService.stub"),De=require("./device-session/utils/FramerUtils"),xe=require("./DeviceManagementKit"),ue=require("./DeviceManagementKitBuilder");o(e,require("./Error"),module.exports);var C=require("./logger-publisher/utils/noopLoggerFactory"),le=require("./logger-subscriber/model/LogLevel"),ge=require("./logger-subscriber/service/ConsoleLogger"),ye=require("./logger-subscriber/service/DefaultLogTagFormatter"),Ce=require("./logger-subscriber/service/WebLogsExporterLogger"),ve=require("./network/DmkNetworkClient"),Se=require("./network/DmkNetworkClientError"),Le=require("./transport/model/ConnectedDevice"),ke=require("./transport/model/DeviceConnectionStateMachine");o(e,require("./transport/model/Errors"),module.exports);var Ee=require("./transport/model/TransportConnectedDevice"),Re=require("./transport/model/TransportConnectedDevice.stub");o(e,require("./types"),module.exports);var v=require("./utils/apduLogs"),Ge=require("./utils/ApplicationChecker"),Ie=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,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 GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n ListLanguagePackCommand,\n type ListLanguagePackCommandArgs,\n ListLanguagePackCommandError,\n type ListLanguagePackCommandResult,\n type ListLanguagePackErrorCodes,\n type ListLanguagePackResponse,\n} from \"@api/command/os/ListLanguagePackCommand\";\nexport {\n type LoadCertificateArgs,\n LoadCertificateCommand,\n type LoadCertificateErrorCodes,\n} from \"@api/command/os/LoadCertificateCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GLOBAL_ERRORS,\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { CallTaskInAppDeviceAction } from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction\";\nexport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nexport {\n AppAlreadyInstalledDAError,\n DeleteLanguagePackDAError,\n DeviceLockedError,\n DeviceNotOnboardedError,\n OutOfMemoryDAError,\n RefusedByUserDAError,\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nexport { GetDeviceMetadataDeviceAction } from \"@api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport type {\n GoToDashboardDAError,\n GoToDashboardDAInput,\n GoToDashboardDAIntermediateValue,\n GoToDashboardDAOutput,\n GoToDashboardDARequiredInteraction,\n GoToDashboardDAState,\n} from \"@api/device-action/os/GoToDashboard/types\";\nexport { InstallLanguagePackageDeviceAction } from \"@api/device-action/os/InstallLanguagePackage/InstallLanguagePackageDeviceAction\";\nexport { InstallOrUpdateAppsDeviceAction } from \"@api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { OpenAppWithDependenciesDeviceAction } from \"@api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport type {\n WaitForAppAndVersionDAError,\n WaitForAppAndVersionDAInput,\n WaitForAppAndVersionDAIntermediateValue,\n WaitForAppAndVersionDAOutput,\n WaitForAppAndVersionDARequiredInteraction,\n WaitForAppAndVersionDAState,\n} from \"@api/device-action/os/WaitForAppAndVersion/types\";\nexport { WaitForAppAndVersionDeviceAction } from \"@api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction\";\nexport {\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
|
|
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_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"]
|
|
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,2CALd,gBAMA,IAAAO,EAAiC,4CACjCC,EAAgC,2CAEhCC,EAGO,+BACPC,EAIO,4CACPC,EAAgC,2CAChCC,EAMO,qDACPC,EAGO,mDACPC,EAMO,yDACPC,EAKO,mDACPC,EAIO,+CACPC,EAKO,2CACPC,EAOO,mDACPC,EAIO,kDACPC,EAGO,0CACPC,EAAmC,4CACnCC,EAA6B,2CAC7BC,EAIO,iDACPC,EAIO,mCACPC,EAA6B,oCAC7BC,EAQO,0CAEPC,EAGO,sDACPC,EAAwC,4DACxCC,EAA0C,qFAC1CC,EAA0C,uCAC1CrB,EASO,wCACPsB,EAA8C,iFAC9CC,EAA4C,6EAC5CC,EAA0C,yEAS1CC,EAAmD,2FACnDC,EAAgD,qFAChDC,EAAqC,+DACrCC,EAAiD,uFACjDC,EAAoC,yEACpCC,EAAoD,6FACpDC,EAA6C,2FAS7CC,EAAiD,uFACjDhC,EAGO,0CACPiC,GAGO,8DACPC,GAA4C,8DAC5CC,GAA+B,kDAC/BpB,GAAqC,+CACrCqB,GAA6B,4CAC7BvC,EAAAN,EAAc,gDAtJd,gBAuJA,IAAA8C,GAGO,kDACPC,EAIO,gCACPC,GAAyC,mFACzCC,GAAuC,+EACvCC,GAA8C,6FAE9CC,GAAyC,mFACzCC,GAA2C,+DAC3CC,GAAuC,0CACvC5C,GAAmC,iDAEnC6C,GAAsD,uEACtDC,GAAoD,qEACpDC,GAA4B,iDAC5BC,GAAoC,oCACpCC,GAA2C,2CAC3CpD,EAAAN,EAAc,sBA9Kd,gBA+KA,IAAA2D,EAGO,yDACPC,GAAyB,iDACzBC,GAA8B,wDAC9BC,GAAuC,iEAEvCC,GAAsC,gEACtCC,GAQO,yCACPC,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",
|
|
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
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var P=(n,e)=>{for(var r in e)y(n,r,{get:e[r],enumerable:!0})},k=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of b(e))!V.call(n,i)&&i!==r&&y(n,i,{get:()=>e[i],enumerable:!(t=h(e,i))||t.enumerable});return n};var I=n=>k(y({},"__esModule",{value:!0}),n),g=(n,e,r,t)=>{for(var i=t>1?void 0:t?h(e,r):e,a=n.length-1,p;a>=0;a--)(p=n[a])&&(i=(t?p(e,r,i):p(i))||i);return t&&i&&y(e,r,i),i},v=(n,e)=>(r,t)=>e(r,t,n);var T={};P(T,{HttpManagerApiDataSource:()=>l});module.exports=I(T);var u=require("inversify"),o=require("purify-ts"),d=require("../../../api/network/DmkNetworkClient"),A=require("../../../api/network/DmkNetworkClientError"),_=require("../../manager-api/di/managerApiTypes"),m=require("../../manager-api/model/Application"),w=require("../../manager-api/model/Const"),D=require("../../manager-api/model/Const"),f=require("../../manager-api/model/Errors"),c=require("./ManagerApiDto");const s=n=>n instanceof A.DmkNetworkClientError&&n.cause!==void 0?new f.HttpFetchApiError(n.cause):new f.HttpFetchApiError(n);let l=class{http;_provider=w.DEFAULT_PROVIDER;_firmwareDistributionSalt=D.DEFAULT_FIRMWARE_DISTRIBUTION_SALT;constructor({managerApiUrl:e,provider:r,firmwareDistributionSalt:t}){this.http=new d.DmkNetworkClient({baseUrl:e}),this._provider=r,this._firmwareDistributionSalt=t}setProvider(e){this._provider===e||e<1||(this._provider=e)}getProvider(){return this._provider}getAppList(e){const{targetId:r,firmwareVersionName:t}=e;return(0,o.EitherAsync)(()=>this.http.get("/v2/apps/by-target",{params:{target_id:r,provider:this._provider,firmware_version_name:t}})).chain(i=>this.mapApplicationDtoToApplication(i)).mapLeft(s)}getMcuList(){return(0,o.EitherAsync)(()=>this.http.get("/mcu_versions")).chain(e=>this.mapMcuDtoToMcu(e)).mapLeft(s)}getDeviceVersion(e){const{targetId:r}=e;return(0,o.EitherAsync)(()=>this.http.get("/get_device_version",{params:{target_id:r,provider:this._provider}})).chain(t=>this.mapDeviceVersionDto(t)).mapLeft(s)}getFirmwareVersion(e){const{deviceId:r,version:t}=e;return(0,o.EitherAsync)(()=>this.http.get("/get_firmware_version",{params:{device_version:r,version_name:t,provider:this._provider}})).chain(i=>this.mapFinalFirmwareDto(i)).mapLeft(s)}getFirmwareVersionById(e){return(0,o.EitherAsync)(()=>this.http.get(`/firmware_final_versions/${e}`)).chain(r=>this.mapFinalFirmwareDto(r)).mapLeft(s)}getOsuFirmwareVersion(e){const{deviceId:r,version:t}=e;return(0,o.EitherAsync)(()=>this.http.get("/get_osu_version",{params:{device_version:r,version_name:t,provider:this._provider}})).chain(i=>this.mapOsuFirmwareDto(i)).mapLeft(s)}getLatestFirmwareVersion(e){const
|
|
1
|
+
"use strict";var y=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var P=(n,e)=>{for(var r in e)y(n,r,{get:e[r],enumerable:!0})},k=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of b(e))!V.call(n,i)&&i!==r&&y(n,i,{get:()=>e[i],enumerable:!(t=h(e,i))||t.enumerable});return n};var I=n=>k(y({},"__esModule",{value:!0}),n),g=(n,e,r,t)=>{for(var i=t>1?void 0:t?h(e,r):e,a=n.length-1,p;a>=0;a--)(p=n[a])&&(i=(t?p(e,r,i):p(i))||i);return t&&i&&y(e,r,i),i},v=(n,e)=>(r,t)=>e(r,t,n);var T={};P(T,{HttpManagerApiDataSource:()=>l});module.exports=I(T);var u=require("inversify"),o=require("purify-ts"),d=require("../../../api/network/DmkNetworkClient"),A=require("../../../api/network/DmkNetworkClientError"),_=require("../../manager-api/di/managerApiTypes"),m=require("../../manager-api/model/Application"),w=require("../../manager-api/model/Const"),D=require("../../manager-api/model/Const"),f=require("../../manager-api/model/Errors"),c=require("./ManagerApiDto");const s=n=>n instanceof A.DmkNetworkClientError&&n.cause!==void 0?new f.HttpFetchApiError(n.cause):new f.HttpFetchApiError(n);let l=class{http;_provider=w.DEFAULT_PROVIDER;_firmwareDistributionSalt=D.DEFAULT_FIRMWARE_DISTRIBUTION_SALT;constructor({managerApiUrl:e,provider:r,firmwareDistributionSalt:t}){this.http=new d.DmkNetworkClient({baseUrl:e}),this._provider=r,this._firmwareDistributionSalt=t}setProvider(e){this._provider===e||e<1||(this._provider=e)}getProvider(){return this._provider}getAppList(e){const{targetId:r,firmwareVersionName:t}=e;return(0,o.EitherAsync)(()=>this.http.get("/v2/apps/by-target",{params:{target_id:r,provider:this._provider,firmware_version_name:t}})).chain(i=>this.mapApplicationDtoToApplication(i)).mapLeft(s)}getMcuList(){return(0,o.EitherAsync)(()=>this.http.get("/mcu_versions")).chain(e=>this.mapMcuDtoToMcu(e)).mapLeft(s)}getDeviceVersion(e){const{targetId:r}=e;return(0,o.EitherAsync)(()=>this.http.get("/get_device_version",{params:{target_id:r,provider:this._provider}})).chain(t=>this.mapDeviceVersionDto(t)).mapLeft(s)}getFirmwareVersion(e){const{deviceId:r,version:t}=e;return(0,o.EitherAsync)(()=>this.http.get("/get_firmware_version",{params:{device_version:r,version_name:t,provider:this._provider}})).chain(i=>this.mapFinalFirmwareDto(i)).mapLeft(s)}getFirmwareVersionById(e){return(0,o.EitherAsync)(()=>this.http.get(`/firmware_final_versions/${e}`)).chain(r=>this.mapFinalFirmwareDto(r)).mapLeft(s)}getOsuFirmwareVersion(e){const{deviceId:r,version:t}=e;return(0,o.EitherAsync)(()=>this.http.get("/get_osu_version",{params:{device_version:r,version_name:t,provider:this._provider}})).chain(i=>this.mapOsuFirmwareDto(i)).mapLeft(s)}getLatestFirmwareVersion(e){const{currentFinalFirmwareId:r,deviceId:t}=e;return(0,o.EitherAsync)(()=>this.http.get("/get_latest_firmware",{params:{current_se_firmware_final_version:r,device_version:t,provider:this._provider,salt:this._firmwareDistributionSalt}})).chain(i=>this.mapLatestFirmwareDto(i)).mapLeft(s)}getAppsByHash(e){const{hashes:r}=e;return(0,o.EitherAsync)(()=>this.http.post("/v2/apps/hash",r)).chain(t=>this.mapNullableApplicationDtoToApplication(t)).mapLeft(s)}getLanguagePackages(e){const{deviceId:r,currentFinalFirmwareId:t}=e;return(0,o.EitherAsync)(()=>this.http.get("/language-packages",{params:{device_version:r,current_se_firmware_final_version:t}})).chain(i=>this.mapLanguagesDtoToLanguages(i)).mapLeft(s)}mapAppTypeDtoToAppType(e){if(e===null)return null;switch(e){case c.AppTypeDto.currency:return m.AppType.currency;case c.AppTypeDto.plugin:return m.AppType.plugin;case c.AppTypeDto.tool:return m.AppType.tool;case c.AppTypeDto.swap:return m.AppType.swap}}mapApplicationDtoToApplication(e){return(0,o.EitherAsync)(()=>Promise.resolve(e.map(r=>this.mapApplicationDto(r))))}mapNullableApplicationDtoToApplication(e){return(0,o.EitherAsync)(()=>Promise.resolve(e.map(r=>r===null?null:this.mapApplicationDto(r))))}mapApplicationDto(e){if(typeof e!="object"||typeof e.versionId!="number"||typeof e.versionName!="string"||e.versionDisplayName!==null&&typeof e.versionDisplayName!="string"||typeof e.version!="string"||e.currencyId!==null&&typeof e.currencyId!="string"||e.description!==null&&typeof e.description!="string"||e.applicationType!==null&&typeof e.applicationType!="string"||typeof e.dateModified!="string"||e.icon!==null&&typeof e.icon!="string"||e.authorName!==null&&typeof e.authorName!="string"||e.supportURL!==null&&typeof e.supportURL!="string"||e.contactURL!==null&&typeof e.contactURL!="string"||e.sourceURL!==null&&typeof e.sourceURL!="string"||e.compatibleWallets!==null&&typeof e.compatibleWallets!="string"||typeof e.hash!="string"||typeof e.perso!="string"||typeof e.firmware!="string"||typeof e.firmwareKey!="string"||typeof e.delete!="string"||typeof e.deleteKey!="string"||e.bytes!==null&&typeof e.bytes!="number"||e.warning!==null&&typeof e.warning!="string"||typeof e.isDevTools!="boolean"||e.category!==null&&typeof e.category!="number"||e.parent!==null&&typeof e.parent!="number"||e.parentName!==null&&typeof e.parentName!="string")throw new Error(`Incomplete application: ${JSON.stringify(e)}`);const{applicationType:r,hash:t,perso:i,firmware:a,firmwareKey:p,delete:F,deleteKey:E,...L}=e;return{...L,hash:t,perso:i,firmware:a,firmwareKey:p,delete:F,deleteKey:E,applicationType:this.mapAppTypeDtoToAppType(r)}}mapMcuDtoToMcu(e){return(0,o.EitherAsync)(()=>Promise.resolve(e.map(r=>{if(typeof r!="object"||typeof r.id!="number"||typeof r.name!="string"||typeof r.from_bootloader_version!="string")throw new Error(`Incomplete MCU version: ${JSON.stringify(r)}`);return{id:r.id,name:r.name,fromBootloaderVersion:r.from_bootloader_version,providers:r.providers}})))}mapDeviceVersionDto(e){return(0,o.EitherAsync)(()=>{if(typeof e!="object"||typeof e.id!="number")throw new Error(`Incomplete device version: ${JSON.stringify(e)}`);const r={id:e.id};return Promise.resolve(r)})}mapFinalFirmwareDto(e){return(0,o.EitherAsync)(()=>{if(typeof e!="object"||typeof e.id!="number"||typeof e.version!="string"||typeof e.perso!="string"||e.firmware!==null&&typeof e.firmware!="string"||e.firmware_key!==null&&typeof e.firmware_key!="string"||e.hash!==null&&typeof e.hash!="string"||e.bytes!==null&&typeof e.bytes!="number"||!Array.isArray(e.mcu_versions))throw new Error(`Incomplete final firmware: ${JSON.stringify(e)}`);const r={id:e.id,version:e.version,perso:e.perso,firmware:e.firmware,firmwareKey:e.firmware_key,hash:e.hash,bytes:e.bytes,mcuVersions:e.mcu_versions};return Promise.resolve(r)})}mapLatestFirmwareDto(e){return(0,o.EitherAsync)(()=>{if(e.result==="null")return Promise.resolve(null);if(e.result!=="success"||!e.se_firmware_osu_version)throw new Error(`Latest firmware could not be retrieved: ${e.result}`);const r=e.se_firmware_osu_version;return Promise.resolve(r)}).chain(r=>r===null?(0,o.EitherAsync)(()=>Promise.resolve(o.Nothing)):this.mapOsuFirmwareDto(r).map(t=>(0,o.Just)(t)))}mapOsuFirmwareDto(e){return(0,o.EitherAsync)(()=>{if(typeof e!="object"||typeof e.id!="number"||e.notes!==null&&typeof e.notes!="string"||typeof e.perso!="string"||typeof e.firmware!="string"||typeof e.firmware_key!="string"||e.hash!==null&&typeof e.hash!="string"||typeof e.next_se_firmware_final_version!="number")throw new Error(`Incomplete latest firmware: ${JSON.stringify(e)}`);const r={id:e.id,notes:e.notes,perso:e.perso,firmware:e.firmware,firmwareKey:e.firmware_key,hash:e.hash,nextFinalFirmware:e.next_se_firmware_final_version};return Promise.resolve(r)})}mapLanguagesDtoToLanguages(e){return(0,o.EitherAsync)(()=>Promise.resolve(e.map(r=>this.mapLanguageDto(r))))}mapLanguageDto(e){if(typeof e!="object"||typeof e.language!="string"||typeof e.languagePackageVersionId!="number"||typeof e.version!="string"||typeof e.language_package_id!="number"||typeof e.apdu_install_url!="string"||typeof e.apdu_uninstall_url!="string"||typeof e.bytes!="number"||typeof e.date_creation!="string"||typeof e.date_last_modified!="string")throw new Error(`Incomplete language version: ${JSON.stringify(e)}`);return{language:e.language,languagePackageVersionId:e.languagePackageVersionId,version:e.version,languagePackageId:e.language_package_id,apduInstallUrl:e.apdu_install_url,apduUninstallUrl:e.apdu_uninstall_url,bytes:e.bytes,dateCreation:e.date_creation,dateLastModified:e.date_last_modified}}};l=g([(0,u.injectable)(),v(0,(0,u.inject)(_.managerApiTypes.DmkConfig))],l);0&&(module.exports={HttpManagerApiDataSource});
|
|
2
2
|
//# sourceMappingURL=HttpManagerApiDataSource.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/internal/manager-api/data/HttpManagerApiDataSource.ts"],
|
|
4
|
-
"sourcesContent": ["import { inject, injectable } from \"inversify\";\nimport { EitherAsync, Just, Maybe, Nothing } from \"purify-ts\";\n\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { DmkNetworkClient } from \"@api/network/DmkNetworkClient\";\nimport { DmkNetworkClientError } from \"@api/network/DmkNetworkClientError\";\nimport { managerApiTypes } from \"@internal/manager-api/di/managerApiTypes\";\nimport {\n type Application,\n AppType,\n} from \"@internal/manager-api/model/Application\";\nimport { DEFAULT_PROVIDER } from \"@internal/manager-api/model/Const\";\nimport { DEFAULT_FIRMWARE_DISTRIBUTION_SALT } from \"@internal/manager-api/model/Const\";\nimport { type DeviceVersion } from \"@internal/manager-api/model/Device\";\nimport { HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\nimport type {\n FinalFirmware,\n McuFirmware,\n OsuFirmware,\n} from \"@internal/manager-api/model/Firmware\";\nimport { type LanguagePackage } from \"@internal/manager-api/model/Language\";\nimport {\n type GetAppByHashParams,\n type GetAppListParams,\n type GetDeviceVersionParams,\n type GetFirmwareVersionParams,\n type GetLanguagePackagesParams,\n type GetLatestFirmwareVersionParams,\n} from \"@internal/manager-api/model/Params\";\n\nimport { ManagerApiDataSource } from \"./ManagerApiDataSource\";\nimport {\n ApplicationDto,\n AppTypeDto,\n DeviceVersionDto,\n FirmwareFinalVersionDto,\n FirmwareOsuVersionDto,\n LanguagePackageVersionDto,\n LatestFirmwareOsuVersionResponseDto,\n McuVersionDto,\n} from \"./ManagerApiDto\";\n\nconst toHttpFetchApiError = (error: unknown): HttpFetchApiError => {\n // The network client wraps fetch errors in DmkNetworkClientError. Unwrap the\n // original cause when available so consumers (and tests) keep seeing the\n // underlying error.\n if (error instanceof DmkNetworkClientError && error.cause !== undefined) {\n return new HttpFetchApiError(error.cause);\n }\n return new HttpFetchApiError(error);\n};\n\n@injectable()\nexport class HttpManagerApiDataSource implements ManagerApiDataSource {\n private readonly http: DmkNetworkClient;\n private _provider: number = DEFAULT_PROVIDER;\n private _firmwareDistributionSalt: string =\n DEFAULT_FIRMWARE_DISTRIBUTION_SALT;\n\n constructor(\n @inject(managerApiTypes.DmkConfig)\n { managerApiUrl, provider, firmwareDistributionSalt }: DmkConfig,\n ) {\n this.http = new DmkNetworkClient({ baseUrl: managerApiUrl });\n this._provider = provider;\n this._firmwareDistributionSalt = firmwareDistributionSalt;\n }\n\n setProvider(provider: number): void {\n if (this._provider === provider || provider < 1) {\n return;\n }\n this._provider = provider;\n }\n\n getProvider(): number {\n return this._provider;\n }\n\n getAppList(\n params: GetAppListParams,\n ): EitherAsync<HttpFetchApiError, Array<Application>> {\n const { targetId, firmwareVersionName } = params;\n return EitherAsync(() =>\n this.http.get(\"/v2/apps/by-target\", {\n params: {\n target_id: targetId,\n provider: this._provider,\n firmware_version_name: firmwareVersionName,\n },\n }),\n )\n .chain((apps) =>\n this.mapApplicationDtoToApplication(apps as Array<ApplicationDto>),\n )\n .mapLeft(toHttpFetchApiError);\n }\n\n getMcuList(): EitherAsync<HttpFetchApiError, Array<McuFirmware>> {\n return EitherAsync(() => this.http.get(\"/mcu_versions\"))\n .chain((mcus) => this.mapMcuDtoToMcu(mcus as Array<McuVersionDto>))\n .mapLeft(toHttpFetchApiError);\n }\n\n getDeviceVersion(\n params: GetDeviceVersionParams,\n ): EitherAsync<HttpFetchApiError, DeviceVersion> {\n const { targetId } = params;\n return EitherAsync(() =>\n this.http.get(\"/get_device_version\", {\n params: { target_id: targetId, provider: this._provider },\n }),\n )\n .chain((deviceVersion) =>\n this.mapDeviceVersionDto(deviceVersion as DeviceVersionDto),\n )\n .mapLeft(toHttpFetchApiError);\n }\n\n getFirmwareVersion(\n params: GetFirmwareVersionParams,\n ): EitherAsync<HttpFetchApiError, FinalFirmware> {\n const { deviceId, version } = params;\n return EitherAsync(() =>\n this.http.get(\"/get_firmware_version\", {\n params: {\n device_version: deviceId,\n version_name: version,\n provider: this._provider,\n },\n }),\n )\n .chain((finalFirmware) =>\n this.mapFinalFirmwareDto(finalFirmware as FirmwareFinalVersionDto),\n )\n .mapLeft(toHttpFetchApiError);\n }\n\n getFirmwareVersionById(\n finalFirmwareId: number,\n ): EitherAsync<HttpFetchApiError, FinalFirmware> {\n return EitherAsync(() =>\n this.http.get(`/firmware_final_versions/${finalFirmwareId}`),\n )\n .chain((finalFirmware) =>\n this.mapFinalFirmwareDto(finalFirmware as FirmwareFinalVersionDto),\n )\n .mapLeft(toHttpFetchApiError);\n }\n\n getOsuFirmwareVersion(\n params: GetFirmwareVersionParams,\n ): EitherAsync<HttpFetchApiError, OsuFirmware> {\n const { deviceId, version } = params;\n return EitherAsync(() =>\n this.http.get(\"/get_osu_version\", {\n params: {\n device_version: deviceId,\n version_name: version,\n provider: this._provider,\n },\n }),\n )\n .chain((osuFirmware) =>\n this.mapOsuFirmwareDto(osuFirmware as FirmwareOsuVersionDto),\n )\n .mapLeft(toHttpFetchApiError);\n }\n\n getLatestFirmwareVersion(\n params: GetLatestFirmwareVersionParams,\n ): EitherAsync<HttpFetchApiError, Maybe<OsuFirmware>> {\n const livecommonversion = \"34.27.0\"; // Legacy parameter that should just be a too old\n const { currentFinalFirmwareId, deviceId } = params;\n return EitherAsync(() =>\n this.http.get(\"/get_latest_firmware\", {\n params: {\n current_se_firmware_final_version: currentFinalFirmwareId,\n device_version: deviceId,\n provider: this._provider,\n salt: this._firmwareDistributionSalt,\n livecommonversion,\n },\n }),\n )\n .chain((latestFirmware) =>\n this.mapLatestFirmwareDto(\n latestFirmware as LatestFirmwareOsuVersionResponseDto,\n ),\n )\n .mapLeft(toHttpFetchApiError);\n }\n\n getAppsByHash(\n params: GetAppByHashParams,\n ): EitherAsync<HttpFetchApiError, Array<Application | null>> {\n const { hashes } = params;\n return EitherAsync(() => this.http.post(\"/v2/apps/hash\", hashes))\n .chain((apps) =>\n this.mapNullableApplicationDtoToApplication(\n apps as Array<ApplicationDto | null>,\n ),\n )\n .mapLeft(toHttpFetchApiError);\n }\n\n getLanguagePackages(\n params: GetLanguagePackagesParams,\n ): EitherAsync<HttpFetchApiError, Array<LanguagePackage>> {\n const { deviceId, currentFinalFirmwareId } = params;\n return EitherAsync(() =>\n this.http.get(\"/language-packages\", {\n params: {\n device_version: deviceId,\n current_se_firmware_final_version: currentFinalFirmwareId,\n },\n }),\n )\n .chain((apps) =>\n this.mapLanguagesDtoToLanguages(\n apps as Array<LanguagePackageVersionDto>,\n ),\n )\n .mapLeft(toHttpFetchApiError);\n }\n\n private mapAppTypeDtoToAppType(appType: AppTypeDto | null): AppType | null {\n if (appType === null) {\n return null;\n }\n switch (appType) {\n case AppTypeDto.currency:\n return AppType.currency;\n case AppTypeDto.plugin:\n return AppType.plugin;\n case AppTypeDto.tool:\n return AppType.tool;\n case AppTypeDto.swap:\n return AppType.swap;\n }\n }\n\n private mapApplicationDtoToApplication(\n apps: Array<ApplicationDto>,\n ): EitherAsync<Error, Array<Application>> {\n return EitherAsync(() =>\n Promise.resolve(apps.map((app) => this.mapApplicationDto(app))),\n );\n }\n\n private mapNullableApplicationDtoToApplication(\n apps: Array<ApplicationDto | null>,\n ): EitherAsync<Error, Array<Application | null>> {\n return EitherAsync(() =>\n Promise.resolve(\n apps.map((app) => {\n if (app === null) {\n return null;\n }\n return this.mapApplicationDto(app);\n }),\n ),\n );\n }\n\n private mapApplicationDto(app: ApplicationDto): Application {\n if (\n typeof app !== \"object\" ||\n typeof app.versionId !== \"number\" ||\n typeof app.versionName !== \"string\" ||\n (app.versionDisplayName !== null &&\n typeof app.versionDisplayName !== \"string\") ||\n typeof app.version !== \"string\" ||\n (app.currencyId !== null && typeof app.currencyId !== \"string\") ||\n (app.description !== null && typeof app.description !== \"string\") ||\n (app.applicationType !== null &&\n typeof app.applicationType !== \"string\") ||\n typeof app.dateModified !== \"string\" ||\n (app.icon !== null && typeof app.icon !== \"string\") ||\n (app.authorName !== null && typeof app.authorName !== \"string\") ||\n (app.supportURL !== null && typeof app.supportURL !== \"string\") ||\n (app.contactURL !== null && typeof app.contactURL !== \"string\") ||\n (app.sourceURL !== null && typeof app.sourceURL !== \"string\") ||\n (app.compatibleWallets !== null &&\n typeof app.compatibleWallets !== \"string\") ||\n typeof app.hash !== \"string\" ||\n typeof app.perso !== \"string\" ||\n typeof app.firmware !== \"string\" ||\n typeof app.firmwareKey !== \"string\" ||\n typeof app.delete !== \"string\" ||\n typeof app.deleteKey !== \"string\" ||\n (app.bytes !== null && typeof app.bytes !== \"number\") ||\n (app.warning !== null && typeof app.warning !== \"string\") ||\n typeof app.isDevTools !== \"boolean\" ||\n (app.category !== null && typeof app.category !== \"number\") ||\n (app.parent !== null && typeof app.parent !== \"number\") ||\n (app.parentName !== null && typeof app.parentName !== \"string\")\n ) {\n throw new Error(`Incomplete application: ${JSON.stringify(app)}`);\n }\n const {\n applicationType,\n hash,\n perso,\n firmware,\n firmwareKey,\n delete: del,\n deleteKey,\n ...rest\n } = app;\n const ret: Application = {\n ...rest,\n hash: hash!,\n perso: perso!,\n firmware: firmware!,\n firmwareKey: firmwareKey!,\n delete: del!,\n deleteKey: deleteKey!,\n applicationType: this.mapAppTypeDtoToAppType(applicationType),\n };\n return ret;\n }\n\n private mapMcuDtoToMcu(\n mcus: Array<McuVersionDto>,\n ): EitherAsync<Error, Array<McuFirmware>> {\n return EitherAsync(() =>\n Promise.resolve(\n mcus.map((mcu) => {\n if (\n typeof mcu !== \"object\" ||\n typeof mcu.id !== \"number\" ||\n typeof mcu.name !== \"string\" ||\n typeof mcu.from_bootloader_version !== \"string\"\n ) {\n throw new Error(`Incomplete MCU version: ${JSON.stringify(mcu)}`);\n }\n const ret: McuFirmware = {\n id: mcu.id,\n name: mcu.name,\n fromBootloaderVersion: mcu.from_bootloader_version,\n providers: mcu.providers,\n };\n return ret;\n }),\n ),\n );\n }\n\n private mapDeviceVersionDto(\n deviceVersion: DeviceVersionDto,\n ): EitherAsync<Error, DeviceVersion> {\n return EitherAsync(() => {\n if (\n typeof deviceVersion !== \"object\" ||\n typeof deviceVersion.id !== \"number\"\n ) {\n throw new Error(\n `Incomplete device version: ${JSON.stringify(deviceVersion)}`,\n );\n }\n const ret: DeviceVersion = {\n id: deviceVersion.id,\n };\n return Promise.resolve(ret);\n });\n }\n\n private mapFinalFirmwareDto(\n finalFirmware: FirmwareFinalVersionDto,\n ): EitherAsync<Error, FinalFirmware> {\n return EitherAsync(() => {\n if (\n typeof finalFirmware !== \"object\" ||\n typeof finalFirmware.id !== \"number\" ||\n typeof finalFirmware.version !== \"string\" ||\n typeof finalFirmware.perso !== \"string\" ||\n (finalFirmware.firmware !== null &&\n typeof finalFirmware.firmware !== \"string\") ||\n (finalFirmware.firmware_key !== null &&\n typeof finalFirmware.firmware_key !== \"string\") ||\n (finalFirmware.hash !== null &&\n typeof finalFirmware.hash !== \"string\") ||\n (finalFirmware.bytes !== null &&\n typeof finalFirmware.bytes !== \"number\") ||\n !Array.isArray(finalFirmware.mcu_versions)\n ) {\n throw new Error(\n `Incomplete final firmware: ${JSON.stringify(finalFirmware)}`,\n );\n }\n const ret: FinalFirmware = {\n id: finalFirmware.id,\n version: finalFirmware.version,\n perso: finalFirmware.perso,\n firmware: finalFirmware.firmware,\n firmwareKey: finalFirmware.firmware_key,\n hash: finalFirmware.hash,\n bytes: finalFirmware.bytes,\n mcuVersions: finalFirmware.mcu_versions,\n };\n return Promise.resolve(ret);\n });\n }\n\n private mapLatestFirmwareDto(\n latestFirmware: LatestFirmwareOsuVersionResponseDto,\n ): EitherAsync<Error, Maybe<OsuFirmware>> {\n return EitherAsync<Error, FirmwareOsuVersionDto | null>(() => {\n /**\n * This is how we know that there is no update available.\n * See the {@link https://github.com/LedgerHQ/ledger-live/blob/develop/libs/device-core/src/managerApi/repositories/HttpManagerApiRepository.ts#L59-L61 | ledger-live implementation}.\n */\n if (latestFirmware.result === \"null\") {\n return Promise.resolve(null);\n }\n if (\n latestFirmware.result !== \"success\" ||\n !latestFirmware.se_firmware_osu_version\n ) {\n throw new Error(\n `Latest firmware could not be retrieved: ${latestFirmware.result}`,\n );\n }\n const osuDto = latestFirmware.se_firmware_osu_version;\n return Promise.resolve(osuDto);\n }).chain((osuDto) => {\n if (null === osuDto) {\n return EitherAsync(() => Promise.resolve(Nothing));\n }\n return this.mapOsuFirmwareDto(osuDto).map((osuFirmware) =>\n Just(osuFirmware),\n );\n });\n }\n\n private mapOsuFirmwareDto(\n osuDto: FirmwareOsuVersionDto,\n ): EitherAsync<Error, OsuFirmware> {\n return EitherAsync(() => {\n if (\n typeof osuDto !== \"object\" ||\n typeof osuDto.id !== \"number\" ||\n (osuDto.notes !== null && typeof osuDto.notes !== \"string\") ||\n typeof osuDto.perso !== \"string\" ||\n typeof osuDto.firmware !== \"string\" ||\n typeof osuDto.firmware_key !== \"string\" ||\n (osuDto.hash !== null && typeof osuDto.hash !== \"string\") ||\n typeof osuDto.next_se_firmware_final_version !== \"number\"\n ) {\n throw new Error(\n `Incomplete latest firmware: ${JSON.stringify(osuDto)}`,\n );\n }\n const ret: OsuFirmware = {\n id: osuDto.id,\n notes: osuDto.notes,\n perso: osuDto.perso,\n firmware: osuDto.firmware,\n firmwareKey: osuDto.firmware_key,\n hash: osuDto.hash,\n nextFinalFirmware: osuDto.next_se_firmware_final_version,\n };\n return Promise.resolve(ret);\n });\n }\n\n private mapLanguagesDtoToLanguages(\n languages: Array<LanguagePackageVersionDto>,\n ): EitherAsync<Error, Array<LanguagePackage>> {\n return EitherAsync(() =>\n Promise.resolve(\n languages.map((language) => this.mapLanguageDto(language)),\n ),\n );\n }\n\n private mapLanguageDto(language: LanguagePackageVersionDto): LanguagePackage {\n if (\n typeof language !== \"object\" ||\n typeof language.language !== \"string\" ||\n typeof language.languagePackageVersionId !== \"number\" ||\n typeof language.version !== \"string\" ||\n typeof language.language_package_id !== \"number\" ||\n typeof language.apdu_install_url !== \"string\" ||\n typeof language.apdu_uninstall_url !== \"string\" ||\n typeof language.bytes !== \"number\" ||\n typeof language.date_creation !== \"string\" ||\n typeof language.date_last_modified !== \"string\"\n ) {\n throw new Error(\n `Incomplete language version: ${JSON.stringify(language)}`,\n );\n }\n const ret: LanguagePackage = {\n language: language.language,\n languagePackageVersionId: language.languagePackageVersionId,\n version: language.version,\n languagePackageId: language.language_package_id,\n apduInstallUrl: language.apdu_install_url,\n apduUninstallUrl: language.apdu_uninstall_url,\n bytes: language.bytes,\n dateCreation: language.date_creation,\n dateLastModified: language.date_last_modified,\n };\n return ret;\n }\n}\n"],
|
|
5
|
-
"mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBACnCC,EAAkD,qBAGlDC,EAAiC,yCACjCC,EAAsC,8CACtCC,EAAgC,oDAChCC,EAGO,mDACPC,EAAiC,6CACjCA,EAAmD,6CAEnDC,EAAkC,8CAiBlCC,EASO,2BAEP,MAAMC,EAAuBC,GAIvBA,aAAiB,yBAAyBA,EAAM,QAAU,OACrD,IAAI,oBAAkBA,EAAM,KAAK,EAEnC,IAAI,oBAAkBA,CAAK,EAI7B,IAAMC,EAAN,KAA+D,CACnD,KACT,UAAoB,mBACpB,0BACN,qCAEF,YAEE,CAAE,cAAAC,EAAe,SAAAC,EAAU,yBAA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K,IAAI,4BAA4BA,CAAe,EAAE,CAC7D,EACG,MAAOD,GACN,KAAK,oBAAoBA,CAAwC,CACnE,EACC,QAAQd,CAAmB,CAChC,CAEA,sBACEM,EAC6C,CAC7C,KAAM,CAAE,SAAAM,EAAU,QAAAC,CAAQ,EAAIP,EAC9B,SAAO,eAAY,IACjB,KAAK,KAAK,IAAI,mBAAoB,CAChC,OAAQ,CACN,eAAgBM,EAChB,aAAcC,EACd,SAAU,KAAK,SACjB,CACF,CAAC,CACH,EACG,MAAOG,GACN,KAAK,kBAAkBA,CAAoC,CAC7D,EACC,QAAQhB,CAAmB,CAChC,CAEA,yBACEM,EACoD,CACpD,
|
|
6
|
-
"names": ["HttpManagerApiDataSource_exports", "__export", "HttpManagerApiDataSource", "__toCommonJS", "import_inversify", "import_purify_ts", "import_DmkNetworkClient", "import_DmkNetworkClientError", "import_managerApiTypes", "import_Application", "import_Const", "import_Errors", "import_ManagerApiDto", "toHttpFetchApiError", "error", "HttpManagerApiDataSource", "managerApiUrl", "provider", "firmwareDistributionSalt", "params", "targetId", "firmwareVersionName", "apps", "mcus", "deviceVersion", "deviceId", "version", "finalFirmware", "finalFirmwareId", "osuFirmware", "
|
|
4
|
+
"sourcesContent": ["import { inject, injectable } from \"inversify\";\nimport { EitherAsync, Just, Maybe, Nothing } from \"purify-ts\";\n\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { DmkNetworkClient } from \"@api/network/DmkNetworkClient\";\nimport { DmkNetworkClientError } from \"@api/network/DmkNetworkClientError\";\nimport { managerApiTypes } from \"@internal/manager-api/di/managerApiTypes\";\nimport {\n type Application,\n AppType,\n} from \"@internal/manager-api/model/Application\";\nimport { DEFAULT_PROVIDER } from \"@internal/manager-api/model/Const\";\nimport { DEFAULT_FIRMWARE_DISTRIBUTION_SALT } from \"@internal/manager-api/model/Const\";\nimport { type DeviceVersion } from \"@internal/manager-api/model/Device\";\nimport { HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\nimport type {\n FinalFirmware,\n McuFirmware,\n OsuFirmware,\n} from \"@internal/manager-api/model/Firmware\";\nimport { type LanguagePackage } from \"@internal/manager-api/model/Language\";\nimport {\n type GetAppByHashParams,\n type GetAppListParams,\n type GetDeviceVersionParams,\n type GetFirmwareVersionParams,\n type GetLanguagePackagesParams,\n type GetLatestFirmwareVersionParams,\n} from \"@internal/manager-api/model/Params\";\n\nimport { ManagerApiDataSource } from \"./ManagerApiDataSource\";\nimport {\n ApplicationDto,\n AppTypeDto,\n DeviceVersionDto,\n FirmwareFinalVersionDto,\n FirmwareOsuVersionDto,\n LanguagePackageVersionDto,\n LatestFirmwareOsuVersionResponseDto,\n McuVersionDto,\n} from \"./ManagerApiDto\";\n\nconst toHttpFetchApiError = (error: unknown): HttpFetchApiError => {\n // The network client wraps fetch errors in DmkNetworkClientError. Unwrap the\n // original cause when available so consumers (and tests) keep seeing the\n // underlying error.\n if (error instanceof DmkNetworkClientError && error.cause !== undefined) {\n return new HttpFetchApiError(error.cause);\n }\n return new HttpFetchApiError(error);\n};\n\n@injectable()\nexport class HttpManagerApiDataSource implements ManagerApiDataSource {\n private readonly http: DmkNetworkClient;\n private _provider: number = DEFAULT_PROVIDER;\n private _firmwareDistributionSalt: string =\n DEFAULT_FIRMWARE_DISTRIBUTION_SALT;\n\n constructor(\n @inject(managerApiTypes.DmkConfig)\n { managerApiUrl, provider, firmwareDistributionSalt }: DmkConfig,\n ) {\n this.http = new DmkNetworkClient({ baseUrl: managerApiUrl });\n this._provider = provider;\n this._firmwareDistributionSalt = firmwareDistributionSalt;\n }\n\n setProvider(provider: number): void {\n if (this._provider === provider || provider < 1) {\n return;\n }\n this._provider = provider;\n }\n\n getProvider(): number {\n return this._provider;\n }\n\n getAppList(\n params: GetAppListParams,\n ): EitherAsync<HttpFetchApiError, Array<Application>> {\n const { targetId, firmwareVersionName } = params;\n return EitherAsync(() =>\n this.http.get(\"/v2/apps/by-target\", {\n params: {\n target_id: targetId,\n provider: this._provider,\n firmware_version_name: firmwareVersionName,\n },\n }),\n )\n .chain((apps) =>\n this.mapApplicationDtoToApplication(apps as Array<ApplicationDto>),\n )\n .mapLeft(toHttpFetchApiError);\n }\n\n getMcuList(): EitherAsync<HttpFetchApiError, Array<McuFirmware>> {\n return EitherAsync(() => this.http.get(\"/mcu_versions\"))\n .chain((mcus) => this.mapMcuDtoToMcu(mcus as Array<McuVersionDto>))\n .mapLeft(toHttpFetchApiError);\n }\n\n getDeviceVersion(\n params: GetDeviceVersionParams,\n ): EitherAsync<HttpFetchApiError, DeviceVersion> {\n const { targetId } = params;\n return EitherAsync(() =>\n this.http.get(\"/get_device_version\", {\n params: { target_id: targetId, provider: this._provider },\n }),\n )\n .chain((deviceVersion) =>\n this.mapDeviceVersionDto(deviceVersion as DeviceVersionDto),\n )\n .mapLeft(toHttpFetchApiError);\n }\n\n getFirmwareVersion(\n params: GetFirmwareVersionParams,\n ): EitherAsync<HttpFetchApiError, FinalFirmware> {\n const { deviceId, version } = params;\n return EitherAsync(() =>\n this.http.get(\"/get_firmware_version\", {\n params: {\n device_version: deviceId,\n version_name: version,\n provider: this._provider,\n },\n }),\n )\n .chain((finalFirmware) =>\n this.mapFinalFirmwareDto(finalFirmware as FirmwareFinalVersionDto),\n )\n .mapLeft(toHttpFetchApiError);\n }\n\n getFirmwareVersionById(\n finalFirmwareId: number,\n ): EitherAsync<HttpFetchApiError, FinalFirmware> {\n return EitherAsync(() =>\n this.http.get(`/firmware_final_versions/${finalFirmwareId}`),\n )\n .chain((finalFirmware) =>\n this.mapFinalFirmwareDto(finalFirmware as FirmwareFinalVersionDto),\n )\n .mapLeft(toHttpFetchApiError);\n }\n\n getOsuFirmwareVersion(\n params: GetFirmwareVersionParams,\n ): EitherAsync<HttpFetchApiError, OsuFirmware> {\n const { deviceId, version } = params;\n return EitherAsync(() =>\n this.http.get(\"/get_osu_version\", {\n params: {\n device_version: deviceId,\n version_name: version,\n provider: this._provider,\n },\n }),\n )\n .chain((osuFirmware) =>\n this.mapOsuFirmwareDto(osuFirmware as FirmwareOsuVersionDto),\n )\n .mapLeft(toHttpFetchApiError);\n }\n\n getLatestFirmwareVersion(\n params: GetLatestFirmwareVersionParams,\n ): EitherAsync<HttpFetchApiError, Maybe<OsuFirmware>> {\n const { currentFinalFirmwareId, deviceId } = params;\n return EitherAsync(() =>\n this.http.get(\"/get_latest_firmware\", {\n params: {\n current_se_firmware_final_version: currentFinalFirmwareId,\n device_version: deviceId,\n provider: this._provider,\n salt: this._firmwareDistributionSalt,\n },\n }),\n )\n .chain((latestFirmware) =>\n this.mapLatestFirmwareDto(\n latestFirmware as LatestFirmwareOsuVersionResponseDto,\n ),\n )\n .mapLeft(toHttpFetchApiError);\n }\n\n getAppsByHash(\n params: GetAppByHashParams,\n ): EitherAsync<HttpFetchApiError, Array<Application | null>> {\n const { hashes } = params;\n return EitherAsync(() => this.http.post(\"/v2/apps/hash\", hashes))\n .chain((apps) =>\n this.mapNullableApplicationDtoToApplication(\n apps as Array<ApplicationDto | null>,\n ),\n )\n .mapLeft(toHttpFetchApiError);\n }\n\n getLanguagePackages(\n params: GetLanguagePackagesParams,\n ): EitherAsync<HttpFetchApiError, Array<LanguagePackage>> {\n const { deviceId, currentFinalFirmwareId } = params;\n return EitherAsync(() =>\n this.http.get(\"/language-packages\", {\n params: {\n device_version: deviceId,\n current_se_firmware_final_version: currentFinalFirmwareId,\n },\n }),\n )\n .chain((apps) =>\n this.mapLanguagesDtoToLanguages(\n apps as Array<LanguagePackageVersionDto>,\n ),\n )\n .mapLeft(toHttpFetchApiError);\n }\n\n private mapAppTypeDtoToAppType(appType: AppTypeDto | null): AppType | null {\n if (appType === null) {\n return null;\n }\n switch (appType) {\n case AppTypeDto.currency:\n return AppType.currency;\n case AppTypeDto.plugin:\n return AppType.plugin;\n case AppTypeDto.tool:\n return AppType.tool;\n case AppTypeDto.swap:\n return AppType.swap;\n }\n }\n\n private mapApplicationDtoToApplication(\n apps: Array<ApplicationDto>,\n ): EitherAsync<Error, Array<Application>> {\n return EitherAsync(() =>\n Promise.resolve(apps.map((app) => this.mapApplicationDto(app))),\n );\n }\n\n private mapNullableApplicationDtoToApplication(\n apps: Array<ApplicationDto | null>,\n ): EitherAsync<Error, Array<Application | null>> {\n return EitherAsync(() =>\n Promise.resolve(\n apps.map((app) => {\n if (app === null) {\n return null;\n }\n return this.mapApplicationDto(app);\n }),\n ),\n );\n }\n\n private mapApplicationDto(app: ApplicationDto): Application {\n if (\n typeof app !== \"object\" ||\n typeof app.versionId !== \"number\" ||\n typeof app.versionName !== \"string\" ||\n (app.versionDisplayName !== null &&\n typeof app.versionDisplayName !== \"string\") ||\n typeof app.version !== \"string\" ||\n (app.currencyId !== null && typeof app.currencyId !== \"string\") ||\n (app.description !== null && typeof app.description !== \"string\") ||\n (app.applicationType !== null &&\n typeof app.applicationType !== \"string\") ||\n typeof app.dateModified !== \"string\" ||\n (app.icon !== null && typeof app.icon !== \"string\") ||\n (app.authorName !== null && typeof app.authorName !== \"string\") ||\n (app.supportURL !== null && typeof app.supportURL !== \"string\") ||\n (app.contactURL !== null && typeof app.contactURL !== \"string\") ||\n (app.sourceURL !== null && typeof app.sourceURL !== \"string\") ||\n (app.compatibleWallets !== null &&\n typeof app.compatibleWallets !== \"string\") ||\n typeof app.hash !== \"string\" ||\n typeof app.perso !== \"string\" ||\n typeof app.firmware !== \"string\" ||\n typeof app.firmwareKey !== \"string\" ||\n typeof app.delete !== \"string\" ||\n typeof app.deleteKey !== \"string\" ||\n (app.bytes !== null && typeof app.bytes !== \"number\") ||\n (app.warning !== null && typeof app.warning !== \"string\") ||\n typeof app.isDevTools !== \"boolean\" ||\n (app.category !== null && typeof app.category !== \"number\") ||\n (app.parent !== null && typeof app.parent !== \"number\") ||\n (app.parentName !== null && typeof app.parentName !== \"string\")\n ) {\n throw new Error(`Incomplete application: ${JSON.stringify(app)}`);\n }\n const {\n applicationType,\n hash,\n perso,\n firmware,\n firmwareKey,\n delete: del,\n deleteKey,\n ...rest\n } = app;\n const ret: Application = {\n ...rest,\n hash: hash!,\n perso: perso!,\n firmware: firmware!,\n firmwareKey: firmwareKey!,\n delete: del!,\n deleteKey: deleteKey!,\n applicationType: this.mapAppTypeDtoToAppType(applicationType),\n };\n return ret;\n }\n\n private mapMcuDtoToMcu(\n mcus: Array<McuVersionDto>,\n ): EitherAsync<Error, Array<McuFirmware>> {\n return EitherAsync(() =>\n Promise.resolve(\n mcus.map((mcu) => {\n if (\n typeof mcu !== \"object\" ||\n typeof mcu.id !== \"number\" ||\n typeof mcu.name !== \"string\" ||\n typeof mcu.from_bootloader_version !== \"string\"\n ) {\n throw new Error(`Incomplete MCU version: ${JSON.stringify(mcu)}`);\n }\n const ret: McuFirmware = {\n id: mcu.id,\n name: mcu.name,\n fromBootloaderVersion: mcu.from_bootloader_version,\n providers: mcu.providers,\n };\n return ret;\n }),\n ),\n );\n }\n\n private mapDeviceVersionDto(\n deviceVersion: DeviceVersionDto,\n ): EitherAsync<Error, DeviceVersion> {\n return EitherAsync(() => {\n if (\n typeof deviceVersion !== \"object\" ||\n typeof deviceVersion.id !== \"number\"\n ) {\n throw new Error(\n `Incomplete device version: ${JSON.stringify(deviceVersion)}`,\n );\n }\n const ret: DeviceVersion = {\n id: deviceVersion.id,\n };\n return Promise.resolve(ret);\n });\n }\n\n private mapFinalFirmwareDto(\n finalFirmware: FirmwareFinalVersionDto,\n ): EitherAsync<Error, FinalFirmware> {\n return EitherAsync(() => {\n if (\n typeof finalFirmware !== \"object\" ||\n typeof finalFirmware.id !== \"number\" ||\n typeof finalFirmware.version !== \"string\" ||\n typeof finalFirmware.perso !== \"string\" ||\n (finalFirmware.firmware !== null &&\n typeof finalFirmware.firmware !== \"string\") ||\n (finalFirmware.firmware_key !== null &&\n typeof finalFirmware.firmware_key !== \"string\") ||\n (finalFirmware.hash !== null &&\n typeof finalFirmware.hash !== \"string\") ||\n (finalFirmware.bytes !== null &&\n typeof finalFirmware.bytes !== \"number\") ||\n !Array.isArray(finalFirmware.mcu_versions)\n ) {\n throw new Error(\n `Incomplete final firmware: ${JSON.stringify(finalFirmware)}`,\n );\n }\n const ret: FinalFirmware = {\n id: finalFirmware.id,\n version: finalFirmware.version,\n perso: finalFirmware.perso,\n firmware: finalFirmware.firmware,\n firmwareKey: finalFirmware.firmware_key,\n hash: finalFirmware.hash,\n bytes: finalFirmware.bytes,\n mcuVersions: finalFirmware.mcu_versions,\n };\n return Promise.resolve(ret);\n });\n }\n\n private mapLatestFirmwareDto(\n latestFirmware: LatestFirmwareOsuVersionResponseDto,\n ): EitherAsync<Error, Maybe<OsuFirmware>> {\n return EitherAsync<Error, FirmwareOsuVersionDto | null>(() => {\n /**\n * This is how we know that there is no update available.\n * See the {@link https://github.com/LedgerHQ/ledger-live/blob/develop/libs/device-core/src/managerApi/repositories/HttpManagerApiRepository.ts#L59-L61 | ledger-live implementation}.\n */\n if (latestFirmware.result === \"null\") {\n return Promise.resolve(null);\n }\n if (\n latestFirmware.result !== \"success\" ||\n !latestFirmware.se_firmware_osu_version\n ) {\n throw new Error(\n `Latest firmware could not be retrieved: ${latestFirmware.result}`,\n );\n }\n const osuDto = latestFirmware.se_firmware_osu_version;\n return Promise.resolve(osuDto);\n }).chain((osuDto) => {\n if (null === osuDto) {\n return EitherAsync(() => Promise.resolve(Nothing));\n }\n return this.mapOsuFirmwareDto(osuDto).map((osuFirmware) =>\n Just(osuFirmware),\n );\n });\n }\n\n private mapOsuFirmwareDto(\n osuDto: FirmwareOsuVersionDto,\n ): EitherAsync<Error, OsuFirmware> {\n return EitherAsync(() => {\n if (\n typeof osuDto !== \"object\" ||\n typeof osuDto.id !== \"number\" ||\n (osuDto.notes !== null && typeof osuDto.notes !== \"string\") ||\n typeof osuDto.perso !== \"string\" ||\n typeof osuDto.firmware !== \"string\" ||\n typeof osuDto.firmware_key !== \"string\" ||\n (osuDto.hash !== null && typeof osuDto.hash !== \"string\") ||\n typeof osuDto.next_se_firmware_final_version !== \"number\"\n ) {\n throw new Error(\n `Incomplete latest firmware: ${JSON.stringify(osuDto)}`,\n );\n }\n const ret: OsuFirmware = {\n id: osuDto.id,\n notes: osuDto.notes,\n perso: osuDto.perso,\n firmware: osuDto.firmware,\n firmwareKey: osuDto.firmware_key,\n hash: osuDto.hash,\n nextFinalFirmware: osuDto.next_se_firmware_final_version,\n };\n return Promise.resolve(ret);\n });\n }\n\n private mapLanguagesDtoToLanguages(\n languages: Array<LanguagePackageVersionDto>,\n ): EitherAsync<Error, Array<LanguagePackage>> {\n return EitherAsync(() =>\n Promise.resolve(\n languages.map((language) => this.mapLanguageDto(language)),\n ),\n );\n }\n\n private mapLanguageDto(language: LanguagePackageVersionDto): LanguagePackage {\n if (\n typeof language !== \"object\" ||\n typeof language.language !== \"string\" ||\n typeof language.languagePackageVersionId !== \"number\" ||\n typeof language.version !== \"string\" ||\n typeof language.language_package_id !== \"number\" ||\n typeof language.apdu_install_url !== \"string\" ||\n typeof language.apdu_uninstall_url !== \"string\" ||\n typeof language.bytes !== \"number\" ||\n typeof language.date_creation !== \"string\" ||\n typeof language.date_last_modified !== \"string\"\n ) {\n throw new Error(\n `Incomplete language version: ${JSON.stringify(language)}`,\n );\n }\n const ret: LanguagePackage = {\n language: language.language,\n languagePackageVersionId: language.languagePackageVersionId,\n version: language.version,\n languagePackageId: language.language_package_id,\n apduInstallUrl: language.apdu_install_url,\n apduUninstallUrl: language.apdu_uninstall_url,\n bytes: language.bytes,\n dateCreation: language.date_creation,\n dateLastModified: language.date_last_modified,\n };\n return ret;\n }\n}\n"],
|
|
5
|
+
"mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBACnCC,EAAkD,qBAGlDC,EAAiC,yCACjCC,EAAsC,8CACtCC,EAAgC,oDAChCC,EAGO,mDACPC,EAAiC,6CACjCA,EAAmD,6CAEnDC,EAAkC,8CAiBlCC,EASO,2BAEP,MAAMC,EAAuBC,GAIvBA,aAAiB,yBAAyBA,EAAM,QAAU,O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C,EAANiC,EAAA,IADN,cAAW,EAQPC,EAAA,eAAO,kBAAgB,SAAS,IAPxBlC",
|
|
6
|
+
"names": ["HttpManagerApiDataSource_exports", "__export", "HttpManagerApiDataSource", "__toCommonJS", "import_inversify", "import_purify_ts", "import_DmkNetworkClient", "import_DmkNetworkClientError", "import_managerApiTypes", "import_Application", "import_Const", "import_Errors", "import_ManagerApiDto", "toHttpFetchApiError", "error", "HttpManagerApiDataSource", "managerApiUrl", "provider", "firmwareDistributionSalt", "params", "targetId", "firmwareVersionName", "apps", "mcus", "deviceVersion", "deviceId", "version", "finalFirmware", "finalFirmwareId", "osuFirmware", "currentFinalFirmwareId", "latestFirmware", "hashes", "appType", "app", "applicationType", "hash", "perso", "firmware", "firmwareKey", "del", "deleteKey", "rest", "mcu", "ret", "osuDto", "languages", "language", "__decorateClass", "__decorateParam"]
|
|
7
7
|
}
|