-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ (dmk): Add API calls and models for secure channel
- Loading branch information
1 parent
8c2c05d
commit 307b674
Showing
20 changed files
with
426 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@ledgerhq/device-management-kit": patch | ||
--- | ||
|
||
Add manager api calls for secure channel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
packages/device-management-kit/src/api/command/os/__mocks__/GetOsVersionCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { DeviceModelId } from "@api/device/DeviceModel"; | ||
import { type GetOsVersionResponse } from "@api/index"; | ||
|
||
export const getOsVersionCommandResponseStubBuilder = ( | ||
deviceModelId: DeviceModelId = DeviceModelId.NANO_SP, | ||
props: Partial<GetOsVersionResponse> = {}, | ||
): GetOsVersionResponse => | ||
({ | ||
[DeviceModelId.NANO_SP]: { | ||
targetId: 856686596, | ||
seVersion: "1.1.1", | ||
seFlags: 3858759680, | ||
mcuSephVersion: "4.03", | ||
mcuBootloaderVersion: "3.12", | ||
hwVersion: "00", | ||
langId: "00", | ||
recoverState: "00", | ||
...props, | ||
}, | ||
[DeviceModelId.NANO_S]: { | ||
targetId: 858783748, | ||
seVersion: "1.1.1", | ||
seFlags: 3858759680, | ||
mcuSephVersion: "6.4.0", | ||
mcuBootloaderVersion: "5.4.0", | ||
hwVersion: "00", | ||
langId: "00", | ||
recoverState: "00", | ||
...props, | ||
}, | ||
[DeviceModelId.NANO_X]: { | ||
targetId: 855638020, | ||
seVersion: "2.2.3", | ||
seFlags: 3858759680, | ||
mcuSephVersion: "2.30", | ||
mcuBootloaderVersion: "1.16", | ||
hwVersion: "00", | ||
langId: "00", | ||
recoverState: "00", | ||
}, | ||
[DeviceModelId.STAX]: { | ||
targetId: 857735172, | ||
seVersion: "1.3.0", | ||
seFlags: 3858759680, | ||
mcuSephVersion: "5.24", | ||
mcuBootloaderVersion: "0.48", | ||
hwVersion: "00", | ||
langId: "00", | ||
recoverState: "00", | ||
...props, | ||
}, | ||
[DeviceModelId.FLEX]: { | ||
targetId: 858783748, | ||
seVersion: "1.1.1", | ||
seFlags: 3858759680, | ||
mcuSephVersion: "6.4.0", | ||
mcuBootloaderVersion: "5.4.0", | ||
hwVersion: "00", | ||
langId: "00", | ||
recoverState: "00", | ||
...props, | ||
}, | ||
})[deviceModelId]; |
2 changes: 1 addition & 1 deletion
2
packages/device-management-kit/src/api/device-action/__test-utils__/data.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/device-management-kit/src/api/device-session/DeviceSessionState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 12 additions & 1 deletion
13
packages/device-management-kit/src/internal/manager-api/data/ManagerApiDataSource.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
import { type EitherAsync } from "purify-ts"; | ||
|
||
import { type Application } from "@internal/manager-api/model/Application"; | ||
import { type DeviceVersion } from "@internal/manager-api/model/Device"; | ||
import { type HttpFetchApiError } from "@internal/manager-api/model/Errors"; | ||
import { type Application } from "@internal/manager-api/model/ManagerApiType"; | ||
import { type FinalFirmware } from "@internal/manager-api/model/Firmware"; | ||
|
||
export interface ManagerApiDataSource { | ||
getAppsByHash( | ||
hashes: string[], | ||
): EitherAsync<HttpFetchApiError, Array<Application | null>>; | ||
getDeviceVersion( | ||
targetId: string, | ||
provider: number, | ||
): EitherAsync<HttpFetchApiError, DeviceVersion>; | ||
getFirmwareVersion( | ||
version: string, | ||
deviceId: number, | ||
provider: number, | ||
): EitherAsync<HttpFetchApiError, FinalFirmware>; | ||
} |
2 changes: 2 additions & 0 deletions
2
...evice-management-kit/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import { type ManagerApiDataSource } from "@internal/manager-api/data/ManagerApiDataSource"; | ||
|
||
export class AxiosManagerApiDataSource implements ManagerApiDataSource { | ||
getDeviceVersion = jest.fn(); | ||
getFirmwareVersion = jest.fn(); | ||
getAppsByHash = jest.fn(); | ||
} |
Oops, something went wrong.