-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
β¨ (dmk) [DSDK-542]: Add API calls and models for secure channel #469
Open
jdabbech-ledger
wants to merge
1
commit into
develop
Choose a base branch
from
feat/dsdk-542-secure-channel-api-calls
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+426
β52
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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>; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[ASK] why
parseInt
thentoString
on astring
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To convert the hexastring to a decimal string, because the API only accept base 10 number for targetId.
The base 10 conversion has to be done on the whole number.