diff --git a/.changeset/calm-months-live.md b/.changeset/calm-months-live.md index 9cf9e7d6a..07cd31d49 100644 --- a/.changeset/calm-months-live.md +++ b/.changeset/calm-months-live.md @@ -1,5 +1,5 @@ --- -"@ledgerhq/keyring-btc": minor +"@ledgerhq/device-signer-kit-btc": minor --- Implement MerkleTree and MerkleMap services diff --git a/.changeset/clever-badgers-pull.md b/.changeset/clever-badgers-pull.md index 6949ba72d..f2ee79b41 100644 --- a/.changeset/clever-badgers-pull.md +++ b/.changeset/clever-badgers-pull.md @@ -1,5 +1,5 @@ --- -"@ledgerhq/device-sdk-sample": minor +"@ledgerhq/device-management-kit-sample": minor --- Add GetAddress Solana Signer use case diff --git a/.changeset/config.json b/.changeset/config.json index c720bb119..0e5190d19 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -12,5 +12,5 @@ "access": "public", "baseBranch": "develop", "updateInternalDependencies": "patch", - "ignore": ["@ledgerhq/keyring-btc"] + "ignore": ["@ledgerhq/device-signer-kit-btc"] } diff --git a/.changeset/cool-dancers-join.md b/.changeset/cool-dancers-join.md index 0b3916fb5..5388f72c4 100644 --- a/.changeset/cool-dancers-join.md +++ b/.changeset/cool-dancers-join.md @@ -5,7 +5,7 @@ "@ledgerhq/device-signer-kit-ethereum": patch "@ledgerhq/tsconfig-dsdk": patch "@ledgerhq/prettier-config-dsdk": patch -"@ledgerhq/device-sdk-transport-mock": patch +"@ledgerhq/device-transport-kit-mock-client": patch "@ledgerhq/eslint-config-dsdk": patch "@ledgerhq/device-sdk-trusted-apps": patch "@ledgerhq/jest-config-dsdk": patch diff --git a/.changeset/cuddly-ducks-confess.md b/.changeset/cuddly-ducks-confess.md new file mode 100644 index 000000000..f40ee1687 --- /dev/null +++ b/.changeset/cuddly-ducks-confess.md @@ -0,0 +1,7 @@ +--- +"@ledgerhq/device-signer-kit-solana": patch +"@ledgerhq/device-signer-kit-ethereum": patch +"@ledgerhq/device-management-kit-sample": patch +--- + +Rename keyring to signer diff --git a/.changeset/cuddly-impalas-sing.md b/.changeset/cuddly-impalas-sing.md index 9bbf2168c..26244e39b 100644 --- a/.changeset/cuddly-impalas-sing.md +++ b/.changeset/cuddly-impalas-sing.md @@ -1,5 +1,5 @@ --- -"@ledgerhq/keyring-btc": minor +"@ledgerhq/device-signer-kit-btc": minor --- Implement GetExtendedPublicKeyCommand diff --git a/.changeset/lemon-suits-notice.md b/.changeset/lemon-suits-notice.md new file mode 100644 index 000000000..4b4b73bd2 --- /dev/null +++ b/.changeset/lemon-suits-notice.md @@ -0,0 +1,10 @@ +--- +"@ledgerhq/device-management-kit-flipper-plugin-client": patch +"@ledgerhq/device-signer-kit-solana": patch +"@ledgerhq/device-signer-kit-ethereum": patch +"@ledgerhq/device-transport-kit-mock-client": patch +"@ledgerhq/device-management-kit": patch +"@ledgerhq/device-management-kit-sample": patch +--- + +Rename SDK to DMK diff --git a/.changeset/lucky-keys-explode.md b/.changeset/lucky-keys-explode.md index fb482bd0c..92b949c54 100644 --- a/.changeset/lucky-keys-explode.md +++ b/.changeset/lucky-keys-explode.md @@ -1,5 +1,5 @@ --- -"@ledgerhq/keyring-btc": minor +"@ledgerhq/device-signer-kit-btc": minor --- Implement GetMasterFingerprintCommand diff --git a/.changeset/mighty-vans-kiss.md b/.changeset/mighty-vans-kiss.md index c2d61c6ef..de801c9ec 100644 --- a/.changeset/mighty-vans-kiss.md +++ b/.changeset/mighty-vans-kiss.md @@ -1,5 +1,5 @@ --- -"@ledgerhq/keyring-btc": patch +"@ledgerhq/device-signer-kit-btc": patch --- Implement wallet policy service diff --git a/.changeset/nine-tools-bow.md b/.changeset/nine-tools-bow.md index 710b90992..6cb5fdcc5 100644 --- a/.changeset/nine-tools-bow.md +++ b/.changeset/nine-tools-bow.md @@ -1,7 +1,7 @@ --- "@ledgerhq/device-management-kit-flipper-plugin-client": patch "@ledgerhq/device-management-kit": patch -"@ledgerhq/device-sdk-sample": patch +"@ledgerhq/device-management-kit-sample": patch --- Implement basic Flipper client for the Ledger Device Management Kit diff --git a/.changeset/perfect-deers-sneeze.md b/.changeset/perfect-deers-sneeze.md index ca93afdab..7cb606bab 100644 --- a/.changeset/perfect-deers-sneeze.md +++ b/.changeset/perfect-deers-sneeze.md @@ -1,5 +1,5 @@ --- -"@ledgerhq/keyring-btc": patch +"@ledgerhq/device-signer-kit-btc": patch --- Rename packages diff --git a/.changeset/smart-games-brush.md b/.changeset/smart-games-brush.md index c3b1bf193..02c9a0e33 100644 --- a/.changeset/smart-games-brush.md +++ b/.changeset/smart-games-brush.md @@ -1,7 +1,7 @@ --- -"@ledgerhq/device-sdk-transport-mock": patch +"@ledgerhq/device-transport-kit-mock-client": patch "@ledgerhq/device-management-kit": patch -"@ledgerhq/device-sdk-sample": patch +"@ledgerhq/device-management-kit-sample": patch --- Add mockserver integration with transport diff --git a/.changeset/tall-hairs-cheer.md b/.changeset/tall-hairs-cheer.md index 09c7c7cb3..d9f6dbaf7 100644 --- a/.changeset/tall-hairs-cheer.md +++ b/.changeset/tall-hairs-cheer.md @@ -1,5 +1,5 @@ --- -"@ledgerhq/keyring-btc": minor +"@ledgerhq/device-signer-kit-btc": minor --- -Create keyring-btc package +Create device-signer-kit-btc package diff --git a/.changeset/tasty-falcons-doubt.md b/.changeset/tasty-falcons-doubt.md index 2ddec3996..36ab5d44e 100644 --- a/.changeset/tasty-falcons-doubt.md +++ b/.changeset/tasty-falcons-doubt.md @@ -3,7 +3,7 @@ "@ledgerhq/signer-utils": patch "@ledgerhq/device-signer-kit-ethereum": patch "@ledgerhq/device-management-kit": patch -"@ledgerhq/device-sdk-sample": patch +"@ledgerhq/device-management-kit-sample": patch --- Use type keyword when importing type diff --git a/.changeset/tiny-hornets-grin.md b/.changeset/tiny-hornets-grin.md index 1ac59c72a..fc5bc0b38 100644 --- a/.changeset/tiny-hornets-grin.md +++ b/.changeset/tiny-hornets-grin.md @@ -1,6 +1,6 @@ --- "@ledgerhq/device-management-kit": patch -"@ledgerhq/device-sdk-sample": patch +"@ledgerhq/device-management-kit-sample": patch --- Add unlock timeout input in open app device action diff --git a/.changeset/tiny-otters-draw.md b/.changeset/tiny-otters-draw.md index 99f2f920e..06299e3f7 100644 --- a/.changeset/tiny-otters-draw.md +++ b/.changeset/tiny-otters-draw.md @@ -1,5 +1,5 @@ --- -"@ledgerhq/device-sdk-sample": minor +"@ledgerhq/device-management-kit-sample": minor --- Add keyring eth provider diff --git a/.changeset/twelve-snakes-agree.md b/.changeset/twelve-snakes-agree.md index 06a1cefc3..cc4c2308a 100644 --- a/.changeset/twelve-snakes-agree.md +++ b/.changeset/twelve-snakes-agree.md @@ -1,6 +1,6 @@ --- "@ledgerhq/device-management-kit": patch -"@ledgerhq/device-sdk-sample": patch +"@ledgerhq/device-management-kit-sample": patch --- New use case listenToKnownDevices diff --git a/.changeset/weak-ads-chew.md b/.changeset/weak-ads-chew.md index d41b3070f..0a4e2d756 100644 --- a/.changeset/weak-ads-chew.md +++ b/.changeset/weak-ads-chew.md @@ -1,5 +1,5 @@ --- -"@ledgerhq/keyring-btc": patch +"@ledgerhq/device-signer-kit-btc": patch --- Implement PSBT parser and mapper services diff --git a/README.md b/README.md index 852bb2905..152bd5c12 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,6 @@

- TypeScript @@ -29,6 +26,10 @@ NPM +
+ + Pull request Tests Passing +

@@ -61,7 +62,7 @@ The Device Management Kit features an interface for applications to handle any L ```mermaid flowchart LR; - application(Application) <--API--> DSDK(DeviceSDK) <--USB/BLE--> device(Device); + application(Application) <--API--> LDMK(LedgerDeviceManagementKit) <--USB/BLE--> device(Device); ``` The Device Management Kit is available in 3 different environments (web, Android & iOS). @@ -72,7 +73,7 @@ This repository is dedicated to **web environment** and is written in TypeScript ### Repository -The Device Management Kit is structured as a monorepository whose prupose is to centralise all the TypeScript code related to the SDK in one place. +The Device Management Kit is structured as a monorepository whose prupose is to centralise all the TypeScript code related to the Device Management Kit in one place. This project uses [turbo monorepo](https://turbo.build/repo/docs) to build and release different packages on NPM registry and a sample demo application on Vercel. @@ -80,16 +81,16 @@ This project uses [turbo monorepo](https://turbo.build/repo/docs) to build and r A brief description of this project packages: -| Name | Path | Description | -| --------------------------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | -| @ledgerhq/device-sdk-sample | apps/sample | React Next web app used to test & demonstrate the Web Device Management Kit | -| @ledgerhq/eslint-config-dsdk | packages/config/eslint | internal package which contains eslint shared config. Used by `extends: ["@ledgerhq/dsdk"]` in `.eslintrc`. | -| @ledgerhq/jest-config-dsdk | packages/config/jest | internal package which contains jest shared config. Used by `preset: "@ledgerhq/jest-config-dsdk"` in `jest.config.ts` | -| @ledgerhq/tsconfig-dsdk | packages/config/typescript | internal package which contains typescript shared config. Used by `"extends": "@ledgerhq/tsconfig-dsdk/tsconfig.sdk"` in `tsconfig.json` | -| @ledgerhq/device-management-kit | packages/core | external package that contains the core of the Web SDK | -| @ledgerhq/device-sdk-signer | packages/signer | external package that contains device coin application dedicated handlers | -| @ledgerhq/device-sdk-trusted-apps | packages/trusted-apps | external package that contains device trusted application dedicated handlers | -| @ledgerhq/device-sdk-ui | packages/ui | external package | +| Name | Path | Description | +|----------------------------------------|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------| +| @ledgerhq/device-management-kit-sample | apps/sample | React Next web app used to test & demonstrate the Web Device Management Kit | +| @ledgerhq/eslint-config-dsdk | packages/config/eslint | internal package which contains eslint shared config. Used by `extends: ["@ledgerhq/dsdk"]` in `.eslintrc`. | +| @ledgerhq/jest-config-dsdk | packages/config/jest | internal package which contains jest shared config. Used by `preset: "@ledgerhq/jest-config-dsdk"` in `jest.config.ts` | +| @ledgerhq/tsconfig-dsdk | packages/config/typescript | internal package which contains typescript shared config. Used by `"extends": "@ledgerhq/tsconfig-dsdk/tsconfig.sdk"` in `tsconfig.json` | +| @ledgerhq/device-management-kit | packages/device-management-kit | external package that contains the core of the Web Device Management Kit | +| @ledgerhq/device-signer-kit-ethereum | packages/signer/signer-eth | external package that contains device ethereum coin application dedicated handlers | +| @ledgerhq/device-signer-kit-solana | packages/signer/signer-solana | external package that contains device solana coin application dedicated handlers | +| @ledgerhq/device-management-kit-flipper-plugin-client | packages/flipper-plugin-client | external package that contains [flipper](https://github.com/facebook/flipper) logger for Device Management Kit | # Getting started @@ -182,7 +183,7 @@ Each package is built using the following command (at the root of the monorepo). Device Management Kit main module. ```bash -pnpm core build +pnpm dmk build ``` ### Signer @@ -258,7 +259,7 @@ Finally, we should add a script in the correct `package.json` as a shortcut to t eg: ``` -pnpm core module:create +pnpm dmk module:create ``` Under the hood, the script looks like this: diff --git a/apps/sample/next.config.js b/apps/sample/next.config.js index f1d5bb18e..8a4688eca 100644 --- a/apps/sample/next.config.js +++ b/apps/sample/next.config.js @@ -23,7 +23,7 @@ const sentryWebpackPluginOptions = { silent: true, org: "ledger", - project: "device-sdk-sample", + project: "device-management-kit-sample", // Additional Sentry options widenClientFileUpload: true, // Upload a larger set of source maps for prettier stack traces (increases build time) diff --git a/apps/sample/package.json b/apps/sample/package.json index 288d2ac2e..c7a7344c3 100644 --- a/apps/sample/package.json +++ b/apps/sample/package.json @@ -1,5 +1,5 @@ { - "name": "@ledgerhq/device-sdk-sample", + "name": "@ledgerhq/device-management-kit-sample", "version": "0.1.3", "private": true, "scripts": { @@ -20,7 +20,7 @@ "@ledgerhq/device-management-kit-flipper-plugin-client": "workspace:*", "@ledgerhq/device-signer-kit-ethereum": "workspace:*", "@ledgerhq/device-signer-kit-solana": "workspace:*", - "@ledgerhq/device-sdk-transport-mock": "workspace:*", + "@ledgerhq/device-transport-kit-mock-client": "workspace:*", "@ledgerhq/react-ui": "^0.16.2", "@sentry/nextjs": "^8.32.0", "@playwright/test": "^1.47.0", diff --git a/apps/sample/playwright/cases/eth_get-address_happy-paths.spec.ts b/apps/sample/playwright/cases/eth_get-address_happy-paths.spec.ts index 837944c39..06644b21c 100644 --- a/apps/sample/playwright/cases/eth_get-address_happy-paths.spec.ts +++ b/apps/sample/playwright/cases/eth_get-address_happy-paths.spec.ts @@ -40,7 +40,7 @@ test.describe("ETH Signer: get address, happy paths", () => { }); await test.step("When execute ETH: get address", async () => { - await whenNavigateTo(page, "/keyring"); + await whenNavigateTo(page, "/signer"); await whenClicking(page, "CTA_command-Ethereum"); @@ -75,7 +75,7 @@ test.describe("ETH Signer: get address, happy paths", () => { }); await test.step("When execute ETH: get address with checkOnDevice on", async () => { - await whenNavigateTo(page, "/keyring"); + await whenNavigateTo(page, "/signer"); await whenClicking(page, "CTA_command-Ethereum"); @@ -125,7 +125,7 @@ test.describe("ETH Signer: get address, happy paths", () => { }); await test.step("Then execute ETH: get address", async () => { - await whenNavigateTo(page, "/keyring"); + await whenNavigateTo(page, "/signer"); await whenClicking(page, "CTA_command-Ethereum"); diff --git a/apps/sample/playwright/cases/eth_get-address_unhappy-paths.spec.ts b/apps/sample/playwright/cases/eth_get-address_unhappy-paths.spec.ts index 6176089fb..35789636d 100644 --- a/apps/sample/playwright/cases/eth_get-address_unhappy-paths.spec.ts +++ b/apps/sample/playwright/cases/eth_get-address_unhappy-paths.spec.ts @@ -36,7 +36,7 @@ test.describe("ETH Signer: get address, unhappy paths", () => { }); await test.step("Then execute ETH: get address with malformed derivation paths", async () => { - await whenNavigateTo(page, "/keyring"); + await whenNavigateTo(page, "/signer"); await whenClicking(page, "CTA_command-Ethereum"); const malformedDerivationPaths = [ diff --git a/apps/sample/playwright/cases/eth_sign-message_happy-paths.spec.ts b/apps/sample/playwright/cases/eth_sign-message_happy-paths.spec.ts index 7991f6e5a..33b8c3b98 100644 --- a/apps/sample/playwright/cases/eth_sign-message_happy-paths.spec.ts +++ b/apps/sample/playwright/cases/eth_sign-message_happy-paths.spec.ts @@ -37,7 +37,7 @@ test.describe("ETH Signer: sign message, happy paths", () => { }); await test.step("When execute ETH: sign message", async () => { - await whenNavigateTo(page, "/keyring"); + await whenNavigateTo(page, "/signer"); await whenClicking(page, "CTA_command-Ethereum"); await whenExecuteDeviceAction(page, "Sign message", [ @@ -75,7 +75,7 @@ test.describe("ETH Signer: sign message, happy paths", () => { }); await test.step("When execute ETH: sign message", async () => { - await whenNavigateTo(page, "/keyring"); + await whenNavigateTo(page, "/signer"); await whenClicking(page, "CTA_command-Ethereum"); @@ -137,7 +137,7 @@ test.describe("ETH Signer: sign message, happy paths", () => { }); await test.step("When execute ETH: sign message", async () => { - await whenNavigateTo(page, "/keyring"); + await whenNavigateTo(page, "/signer"); await whenClicking(page, "CTA_command-Ethereum"); diff --git a/apps/sample/playwright/cases/eth_sign-message_unhappy-paths.spec.ts b/apps/sample/playwright/cases/eth_sign-message_unhappy-paths.spec.ts index d07afc052..edf77039f 100644 --- a/apps/sample/playwright/cases/eth_sign-message_unhappy-paths.spec.ts +++ b/apps/sample/playwright/cases/eth_sign-message_unhappy-paths.spec.ts @@ -37,7 +37,7 @@ test.describe("ETH Signer: sign message, unhappy paths", () => { }); await test.step("When execute ETH: sign message with malformed derivation paths", async () => { - await whenNavigateTo(page, "/keyring"); + await whenNavigateTo(page, "/signer"); await whenClicking(page, "CTA_command-Ethereum"); const malformedDerivationPaths = [ diff --git a/apps/sample/playwright/cases/eth_sign-transaction_happy-paths.spec.ts b/apps/sample/playwright/cases/eth_sign-transaction_happy-paths.spec.ts index 4769463f5..b15fbabfd 100644 --- a/apps/sample/playwright/cases/eth_sign-transaction_happy-paths.spec.ts +++ b/apps/sample/playwright/cases/eth_sign-transaction_happy-paths.spec.ts @@ -40,7 +40,7 @@ test.describe("ETH Signer: sign transaction, happy paths", () => { }); await test.step("When execute ETH: sign transaction", async () => { - await whenNavigateTo(page, "/keyring"); + await whenNavigateTo(page, "/signer"); await whenClicking(page, "CTA_command-Ethereum"); @@ -79,7 +79,7 @@ test.describe("ETH Signer: sign transaction, happy paths", () => { }); await test.step("When execute ETH: sign transaction", async () => { - await whenNavigateTo(page, "/keyring"); + await whenNavigateTo(page, "/signer"); await whenClicking(page, "CTA_command-Ethereum"); diff --git a/apps/sample/playwright/cases/eth_sign-transaction_unhappy-paths.spec.ts b/apps/sample/playwright/cases/eth_sign-transaction_unhappy-paths.spec.ts index 4ab5e6b47..35b79dd58 100644 --- a/apps/sample/playwright/cases/eth_sign-transaction_unhappy-paths.spec.ts +++ b/apps/sample/playwright/cases/eth_sign-transaction_unhappy-paths.spec.ts @@ -37,7 +37,7 @@ test.describe("ETH Signer: sign transaction, unhappy paths", () => { }); await test.step("When execute ETH: sign transaction with malformed derivation paths", async () => { - await whenNavigateTo(page, "/keyring"); + await whenNavigateTo(page, "/signer"); await whenClicking(page, "CTA_command-Ethereum"); const malformedDerivationPaths = [ diff --git a/apps/sample/playwright/cases/eth_sign-typed-message-happy-paths.spec.ts b/apps/sample/playwright/cases/eth_sign-typed-message-happy-paths.spec.ts index 624e210ae..233231a19 100644 --- a/apps/sample/playwright/cases/eth_sign-typed-message-happy-paths.spec.ts +++ b/apps/sample/playwright/cases/eth_sign-typed-message-happy-paths.spec.ts @@ -37,7 +37,7 @@ test.describe("ETH Signer: sign EIP712 message, happy paths", () => { }); await test.step("When execute ETH: sign EIP712 message", async () => { - await whenNavigateTo(page, "/keyring"); + await whenNavigateTo(page, "/signer"); await whenClicking(page, "CTA_command-Ethereum"); await whenExecuteDeviceAction(page, "Sign typed message", [ @@ -76,7 +76,7 @@ test.describe("ETH Signer: sign EIP712 message, happy paths", () => { }); await test.step("When execute ETH: sign EIP712 message", async () => { - await whenNavigateTo(page, "/keyring"); + await whenNavigateTo(page, "/signer"); await whenClicking(page, "CTA_command-Ethereum"); await whenExecuteDeviceAction(page, "Sign typed message", [ @@ -139,7 +139,7 @@ test.describe("ETH Signer: sign EIP712 message, happy paths", () => { }); await test.step("When execute ETH: sign EIP712 message", async () => { - await whenNavigateTo(page, "/keyring"); + await whenNavigateTo(page, "/signer"); await whenClicking(page, "CTA_command-Ethereum"); diff --git a/apps/sample/playwright/cases/eth_sign-typed-message-unhappy-paths.spec.ts b/apps/sample/playwright/cases/eth_sign-typed-message-unhappy-paths.spec.ts index 4cf56a50d..81ea18096 100644 --- a/apps/sample/playwright/cases/eth_sign-typed-message-unhappy-paths.spec.ts +++ b/apps/sample/playwright/cases/eth_sign-typed-message-unhappy-paths.spec.ts @@ -37,7 +37,7 @@ test.describe("ETH Signer: sign EIP712 message, unhappy paths", () => { }); await test.step("When execute ETH: sign typed message with malformed derivation paths", async () => { - await whenNavigateTo(page, "/keyring"); + await whenNavigateTo(page, "/signer"); await whenClicking(page, "CTA_command-Ethereum"); diff --git a/apps/sample/src/app/client-layout.tsx b/apps/sample/src/app/client-layout.tsx index c6b2e351f..d3fff05f8 100644 --- a/apps/sample/src/app/client-layout.tsx +++ b/apps/sample/src/app/client-layout.tsx @@ -15,10 +15,10 @@ import styled, { type DefaultTheme } from "styled-components"; import { Header } from "@/components/Header"; import { Sidebar } from "@/components/Sidebar"; -import { SdkProvider } from "@/providers/DeviceSdkProvider"; +import { DmkProvider } from "@/providers/DeviceManagementKitProvider"; import { DeviceSessionsProvider } from "@/providers/DeviceSessionsProvider"; -import { KeyringEthProvider } from "@/providers/KeyringEthProvider"; -import { SdkConfigProvider } from "@/providers/SdkConfig"; +import { DmkConfigProvider } from "@/providers/DmkConfig"; +import { SignerEthProvider } from "@/providers/SignerEthProvider"; import { GlobalStyle } from "@/styles/globalstyles"; const Root = styled(Flex)` @@ -38,10 +38,10 @@ const PageContainer = styled(Flex)` const ClientRootLayout: React.FC = ({ children }) => { return ( - - + + - + @@ -54,10 +54,10 @@ const ClientRootLayout: React.FC = ({ children }) => { - + - - + + ); }; diff --git a/apps/sample/src/app/keyring/ethereum/page.tsx b/apps/sample/src/app/keyring/ethereum/page.tsx index 26cb849dd..c297848d3 100644 --- a/apps/sample/src/app/keyring/ethereum/page.tsx +++ b/apps/sample/src/app/keyring/ethereum/page.tsx @@ -1,11 +1,11 @@ "use client"; import React from "react"; -import { KeyringEthView } from "@/components/KeyringEthView"; import { SessionIdWrapper } from "@/components/SessionIdWrapper"; +import { SignerEthView } from "@/components/SignerEthView"; -const Keyring: React.FC = () => { - return ; +const Signer: React.FC = () => { + return ; }; -export default Keyring; +export default Signer; diff --git a/apps/sample/src/app/keyring/page.tsx b/apps/sample/src/app/keyring/page.tsx index 134e7bf48..5231d75af 100644 --- a/apps/sample/src/app/keyring/page.tsx +++ b/apps/sample/src/app/keyring/page.tsx @@ -1,10 +1,10 @@ "use client"; import React from "react"; -import { KeyringView } from "@/components/KeyringView"; +import { SignerView } from "@/components/SignerView"; -const Keyring: React.FC = () => { - return ; +const Signer: React.FC = () => { + return ; }; -export default Keyring; +export default Signer; diff --git a/apps/sample/src/components/ApduView/index.tsx b/apps/sample/src/components/ApduView/index.tsx index 81d1c4085..11d409736 100644 --- a/apps/sample/src/components/ApduView/index.tsx +++ b/apps/sample/src/components/ApduView/index.tsx @@ -4,7 +4,7 @@ import { Button, Divider, Flex, Grid, Input, Text } from "@ledgerhq/react-ui"; import styled, { type DefaultTheme } from "styled-components"; import { useApduForm } from "@/hooks/useApduForm"; -import { useSdk } from "@/providers/DeviceSdkProvider"; +import { useDmk } from "@/providers/DeviceManagementKitProvider"; import { useDeviceSessionsContext } from "@/providers/DeviceSessionsProvider"; const Root = styled(Flex).attrs({ mx: 15, mt: 10, mb: 5 })` @@ -69,7 +69,7 @@ export const ApduView: React.FC = () => { useApduForm(); const [loading, setLoading] = useState(false); const [apduResponse, setApduResponse] = useState(); - const sdk = useSdk(); + const dmk = useDmk(); const { state: { selectedId: selectedSessionId }, } = useDeviceSessionsContext(); @@ -78,7 +78,7 @@ export const ApduView: React.FC = () => { setLoading(true); let rawApduResponse; try { - rawApduResponse = await sdk.sendApdu({ + rawApduResponse = await dmk.sendApdu({ sessionId: selectedSessionId ?? "", apdu: getRawApdu(values), }); @@ -89,7 +89,7 @@ export const ApduView: React.FC = () => { setLoading(false); } }, - [getRawApdu, sdk, selectedSessionId], + [getRawApdu, dmk, selectedSessionId], ); return ( diff --git a/apps/sample/src/components/AvailableDevices/index.tsx b/apps/sample/src/components/AvailableDevices/index.tsx index bf883e075..02fbb759f 100644 --- a/apps/sample/src/components/AvailableDevices/index.tsx +++ b/apps/sample/src/components/AvailableDevices/index.tsx @@ -5,7 +5,7 @@ import styled from "styled-components"; import { AvailableDevice } from "@/components/Device"; import { useAvailableDevices } from "@/hooks/useAvailableDevices"; -import { useSdk } from "@/providers/DeviceSdkProvider"; +import { useDmk } from "@/providers/DeviceManagementKitProvider"; import { useDeviceSessionsContext } from "@/providers/DeviceSessionsProvider"; const Title = styled(Text)<{ disabled: boolean }>` @@ -66,19 +66,19 @@ const KnownDevice: React.FC = ( device, ) => { const { deviceModel, connected } = device; - const sdk = useSdk(); + const dmk = useDmk(); const { dispatch } = useDeviceSessionsContext(); const connectToDevice = useCallback(() => { - sdk.connect({ device }).then((sessionId) => { + dmk.connect({ device }).then((sessionId) => { dispatch({ type: "add_session", payload: { sessionId, - connectedDevice: sdk.getConnectedDevice({ sessionId }), + connectedDevice: dmk.getConnectedDevice({ sessionId }), }, }); }); - }, [sdk, device, dispatch]); + }, [dmk, device, dispatch]); return ( diff --git a/apps/sample/src/components/CalView/CalCheckDappDrawer.tsx b/apps/sample/src/components/CalView/CalCheckDappDrawer.tsx index d8a9ac635..cd75a04bd 100644 --- a/apps/sample/src/components/CalView/CalCheckDappDrawer.tsx +++ b/apps/sample/src/components/CalView/CalCheckDappDrawer.tsx @@ -13,7 +13,7 @@ import { type ValueSelector, } from "@/components/CommandsView/CommandForm"; import { type FieldType } from "@/hooks/useForm"; -import { useCalConfig } from "@/providers/KeyringEthProvider"; +import { useCalConfig } from "@/providers/SignerEthProvider"; import { CalAvailabilityResponseComponent } from "./CalAvailabilityResponse"; import { diff --git a/apps/sample/src/components/CalView/CalSettingsDrawer.tsx b/apps/sample/src/components/CalView/CalSettingsDrawer.tsx index eb3f20f0c..0f7f31682 100644 --- a/apps/sample/src/components/CalView/CalSettingsDrawer.tsx +++ b/apps/sample/src/components/CalView/CalSettingsDrawer.tsx @@ -8,7 +8,7 @@ import { type ValueSelector, } from "@/components/CommandsView/CommandForm"; import { type FieldType } from "@/hooks/useForm"; -import { useCalConfig } from "@/providers/KeyringEthProvider"; +import { useCalConfig } from "@/providers/SignerEthProvider"; type CalSettingsDrawerProps = { onClose: () => void; diff --git a/apps/sample/src/components/CalView/index.tsx b/apps/sample/src/components/CalView/index.tsx index 4bc119e5b..6875670f1 100644 --- a/apps/sample/src/components/CalView/index.tsx +++ b/apps/sample/src/components/CalView/index.tsx @@ -48,7 +48,7 @@ export const CalView = () => { > {entries.map(({ title, description, onClick }) => ( = ({ sessionId: selectedSessionId, }) => { - const sdk = useSdk(); + const dmk = useDmk(); // eslint-disable-next-line @typescript-eslint/no-explicit-any const commands: CommandProps[] = useMemo( @@ -38,7 +38,7 @@ export const CommandsView: React.FC<{ sessionId: string }> = ({ description: "List all apps on the device", sendCommand: ({ isContinue }) => { const command = new ListAppsCommand({ isContinue }); - return sdk.sendCommand({ + return dmk.sendCommand({ sessionId: selectedSessionId, command, }); @@ -54,7 +54,7 @@ export const CommandsView: React.FC<{ sessionId: string }> = ({ description: "Launch an app on the device", sendCommand: ({ appName }) => { const command = new OpenAppCommand({ appName }); - return sdk.sendCommand({ + return dmk.sendCommand({ sessionId: selectedSessionId, command, }); @@ -67,7 +67,7 @@ export const CommandsView: React.FC<{ sessionId: string }> = ({ description: "Close the currently open app", sendCommand: () => { const command = new CloseAppCommand(); - return sdk.sendCommand({ + return dmk.sendCommand({ sessionId: selectedSessionId, command, }); @@ -79,7 +79,7 @@ export const CommandsView: React.FC<{ sessionId: string }> = ({ description: "Get the currently open app and its version", sendCommand: () => { const command = new GetAppAndVersionCommand(); - return sdk.sendCommand({ + return dmk.sendCommand({ sessionId: selectedSessionId, command, }); @@ -91,7 +91,7 @@ export const CommandsView: React.FC<{ sessionId: string }> = ({ description: "Get the OS version of the device", sendCommand: () => { const command = new GetOsVersionCommand(); - return sdk.sendCommand({ + return dmk.sendCommand({ sessionId: selectedSessionId, command, }); @@ -103,7 +103,7 @@ export const CommandsView: React.FC<{ sessionId: string }> = ({ description: "Get the battery status of the device", sendCommand: ({ statusType }) => { const command = new GetBatteryStatusCommand({ statusType }); - return sdk.sendCommand({ + return dmk.sendCommand({ sessionId: selectedSessionId, command, }); @@ -116,7 +116,7 @@ export const CommandsView: React.FC<{ sessionId: string }> = ({ }, } satisfies CommandProps, ], - [selectedSessionId, sdk], + [selectedSessionId, dmk], ); return ( diff --git a/apps/sample/src/components/DeviceActionsView/AllDeviceActions.tsx b/apps/sample/src/components/DeviceActionsView/AllDeviceActions.tsx index bdd69f6c0..dea6ed349 100644 --- a/apps/sample/src/components/DeviceActionsView/AllDeviceActions.tsx +++ b/apps/sample/src/components/DeviceActionsView/AllDeviceActions.tsx @@ -28,7 +28,7 @@ import { OpenAppDeviceAction, } from "@ledgerhq/device-management-kit"; -import { useSdk } from "@/providers/DeviceSdkProvider"; +import { useDmk } from "@/providers/DeviceManagementKitProvider"; import { DeviceActionsList, UNLOCK_TIMEOUT } from "./DeviceActionsList"; import { type DeviceActionProps } from "./DeviceActionTester"; @@ -36,9 +36,9 @@ import { type DeviceActionProps } from "./DeviceActionTester"; export const AllDeviceActions: React.FC<{ sessionId: string }> = ({ sessionId, }) => { - const sdk = useSdk(); + const dmk = useDmk(); - const deviceModelId = sdk.getConnectedDevice({ + const deviceModelId = dmk.getConnectedDevice({ sessionId, }).modelId; @@ -54,7 +54,7 @@ export const AllDeviceActions: React.FC<{ sessionId: string }> = ({ input: { appName, unlockTimeout }, inspect, }); - return sdk.executeDeviceAction({ + return dmk.executeDeviceAction({ sessionId, deviceAction, }); @@ -76,7 +76,7 @@ export const AllDeviceActions: React.FC<{ sessionId: string }> = ({ input: { unlockTimeout }, inspect, }); - return sdk.executeDeviceAction({ + return dmk.executeDeviceAction({ sessionId, deviceAction, }); @@ -97,7 +97,7 @@ export const AllDeviceActions: React.FC<{ sessionId: string }> = ({ input: { unlockTimeout }, inspect, }); - return sdk.executeDeviceAction({ + return dmk.executeDeviceAction({ sessionId, deviceAction, }); @@ -118,7 +118,7 @@ export const AllDeviceActions: React.FC<{ sessionId: string }> = ({ input: { unlockTimeout }, inspect, }); - return sdk.executeDeviceAction({ + return dmk.executeDeviceAction({ sessionId, deviceAction, }); @@ -140,7 +140,7 @@ export const AllDeviceActions: React.FC<{ sessionId: string }> = ({ input: { unlockTimeout }, inspect, }); - return sdk.executeDeviceAction({ + return dmk.executeDeviceAction({ sessionId, deviceAction, }); @@ -154,7 +154,7 @@ export const AllDeviceActions: React.FC<{ sessionId: string }> = ({ ListAppsWithMetadataDAIntermediateValue >, ], - [deviceModelId, sdk, sessionId], + [deviceModelId, dmk, sessionId], ); return ( diff --git a/apps/sample/src/components/DeviceActionsView/DeviceActionTester.tsx b/apps/sample/src/components/DeviceActionsView/DeviceActionTester.tsx index ed9e2310d..ea78a83d7 100644 --- a/apps/sample/src/components/DeviceActionsView/DeviceActionTester.tsx +++ b/apps/sample/src/components/DeviceActionsView/DeviceActionTester.tsx @@ -2,8 +2,8 @@ import React from "react"; import { useCallback, useEffect, useRef, useState } from "react"; import type { DeviceActionIntermediateValue, + DmkError, ExecuteDeviceActionReturnType, - SdkError, } from "@ledgerhq/device-management-kit"; import { type DeviceModelId } from "@ledgerhq/device-management-kit"; import { @@ -35,7 +35,7 @@ import { DeviceActionUI } from "./DeviceActionUI"; export type DeviceActionProps< Output, Input extends Record | void, - Error extends SdkError, + Error extends DmkError, IntermediateValue extends DeviceActionIntermediateValue, > = { title: string; @@ -85,7 +85,7 @@ const BoxHeader: React.FC<{ children: string; hint: string }> = ({ export function DeviceActionTester< Output, Input extends Record, - Error extends SdkError, + Error extends DmkError, IntermediateValue extends DeviceActionIntermediateValue, >(props: DeviceActionProps) { const { @@ -300,7 +300,7 @@ export function DeviceActionTester< export function DeviceActionRow< Output, Input extends Record, - Error extends SdkError, + Error extends DmkError, IntermediateValue extends DeviceActionIntermediateValue, >( props: DeviceActionProps & { diff --git a/apps/sample/src/components/Header/index.tsx b/apps/sample/src/components/Header/index.tsx index 7c73274d0..b0e746020 100644 --- a/apps/sample/src/components/Header/index.tsx +++ b/apps/sample/src/components/Header/index.tsx @@ -13,7 +13,7 @@ import { } from "@ledgerhq/react-ui"; import styled, { type DefaultTheme } from "styled-components"; -import { useSdkConfigContext } from "@/providers/SdkConfig"; +import { useDmkConfigContext } from "@/providers/DmkConfig"; const Root = styled(Flex).attrs({ py: 3, px: 10, gridGap: 8 })` color: ${({ theme }: { theme: DefaultTheme }) => theme.colors.neutral.c90}; @@ -41,7 +41,7 @@ export const Header = () => { const { dispatch, state: { transport, mockServerUrl }, - } = useSdkConfigContext(); + } = useDmkConfigContext(); const onToggleMockServer = useCallback(() => { dispatch({ type: "set_transport", diff --git a/apps/sample/src/components/MainView/ConnectDeviceActions.tsx b/apps/sample/src/components/MainView/ConnectDeviceActions.tsx index 1ffd576c3..2334173ee 100644 --- a/apps/sample/src/components/MainView/ConnectDeviceActions.tsx +++ b/apps/sample/src/components/MainView/ConnectDeviceActions.tsx @@ -1,17 +1,17 @@ import React, { useCallback } from "react"; import { BuiltinTransports, - type SdkError, + type DmkError, } from "@ledgerhq/device-management-kit"; import { Button, Flex } from "@ledgerhq/react-ui"; import styled from "styled-components"; -import { useSdk } from "@/providers/DeviceSdkProvider"; +import { useDmk } from "@/providers/DeviceManagementKitProvider"; import { useDeviceSessionsContext } from "@/providers/DeviceSessionsProvider"; -import { useSdkConfigContext } from "@/providers/SdkConfig"; +import { useDmkConfigContext } from "@/providers/DmkConfig"; type ConnectDeviceActionsProps = { - onError: (error: SdkError | null) => void; + onError: (error: DmkError | null) => void; }; const ConnectButton = styled(Button).attrs({ mx: 3 })``; @@ -21,16 +21,16 @@ export const ConnectDeviceActions = ({ }: ConnectDeviceActionsProps) => { const { state: { transport }, - } = useSdkConfigContext(); + } = useDmkConfigContext(); const { dispatch: dispatchDeviceSession } = useDeviceSessionsContext(); - const sdk = useSdk(); + const dmk = useDmk(); const onSelectDeviceClicked = useCallback( (selectedTransport: BuiltinTransports) => { onError(null); - sdk.startDiscovering({ transport: selectedTransport }).subscribe({ + dmk.startDiscovering({ transport: selectedTransport }).subscribe({ next: (device) => { - sdk + dmk .connect({ device }) .then((sessionId) => { console.log( @@ -40,7 +40,7 @@ export const ConnectDeviceActions = ({ type: "add_session", payload: { sessionId, - connectedDevice: sdk.getConnectedDevice({ sessionId }), + connectedDevice: dmk.getConnectedDevice({ sessionId }), }, }); }) @@ -54,7 +54,7 @@ export const ConnectDeviceActions = ({ }, }); }, - [dispatchDeviceSession, onError, sdk], + [dispatchDeviceSession, onError, dmk], ); // This implementation gives the impression that working with the mock server diff --git a/apps/sample/src/components/MainView/index.tsx b/apps/sample/src/components/MainView/index.tsx index fd5444db7..45aa638fb 100644 --- a/apps/sample/src/components/MainView/index.tsx +++ b/apps/sample/src/components/MainView/index.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from "react"; -import { type SdkError } from "@ledgerhq/device-management-kit"; +import { type DmkError } from "@ledgerhq/device-management-kit"; import { Badge, Flex, Icon, Notification, Text } from "@ledgerhq/react-ui"; import Image from "next/image"; import styled, { type DefaultTheme } from "styled-components"; @@ -27,7 +27,7 @@ const NanoLogo = styled(Image).attrs({ mb: 8 })` `; export const MainView: React.FC = () => { - const [connectionError, setConnectionError] = useState(null); + const [connectionError, setConnectionError] = useState(null); useEffect(() => { let timeoutId: NodeJS.Timeout; diff --git a/apps/sample/src/components/Menu/index.tsx b/apps/sample/src/components/Menu/index.tsx index bbc598816..e8f8979ce 100644 --- a/apps/sample/src/components/Menu/index.tsx +++ b/apps/sample/src/components/Menu/index.tsx @@ -4,7 +4,7 @@ import { Flex, Icons, Link } from "@ledgerhq/react-ui"; import { useRouter } from "next/navigation"; import styled from "styled-components"; -import { useSdkConfigContext } from "@/providers/SdkConfig"; +import { useDmkConfigContext } from "@/providers/DmkConfig"; const MenuItem = styled(Flex).attrs({ p: 3, pl: 5 })` align-items: center; @@ -20,7 +20,7 @@ export const Menu: React.FC = () => { const router = useRouter(); const { state: { transport }, - } = useSdkConfigContext(); + } = useDmkConfigContext(); return ( <> @@ -62,10 +62,10 @@ export const Menu: React.FC = () => { router.push("/keyring")} + data-testid="CTA_route-to-/signer" + onClick={() => router.push("/signer")} > - Keyrings + Signers diff --git a/apps/sample/src/components/MockView/MockDeviceDrawer.tsx b/apps/sample/src/components/MockView/MockDeviceDrawer.tsx index 86dd10398..1176e5453 100644 --- a/apps/sample/src/components/MockView/MockDeviceDrawer.tsx +++ b/apps/sample/src/components/MockView/MockDeviceDrawer.tsx @@ -3,7 +3,7 @@ import { type Mock, type MockClient, type Session, -} from "@ledgerhq/device-sdk-transport-mock"; +} from "@ledgerhq/device-transport-kit-mock-client"; import { Button, Divider, Flex, Input, Text } from "@ledgerhq/react-ui"; import styled from "styled-components"; diff --git a/apps/sample/src/components/MockView/MockItem.tsx b/apps/sample/src/components/MockView/MockItem.tsx index 0c8b8cf28..78c3668a1 100644 --- a/apps/sample/src/components/MockView/MockItem.tsx +++ b/apps/sample/src/components/MockView/MockItem.tsx @@ -1,5 +1,5 @@ import React, { useState } from "react"; -import { type Mock } from "@ledgerhq/device-sdk-transport-mock"; +import { type Mock } from "@ledgerhq/device-transport-kit-mock-client"; import { Button, Flex, Icons, Input, Text } from "@ledgerhq/react-ui"; type MockItemProps = { diff --git a/apps/sample/src/components/MockView/index.tsx b/apps/sample/src/components/MockView/index.tsx index f038fc37d..085ac28c3 100644 --- a/apps/sample/src/components/MockView/index.tsx +++ b/apps/sample/src/components/MockView/index.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useEffect, useState } from "react"; -import { type Session } from "@ledgerhq/device-sdk-transport-mock"; +import { type Session } from "@ledgerhq/device-transport-kit-mock-client"; import { Button, Flex, Text } from "@ledgerhq/react-ui"; import styled from "styled-components"; @@ -7,7 +7,7 @@ import { ClickableListItem } from "@/components/ClickableListItem"; import { MockDeviceDrawer } from "@/components/MockView/MockDeviceDrawer"; import { PageWithHeader } from "@/components/PageWithHeader"; import { useMockClient } from "@/hooks/useMockClient"; -import { useSdkConfigContext } from "@/providers/SdkConfig"; +import { useDmkConfigContext } from "@/providers/DmkConfig"; const MockButton = styled(Button).attrs({ variant: "main", @@ -23,7 +23,7 @@ export const MockView: React.FC = () => { const { state: { mockServerUrl }, - } = useSdkConfigContext(); + } = useDmkConfigContext(); const client = useMockClient(mockServerUrl); diff --git a/apps/sample/src/components/Sidebar/index.tsx b/apps/sample/src/components/Sidebar/index.tsx index 054145263..427cc7854 100644 --- a/apps/sample/src/components/Sidebar/index.tsx +++ b/apps/sample/src/components/Sidebar/index.tsx @@ -8,9 +8,12 @@ import styled, { type DefaultTheme } from "styled-components"; import { AvailableDevices } from "@/components/AvailableDevices"; import { Device } from "@/components/Device"; import { Menu } from "@/components/Menu"; -import { useExportLogsCallback, useSdk } from "@/providers/DeviceSdkProvider"; +import { + useDmk, + useExportLogsCallback, +} from "@/providers/DeviceManagementKitProvider"; import { useDeviceSessionsContext } from "@/providers/DeviceSessionsProvider"; -import { useSdkConfigContext } from "@/providers/SdkConfig"; +import { useDmkConfigContext } from "@/providers/DmkConfig"; const Root = styled(Flex).attrs({ py: 8, px: 6 })` flex-direction: column; @@ -46,7 +49,7 @@ const VersionText = styled(Text)` export const Sidebar: React.FC = () => { const [version, setVersion] = useState(""); - const sdk = useSdk(); + const dmk = useDmk(); const exportLogs = useExportLogsCallback(); const { state: { deviceById, selectedId }, @@ -54,27 +57,27 @@ export const Sidebar: React.FC = () => { } = useDeviceSessionsContext(); const { state: { transport }, - } = useSdkConfigContext(); + } = useDmkConfigContext(); useEffect(() => { - sdk + dmk .getVersion() .then((v) => setVersion(v)) .catch((error: unknown) => { console.error(new Error(String(error))); setVersion(""); }); - }, [sdk]); + }, [dmk]); const onDeviceDisconnect = useCallback( async (sessionId: string) => { try { - await sdk.disconnect({ sessionId }); + await dmk.disconnect({ sessionId }); dispatch({ type: "remove_session", payload: { sessionId } }); } catch (e) { console.error(e); } }, - [dispatch, sdk], + [dispatch, dmk], ); const router = useRouter(); diff --git a/apps/sample/src/components/KeyringEthView/index.tsx b/apps/sample/src/components/SignerEthView/index.tsx similarity index 84% rename from apps/sample/src/components/KeyringEthView/index.tsx rename to apps/sample/src/components/SignerEthView/index.tsx index dc932553a..0aa711ea3 100644 --- a/apps/sample/src/components/KeyringEthView/index.tsx +++ b/apps/sample/src/components/SignerEthView/index.tsx @@ -18,16 +18,16 @@ import { ethers } from "ethers"; import { DeviceActionsList } from "@/components/DeviceActionsView/DeviceActionsList"; import { type DeviceActionProps } from "@/components/DeviceActionsView/DeviceActionTester"; -import { useSdk } from "@/providers/DeviceSdkProvider"; -import { useKeyringEth } from "@/providers/KeyringEthProvider"; +import { useDmk } from "@/providers/DeviceManagementKitProvider"; +import { useSignerEth } from "@/providers/SignerEthProvider"; -export const KeyringEthView: React.FC<{ sessionId: string }> = ({ +export const SignerEthView: React.FC<{ sessionId: string }> = ({ sessionId, }) => { - const sdk = useSdk(); - const keyring = useKeyringEth(); + const dmk = useDmk(); + const signer = useSignerEth(); - const deviceModelId = sdk.getConnectedDevice({ + const deviceModelId = dmk.getConnectedDevice({ sessionId, }).modelId; @@ -43,10 +43,10 @@ export const KeyringEthView: React.FC<{ sessionId: string }> = ({ checkOnDevice, returnChainCode, }) => { - if (!keyring) { - throw new Error("Keyring not initialized"); + if (!signer) { + throw new Error("Signer not initialized"); } - return keyring.getAddress(derivationPath, { + return signer.getAddress(derivationPath, { checkOnDevice, returnChainCode, }); @@ -72,10 +72,10 @@ export const KeyringEthView: React.FC<{ sessionId: string }> = ({ description: "Perform all the actions necessary to sign a message with the device", executeDeviceAction: ({ derivationPath, message }) => { - if (!keyring) { - throw new Error("Keyring not initialized"); + if (!signer) { + throw new Error("Signer not initialized"); } - return keyring.signMessage(derivationPath, message); + return signer.signMessage(derivationPath, message); }, initialValues: { derivationPath: "44'/60'/0'/0/0", @@ -100,10 +100,10 @@ export const KeyringEthView: React.FC<{ sessionId: string }> = ({ transaction, recipientDomain, }) => { - if (!keyring) { - throw new Error("Keyring not initialized"); + if (!signer) { + throw new Error("Signer not initialized"); } - return keyring.signTransaction( + return signer.signTransaction( derivationPath, ethers.Transaction.from(transaction), { domain: recipientDomain }, @@ -132,10 +132,10 @@ export const KeyringEthView: React.FC<{ sessionId: string }> = ({ executeDeviceAction: ({ derivationPath, message }) => { const typedData = JSON.parse(message) as TypedData; - if (!keyring) { - throw new Error("Keyring not initialized"); + if (!signer) { + throw new Error("Signer not initialized"); } - return keyring.signTypedData(derivationPath, typedData); + return signer.signTypedData(derivationPath, typedData); }, initialValues: { derivationPath: "44'/60'/0'/0/0", @@ -173,10 +173,10 @@ export const KeyringEthView: React.FC<{ sessionId: string }> = ({ SignTypedDataDAIntermediateValue >, ], - [deviceModelId, keyring], + [deviceModelId, signer], ); return ( - + ); }; diff --git a/apps/sample/src/components/SignerSolanaView/index.tsx b/apps/sample/src/components/SignerSolanaView/index.tsx index df614dedb..952371d32 100644 --- a/apps/sample/src/components/SignerSolanaView/index.tsx +++ b/apps/sample/src/components/SignerSolanaView/index.tsx @@ -8,17 +8,17 @@ import { import { DeviceActionsList } from "@/components/DeviceActionsView/DeviceActionsList"; import { type DeviceActionProps } from "@/components/DeviceActionsView/DeviceActionTester"; -import { useSdk } from "@/providers/DeviceSdkProvider"; +import { useDmk } from "@/providers/DeviceManagementKitProvider"; const DEFAULT_DERIVATION_PATH = "44'/501'"; export const SignerSolanaView: React.FC<{ sessionId: string }> = ({ sessionId, }) => { - const sdk = useSdk(); - const signer = new SignerSolanaBuilder({ sdk, sessionId }).build(); + const dmk = useDmk(); + const signer = new SignerSolanaBuilder({ dmk, sessionId }).build(); - const deviceModelId = sdk.getConnectedDevice({ + const deviceModelId = dmk.getConnectedDevice({ sessionId, }).modelId; diff --git a/apps/sample/src/components/KeyringView/index.tsx b/apps/sample/src/components/SignerView/index.tsx similarity index 65% rename from apps/sample/src/components/KeyringView/index.tsx rename to apps/sample/src/components/SignerView/index.tsx index 3a86dc9e6..3e5ef4b6c 100644 --- a/apps/sample/src/components/KeyringView/index.tsx +++ b/apps/sample/src/components/SignerView/index.tsx @@ -5,40 +5,40 @@ import { useRouter } from "next/navigation"; import { PageWithHeader } from "@/components//PageWithHeader"; import { ClickableListItem } from "@/components/ClickableListItem"; -const SUPPORTED_KEYRINGS = [ +const SUPPORTED_SIGNERS = [ { title: "Ethereum", - description: "Access EVM compatible keyring functionality", + description: "Access EVM compatible signer functionality", icon: , }, { title: "Bitcoin", - description: "Access Bitcoin keyring functionality", + description: "Access Bitcoin signer functionality", icon: , }, { title: "Solana", - description: "Access Solana keyring functionality", + description: "Access Solana signer functionality", icon: , }, ]; -export const KeyringView = () => { +export const SignerView = () => { const router = useRouter(); return ( - + - {SUPPORTED_KEYRINGS.map(({ title, description, icon }) => ( + {SUPPORTED_SIGNERS.map(({ title, description, icon }) => ( { - router.push(`/keyring/${title.toLowerCase()}`); + router.push(`/signer/${title.toLowerCase()}`); }} icon={icon} /> diff --git a/apps/sample/src/hooks/useAvailableDevices.tsx b/apps/sample/src/hooks/useAvailableDevices.tsx index 57d07f551..2a78ef7b7 100644 --- a/apps/sample/src/hooks/useAvailableDevices.tsx +++ b/apps/sample/src/hooks/useAvailableDevices.tsx @@ -2,13 +2,13 @@ import { useEffect, useMemo, useRef, useState } from "react"; import { type DiscoveredDevice } from "@ledgerhq/device-management-kit"; import { type Subscription } from "rxjs"; -import { useSdk } from "@/providers/DeviceSdkProvider"; +import { useDmk } from "@/providers/DeviceManagementKitProvider"; import { useDeviceSessionsContext } from "@/providers/DeviceSessionsProvider"; type AvailableDevice = DiscoveredDevice & { connected: boolean }; export function useAvailableDevices(): AvailableDevice[] { - const sdk = useSdk(); + const dmk = useDmk(); const [discoveredDevices, setDiscoveredDevices] = useState< DiscoveredDevice[] >([]); @@ -17,7 +17,7 @@ export function useAvailableDevices(): AvailableDevice[] { const subscription = useRef(null); useEffect(() => { if (!subscription.current) { - subscription.current = sdk.listenToKnownDevices().subscribe((devices) => { + subscription.current = dmk.listenToKnownDevices().subscribe((devices) => { setDiscoveredDevices(devices); }); } @@ -28,7 +28,7 @@ export function useAvailableDevices(): AvailableDevice[] { subscription.current = null; } }; - }, [sdk]); + }, [dmk]); const result = useMemo( () => diff --git a/apps/sample/src/hooks/useDeviceSessionState.ts b/apps/sample/src/hooks/useDeviceSessionState.ts index 6fc770f1a..03236e543 100644 --- a/apps/sample/src/hooks/useDeviceSessionState.ts +++ b/apps/sample/src/hooks/useDeviceSessionState.ts @@ -5,18 +5,18 @@ import { DeviceStatus, } from "@ledgerhq/device-management-kit"; -import { useSdk } from "@/providers/DeviceSdkProvider"; +import { useDmk } from "@/providers/DeviceManagementKitProvider"; import { useDeviceSessionsContext } from "@/providers/DeviceSessionsProvider"; export function useDeviceSessionState(sessionId: DeviceSessionId) { - const sdk = useSdk(); + const dmk = useDmk(); const [deviceSessionState, setDeviceSessionState] = useState(); const { dispatch } = useDeviceSessionsContext(); useEffect(() => { if (sessionId) { - const subscription = sdk + const subscription = dmk .getDeviceSessionState({ sessionId, }) @@ -32,7 +32,7 @@ export function useDeviceSessionState(sessionId: DeviceSessionId) { subscription.unsubscribe(); }; } - }, [sessionId, sdk, dispatch]); + }, [sessionId, dmk, dispatch]); return deviceSessionState; } diff --git a/apps/sample/src/hooks/useMockClient.ts b/apps/sample/src/hooks/useMockClient.ts index 581429d8e..58560561a 100644 --- a/apps/sample/src/hooks/useMockClient.ts +++ b/apps/sample/src/hooks/useMockClient.ts @@ -1,5 +1,5 @@ import { useEffect, useState } from "react"; -import { MockClient } from "@ledgerhq/device-sdk-transport-mock"; +import { MockClient } from "@ledgerhq/device-transport-kit-mock-client"; export const useMockClient = (url: string): MockClient => { const [client, setClient] = useState(new MockClient(url)); diff --git a/apps/sample/src/providers/DeviceSdkProvider/index.tsx b/apps/sample/src/providers/DeviceManagementKitProvider/index.tsx similarity index 59% rename from apps/sample/src/providers/DeviceSdkProvider/index.tsx rename to apps/sample/src/providers/DeviceManagementKitProvider/index.tsx index 05a52e024..f5ce22a18 100644 --- a/apps/sample/src/providers/DeviceSdkProvider/index.tsx +++ b/apps/sample/src/providers/DeviceManagementKitProvider/index.tsx @@ -3,50 +3,50 @@ import { createContext, type PropsWithChildren, useContext } from "react"; import { BuiltinTransports, ConsoleLogger, - type DeviceSdk, - DeviceSdkBuilder, + type DeviceManagementKit, + DeviceManagementKitBuilder, WebLogsExporterLogger, } from "@ledgerhq/device-management-kit"; -import { FlipperSdkLogger } from "@ledgerhq/device-management-kit-flipper-plugin-client"; +import { FlipperDmkLogger } from "@ledgerhq/device-management-kit-flipper-plugin-client"; import { useHasChanged } from "@/hooks/useHasChanged"; -import { useSdkConfigContext } from "@/providers/SdkConfig"; +import { useDmkConfigContext } from "@/providers/DmkConfig"; -const SdkContext = createContext(null); +const DmkContext = createContext(null); const LogsExporterContext = createContext(null); -function buildDefaultSdk(logsExporter: WebLogsExporterLogger) { - return new DeviceSdkBuilder() +function buildDefaultDmk(logsExporter: WebLogsExporterLogger) { + return new DeviceManagementKitBuilder() .addTransport(BuiltinTransports.USB) .addTransport(BuiltinTransports.BLE) .addLogger(new ConsoleLogger()) .addLogger(logsExporter) - .addLogger(new FlipperSdkLogger()) + .addLogger(new FlipperDmkLogger()) .build(); } -function buildMockSdk(url: string, logsExporter: WebLogsExporterLogger) { - return new DeviceSdkBuilder() +function buildMockDmk(url: string, logsExporter: WebLogsExporterLogger) { + return new DeviceManagementKitBuilder() .addTransport(BuiltinTransports.MOCK_SERVER) .addLogger(new ConsoleLogger()) .addLogger(logsExporter) - .addLogger(new FlipperSdkLogger()) + .addLogger(new FlipperDmkLogger()) .addConfig({ mockUrl: url }) .build(); } -export const SdkProvider: React.FC = ({ children }) => { +export const DmkProvider: React.FC = ({ children }) => { const { state: { transport, mockServerUrl }, - } = useSdkConfigContext(); + } = useDmkConfigContext(); const mockServerEnabled = transport === BuiltinTransports.MOCK_SERVER; const [state, setState] = useState(() => { const logsExporter = new WebLogsExporterLogger(); - const sdk = mockServerEnabled - ? buildMockSdk(mockServerUrl, logsExporter) - : buildDefaultSdk(logsExporter); - return { sdk, logsExporter }; + const dmk = mockServerEnabled + ? buildMockDmk(mockServerUrl, logsExporter) + : buildDefaultDmk(logsExporter); + return { dmk, logsExporter }; }); const mockServerEnabledChanged = useHasChanged(mockServerEnabled); @@ -55,9 +55,9 @@ export const SdkProvider: React.FC = ({ children }) => { if (mockServerEnabledChanged || mockServerUrlChanged) { setState(({ logsExporter }) => { return { - sdk: mockServerEnabled - ? buildMockSdk(mockServerUrl, logsExporter) - : buildDefaultSdk(logsExporter), + dmk: mockServerEnabled + ? buildMockDmk(mockServerUrl, logsExporter) + : buildDefaultDmk(logsExporter), logsExporter, }; }); @@ -65,24 +65,24 @@ export const SdkProvider: React.FC = ({ children }) => { useEffect(() => { return () => { - state.sdk.close(); + state.dmk.close(); }; - }, [state.sdk]); + }, [state.dmk]); return ( - + {children} - + ); }; -export const useSdk = (): DeviceSdk => { - const sdk = useContext(SdkContext); - if (sdk === null) - throw new Error("useSdk must be used within a SdkContext.Provider"); - return sdk; +export const useDmk = (): DeviceManagementKit => { + const dmk = useContext(DmkContext); + if (dmk === null) + throw new Error("useDmk must be used within a DmkContext.Provider"); + return dmk; }; export function useExportLogsCallback() { diff --git a/apps/sample/src/providers/DeviceSessionsProvider/index.tsx b/apps/sample/src/providers/DeviceSessionsProvider/index.tsx index 9218da576..9dd46cef6 100644 --- a/apps/sample/src/providers/DeviceSessionsProvider/index.tsx +++ b/apps/sample/src/providers/DeviceSessionsProvider/index.tsx @@ -7,7 +7,7 @@ import React, { } from "react"; import { useHasChanged } from "@/hooks/useHasChanged"; -import { useSdk } from "@/providers/DeviceSdkProvider"; +import { useDmk } from "@/providers/DeviceManagementKitProvider"; import { type DeviceSessionsAction, DeviceSessionsInitialState, @@ -29,28 +29,28 @@ const DeviceSessionsContext: Context = export const DeviceSessionsProvider: React.FC = ({ children, }) => { - const sdk = useSdk(); + const dmk = useDmk(); const [state, dispatch] = useReducer( deviceSessionsReducer, DeviceSessionsInitialState, ); - const sdkHasChanged = useHasChanged(sdk); - if (sdkHasChanged) { + const dmkHasChanged = useHasChanged(dmk); + if (dmkHasChanged) { dispatch({ type: "remove_all_sessions" }); } useEffect(() => { - sdk.listDeviceSessions().map((session) => { + dmk.listDeviceSessions().map((session) => { dispatch({ type: "add_session", payload: { sessionId: session.id, - connectedDevice: sdk.getConnectedDevice({ sessionId: session.id }), + connectedDevice: dmk.getConnectedDevice({ sessionId: session.id }), }, }); }); - }, [sdk]); + }, [dmk]); return ( diff --git a/apps/sample/src/providers/DmkConfig/index.tsx b/apps/sample/src/providers/DmkConfig/index.tsx new file mode 100644 index 000000000..60b668e66 --- /dev/null +++ b/apps/sample/src/providers/DmkConfig/index.tsx @@ -0,0 +1,34 @@ +import React from "react"; +import { createContext, useContext, useReducer } from "react"; + +import { + type DmkConfigAction, + DmkConfigInitialState, + dmkConfigReducer, + type DmkConfigState, +} from "@/reducers/dmkConfig"; + +type DmkConfigContextType = { + state: DmkConfigState; + dispatch: (value: DmkConfigAction) => void; +}; + +const DmkConfigContext = createContext({ + state: DmkConfigInitialState, + dispatch: () => null, +}); + +export const DmkConfigProvider: React.FC = ({ + children, +}) => { + const [state, dispatch] = useReducer(dmkConfigReducer, DmkConfigInitialState); + + return ( + + {children} + + ); +}; + +export const useDmkConfigContext = () => + useContext(DmkConfigContext); diff --git a/apps/sample/src/providers/SdkConfig/index.tsx b/apps/sample/src/providers/SdkConfig/index.tsx deleted file mode 100644 index 807d42085..000000000 --- a/apps/sample/src/providers/SdkConfig/index.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import React from "react"; -import { createContext, useContext, useReducer } from "react"; - -import { - type SdkConfigAction, - SdkConfigInitialState, - sdkConfigReducer, - type SdkConfigState, -} from "@/reducers/sdkConfig"; - -type SdkConfigContextType = { - state: SdkConfigState; - dispatch: (value: SdkConfigAction) => void; -}; - -const SdkConfigContext = createContext({ - state: SdkConfigInitialState, - dispatch: () => null, -}); - -export const SdkConfigProvider: React.FC = ({ - children, -}) => { - const [state, dispatch] = useReducer(sdkConfigReducer, SdkConfigInitialState); - - return ( - - {children} - - ); -}; - -export const useSdkConfigContext = () => - useContext(SdkConfigContext); diff --git a/apps/sample/src/providers/KeyringEthProvider/index.tsx b/apps/sample/src/providers/SignerEthProvider/index.tsx similarity index 55% rename from apps/sample/src/providers/KeyringEthProvider/index.tsx rename to apps/sample/src/providers/SignerEthProvider/index.tsx index f36bf4e5e..d5da929bf 100644 --- a/apps/sample/src/providers/KeyringEthProvider/index.tsx +++ b/apps/sample/src/providers/SignerEthProvider/index.tsx @@ -12,21 +12,21 @@ import { type ContextModuleCalConfig, } from "@ledgerhq/context-module"; import { - type KeyringEth, - KeyringEthBuilder, + type SignerEth, + SignerEthBuilder, } from "@ledgerhq/device-signer-kit-ethereum"; -import { useSdk } from "@/providers/DeviceSdkProvider"; +import { useDmk } from "@/providers/DeviceManagementKitProvider"; import { useDeviceSessionsContext } from "@/providers/DeviceSessionsProvider"; -type KeyringEthContextType = { - keyring: KeyringEth | null; +type SignerEthContextType = { + signer: SignerEth | null; calConfig: ContextModuleCalConfig; setCalConfig: (cal: ContextModuleCalConfig) => void; }; -const initialState: KeyringEthContextType = { - keyring: null, +const initialState: SignerEthContextType = { + signer: null, calConfig: { url: "https://crypto-assets-service.api.ledger.com/v1", mode: "prod", @@ -35,48 +35,48 @@ const initialState: KeyringEthContextType = { setCalConfig: () => {}, }; -const KeyringEthContext = createContext(initialState); +const SignerEthContext = createContext(initialState); -export const KeyringEthProvider: React.FC = ({ +export const SignerEthProvider: React.FC = ({ children, }) => { - const sdk = useSdk(); + const dmk = useDmk(); const { state: { selectedId: sessionId }, } = useDeviceSessionsContext(); - const [keyring, setKeyring] = useState(null); + const [signer, setSigner] = useState(null); const [calConfig, setCalConfig] = useState( initialState.calConfig, ); useEffect(() => { - if (!sessionId || !sdk) { - setKeyring(null); + if (!sessionId || !dmk) { + setSigner(null); return; } const contextModule = new ContextModuleBuilder() .withConfig({ cal: calConfig }) .build(); - const newKeyring = new KeyringEthBuilder({ sdk, sessionId }) + const newSigner = new SignerEthBuilder({ dmk, sessionId }) .withContextModule(contextModule) .build(); - setKeyring(newKeyring); - }, [calConfig, sdk, sessionId]); + setSigner(newSigner); + }, [calConfig, dmk, sessionId]); return ( - + {children} - + ); }; -export const useKeyringEth = (): KeyringEth | null => { - return useContext(KeyringEthContext).keyring; +export const useSignerEth = (): SignerEth | null => { + return useContext(SignerEthContext).signer; }; export const useCalConfig = () => { - const { calConfig, setCalConfig } = useContext(KeyringEthContext); + const { calConfig, setCalConfig } = useContext(SignerEthContext); return { calConfig, setCalConfig }; }; diff --git a/apps/sample/src/reducers/sdkConfig.ts b/apps/sample/src/reducers/dmkConfig.ts similarity index 75% rename from apps/sample/src/reducers/sdkConfig.ts rename to apps/sample/src/reducers/dmkConfig.ts index 293e78c2b..fad34525c 100644 --- a/apps/sample/src/reducers/sdkConfig.ts +++ b/apps/sample/src/reducers/dmkConfig.ts @@ -1,7 +1,7 @@ import { type Reducer } from "react"; import { BuiltinTransports } from "@ledgerhq/device-management-kit"; -export type SdkConfigState = { +export type DmkConfigState = { mockServerUrl: string; transport: BuiltinTransports; }; @@ -20,16 +20,16 @@ type SetMockServerUrlAction = { }; }; -export type SdkConfigAction = SetTransportAction | SetMockServerUrlAction; +export type DmkConfigAction = SetTransportAction | SetMockServerUrlAction; -export const SdkConfigInitialState: SdkConfigState = { +export const DmkConfigInitialState: DmkConfigState = { mockServerUrl: "http://127.0.0.1:8080/", transport: - (process.env.SDK_CONFIG_TRANSPORT as BuiltinTransports) || + (process.env.Dmk_CONFIG_TRANSPORT as BuiltinTransports) || BuiltinTransports.USB, }; -export const sdkConfigReducer: Reducer = ( +export const dmkConfigReducer: Reducer = ( state, action, ) => { diff --git a/danger/helpers.ts b/danger/helpers.ts index ab4a308f2..c6e8ee868 100644 --- a/danger/helpers.ts +++ b/danger/helpers.ts @@ -11,7 +11,7 @@ import { execSync } from "child_process"; type FailFn = (message: MarkdownString, file?: string, line?: number) => void; type MessageFn = ( message: MarkdownString, - opts?: { file?: string; line?: number; icon?: MarkdownString } + opts?: { file?: string; line?: number; icon?: MarkdownString }, ) => void; export const BRANCH_PREFIX = [ @@ -44,13 +44,13 @@ export const isFork = (pr: GitHubPRDSL) => pr?.head?.repo?.fork ?? false; const Branch = ( danger: DangerDSLType, fail: FailFn, - isFork: boolean = false + isFork: boolean = false, ) => ({ regex: isFork ? new RegExp(`^(${BRANCH_PREFIX.join("|")})\/.+`, "i") : new RegExp( `^(${BRANCH_PREFIX.join("|")})\/((dsdk)-[0-9]+|no-issue|issue-[0-9]+)\-.+`, - "i" + "i", ), getBranch: () => { @@ -99,7 +99,7 @@ Please fix the PR branch name to match the convention, see [CONTRIBUTING.md](htt export const checkBranches = ( danger: DangerDSLType, fail: FailFn, - fork: boolean = false + fork: boolean = false, ) => { const config = Branch(danger, fail, fork); const currentBranch = config.getBranch(); @@ -115,7 +115,7 @@ export const checkBranches = ( const Commits = ( danger: DangerDSLType, fail: FailFn, - fork: boolean = false + fork: boolean = false, ) => ({ regex: /^.+\(([a-z]+\-?){1,}\): [A-Z].*/, @@ -146,7 +146,7 @@ Example: \`💚 (scope): My feature\`\ const currentBranch = Branch(danger, fail, fork).getBranch(); return execSync( - `git log origin/develop..${currentBranch} --pretty=format:%s` + `git log origin/develop..${currentBranch} --pretty=format:%s`, ) .toString() .split("\n"); @@ -156,14 +156,14 @@ Example: \`💚 (scope): My feature\`\ export const checkCommits = ( danger: DangerDSLType, fail: FailFn, - fork: boolean = false + fork: boolean = false, ) => { const config = Commits(danger, fail, fork); const branchCommits = config.getCommits(); console.log("Branch commits:", branchCommits); const wrongCommits = branchCommits.filter( - (commit) => !config.regex.test(commit) + (commit) => !config.regex.test(commit), ); if (wrongCommits.length > 0) { @@ -225,7 +225,7 @@ Please fix the PR title to match the convention, see [CONTRIBUTING.md](https://g export const checkTitle = ( danger: DangerDSLType, fail: FailFn, - fork: boolean = false + fork: boolean = false, ) => { const config = Title(danger, fail, fork); if (!config.regex.test(danger.github.pr.title)) { @@ -243,7 +243,7 @@ export const checkChangesets = (danger: DangerDSLType, message: MessageFn) => { `\ No changeset file found in the PR. Please add a changeset file.`, { icon: "⚠️", - } + }, ); return false; } diff --git a/package.json b/package.json index 4337b8b6f..115490343 100644 --- a/package.json +++ b/package.json @@ -15,16 +15,16 @@ "test:coverage": "turbo run test:coverage", "typecheck": "turbo run typecheck", "health-check": "turbo run health-check --output-logs=errors-only --continue", - "core": "pnpm --filter @ledgerhq/device-management-kit", + "dmk": "pnpm --filter @ledgerhq/device-management-kit", "context-module": "pnpm --filter @ledgerhq/context-module", - "keyring-btc": "pnpm --filter @ledgerhq/keyring-btc", - "keyring-eth": "pnpm --filter @ledgerhq/device-signer-kit-ethereum", + "signer-btc": "pnpm --filter @ledgerhq/signer-btc", + "signer-eth": "pnpm --filter @ledgerhq/device-signer-kit-ethereum", "signer-solana": "pnpm --filter @ledgerhq/device-signer-kit-solana", - "transport-mock": "pnpm --filter @ledgerhq/device-sdk-transport-mock", + "mock-client": "pnpm --filter @ledgerhq/device-transport-kit-mock-client", "trusted-apps": "pnpm --filter @ledgerhq/device-sdk-trusted-apps", "ui": "pnpm --filter @ledgerhq/device-sdk-ui", "flipper": "pnpm --filter @ledgerhq/device-management-kit-flipper-plugin-client", - "sample": "pnpm --filter @ledgerhq/device-sdk-sample", + "sample": "pnpm --filter @ledgerhq/device-management-kit-sample", "bump": "changeset version", "prerelease": "pnpm recursive exec -- pnpm pack", "release": "changeset publish", diff --git a/packages/core/src/internal/config/use-case/GetSdkVersionUseCase.test.ts b/packages/core/src/internal/config/use-case/GetSdkVersionUseCase.test.ts deleted file mode 100644 index d16f097ac..000000000 --- a/packages/core/src/internal/config/use-case/GetSdkVersionUseCase.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { GetSdkVersionUseCase } from "./GetSdkVersionUseCase"; - -const getSdkConfigMock = jest.fn(); - -let usecase: GetSdkVersionUseCase; -describe("GetSdkVersionUseCase", () => { - beforeEach(() => { - getSdkConfigMock.mockClear(); - const configService = { - getSdkConfig: getSdkConfigMock, - }; - - usecase = new GetSdkVersionUseCase(configService); - }); - - it("should return the sdk version", async () => { - getSdkConfigMock.mockResolvedValue({ - name: "DeviceSDK", - version: "1.0.0", - }); - expect(await usecase.getSdkVersion()).toBe("1.0.0"); - }); -}); diff --git a/packages/core/.prettierignore b/packages/device-management-kit/.prettierignore similarity index 100% rename from packages/core/.prettierignore rename to packages/device-management-kit/.prettierignore diff --git a/packages/core/.prettierrc.js b/packages/device-management-kit/.prettierrc.js similarity index 100% rename from packages/core/.prettierrc.js rename to packages/device-management-kit/.prettierrc.js diff --git a/packages/core/CHANGELOG.md b/packages/device-management-kit/CHANGELOG.md similarity index 100% rename from packages/core/CHANGELOG.md rename to packages/device-management-kit/CHANGELOG.md diff --git a/packages/core/README.md b/packages/device-management-kit/README.md similarity index 100% rename from packages/core/README.md rename to packages/device-management-kit/README.md diff --git a/packages/core/SCRIPTS.MD b/packages/device-management-kit/SCRIPTS.MD similarity index 100% rename from packages/core/SCRIPTS.MD rename to packages/device-management-kit/SCRIPTS.MD diff --git a/packages/core/_templates/core-module/with-prompt/datasource.ejs.t b/packages/device-management-kit/_templates/core-module/with-prompt/datasource.ejs.t similarity index 100% rename from packages/core/_templates/core-module/with-prompt/datasource.ejs.t rename to packages/device-management-kit/_templates/core-module/with-prompt/datasource.ejs.t diff --git a/packages/core/_templates/core-module/with-prompt/default-service.ejs.t b/packages/device-management-kit/_templates/core-module/with-prompt/default-service.ejs.t similarity index 100% rename from packages/core/_templates/core-module/with-prompt/default-service.ejs.t rename to packages/device-management-kit/_templates/core-module/with-prompt/default-service.ejs.t diff --git a/packages/core/_templates/core-module/with-prompt/default-service.test.ejs.t b/packages/device-management-kit/_templates/core-module/with-prompt/default-service.test.ejs.t similarity index 100% rename from packages/core/_templates/core-module/with-prompt/default-service.test.ejs.t rename to packages/device-management-kit/_templates/core-module/with-prompt/default-service.test.ejs.t diff --git a/packages/core/_templates/core-module/with-prompt/di-module.ejs.t b/packages/device-management-kit/_templates/core-module/with-prompt/di-module.ejs.t similarity index 100% rename from packages/core/_templates/core-module/with-prompt/di-module.ejs.t rename to packages/device-management-kit/_templates/core-module/with-prompt/di-module.ejs.t diff --git a/packages/core/_templates/core-module/with-prompt/di-module.test.ejs.t b/packages/device-management-kit/_templates/core-module/with-prompt/di-module.test.ejs.t similarity index 100% rename from packages/core/_templates/core-module/with-prompt/di-module.test.ejs.t rename to packages/device-management-kit/_templates/core-module/with-prompt/di-module.test.ejs.t diff --git a/packages/core/_templates/core-module/with-prompt/di-types.ejs.t b/packages/device-management-kit/_templates/core-module/with-prompt/di-types.ejs.t similarity index 100% rename from packages/core/_templates/core-module/with-prompt/di-types.ejs.t rename to packages/device-management-kit/_templates/core-module/with-prompt/di-types.ejs.t diff --git a/packages/core/_templates/core-module/with-prompt/gitkeep-model.ejs.t b/packages/device-management-kit/_templates/core-module/with-prompt/gitkeep-model.ejs.t similarity index 100% rename from packages/core/_templates/core-module/with-prompt/gitkeep-model.ejs.t rename to packages/device-management-kit/_templates/core-module/with-prompt/gitkeep-model.ejs.t diff --git a/packages/core/_templates/core-module/with-prompt/gitkeep-usecase.ejs.t b/packages/device-management-kit/_templates/core-module/with-prompt/gitkeep-usecase.ejs.t similarity index 100% rename from packages/core/_templates/core-module/with-prompt/gitkeep-usecase.ejs.t rename to packages/device-management-kit/_templates/core-module/with-prompt/gitkeep-usecase.ejs.t diff --git a/packages/core/_templates/core-module/with-prompt/prompt.js b/packages/device-management-kit/_templates/core-module/with-prompt/prompt.js similarity index 100% rename from packages/core/_templates/core-module/with-prompt/prompt.js rename to packages/device-management-kit/_templates/core-module/with-prompt/prompt.js diff --git a/packages/core/_templates/core-module/with-prompt/service.ejs.t b/packages/device-management-kit/_templates/core-module/with-prompt/service.ejs.t similarity index 100% rename from packages/core/_templates/core-module/with-prompt/service.ejs.t rename to packages/device-management-kit/_templates/core-module/with-prompt/service.ejs.t diff --git a/packages/core/doc/DeviceActionStateGraph.md b/packages/device-management-kit/doc/DeviceActionStateGraph.md similarity index 100% rename from packages/core/doc/DeviceActionStateGraph.md rename to packages/device-management-kit/doc/DeviceActionStateGraph.md diff --git a/packages/core/eslint.config.mjs b/packages/device-management-kit/eslint.config.mjs similarity index 100% rename from packages/core/eslint.config.mjs rename to packages/device-management-kit/eslint.config.mjs diff --git a/packages/core/index.ts b/packages/device-management-kit/index.ts similarity index 100% rename from packages/core/index.ts rename to packages/device-management-kit/index.ts diff --git a/packages/core/jest.config.ts b/packages/device-management-kit/jest.config.ts similarity index 100% rename from packages/core/jest.config.ts rename to packages/device-management-kit/jest.config.ts diff --git a/packages/core/jest.setup.ts b/packages/device-management-kit/jest.setup.ts similarity index 100% rename from packages/core/jest.setup.ts rename to packages/device-management-kit/jest.setup.ts diff --git a/packages/core/package.json b/packages/device-management-kit/package.json similarity index 96% rename from packages/core/package.json rename to packages/device-management-kit/package.json index 6df1baf1f..e55809b9f 100644 --- a/packages/core/package.json +++ b/packages/device-management-kit/package.json @@ -36,7 +36,7 @@ "module:create": "pnpm hygen core-module with-prompt" }, "dependencies": { - "@ledgerhq/device-sdk-transport-mock": "workspace:*", + "@ledgerhq/device-transport-kit-mock-client": "workspace:*", "@sentry/minimal": "^6.19.7", "@statelyai/inspect": "^0.4.0", "axios": "^1.7.7", diff --git a/packages/core/scripts/add-module.mjs b/packages/device-management-kit/scripts/add-module.mjs similarity index 100% rename from packages/core/scripts/add-module.mjs rename to packages/device-management-kit/scripts/add-module.mjs diff --git a/packages/core/src/api/DeviceSdk.test.ts b/packages/device-management-kit/src/api/DeviceManagementKit.test.ts similarity index 73% rename from packages/core/src/api/DeviceSdk.test.ts rename to packages/device-management-kit/src/api/DeviceManagementKit.test.ts index 21c79b8a2..20600a78a 100644 --- a/packages/core/src/api/DeviceSdk.test.ts +++ b/packages/device-management-kit/src/api/DeviceManagementKit.test.ts @@ -11,17 +11,17 @@ import { StubUseCase } from "@root/src/di.stub"; import { commandTypes } from "./command/di/commandTypes"; import { ConsoleLogger } from "./logger-subscriber/service/ConsoleLogger"; -import { DeviceSdk } from "./DeviceSdk"; +import { DeviceManagementKit } from "./DeviceManagementKit"; jest.mock("./logger-subscriber/service/ConsoleLogger"); -let sdk: DeviceSdk; +let dmk: DeviceManagementKit; let logger: ConsoleLogger; -describe("DeviceSdk", () => { +describe("DeviceManagementKit", () => { describe("clean", () => { beforeEach(() => { logger = new ConsoleLogger(); - sdk = new DeviceSdk({ + dmk = new DeviceManagementKit({ stub: false, loggers: [logger], config: { @@ -32,46 +32,46 @@ describe("DeviceSdk", () => { }); it("should create an instance", () => { - expect(sdk).toBeDefined(); - expect(sdk).toBeInstanceOf(DeviceSdk); + expect(dmk).toBeDefined(); + expect(dmk).toBeInstanceOf(DeviceManagementKit); }); it("should return a clean `version`", async () => { - expect(await sdk.getVersion()).toBe(pkg.version); + expect(await dmk.getVersion()).toBe(pkg.version); }); it("should have startDiscovery method", () => { - expect(sdk.startDiscovering).toBeDefined(); + expect(dmk.startDiscovering).toBeDefined(); }); it("should have stopDiscovery method", () => { - expect(sdk.stopDiscovering).toBeDefined(); + expect(dmk.stopDiscovering).toBeDefined(); }); it("should have connect method", () => { - expect(sdk.connect).toBeDefined(); + expect(dmk.connect).toBeDefined(); }); it("should have sendApdu method", () => { - expect(sdk.sendApdu).toBeDefined(); + expect(dmk.sendApdu).toBeDefined(); }); it("should have getConnectedDevice method", () => { - expect(sdk.getConnectedDevice).toBeDefined(); + expect(dmk.getConnectedDevice).toBeDefined(); }); it("should have sendCommand method", () => { - expect(sdk.sendCommand).toBeDefined(); + expect(dmk.sendCommand).toBeDefined(); }); it("should have listDeviceSessions method", () => { - expect(sdk.listDeviceSessions).toBeDefined(); + expect(dmk.listDeviceSessions).toBeDefined(); }); }); describe("stubbed", () => { beforeEach(() => { - sdk = new DeviceSdk({ + dmk = new DeviceManagementKit({ stub: true, loggers: [], config: { @@ -81,21 +81,21 @@ describe("DeviceSdk", () => { }); }); - it("should create a stubbed sdk", () => { - expect(sdk).toBeDefined(); - expect(sdk).toBeInstanceOf(DeviceSdk); + it("should create a stubbed dmk", () => { + expect(dmk).toBeDefined(); + expect(dmk).toBeInstanceOf(DeviceManagementKit); }); it("should return a stubbed config", () => { expect( - sdk.container.get( + dmk.container.get( configTypes.LocalConfigDataSource, ), ).toBeInstanceOf(StubLocalConfigDataSource); }); it("should return a stubbed version", async () => { - expect(await sdk.getVersion()).toBe("0.0.0-stub.1"); + expect(await dmk.getVersion()).toBe("0.0.0-stub.1"); }); it.each([ @@ -111,7 +111,7 @@ describe("DeviceSdk", () => { ])( "should have %p use case", (diSymbol: interfaces.ServiceIdentifier) => { - const uc = sdk.container.get(diSymbol); + const uc = dmk.container.get(diSymbol); expect(uc).toBeInstanceOf(StubUseCase); expect(uc.execute()).toBe("stub"); }, diff --git a/packages/core/src/api/DeviceSdk.ts b/packages/device-management-kit/src/api/DeviceManagementKit.ts similarity index 93% rename from packages/core/src/api/DeviceSdk.ts rename to packages/device-management-kit/src/api/DeviceManagementKit.ts index 11823b7a6..5499d6152 100644 --- a/packages/core/src/api/DeviceSdk.ts +++ b/packages/device-management-kit/src/api/DeviceManagementKit.ts @@ -24,7 +24,7 @@ import { type StartDiscoveringUseCaseArgs, } from "@api/types"; import { configTypes } from "@internal/config/di/configTypes"; -import { type GetSdkVersionUseCase } from "@internal/config/use-case/GetSdkVersionUseCase"; +import { type GetDmkVersionUseCase } from "@internal/config/use-case/GetDmkVersionUseCase"; import { deviceSessionTypes } from "@internal/device-session/di/deviceSessionTypes"; import { type DeviceSession } from "@internal/device-session/model/DeviceSession"; import { type CloseSessionsUseCase } from "@internal/device-session/use-case/CloseSessionsUseCase"; @@ -46,14 +46,14 @@ import { type ExecuteDeviceActionReturnType, } from "./device-action/DeviceAction"; import { deviceActionTypes } from "./device-action/di/deviceActionTypes"; -import { type SdkError } from "./Error"; +import { type DmkError } from "./Error"; /** - * The main class to interact with the SDK. + * The main class to interact with the Device Management Kit. * - * NB: do not instantiate this class directly, instead, use `DeviceSdkBuilder`. + * NB: do not instantiate this class directly, instead, use `LedgerDMKBuilder`. */ -export class DeviceSdk { +export class DeviceManagementKit { readonly container: Container; /** @internal */ constructor({ @@ -80,8 +80,8 @@ export class DeviceSdk { */ getVersion(): Promise { return this.container - .get(configTypes.GetSdkVersionUseCase) - .getSdkVersion(); + .get(configTypes.GetDmkVersionUseCase) + .getDmkVersion(); } /** @@ -124,11 +124,11 @@ export class DeviceSdk { } /** - * Connects to a device previously discovered with `DeviceSdk.startDiscovering`. + * Connects to a device previously discovered with `DeviceManagementKit.startDiscovering`. * Creates a new device session which: * - Represents the connection to the device. * - Is terminated upon disconnection of the device. - * - Exposes the device state through an observable (see `DeviceSdk.getDeviceSessionState`) + * - Exposes the device state through an observable (see `DeviceManagementKit.getDeviceSessionState`) * - Should be used for all subsequent communication with the device. * * @param {ConnectUseCaseArgs} args - The device ID (obtained in discovery) to connect to. @@ -179,7 +179,7 @@ export class DeviceSdk { executeDeviceAction< Output, Input, - Error extends SdkError, + Error extends DmkError, IntermediateValue extends DeviceActionIntermediateValue, >( args: ExecuteDeviceActionUseCaseArgs< diff --git a/packages/core/src/api/DeviceSdkBuilder.test.ts b/packages/device-management-kit/src/api/DeviceManagementKitBuilder.test.ts similarity index 56% rename from packages/core/src/api/DeviceSdkBuilder.test.ts rename to packages/device-management-kit/src/api/DeviceManagementKitBuilder.test.ts index c2c19b779..be76d5864 100644 --- a/packages/core/src/api/DeviceSdkBuilder.test.ts +++ b/packages/device-management-kit/src/api/DeviceManagementKitBuilder.test.ts @@ -1,20 +1,20 @@ import { ConsoleLogger } from "./logger-subscriber/service/ConsoleLogger"; -import { DeviceSdk } from "./DeviceSdk"; -import { LedgerDeviceSdkBuilder } from "./DeviceSdkBuilder"; +import { DeviceManagementKit } from "./DeviceManagementKit"; +import { DeviceManagementKitBuilder } from "./DeviceManagementKitBuilder"; jest.mock("./logger-subscriber/service/ConsoleLogger"); -let builder: LedgerDeviceSdkBuilder; +let builder: DeviceManagementKitBuilder; let logger: ConsoleLogger; -describe("LedgerDeviceSdkBuilder", () => { +describe("LedgerDeviceManagementKitBuilder", () => { beforeEach(() => { - builder = new LedgerDeviceSdkBuilder(); + builder = new DeviceManagementKitBuilder(); }); - it("should build a DeviceSdk instance", () => { - const sdk: DeviceSdk = builder.build(); - expect(sdk).toBeInstanceOf(DeviceSdk); + it("should build a DeviceManagementKit instance", () => { + const dmk: DeviceManagementKit = builder.build(); + expect(dmk).toBeInstanceOf(DeviceManagementKit); }); it("should set the stub flag", () => { diff --git a/packages/core/src/api/DeviceSdkBuilder.ts b/packages/device-management-kit/src/api/DeviceManagementKitBuilder.ts similarity index 66% rename from packages/core/src/api/DeviceSdkBuilder.ts rename to packages/device-management-kit/src/api/DeviceManagementKitBuilder.ts index f28eeaf80..e8c49120a 100644 --- a/packages/core/src/api/DeviceSdkBuilder.ts +++ b/packages/device-management-kit/src/api/DeviceManagementKitBuilder.ts @@ -6,15 +6,15 @@ import { import { type LoggerSubscriberService } from "./logger-subscriber/service/LoggerSubscriberService"; import { type Transport } from "./transport/model/Transport"; import { type BuiltinTransports } from "./transport/model/TransportIdentifier"; -import { DeviceSdk } from "./DeviceSdk"; -import { type SdkConfig } from "./SdkConfig"; +import { DeviceManagementKit } from "./DeviceManagementKit"; +import { type DmkConfig } from "./DmkConfig"; /** - * Builder for the `DeviceSdk` class. + * Builder for the `DeviceManagementKit` class. * * @example * ``` - * const sdk = new LedgerDeviceSdkBuilder() + * const dmk = new LedgerDeviceManagementKitBuilder() * .setStub(false) * .addTransport(BuiltinTransports.USB) * .addCustomTransport(new MyTransport()) @@ -22,18 +22,18 @@ import { type SdkConfig } from "./SdkConfig"; * .build(); * ``` */ -export class LedgerDeviceSdkBuilder { +export class DeviceManagementKitBuilder { private stub = false; private readonly loggers: LoggerSubscriberService[] = []; private readonly transports: BuiltinTransports[] = []; private readonly customTransports: Transport[] = []; - private config: SdkConfig = { + private config: DmkConfig = { managerApiUrl: DEFAULT_MANAGER_API_BASE_URL, mockUrl: DEFAULT_MOCK_SERVER_BASE_URL, }; - build(): DeviceSdk { - return new DeviceSdk({ + build(): DeviceManagementKit { + return new DeviceManagementKit({ stub: this.stub, transports: this.transports, customTransports: this.customTransports, @@ -42,17 +42,17 @@ export class LedgerDeviceSdkBuilder { }); } - setStub(stubbed: boolean): LedgerDeviceSdkBuilder { + setStub(stubbed: boolean): DeviceManagementKitBuilder { this.stub = stubbed; return this; } - addTransport(transport: BuiltinTransports): LedgerDeviceSdkBuilder { + addTransport(transport: BuiltinTransports): DeviceManagementKitBuilder { this.transports.push(transport); return this; } - addCustomTransport(transport: Transport): LedgerDeviceSdkBuilder { + addCustomTransport(transport: Transport): DeviceManagementKitBuilder { this.customTransports.push(transport); return this; } @@ -60,12 +60,12 @@ export class LedgerDeviceSdkBuilder { /** * Add a logger to the SDK that will receive its logs */ - addLogger(logger: LoggerSubscriberService): LedgerDeviceSdkBuilder { + addLogger(logger: LoggerSubscriberService): DeviceManagementKitBuilder { this.loggers.push(logger); return this; } - addConfig(config: Partial): LedgerDeviceSdkBuilder { + addConfig(config: Partial): DeviceManagementKitBuilder { this.config = { ...this.config, ...config, diff --git a/packages/core/src/api/SdkConfig.ts b/packages/device-management-kit/src/api/DmkConfig.ts similarity index 64% rename from packages/core/src/api/SdkConfig.ts rename to packages/device-management-kit/src/api/DmkConfig.ts index 05982d26f..40b51a50d 100644 --- a/packages/core/src/api/SdkConfig.ts +++ b/packages/device-management-kit/src/api/DmkConfig.ts @@ -1,4 +1,4 @@ -export type SdkConfig = { +export type DmkConfig = { mockUrl: string; managerApiUrl: string; }; diff --git a/packages/core/src/api/Error.ts b/packages/device-management-kit/src/api/Error.ts similarity index 92% rename from packages/core/src/api/Error.ts rename to packages/device-management-kit/src/api/Error.ts index 76057c217..80ad274d1 100644 --- a/packages/core/src/api/Error.ts +++ b/packages/device-management-kit/src/api/Error.ts @@ -1,4 +1,4 @@ -export interface SdkError { +export interface DmkError { readonly _tag: string; readonly originalError?: unknown; message?: string; @@ -35,7 +35,7 @@ export abstract class DeviceExchangeError { } } -export class UnknownDeviceExchangeError implements SdkError { +export class UnknownDeviceExchangeError implements DmkError { readonly _tag = "UnknownDeviceExchangeError"; readonly originalError?: unknown; readonly message: string; diff --git a/packages/core/src/api/apdu/model/Apdu.test.ts b/packages/device-management-kit/src/api/apdu/model/Apdu.test.ts similarity index 100% rename from packages/core/src/api/apdu/model/Apdu.test.ts rename to packages/device-management-kit/src/api/apdu/model/Apdu.test.ts diff --git a/packages/core/src/api/apdu/model/Apdu.ts b/packages/device-management-kit/src/api/apdu/model/Apdu.ts similarity index 100% rename from packages/core/src/api/apdu/model/Apdu.ts rename to packages/device-management-kit/src/api/apdu/model/Apdu.ts diff --git a/packages/core/src/api/apdu/utils/ApduBuilder.test.ts b/packages/device-management-kit/src/api/apdu/utils/ApduBuilder.test.ts similarity index 100% rename from packages/core/src/api/apdu/utils/ApduBuilder.test.ts rename to packages/device-management-kit/src/api/apdu/utils/ApduBuilder.test.ts diff --git a/packages/core/src/api/apdu/utils/ApduBuilder.ts b/packages/device-management-kit/src/api/apdu/utils/ApduBuilder.ts similarity index 100% rename from packages/core/src/api/apdu/utils/ApduBuilder.ts rename to packages/device-management-kit/src/api/apdu/utils/ApduBuilder.ts diff --git a/packages/core/src/api/apdu/utils/ApduParser.test.ts b/packages/device-management-kit/src/api/apdu/utils/ApduParser.test.ts similarity index 100% rename from packages/core/src/api/apdu/utils/ApduParser.test.ts rename to packages/device-management-kit/src/api/apdu/utils/ApduParser.test.ts diff --git a/packages/core/src/api/apdu/utils/ApduParser.ts b/packages/device-management-kit/src/api/apdu/utils/ApduParser.ts similarity index 100% rename from packages/core/src/api/apdu/utils/ApduParser.ts rename to packages/device-management-kit/src/api/apdu/utils/ApduParser.ts diff --git a/packages/core/src/api/apdu/utils/AppBuilderError.ts b/packages/device-management-kit/src/api/apdu/utils/AppBuilderError.ts similarity index 78% rename from packages/core/src/api/apdu/utils/AppBuilderError.ts rename to packages/device-management-kit/src/api/apdu/utils/AppBuilderError.ts index 7a46a2730..64e2c0bbe 100644 --- a/packages/core/src/api/apdu/utils/AppBuilderError.ts +++ b/packages/device-management-kit/src/api/apdu/utils/AppBuilderError.ts @@ -1,12 +1,12 @@ -import { type SdkError } from "@api/Error"; +import { type DmkError } from "@api/Error"; import { APDU_MAX_PAYLOAD } from "./ApduBuilder"; -interface SdkAppBuilderError extends SdkError { +interface DmkAppBuilderError extends DmkError { readonly message: string; } -export class ValueOverflowError implements SdkAppBuilderError { +export class ValueOverflowError implements DmkAppBuilderError { readonly _tag = "ValueOverflow"; readonly originalError?: Error; readonly message: string; @@ -15,7 +15,7 @@ export class ValueOverflowError implements SdkAppBuilderError { } } -export class DataOverflowError implements SdkAppBuilderError { +export class DataOverflowError implements DmkAppBuilderError { readonly _tag = "DataOverflow"; readonly message: string; readonly originalError?: Error; @@ -27,7 +27,7 @@ export class DataOverflowError implements SdkAppBuilderError { } } -export class HexaStringEncodeError implements SdkAppBuilderError { +export class HexaStringEncodeError implements DmkAppBuilderError { readonly _tag = "HexaString"; readonly message: string; readonly originalError?: Error; diff --git a/packages/core/src/api/apdu/utils/ByteArrayBuilder.test.ts b/packages/device-management-kit/src/api/apdu/utils/ByteArrayBuilder.test.ts similarity index 100% rename from packages/core/src/api/apdu/utils/ByteArrayBuilder.test.ts rename to packages/device-management-kit/src/api/apdu/utils/ByteArrayBuilder.test.ts diff --git a/packages/core/src/api/apdu/utils/ByteArrayBuilder.ts b/packages/device-management-kit/src/api/apdu/utils/ByteArrayBuilder.ts similarity index 100% rename from packages/core/src/api/apdu/utils/ByteArrayBuilder.ts rename to packages/device-management-kit/src/api/apdu/utils/ByteArrayBuilder.ts diff --git a/packages/core/src/api/apdu/utils/ByteArrayParser.test.ts b/packages/device-management-kit/src/api/apdu/utils/ByteArrayParser.test.ts similarity index 100% rename from packages/core/src/api/apdu/utils/ByteArrayParser.test.ts rename to packages/device-management-kit/src/api/apdu/utils/ByteArrayParser.test.ts diff --git a/packages/core/src/api/apdu/utils/ByteArrayParser.ts b/packages/device-management-kit/src/api/apdu/utils/ByteArrayParser.ts similarity index 100% rename from packages/core/src/api/apdu/utils/ByteArrayParser.ts rename to packages/device-management-kit/src/api/apdu/utils/ByteArrayParser.ts diff --git a/packages/core/src/api/command/Command.ts b/packages/device-management-kit/src/api/command/Command.ts similarity index 100% rename from packages/core/src/api/command/Command.ts rename to packages/device-management-kit/src/api/command/Command.ts diff --git a/packages/core/src/api/command/Errors.ts b/packages/device-management-kit/src/api/command/Errors.ts similarity index 73% rename from packages/core/src/api/command/Errors.ts rename to packages/device-management-kit/src/api/command/Errors.ts index 055a0dd5b..7faa161a1 100644 --- a/packages/core/src/api/command/Errors.ts +++ b/packages/device-management-kit/src/api/command/Errors.ts @@ -1,6 +1,6 @@ -import { type SdkError } from "@api/Error"; +import { type DmkError } from "@api/Error"; -export class InvalidStatusWordError implements SdkError { +export class InvalidStatusWordError implements DmkError { readonly _tag = "InvalidStatusWordError"; readonly originalError?: Error; @@ -9,7 +9,7 @@ export class InvalidStatusWordError implements SdkError { } } -export class InvalidBatteryStatusTypeError implements SdkError { +export class InvalidBatteryStatusTypeError implements DmkError { readonly _tag = "InvalidBatteryStatusTypeError"; readonly originalError: Error; @@ -18,7 +18,7 @@ export class InvalidBatteryStatusTypeError implements SdkError { } } -export class InvalidBatteryDataError implements SdkError { +export class InvalidBatteryDataError implements DmkError { readonly _tag = "InvalidBatteryDataError"; readonly originalError: Error; @@ -27,7 +27,7 @@ export class InvalidBatteryDataError implements SdkError { } } -export class InvalidBatteryFlagsError implements SdkError { +export class InvalidBatteryFlagsError implements DmkError { readonly _tag = "InvalidBatteryFlagsError"; readonly originalError: Error; @@ -36,7 +36,7 @@ export class InvalidBatteryFlagsError implements SdkError { } } -export class InvalidResponseFormatError implements SdkError { +export class InvalidResponseFormatError implements DmkError { readonly _tag = "InvalidResponseFormatError"; readonly originalError: Error; diff --git a/packages/core/src/api/command/di/commandModule.test.ts b/packages/device-management-kit/src/api/command/di/commandModule.test.ts similarity index 100% rename from packages/core/src/api/command/di/commandModule.test.ts rename to packages/device-management-kit/src/api/command/di/commandModule.test.ts diff --git a/packages/core/src/api/command/di/commandModule.ts b/packages/device-management-kit/src/api/command/di/commandModule.ts similarity index 100% rename from packages/core/src/api/command/di/commandModule.ts rename to packages/device-management-kit/src/api/command/di/commandModule.ts diff --git a/packages/core/src/api/command/di/commandTypes.ts b/packages/device-management-kit/src/api/command/di/commandTypes.ts similarity index 100% rename from packages/core/src/api/command/di/commandTypes.ts rename to packages/device-management-kit/src/api/command/di/commandTypes.ts diff --git a/packages/core/src/api/command/model/CommandResult.test.ts b/packages/device-management-kit/src/api/command/model/CommandResult.test.ts similarity index 100% rename from packages/core/src/api/command/model/CommandResult.test.ts rename to packages/device-management-kit/src/api/command/model/CommandResult.test.ts diff --git a/packages/core/src/api/command/model/CommandResult.ts b/packages/device-management-kit/src/api/command/model/CommandResult.ts similarity index 100% rename from packages/core/src/api/command/model/CommandResult.ts rename to packages/device-management-kit/src/api/command/model/CommandResult.ts diff --git a/packages/core/src/api/command/os/CloseAppCommand.test.ts b/packages/device-management-kit/src/api/command/os/CloseAppCommand.test.ts similarity index 100% rename from packages/core/src/api/command/os/CloseAppCommand.test.ts rename to packages/device-management-kit/src/api/command/os/CloseAppCommand.test.ts diff --git a/packages/core/src/api/command/os/CloseAppCommand.ts b/packages/device-management-kit/src/api/command/os/CloseAppCommand.ts similarity index 100% rename from packages/core/src/api/command/os/CloseAppCommand.ts rename to packages/device-management-kit/src/api/command/os/CloseAppCommand.ts diff --git a/packages/core/src/api/command/os/GetAppAndVersionCommand.test.ts b/packages/device-management-kit/src/api/command/os/GetAppAndVersionCommand.test.ts similarity index 100% rename from packages/core/src/api/command/os/GetAppAndVersionCommand.test.ts rename to packages/device-management-kit/src/api/command/os/GetAppAndVersionCommand.test.ts diff --git a/packages/core/src/api/command/os/GetAppAndVersionCommand.ts b/packages/device-management-kit/src/api/command/os/GetAppAndVersionCommand.ts similarity index 100% rename from packages/core/src/api/command/os/GetAppAndVersionCommand.ts rename to packages/device-management-kit/src/api/command/os/GetAppAndVersionCommand.ts diff --git a/packages/core/src/api/command/os/GetBatteryStatusCommand.test.ts b/packages/device-management-kit/src/api/command/os/GetBatteryStatusCommand.test.ts similarity index 100% rename from packages/core/src/api/command/os/GetBatteryStatusCommand.test.ts rename to packages/device-management-kit/src/api/command/os/GetBatteryStatusCommand.test.ts diff --git a/packages/core/src/api/command/os/GetBatteryStatusCommand.ts b/packages/device-management-kit/src/api/command/os/GetBatteryStatusCommand.ts similarity index 100% rename from packages/core/src/api/command/os/GetBatteryStatusCommand.ts rename to packages/device-management-kit/src/api/command/os/GetBatteryStatusCommand.ts diff --git a/packages/core/src/api/command/os/GetOsVersionCommand.test.ts b/packages/device-management-kit/src/api/command/os/GetOsVersionCommand.test.ts similarity index 100% rename from packages/core/src/api/command/os/GetOsVersionCommand.test.ts rename to packages/device-management-kit/src/api/command/os/GetOsVersionCommand.test.ts diff --git a/packages/core/src/api/command/os/GetOsVersionCommand.ts b/packages/device-management-kit/src/api/command/os/GetOsVersionCommand.ts similarity index 100% rename from packages/core/src/api/command/os/GetOsVersionCommand.ts rename to packages/device-management-kit/src/api/command/os/GetOsVersionCommand.ts diff --git a/packages/core/src/api/command/os/ListAppsCommand.test.ts b/packages/device-management-kit/src/api/command/os/ListAppsCommand.test.ts similarity index 100% rename from packages/core/src/api/command/os/ListAppsCommand.test.ts rename to packages/device-management-kit/src/api/command/os/ListAppsCommand.test.ts diff --git a/packages/core/src/api/command/os/ListAppsCommand.ts b/packages/device-management-kit/src/api/command/os/ListAppsCommand.ts similarity index 100% rename from packages/core/src/api/command/os/ListAppsCommand.ts rename to packages/device-management-kit/src/api/command/os/ListAppsCommand.ts diff --git a/packages/core/src/api/command/os/OpenAppCommand.test.ts b/packages/device-management-kit/src/api/command/os/OpenAppCommand.test.ts similarity index 100% rename from packages/core/src/api/command/os/OpenAppCommand.test.ts rename to packages/device-management-kit/src/api/command/os/OpenAppCommand.test.ts diff --git a/packages/core/src/api/command/os/OpenAppCommand.ts b/packages/device-management-kit/src/api/command/os/OpenAppCommand.ts similarity index 100% rename from packages/core/src/api/command/os/OpenAppCommand.ts rename to packages/device-management-kit/src/api/command/os/OpenAppCommand.ts diff --git a/packages/core/src/api/command/use-case/SendCommandUseCase.test.ts b/packages/device-management-kit/src/api/command/use-case/SendCommandUseCase.test.ts similarity index 100% rename from packages/core/src/api/command/use-case/SendCommandUseCase.test.ts rename to packages/device-management-kit/src/api/command/use-case/SendCommandUseCase.test.ts diff --git a/packages/core/src/api/command/use-case/SendCommandUseCase.ts b/packages/device-management-kit/src/api/command/use-case/SendCommandUseCase.ts similarity index 100% rename from packages/core/src/api/command/use-case/SendCommandUseCase.ts rename to packages/device-management-kit/src/api/command/use-case/SendCommandUseCase.ts diff --git a/packages/core/src/api/command/utils/CommandErrors.ts b/packages/device-management-kit/src/api/command/utils/CommandErrors.ts similarity index 100% rename from packages/core/src/api/command/utils/CommandErrors.ts rename to packages/device-management-kit/src/api/command/utils/CommandErrors.ts diff --git a/packages/core/src/api/command/utils/CommandUtils.test.ts b/packages/device-management-kit/src/api/command/utils/CommandUtils.test.ts similarity index 100% rename from packages/core/src/api/command/utils/CommandUtils.test.ts rename to packages/device-management-kit/src/api/command/utils/CommandUtils.test.ts diff --git a/packages/core/src/api/command/utils/CommandUtils.ts b/packages/device-management-kit/src/api/command/utils/CommandUtils.ts similarity index 100% rename from packages/core/src/api/command/utils/CommandUtils.ts rename to packages/device-management-kit/src/api/command/utils/CommandUtils.ts diff --git a/packages/core/src/api/command/utils/GlobalCommandError.test.ts b/packages/device-management-kit/src/api/command/utils/GlobalCommandError.test.ts similarity index 100% rename from packages/core/src/api/command/utils/GlobalCommandError.test.ts rename to packages/device-management-kit/src/api/command/utils/GlobalCommandError.test.ts diff --git a/packages/core/src/api/command/utils/GlobalCommandError.ts b/packages/device-management-kit/src/api/command/utils/GlobalCommandError.ts similarity index 97% rename from packages/core/src/api/command/utils/GlobalCommandError.ts rename to packages/device-management-kit/src/api/command/utils/GlobalCommandError.ts index f54eefc25..8f9589923 100644 --- a/packages/core/src/api/command/utils/GlobalCommandError.ts +++ b/packages/device-management-kit/src/api/command/utils/GlobalCommandError.ts @@ -37,7 +37,7 @@ export const GLOBAL_ERRORS: CommandErrors = { */ export class GlobalCommandErrorHandler { /** - * Static method to get a handled GlobalCommandError or an unhandled SdkError from an apdu response + * Static method to get a handled GlobalCommandError or an unhandled DmkError from an apdu response * @param apduResponse */ static handle( diff --git a/packages/core/src/api/device-action/DeviceAction.ts b/packages/device-management-kit/src/api/device-action/DeviceAction.ts similarity index 95% rename from packages/core/src/api/device-action/DeviceAction.ts rename to packages/device-management-kit/src/api/device-action/DeviceAction.ts index 1c765956a..32d5a22ca 100644 --- a/packages/core/src/api/device-action/DeviceAction.ts +++ b/packages/device-management-kit/src/api/device-action/DeviceAction.ts @@ -3,7 +3,7 @@ import { type Observable } from "rxjs"; import { type Command } from "@api/command/Command"; import { type CommandResult } from "@api/command/model/CommandResult"; import { type DeviceSessionState } from "@api/device-session/DeviceSessionState"; -import { type SdkError } from "@api/Error"; +import { type DmkError } from "@api/Error"; import { type ManagerApiService } from "@internal/manager-api/service/ManagerApiService"; import { type DeviceActionState } from "./model/DeviceActionState"; @@ -34,7 +34,7 @@ export type ExecuteDeviceActionReturnType = { export interface DeviceAction< Output, Input, - Error extends SdkError, + Error extends DmkError, IntermediateValue extends DeviceActionIntermediateValue, > { readonly input: Input; diff --git a/packages/core/src/api/device-action/__test-utils__/data.ts b/packages/device-management-kit/src/api/device-action/__test-utils__/data.ts similarity index 100% rename from packages/core/src/api/device-action/__test-utils__/data.ts rename to packages/device-management-kit/src/api/device-action/__test-utils__/data.ts diff --git a/packages/core/src/api/device-action/__test-utils__/makeInternalApi.ts b/packages/device-management-kit/src/api/device-action/__test-utils__/makeInternalApi.ts similarity index 100% rename from packages/core/src/api/device-action/__test-utils__/makeInternalApi.ts rename to packages/device-management-kit/src/api/device-action/__test-utils__/makeInternalApi.ts diff --git a/packages/core/src/api/device-action/__test-utils__/setupTestMachine.ts b/packages/device-management-kit/src/api/device-action/__test-utils__/setupTestMachine.ts similarity index 96% rename from packages/core/src/api/device-action/__test-utils__/setupTestMachine.ts rename to packages/device-management-kit/src/api/device-action/__test-utils__/setupTestMachine.ts index 26e0ad37f..0c69439be 100644 --- a/packages/core/src/api/device-action/__test-utils__/setupTestMachine.ts +++ b/packages/device-management-kit/src/api/device-action/__test-utils__/setupTestMachine.ts @@ -6,7 +6,7 @@ import { UnknownDAError } from "@api/device-action/os/Errors"; import { GetDeviceStatusDeviceAction } from "@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"; import { GoToDashboardDeviceAction } from "@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction"; import { ListAppsDeviceAction } from "@api/device-action/os/ListApps/ListAppsDeviceAction"; -import { type SdkError } from "@api/Error"; +import { type DmkError } from "@api/Error"; import { type BTC_APP } from "./data"; @@ -76,7 +76,7 @@ export const setupGoToDashboardMock = (error: boolean = false) => { export const setupGetDeviceStatusMock = ( outputs: ReadonlyArray< - { currentApp: string; currentAppVersion: string } | SdkError + { currentApp: string; currentAppVersion: string } | DmkError > = [ { currentApp: "BOLOS", diff --git a/packages/core/src/api/device-action/__test-utils__/testDeviceActionStates.ts b/packages/device-management-kit/src/api/device-action/__test-utils__/testDeviceActionStates.ts similarity index 94% rename from packages/core/src/api/device-action/__test-utils__/testDeviceActionStates.ts rename to packages/device-management-kit/src/api/device-action/__test-utils__/testDeviceActionStates.ts index a4ee18fab..dad6bedd9 100644 --- a/packages/core/src/api/device-action/__test-utils__/testDeviceActionStates.ts +++ b/packages/device-management-kit/src/api/device-action/__test-utils__/testDeviceActionStates.ts @@ -4,7 +4,7 @@ import { type InternalApi, } from "@api/device-action/DeviceAction"; import { type DeviceActionState } from "@api/device-action/model/DeviceActionState"; -import { type SdkError } from "@api/Error"; +import { type DmkError } from "@api/Error"; /** * Test that the states emitted by a device action match the expected states. @@ -16,7 +16,7 @@ import { type SdkError } from "@api/Error"; export function testDeviceActionStates< Output, Input, - Error extends SdkError, + Error extends DmkError, IntermediateValue extends DeviceActionIntermediateValue, >( deviceAction: DeviceAction, diff --git a/packages/core/src/api/device-action/di/deviceActionModule.test.ts b/packages/device-management-kit/src/api/device-action/di/deviceActionModule.test.ts similarity index 100% rename from packages/core/src/api/device-action/di/deviceActionModule.test.ts rename to packages/device-management-kit/src/api/device-action/di/deviceActionModule.test.ts diff --git a/packages/core/src/api/device-action/di/deviceActionModule.ts b/packages/device-management-kit/src/api/device-action/di/deviceActionModule.ts similarity index 100% rename from packages/core/src/api/device-action/di/deviceActionModule.ts rename to packages/device-management-kit/src/api/device-action/di/deviceActionModule.ts diff --git a/packages/core/src/api/device-action/di/deviceActionTypes.ts b/packages/device-management-kit/src/api/device-action/di/deviceActionTypes.ts similarity index 100% rename from packages/core/src/api/device-action/di/deviceActionTypes.ts rename to packages/device-management-kit/src/api/device-action/di/deviceActionTypes.ts diff --git a/packages/core/src/api/device-action/model/DeviceActionState.ts b/packages/device-management-kit/src/api/device-action/model/DeviceActionState.ts similarity index 100% rename from packages/core/src/api/device-action/model/DeviceActionState.ts rename to packages/device-management-kit/src/api/device-action/model/DeviceActionState.ts diff --git a/packages/core/src/api/device-action/model/UserInteractionRequired.ts b/packages/device-management-kit/src/api/device-action/model/UserInteractionRequired.ts similarity index 100% rename from packages/core/src/api/device-action/model/UserInteractionRequired.ts rename to packages/device-management-kit/src/api/device-action/model/UserInteractionRequired.ts diff --git a/packages/core/src/api/device-action/os/Const.ts b/packages/device-management-kit/src/api/device-action/os/Const.ts similarity index 100% rename from packages/core/src/api/device-action/os/Const.ts rename to packages/device-management-kit/src/api/device-action/os/Const.ts diff --git a/packages/core/src/api/device-action/os/Errors.ts b/packages/device-management-kit/src/api/device-action/os/Errors.ts similarity index 72% rename from packages/core/src/api/device-action/os/Errors.ts rename to packages/device-management-kit/src/api/device-action/os/Errors.ts index 681df18b3..71a178c6f 100644 --- a/packages/core/src/api/device-action/os/Errors.ts +++ b/packages/device-management-kit/src/api/device-action/os/Errors.ts @@ -1,6 +1,6 @@ -import { type SdkError } from "@api/Error"; +import { type DmkError } from "@api/Error"; -export class DeviceNotOnboardedError implements SdkError { +export class DeviceNotOnboardedError implements DmkError { readonly _tag = "DeviceNotOnboardedError"; readonly originalError?: Error; @@ -9,7 +9,7 @@ export class DeviceNotOnboardedError implements SdkError { } } -export class DeviceLockedError implements SdkError { +export class DeviceLockedError implements DmkError { readonly _tag = "DeviceLockedError"; readonly originalError?: Error; @@ -18,7 +18,7 @@ export class DeviceLockedError implements SdkError { } } -export class UnknownDAError implements SdkError { +export class UnknownDAError implements DmkError { readonly _tag = "UnknownDAError"; readonly originalError?: Error; diff --git a/packages/core/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.ts b/packages/device-management-kit/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.ts similarity index 100% rename from packages/core/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.ts rename to packages/device-management-kit/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.ts diff --git a/packages/core/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.ts b/packages/device-management-kit/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.ts similarity index 100% rename from packages/core/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.ts rename to packages/device-management-kit/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.ts diff --git a/packages/core/src/api/device-action/os/GetDeviceStatus/types.ts b/packages/device-management-kit/src/api/device-action/os/GetDeviceStatus/types.ts similarity index 100% rename from packages/core/src/api/device-action/os/GetDeviceStatus/types.ts rename to packages/device-management-kit/src/api/device-action/os/GetDeviceStatus/types.ts diff --git a/packages/core/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.ts b/packages/device-management-kit/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.ts similarity index 100% rename from packages/core/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.ts rename to packages/device-management-kit/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.ts diff --git a/packages/core/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.ts b/packages/device-management-kit/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.ts similarity index 100% rename from packages/core/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.ts rename to packages/device-management-kit/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.ts diff --git a/packages/core/src/api/device-action/os/GoToDashboard/types.ts b/packages/device-management-kit/src/api/device-action/os/GoToDashboard/types.ts similarity index 100% rename from packages/core/src/api/device-action/os/GoToDashboard/types.ts rename to packages/device-management-kit/src/api/device-action/os/GoToDashboard/types.ts diff --git a/packages/core/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.ts b/packages/device-management-kit/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.ts similarity index 100% rename from packages/core/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.ts rename to packages/device-management-kit/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.ts diff --git a/packages/core/src/api/device-action/os/ListApps/ListAppsDeviceAction.ts b/packages/device-management-kit/src/api/device-action/os/ListApps/ListAppsDeviceAction.ts similarity index 100% rename from packages/core/src/api/device-action/os/ListApps/ListAppsDeviceAction.ts rename to packages/device-management-kit/src/api/device-action/os/ListApps/ListAppsDeviceAction.ts diff --git a/packages/core/src/api/device-action/os/ListApps/types.ts b/packages/device-management-kit/src/api/device-action/os/ListApps/types.ts similarity index 100% rename from packages/core/src/api/device-action/os/ListApps/types.ts rename to packages/device-management-kit/src/api/device-action/os/ListApps/types.ts diff --git a/packages/core/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.ts b/packages/device-management-kit/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.ts similarity index 100% rename from packages/core/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.ts rename to packages/device-management-kit/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.ts diff --git a/packages/core/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.ts b/packages/device-management-kit/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.ts similarity index 100% rename from packages/core/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.ts rename to packages/device-management-kit/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.ts diff --git a/packages/core/src/api/device-action/os/ListAppsWithMetadata/types.ts b/packages/device-management-kit/src/api/device-action/os/ListAppsWithMetadata/types.ts similarity index 100% rename from packages/core/src/api/device-action/os/ListAppsWithMetadata/types.ts rename to packages/device-management-kit/src/api/device-action/os/ListAppsWithMetadata/types.ts diff --git a/packages/core/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.ts b/packages/device-management-kit/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.ts similarity index 100% rename from packages/core/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.ts rename to packages/device-management-kit/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.ts diff --git a/packages/core/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.ts b/packages/device-management-kit/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.ts similarity index 99% rename from packages/core/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.ts rename to packages/device-management-kit/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.ts index 58fcdd682..8eecb605e 100644 --- a/packages/core/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.ts +++ b/packages/device-management-kit/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.ts @@ -66,7 +66,7 @@ export type ExtractMachineDependencies = ( * appName: "MyApp", * }, * }); - * sdk.executeDeviceAction({ sessionId: "mySessionId", deviceAction }); + * dmk.executeDeviceAction({ sessionId: "mySessionId", deviceAction }); * ``` */ export class OpenAppDeviceAction extends XStateDeviceAction< diff --git a/packages/core/src/api/device-action/os/OpenAppDeviceAction/types.ts b/packages/device-management-kit/src/api/device-action/os/OpenAppDeviceAction/types.ts similarity index 100% rename from packages/core/src/api/device-action/os/OpenAppDeviceAction/types.ts rename to packages/device-management-kit/src/api/device-action/os/OpenAppDeviceAction/types.ts diff --git a/packages/core/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.ts b/packages/device-management-kit/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.ts similarity index 100% rename from packages/core/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.ts rename to packages/device-management-kit/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.ts diff --git a/packages/core/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.ts b/packages/device-management-kit/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.ts similarity index 99% rename from packages/core/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.ts rename to packages/device-management-kit/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.ts index fe3ec2e68..809a1f4b6 100644 --- a/packages/core/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.ts +++ b/packages/device-management-kit/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.ts @@ -47,7 +47,7 @@ import { * requiredUserInteraction: UserInteractionRequired.None, * }, * }); - * sdk.executeDeviceAction({ sessionId: "mySessionId", deviceAction }); + * dmk.executeDeviceAction({ sessionId: "mySessionId", deviceAction }); * ``` */ export class SendCommandInAppDeviceAction< diff --git a/packages/core/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.ts b/packages/device-management-kit/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.ts similarity index 100% rename from packages/core/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.ts rename to packages/device-management-kit/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.ts diff --git a/packages/core/src/api/device-action/use-case/ExecuteDeviceActionUseCase.ts b/packages/device-management-kit/src/api/device-action/use-case/ExecuteDeviceActionUseCase.ts similarity index 96% rename from packages/core/src/api/device-action/use-case/ExecuteDeviceActionUseCase.ts rename to packages/device-management-kit/src/api/device-action/use-case/ExecuteDeviceActionUseCase.ts index 76bc7d724..475fbad5e 100644 --- a/packages/core/src/api/device-action/use-case/ExecuteDeviceActionUseCase.ts +++ b/packages/device-management-kit/src/api/device-action/use-case/ExecuteDeviceActionUseCase.ts @@ -5,7 +5,7 @@ import { DeviceActionIntermediateValue, ExecuteDeviceActionReturnType, } from "@api/device-action/DeviceAction"; -import { SdkError } from "@api/Error"; +import { DmkError } from "@api/Error"; import { deviceSessionTypes } from "@internal/device-session/di/deviceSessionTypes"; import type { DeviceSessionService } from "@internal/device-session/service/DeviceSessionService"; import { loggerTypes } from "@internal/logger-publisher/di/loggerTypes"; @@ -14,7 +14,7 @@ import { LoggerPublisherService } from "@internal/logger-publisher/service/Logge export type ExecuteDeviceActionUseCaseArgs< Output, Input, - Error extends SdkError, + Error extends DmkError, IntermediateValue extends DeviceActionIntermediateValue, > = { /** @@ -53,7 +53,7 @@ export class ExecuteDeviceActionUseCase { */ execute< Output, - Error extends SdkError, + Error extends DmkError, IntermediateValue extends DeviceActionIntermediateValue, Input, >({ diff --git a/packages/core/src/api/device-action/xstate-utils/StateMachineTypes.ts b/packages/device-management-kit/src/api/device-action/xstate-utils/StateMachineTypes.ts similarity index 100% rename from packages/core/src/api/device-action/xstate-utils/StateMachineTypes.ts rename to packages/device-management-kit/src/api/device-action/xstate-utils/StateMachineTypes.ts diff --git a/packages/core/src/api/device-action/xstate-utils/XStateDeviceAction.ts b/packages/device-management-kit/src/api/device-action/xstate-utils/XStateDeviceAction.ts similarity index 98% rename from packages/core/src/api/device-action/xstate-utils/XStateDeviceAction.ts rename to packages/device-management-kit/src/api/device-action/xstate-utils/XStateDeviceAction.ts index a4e510878..1e784b3f5 100644 --- a/packages/core/src/api/device-action/xstate-utils/XStateDeviceAction.ts +++ b/packages/device-management-kit/src/api/device-action/xstate-utils/XStateDeviceAction.ts @@ -17,14 +17,14 @@ import { type DeviceActionState, DeviceActionStatus, } from "@api/device-action/model/DeviceActionState"; -import { type SdkError } from "@api/Error"; +import { type DmkError } from "@api/Error"; import { type StateMachineTypes } from "./StateMachineTypes"; export type DeviceActionStateMachine< Output, Input, - Error extends SdkError, + Error extends DmkError, IntermediateValue extends DeviceActionIntermediateValue, InternalState, > = StateMachine< @@ -78,7 +78,7 @@ export type DeviceActionStateMachine< export abstract class XStateDeviceAction< Output, Input, - Error extends SdkError, + Error extends DmkError, IntermediateValue extends DeviceActionIntermediateValue, InternalState, > implements DeviceAction diff --git a/packages/core/src/api/device-session/ApduResponse.stub.ts b/packages/device-management-kit/src/api/device-session/ApduResponse.stub.ts similarity index 100% rename from packages/core/src/api/device-session/ApduResponse.stub.ts rename to packages/device-management-kit/src/api/device-session/ApduResponse.stub.ts diff --git a/packages/core/src/api/device-session/ApduResponse.ts b/packages/device-management-kit/src/api/device-session/ApduResponse.ts similarity index 100% rename from packages/core/src/api/device-session/ApduResponse.ts rename to packages/device-management-kit/src/api/device-session/ApduResponse.ts diff --git a/packages/core/src/api/device-session/DeviceSessionState.ts b/packages/device-management-kit/src/api/device-session/DeviceSessionState.ts similarity index 100% rename from packages/core/src/api/device-session/DeviceSessionState.ts rename to packages/device-management-kit/src/api/device-session/DeviceSessionState.ts diff --git a/packages/core/src/api/device-session/types.ts b/packages/device-management-kit/src/api/device-session/types.ts similarity index 100% rename from packages/core/src/api/device-session/types.ts rename to packages/device-management-kit/src/api/device-session/types.ts diff --git a/packages/core/src/api/device/DeviceModel.ts b/packages/device-management-kit/src/api/device/DeviceModel.ts similarity index 100% rename from packages/core/src/api/device/DeviceModel.ts rename to packages/device-management-kit/src/api/device/DeviceModel.ts diff --git a/packages/core/src/api/device/DeviceStatus.ts b/packages/device-management-kit/src/api/device/DeviceStatus.ts similarity index 100% rename from packages/core/src/api/device/DeviceStatus.ts rename to packages/device-management-kit/src/api/device/DeviceStatus.ts diff --git a/packages/core/src/api/discovery/ConnectionType.ts b/packages/device-management-kit/src/api/discovery/ConnectionType.ts similarity index 100% rename from packages/core/src/api/discovery/ConnectionType.ts rename to packages/device-management-kit/src/api/discovery/ConnectionType.ts diff --git a/packages/core/src/api/index.ts b/packages/device-management-kit/src/api/index.ts similarity index 96% rename from packages/core/src/api/index.ts rename to packages/device-management-kit/src/api/index.ts index d1d3d1369..1de6aa487 100644 --- a/packages/core/src/api/index.ts +++ b/packages/device-management-kit/src/api/index.ts @@ -41,8 +41,8 @@ export { export { DeviceModel, DeviceModelId } from "./device/DeviceModel"; export { DeviceStatus } from "./device/DeviceStatus"; export { ApduResponse } from "./device-session/ApduResponse"; -export { DeviceSdk } from "./DeviceSdk"; -export { LedgerDeviceSdkBuilder as DeviceSdkBuilder } from "./DeviceSdkBuilder"; +export { DeviceManagementKit } from "./DeviceManagementKit"; +export { DeviceManagementKitBuilder } from "./DeviceManagementKitBuilder"; export { DeviceExchangeError, UnknownDeviceExchangeError } from "./Error"; export { LogLevel } from "./logger-subscriber/model/LogLevel"; export { ConsoleLogger } from "./logger-subscriber/service/ConsoleLogger"; @@ -121,7 +121,7 @@ export { type DeviceSessionState, DeviceSessionStateType, } from "@api/device-session/DeviceSessionState"; -export { type SdkError } from "@api/Error"; +export { type DmkError } from "@api/Error"; export { base64StringToBuffer, isBase64String } from "@api/utils/Base64String"; export { bufferToHexaString, diff --git a/packages/core/src/api/logger-subscriber/__mocks__/ConsoleLogger.ts b/packages/device-management-kit/src/api/logger-subscriber/__mocks__/ConsoleLogger.ts similarity index 100% rename from packages/core/src/api/logger-subscriber/__mocks__/ConsoleLogger.ts rename to packages/device-management-kit/src/api/logger-subscriber/__mocks__/ConsoleLogger.ts diff --git a/packages/core/src/api/logger-subscriber/model/LogLevel.ts b/packages/device-management-kit/src/api/logger-subscriber/model/LogLevel.ts similarity index 100% rename from packages/core/src/api/logger-subscriber/model/LogLevel.ts rename to packages/device-management-kit/src/api/logger-subscriber/model/LogLevel.ts diff --git a/packages/core/src/api/logger-subscriber/model/LogSubscriberOptions.ts b/packages/device-management-kit/src/api/logger-subscriber/model/LogSubscriberOptions.ts similarity index 100% rename from packages/core/src/api/logger-subscriber/model/LogSubscriberOptions.ts rename to packages/device-management-kit/src/api/logger-subscriber/model/LogSubscriberOptions.ts diff --git a/packages/core/src/api/logger-subscriber/service/ConsoleLogger.test.ts b/packages/device-management-kit/src/api/logger-subscriber/service/ConsoleLogger.test.ts similarity index 100% rename from packages/core/src/api/logger-subscriber/service/ConsoleLogger.test.ts rename to packages/device-management-kit/src/api/logger-subscriber/service/ConsoleLogger.test.ts diff --git a/packages/core/src/api/logger-subscriber/service/ConsoleLogger.ts b/packages/device-management-kit/src/api/logger-subscriber/service/ConsoleLogger.ts similarity index 100% rename from packages/core/src/api/logger-subscriber/service/ConsoleLogger.ts rename to packages/device-management-kit/src/api/logger-subscriber/service/ConsoleLogger.ts diff --git a/packages/core/src/api/logger-subscriber/service/LoggerSubscriberService.ts b/packages/device-management-kit/src/api/logger-subscriber/service/LoggerSubscriberService.ts similarity index 84% rename from packages/core/src/api/logger-subscriber/service/LoggerSubscriberService.ts rename to packages/device-management-kit/src/api/logger-subscriber/service/LoggerSubscriberService.ts index 06c77a0a2..0002b7a6e 100644 --- a/packages/core/src/api/logger-subscriber/service/LoggerSubscriberService.ts +++ b/packages/device-management-kit/src/api/logger-subscriber/service/LoggerSubscriberService.ts @@ -4,7 +4,7 @@ import { type LogSubscriberOptions } from "@api/logger-subscriber/model/LogSubsc /** * Logger subscriber service. * - * Implement this interface and use `LedgerDeviceSdkBuilder.addLogger` to + * Implement this interface and use `DeviceManagementKitBuilder.addLogger` to * receive logs from the SDK. */ export type LogParams = [ diff --git a/packages/core/src/api/logger-subscriber/service/WebLogsExporterLogger.test.ts b/packages/device-management-kit/src/api/logger-subscriber/service/WebLogsExporterLogger.test.ts similarity index 100% rename from packages/core/src/api/logger-subscriber/service/WebLogsExporterLogger.test.ts rename to packages/device-management-kit/src/api/logger-subscriber/service/WebLogsExporterLogger.test.ts diff --git a/packages/core/src/api/logger-subscriber/service/WebLogsExporterLogger.ts b/packages/device-management-kit/src/api/logger-subscriber/service/WebLogsExporterLogger.ts similarity index 100% rename from packages/core/src/api/logger-subscriber/service/WebLogsExporterLogger.ts rename to packages/device-management-kit/src/api/logger-subscriber/service/WebLogsExporterLogger.ts diff --git a/packages/core/src/api/transport/model/ConnectedDevice.ts b/packages/device-management-kit/src/api/transport/model/ConnectedDevice.ts similarity index 100% rename from packages/core/src/api/transport/model/ConnectedDevice.ts rename to packages/device-management-kit/src/api/transport/model/ConnectedDevice.ts diff --git a/packages/core/src/api/transport/model/DiscoveredDevice.ts b/packages/device-management-kit/src/api/transport/model/DiscoveredDevice.ts similarity index 100% rename from packages/core/src/api/transport/model/DiscoveredDevice.ts rename to packages/device-management-kit/src/api/transport/model/DiscoveredDevice.ts diff --git a/packages/core/src/api/transport/model/Transport.ts b/packages/device-management-kit/src/api/transport/model/Transport.ts similarity index 94% rename from packages/core/src/api/transport/model/Transport.ts rename to packages/device-management-kit/src/api/transport/model/Transport.ts index ed1ffee43..8a3ff8225 100644 --- a/packages/core/src/api/transport/model/Transport.ts +++ b/packages/device-management-kit/src/api/transport/model/Transport.ts @@ -2,7 +2,7 @@ import { type Either } from "purify-ts"; import { type Observable } from "rxjs"; import { type DeviceId } from "@api/device/DeviceModel"; -import { type SdkError } from "@api/Error"; +import { type DmkError } from "@api/Error"; import { type TransportIdentifier } from "@api/transport/model/TransportIdentifier"; import { type ConnectError } from "@internal/transport/model/Errors"; import { type InternalConnectedDevice } from "@internal/transport/model/InternalConnectedDevice"; @@ -40,5 +40,5 @@ export interface Transport { disconnect(params: { connectedDevice: InternalConnectedDevice; - }): Promise>; + }): Promise>; } diff --git a/packages/core/src/api/transport/model/TransportIdentifier.ts b/packages/device-management-kit/src/api/transport/model/TransportIdentifier.ts similarity index 100% rename from packages/core/src/api/transport/model/TransportIdentifier.ts rename to packages/device-management-kit/src/api/transport/model/TransportIdentifier.ts diff --git a/packages/core/src/api/types.ts b/packages/device-management-kit/src/api/types.ts similarity index 100% rename from packages/core/src/api/types.ts rename to packages/device-management-kit/src/api/types.ts diff --git a/packages/core/src/api/utils/Base64String.test.ts b/packages/device-management-kit/src/api/utils/Base64String.test.ts similarity index 100% rename from packages/core/src/api/utils/Base64String.test.ts rename to packages/device-management-kit/src/api/utils/Base64String.test.ts diff --git a/packages/core/src/api/utils/Base64String.ts b/packages/device-management-kit/src/api/utils/Base64String.ts similarity index 100% rename from packages/core/src/api/utils/Base64String.ts rename to packages/device-management-kit/src/api/utils/Base64String.ts diff --git a/packages/core/src/api/utils/HexaString.test.ts b/packages/device-management-kit/src/api/utils/HexaString.test.ts similarity index 100% rename from packages/core/src/api/utils/HexaString.test.ts rename to packages/device-management-kit/src/api/utils/HexaString.test.ts diff --git a/packages/core/src/api/utils/HexaString.ts b/packages/device-management-kit/src/api/utils/HexaString.ts similarity index 100% rename from packages/core/src/api/utils/HexaString.ts rename to packages/device-management-kit/src/api/utils/HexaString.ts diff --git a/packages/core/src/di.stub.ts b/packages/device-management-kit/src/di.stub.ts similarity index 100% rename from packages/core/src/di.stub.ts rename to packages/device-management-kit/src/di.stub.ts diff --git a/packages/core/src/di.ts b/packages/device-management-kit/src/di.ts similarity index 97% rename from packages/core/src/di.ts rename to packages/device-management-kit/src/di.ts index 6a08577f6..d4c85a931 100644 --- a/packages/core/src/di.ts +++ b/packages/device-management-kit/src/di.ts @@ -4,10 +4,10 @@ import { Container } from "inversify"; // import { makeLoggerMiddleware } from "inversify-logger-middleware"; import { commandModuleFactory } from "@api/command/di/commandModule"; import { deviceActionModuleFactory } from "@api/device-action/di/deviceActionModule"; -import { type LoggerSubscriberService } from "@api/logger-subscriber/service/LoggerSubscriberService"; // Uncomment this line to enable the logger middleware // import { makeLoggerMiddleware } from "inversify-logger-middleware"; -import { type SdkConfig } from "@api/SdkConfig"; +import { type DmkConfig } from "@api/DmkConfig"; +import { type LoggerSubscriberService } from "@api/logger-subscriber/service/LoggerSubscriberService"; import { type Transport } from "@api/transport/model/Transport"; import { type BuiltinTransports } from "@api/transport/model/TransportIdentifier"; import { configModuleFactory } from "@internal/config/di/configModule"; @@ -33,7 +33,7 @@ export type MakeContainerProps = { transports: BuiltinTransports[]; customTransports: Transport[]; loggers: LoggerSubscriberService[]; - config: SdkConfig; + config: DmkConfig; }; export const makeContainer = ({ diff --git a/packages/core/src/index.ts b/packages/device-management-kit/src/index.ts similarity index 100% rename from packages/core/src/index.ts rename to packages/device-management-kit/src/index.ts diff --git a/packages/core/src/internal/config/data/ConfigDataSource.ts b/packages/device-management-kit/src/internal/config/data/ConfigDataSource.ts similarity index 100% rename from packages/core/src/internal/config/data/ConfigDataSource.ts rename to packages/device-management-kit/src/internal/config/data/ConfigDataSource.ts diff --git a/packages/core/src/internal/config/data/Dto.ts b/packages/device-management-kit/src/internal/config/data/Dto.ts similarity index 100% rename from packages/core/src/internal/config/data/Dto.ts rename to packages/device-management-kit/src/internal/config/data/Dto.ts diff --git a/packages/core/src/internal/config/data/LocalConfigDataSource.stub.ts b/packages/device-management-kit/src/internal/config/data/LocalConfigDataSource.stub.ts similarity index 100% rename from packages/core/src/internal/config/data/LocalConfigDataSource.stub.ts rename to packages/device-management-kit/src/internal/config/data/LocalConfigDataSource.stub.ts diff --git a/packages/core/src/internal/config/data/LocalConfigDataSource.test.ts b/packages/device-management-kit/src/internal/config/data/LocalConfigDataSource.test.ts similarity index 100% rename from packages/core/src/internal/config/data/LocalConfigDataSource.test.ts rename to packages/device-management-kit/src/internal/config/data/LocalConfigDataSource.test.ts diff --git a/packages/core/src/internal/config/data/LocalConfigDataSource.ts b/packages/device-management-kit/src/internal/config/data/LocalConfigDataSource.ts similarity index 100% rename from packages/core/src/internal/config/data/LocalConfigDataSource.ts rename to packages/device-management-kit/src/internal/config/data/LocalConfigDataSource.ts diff --git a/packages/core/src/internal/config/data/RemoteConfigDataSource.stub.ts b/packages/device-management-kit/src/internal/config/data/RemoteConfigDataSource.stub.ts similarity index 100% rename from packages/core/src/internal/config/data/RemoteConfigDataSource.stub.ts rename to packages/device-management-kit/src/internal/config/data/RemoteConfigDataSource.stub.ts diff --git a/packages/core/src/internal/config/data/RemoteConfigDataSource.test.ts b/packages/device-management-kit/src/internal/config/data/RemoteConfigDataSource.test.ts similarity index 100% rename from packages/core/src/internal/config/data/RemoteConfigDataSource.test.ts rename to packages/device-management-kit/src/internal/config/data/RemoteConfigDataSource.test.ts diff --git a/packages/core/src/internal/config/data/RemoteConfigDataSource.ts b/packages/device-management-kit/src/internal/config/data/RemoteConfigDataSource.ts similarity index 100% rename from packages/core/src/internal/config/data/RemoteConfigDataSource.ts rename to packages/device-management-kit/src/internal/config/data/RemoteConfigDataSource.ts diff --git a/packages/core/src/internal/config/data/__mocks__/LocalConfigDataSource.ts b/packages/device-management-kit/src/internal/config/data/__mocks__/LocalConfigDataSource.ts similarity index 100% rename from packages/core/src/internal/config/data/__mocks__/LocalConfigDataSource.ts rename to packages/device-management-kit/src/internal/config/data/__mocks__/LocalConfigDataSource.ts diff --git a/packages/core/src/internal/config/data/__mocks__/RemoteConfigDataSource.ts b/packages/device-management-kit/src/internal/config/data/__mocks__/RemoteConfigDataSource.ts similarity index 100% rename from packages/core/src/internal/config/data/__mocks__/RemoteConfigDataSource.ts rename to packages/device-management-kit/src/internal/config/data/__mocks__/RemoteConfigDataSource.ts diff --git a/packages/core/src/internal/config/di/configModule.test.ts b/packages/device-management-kit/src/internal/config/di/configModule.test.ts similarity index 100% rename from packages/core/src/internal/config/di/configModule.test.ts rename to packages/device-management-kit/src/internal/config/di/configModule.test.ts diff --git a/packages/core/src/internal/config/di/configModule.ts b/packages/device-management-kit/src/internal/config/di/configModule.ts similarity index 89% rename from packages/core/src/internal/config/di/configModule.ts rename to packages/device-management-kit/src/internal/config/di/configModule.ts index e749a2a52..01ec9be87 100644 --- a/packages/core/src/internal/config/di/configModule.ts +++ b/packages/device-management-kit/src/internal/config/di/configModule.ts @@ -5,7 +5,7 @@ import { StubLocalConfigDataSource } from "@internal/config/data/LocalConfigData import { RestRemoteConfigDataSource } from "@internal/config/data/RemoteConfigDataSource"; import { StubRemoteConfigDataSource } from "@internal/config/data/RemoteConfigDataSource.stub"; import { DefaultConfigService } from "@internal/config/service/DefaultConfigService"; -import { GetSdkVersionUseCase } from "@internal/config/use-case/GetSdkVersionUseCase"; +import { GetDmkVersionUseCase } from "@internal/config/use-case/GetDmkVersionUseCase"; import { configTypes } from "./configTypes"; @@ -19,7 +19,7 @@ export const configModuleFactory = ({ stub }: FactoryProps) => new ContainerModule((bind, _unbind, _isBound, rebind) => { bind(configTypes.LocalConfigDataSource).to(FileLocalConfigDataSource); bind(configTypes.RemoteConfigDataSource).to(RestRemoteConfigDataSource); - bind(configTypes.GetSdkVersionUseCase).to(GetSdkVersionUseCase); + bind(configTypes.GetDmkVersionUseCase).to(GetDmkVersionUseCase); bind(configTypes.ConfigService).to(DefaultConfigService); if (stub) { diff --git a/packages/core/src/internal/config/di/configTypes.ts b/packages/device-management-kit/src/internal/config/di/configTypes.ts similarity index 77% rename from packages/core/src/internal/config/di/configTypes.ts rename to packages/device-management-kit/src/internal/config/di/configTypes.ts index ffe10b732..896543d13 100644 --- a/packages/core/src/internal/config/di/configTypes.ts +++ b/packages/device-management-kit/src/internal/config/di/configTypes.ts @@ -2,5 +2,5 @@ export const configTypes = { LocalConfigDataSource: Symbol.for("LocalConfigDataSource"), RemoteConfigDataSource: Symbol.for("RemoteConfigDataSource"), ConfigService: Symbol.for("ConfigService"), - GetSdkVersionUseCase: Symbol.for("GetSdkVersionUseCase"), + GetDmkVersionUseCase: Symbol.for("GetDmkVersionUseCase"), }; diff --git a/packages/core/src/internal/config/model/Config.ts b/packages/device-management-kit/src/internal/config/model/Config.ts similarity index 100% rename from packages/core/src/internal/config/model/Config.ts rename to packages/device-management-kit/src/internal/config/model/Config.ts diff --git a/packages/core/src/internal/config/model/Errors.ts b/packages/device-management-kit/src/internal/config/model/Errors.ts similarity index 100% rename from packages/core/src/internal/config/model/Errors.ts rename to packages/device-management-kit/src/internal/config/model/Errors.ts diff --git a/packages/core/src/internal/config/service/ConfigService.ts b/packages/device-management-kit/src/internal/config/service/ConfigService.ts similarity index 73% rename from packages/core/src/internal/config/service/ConfigService.ts rename to packages/device-management-kit/src/internal/config/service/ConfigService.ts index 39b91cb2e..060249a57 100644 --- a/packages/core/src/internal/config/service/ConfigService.ts +++ b/packages/device-management-kit/src/internal/config/service/ConfigService.ts @@ -1,5 +1,5 @@ import { type Config } from "@internal/config/model/Config"; export interface ConfigService { - getSdkConfig(): Promise; + getDmkConfig(): Promise; } diff --git a/packages/core/src/internal/config/service/DefaultConfigService.test.ts b/packages/device-management-kit/src/internal/config/service/DefaultConfigService.test.ts similarity index 92% rename from packages/core/src/internal/config/service/DefaultConfigService.test.ts rename to packages/device-management-kit/src/internal/config/service/DefaultConfigService.test.ts index c402be585..380163786 100644 --- a/packages/core/src/internal/config/service/DefaultConfigService.test.ts +++ b/packages/device-management-kit/src/internal/config/service/DefaultConfigService.test.ts @@ -45,7 +45,7 @@ describe("DefaultConfigService", () => { }), ); - expect(await service.getSdkConfig()).toStrictEqual({ + expect(await service.getDmkConfig()).toStrictEqual({ name: "DeviceSDK", version: "1.0.0-local", }); @@ -62,7 +62,7 @@ describe("DefaultConfigService", () => { }), ); - expect(await service.getSdkConfig()).toStrictEqual({ + expect(await service.getDmkConfig()).toStrictEqual({ name: "DeviceSDK", version: "1.0.0-remote", }); @@ -74,8 +74,8 @@ describe("DefaultConfigService", () => { localDataSource.getConfig.mockReturnValue(Left(new JSONParseError())); remoteDataSource.getConfig.mockResolvedValue(Left(new JSONParseError())); - expect(await service.getSdkConfig()).toStrictEqual({ - name: "DeadSdk", + expect(await service.getDmkConfig()).toStrictEqual({ + name: "DeadDmk", version: "0.0.0-dead.1", }); }); diff --git a/packages/core/src/internal/config/service/DefaultConfigService.ts b/packages/device-management-kit/src/internal/config/service/DefaultConfigService.ts similarity index 94% rename from packages/core/src/internal/config/service/DefaultConfigService.ts rename to packages/device-management-kit/src/internal/config/service/DefaultConfigService.ts index 4fcdb79b8..0c538e2c7 100644 --- a/packages/core/src/internal/config/service/DefaultConfigService.ts +++ b/packages/device-management-kit/src/internal/config/service/DefaultConfigService.ts @@ -31,7 +31,7 @@ export class DefaultConfigService implements ConfigService { this._logger = loggerServiceFactory("config"); } - async getSdkConfig(): Promise { + async getDmkConfig(): Promise { // Returns an Either const localConfig = this._local .getConfig() @@ -52,7 +52,7 @@ export class DefaultConfigService implements ConfigService { .mapLeft((error: RemoteConfigFailure) => { // Here we handle the error and return a default value this._logger.error("Local config available", { data: { error } }); - return { name: "DeadSdk", version: "0.0.0-dead.1" }; + return { name: "DeadDmk", version: "0.0.0-dead.1" }; }) .extract(); }); diff --git a/packages/device-management-kit/src/internal/config/use-case/GetDmkVersionUseCase.test.ts b/packages/device-management-kit/src/internal/config/use-case/GetDmkVersionUseCase.test.ts new file mode 100644 index 000000000..0cae5a8c8 --- /dev/null +++ b/packages/device-management-kit/src/internal/config/use-case/GetDmkVersionUseCase.test.ts @@ -0,0 +1,23 @@ +import { GetDmkVersionUseCase } from "./GetDmkVersionUseCase"; + +const getDmkConfigMock = jest.fn(); + +let usecase: GetDmkVersionUseCase; +describe("GetDmkVersionUseCase", () => { + beforeEach(() => { + getDmkConfigMock.mockClear(); + const configService = { + getDmkConfig: getDmkConfigMock, + }; + + usecase = new GetDmkVersionUseCase(configService); + }); + + it("should return the dmk version", async () => { + getDmkConfigMock.mockResolvedValue({ + name: "DeviceSDK", + version: "1.0.0", + }); + expect(await usecase.getDmkVersion()).toBe("1.0.0"); + }); +}); diff --git a/packages/core/src/internal/config/use-case/GetSdkVersionUseCase.ts b/packages/device-management-kit/src/internal/config/use-case/GetDmkVersionUseCase.ts similarity index 58% rename from packages/core/src/internal/config/use-case/GetSdkVersionUseCase.ts rename to packages/device-management-kit/src/internal/config/use-case/GetDmkVersionUseCase.ts index 8157707df..0da9cb69c 100644 --- a/packages/core/src/internal/config/use-case/GetSdkVersionUseCase.ts +++ b/packages/device-management-kit/src/internal/config/use-case/GetDmkVersionUseCase.ts @@ -4,17 +4,17 @@ import { configTypes } from "@internal/config/di/configTypes"; import type { ConfigService } from "@internal/config/service/ConfigService"; /** - * class GetSDKVersionUseCase - * This is our actual use case that our SDK will use. - * We will have many use cases in our SDK, and each should be contained in its own file. + * class GetDmkVersionUseCase + * This is our actual use case that our DMK will use. + * We will have many use cases in our DMK, and each should be contained in its own file. */ @injectable() -export class GetSdkVersionUseCase { +export class GetDmkVersionUseCase { private _configService: ConfigService; constructor(@inject(configTypes.ConfigService) configService: ConfigService) { this._configService = configService; } - async getSdkVersion(): Promise { - return (await this._configService.getSdkConfig()).version; + async getDmkVersion(): Promise { + return (await this._configService.getDmkConfig()).version; } } diff --git a/packages/core/src/internal/device-model/data/DeviceModelDataSource.ts b/packages/device-management-kit/src/internal/device-model/data/DeviceModelDataSource.ts similarity index 100% rename from packages/core/src/internal/device-model/data/DeviceModelDataSource.ts rename to packages/device-management-kit/src/internal/device-model/data/DeviceModelDataSource.ts diff --git a/packages/core/src/internal/device-model/data/StaticDeviceModelDataSource.test.ts b/packages/device-management-kit/src/internal/device-model/data/StaticDeviceModelDataSource.test.ts similarity index 100% rename from packages/core/src/internal/device-model/data/StaticDeviceModelDataSource.test.ts rename to packages/device-management-kit/src/internal/device-model/data/StaticDeviceModelDataSource.test.ts diff --git a/packages/core/src/internal/device-model/data/StaticDeviceModelDataSource.ts b/packages/device-management-kit/src/internal/device-model/data/StaticDeviceModelDataSource.ts similarity index 100% rename from packages/core/src/internal/device-model/data/StaticDeviceModelDataSource.ts rename to packages/device-management-kit/src/internal/device-model/data/StaticDeviceModelDataSource.ts diff --git a/packages/core/src/internal/device-model/di/deviceModelModule.test.ts b/packages/device-management-kit/src/internal/device-model/di/deviceModelModule.test.ts similarity index 100% rename from packages/core/src/internal/device-model/di/deviceModelModule.test.ts rename to packages/device-management-kit/src/internal/device-model/di/deviceModelModule.test.ts diff --git a/packages/core/src/internal/device-model/di/deviceModelModule.ts b/packages/device-management-kit/src/internal/device-model/di/deviceModelModule.ts similarity index 100% rename from packages/core/src/internal/device-model/di/deviceModelModule.ts rename to packages/device-management-kit/src/internal/device-model/di/deviceModelModule.ts diff --git a/packages/core/src/internal/device-model/di/deviceModelTypes.ts b/packages/device-management-kit/src/internal/device-model/di/deviceModelTypes.ts similarity index 100% rename from packages/core/src/internal/device-model/di/deviceModelTypes.ts rename to packages/device-management-kit/src/internal/device-model/di/deviceModelTypes.ts diff --git a/packages/core/src/internal/device-model/model/DeviceModel.stub.ts b/packages/device-management-kit/src/internal/device-model/model/DeviceModel.stub.ts similarity index 100% rename from packages/core/src/internal/device-model/model/DeviceModel.stub.ts rename to packages/device-management-kit/src/internal/device-model/model/DeviceModel.stub.ts diff --git a/packages/core/src/internal/device-model/model/DeviceModel.test.ts b/packages/device-management-kit/src/internal/device-model/model/DeviceModel.test.ts similarity index 100% rename from packages/core/src/internal/device-model/model/DeviceModel.test.ts rename to packages/device-management-kit/src/internal/device-model/model/DeviceModel.test.ts diff --git a/packages/core/src/internal/device-model/model/DeviceModel.ts b/packages/device-management-kit/src/internal/device-model/model/DeviceModel.ts similarity index 100% rename from packages/core/src/internal/device-model/model/DeviceModel.ts rename to packages/device-management-kit/src/internal/device-model/model/DeviceModel.ts diff --git a/packages/core/src/internal/device-session/data/ApduResponseConst.ts b/packages/device-management-kit/src/internal/device-session/data/ApduResponseConst.ts similarity index 100% rename from packages/core/src/internal/device-session/data/ApduResponseConst.ts rename to packages/device-management-kit/src/internal/device-session/data/ApduResponseConst.ts diff --git a/packages/core/src/internal/device-session/data/FramerConst.ts b/packages/device-management-kit/src/internal/device-session/data/FramerConst.ts similarity index 100% rename from packages/core/src/internal/device-session/data/FramerConst.ts rename to packages/device-management-kit/src/internal/device-session/data/FramerConst.ts diff --git a/packages/core/src/internal/device-session/di/deviceSessionModule.test.ts b/packages/device-management-kit/src/internal/device-session/di/deviceSessionModule.test.ts similarity index 100% rename from packages/core/src/internal/device-session/di/deviceSessionModule.test.ts rename to packages/device-management-kit/src/internal/device-session/di/deviceSessionModule.test.ts diff --git a/packages/core/src/internal/device-session/di/deviceSessionModule.ts b/packages/device-management-kit/src/internal/device-session/di/deviceSessionModule.ts similarity index 100% rename from packages/core/src/internal/device-session/di/deviceSessionModule.ts rename to packages/device-management-kit/src/internal/device-session/di/deviceSessionModule.ts diff --git a/packages/core/src/internal/device-session/di/deviceSessionTypes.ts b/packages/device-management-kit/src/internal/device-session/di/deviceSessionTypes.ts similarity index 100% rename from packages/core/src/internal/device-session/di/deviceSessionTypes.ts rename to packages/device-management-kit/src/internal/device-session/di/deviceSessionTypes.ts diff --git a/packages/core/src/internal/device-session/model/DeviceSession.stub.ts b/packages/device-management-kit/src/internal/device-session/model/DeviceSession.stub.ts similarity index 100% rename from packages/core/src/internal/device-session/model/DeviceSession.stub.ts rename to packages/device-management-kit/src/internal/device-session/model/DeviceSession.stub.ts diff --git a/packages/core/src/internal/device-session/model/DeviceSession.ts b/packages/device-management-kit/src/internal/device-session/model/DeviceSession.ts similarity index 97% rename from packages/core/src/internal/device-session/model/DeviceSession.ts rename to packages/device-management-kit/src/internal/device-session/model/DeviceSession.ts index 32c46450c..2481525cf 100644 --- a/packages/core/src/internal/device-session/model/DeviceSession.ts +++ b/packages/device-management-kit/src/internal/device-session/model/DeviceSession.ts @@ -17,7 +17,7 @@ import { DeviceSessionStateType, } from "@api/device-session/DeviceSessionState"; import { type DeviceSessionId } from "@api/device-session/types"; -import { type SdkError } from "@api/Error"; +import { type DmkError } from "@api/Error"; import { type LoggerPublisherService } from "@internal/logger-publisher/service/LoggerPublisherService"; import { type ManagerApiService } from "@internal/manager-api/service/ManagerApiService"; import { type InternalConnectedDevice } from "@internal/transport/model/InternalConnectedDevice"; @@ -107,6 +107,7 @@ export class DeviceSession { rawApdu, options.triggersDisconnection, ); + console.log("errrorOrResponse", rawApdu); return errorOrResponse.ifRight((response: ApduResponse) => { if (CommandUtils.isLockedDeviceResponse(response)) { @@ -138,7 +139,7 @@ export class DeviceSession { executeDeviceAction< Output, Input, - Error extends SdkError, + Error extends DmkError, IntermediateValue extends DeviceActionIntermediateValue, >( deviceAction: DeviceAction, diff --git a/packages/core/src/internal/device-session/model/DeviceSessionRefresher.test.ts b/packages/device-management-kit/src/internal/device-session/model/DeviceSessionRefresher.test.ts similarity index 100% rename from packages/core/src/internal/device-session/model/DeviceSessionRefresher.test.ts rename to packages/device-management-kit/src/internal/device-session/model/DeviceSessionRefresher.test.ts diff --git a/packages/core/src/internal/device-session/model/DeviceSessionRefresher.ts b/packages/device-management-kit/src/internal/device-session/model/DeviceSessionRefresher.ts similarity index 97% rename from packages/core/src/internal/device-session/model/DeviceSessionRefresher.ts rename to packages/device-management-kit/src/internal/device-session/model/DeviceSessionRefresher.ts index fc2370167..8b4abf18c 100644 --- a/packages/core/src/internal/device-session/model/DeviceSessionRefresher.ts +++ b/packages/device-management-kit/src/internal/device-session/model/DeviceSessionRefresher.ts @@ -10,7 +10,7 @@ import { DeviceSessionState, DeviceSessionStateType, } from "@api/device-session/DeviceSessionState"; -import { SdkError } from "@api/Error"; +import { DmkError } from "@api/Error"; import { type LoggerPublisherService } from "@internal/logger-publisher/service/LoggerPublisherService"; /** @@ -30,7 +30,7 @@ export type DeviceSessionRefresherArgs = { /** * The function used to send APDU commands to the device. */ - sendApduFn: (rawApdu: Uint8Array) => Promise>; + sendApduFn: (rawApdu: Uint8Array) => Promise>; /** * Callback that updates the state of the device session with diff --git a/packages/core/src/internal/device-session/model/Errors.ts b/packages/device-management-kit/src/internal/device-session/model/Errors.ts similarity index 73% rename from packages/core/src/internal/device-session/model/Errors.ts rename to packages/device-management-kit/src/internal/device-session/model/Errors.ts index d67191cc8..d036ef84f 100644 --- a/packages/core/src/internal/device-session/model/Errors.ts +++ b/packages/device-management-kit/src/internal/device-session/model/Errors.ts @@ -1,6 +1,6 @@ -import { type SdkError } from "@root/src/api/Error"; +import { type DmkError } from "@root/src/api/Error"; -export class FramerOverflowError implements SdkError { +export class FramerOverflowError implements DmkError { readonly _tag = "FramerOverflowError"; originalError?: Error; constructor() { @@ -10,7 +10,7 @@ export class FramerOverflowError implements SdkError { } } -export class FramerApduError implements SdkError { +export class FramerApduError implements DmkError { readonly _tag = "FramerApduError"; originalError?: Error; @@ -19,7 +19,7 @@ export class FramerApduError implements SdkError { } } -export class ReceiverApduError implements SdkError { +export class ReceiverApduError implements DmkError { readonly _tag = "ReceiverApduError"; originalError: Error; @@ -28,7 +28,7 @@ export class ReceiverApduError implements SdkError { } } -export class DeviceSessionNotFound implements SdkError { +export class DeviceSessionNotFound implements DmkError { readonly _tag = "DeviceSessionNotFound"; originalError?: Error; @@ -37,7 +37,7 @@ export class DeviceSessionNotFound implements SdkError { } } -export class DeviceSessionRefresherError implements SdkError { +export class DeviceSessionRefresherError implements DmkError { readonly _tag = "DeviceSessionRefresherError"; originalError?: Error; diff --git a/packages/core/src/internal/device-session/model/Frame.ts b/packages/device-management-kit/src/internal/device-session/model/Frame.ts similarity index 100% rename from packages/core/src/internal/device-session/model/Frame.ts rename to packages/device-management-kit/src/internal/device-session/model/Frame.ts diff --git a/packages/core/src/internal/device-session/model/FrameHeader.ts b/packages/device-management-kit/src/internal/device-session/model/FrameHeader.ts similarity index 100% rename from packages/core/src/internal/device-session/model/FrameHeader.ts rename to packages/device-management-kit/src/internal/device-session/model/FrameHeader.ts diff --git a/packages/core/src/internal/device-session/service/ApduReceiverService.ts b/packages/device-management-kit/src/internal/device-session/service/ApduReceiverService.ts similarity index 61% rename from packages/core/src/internal/device-session/service/ApduReceiverService.ts rename to packages/device-management-kit/src/internal/device-session/service/ApduReceiverService.ts index 4a17ee871..d6b56f139 100644 --- a/packages/core/src/internal/device-session/service/ApduReceiverService.ts +++ b/packages/device-management-kit/src/internal/device-session/service/ApduReceiverService.ts @@ -1,8 +1,8 @@ import { type Either, type Maybe } from "purify-ts"; import { type ApduResponse } from "@api/device-session/ApduResponse"; -import { type SdkError } from "@api/Error"; +import { type DmkError } from "@api/Error"; export interface ApduReceiverService { - handleFrame(apdu: Uint8Array): Either>; + handleFrame(apdu: Uint8Array): Either>; } diff --git a/packages/core/src/internal/device-session/service/ApduSenderService.ts b/packages/device-management-kit/src/internal/device-session/service/ApduSenderService.ts similarity index 100% rename from packages/core/src/internal/device-session/service/ApduSenderService.ts rename to packages/device-management-kit/src/internal/device-session/service/ApduSenderService.ts diff --git a/packages/core/src/internal/device-session/service/DefaultApduReceiverService.stub.ts b/packages/device-management-kit/src/internal/device-session/service/DefaultApduReceiverService.stub.ts similarity index 100% rename from packages/core/src/internal/device-session/service/DefaultApduReceiverService.stub.ts rename to packages/device-management-kit/src/internal/device-session/service/DefaultApduReceiverService.stub.ts diff --git a/packages/core/src/internal/device-session/service/DefaultApduReceiverService.test.ts b/packages/device-management-kit/src/internal/device-session/service/DefaultApduReceiverService.test.ts similarity index 100% rename from packages/core/src/internal/device-session/service/DefaultApduReceiverService.test.ts rename to packages/device-management-kit/src/internal/device-session/service/DefaultApduReceiverService.test.ts diff --git a/packages/core/src/internal/device-session/service/DefaultApduReceiverService.ts b/packages/device-management-kit/src/internal/device-session/service/DefaultApduReceiverService.ts similarity index 100% rename from packages/core/src/internal/device-session/service/DefaultApduReceiverService.ts rename to packages/device-management-kit/src/internal/device-session/service/DefaultApduReceiverService.ts diff --git a/packages/core/src/internal/device-session/service/DefaultApduSenderService.stub.ts b/packages/device-management-kit/src/internal/device-session/service/DefaultApduSenderService.stub.ts similarity index 100% rename from packages/core/src/internal/device-session/service/DefaultApduSenderService.stub.ts rename to packages/device-management-kit/src/internal/device-session/service/DefaultApduSenderService.stub.ts diff --git a/packages/core/src/internal/device-session/service/DefaultApduSenderService.test.ts b/packages/device-management-kit/src/internal/device-session/service/DefaultApduSenderService.test.ts similarity index 100% rename from packages/core/src/internal/device-session/service/DefaultApduSenderService.test.ts rename to packages/device-management-kit/src/internal/device-session/service/DefaultApduSenderService.test.ts diff --git a/packages/core/src/internal/device-session/service/DefaultApduSenderService.ts b/packages/device-management-kit/src/internal/device-session/service/DefaultApduSenderService.ts similarity index 98% rename from packages/core/src/internal/device-session/service/DefaultApduSenderService.ts rename to packages/device-management-kit/src/internal/device-session/service/DefaultApduSenderService.ts index 72c1f4dd9..a6ac32e07 100644 --- a/packages/core/src/internal/device-session/service/DefaultApduSenderService.ts +++ b/packages/device-management-kit/src/internal/device-session/service/DefaultApduSenderService.ts @@ -18,7 +18,7 @@ import { FrameHeader } from "@internal/device-session/model/FrameHeader"; import { FramerUtils } from "@internal/device-session/utils/FramerUtils"; import { loggerTypes } from "@internal/logger-publisher/di/loggerTypes"; import { LoggerPublisherService } from "@internal/logger-publisher/service/LoggerPublisherService"; -import { SdkError } from "@root/src/api/Error"; +import { DmkError } from "@root/src/api/Error"; import type { ApduSenderService } from "./ApduSenderService"; @@ -98,7 +98,7 @@ export class DefaultApduSenderService implements ApduSenderService { private getFrameAtIndex( apdu: Uint8Array, frameIndex: number, - ): Either { + ): Either { const header = this.getFrameHeaderFrom(frameIndex, apdu.length); const frameOffset = frameIndex * this._frameSize - this.getHeaderSizeSumFrom(frameIndex); diff --git a/packages/core/src/internal/device-session/service/DefaultDeviceSessionService.test.ts b/packages/device-management-kit/src/internal/device-session/service/DefaultDeviceSessionService.test.ts similarity index 100% rename from packages/core/src/internal/device-session/service/DefaultDeviceSessionService.test.ts rename to packages/device-management-kit/src/internal/device-session/service/DefaultDeviceSessionService.test.ts diff --git a/packages/core/src/internal/device-session/service/DefaultDeviceSessionService.ts b/packages/device-management-kit/src/internal/device-session/service/DefaultDeviceSessionService.ts similarity index 100% rename from packages/core/src/internal/device-session/service/DefaultDeviceSessionService.ts rename to packages/device-management-kit/src/internal/device-session/service/DefaultDeviceSessionService.ts diff --git a/packages/core/src/internal/device-session/service/DeviceSessionService.ts b/packages/device-management-kit/src/internal/device-session/service/DeviceSessionService.ts similarity index 68% rename from packages/core/src/internal/device-session/service/DeviceSessionService.ts rename to packages/device-management-kit/src/internal/device-session/service/DeviceSessionService.ts index 03991fc0b..1664f0c8c 100644 --- a/packages/core/src/internal/device-session/service/DeviceSessionService.ts +++ b/packages/device-management-kit/src/internal/device-session/service/DeviceSessionService.ts @@ -1,12 +1,12 @@ import { type Either } from "purify-ts"; -import { type SdkError } from "@api/Error"; +import { type DmkError } from "@api/Error"; import { type DeviceSession } from "@internal/device-session/model/DeviceSession"; export interface DeviceSessionService { addDeviceSession(deviceSession: DeviceSession): DeviceSessionService; - getDeviceSessionById(sessionId: string): Either; - getDeviceSessionByDeviceId(deviceId: string): Either; + getDeviceSessionById(sessionId: string): Either; + getDeviceSessionByDeviceId(deviceId: string): Either; removeDeviceSession(sessionId: string): DeviceSessionService; getDeviceSessions(): DeviceSession[]; } diff --git a/packages/core/src/internal/device-session/use-case/CloseSessionsUseCase.ts b/packages/device-management-kit/src/internal/device-session/use-case/CloseSessionsUseCase.ts similarity index 100% rename from packages/core/src/internal/device-session/use-case/CloseSessionsUseCase.ts rename to packages/device-management-kit/src/internal/device-session/use-case/CloseSessionsUseCase.ts diff --git a/packages/core/src/internal/device-session/use-case/CloseSessionsUseState.test.ts b/packages/device-management-kit/src/internal/device-session/use-case/CloseSessionsUseState.test.ts similarity index 100% rename from packages/core/src/internal/device-session/use-case/CloseSessionsUseState.test.ts rename to packages/device-management-kit/src/internal/device-session/use-case/CloseSessionsUseState.test.ts diff --git a/packages/core/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.ts b/packages/device-management-kit/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.ts similarity index 100% rename from packages/core/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.ts rename to packages/device-management-kit/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.ts diff --git a/packages/core/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.ts b/packages/device-management-kit/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.ts similarity index 100% rename from packages/core/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.ts rename to packages/device-management-kit/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.ts diff --git a/packages/core/src/internal/device-session/use-case/ListDeviceSessionsUseCase.test.ts b/packages/device-management-kit/src/internal/device-session/use-case/ListDeviceSessionsUseCase.test.ts similarity index 100% rename from packages/core/src/internal/device-session/use-case/ListDeviceSessionsUseCase.test.ts rename to packages/device-management-kit/src/internal/device-session/use-case/ListDeviceSessionsUseCase.test.ts diff --git a/packages/core/src/internal/device-session/use-case/ListDeviceSessionsUseCase.ts b/packages/device-management-kit/src/internal/device-session/use-case/ListDeviceSessionsUseCase.ts similarity index 100% rename from packages/core/src/internal/device-session/use-case/ListDeviceSessionsUseCase.ts rename to packages/device-management-kit/src/internal/device-session/use-case/ListDeviceSessionsUseCase.ts diff --git a/packages/core/src/internal/device-session/utils/FramerUtils.test.ts b/packages/device-management-kit/src/internal/device-session/utils/FramerUtils.test.ts similarity index 100% rename from packages/core/src/internal/device-session/utils/FramerUtils.test.ts rename to packages/device-management-kit/src/internal/device-session/utils/FramerUtils.test.ts diff --git a/packages/core/src/internal/device-session/utils/FramerUtils.ts b/packages/device-management-kit/src/internal/device-session/utils/FramerUtils.ts similarity index 100% rename from packages/core/src/internal/device-session/utils/FramerUtils.ts rename to packages/device-management-kit/src/internal/device-session/utils/FramerUtils.ts diff --git a/packages/core/src/internal/discovery/di/discoveryModule.test.ts b/packages/device-management-kit/src/internal/discovery/di/discoveryModule.test.ts similarity index 100% rename from packages/core/src/internal/discovery/di/discoveryModule.test.ts rename to packages/device-management-kit/src/internal/discovery/di/discoveryModule.test.ts diff --git a/packages/core/src/internal/discovery/di/discoveryModule.ts b/packages/device-management-kit/src/internal/discovery/di/discoveryModule.ts similarity index 100% rename from packages/core/src/internal/discovery/di/discoveryModule.ts rename to packages/device-management-kit/src/internal/discovery/di/discoveryModule.ts diff --git a/packages/core/src/internal/discovery/di/discoveryTypes.ts b/packages/device-management-kit/src/internal/discovery/di/discoveryTypes.ts similarity index 100% rename from packages/core/src/internal/discovery/di/discoveryTypes.ts rename to packages/device-management-kit/src/internal/discovery/di/discoveryTypes.ts diff --git a/packages/core/src/internal/discovery/use-case/ConnectUseCase.test.ts b/packages/device-management-kit/src/internal/discovery/use-case/ConnectUseCase.test.ts similarity index 100% rename from packages/core/src/internal/discovery/use-case/ConnectUseCase.test.ts rename to packages/device-management-kit/src/internal/discovery/use-case/ConnectUseCase.test.ts diff --git a/packages/core/src/internal/discovery/use-case/ConnectUseCase.ts b/packages/device-management-kit/src/internal/discovery/use-case/ConnectUseCase.ts similarity index 100% rename from packages/core/src/internal/discovery/use-case/ConnectUseCase.ts rename to packages/device-management-kit/src/internal/discovery/use-case/ConnectUseCase.ts diff --git a/packages/core/src/internal/discovery/use-case/DisconnectUseCase.test.ts b/packages/device-management-kit/src/internal/discovery/use-case/DisconnectUseCase.test.ts similarity index 100% rename from packages/core/src/internal/discovery/use-case/DisconnectUseCase.test.ts rename to packages/device-management-kit/src/internal/discovery/use-case/DisconnectUseCase.test.ts diff --git a/packages/core/src/internal/discovery/use-case/DisconnectUseCase.ts b/packages/device-management-kit/src/internal/discovery/use-case/DisconnectUseCase.ts similarity index 97% rename from packages/core/src/internal/discovery/use-case/DisconnectUseCase.ts rename to packages/device-management-kit/src/internal/discovery/use-case/DisconnectUseCase.ts index f376cd2a5..dfe0aabb1 100644 --- a/packages/core/src/internal/discovery/use-case/DisconnectUseCase.ts +++ b/packages/device-management-kit/src/internal/discovery/use-case/DisconnectUseCase.ts @@ -14,7 +14,7 @@ import { TransportNotSupportedError } from "@internal/transport/model/Errors"; */ export type DisconnectUseCaseArgs = { /** - * Device session identifier from `DeviceSdk.connect`. + * Device session identifier from `DeviceManagementKit.connect`. */ sessionId: DeviceSessionId; }; diff --git a/packages/core/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.ts b/packages/device-management-kit/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.ts similarity index 100% rename from packages/core/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.ts rename to packages/device-management-kit/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.ts diff --git a/packages/core/src/internal/discovery/use-case/GetConnectedDeviceUseCase.ts b/packages/device-management-kit/src/internal/discovery/use-case/GetConnectedDeviceUseCase.ts similarity index 100% rename from packages/core/src/internal/discovery/use-case/GetConnectedDeviceUseCase.ts rename to packages/device-management-kit/src/internal/discovery/use-case/GetConnectedDeviceUseCase.ts diff --git a/packages/core/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.ts b/packages/device-management-kit/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.ts similarity index 100% rename from packages/core/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.ts rename to packages/device-management-kit/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.ts diff --git a/packages/core/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.ts b/packages/device-management-kit/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.ts similarity index 100% rename from packages/core/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.ts rename to packages/device-management-kit/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.ts diff --git a/packages/core/src/internal/discovery/use-case/StartDiscoveringUseCase.test.ts b/packages/device-management-kit/src/internal/discovery/use-case/StartDiscoveringUseCase.test.ts similarity index 100% rename from packages/core/src/internal/discovery/use-case/StartDiscoveringUseCase.test.ts rename to packages/device-management-kit/src/internal/discovery/use-case/StartDiscoveringUseCase.test.ts diff --git a/packages/core/src/internal/discovery/use-case/StartDiscoveringUseCase.ts b/packages/device-management-kit/src/internal/discovery/use-case/StartDiscoveringUseCase.ts similarity index 100% rename from packages/core/src/internal/discovery/use-case/StartDiscoveringUseCase.ts rename to packages/device-management-kit/src/internal/discovery/use-case/StartDiscoveringUseCase.ts diff --git a/packages/core/src/internal/discovery/use-case/StopDiscoveringUseCase.test.ts b/packages/device-management-kit/src/internal/discovery/use-case/StopDiscoveringUseCase.test.ts similarity index 100% rename from packages/core/src/internal/discovery/use-case/StopDiscoveringUseCase.test.ts rename to packages/device-management-kit/src/internal/discovery/use-case/StopDiscoveringUseCase.test.ts diff --git a/packages/core/src/internal/discovery/use-case/StopDiscoveringUseCase.ts b/packages/device-management-kit/src/internal/discovery/use-case/StopDiscoveringUseCase.ts similarity index 100% rename from packages/core/src/internal/discovery/use-case/StopDiscoveringUseCase.ts rename to packages/device-management-kit/src/internal/discovery/use-case/StopDiscoveringUseCase.ts diff --git a/packages/core/src/internal/logger-publisher/di/loggerModule.test.ts b/packages/device-management-kit/src/internal/logger-publisher/di/loggerModule.test.ts similarity index 100% rename from packages/core/src/internal/logger-publisher/di/loggerModule.test.ts rename to packages/device-management-kit/src/internal/logger-publisher/di/loggerModule.test.ts diff --git a/packages/core/src/internal/logger-publisher/di/loggerModule.ts b/packages/device-management-kit/src/internal/logger-publisher/di/loggerModule.ts similarity index 100% rename from packages/core/src/internal/logger-publisher/di/loggerModule.ts rename to packages/device-management-kit/src/internal/logger-publisher/di/loggerModule.ts diff --git a/packages/core/src/internal/logger-publisher/di/loggerTypes.ts b/packages/device-management-kit/src/internal/logger-publisher/di/loggerTypes.ts similarity index 100% rename from packages/core/src/internal/logger-publisher/di/loggerTypes.ts rename to packages/device-management-kit/src/internal/logger-publisher/di/loggerTypes.ts diff --git a/packages/core/src/internal/logger-publisher/model/LogPublisherOptions.ts b/packages/device-management-kit/src/internal/logger-publisher/model/LogPublisherOptions.ts similarity index 100% rename from packages/core/src/internal/logger-publisher/model/LogPublisherOptions.ts rename to packages/device-management-kit/src/internal/logger-publisher/model/LogPublisherOptions.ts diff --git a/packages/core/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.ts b/packages/device-management-kit/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.ts similarity index 100% rename from packages/core/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.ts rename to packages/device-management-kit/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.ts diff --git a/packages/core/src/internal/logger-publisher/service/DefaultLoggerPublisherService.ts b/packages/device-management-kit/src/internal/logger-publisher/service/DefaultLoggerPublisherService.ts similarity index 100% rename from packages/core/src/internal/logger-publisher/service/DefaultLoggerPublisherService.ts rename to packages/device-management-kit/src/internal/logger-publisher/service/DefaultLoggerPublisherService.ts diff --git a/packages/core/src/internal/logger-publisher/service/LoggerPublisherService.ts b/packages/device-management-kit/src/internal/logger-publisher/service/LoggerPublisherService.ts similarity index 100% rename from packages/core/src/internal/logger-publisher/service/LoggerPublisherService.ts rename to packages/device-management-kit/src/internal/logger-publisher/service/LoggerPublisherService.ts diff --git a/packages/core/src/internal/logger-publisher/service/__mocks__/DefaultLoggerService.ts b/packages/device-management-kit/src/internal/logger-publisher/service/__mocks__/DefaultLoggerService.ts similarity index 100% rename from packages/core/src/internal/logger-publisher/service/__mocks__/DefaultLoggerService.ts rename to packages/device-management-kit/src/internal/logger-publisher/service/__mocks__/DefaultLoggerService.ts diff --git a/packages/core/src/internal/manager-api/data/AxiosManagerApiDataSource.test.ts b/packages/device-management-kit/src/internal/manager-api/data/AxiosManagerApiDataSource.test.ts similarity index 100% rename from packages/core/src/internal/manager-api/data/AxiosManagerApiDataSource.test.ts rename to packages/device-management-kit/src/internal/manager-api/data/AxiosManagerApiDataSource.test.ts diff --git a/packages/core/src/internal/manager-api/data/AxiosManagerApiDataSource.ts b/packages/device-management-kit/src/internal/manager-api/data/AxiosManagerApiDataSource.ts similarity index 94% rename from packages/core/src/internal/manager-api/data/AxiosManagerApiDataSource.ts rename to packages/device-management-kit/src/internal/manager-api/data/AxiosManagerApiDataSource.ts index c586991a3..8b380f4fd 100644 --- a/packages/core/src/internal/manager-api/data/AxiosManagerApiDataSource.ts +++ b/packages/device-management-kit/src/internal/manager-api/data/AxiosManagerApiDataSource.ts @@ -2,7 +2,7 @@ import axios from "axios"; import { inject, injectable } from "inversify"; import { EitherAsync } from "purify-ts"; -import { type SdkConfig } from "@api/SdkConfig"; +import { type DmkConfig } from "@api/DmkConfig"; import { managerApiTypes } from "@internal/manager-api/di/managerApiTypes"; import { HttpFetchApiError } from "@internal/manager-api/model/Errors"; import { @@ -16,7 +16,7 @@ import { ApplicationDto, AppTypeDto } from "./ManagerApiDto"; @injectable() export class AxiosManagerApiDataSource implements ManagerApiDataSource { private readonly baseUrl: string; - constructor(@inject(managerApiTypes.SdkConfig) config: SdkConfig) { + constructor(@inject(managerApiTypes.DmkConfig) config: DmkConfig) { this.baseUrl = config.managerApiUrl; } diff --git a/packages/core/src/internal/manager-api/data/ManagerApiDataSource.ts b/packages/device-management-kit/src/internal/manager-api/data/ManagerApiDataSource.ts similarity index 100% rename from packages/core/src/internal/manager-api/data/ManagerApiDataSource.ts rename to packages/device-management-kit/src/internal/manager-api/data/ManagerApiDataSource.ts diff --git a/packages/core/src/internal/manager-api/data/ManagerApiDto.ts b/packages/device-management-kit/src/internal/manager-api/data/ManagerApiDto.ts similarity index 100% rename from packages/core/src/internal/manager-api/data/ManagerApiDto.ts rename to packages/device-management-kit/src/internal/manager-api/data/ManagerApiDto.ts diff --git a/packages/core/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.ts b/packages/device-management-kit/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.ts similarity index 100% rename from packages/core/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.ts rename to packages/device-management-kit/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.ts diff --git a/packages/core/src/internal/manager-api/di/managerApiModule.test.ts b/packages/device-management-kit/src/internal/manager-api/di/managerApiModule.test.ts similarity index 95% rename from packages/core/src/internal/manager-api/di/managerApiModule.test.ts rename to packages/device-management-kit/src/internal/manager-api/di/managerApiModule.test.ts index 3ac9bc47c..f0425dea6 100644 --- a/packages/core/src/internal/manager-api/di/managerApiModule.test.ts +++ b/packages/device-management-kit/src/internal/manager-api/di/managerApiModule.test.ts @@ -39,7 +39,7 @@ describe("managerApiModuleFactory", () => { ); expect(managerApiService).toBeInstanceOf(DefaultManagerApiService); - const config = container.get(managerApiTypes.SdkConfig); + const config = container.get(managerApiTypes.DmkConfig); expect(config).toEqual({ managerApiUrl: "http://fake.url", mockUrl: "http://fake-mock.url", @@ -77,7 +77,7 @@ describe("managerApiModuleFactory", () => { ); expect(managerApiService).toBeInstanceOf(StubUseCase); - const config = container.get(managerApiTypes.SdkConfig); + const config = container.get(managerApiTypes.DmkConfig); expect(config).toEqual({ managerApiUrl: "http://fake.url", mockUrl: "http://fake-mock.url", diff --git a/packages/core/src/internal/manager-api/di/managerApiModule.ts b/packages/device-management-kit/src/internal/manager-api/di/managerApiModule.ts similarity index 86% rename from packages/core/src/internal/manager-api/di/managerApiModule.ts rename to packages/device-management-kit/src/internal/manager-api/di/managerApiModule.ts index 34bee075d..0e4ae5512 100644 --- a/packages/core/src/internal/manager-api/di/managerApiModule.ts +++ b/packages/device-management-kit/src/internal/manager-api/di/managerApiModule.ts @@ -1,6 +1,6 @@ import { ContainerModule } from "inversify"; -import { type SdkConfig } from "@api/SdkConfig"; +import { type DmkConfig } from "@api/DmkConfig"; import { AxiosManagerApiDataSource } from "@internal/manager-api/data/AxiosManagerApiDataSource"; import { DefaultManagerApiService } from "@internal/manager-api/service/DefaultManagerApiService"; import { StubUseCase } from "@root/src/di.stub"; @@ -9,12 +9,12 @@ import { managerApiTypes } from "./managerApiTypes"; type FactoryProps = { stub?: boolean; - config: SdkConfig; + config: DmkConfig; }; export const managerApiModuleFactory = ({ stub, config }: FactoryProps) => new ContainerModule((bind, _unbind, _isBound, rebind) => { - bind(managerApiTypes.SdkConfig).toConstantValue(config); + bind(managerApiTypes.DmkConfig).toConstantValue(config); bind(managerApiTypes.ManagerApiDataSource).to(AxiosManagerApiDataSource); bind(managerApiTypes.ManagerApiService).to(DefaultManagerApiService); diff --git a/packages/core/src/internal/manager-api/di/managerApiTypes.ts b/packages/device-management-kit/src/internal/manager-api/di/managerApiTypes.ts similarity index 75% rename from packages/core/src/internal/manager-api/di/managerApiTypes.ts rename to packages/device-management-kit/src/internal/manager-api/di/managerApiTypes.ts index b2d99ae52..09fbc59df 100644 --- a/packages/core/src/internal/manager-api/di/managerApiTypes.ts +++ b/packages/device-management-kit/src/internal/manager-api/di/managerApiTypes.ts @@ -1,5 +1,5 @@ export const managerApiTypes = { ManagerApiService: Symbol.for("ManagerApiService"), ManagerApiDataSource: Symbol.for("ManagerApiDataSource"), - SdkConfig: Symbol.for("ManagerApiSdkConfig"), + DmkConfig: Symbol.for("ManagerApiDmkConfig"), }; diff --git a/packages/core/src/internal/manager-api/model/Const.ts b/packages/device-management-kit/src/internal/manager-api/model/Const.ts similarity index 100% rename from packages/core/src/internal/manager-api/model/Const.ts rename to packages/device-management-kit/src/internal/manager-api/model/Const.ts diff --git a/packages/core/src/internal/manager-api/model/Errors.ts b/packages/device-management-kit/src/internal/manager-api/model/Errors.ts similarity index 58% rename from packages/core/src/internal/manager-api/model/Errors.ts rename to packages/device-management-kit/src/internal/manager-api/model/Errors.ts index 4b3781c30..915f76559 100644 --- a/packages/core/src/internal/manager-api/model/Errors.ts +++ b/packages/device-management-kit/src/internal/manager-api/model/Errors.ts @@ -1,6 +1,6 @@ -import { type SdkError } from "@api/Error"; +import { type DmkError } from "@api/Error"; -export class HttpFetchApiError implements SdkError { +export class HttpFetchApiError implements DmkError { _tag = "FetchError"; originalError?: unknown; diff --git a/packages/core/src/internal/manager-api/model/ManagerApiType.ts b/packages/device-management-kit/src/internal/manager-api/model/ManagerApiType.ts similarity index 100% rename from packages/core/src/internal/manager-api/model/ManagerApiType.ts rename to packages/device-management-kit/src/internal/manager-api/model/ManagerApiType.ts diff --git a/packages/core/src/internal/manager-api/service/DefaultManagerApiService.test.ts b/packages/device-management-kit/src/internal/manager-api/service/DefaultManagerApiService.test.ts similarity index 100% rename from packages/core/src/internal/manager-api/service/DefaultManagerApiService.test.ts rename to packages/device-management-kit/src/internal/manager-api/service/DefaultManagerApiService.test.ts diff --git a/packages/core/src/internal/manager-api/service/DefaultManagerApiService.ts b/packages/device-management-kit/src/internal/manager-api/service/DefaultManagerApiService.ts similarity index 100% rename from packages/core/src/internal/manager-api/service/DefaultManagerApiService.ts rename to packages/device-management-kit/src/internal/manager-api/service/DefaultManagerApiService.ts diff --git a/packages/core/src/internal/manager-api/service/ManagerApiService.ts b/packages/device-management-kit/src/internal/manager-api/service/ManagerApiService.ts similarity index 100% rename from packages/core/src/internal/manager-api/service/ManagerApiService.ts rename to packages/device-management-kit/src/internal/manager-api/service/ManagerApiService.ts diff --git a/packages/core/src/internal/send/di/sendModule.test.ts b/packages/device-management-kit/src/internal/send/di/sendModule.test.ts similarity index 100% rename from packages/core/src/internal/send/di/sendModule.test.ts rename to packages/device-management-kit/src/internal/send/di/sendModule.test.ts diff --git a/packages/core/src/internal/send/di/sendModule.ts b/packages/device-management-kit/src/internal/send/di/sendModule.ts similarity index 100% rename from packages/core/src/internal/send/di/sendModule.ts rename to packages/device-management-kit/src/internal/send/di/sendModule.ts diff --git a/packages/core/src/internal/send/di/sendTypes.ts b/packages/device-management-kit/src/internal/send/di/sendTypes.ts similarity index 100% rename from packages/core/src/internal/send/di/sendTypes.ts rename to packages/device-management-kit/src/internal/send/di/sendTypes.ts diff --git a/packages/core/src/internal/send/use-case/SendApduUseCase.test.ts b/packages/device-management-kit/src/internal/send/use-case/SendApduUseCase.test.ts similarity index 100% rename from packages/core/src/internal/send/use-case/SendApduUseCase.test.ts rename to packages/device-management-kit/src/internal/send/use-case/SendApduUseCase.test.ts diff --git a/packages/core/src/internal/send/use-case/SendApduUseCase.ts b/packages/device-management-kit/src/internal/send/use-case/SendApduUseCase.ts similarity index 97% rename from packages/core/src/internal/send/use-case/SendApduUseCase.ts rename to packages/device-management-kit/src/internal/send/use-case/SendApduUseCase.ts index 84ff963d0..d730d2001 100644 --- a/packages/core/src/internal/send/use-case/SendApduUseCase.ts +++ b/packages/device-management-kit/src/internal/send/use-case/SendApduUseCase.ts @@ -12,7 +12,7 @@ import { LoggerPublisherService } from "@internal/logger-publisher/service/Logge */ export type SendApduUseCaseArgs = { /** - * Device session identifier from `DeviceSdk.connect`. + * Device session identifier from `DeviceManagementKit.connect`. */ sessionId: DeviceSessionId; /** diff --git a/packages/core/src/internal/transport/ble/di/bleDiTypes.ts b/packages/device-management-kit/src/internal/transport/ble/di/bleDiTypes.ts similarity index 100% rename from packages/core/src/internal/transport/ble/di/bleDiTypes.ts rename to packages/device-management-kit/src/internal/transport/ble/di/bleDiTypes.ts diff --git a/packages/core/src/internal/transport/ble/di/bleModule.test.ts b/packages/device-management-kit/src/internal/transport/ble/di/bleModule.test.ts similarity index 100% rename from packages/core/src/internal/transport/ble/di/bleModule.test.ts rename to packages/device-management-kit/src/internal/transport/ble/di/bleModule.test.ts diff --git a/packages/core/src/internal/transport/ble/di/bleModule.ts b/packages/device-management-kit/src/internal/transport/ble/di/bleModule.ts similarity index 100% rename from packages/core/src/internal/transport/ble/di/bleModule.ts rename to packages/device-management-kit/src/internal/transport/ble/di/bleModule.ts diff --git a/packages/core/src/internal/transport/ble/model/BleDevice.stub.ts b/packages/device-management-kit/src/internal/transport/ble/model/BleDevice.stub.ts similarity index 100% rename from packages/core/src/internal/transport/ble/model/BleDevice.stub.ts rename to packages/device-management-kit/src/internal/transport/ble/model/BleDevice.stub.ts diff --git a/packages/core/src/internal/transport/ble/model/BleDeviceInfos.ts b/packages/device-management-kit/src/internal/transport/ble/model/BleDeviceInfos.ts similarity index 100% rename from packages/core/src/internal/transport/ble/model/BleDeviceInfos.ts rename to packages/device-management-kit/src/internal/transport/ble/model/BleDeviceInfos.ts diff --git a/packages/core/src/internal/transport/ble/service/BleDeviceConnectionFactory.stub.ts b/packages/device-management-kit/src/internal/transport/ble/service/BleDeviceConnectionFactory.stub.ts similarity index 100% rename from packages/core/src/internal/transport/ble/service/BleDeviceConnectionFactory.stub.ts rename to packages/device-management-kit/src/internal/transport/ble/service/BleDeviceConnectionFactory.stub.ts diff --git a/packages/core/src/internal/transport/ble/service/BleDeviceConnectionFactory.ts b/packages/device-management-kit/src/internal/transport/ble/service/BleDeviceConnectionFactory.ts similarity index 100% rename from packages/core/src/internal/transport/ble/service/BleDeviceConnectionFactory.ts rename to packages/device-management-kit/src/internal/transport/ble/service/BleDeviceConnectionFactory.ts diff --git a/packages/core/src/internal/transport/ble/transport/BleDeviceConnection.test.ts b/packages/device-management-kit/src/internal/transport/ble/transport/BleDeviceConnection.test.ts similarity index 100% rename from packages/core/src/internal/transport/ble/transport/BleDeviceConnection.test.ts rename to packages/device-management-kit/src/internal/transport/ble/transport/BleDeviceConnection.test.ts diff --git a/packages/core/src/internal/transport/ble/transport/BleDeviceConnection.ts b/packages/device-management-kit/src/internal/transport/ble/transport/BleDeviceConnection.ts similarity index 95% rename from packages/core/src/internal/transport/ble/transport/BleDeviceConnection.ts rename to packages/device-management-kit/src/internal/transport/ble/transport/BleDeviceConnection.ts index c171972fc..baaa2e642 100644 --- a/packages/core/src/internal/transport/ble/transport/BleDeviceConnection.ts +++ b/packages/device-management-kit/src/internal/transport/ble/transport/BleDeviceConnection.ts @@ -2,7 +2,7 @@ import { type Either, Left, Maybe, Nothing, Right } from "purify-ts"; import { CommandUtils } from "@api/command/utils/CommandUtils"; import { type ApduResponse } from "@api/device-session/ApduResponse"; -import { type SdkError } from "@api/Error"; +import { type DmkError } from "@api/Error"; import { type ApduReceiverService } from "@internal/device-session/service/ApduReceiverService"; import { type ApduSenderService } from "@internal/device-session/service/ApduSenderService"; import { type DefaultApduSenderServiceConstructorArgs } from "@internal/device-session/service/DefaultApduSenderService"; @@ -39,11 +39,11 @@ export class BleDeviceConnection implements DeviceConnection { private readonly _apduReceiver: ApduReceiverService; private _isDeviceReady: boolean; private _sendApduPromiseResolver: Maybe<{ - resolve(value: Either): void; + resolve(value: Either): void; }>; private _settleReconnectionPromiseResolvers: Maybe<{ resolve(): void; - reject(err: SdkError): void; + reject(err: DmkError): void; }>; constructor( @@ -184,14 +184,14 @@ export class BleDeviceConnection implements DeviceConnection { async sendApdu( apdu: Uint8Array, triggersDisconnection?: boolean, - ): Promise> { + ): Promise> { if (!this._isDeviceReady) { return Promise.resolve( Left(new DeviceNotInitializedError("Unknown MTU")), ); } // Create a promise that would be resolved once the response had been received - const resultPromise = new Promise>( + const resultPromise = new Promise>( (resolve) => { this._sendApduPromiseResolver = Maybe.of({ resolve, @@ -251,11 +251,11 @@ export class BleDeviceConnection implements DeviceConnection { * * @private */ - private setupWaitForReconnection(): Promise> { - return new Promise>((resolve) => { + private setupWaitForReconnection(): Promise> { + return new Promise>((resolve) => { this._settleReconnectionPromiseResolvers = Maybe.of({ resolve: () => resolve(Right(undefined)), - reject: (error: SdkError) => resolve(Left(error)), + reject: (error: DmkError) => resolve(Left(error)), }); }); } diff --git a/packages/core/src/internal/transport/ble/transport/WebBleTransport.test.ts b/packages/device-management-kit/src/internal/transport/ble/transport/WebBleTransport.test.ts similarity index 100% rename from packages/core/src/internal/transport/ble/transport/WebBleTransport.test.ts rename to packages/device-management-kit/src/internal/transport/ble/transport/WebBleTransport.test.ts diff --git a/packages/core/src/internal/transport/ble/transport/WebBleTransport.ts b/packages/device-management-kit/src/internal/transport/ble/transport/WebBleTransport.ts similarity index 99% rename from packages/core/src/internal/transport/ble/transport/WebBleTransport.ts rename to packages/device-management-kit/src/internal/transport/ble/transport/WebBleTransport.ts index 631ce4d37..06491abf8 100644 --- a/packages/core/src/internal/transport/ble/transport/WebBleTransport.ts +++ b/packages/device-management-kit/src/internal/transport/ble/transport/WebBleTransport.ts @@ -5,7 +5,7 @@ import { v4 as uuid } from "uuid"; import { DeviceId } from "@api/device/DeviceModel"; import { ConnectionType } from "@api/discovery/ConnectionType"; -import { SdkError } from "@api/Error"; +import { DmkError } from "@api/Error"; import { Transport } from "@api/transport/model/Transport"; import { BuiltinTransports, @@ -397,7 +397,7 @@ export class WebBleTransport implements Transport { */ async disconnect(params: { connectedDevice: InternalConnectedDevice; - }): Promise> { + }): Promise> { // retrieve internal device const maybeInternalDevice = Maybe.fromNullable( this._internalDevicesById.get(params.connectedDevice.id), diff --git a/packages/core/src/internal/transport/ble/transport/__mocks__/WebBleTransport.ts b/packages/device-management-kit/src/internal/transport/ble/transport/__mocks__/WebBleTransport.ts similarity index 100% rename from packages/core/src/internal/transport/ble/transport/__mocks__/WebBleTransport.ts rename to packages/device-management-kit/src/internal/transport/ble/transport/__mocks__/WebBleTransport.ts diff --git a/packages/core/src/internal/transport/data/TransportDataSource.ts b/packages/device-management-kit/src/internal/transport/data/TransportDataSource.ts similarity index 100% rename from packages/core/src/internal/transport/data/TransportDataSource.ts rename to packages/device-management-kit/src/internal/transport/data/TransportDataSource.ts diff --git a/packages/core/src/internal/transport/di/transportDiTypes.ts b/packages/device-management-kit/src/internal/transport/di/transportDiTypes.ts similarity index 61% rename from packages/core/src/internal/transport/di/transportDiTypes.ts rename to packages/device-management-kit/src/internal/transport/di/transportDiTypes.ts index 65042ee11..5bba8cebe 100644 --- a/packages/core/src/internal/transport/di/transportDiTypes.ts +++ b/packages/device-management-kit/src/internal/transport/di/transportDiTypes.ts @@ -1,4 +1,4 @@ export const transportDiTypes = { Transport: Symbol.for("Transport"), - SdkConfig: Symbol.for("TransportSdkConfig"), + DmkConfig: Symbol.for("TransportDmkConfig"), }; diff --git a/packages/core/src/internal/transport/di/transportModule.ts b/packages/device-management-kit/src/internal/transport/di/transportModule.ts similarity index 88% rename from packages/core/src/internal/transport/di/transportModule.ts rename to packages/device-management-kit/src/internal/transport/di/transportModule.ts index 1c13db607..b85737287 100644 --- a/packages/core/src/internal/transport/di/transportModule.ts +++ b/packages/device-management-kit/src/internal/transport/di/transportModule.ts @@ -1,6 +1,6 @@ import { ContainerModule } from "inversify"; -import { type SdkConfig } from "@api/SdkConfig"; +import { type DmkConfig } from "@api/DmkConfig"; import { type Transport } from "@api/transport/model/Transport"; import { type BuiltinTransports } from "@api/transport/model/TransportIdentifier"; import { TransportDataSource } from "@internal/transport/data/TransportDataSource"; @@ -11,7 +11,7 @@ type FactoryProps = { stub: boolean; transports: BuiltinTransports[]; customTransports: Transport[]; - config: SdkConfig; + config: DmkConfig; }; export const transportModuleFactory = ({ @@ -29,7 +29,7 @@ export const transportModuleFactory = ({ for (const transport of customTransports) { bind(transportDiTypes.Transport).toConstantValue(transport); } - bind(transportDiTypes.SdkConfig).toConstantValue(config); + bind(transportDiTypes.DmkConfig).toConstantValue(config); if (stub) { // Add stubs here } diff --git a/packages/core/src/internal/transport/mockserver/MockserverTransport.ts b/packages/device-management-kit/src/internal/transport/mockserver/MockserverTransport.ts similarity index 94% rename from packages/core/src/internal/transport/mockserver/MockserverTransport.ts rename to packages/device-management-kit/src/internal/transport/mockserver/MockserverTransport.ts index 5bc792f8e..454184711 100644 --- a/packages/core/src/internal/transport/mockserver/MockserverTransport.ts +++ b/packages/device-management-kit/src/internal/transport/mockserver/MockserverTransport.ts @@ -5,15 +5,15 @@ import { Device, MockClient, Session, -} from "@ledgerhq/device-sdk-transport-mock"; +} from "@ledgerhq/device-transport-kit-mock-client"; import { inject, injectable } from "inversify"; import { Either, Left, Right } from "purify-ts"; import { from, mergeMap, Observable } from "rxjs"; import { DeviceId } from "@api/device/DeviceModel"; import { ApduResponse } from "@api/device-session/ApduResponse"; -import { SdkError } from "@api/Error"; -import type { SdkConfig } from "@api/SdkConfig"; +import type { DmkConfig } from "@api/DmkConfig"; +import { DmkError } from "@api/Error"; import { Transport } from "@api/transport/model/Transport"; import { BuiltinTransports, @@ -42,7 +42,7 @@ export class MockTransport implements Transport { constructor( @inject(loggerTypes.LoggerPublisherServiceFactory) loggerServiceFactory: (tag: string) => LoggerPublisherService, - @inject(transportDiTypes.SdkConfig) config: SdkConfig, + @inject(transportDiTypes.DmkConfig) config: DmkConfig, ) { this.logger = loggerServiceFactory("MockTransport"); this.mockClient = new MockClient(config.mockUrl); @@ -134,7 +134,7 @@ export class MockTransport implements Transport { async disconnect(params: { connectedDevice: InternalConnectedDevice; - }): Promise> { + }): Promise> { this.logger.debug("disconnect"); const sessionId: string = params.connectedDevice.id; try { @@ -155,7 +155,7 @@ export class MockTransport implements Transport { deviceId: DeviceId, onDisconnect: DisconnectHandler, apdu: Uint8Array, - ): Promise> { + ): Promise> { this.logger.debug("send"); try { const response: CommandResponse = await this.mockClient.send( diff --git a/packages/core/src/internal/transport/model/DeviceConnection.ts b/packages/device-management-kit/src/internal/transport/model/DeviceConnection.ts similarity index 81% rename from packages/core/src/internal/transport/model/DeviceConnection.ts rename to packages/device-management-kit/src/internal/transport/model/DeviceConnection.ts index 4d1b68605..f0ce8a9a8 100644 --- a/packages/core/src/internal/transport/model/DeviceConnection.ts +++ b/packages/device-management-kit/src/internal/transport/model/DeviceConnection.ts @@ -2,14 +2,14 @@ import { type Either } from "purify-ts"; import { type DeviceId } from "@api/device/DeviceModel"; import { type ApduResponse } from "@api/device-session/ApduResponse"; -import { type SdkError } from "@api/Error"; +import { type DmkError } from "@api/Error"; export type DisconnectHandler = (deviceId: DeviceId) => void; export type SendApduFnType = ( apdu: Uint8Array, triggersDisconnection?: boolean, -) => Promise>; +) => Promise>; export interface DeviceConnection { sendApdu: SendApduFnType; diff --git a/packages/core/src/internal/transport/model/Errors.ts b/packages/device-management-kit/src/internal/transport/model/Errors.ts similarity index 68% rename from packages/core/src/internal/transport/model/Errors.ts rename to packages/device-management-kit/src/internal/transport/model/Errors.ts index ead13153a..037fbb8b2 100644 --- a/packages/core/src/internal/transport/model/Errors.ts +++ b/packages/device-management-kit/src/internal/transport/model/Errors.ts @@ -1,4 +1,4 @@ -import { type SdkError } from "@api/Error"; +import { type DmkError } from "@api/Error"; export type PromptDeviceAccessError = | UsbHidTransportNotSupportedError @@ -10,8 +10,8 @@ export type ConnectError = | OpeningConnectionError | DeviceAlreadyConnectedError; -class GeneralSdkError implements SdkError { - _tag = "GeneralSdkError"; +class GeneralDmkError implements DmkError { + _tag = "GeneralDmkError"; originalError?: unknown; constructor(err?: unknown) { if (err instanceof Error) { @@ -22,98 +22,98 @@ class GeneralSdkError implements SdkError { } } -export class DeviceNotRecognizedError extends GeneralSdkError { +export class DeviceNotRecognizedError extends GeneralDmkError { override readonly _tag = "DeviceNotRecognizedError"; constructor(readonly err?: unknown) { super(err); } } -export class NoAccessibleDeviceError extends GeneralSdkError { +export class NoAccessibleDeviceError extends GeneralDmkError { override readonly _tag = "NoAccessibleDeviceError"; constructor(readonly err?: unknown) { super(err); } } -export class OpeningConnectionError extends GeneralSdkError { +export class OpeningConnectionError extends GeneralDmkError { override readonly _tag = "ConnectionOpeningError"; constructor(readonly err?: unknown) { super(err); } } -export class UnknownDeviceError extends GeneralSdkError { +export class UnknownDeviceError extends GeneralDmkError { override readonly _tag = "UnknownDeviceError"; constructor(readonly err?: unknown) { super(err); } } -export class TransportNotSupportedError extends GeneralSdkError { +export class TransportNotSupportedError extends GeneralDmkError { override readonly _tag = "TransportNotSupportedError"; constructor(readonly err?: unknown) { super(err); } } -export class BleTransportNotSupportedError extends GeneralSdkError { +export class BleTransportNotSupportedError extends GeneralDmkError { override readonly _tag = "BleTransportNotSupportedError"; constructor(readonly err?: unknown) { super(err); } } -export class UsbHidTransportNotSupportedError extends GeneralSdkError { +export class UsbHidTransportNotSupportedError extends GeneralDmkError { override readonly _tag = "UsbHidTransportNotSupportedError"; constructor(readonly err?: unknown) { super(err); } } -export class SendApduConcurrencyError extends GeneralSdkError { +export class SendApduConcurrencyError extends GeneralDmkError { override readonly _tag = "SendApduConcurrencyError"; constructor(readonly err?: unknown) { super(err); } } -export class DisconnectError extends GeneralSdkError { +export class DisconnectError extends GeneralDmkError { override readonly _tag = "DisconnectError"; constructor(readonly err?: unknown) { super(err); } } -export class ReconnectionFailedError extends GeneralSdkError { +export class ReconnectionFailedError extends GeneralDmkError { override readonly _tag = "ReconnectionFailedError"; constructor(readonly err?: unknown) { super(err); } } -export class HidSendReportError extends GeneralSdkError { +export class HidSendReportError extends GeneralDmkError { override readonly _tag = "HidSendReportError"; constructor(readonly err?: unknown) { super(err); } } -export class DeviceNotInitializedError extends GeneralSdkError { +export class DeviceNotInitializedError extends GeneralDmkError { override readonly _tag = "DeviceNotInitializedError"; constructor(readonly err?: unknown) { super(err); } } -export class BleDeviceGattServerError extends GeneralSdkError { +export class BleDeviceGattServerError extends GeneralDmkError { override readonly _tag = "BleDeviceGattServerError"; constructor(readonly err?: unknown) { super(err); } } -export class DeviceAlreadyConnectedError extends GeneralSdkError { +export class DeviceAlreadyConnectedError extends GeneralDmkError { override readonly _tag = "DeviceAlreadyDiscoveredError"; constructor(readonly err?: unknown) { super(err); diff --git a/packages/core/src/internal/transport/model/InternalConnectedDevice.stub.ts b/packages/device-management-kit/src/internal/transport/model/InternalConnectedDevice.stub.ts similarity index 100% rename from packages/core/src/internal/transport/model/InternalConnectedDevice.stub.ts rename to packages/device-management-kit/src/internal/transport/model/InternalConnectedDevice.stub.ts diff --git a/packages/core/src/internal/transport/model/InternalConnectedDevice.test.ts b/packages/device-management-kit/src/internal/transport/model/InternalConnectedDevice.test.ts similarity index 100% rename from packages/core/src/internal/transport/model/InternalConnectedDevice.test.ts rename to packages/device-management-kit/src/internal/transport/model/InternalConnectedDevice.test.ts diff --git a/packages/core/src/internal/transport/model/InternalConnectedDevice.ts b/packages/device-management-kit/src/internal/transport/model/InternalConnectedDevice.ts similarity index 100% rename from packages/core/src/internal/transport/model/InternalConnectedDevice.ts rename to packages/device-management-kit/src/internal/transport/model/InternalConnectedDevice.ts diff --git a/packages/core/src/internal/transport/model/InternalDiscoveredDevice.ts b/packages/device-management-kit/src/internal/transport/model/InternalDiscoveredDevice.ts similarity index 100% rename from packages/core/src/internal/transport/model/InternalDiscoveredDevice.ts rename to packages/device-management-kit/src/internal/transport/model/InternalDiscoveredDevice.ts diff --git a/packages/core/src/internal/transport/usb/data/UsbHidConfig.ts b/packages/device-management-kit/src/internal/transport/usb/data/UsbHidConfig.ts similarity index 100% rename from packages/core/src/internal/transport/usb/data/UsbHidConfig.ts rename to packages/device-management-kit/src/internal/transport/usb/data/UsbHidConfig.ts diff --git a/packages/core/src/internal/transport/usb/di/usbDiTypes.ts b/packages/device-management-kit/src/internal/transport/usb/di/usbDiTypes.ts similarity index 100% rename from packages/core/src/internal/transport/usb/di/usbDiTypes.ts rename to packages/device-management-kit/src/internal/transport/usb/di/usbDiTypes.ts diff --git a/packages/core/src/internal/transport/usb/di/usbModule.test.ts b/packages/device-management-kit/src/internal/transport/usb/di/usbModule.test.ts similarity index 100% rename from packages/core/src/internal/transport/usb/di/usbModule.test.ts rename to packages/device-management-kit/src/internal/transport/usb/di/usbModule.test.ts diff --git a/packages/core/src/internal/transport/usb/di/usbModule.ts b/packages/device-management-kit/src/internal/transport/usb/di/usbModule.ts similarity index 100% rename from packages/core/src/internal/transport/usb/di/usbModule.ts rename to packages/device-management-kit/src/internal/transport/usb/di/usbModule.ts diff --git a/packages/core/src/internal/transport/usb/model/HIDDevice.stub.ts b/packages/device-management-kit/src/internal/transport/usb/model/HIDDevice.stub.ts similarity index 100% rename from packages/core/src/internal/transport/usb/model/HIDDevice.stub.ts rename to packages/device-management-kit/src/internal/transport/usb/model/HIDDevice.stub.ts diff --git a/packages/core/src/internal/transport/usb/service/UsbHidDeviceConnectionFactory.stub.ts b/packages/device-management-kit/src/internal/transport/usb/service/UsbHidDeviceConnectionFactory.stub.ts similarity index 100% rename from packages/core/src/internal/transport/usb/service/UsbHidDeviceConnectionFactory.stub.ts rename to packages/device-management-kit/src/internal/transport/usb/service/UsbHidDeviceConnectionFactory.stub.ts diff --git a/packages/core/src/internal/transport/usb/service/UsbHidDeviceConnectionFactory.ts b/packages/device-management-kit/src/internal/transport/usb/service/UsbHidDeviceConnectionFactory.ts similarity index 100% rename from packages/core/src/internal/transport/usb/service/UsbHidDeviceConnectionFactory.ts rename to packages/device-management-kit/src/internal/transport/usb/service/UsbHidDeviceConnectionFactory.ts diff --git a/packages/core/src/internal/transport/usb/transport/UsbHidDeviceConnection.test.ts b/packages/device-management-kit/src/internal/transport/usb/transport/UsbHidDeviceConnection.test.ts similarity index 100% rename from packages/core/src/internal/transport/usb/transport/UsbHidDeviceConnection.test.ts rename to packages/device-management-kit/src/internal/transport/usb/transport/UsbHidDeviceConnection.test.ts diff --git a/packages/core/src/internal/transport/usb/transport/UsbHidDeviceConnection.ts b/packages/device-management-kit/src/internal/transport/usb/transport/UsbHidDeviceConnection.ts similarity index 95% rename from packages/core/src/internal/transport/usb/transport/UsbHidDeviceConnection.ts rename to packages/device-management-kit/src/internal/transport/usb/transport/UsbHidDeviceConnection.ts index 8e7df0b60..d9275e4c1 100644 --- a/packages/core/src/internal/transport/usb/transport/UsbHidDeviceConnection.ts +++ b/packages/device-management-kit/src/internal/transport/usb/transport/UsbHidDeviceConnection.ts @@ -4,7 +4,7 @@ import { Subject } from "rxjs"; import { CommandUtils } from "@api/command/utils/CommandUtils"; import { ApduResponse } from "@api/device-session/ApduResponse"; -import { SdkError } from "@api/Error"; +import { DmkError } from "@api/Error"; import { DeviceId } from "@api/types"; import { ApduReceiverService } from "@internal/device-session/service/ApduReceiverService"; import { ApduSenderService } from "@internal/device-session/service/ApduSenderService"; @@ -39,7 +39,7 @@ export class UsbHidDeviceConnection implements DeviceConnection { /** Callback to notify the connection termination */ private _onConnectionTerminated: () => void; /** Subject to notify the reconnection status */ - private reconnectionSubject: Subject<"success" | SdkError> = new Subject(); + private reconnectionSubject: Subject<"success" | DmkError> = new Subject(); /** Flag to indicate if the connection is waiting for a reconnection */ private waitingForReconnection = false; /** Timeout to wait for the device to reconnect */ @@ -79,7 +79,7 @@ export class UsbHidDeviceConnection implements DeviceConnection { async sendApdu( apdu: Uint8Array, triggersDisconnection?: boolean, - ): Promise> { + ): Promise> { this._sendApduSubject = new Subject(); this._logger.debug("Sending APDU", { @@ -87,7 +87,7 @@ export class UsbHidDeviceConnection implements DeviceConnection { tag: "apdu-sender", }); - const resultPromise = new Promise>( + const resultPromise = new Promise>( (resolve) => { this._sendApduSubject.subscribe({ next: async (r) => { @@ -155,10 +155,10 @@ export class UsbHidDeviceConnection implements DeviceConnection { }); } - private waitForReconnection(): Promise> { + private waitForReconnection(): Promise> { if (this.terminated) return Promise.resolve(Left(new ReconnectionFailedError())); - return new Promise>((resolve) => { + return new Promise>((resolve) => { const sub = this.reconnectionSubject.subscribe({ next: (res) => { if (res === "success") { diff --git a/packages/core/src/internal/transport/usb/transport/WebUsbHidTransport.test.ts b/packages/device-management-kit/src/internal/transport/usb/transport/WebUsbHidTransport.test.ts similarity index 100% rename from packages/core/src/internal/transport/usb/transport/WebUsbHidTransport.test.ts rename to packages/device-management-kit/src/internal/transport/usb/transport/WebUsbHidTransport.test.ts diff --git a/packages/core/src/internal/transport/usb/transport/WebUsbHidTransport.ts b/packages/device-management-kit/src/internal/transport/usb/transport/WebUsbHidTransport.ts similarity index 99% rename from packages/core/src/internal/transport/usb/transport/WebUsbHidTransport.ts rename to packages/device-management-kit/src/internal/transport/usb/transport/WebUsbHidTransport.ts index 5b7dca105..336f877df 100644 --- a/packages/core/src/internal/transport/usb/transport/WebUsbHidTransport.ts +++ b/packages/device-management-kit/src/internal/transport/usb/transport/WebUsbHidTransport.ts @@ -6,7 +6,7 @@ import { v4 as uuid } from "uuid"; import { DeviceId } from "@api/device/DeviceModel"; import { ConnectionType } from "@api/discovery/ConnectionType"; -import { SdkError } from "@api/Error"; +import { DmkError } from "@api/Error"; import { Transport } from "@api/transport/model/Transport"; import { BuiltinTransports, @@ -112,7 +112,7 @@ export class WebUsbHidTransport implements Transport { * It will return the list of plugged in HID devices to which the user has * previously granted access through `navigator.hid.requestDevice()`. */ - private async getDevices(): Promise> { + private async getDevices(): Promise> { return EitherAsync.liftEither(this.hidApi) .map(async (hidApi) => { try { @@ -413,7 +413,7 @@ export class WebUsbHidTransport implements Transport { */ async disconnect(params: { connectedDevice: InternalConnectedDevice; - }): Promise> { + }): Promise> { this._logger.debug("disconnect", { data: { connectedDevice: params } }); const matchingDeviceConnection = Array.from( diff --git a/packages/core/src/internal/transport/usb/transport/__mocks__/WebUsbHidTransport.ts b/packages/device-management-kit/src/internal/transport/usb/transport/__mocks__/WebUsbHidTransport.ts similarity index 100% rename from packages/core/src/internal/transport/usb/transport/__mocks__/WebUsbHidTransport.ts rename to packages/device-management-kit/src/internal/transport/usb/transport/__mocks__/WebUsbHidTransport.ts diff --git a/packages/core/tsconfig.json b/packages/device-management-kit/tsconfig.json similarity index 100% rename from packages/core/tsconfig.json rename to packages/device-management-kit/tsconfig.json diff --git a/packages/core/tsconfig.prod.json b/packages/device-management-kit/tsconfig.prod.json similarity index 100% rename from packages/core/tsconfig.prod.json rename to packages/device-management-kit/tsconfig.prod.json diff --git a/packages/flipper-plugin-client/package.json b/packages/flipper-plugin-client/package.json index 9801e9386..9b313e9e6 100644 --- a/packages/flipper-plugin-client/package.json +++ b/packages/flipper-plugin-client/package.json @@ -1,5 +1,6 @@ { "name": "@ledgerhq/device-management-kit-flipper-plugin-client", + "private": true, "version": "1.0.0", "license": "Apache-2.0", "main": "lib/index.js", diff --git a/packages/flipper-plugin-client/src/FlipperSdkLogger.test.ts b/packages/flipper-plugin-client/src/FlipperDmkLogger.test.ts similarity index 94% rename from packages/flipper-plugin-client/src/FlipperSdkLogger.test.ts rename to packages/flipper-plugin-client/src/FlipperDmkLogger.test.ts index 40697bb41..72a312c84 100644 --- a/packages/flipper-plugin-client/src/FlipperSdkLogger.test.ts +++ b/packages/flipper-plugin-client/src/FlipperDmkLogger.test.ts @@ -1,8 +1,8 @@ import { LogLevel, type LogParams } from "@ledgerhq/device-management-kit"; import { type FlipperPluginConnection } from "js-flipper"; +import { FlipperDmkLogger, type FlipperObjLog } from "./FlipperDmkLogger"; import { FlipperPluginManager } from "./FlipperPluginManager"; -import { type FlipperObjLog, FlipperSdkLogger } from "./FlipperSdkLogger"; jest.mock("js-flipper"); @@ -103,12 +103,12 @@ const expectedFlipperMessages = expectedFlipperLogs.map((log) => ({ params: log, })); -describe("FlipperSdkLogger", () => { +describe("FlipperDmkLogger", () => { beforeEach(() => {}); test("subscribeToLogs should return a subscription emitting all the logs, formatted", () => { const flipperPluginManager = FlipperPluginManager.getInstance(); - const logger = new FlipperSdkLogger(flipperPluginManager); + const logger = new FlipperDmkLogger(flipperPluginManager); // Logs emitted before a Flipper connection is established for (const log of testLogs.slice(0, 2)) { diff --git a/packages/flipper-plugin-client/src/FlipperSdkLogger.ts b/packages/flipper-plugin-client/src/FlipperDmkLogger.ts similarity index 92% rename from packages/flipper-plugin-client/src/FlipperSdkLogger.ts rename to packages/flipper-plugin-client/src/FlipperDmkLogger.ts index 2bfe91864..147ea7bec 100644 --- a/packages/flipper-plugin-client/src/FlipperSdkLogger.ts +++ b/packages/flipper-plugin-client/src/FlipperDmkLogger.ts @@ -34,8 +34,8 @@ function stringifyUint8ArrayFormatter(_: string, value: unknown) { return value; } -function mapSdkLogToFlipperObjLog(sdkLog: LogParams): FlipperObjLog { - const [level, message, options] = sdkLog; +function mapDmkLogToFlipperObjLog(dmkLog: LogParams): FlipperObjLog { + const [level, message, options] = dmkLog; const verbosities: Record = { [LogLevel.Debug]: "debug", @@ -64,7 +64,7 @@ function mapSdkLogToFlipperObjLog(sdkLog: LogParams): FlipperObjLog { }; } -export class FlipperSdkLogger implements LoggerSubscriberService { +export class FlipperDmkLogger implements LoggerSubscriberService { /** * A ReplaySubject allows the plugin to receive all the logs that were emitted * before the connection was established. @@ -103,6 +103,6 @@ export class FlipperSdkLogger implements LoggerSubscriberService { } public log(...logParams: LogParams) { - this.logsSubject.next(mapSdkLogToFlipperObjLog(logParams)); + this.logsSubject.next(mapDmkLogToFlipperObjLog(logParams)); } } diff --git a/packages/flipper-plugin-client/src/FlipperPluginManager.ts b/packages/flipper-plugin-client/src/FlipperPluginManager.ts index f15cf3a47..73f6f2cc2 100644 --- a/packages/flipper-plugin-client/src/FlipperPluginManager.ts +++ b/packages/flipper-plugin-client/src/FlipperPluginManager.ts @@ -29,7 +29,7 @@ export class FlipperPluginManager implements FlipperPlugin { * If the Flipper server is not running, this will fail silently. */ attemptInitialization() { - flipperClient.start("ledger-device-sdk", { + flipperClient.start("ledger-device-dmk", { onError: () => {}, websocketFactory: (url) => { console.log("Creating Flipper WebSocket"); @@ -67,7 +67,7 @@ export class FlipperPluginManager implements FlipperPlugin { /** FlipperPlugin interface methods */ getId(): string { - return "ledger-device-sdk"; + return "ledger-device-dmk"; } onConnect(connection: FlipperPluginConnection): void { diff --git a/packages/flipper-plugin-client/src/index.ts b/packages/flipper-plugin-client/src/index.ts index db5cee706..6d520bc3b 100644 --- a/packages/flipper-plugin-client/src/index.ts +++ b/packages/flipper-plugin-client/src/index.ts @@ -1,2 +1,2 @@ +export { FlipperDmkLogger } from "./FlipperDmkLogger"; export { FlipperPluginManager } from "./FlipperPluginManager"; -export { FlipperSdkLogger } from "./FlipperSdkLogger"; diff --git a/packages/signer/keyring-btc/src/index.ts b/packages/signer/keyring-btc/src/index.ts deleted file mode 100644 index ee837fbf1..000000000 --- a/packages/signer/keyring-btc/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "@api/KeyringBtc"; diff --git a/packages/signer/keyring-btc/.prettierignore b/packages/signer/signer-btc/.prettierignore similarity index 100% rename from packages/signer/keyring-btc/.prettierignore rename to packages/signer/signer-btc/.prettierignore diff --git a/packages/signer/keyring-btc/.prettierrc.js b/packages/signer/signer-btc/.prettierrc.js similarity index 100% rename from packages/signer/keyring-btc/.prettierrc.js rename to packages/signer/signer-btc/.prettierrc.js diff --git a/packages/signer/keyring-btc/eslint.config.mjs b/packages/signer/signer-btc/eslint.config.mjs similarity index 100% rename from packages/signer/keyring-btc/eslint.config.mjs rename to packages/signer/signer-btc/eslint.config.mjs diff --git a/packages/signer/keyring-btc/jest.config.ts b/packages/signer/signer-btc/jest.config.ts similarity index 100% rename from packages/signer/keyring-btc/jest.config.ts rename to packages/signer/signer-btc/jest.config.ts diff --git a/packages/signer/keyring-btc/jest.setup.ts b/packages/signer/signer-btc/jest.setup.ts similarity index 100% rename from packages/signer/keyring-btc/jest.setup.ts rename to packages/signer/signer-btc/jest.setup.ts diff --git a/packages/signer/keyring-btc/package.json b/packages/signer/signer-btc/package.json similarity index 97% rename from packages/signer/keyring-btc/package.json rename to packages/signer/signer-btc/package.json index 5cdf139dd..a1ea03e77 100644 --- a/packages/signer/keyring-btc/package.json +++ b/packages/signer/signer-btc/package.json @@ -1,5 +1,5 @@ { - "name": "@ledgerhq/keyring-btc", + "name": "@ledgerhq/device-signer-kit-btc", "version": "0.0.1", "license": "Apache-2.0", "main": "lib/cjs/index.js", diff --git a/packages/signer/keyring-btc/src/api/KeyringBtc.ts b/packages/signer/signer-btc/src/api/SignerBtc.ts similarity index 95% rename from packages/signer/keyring-btc/src/api/KeyringBtc.ts rename to packages/signer/signer-btc/src/api/SignerBtc.ts index 6bdd98940..5025338a9 100644 --- a/packages/signer/keyring-btc/src/api/KeyringBtc.ts +++ b/packages/signer/signer-btc/src/api/SignerBtc.ts @@ -3,7 +3,7 @@ import { type Psbt } from "@api/model/Psbt"; import { type Signature } from "@api/model/Signature"; import { type Wallet } from "@api/model/Wallet"; -export interface KeyringBtc { +export interface SignerBtc { getExtendedPubkey: ( derivationPath: string, checkOnDevice?: boolean, diff --git a/packages/signer/keyring-btc/src/api/model/AddressOptions.ts b/packages/signer/signer-btc/src/api/model/AddressOptions.ts similarity index 100% rename from packages/signer/keyring-btc/src/api/model/AddressOptions.ts rename to packages/signer/signer-btc/src/api/model/AddressOptions.ts diff --git a/packages/signer/keyring-btc/src/api/model/Psbt.ts b/packages/signer/signer-btc/src/api/model/Psbt.ts similarity index 100% rename from packages/signer/keyring-btc/src/api/model/Psbt.ts rename to packages/signer/signer-btc/src/api/model/Psbt.ts diff --git a/packages/signer/keyring-btc/src/api/model/Signature.ts b/packages/signer/signer-btc/src/api/model/Signature.ts similarity index 100% rename from packages/signer/keyring-btc/src/api/model/Signature.ts rename to packages/signer/signer-btc/src/api/model/Signature.ts diff --git a/packages/signer/keyring-btc/src/api/model/Wallet.ts b/packages/signer/signer-btc/src/api/model/Wallet.ts similarity index 100% rename from packages/signer/keyring-btc/src/api/model/Wallet.ts rename to packages/signer/signer-btc/src/api/model/Wallet.ts diff --git a/packages/signer/signer-btc/src/index.ts b/packages/signer/signer-btc/src/index.ts new file mode 100644 index 000000000..65060a8d1 --- /dev/null +++ b/packages/signer/signer-btc/src/index.ts @@ -0,0 +1 @@ +export * from "@api/SignerBtc"; diff --git a/packages/signer/keyring-btc/src/internal/app-binder/command/GetExtendedPublicKeyCommand.test.ts b/packages/signer/signer-btc/src/internal/app-binder/command/GetExtendedPublicKeyCommand.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/app-binder/command/GetExtendedPublicKeyCommand.test.ts rename to packages/signer/signer-btc/src/internal/app-binder/command/GetExtendedPublicKeyCommand.test.ts diff --git a/packages/signer/keyring-btc/src/internal/app-binder/command/GetExtendedPublicKeyCommand.ts b/packages/signer/signer-btc/src/internal/app-binder/command/GetExtendedPublicKeyCommand.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/app-binder/command/GetExtendedPublicKeyCommand.ts rename to packages/signer/signer-btc/src/internal/app-binder/command/GetExtendedPublicKeyCommand.ts diff --git a/packages/signer/keyring-btc/src/internal/app-binder/command/GetMasterFingerprintCommand.test.ts b/packages/signer/signer-btc/src/internal/app-binder/command/GetMasterFingerprintCommand.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/app-binder/command/GetMasterFingerprintCommand.test.ts rename to packages/signer/signer-btc/src/internal/app-binder/command/GetMasterFingerprintCommand.test.ts diff --git a/packages/signer/keyring-btc/src/internal/app-binder/command/GetMasterFingerprintCommand.ts b/packages/signer/signer-btc/src/internal/app-binder/command/GetMasterFingerprintCommand.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/app-binder/command/GetMasterFingerprintCommand.ts rename to packages/signer/signer-btc/src/internal/app-binder/command/GetMasterFingerprintCommand.ts diff --git a/packages/signer/keyring-btc/src/internal/data-store/di/dataStoreModule.test.ts b/packages/signer/signer-btc/src/internal/data-store/di/dataStoreModule.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/data-store/di/dataStoreModule.test.ts rename to packages/signer/signer-btc/src/internal/data-store/di/dataStoreModule.test.ts diff --git a/packages/signer/keyring-btc/src/internal/data-store/di/dataStoreModule.ts b/packages/signer/signer-btc/src/internal/data-store/di/dataStoreModule.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/data-store/di/dataStoreModule.ts rename to packages/signer/signer-btc/src/internal/data-store/di/dataStoreModule.ts diff --git a/packages/signer/keyring-btc/src/internal/data-store/di/dataStoreTypes.ts b/packages/signer/signer-btc/src/internal/data-store/di/dataStoreTypes.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/data-store/di/dataStoreTypes.ts rename to packages/signer/signer-btc/src/internal/data-store/di/dataStoreTypes.ts diff --git a/packages/signer/keyring-btc/src/internal/data-store/model/DataStore.test.ts b/packages/signer/signer-btc/src/internal/data-store/model/DataStore.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/data-store/model/DataStore.test.ts rename to packages/signer/signer-btc/src/internal/data-store/model/DataStore.test.ts diff --git a/packages/signer/keyring-btc/src/internal/data-store/model/DataStore.ts b/packages/signer/signer-btc/src/internal/data-store/model/DataStore.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/data-store/model/DataStore.ts rename to packages/signer/signer-btc/src/internal/data-store/model/DataStore.ts diff --git a/packages/signer/keyring-btc/src/internal/data-store/service/DataStoreService.ts b/packages/signer/signer-btc/src/internal/data-store/service/DataStoreService.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/data-store/service/DataStoreService.ts rename to packages/signer/signer-btc/src/internal/data-store/service/DataStoreService.ts diff --git a/packages/signer/keyring-btc/src/internal/data-store/service/DefaultDataStoreService.test.ts b/packages/signer/signer-btc/src/internal/data-store/service/DefaultDataStoreService.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/data-store/service/DefaultDataStoreService.test.ts rename to packages/signer/signer-btc/src/internal/data-store/service/DefaultDataStoreService.test.ts diff --git a/packages/signer/keyring-btc/src/internal/data-store/service/DefaultDataStoreService.ts b/packages/signer/signer-btc/src/internal/data-store/service/DefaultDataStoreService.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/data-store/service/DefaultDataStoreService.ts rename to packages/signer/signer-btc/src/internal/data-store/service/DefaultDataStoreService.ts diff --git a/packages/signer/keyring-btc/src/internal/merkle-tree/di/merkleTreeModule.test.ts b/packages/signer/signer-btc/src/internal/merkle-tree/di/merkleTreeModule.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/merkle-tree/di/merkleTreeModule.test.ts rename to packages/signer/signer-btc/src/internal/merkle-tree/di/merkleTreeModule.test.ts diff --git a/packages/signer/keyring-btc/src/internal/merkle-tree/di/merkleTreeModule.ts b/packages/signer/signer-btc/src/internal/merkle-tree/di/merkleTreeModule.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/merkle-tree/di/merkleTreeModule.ts rename to packages/signer/signer-btc/src/internal/merkle-tree/di/merkleTreeModule.ts diff --git a/packages/signer/keyring-btc/src/internal/merkle-tree/di/merkleTreeTypes.ts b/packages/signer/signer-btc/src/internal/merkle-tree/di/merkleTreeTypes.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/merkle-tree/di/merkleTreeTypes.ts rename to packages/signer/signer-btc/src/internal/merkle-tree/di/merkleTreeTypes.ts diff --git a/packages/signer/keyring-btc/src/internal/merkle-tree/model/Leaf.ts b/packages/signer/signer-btc/src/internal/merkle-tree/model/Leaf.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/merkle-tree/model/Leaf.ts rename to packages/signer/signer-btc/src/internal/merkle-tree/model/Leaf.ts diff --git a/packages/signer/keyring-btc/src/internal/merkle-tree/model/MerkleMap.test.ts b/packages/signer/signer-btc/src/internal/merkle-tree/model/MerkleMap.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/merkle-tree/model/MerkleMap.test.ts rename to packages/signer/signer-btc/src/internal/merkle-tree/model/MerkleMap.test.ts diff --git a/packages/signer/keyring-btc/src/internal/merkle-tree/model/MerkleMap.ts b/packages/signer/signer-btc/src/internal/merkle-tree/model/MerkleMap.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/merkle-tree/model/MerkleMap.ts rename to packages/signer/signer-btc/src/internal/merkle-tree/model/MerkleMap.ts diff --git a/packages/signer/keyring-btc/src/internal/merkle-tree/model/MerkleTree.ts b/packages/signer/signer-btc/src/internal/merkle-tree/model/MerkleTree.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/merkle-tree/model/MerkleTree.ts rename to packages/signer/signer-btc/src/internal/merkle-tree/model/MerkleTree.ts diff --git a/packages/signer/keyring-btc/src/internal/merkle-tree/model/Node.ts b/packages/signer/signer-btc/src/internal/merkle-tree/model/Node.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/merkle-tree/model/Node.ts rename to packages/signer/signer-btc/src/internal/merkle-tree/model/Node.ts diff --git a/packages/signer/keyring-btc/src/internal/merkle-tree/service/HasherService.ts b/packages/signer/signer-btc/src/internal/merkle-tree/service/HasherService.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/merkle-tree/service/HasherService.ts rename to packages/signer/signer-btc/src/internal/merkle-tree/service/HasherService.ts diff --git a/packages/signer/keyring-btc/src/internal/merkle-tree/service/MerkleMapBuilder.test.ts b/packages/signer/signer-btc/src/internal/merkle-tree/service/MerkleMapBuilder.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/merkle-tree/service/MerkleMapBuilder.test.ts rename to packages/signer/signer-btc/src/internal/merkle-tree/service/MerkleMapBuilder.test.ts diff --git a/packages/signer/keyring-btc/src/internal/merkle-tree/service/MerkleMapBuilder.ts b/packages/signer/signer-btc/src/internal/merkle-tree/service/MerkleMapBuilder.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/merkle-tree/service/MerkleMapBuilder.ts rename to packages/signer/signer-btc/src/internal/merkle-tree/service/MerkleMapBuilder.ts diff --git a/packages/signer/keyring-btc/src/internal/merkle-tree/service/MerkleTreeBuilder.test.ts b/packages/signer/signer-btc/src/internal/merkle-tree/service/MerkleTreeBuilder.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/merkle-tree/service/MerkleTreeBuilder.test.ts rename to packages/signer/signer-btc/src/internal/merkle-tree/service/MerkleTreeBuilder.test.ts diff --git a/packages/signer/keyring-btc/src/internal/merkle-tree/service/MerkleTreeBuilder.ts b/packages/signer/signer-btc/src/internal/merkle-tree/service/MerkleTreeBuilder.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/merkle-tree/service/MerkleTreeBuilder.ts rename to packages/signer/signer-btc/src/internal/merkle-tree/service/MerkleTreeBuilder.ts diff --git a/packages/signer/keyring-btc/src/internal/merkle-tree/service/Sha256HasherService.ts b/packages/signer/signer-btc/src/internal/merkle-tree/service/Sha256HasherService.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/merkle-tree/service/Sha256HasherService.ts rename to packages/signer/signer-btc/src/internal/merkle-tree/service/Sha256HasherService.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/di/psbtModule.test.ts b/packages/signer/signer-btc/src/internal/psbt/di/psbtModule.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/di/psbtModule.test.ts rename to packages/signer/signer-btc/src/internal/psbt/di/psbtModule.test.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/di/psbtModule.ts b/packages/signer/signer-btc/src/internal/psbt/di/psbtModule.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/di/psbtModule.ts rename to packages/signer/signer-btc/src/internal/psbt/di/psbtModule.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/di/psbtTypes.ts b/packages/signer/signer-btc/src/internal/psbt/di/psbtTypes.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/di/psbtTypes.ts rename to packages/signer/signer-btc/src/internal/psbt/di/psbtTypes.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/model/Key.test.ts b/packages/signer/signer-btc/src/internal/psbt/model/Key.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/model/Key.test.ts rename to packages/signer/signer-btc/src/internal/psbt/model/Key.test.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/model/Key.ts b/packages/signer/signer-btc/src/internal/psbt/model/Key.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/model/Key.ts rename to packages/signer/signer-btc/src/internal/psbt/model/Key.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/model/KeyPair.ts b/packages/signer/signer-btc/src/internal/psbt/model/KeyPair.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/model/KeyPair.ts rename to packages/signer/signer-btc/src/internal/psbt/model/KeyPair.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/model/Psbt.test.ts b/packages/signer/signer-btc/src/internal/psbt/model/Psbt.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/model/Psbt.test.ts rename to packages/signer/signer-btc/src/internal/psbt/model/Psbt.test.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/model/Psbt.ts b/packages/signer/signer-btc/src/internal/psbt/model/Psbt.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/model/Psbt.ts rename to packages/signer/signer-btc/src/internal/psbt/model/Psbt.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/model/Value.ts b/packages/signer/signer-btc/src/internal/psbt/model/Value.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/model/Value.ts rename to packages/signer/signer-btc/src/internal/psbt/model/Value.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/key-pair/DefaultKeyPairSerializer.test.ts b/packages/signer/signer-btc/src/internal/psbt/service/key-pair/DefaultKeyPairSerializer.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/key-pair/DefaultKeyPairSerializer.test.ts rename to packages/signer/signer-btc/src/internal/psbt/service/key-pair/DefaultKeyPairSerializer.test.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/key-pair/DefaultKeyPairSerializer.ts b/packages/signer/signer-btc/src/internal/psbt/service/key-pair/DefaultKeyPairSerializer.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/key-pair/DefaultKeyPairSerializer.ts rename to packages/signer/signer-btc/src/internal/psbt/service/key-pair/DefaultKeyPairSerializer.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/key-pair/KeyPairSerializer.ts b/packages/signer/signer-btc/src/internal/psbt/service/key-pair/KeyPairSerializer.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/key-pair/KeyPairSerializer.ts rename to packages/signer/signer-btc/src/internal/psbt/service/key-pair/KeyPairSerializer.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/key/DefaultKeySerializer.test.ts b/packages/signer/signer-btc/src/internal/psbt/service/key/DefaultKeySerializer.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/key/DefaultKeySerializer.test.ts rename to packages/signer/signer-btc/src/internal/psbt/service/key/DefaultKeySerializer.test.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/key/DefaultKeySerializer.ts b/packages/signer/signer-btc/src/internal/psbt/service/key/DefaultKeySerializer.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/key/DefaultKeySerializer.ts rename to packages/signer/signer-btc/src/internal/psbt/service/key/DefaultKeySerializer.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/key/KeySerializer.ts b/packages/signer/signer-btc/src/internal/psbt/service/key/KeySerializer.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/key/KeySerializer.ts rename to packages/signer/signer-btc/src/internal/psbt/service/key/KeySerializer.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/psbt/DefaultPsbtMapper.test.ts b/packages/signer/signer-btc/src/internal/psbt/service/psbt/DefaultPsbtMapper.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/psbt/DefaultPsbtMapper.test.ts rename to packages/signer/signer-btc/src/internal/psbt/service/psbt/DefaultPsbtMapper.test.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/psbt/DefaultPsbtMapper.ts b/packages/signer/signer-btc/src/internal/psbt/service/psbt/DefaultPsbtMapper.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/psbt/DefaultPsbtMapper.ts rename to packages/signer/signer-btc/src/internal/psbt/service/psbt/DefaultPsbtMapper.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/psbt/DefaultPsbtSerializer.test.ts b/packages/signer/signer-btc/src/internal/psbt/service/psbt/DefaultPsbtSerializer.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/psbt/DefaultPsbtSerializer.test.ts rename to packages/signer/signer-btc/src/internal/psbt/service/psbt/DefaultPsbtSerializer.test.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/psbt/DefaultPsbtSerializer.ts b/packages/signer/signer-btc/src/internal/psbt/service/psbt/DefaultPsbtSerializer.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/psbt/DefaultPsbtSerializer.ts rename to packages/signer/signer-btc/src/internal/psbt/service/psbt/DefaultPsbtSerializer.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/psbt/DefaultPsbtV2Normalizer.test.ts b/packages/signer/signer-btc/src/internal/psbt/service/psbt/DefaultPsbtV2Normalizer.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/psbt/DefaultPsbtV2Normalizer.test.ts rename to packages/signer/signer-btc/src/internal/psbt/service/psbt/DefaultPsbtV2Normalizer.test.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/psbt/DefaultPsbtV2Normalizer.ts b/packages/signer/signer-btc/src/internal/psbt/service/psbt/DefaultPsbtV2Normalizer.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/psbt/DefaultPsbtV2Normalizer.ts rename to packages/signer/signer-btc/src/internal/psbt/service/psbt/DefaultPsbtV2Normalizer.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/psbt/PsbtMapper.ts b/packages/signer/signer-btc/src/internal/psbt/service/psbt/PsbtMapper.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/psbt/PsbtMapper.ts rename to packages/signer/signer-btc/src/internal/psbt/service/psbt/PsbtMapper.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/psbt/PsbtSerializer.ts b/packages/signer/signer-btc/src/internal/psbt/service/psbt/PsbtSerializer.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/psbt/PsbtSerializer.ts rename to packages/signer/signer-btc/src/internal/psbt/service/psbt/PsbtSerializer.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/psbt/PsbtV2Normalizer.ts b/packages/signer/signer-btc/src/internal/psbt/service/psbt/PsbtV2Normalizer.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/psbt/PsbtV2Normalizer.ts rename to packages/signer/signer-btc/src/internal/psbt/service/psbt/PsbtV2Normalizer.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/value/DefaultValueFactory.test.ts b/packages/signer/signer-btc/src/internal/psbt/service/value/DefaultValueFactory.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/value/DefaultValueFactory.test.ts rename to packages/signer/signer-btc/src/internal/psbt/service/value/DefaultValueFactory.test.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/value/DefaultValueFactory.ts b/packages/signer/signer-btc/src/internal/psbt/service/value/DefaultValueFactory.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/value/DefaultValueFactory.ts rename to packages/signer/signer-btc/src/internal/psbt/service/value/DefaultValueFactory.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/value/DefaultValueParser.test.ts b/packages/signer/signer-btc/src/internal/psbt/service/value/DefaultValueParser.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/value/DefaultValueParser.test.ts rename to packages/signer/signer-btc/src/internal/psbt/service/value/DefaultValueParser.test.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/value/DefaultValueParser.ts b/packages/signer/signer-btc/src/internal/psbt/service/value/DefaultValueParser.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/value/DefaultValueParser.ts rename to packages/signer/signer-btc/src/internal/psbt/service/value/DefaultValueParser.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/value/ValueFactory.ts b/packages/signer/signer-btc/src/internal/psbt/service/value/ValueFactory.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/value/ValueFactory.ts rename to packages/signer/signer-btc/src/internal/psbt/service/value/ValueFactory.ts diff --git a/packages/signer/keyring-btc/src/internal/psbt/service/value/ValueParser.ts b/packages/signer/signer-btc/src/internal/psbt/service/value/ValueParser.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/psbt/service/value/ValueParser.ts rename to packages/signer/signer-btc/src/internal/psbt/service/value/ValueParser.ts diff --git a/packages/signer/keyring-btc/src/internal/utils/Varint.test.ts b/packages/signer/signer-btc/src/internal/utils/Varint.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/utils/Varint.test.ts rename to packages/signer/signer-btc/src/internal/utils/Varint.test.ts diff --git a/packages/signer/keyring-btc/src/internal/utils/Varint.ts b/packages/signer/signer-btc/src/internal/utils/Varint.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/utils/Varint.ts rename to packages/signer/signer-btc/src/internal/utils/Varint.ts diff --git a/packages/signer/keyring-btc/src/internal/wallet/di/walletModule.test.ts b/packages/signer/signer-btc/src/internal/wallet/di/walletModule.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/wallet/di/walletModule.test.ts rename to packages/signer/signer-btc/src/internal/wallet/di/walletModule.test.ts diff --git a/packages/signer/keyring-btc/src/internal/wallet/di/walletModule.ts b/packages/signer/signer-btc/src/internal/wallet/di/walletModule.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/wallet/di/walletModule.ts rename to packages/signer/signer-btc/src/internal/wallet/di/walletModule.ts diff --git a/packages/signer/keyring-btc/src/internal/wallet/di/walletTypes.ts b/packages/signer/signer-btc/src/internal/wallet/di/walletTypes.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/wallet/di/walletTypes.ts rename to packages/signer/signer-btc/src/internal/wallet/di/walletTypes.ts diff --git a/packages/signer/keyring-btc/src/internal/wallet/model/Wallet.ts b/packages/signer/signer-btc/src/internal/wallet/model/Wallet.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/wallet/model/Wallet.ts rename to packages/signer/signer-btc/src/internal/wallet/model/Wallet.ts diff --git a/packages/signer/keyring-btc/src/internal/wallet/service/DefaultWalletBuilder.test.ts b/packages/signer/signer-btc/src/internal/wallet/service/DefaultWalletBuilder.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/wallet/service/DefaultWalletBuilder.test.ts rename to packages/signer/signer-btc/src/internal/wallet/service/DefaultWalletBuilder.test.ts diff --git a/packages/signer/keyring-btc/src/internal/wallet/service/DefaultWalletBuilder.ts b/packages/signer/signer-btc/src/internal/wallet/service/DefaultWalletBuilder.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/wallet/service/DefaultWalletBuilder.ts rename to packages/signer/signer-btc/src/internal/wallet/service/DefaultWalletBuilder.ts diff --git a/packages/signer/keyring-btc/src/internal/wallet/service/DefaultWalletSerializer.test.ts b/packages/signer/signer-btc/src/internal/wallet/service/DefaultWalletSerializer.test.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/wallet/service/DefaultWalletSerializer.test.ts rename to packages/signer/signer-btc/src/internal/wallet/service/DefaultWalletSerializer.test.ts diff --git a/packages/signer/keyring-btc/src/internal/wallet/service/DefaultWalletSerializer.ts b/packages/signer/signer-btc/src/internal/wallet/service/DefaultWalletSerializer.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/wallet/service/DefaultWalletSerializer.ts rename to packages/signer/signer-btc/src/internal/wallet/service/DefaultWalletSerializer.ts diff --git a/packages/signer/keyring-btc/src/internal/wallet/service/WalletBuilder.ts b/packages/signer/signer-btc/src/internal/wallet/service/WalletBuilder.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/wallet/service/WalletBuilder.ts rename to packages/signer/signer-btc/src/internal/wallet/service/WalletBuilder.ts diff --git a/packages/signer/keyring-btc/src/internal/wallet/service/WalletSerializer.ts b/packages/signer/signer-btc/src/internal/wallet/service/WalletSerializer.ts similarity index 100% rename from packages/signer/keyring-btc/src/internal/wallet/service/WalletSerializer.ts rename to packages/signer/signer-btc/src/internal/wallet/service/WalletSerializer.ts diff --git a/packages/signer/keyring-btc/tsconfig.json b/packages/signer/signer-btc/tsconfig.json similarity index 100% rename from packages/signer/keyring-btc/tsconfig.json rename to packages/signer/signer-btc/tsconfig.json diff --git a/packages/signer/keyring-btc/tsconfig.prod.json b/packages/signer/signer-btc/tsconfig.prod.json similarity index 100% rename from packages/signer/keyring-btc/tsconfig.prod.json rename to packages/signer/signer-btc/tsconfig.prod.json diff --git a/packages/signer/keyring-eth/.prettierignore b/packages/signer/signer-eth/.prettierignore similarity index 100% rename from packages/signer/keyring-eth/.prettierignore rename to packages/signer/signer-eth/.prettierignore diff --git a/packages/signer/keyring-eth/.prettierrc.js b/packages/signer/signer-eth/.prettierrc.js similarity index 100% rename from packages/signer/keyring-eth/.prettierrc.js rename to packages/signer/signer-eth/.prettierrc.js diff --git a/packages/signer/keyring-eth/CHANGELOG.md b/packages/signer/signer-eth/CHANGELOG.md similarity index 100% rename from packages/signer/keyring-eth/CHANGELOG.md rename to packages/signer/signer-eth/CHANGELOG.md diff --git a/packages/signer/keyring-eth/README.md b/packages/signer/signer-eth/README.md similarity index 83% rename from packages/signer/keyring-eth/README.md rename to packages/signer/signer-eth/README.md index 249211da5..b410eefc0 100644 --- a/packages/signer/keyring-eth/README.md +++ b/packages/signer/signer-eth/README.md @@ -1,8 +1,8 @@ -# Ledger Ethereum Keyring Implementation +# Ledger Ethereum Signer Implementation ## Introduction -This module provides the implementation of the Ledger Ethereum keyring of the Device Management Kit. It enables interaction with the Ethereum application on a Ledger device including: +This module provides the implementation of the Ledger Ethereum signer of the Device Management Kit. It enables interaction with the Ethereum application on a Ledger device including: - Retrieving the Ethereum address using a given derivation path; - Signing an Ethereum transaction ([Clear Signing](https://www.ledger.com/academy/topics/ledgersolutions/what-is-clear-signing)); @@ -11,11 +11,11 @@ This module provides the implementation of the Ledger Ethereum keyring of the De ### How it works -The Ledger Ethereum Keyring utilizes the advanced capabilities of the Ledger device to provide secure operations for end users. It takes advantage of the interface provided by the Device Management Kit to establish communication with the Ledger device and execute various operations, including signing transactions. The communication with the Ledger device is performed using [APDU](https://en.wikipedia.org/wiki/Smart_card_application_protocol_data_unit)s (Application Protocol Data Units), which are encapsulated within the `Command` object. These commands are then organized into tasks, allowing for the execution of complex operations with one or more APDUs. The tasks are further encapsulated within `DeviceAction` objects to handle different real-world scenarios. Finally, the Keyring exposes dedicated and independent use cases that can be directly utilized by end users. +The Ledger Ethereum Signer utilizes the advanced capabilities of the Ledger device to provide secure operations for end users. It takes advantage of the interface provided by the Device Management Kit to establish communication with the Ledger device and execute various operations, including signing transactions. The communication with the Ledger device is performed using [APDU](https://en.wikipedia.org/wiki/Smart_card_application_protocol_data_unit)s (Application Protocol Data Units), which are encapsulated within the `Command` object. These commands are then organized into tasks, allowing for the execution of complex operations with one or more APDUs. The tasks are further encapsulated within `DeviceAction` objects to handle different real-world scenarios. Finally, the Signer exposes dedicated and independent use cases that can be directly utilized by end users. ### Installation -> **Note:** This module is not standalone; it depends on the [@ledgerhq/device-management-kit](https://github.com/LedgerHQ/device-sdk-ts/tree/develop/packages/core) package, so you need to install it first. +> **Note:** This module is not standalone; it depends on the [@ledgerhq/device-management-kit](https://github.com/LedgerHQ/device-sdk-ts/tree/develop/packages/device-management-kit) package, so you need to install it first. To install the `device-signer-kit-ethereum` package, run the following command: @@ -27,32 +27,32 @@ npm install @ledgerhq/device-signer-kit-ethereum ### Setting up -To initialize an Ethereum keyring instance, you need a Ledger Device Management Kit instance and the ID of the session of the connected device. Use the `KeyringEthBuilder` along with the [Context Module](https://github.com/LedgerHQ/device-sdk-ts/tree/develop/packages/signer/context-module) by default developed by Ledger: +To initialize an Ethereum signer instance, you need a Ledger Device Management Kit instance and the ID of the session of the connected device. Use the `SignerEthBuilder` along with the [Context Module](https://github.com/LedgerHQ/device-sdk-ts/tree/develop/packages/signer/context-module) by default developed by Ledger: ```typescript -// Initialize an Ethereum keyring instance using default context module -const keyringEth = new KeyringEthBuilder({ sdk, sessionId }).build(); +// Initialize an Ethereum signer instance using default context module +const signerEth = new SignerEthBuilder({ sdk, sessionId }).build(); ``` You can also configure the context module yourself: ```typescript -// Initialize an Ethereum keyring instance using customized context module -const keyringEth = new KeyringEthBuilder({ sdk, sessionId }) +// Initialize an Ethereum signer instance using customized context module +const signerEth = new SignerEthBuilder({ sdk, sessionId }) .withContextModule(customContextModule) .build(); ``` ### Use Cases -The `KeyringEthBuilder.build()` method will return a `KeyringEth` instance that exposes 4 dedicated methods, each of which calls an independent use case. Each use case will return an object that contains an observable and a method called `cancel`. +The `SignerEthBuilder.build()` method will return a `SignerEth` instance that exposes 4 dedicated methods, each of which calls an independent use case. Each use case will return an object that contains an observable and a method called `cancel`. #### Use Case 1: Get Address This method allows users to retrieve the Ethereum address according to given `derivationPath`. ```typescript -const { observable, cancel } = keyringETH.getAddress(derivationPath, options); +const { observable, cancel } = signerEth.getAddress(derivationPath, options); ``` **Parameters** @@ -82,7 +82,7 @@ const { observable, cancel } = keyringETH.getAddress(derivationPath, options); - `observable` - - An [Observable](https://rxjs.dev/guide/observable) object that contains the [`DeviceActionState`](https://github.com/LedgerHQ/device-sdk-ts/blob/develop/packages/core/src/api/device-action/model/DeviceActionState.ts) derived instance, which reprensents the operation's state. For example: + - An [Observable](https://rxjs.dev/guide/observable) object that contains the [`DeviceActionState`](https://github.com/LedgerHQ/device-sdk-ts/blob/develop/packages/device-management-kit/src/api/device-action/model/DeviceActionState.ts) derived instance, which reprensents the operation's state. For example: ```typescript observable.subscribe({ @@ -180,7 +180,7 @@ const { observable, cancel } = keyringETH.getAddress(derivationPath, options); This method enables users to securely sign transactions using clear signing on Ledger devices. ```typescript -const { observable, cancel } = keyringETH.signTransaction( +const { observable, cancel } = signerEth.signTransaction( derivationPath, transaction, options, @@ -218,7 +218,7 @@ const { observable, cancel } = keyringETH.signTransaction( - `observable` - - An [Observable](https://rxjs.dev/guide/observable) object that contains the [`DeviceActionState`](https://github.com/LedgerHQ/device-sdk-ts/blob/develop/packages/core/src/api/device-action/model/DeviceActionState.ts) derived instance which reprensents the operation's state. For example: + - An [Observable](https://rxjs.dev/guide/observable) object that contains the [`DeviceActionState`](https://github.com/LedgerHQ/device-sdk-ts/blob/develop/packages/device-management-kit/src/api/device-action/model/DeviceActionState.ts) derived instance which reprensents the operation's state. For example: ```typescript observable.subscribe({ @@ -316,7 +316,7 @@ const { observable, cancel } = keyringETH.signTransaction( This method allows users to sign a text string that is displayed on Ledger devices. ```typescript -const { observable, cancel } = keyringETH.signMessage(derivationPath, message); +const { observable, cancel } = signerEth.signMessage(derivationPath, message); ``` **Parameters** @@ -337,7 +337,7 @@ const { observable, cancel } = keyringETH.signMessage(derivationPath, message); - `observable` - - An [Observable](https://rxjs.dev/guide/observable) object that contains the [`DeviceActionState`](https://github.com/LedgerHQ/device-sdk-ts/blob/develop/packages/core/src/api/device-action/model/DeviceActionState.ts) derived instance which reprensents the operation's state. For example: + - An [Observable](https://rxjs.dev/guide/observable) object that contains the [`DeviceActionState`](https://github.com/LedgerHQ/device-sdk-ts/blob/develop/packages/device-management-kit/src/api/device-action/model/DeviceActionState.ts) derived instance which reprensents the operation's state. For example: ```typescript observable.subscribe({ @@ -433,7 +433,7 @@ const { observable, cancel } = keyringETH.signMessage(derivationPath, message); This method enables users to sign an Ethereum message following the [EIP-712](https://eips.ethereum.org/EIPS/eip-712) specification. ```typescript -const { observable, cancel } = keyringETH.signTypedData( +const { observable, cancel } = signerEth.signTypedData( derivationPath, typedData, ); @@ -480,7 +480,7 @@ const { observable, cancel } = keyringETH.signTypedData( - `observable` - - An [Observable](https://rxjs.dev/guide/observable) object that contains the [`DeviceActionState`](https://github.com/LedgerHQ/device-sdk-ts/blob/develop/packages/core/src/api/device-action/model/DeviceActionState.ts) derived instance which reprensents the operation's state. For example: + - An [Observable](https://rxjs.dev/guide/observable) object that contains the [`DeviceActionState`](https://github.com/LedgerHQ/device-sdk-ts/blob/develop/packages/device-management-kit/src/api/device-action/model/DeviceActionState.ts) derived instance which reprensents the operation's state. For example: ```typescript observable.subscribe({ @@ -573,4 +573,4 @@ const { observable, cancel } = keyringETH.signTypedData( ## Example -We encourage you to explore the Ethereum Keyring by trying it out in our online [sample application](https://app.devicesdk.ledger-test.com/). Experience how it works and see its capabilities in action. Of course, you will need a Ledger device connected. +We encourage you to explore the Ethereum Signer by trying it out in our online [sample application](https://app.devicesdk.ledger-test.com/). Experience how it works and see its capabilities in action. Of course, you will need a Ledger device connected. diff --git a/packages/signer/keyring-eth/eslint.config.mjs b/packages/signer/signer-eth/eslint.config.mjs similarity index 100% rename from packages/signer/keyring-eth/eslint.config.mjs rename to packages/signer/signer-eth/eslint.config.mjs diff --git a/packages/signer/keyring-eth/jest.config.ts b/packages/signer/signer-eth/jest.config.ts similarity index 100% rename from packages/signer/keyring-eth/jest.config.ts rename to packages/signer/signer-eth/jest.config.ts diff --git a/packages/signer/keyring-eth/jest.setup.ts b/packages/signer/signer-eth/jest.setup.ts similarity index 100% rename from packages/signer/keyring-eth/jest.setup.ts rename to packages/signer/signer-eth/jest.setup.ts diff --git a/packages/signer/keyring-eth/package.json b/packages/signer/signer-eth/package.json similarity index 100% rename from packages/signer/keyring-eth/package.json rename to packages/signer/signer-eth/package.json diff --git a/packages/signer/keyring-eth/src/api/KeyringEth.ts b/packages/signer/signer-eth/src/api/SignerEth.ts similarity index 97% rename from packages/signer/keyring-eth/src/api/KeyringEth.ts rename to packages/signer/signer-eth/src/api/SignerEth.ts index 6b98db4e0..39a85ae92 100644 --- a/packages/signer/keyring-eth/src/api/KeyringEth.ts +++ b/packages/signer/signer-eth/src/api/SignerEth.ts @@ -8,7 +8,7 @@ import { type TypedData } from "@api/model/TypedData"; import { type SignPersonalMessageDAReturnType } from "./app-binder/SignPersonalMessageDeviceActionTypes"; import { type SignTransactionDAReturnType } from "./app-binder/SignTransactionDeviceActionTypes"; -export interface KeyringEth { +export interface SignerEth { signTransaction: ( derivationPath: string, transaction: Transaction, diff --git a/packages/signer/keyring-eth/src/api/KeyringEthBuilder.test.ts b/packages/signer/signer-eth/src/api/SignerEthBuilder.test.ts similarity index 58% rename from packages/signer/keyring-eth/src/api/KeyringEthBuilder.test.ts rename to packages/signer/signer-eth/src/api/SignerEthBuilder.test.ts index 639d6407a..86cfb7286 100644 --- a/packages/signer/keyring-eth/src/api/KeyringEthBuilder.test.ts +++ b/packages/signer/signer-eth/src/api/SignerEthBuilder.test.ts @@ -2,27 +2,27 @@ import { type ContextLoader, type ContextModule, } from "@ledgerhq/context-module"; -import { type DeviceSdk } from "@ledgerhq/device-management-kit"; +import { type DeviceManagementKit } from "@ledgerhq/device-management-kit"; -import { KeyringEthBuilder } from "@api/KeyringEthBuilder"; +import { SignerEthBuilder } from "@api/SignerEthBuilder"; -describe("KeyringEthBuilder", () => { - const sdk: DeviceSdk = {} as DeviceSdk; +describe("SignerEthBuilder", () => { + const dmk: DeviceManagementKit = {} as DeviceManagementKit; - test("should be an instance of KeyringEth", () => { + test("should be an instance of SignerEth", () => { // GIVEN - const builder = new KeyringEthBuilder({ sdk, sessionId: "" }); + const builder = new SignerEthBuilder({ dmk, sessionId: "" }); // WHEN builder.build(); // THEN - expect(builder).toBeInstanceOf(KeyringEthBuilder); + expect(builder).toBeInstanceOf(SignerEthBuilder); }); test("should instanciate with default context module", () => { // GIVEN - const builder = new KeyringEthBuilder({ sdk, sessionId: "" }); + const builder = new SignerEthBuilder({ dmk, sessionId: "" }); // WHEN builder.build(); @@ -37,7 +37,7 @@ describe("KeyringEthBuilder", () => { test("should instanciate with custom context module", () => { // GIVEN - const builder = new KeyringEthBuilder({ sdk, sessionId: "" }); + const builder = new SignerEthBuilder({ dmk, sessionId: "" }); const contextModule = {} as ContextModule; // WHEN diff --git a/packages/signer/keyring-eth/src/api/KeyringEthBuilder.ts b/packages/signer/signer-eth/src/api/SignerEthBuilder.ts similarity index 61% rename from packages/signer/keyring-eth/src/api/KeyringEthBuilder.ts rename to packages/signer/signer-eth/src/api/SignerEthBuilder.ts index 4ae15a21e..0fa78ff38 100644 --- a/packages/signer/keyring-eth/src/api/KeyringEthBuilder.ts +++ b/packages/signer/signer-eth/src/api/SignerEthBuilder.ts @@ -3,33 +3,33 @@ import { ContextModuleBuilder, } from "@ledgerhq/context-module"; import { - type DeviceSdk, + type DeviceManagementKit, type DeviceSessionId, } from "@ledgerhq/device-management-kit"; -import { DefaultKeyringEth } from "@internal/DefaultKeyringEth"; +import { DefaultSignerEth } from "@internal/DefaultSignerEth"; -type KeyringEthBuilderConstructorArgs = { - sdk: DeviceSdk; +type SignerEthBuilderConstructorArgs = { + dmk: DeviceManagementKit; sessionId: DeviceSessionId; }; /** - * Builder for the `KeyringEth` class. + * Builder for the `SignerEth` class. * * @example * ``` - * const sdk = new KeyringEthBuilder(sdk) + * const dmk = new SignerEthBuilder(dmk) * .build(); * ``` */ -export class KeyringEthBuilder { - private _sdk: DeviceSdk; +export class SignerEthBuilder { + private _dmk: DeviceManagementKit; private _sessionId: DeviceSessionId; private _contextModule: ContextModule; - constructor({ sdk, sessionId }: KeyringEthBuilderConstructorArgs) { - this._sdk = sdk; + constructor({ dmk, sessionId }: SignerEthBuilderConstructorArgs) { + this._dmk = dmk; this._sessionId = sessionId; // default context module for ETH this._contextModule = new ContextModuleBuilder().build(); @@ -47,13 +47,13 @@ export class KeyringEthBuilder { } /** - * Build the ethereum keyring + * Build the ethereum signer * - * @returns the ethereum keyring + * @returns the ethereum signer */ public build() { - return new DefaultKeyringEth({ - sdk: this._sdk, + return new DefaultSignerEth({ + dmk: this._dmk, sessionId: this._sessionId, contextModule: this._contextModule, }); diff --git a/packages/signer/keyring-eth/src/api/app-binder/GetAddressCommandTypes.ts b/packages/signer/signer-eth/src/api/app-binder/GetAddressCommandTypes.ts similarity index 100% rename from packages/signer/keyring-eth/src/api/app-binder/GetAddressCommandTypes.ts rename to packages/signer/signer-eth/src/api/app-binder/GetAddressCommandTypes.ts diff --git a/packages/signer/keyring-eth/src/api/app-binder/GetAddressDeviceActionTypes.ts b/packages/signer/signer-eth/src/api/app-binder/GetAddressDeviceActionTypes.ts similarity index 100% rename from packages/signer/keyring-eth/src/api/app-binder/GetAddressDeviceActionTypes.ts rename to packages/signer/signer-eth/src/api/app-binder/GetAddressDeviceActionTypes.ts diff --git a/packages/signer/keyring-eth/src/api/app-binder/SignPersonalMessageDeviceActionTypes.ts b/packages/signer/signer-eth/src/api/app-binder/SignPersonalMessageDeviceActionTypes.ts similarity index 100% rename from packages/signer/keyring-eth/src/api/app-binder/SignPersonalMessageDeviceActionTypes.ts rename to packages/signer/signer-eth/src/api/app-binder/SignPersonalMessageDeviceActionTypes.ts diff --git a/packages/signer/keyring-eth/src/api/app-binder/SignTransactionDeviceActionTypes.ts b/packages/signer/signer-eth/src/api/app-binder/SignTransactionDeviceActionTypes.ts similarity index 100% rename from packages/signer/keyring-eth/src/api/app-binder/SignTransactionDeviceActionTypes.ts rename to packages/signer/signer-eth/src/api/app-binder/SignTransactionDeviceActionTypes.ts diff --git a/packages/signer/keyring-eth/src/api/app-binder/SignTypedDataDeviceActionTypes.ts b/packages/signer/signer-eth/src/api/app-binder/SignTypedDataDeviceActionTypes.ts similarity index 100% rename from packages/signer/keyring-eth/src/api/app-binder/SignTypedDataDeviceActionTypes.ts rename to packages/signer/signer-eth/src/api/app-binder/SignTypedDataDeviceActionTypes.ts diff --git a/packages/signer/keyring-eth/src/api/index.ts b/packages/signer/signer-eth/src/api/index.ts similarity index 93% rename from packages/signer/keyring-eth/src/api/index.ts rename to packages/signer/signer-eth/src/api/index.ts index 64de4700a..be120956a 100644 --- a/packages/signer/keyring-eth/src/api/index.ts +++ b/packages/signer/signer-eth/src/api/index.ts @@ -20,11 +20,11 @@ export { type SignTypedDataDAOutput, type SignTypedDataDAState, } from "@api/app-binder/SignTypedDataDeviceActionTypes"; -export * from "@api/KeyringEth"; -export * from "@api/KeyringEthBuilder"; export * from "@api/model/Address"; export * from "@api/model/AddressOptions"; export * from "@api/model/Signature"; export * from "@api/model/Transaction"; export * from "@api/model/TransactionOptions"; export * from "@api/model/TypedData"; +export * from "@api/SignerEth"; +export * from "@api/SignerEthBuilder"; diff --git a/packages/signer/keyring-eth/src/api/model/Address.ts b/packages/signer/signer-eth/src/api/model/Address.ts similarity index 100% rename from packages/signer/keyring-eth/src/api/model/Address.ts rename to packages/signer/signer-eth/src/api/model/Address.ts diff --git a/packages/signer/keyring-eth/src/api/model/AddressOptions.ts b/packages/signer/signer-eth/src/api/model/AddressOptions.ts similarity index 100% rename from packages/signer/keyring-eth/src/api/model/AddressOptions.ts rename to packages/signer/signer-eth/src/api/model/AddressOptions.ts diff --git a/packages/signer/keyring-eth/src/api/model/Signature.ts b/packages/signer/signer-eth/src/api/model/Signature.ts similarity index 100% rename from packages/signer/keyring-eth/src/api/model/Signature.ts rename to packages/signer/signer-eth/src/api/model/Signature.ts diff --git a/packages/signer/keyring-eth/src/api/model/Transaction.ts b/packages/signer/signer-eth/src/api/model/Transaction.ts similarity index 100% rename from packages/signer/keyring-eth/src/api/model/Transaction.ts rename to packages/signer/signer-eth/src/api/model/Transaction.ts diff --git a/packages/signer/keyring-eth/src/api/model/TransactionOptions.ts b/packages/signer/signer-eth/src/api/model/TransactionOptions.ts similarity index 100% rename from packages/signer/keyring-eth/src/api/model/TransactionOptions.ts rename to packages/signer/signer-eth/src/api/model/TransactionOptions.ts diff --git a/packages/signer/keyring-eth/src/api/model/TypedData.ts b/packages/signer/signer-eth/src/api/model/TypedData.ts similarity index 100% rename from packages/signer/keyring-eth/src/api/model/TypedData.ts rename to packages/signer/signer-eth/src/api/model/TypedData.ts diff --git a/packages/signer/keyring-eth/src/index.ts b/packages/signer/signer-eth/src/index.ts similarity index 100% rename from packages/signer/keyring-eth/src/index.ts rename to packages/signer/signer-eth/src/index.ts diff --git a/packages/signer/keyring-eth/src/internal/DefaultKeyringEth.test.ts b/packages/signer/signer-eth/src/internal/DefaultSignerEth.test.ts similarity index 82% rename from packages/signer/keyring-eth/src/internal/DefaultKeyringEth.test.ts rename to packages/signer/signer-eth/src/internal/DefaultSignerEth.test.ts index e1a64ee05..ddc1a2938 100644 --- a/packages/signer/keyring-eth/src/internal/DefaultKeyringEth.test.ts +++ b/packages/signer/signer-eth/src/internal/DefaultSignerEth.test.ts @@ -1,6 +1,6 @@ import { type ContextModule } from "@ledgerhq/context-module"; import { - type DeviceSdk, + type DeviceManagementKit, type DeviceSessionId, } from "@ledgerhq/device-management-kit"; import { type Container } from "inversify"; @@ -10,10 +10,10 @@ import { messageTypes } from "./message/di/messageTypes"; import { transactionTypes } from "./transaction/di/transactionTypes"; import { typedDataTypes } from "./typed-data/di/typedDataTypes"; import { type Transaction, type TypedData } from ".."; -import { DefaultKeyringEth } from "./DefaultKeyringEth"; +import { DefaultSignerEth } from "./DefaultSignerEth"; -describe("DefaultKeyringEth", () => { - let keyring: DefaultKeyringEth; +describe("DefaultSignerEth", () => { + let signer: DefaultSignerEth; const mock: Container = { get: jest.fn((id: symbol) => ({ execute: jest.fn(() => { @@ -35,11 +35,11 @@ describe("DefaultKeyringEth", () => { beforeEach(() => { jest.clearAllMocks(); - const sdk = {} as DeviceSdk; + const dmk = {} as DeviceManagementKit; const sessionId = "" as DeviceSessionId; const contextModule = {} as ContextModule; - keyring = new DefaultKeyringEth({ sdk, sessionId, contextModule }); - keyring["_container"] = mock as unknown as Container; + signer = new DefaultSignerEth({ dmk, sessionId, contextModule }); + signer["_container"] = mock as unknown as Container; }); describe("signTransaction", () => { @@ -49,7 +49,7 @@ describe("DefaultKeyringEth", () => { const transaction = {} as Transaction; // WHEN - const result = await keyring.signTransaction(derivationPath, transaction); + const result = await signer.signTransaction(derivationPath, transaction); // THEN expect(result).toBeDefined(); @@ -67,7 +67,7 @@ describe("DefaultKeyringEth", () => { const message = "message"; // WHEN - const result = await keyring.signMessage(derivationPath, message); + const result = await signer.signMessage(derivationPath, message); // THEN expect(result).toBeDefined(); @@ -83,7 +83,7 @@ describe("DefaultKeyringEth", () => { const typedData = {} as TypedData; // WHEN - const result = await keyring.signTypedData(derivationPath, typedData); + const result = await signer.signTypedData(derivationPath, typedData); // THEN expect(result).toBeDefined(); @@ -100,7 +100,7 @@ describe("DefaultKeyringEth", () => { const derivationPath = "derivationPath"; // WHEN - const result = await keyring.getAddress(derivationPath); + const result = await signer.getAddress(derivationPath); // THEN expect(result).toBeDefined(); diff --git a/packages/signer/keyring-eth/src/internal/DefaultKeyringEth.ts b/packages/signer/signer-eth/src/internal/DefaultSignerEth.ts similarity index 88% rename from packages/signer/keyring-eth/src/internal/DefaultKeyringEth.ts rename to packages/signer/signer-eth/src/internal/DefaultSignerEth.ts index a31620b68..8ee4d1400 100644 --- a/packages/signer/keyring-eth/src/internal/DefaultKeyringEth.ts +++ b/packages/signer/signer-eth/src/internal/DefaultSignerEth.ts @@ -1,6 +1,6 @@ import { type ContextModule } from "@ledgerhq/context-module"; import { - type DeviceSdk, + type DeviceManagementKit, type DeviceSessionId, } from "@ledgerhq/device-management-kit"; import { type Container } from "inversify"; @@ -9,11 +9,11 @@ import { type GetAddressDAReturnType } from "@api/app-binder/GetAddressDeviceAct import { type SignPersonalMessageDAReturnType } from "@api/app-binder/SignPersonalMessageDeviceActionTypes"; import { type SignTransactionDAReturnType } from "@api/app-binder/SignTransactionDeviceActionTypes"; import { type SignTypedDataDAReturnType } from "@api/app-binder/SignTypedDataDeviceActionTypes"; -import { type KeyringEth } from "@api/KeyringEth"; import { type AddressOptions } from "@api/model/AddressOptions"; import { type Transaction } from "@api/model/Transaction"; import { type TransactionOptions } from "@api/model/TransactionOptions"; import { type TypedData } from "@api/model/TypedData"; +import { type SignerEth } from "@api/SignerEth"; import { addressTypes } from "@internal/address/di/addressTypes"; import { type GetAddressUseCase } from "@internal/address/use-case/GetAddressUseCase"; import { makeContainer } from "@internal/di"; @@ -24,21 +24,17 @@ import { type SignTransactionUseCase } from "@internal/transaction/use-case/Sign import { typedDataTypes } from "@internal/typed-data/di/typedDataTypes"; import { type SignTypedDataUseCase } from "@internal/typed-data/use-case/SignTypedDataUseCase"; -type DefaultKeyringConstructorArgs = { - sdk: DeviceSdk; +type DefaultSignerConstructorArgs = { + dmk: DeviceManagementKit; sessionId: DeviceSessionId; contextModule: ContextModule; }; -export class DefaultKeyringEth implements KeyringEth { +export class DefaultSignerEth implements SignerEth { private _container: Container; - constructor({ - sdk, - sessionId, - contextModule, - }: DefaultKeyringConstructorArgs) { - this._container = makeContainer({ sdk, sessionId, contextModule }); + constructor({ dmk, sessionId, contextModule }: DefaultSignerConstructorArgs) { + this._container = makeContainer({ dmk, sessionId, contextModule }); } signTransaction( diff --git a/packages/signer/keyring-eth/src/internal/address/di/addressModule.test.ts b/packages/signer/signer-eth/src/internal/address/di/addressModule.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/address/di/addressModule.test.ts rename to packages/signer/signer-eth/src/internal/address/di/addressModule.test.ts diff --git a/packages/signer/keyring-eth/src/internal/address/di/addressModule.ts b/packages/signer/signer-eth/src/internal/address/di/addressModule.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/address/di/addressModule.ts rename to packages/signer/signer-eth/src/internal/address/di/addressModule.ts diff --git a/packages/signer/keyring-eth/src/internal/address/di/addressTypes.ts b/packages/signer/signer-eth/src/internal/address/di/addressTypes.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/address/di/addressTypes.ts rename to packages/signer/signer-eth/src/internal/address/di/addressTypes.ts diff --git a/packages/signer/keyring-eth/src/internal/address/use-case/GetAddressUseCase.test.ts b/packages/signer/signer-eth/src/internal/address/use-case/GetAddressUseCase.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/address/use-case/GetAddressUseCase.test.ts rename to packages/signer/signer-eth/src/internal/address/use-case/GetAddressUseCase.test.ts diff --git a/packages/signer/keyring-eth/src/internal/address/use-case/GetAddressUseCase.ts b/packages/signer/signer-eth/src/internal/address/use-case/GetAddressUseCase.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/address/use-case/GetAddressUseCase.ts rename to packages/signer/signer-eth/src/internal/address/use-case/GetAddressUseCase.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/EthAppBinder.test.ts b/packages/signer/signer-eth/src/internal/app-binder/EthAppBinder.test.ts similarity index 94% rename from packages/signer/keyring-eth/src/internal/app-binder/EthAppBinder.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/EthAppBinder.test.ts index 69379e016..154dc7ca4 100644 --- a/packages/signer/keyring-eth/src/internal/app-binder/EthAppBinder.test.ts +++ b/packages/signer/signer-eth/src/internal/app-binder/EthAppBinder.test.ts @@ -1,7 +1,7 @@ import { type ContextModule } from "@ledgerhq/context-module"; import { type DeviceActionState, - type DeviceSdk, + type DeviceManagementKit, } from "@ledgerhq/device-management-kit"; import { DeviceActionStatus } from "@ledgerhq/device-management-kit"; import { SendCommandInAppDeviceAction } from "@ledgerhq/device-management-kit"; @@ -38,10 +38,10 @@ import { GetAddressCommand } from "./command/GetAddressCommand"; import { EthAppBinder } from "./EthAppBinder"; describe("EthAppBinder", () => { - const mockedSdk: DeviceSdk = { + const mockedDmk: DeviceManagementKit = { sendCommand: jest.fn(), executeDeviceAction: jest.fn(), - } as unknown as DeviceSdk; + } as unknown as DeviceManagementKit; const mockedContextModule: ContextModule = { getContexts: jest.fn(), getTypedDataFilters: jest.fn(), @@ -61,7 +61,7 @@ describe("EthAppBinder", () => { const publicKey = "04e3785ca"; const chainCode = undefined; - jest.spyOn(mockedSdk, "executeDeviceAction").mockReturnValue({ + jest.spyOn(mockedDmk, "executeDeviceAction").mockReturnValue({ observable: from([ { status: DeviceActionStatus.Completed, @@ -77,7 +77,7 @@ describe("EthAppBinder", () => { // WHEN const appBinder = new EthAppBinder( - mockedSdk, + mockedDmk, mockedContextModule, mockedMapper, "sessionId", @@ -131,7 +131,7 @@ describe("EthAppBinder", () => { // WHEN const appBinder = new EthAppBinder( - mockedSdk, + mockedDmk, mockedContextModule, mockedMapper, "sessionId", @@ -139,7 +139,7 @@ describe("EthAppBinder", () => { appBinder.getAddress(params); // THEN - expect(mockedSdk.executeDeviceAction).toHaveBeenCalledWith({ + expect(mockedDmk.executeDeviceAction).toHaveBeenCalledWith({ sessionId: "sessionId", deviceAction: new SendCommandInAppDeviceAction({ input: { @@ -161,7 +161,7 @@ describe("EthAppBinder", () => { // WHEN const appBinder = new EthAppBinder( - mockedSdk, + mockedDmk, mockedContextModule, mockedMapper, "sessionId", @@ -169,7 +169,7 @@ describe("EthAppBinder", () => { appBinder.getAddress(params); // THEN - expect(mockedSdk.executeDeviceAction).toHaveBeenCalledWith({ + expect(mockedDmk.executeDeviceAction).toHaveBeenCalledWith({ sessionId: "sessionId", deviceAction: new SendCommandInAppDeviceAction({ input: { @@ -196,7 +196,7 @@ describe("EthAppBinder", () => { transaction.value = 0n; const options = {}; - jest.spyOn(mockedSdk, "executeDeviceAction").mockReturnValue({ + jest.spyOn(mockedDmk, "executeDeviceAction").mockReturnValue({ observable: from([ { status: DeviceActionStatus.Completed, @@ -212,7 +212,7 @@ describe("EthAppBinder", () => { // WHEN const appBinder = new EthAppBinder( - mockedSdk, + mockedDmk, mockedContextModule, mockedMapper, "sessionId", @@ -263,7 +263,7 @@ describe("EthAppBinder", () => { transaction.to = "0x1234567890123456789012345678901234567890"; transaction.value = 0n; - jest.spyOn(mockedSdk, "executeDeviceAction").mockReturnValue({ + jest.spyOn(mockedDmk, "executeDeviceAction").mockReturnValue({ observable: from([ { status: DeviceActionStatus.Completed, @@ -279,7 +279,7 @@ describe("EthAppBinder", () => { // WHEN const appBinder = new EthAppBinder( - mockedSdk, + mockedDmk, mockedContextModule, mockedMapper, "sessionId", @@ -330,7 +330,7 @@ describe("EthAppBinder", () => { }; const message = "Hello, World!"; - jest.spyOn(mockedSdk, "executeDeviceAction").mockReturnValue({ + jest.spyOn(mockedDmk, "executeDeviceAction").mockReturnValue({ observable: from([ { status: DeviceActionStatus.Completed, @@ -346,7 +346,7 @@ describe("EthAppBinder", () => { // WHEN const appBinder = new EthAppBinder( - mockedSdk, + mockedDmk, mockedContextModule, mockedMapper, "sessionId", @@ -404,7 +404,7 @@ describe("EthAppBinder", () => { parse: jest.fn(), }; - jest.spyOn(mockedSdk, "executeDeviceAction").mockReturnValue({ + jest.spyOn(mockedDmk, "executeDeviceAction").mockReturnValue({ observable: from([ { status: DeviceActionStatus.Completed, @@ -420,7 +420,7 @@ describe("EthAppBinder", () => { // WHEN const appBinder = new EthAppBinder( - mockedSdk, + mockedDmk, mockedContextModule, mockedMapper, "sessionId", diff --git a/packages/signer/keyring-eth/src/internal/app-binder/EthAppBinder.ts b/packages/signer/signer-eth/src/internal/app-binder/EthAppBinder.ts similarity index 93% rename from packages/signer/keyring-eth/src/internal/app-binder/EthAppBinder.ts rename to packages/signer/signer-eth/src/internal/app-binder/EthAppBinder.ts index 453f8515d..ac0cd9fda 100644 --- a/packages/signer/keyring-eth/src/internal/app-binder/EthAppBinder.ts +++ b/packages/signer/signer-eth/src/internal/app-binder/EthAppBinder.ts @@ -1,6 +1,6 @@ import { type ContextModule } from "@ledgerhq/context-module"; import { - DeviceSdk, + DeviceManagementKit, type DeviceSessionId, } from "@ledgerhq/device-management-kit"; import { SendCommandInAppDeviceAction } from "@ledgerhq/device-management-kit"; @@ -27,7 +27,7 @@ import { SignTransactionDeviceAction } from "./device-action/SignTransaction/Sig @injectable() export class EthAppBinder { constructor( - @inject(externalTypes.Sdk) private sdk: DeviceSdk, + @inject(externalTypes.Dmk) private dmk: DeviceManagementKit, @inject(externalTypes.ContextModule) private contextModule: ContextModule, @inject(transactionTypes.TransactionMapperService) private mapper: TransactionMapperService, @@ -39,7 +39,7 @@ export class EthAppBinder { checkOnDevice?: boolean; returnChainCode?: boolean; }): GetAddressDAReturnType { - return this.sdk.executeDeviceAction({ + return this.dmk.executeDeviceAction({ sessionId: this.sessionId, deviceAction: new SendCommandInAppDeviceAction({ input: { @@ -57,7 +57,7 @@ export class EthAppBinder { derivationPath: string; message: string; }): SignPersonalMessageDAReturnType { - return this.sdk.executeDeviceAction({ + return this.dmk.executeDeviceAction({ sessionId: this.sessionId, deviceAction: new SignPersonalMessageDeviceAction({ input: { @@ -73,7 +73,7 @@ export class EthAppBinder { transaction: Transaction; options?: TransactionOptions; }): SignTransactionDAReturnType { - return this.sdk.executeDeviceAction({ + return this.dmk.executeDeviceAction({ sessionId: this.sessionId, deviceAction: new SignTransactionDeviceAction({ input: { @@ -92,7 +92,7 @@ export class EthAppBinder { parser: TypedDataParserService; data: TypedData; }): SignTypedDataDAReturnType { - return this.sdk.executeDeviceAction({ + return this.dmk.executeDeviceAction({ sessionId: this.sessionId, deviceAction: new SignTypedDataDeviceAction({ input: { diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/GetAddressCommand.test.ts b/packages/signer/signer-eth/src/internal/app-binder/command/GetAddressCommand.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/GetAddressCommand.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/GetAddressCommand.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/GetAddressCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/GetAddressCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/GetAddressCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/GetAddressCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/GetChallengeCommand.test.ts b/packages/signer/signer-eth/src/internal/app-binder/command/GetChallengeCommand.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/GetChallengeCommand.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/GetChallengeCommand.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/GetChallengeCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/GetChallengeCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/GetChallengeCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/GetChallengeCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/ProvideDomainNameCommand.test.ts b/packages/signer/signer-eth/src/internal/app-binder/command/ProvideDomainNameCommand.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/ProvideDomainNameCommand.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/ProvideDomainNameCommand.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/ProvideDomainNameCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/ProvideDomainNameCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/ProvideDomainNameCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/ProvideDomainNameCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/ProvideEnumCommand.test.ts b/packages/signer/signer-eth/src/internal/app-binder/command/ProvideEnumCommand.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/ProvideEnumCommand.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/ProvideEnumCommand.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/ProvideEnumCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/ProvideEnumCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/ProvideEnumCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/ProvideEnumCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/ProvideNFTInformationCommand.test.ts b/packages/signer/signer-eth/src/internal/app-binder/command/ProvideNFTInformationCommand.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/ProvideNFTInformationCommand.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/ProvideNFTInformationCommand.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/ProvideNFTInformationCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/ProvideNFTInformationCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/ProvideNFTInformationCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/ProvideNFTInformationCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/ProvideTokenInformationCommand.test.ts b/packages/signer/signer-eth/src/internal/app-binder/command/ProvideTokenInformationCommand.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/ProvideTokenInformationCommand.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/ProvideTokenInformationCommand.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/ProvideTokenInformationCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/ProvideTokenInformationCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/ProvideTokenInformationCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/ProvideTokenInformationCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.test.ts b/packages/signer/signer-eth/src/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/ProvideTransactionFieldDescriptionCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/ProvideTransactionInformationCommand.test.ts b/packages/signer/signer-eth/src/internal/app-binder/command/ProvideTransactionInformationCommand.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/ProvideTransactionInformationCommand.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/ProvideTransactionInformationCommand.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/ProvideTransactionInformationCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/ProvideTransactionInformationCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/ProvideTransactionInformationCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/ProvideTransactionInformationCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/SendEIP712FilteringCommand.test.ts b/packages/signer/signer-eth/src/internal/app-binder/command/SendEIP712FilteringCommand.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/SendEIP712FilteringCommand.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/SendEIP712FilteringCommand.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/SendEIP712FilteringCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/SendEIP712FilteringCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/SendEIP712FilteringCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/SendEIP712FilteringCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/SendEIP712StructDefinitionCommand.test.ts b/packages/signer/signer-eth/src/internal/app-binder/command/SendEIP712StructDefinitionCommand.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/SendEIP712StructDefinitionCommand.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/SendEIP712StructDefinitionCommand.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/SendEIP712StructDefinitionCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/SendEIP712StructDefinitionCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/SendEIP712StructDefinitionCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/SendEIP712StructDefinitionCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/SendEIP712StructImplemCommand.test.ts b/packages/signer/signer-eth/src/internal/app-binder/command/SendEIP712StructImplemCommand.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/SendEIP712StructImplemCommand.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/SendEIP712StructImplemCommand.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/SendEIP712StructImplemCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/SendEIP712StructImplemCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/SendEIP712StructImplemCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/SendEIP712StructImplemCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/SetExternalPluginCommand.test.ts b/packages/signer/signer-eth/src/internal/app-binder/command/SetExternalPluginCommand.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/SetExternalPluginCommand.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/SetExternalPluginCommand.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/SetExternalPluginCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/SetExternalPluginCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/SetExternalPluginCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/SetExternalPluginCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/SetPluginCommand.test.ts b/packages/signer/signer-eth/src/internal/app-binder/command/SetPluginCommand.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/SetPluginCommand.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/SetPluginCommand.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/SetPluginCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/SetPluginCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/SetPluginCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/SetPluginCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/SignEIP712Command.test.ts b/packages/signer/signer-eth/src/internal/app-binder/command/SignEIP712Command.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/SignEIP712Command.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/SignEIP712Command.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/SignEIP712Command.ts b/packages/signer/signer-eth/src/internal/app-binder/command/SignEIP712Command.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/SignEIP712Command.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/SignEIP712Command.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/SignPersonalMessageCommand.test.ts b/packages/signer/signer-eth/src/internal/app-binder/command/SignPersonalMessageCommand.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/SignPersonalMessageCommand.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/SignPersonalMessageCommand.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/SignPersonalMessageCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/SignPersonalMessageCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/SignPersonalMessageCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/SignPersonalMessageCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/SignTransactionCommand.test.ts b/packages/signer/signer-eth/src/internal/app-binder/command/SignTransactionCommand.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/SignTransactionCommand.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/SignTransactionCommand.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/SignTransactionCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/SignTransactionCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/SignTransactionCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/SignTransactionCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/StartTransactionCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/StartTransactionCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/StartTransactionCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/StartTransactionCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/command/StoreTransactionCommand.ts b/packages/signer/signer-eth/src/internal/app-binder/command/StoreTransactionCommand.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/command/StoreTransactionCommand.ts rename to packages/signer/signer-eth/src/internal/app-binder/command/StoreTransactionCommand.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.test.ts b/packages/signer/signer-eth/src/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.ts b/packages/signer/signer-eth/src/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.ts rename to packages/signer/signer-eth/src/internal/app-binder/device-action/SignPersonalMessage/SignPersonalMessageDeviceAction.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.test.ts b/packages/signer/signer-eth/src/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.ts b/packages/signer/signer-eth/src/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.ts rename to packages/signer/signer-eth/src/internal/app-binder/device-action/SignTransaction/SignTransactionDeviceAction.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.test.ts b/packages/signer/signer-eth/src/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.ts b/packages/signer/signer-eth/src/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.ts rename to packages/signer/signer-eth/src/internal/app-binder/device-action/SignTypedData/SignTypedDataDeviceAction.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/device-action/__test-utils__/makeInternalApi.ts b/packages/signer/signer-eth/src/internal/app-binder/device-action/__test-utils__/makeInternalApi.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/device-action/__test-utils__/makeInternalApi.ts rename to packages/signer/signer-eth/src/internal/app-binder/device-action/__test-utils__/makeInternalApi.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock.ts b/packages/signer/signer-eth/src/internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock.ts rename to packages/signer/signer-eth/src/internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.ts b/packages/signer/signer-eth/src/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.ts similarity index 96% rename from packages/signer/keyring-eth/src/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.ts rename to packages/signer/signer-eth/src/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.ts index 0bb733a4f..bc8f1ce01 100644 --- a/packages/signer/keyring-eth/src/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.ts +++ b/packages/signer/signer-eth/src/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.ts @@ -2,8 +2,8 @@ import { type DeviceAction, type DeviceActionIntermediateValue, type DeviceActionState, + type DmkError, type InternalApi, - type SdkError, } from "@ledgerhq/device-management-kit"; /** @@ -15,7 +15,7 @@ import { export function testDeviceActionStates< Output, Input, - Error extends SdkError, + Error extends DmkError, IntermediateValue extends DeviceActionIntermediateValue, >( deviceAction: DeviceAction, diff --git a/packages/signer/keyring-eth/src/internal/app-binder/di/appBinderModule.ts b/packages/signer/signer-eth/src/internal/app-binder/di/appBinderModule.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/di/appBinderModule.ts rename to packages/signer/signer-eth/src/internal/app-binder/di/appBinderModule.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/di/appBinderTypes.ts b/packages/signer/signer-eth/src/internal/app-binder/di/appBinderTypes.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/di/appBinderTypes.ts rename to packages/signer/signer-eth/src/internal/app-binder/di/appBinderTypes.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/task/BuildEIP712ContextTask.test.ts b/packages/signer/signer-eth/src/internal/app-binder/task/BuildEIP712ContextTask.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/task/BuildEIP712ContextTask.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/task/BuildEIP712ContextTask.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/task/BuildEIP712ContextTask.ts b/packages/signer/signer-eth/src/internal/app-binder/task/BuildEIP712ContextTask.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/task/BuildEIP712ContextTask.ts rename to packages/signer/signer-eth/src/internal/app-binder/task/BuildEIP712ContextTask.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/task/BuildTransactionContextTask.test.ts b/packages/signer/signer-eth/src/internal/app-binder/task/BuildTransactionContextTask.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/task/BuildTransactionContextTask.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/task/BuildTransactionContextTask.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/task/BuildTransactionContextTask.ts b/packages/signer/signer-eth/src/internal/app-binder/task/BuildTransactionContextTask.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/task/BuildTransactionContextTask.ts rename to packages/signer/signer-eth/src/internal/app-binder/task/BuildTransactionContextTask.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/task/ProvideEIP712ContextTask.test.ts b/packages/signer/signer-eth/src/internal/app-binder/task/ProvideEIP712ContextTask.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/task/ProvideEIP712ContextTask.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/task/ProvideEIP712ContextTask.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/task/ProvideEIP712ContextTask.ts b/packages/signer/signer-eth/src/internal/app-binder/task/ProvideEIP712ContextTask.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/task/ProvideEIP712ContextTask.ts rename to packages/signer/signer-eth/src/internal/app-binder/task/ProvideEIP712ContextTask.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/task/ProvideTransactionContextTask.test.ts b/packages/signer/signer-eth/src/internal/app-binder/task/ProvideTransactionContextTask.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/task/ProvideTransactionContextTask.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/task/ProvideTransactionContextTask.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/task/ProvideTransactionContextTask.ts b/packages/signer/signer-eth/src/internal/app-binder/task/ProvideTransactionContextTask.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/task/ProvideTransactionContextTask.ts rename to packages/signer/signer-eth/src/internal/app-binder/task/ProvideTransactionContextTask.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/task/ProvideTransactionGenericContextTask.ts b/packages/signer/signer-eth/src/internal/app-binder/task/ProvideTransactionGenericContextTask.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/task/ProvideTransactionGenericContextTask.ts rename to packages/signer/signer-eth/src/internal/app-binder/task/ProvideTransactionGenericContextTask.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/task/SendCommandInChunksTask.ts b/packages/signer/signer-eth/src/internal/app-binder/task/SendCommandInChunksTask.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/task/SendCommandInChunksTask.ts rename to packages/signer/signer-eth/src/internal/app-binder/task/SendCommandInChunksTask.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/task/SendEIP712StructImplemTask.test.ts b/packages/signer/signer-eth/src/internal/app-binder/task/SendEIP712StructImplemTask.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/task/SendEIP712StructImplemTask.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/task/SendEIP712StructImplemTask.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/task/SendEIP712StructImplemTask.ts b/packages/signer/signer-eth/src/internal/app-binder/task/SendEIP712StructImplemTask.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/task/SendEIP712StructImplemTask.ts rename to packages/signer/signer-eth/src/internal/app-binder/task/SendEIP712StructImplemTask.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/task/SendSignPersonalMessageTask.test.ts b/packages/signer/signer-eth/src/internal/app-binder/task/SendSignPersonalMessageTask.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/task/SendSignPersonalMessageTask.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/task/SendSignPersonalMessageTask.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/task/SendSignPersonalMessageTask.ts b/packages/signer/signer-eth/src/internal/app-binder/task/SendSignPersonalMessageTask.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/task/SendSignPersonalMessageTask.ts rename to packages/signer/signer-eth/src/internal/app-binder/task/SendSignPersonalMessageTask.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/task/SendSignTransactionTask.test.ts b/packages/signer/signer-eth/src/internal/app-binder/task/SendSignTransactionTask.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/task/SendSignTransactionTask.test.ts rename to packages/signer/signer-eth/src/internal/app-binder/task/SendSignTransactionTask.test.ts diff --git a/packages/signer/keyring-eth/src/internal/app-binder/task/SendSignTransactionTask.ts b/packages/signer/signer-eth/src/internal/app-binder/task/SendSignTransactionTask.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/app-binder/task/SendSignTransactionTask.ts rename to packages/signer/signer-eth/src/internal/app-binder/task/SendSignTransactionTask.ts diff --git a/packages/signer/keyring-eth/src/internal/di.ts b/packages/signer/signer-eth/src/internal/di.ts similarity index 91% rename from packages/signer/keyring-eth/src/internal/di.ts rename to packages/signer/signer-eth/src/internal/di.ts index 55e16c9cd..43196493b 100644 --- a/packages/signer/keyring-eth/src/internal/di.ts +++ b/packages/signer/signer-eth/src/internal/di.ts @@ -1,6 +1,6 @@ import { type ContextModule } from "@ledgerhq/context-module"; import { - type DeviceSdk, + type DeviceManagementKit, type DeviceSessionId, } from "@ledgerhq/device-management-kit"; import { Container } from "inversify"; @@ -17,13 +17,13 @@ import { typedDataModuleFactory } from "@internal/typed-data/di/typedDataModule" // const logger = makeLoggerMiddleware(); export type MakeContainerProps = { - sdk: DeviceSdk; + dmk: DeviceManagementKit; sessionId: DeviceSessionId; contextModule: ContextModule; }; export const makeContainer = ({ - sdk, + dmk, sessionId, contextModule, }: MakeContainerProps) => { @@ -32,7 +32,7 @@ export const makeContainer = ({ // Uncomment this line to enable the logger middleware // container.applyMiddleware(logger); - container.bind(externalTypes.Sdk).toConstantValue(sdk); + container.bind(externalTypes.Dmk).toConstantValue(dmk); container .bind(externalTypes.ContextModule) .toConstantValue(contextModule); diff --git a/packages/signer/keyring-eth/src/internal/externalTypes.ts b/packages/signer/signer-eth/src/internal/externalTypes.ts similarity index 81% rename from packages/signer/keyring-eth/src/internal/externalTypes.ts rename to packages/signer/signer-eth/src/internal/externalTypes.ts index d4757b8ba..01ed6d441 100644 --- a/packages/signer/keyring-eth/src/internal/externalTypes.ts +++ b/packages/signer/signer-eth/src/internal/externalTypes.ts @@ -1,5 +1,5 @@ export const externalTypes = { - Sdk: Symbol.for("Sdk"), + Dmk: Symbol.for("Dmk"), SessionId: Symbol.for("SessionId"), ContextModule: Symbol.for("ContextModule"), }; diff --git a/packages/signer/keyring-eth/src/internal/message/di/messageModule.test.ts b/packages/signer/signer-eth/src/internal/message/di/messageModule.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/message/di/messageModule.test.ts rename to packages/signer/signer-eth/src/internal/message/di/messageModule.test.ts diff --git a/packages/signer/keyring-eth/src/internal/message/di/messageModule.ts b/packages/signer/signer-eth/src/internal/message/di/messageModule.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/message/di/messageModule.ts rename to packages/signer/signer-eth/src/internal/message/di/messageModule.ts diff --git a/packages/signer/keyring-eth/src/internal/message/di/messageTypes.ts b/packages/signer/signer-eth/src/internal/message/di/messageTypes.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/message/di/messageTypes.ts rename to packages/signer/signer-eth/src/internal/message/di/messageTypes.ts diff --git a/packages/signer/keyring-eth/src/internal/message/use-case/SignMessageUseCase.test.ts b/packages/signer/signer-eth/src/internal/message/use-case/SignMessageUseCase.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/message/use-case/SignMessageUseCase.test.ts rename to packages/signer/signer-eth/src/internal/message/use-case/SignMessageUseCase.test.ts diff --git a/packages/signer/keyring-eth/src/internal/message/use-case/SignMessageUseCase.ts b/packages/signer/signer-eth/src/internal/message/use-case/SignMessageUseCase.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/message/use-case/SignMessageUseCase.ts rename to packages/signer/signer-eth/src/internal/message/use-case/SignMessageUseCase.ts diff --git a/packages/signer/keyring-eth/src/internal/shared/utils/PayloadUtils.ts b/packages/signer/signer-eth/src/internal/shared/utils/PayloadUtils.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/shared/utils/PayloadUtils.ts rename to packages/signer/signer-eth/src/internal/shared/utils/PayloadUtils.ts diff --git a/packages/signer/keyring-eth/src/internal/transaction/di/transactionModule.test.ts b/packages/signer/signer-eth/src/internal/transaction/di/transactionModule.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/transaction/di/transactionModule.test.ts rename to packages/signer/signer-eth/src/internal/transaction/di/transactionModule.test.ts diff --git a/packages/signer/keyring-eth/src/internal/transaction/di/transactionModule.ts b/packages/signer/signer-eth/src/internal/transaction/di/transactionModule.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/transaction/di/transactionModule.ts rename to packages/signer/signer-eth/src/internal/transaction/di/transactionModule.ts diff --git a/packages/signer/keyring-eth/src/internal/transaction/di/transactionTypes.ts b/packages/signer/signer-eth/src/internal/transaction/di/transactionTypes.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/transaction/di/transactionTypes.ts rename to packages/signer/signer-eth/src/internal/transaction/di/transactionTypes.ts diff --git a/packages/signer/keyring-eth/src/internal/transaction/service/mapper/EthersV5TransactionMapper.test.ts b/packages/signer/signer-eth/src/internal/transaction/service/mapper/EthersV5TransactionMapper.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/transaction/service/mapper/EthersV5TransactionMapper.test.ts rename to packages/signer/signer-eth/src/internal/transaction/service/mapper/EthersV5TransactionMapper.test.ts diff --git a/packages/signer/keyring-eth/src/internal/transaction/service/mapper/EthersV5TransactionMapper.ts b/packages/signer/signer-eth/src/internal/transaction/service/mapper/EthersV5TransactionMapper.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/transaction/service/mapper/EthersV5TransactionMapper.ts rename to packages/signer/signer-eth/src/internal/transaction/service/mapper/EthersV5TransactionMapper.ts diff --git a/packages/signer/keyring-eth/src/internal/transaction/service/mapper/EthersV6TransactionMapper.test.ts b/packages/signer/signer-eth/src/internal/transaction/service/mapper/EthersV6TransactionMapper.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/transaction/service/mapper/EthersV6TransactionMapper.test.ts rename to packages/signer/signer-eth/src/internal/transaction/service/mapper/EthersV6TransactionMapper.test.ts diff --git a/packages/signer/keyring-eth/src/internal/transaction/service/mapper/EthersV6TransactionMapper.ts b/packages/signer/signer-eth/src/internal/transaction/service/mapper/EthersV6TransactionMapper.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/transaction/service/mapper/EthersV6TransactionMapper.ts rename to packages/signer/signer-eth/src/internal/transaction/service/mapper/EthersV6TransactionMapper.ts diff --git a/packages/signer/keyring-eth/src/internal/transaction/service/mapper/TransactionMapper.ts b/packages/signer/signer-eth/src/internal/transaction/service/mapper/TransactionMapper.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/transaction/service/mapper/TransactionMapper.ts rename to packages/signer/signer-eth/src/internal/transaction/service/mapper/TransactionMapper.ts diff --git a/packages/signer/keyring-eth/src/internal/transaction/service/mapper/TransactionMapperService.test.ts b/packages/signer/signer-eth/src/internal/transaction/service/mapper/TransactionMapperService.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/transaction/service/mapper/TransactionMapperService.test.ts rename to packages/signer/signer-eth/src/internal/transaction/service/mapper/TransactionMapperService.test.ts diff --git a/packages/signer/keyring-eth/src/internal/transaction/service/mapper/TransactionMapperService.ts b/packages/signer/signer-eth/src/internal/transaction/service/mapper/TransactionMapperService.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/transaction/service/mapper/TransactionMapperService.ts rename to packages/signer/signer-eth/src/internal/transaction/service/mapper/TransactionMapperService.ts diff --git a/packages/signer/keyring-eth/src/internal/transaction/service/mapper/model/TransactionMapperResult.ts b/packages/signer/signer-eth/src/internal/transaction/service/mapper/model/TransactionMapperResult.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/transaction/service/mapper/model/TransactionMapperResult.ts rename to packages/signer/signer-eth/src/internal/transaction/service/mapper/model/TransactionMapperResult.ts diff --git a/packages/signer/keyring-eth/src/internal/transaction/use-case/SignTransactionUseCase.test.ts b/packages/signer/signer-eth/src/internal/transaction/use-case/SignTransactionUseCase.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/transaction/use-case/SignTransactionUseCase.test.ts rename to packages/signer/signer-eth/src/internal/transaction/use-case/SignTransactionUseCase.test.ts diff --git a/packages/signer/keyring-eth/src/internal/transaction/use-case/SignTransactionUseCase.ts b/packages/signer/signer-eth/src/internal/transaction/use-case/SignTransactionUseCase.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/transaction/use-case/SignTransactionUseCase.ts rename to packages/signer/signer-eth/src/internal/transaction/use-case/SignTransactionUseCase.ts diff --git a/packages/signer/keyring-eth/src/internal/typed-data/di/typedDataModule.test.ts b/packages/signer/signer-eth/src/internal/typed-data/di/typedDataModule.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/typed-data/di/typedDataModule.test.ts rename to packages/signer/signer-eth/src/internal/typed-data/di/typedDataModule.test.ts diff --git a/packages/signer/keyring-eth/src/internal/typed-data/di/typedDataModule.ts b/packages/signer/signer-eth/src/internal/typed-data/di/typedDataModule.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/typed-data/di/typedDataModule.ts rename to packages/signer/signer-eth/src/internal/typed-data/di/typedDataModule.ts diff --git a/packages/signer/keyring-eth/src/internal/typed-data/di/typedDataTypes.ts b/packages/signer/signer-eth/src/internal/typed-data/di/typedDataTypes.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/typed-data/di/typedDataTypes.ts rename to packages/signer/signer-eth/src/internal/typed-data/di/typedDataTypes.ts diff --git a/packages/signer/keyring-eth/src/internal/typed-data/model/Types.ts b/packages/signer/signer-eth/src/internal/typed-data/model/Types.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/typed-data/model/Types.ts rename to packages/signer/signer-eth/src/internal/typed-data/model/Types.ts diff --git a/packages/signer/keyring-eth/src/internal/typed-data/service/DefaultTypedDataParserService.ts b/packages/signer/signer-eth/src/internal/typed-data/service/DefaultTypedDataParserService.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/typed-data/service/DefaultTypedDataParserService.ts rename to packages/signer/signer-eth/src/internal/typed-data/service/DefaultTypedDataParserService.ts diff --git a/packages/signer/keyring-eth/src/internal/typed-data/service/TypedDataEncoder.test.ts b/packages/signer/signer-eth/src/internal/typed-data/service/TypedDataEncoder.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/typed-data/service/TypedDataEncoder.test.ts rename to packages/signer/signer-eth/src/internal/typed-data/service/TypedDataEncoder.test.ts diff --git a/packages/signer/keyring-eth/src/internal/typed-data/service/TypedDataEncoder.ts b/packages/signer/signer-eth/src/internal/typed-data/service/TypedDataEncoder.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/typed-data/service/TypedDataEncoder.ts rename to packages/signer/signer-eth/src/internal/typed-data/service/TypedDataEncoder.ts diff --git a/packages/signer/keyring-eth/src/internal/typed-data/service/TypedDataParser.test.ts b/packages/signer/signer-eth/src/internal/typed-data/service/TypedDataParser.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/typed-data/service/TypedDataParser.test.ts rename to packages/signer/signer-eth/src/internal/typed-data/service/TypedDataParser.test.ts diff --git a/packages/signer/keyring-eth/src/internal/typed-data/service/TypedDataParser.ts b/packages/signer/signer-eth/src/internal/typed-data/service/TypedDataParser.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/typed-data/service/TypedDataParser.ts rename to packages/signer/signer-eth/src/internal/typed-data/service/TypedDataParser.ts diff --git a/packages/signer/keyring-eth/src/internal/typed-data/service/TypedDataParserService.ts b/packages/signer/signer-eth/src/internal/typed-data/service/TypedDataParserService.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/typed-data/service/TypedDataParserService.ts rename to packages/signer/signer-eth/src/internal/typed-data/service/TypedDataParserService.ts diff --git a/packages/signer/keyring-eth/src/internal/typed-data/use-case/SignTypedDataUseCase.test.ts b/packages/signer/signer-eth/src/internal/typed-data/use-case/SignTypedDataUseCase.test.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/typed-data/use-case/SignTypedDataUseCase.test.ts rename to packages/signer/signer-eth/src/internal/typed-data/use-case/SignTypedDataUseCase.test.ts diff --git a/packages/signer/keyring-eth/src/internal/typed-data/use-case/SignTypedDataUseCase.ts b/packages/signer/signer-eth/src/internal/typed-data/use-case/SignTypedDataUseCase.ts similarity index 100% rename from packages/signer/keyring-eth/src/internal/typed-data/use-case/SignTypedDataUseCase.ts rename to packages/signer/signer-eth/src/internal/typed-data/use-case/SignTypedDataUseCase.ts diff --git a/packages/signer/keyring-eth/tsconfig.json b/packages/signer/signer-eth/tsconfig.json similarity index 100% rename from packages/signer/keyring-eth/tsconfig.json rename to packages/signer/signer-eth/tsconfig.json diff --git a/packages/signer/keyring-eth/tsconfig.prod.json b/packages/signer/signer-eth/tsconfig.prod.json similarity index 100% rename from packages/signer/keyring-eth/tsconfig.prod.json rename to packages/signer/signer-eth/tsconfig.prod.json diff --git a/packages/signer/signer-solana/src/api/SignerSolanaBuilder.ts b/packages/signer/signer-solana/src/api/SignerSolanaBuilder.ts index e4aaca8b6..5aba89532 100644 --- a/packages/signer/signer-solana/src/api/SignerSolanaBuilder.ts +++ b/packages/signer/signer-solana/src/api/SignerSolanaBuilder.ts @@ -1,12 +1,12 @@ import { - type DeviceSdk, + type DeviceManagementKit, type DeviceSessionId, } from "@ledgerhq/device-management-kit"; import { DefaultSignerSolana } from "@internal/DefaultSignerSolana"; type SignerSolanaBuilderConstructorArgs = { - sdk: DeviceSdk; + dmk: DeviceManagementKit; sessionId: DeviceSessionId; }; @@ -15,16 +15,16 @@ type SignerSolanaBuilderConstructorArgs = { * * @example * ``` - * const sdk = new SignerSolanaBuilder({ sdk, sessionId }) + * const dmk = new SignerSolanaBuilder({ dmk, sessionId }) * .build(); * ``` */ export class SignerSolanaBuilder { - private _sdk: DeviceSdk; + private _dmk: DeviceManagementKit; private _sessionId: DeviceSessionId; - constructor({ sdk, sessionId }: SignerSolanaBuilderConstructorArgs) { - this._sdk = sdk; + constructor({ dmk, sessionId }: SignerSolanaBuilderConstructorArgs) { + this._dmk = dmk; this._sessionId = sessionId; } @@ -35,7 +35,7 @@ export class SignerSolanaBuilder { */ public build() { return new DefaultSignerSolana({ - sdk: this._sdk, + dmk: this._dmk, sessionId: this._sessionId, }); } diff --git a/packages/signer/signer-solana/src/internal/DefaultSignerSolana.test.ts b/packages/signer/signer-solana/src/internal/DefaultSignerSolana.test.ts index 519e213dd..8018abe01 100644 --- a/packages/signer/signer-solana/src/internal/DefaultSignerSolana.test.ts +++ b/packages/signer/signer-solana/src/internal/DefaultSignerSolana.test.ts @@ -1,5 +1,5 @@ import { - type DeviceSdk, + type DeviceManagementKit, type DeviceSessionId, } from "@ledgerhq/device-management-kit"; @@ -8,7 +8,7 @@ import { DefaultSignerSolana } from "./DefaultSignerSolana"; describe("DefaultSignerSolana", () => { it("should be defined", () => { const signer = new DefaultSignerSolana({ - sdk: {} as DeviceSdk, + dmk: {} as DeviceManagementKit, sessionId: {} as DeviceSessionId, }); expect(signer).toBeDefined(); diff --git a/packages/signer/signer-solana/src/internal/DefaultSignerSolana.ts b/packages/signer/signer-solana/src/internal/DefaultSignerSolana.ts index effa92d74..a0d6e153a 100644 --- a/packages/signer/signer-solana/src/internal/DefaultSignerSolana.ts +++ b/packages/signer/signer-solana/src/internal/DefaultSignerSolana.ts @@ -1,5 +1,5 @@ import { - type DeviceSdk, + type DeviceManagementKit, type DeviceSessionId, } from "@ledgerhq/device-management-kit"; import { type Container } from "inversify"; @@ -18,15 +18,15 @@ import { useCasesTypes } from "./use-cases/di/useCasesTypes"; import { makeContainer } from "./di"; export type DefaultSignerSolanaConstructorArgs = { - sdk: DeviceSdk; + dmk: DeviceManagementKit; sessionId: DeviceSessionId; }; export class DefaultSignerSolana implements SignerSolana { private _container: Container; - constructor({ sdk, sessionId }: DefaultSignerSolanaConstructorArgs) { - this._container = makeContainer({ sdk, sessionId }); + constructor({ dmk, sessionId }: DefaultSignerSolanaConstructorArgs) { + this._container = makeContainer({ dmk, sessionId }); } signTransaction( diff --git a/packages/signer/signer-solana/src/internal/app-binder/SolanaAppBinder.test.ts b/packages/signer/signer-solana/src/internal/app-binder/SolanaAppBinder.test.ts index b63543b8b..c5571eb80 100644 --- a/packages/signer/signer-solana/src/internal/app-binder/SolanaAppBinder.test.ts +++ b/packages/signer/signer-solana/src/internal/app-binder/SolanaAppBinder.test.ts @@ -1,7 +1,7 @@ import { type DeviceActionState, DeviceActionStatus, - type DeviceSdk, + type DeviceManagementKit, type DeviceSessionId, SendCommandInAppDeviceAction, UserInteractionRequired, @@ -18,17 +18,20 @@ import { GetPubKeyCommand } from "./command/GetPubKeyCommand"; import { SolanaAppBinder } from "./SolanaAppBinder"; describe("SolanaAppBinder", () => { - const mockedSdk: DeviceSdk = { + const mockedDmk: DeviceManagementKit = { sendCommand: jest.fn(), executeDeviceAction: jest.fn(), - } as unknown as DeviceSdk; + } as unknown as DeviceManagementKit; beforeEach(() => { jest.clearAllMocks(); }); it("should be defined", () => { - const binder = new SolanaAppBinder({} as DeviceSdk, {} as DeviceSessionId); + const binder = new SolanaAppBinder( + {} as DeviceManagementKit, + {} as DeviceSessionId, + ); expect(binder).toBeDefined(); }); @@ -37,7 +40,7 @@ describe("SolanaAppBinder", () => { // GIVEN const address = "D2PPQSYFe83nDzk96FqGumVU8JA7J8vj2Rhjc2oXzEi5"; - jest.spyOn(mockedSdk, "executeDeviceAction").mockReturnValue({ + jest.spyOn(mockedDmk, "executeDeviceAction").mockReturnValue({ observable: from([ { status: DeviceActionStatus.Completed, @@ -52,7 +55,7 @@ describe("SolanaAppBinder", () => { }); // WHEN - const appBinder = new SolanaAppBinder(mockedSdk, "sessionId"); + const appBinder = new SolanaAppBinder(mockedDmk, "sessionId"); const { observable } = appBinder.getAddress({ derivationPath: "44'/501'", checkOnDevice: false, @@ -102,11 +105,11 @@ describe("SolanaAppBinder", () => { }; // WHEN - const appBinder = new SolanaAppBinder(mockedSdk, "sessionId"); + const appBinder = new SolanaAppBinder(mockedDmk, "sessionId"); appBinder.getAddress(params); // THEN - expect(mockedSdk.executeDeviceAction).toHaveBeenCalledWith({ + expect(mockedDmk.executeDeviceAction).toHaveBeenCalledWith({ sessionId: "sessionId", deviceAction: new SendCommandInAppDeviceAction({ input: { @@ -127,11 +130,11 @@ describe("SolanaAppBinder", () => { }; // WHEN - const appBinder = new SolanaAppBinder(mockedSdk, "sessionId"); + const appBinder = new SolanaAppBinder(mockedDmk, "sessionId"); appBinder.getAddress(params); // THEN - expect(mockedSdk.executeDeviceAction).toHaveBeenCalledWith({ + expect(mockedDmk.executeDeviceAction).toHaveBeenCalledWith({ sessionId: "sessionId", deviceAction: new SendCommandInAppDeviceAction({ input: { diff --git a/packages/signer/signer-solana/src/internal/app-binder/SolanaAppBinder.ts b/packages/signer/signer-solana/src/internal/app-binder/SolanaAppBinder.ts index 5dc8083ce..27145b741 100644 --- a/packages/signer/signer-solana/src/internal/app-binder/SolanaAppBinder.ts +++ b/packages/signer/signer-solana/src/internal/app-binder/SolanaAppBinder.ts @@ -1,5 +1,5 @@ import { - DeviceSdk, + DeviceManagementKit, type DeviceSessionId, SendCommandInAppDeviceAction, UserInteractionRequired, @@ -18,7 +18,7 @@ import { GetPubKeyCommand } from "./command/GetPubKeyCommand"; @injectable() export class SolanaAppBinder { constructor( - @inject(externalTypes.Sdk) private sdk: DeviceSdk, + @inject(externalTypes.Dmk) private dmk: DeviceManagementKit, @inject(externalTypes.SessionId) private sessionId: DeviceSessionId, ) {} @@ -26,7 +26,7 @@ export class SolanaAppBinder { derivationPath: string; checkOnDevice: boolean; }): GetAddressDAReturnType { - return this.sdk.executeDeviceAction({ + return this.dmk.executeDeviceAction({ sessionId: this.sessionId, deviceAction: new SendCommandInAppDeviceAction({ input: { diff --git a/packages/signer/signer-solana/src/internal/di.ts b/packages/signer/signer-solana/src/internal/di.ts index 1c3b9e7fb..abfbdcefd 100644 --- a/packages/signer/signer-solana/src/internal/di.ts +++ b/packages/signer/signer-solana/src/internal/di.ts @@ -1,5 +1,5 @@ import { - type DeviceSdk, + type DeviceManagementKit, type DeviceSessionId, } from "@ledgerhq/device-management-kit"; import { Container } from "inversify"; @@ -13,16 +13,16 @@ import { externalTypes } from "./externalTypes"; // const logger = makeLoggerMiddleware(); export type MakeContainerProps = { - sdk: DeviceSdk; + dmk: DeviceManagementKit; sessionId: DeviceSessionId; }; -export const makeContainer = ({ sdk, sessionId }: MakeContainerProps) => { +export const makeContainer = ({ dmk, sessionId }: MakeContainerProps) => { const container = new Container(); // Uncomment this line to enable the logger middleware // container.applyMiddleware(logger); - container.bind(externalTypes.Sdk).toConstantValue(sdk); + container.bind(externalTypes.Dmk).toConstantValue(dmk); container .bind(externalTypes.SessionId) .toConstantValue(sessionId); diff --git a/packages/signer/signer-solana/src/internal/externalTypes.ts b/packages/signer/signer-solana/src/internal/externalTypes.ts index 1f1e75168..397009d34 100644 --- a/packages/signer/signer-solana/src/internal/externalTypes.ts +++ b/packages/signer/signer-solana/src/internal/externalTypes.ts @@ -1,4 +1,4 @@ export const externalTypes = { - Sdk: Symbol.for("Sdk"), + Dmk: Symbol.for("Dmk"), SessionId: Symbol.for("SessionId"), }; diff --git a/packages/transport-mock/package.json b/packages/transport-mock/package.json index d28ec66ab..a1fd81fb4 100644 --- a/packages/transport-mock/package.json +++ b/packages/transport-mock/package.json @@ -1,5 +1,6 @@ { - "name": "@ledgerhq/device-sdk-transport-mock", + "name": "@ledgerhq/device-transport-kit-mock-client", + "private": true, "version": "1.0.0", "license": "Apache-2.0", "main": "lib/index.js", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1325c4c03..7e50d228b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -73,19 +73,19 @@ importers: version: link:../../packages/signer/context-module '@ledgerhq/device-management-kit': specifier: workspace:* - version: link:../../packages/core + version: link:../../packages/device-management-kit '@ledgerhq/device-management-kit-flipper-plugin-client': specifier: workspace:* version: link:../../packages/flipper-plugin-client - '@ledgerhq/device-sdk-transport-mock': - specifier: workspace:* - version: link:../../packages/transport-mock '@ledgerhq/device-signer-kit-ethereum': specifier: workspace:* - version: link:../../packages/signer/keyring-eth + version: link:../../packages/signer/signer-eth '@ledgerhq/device-signer-kit-solana': specifier: workspace:* version: link:../../packages/signer/signer-solana + '@ledgerhq/device-transport-kit-mock-client': + specifier: workspace:* + version: link:../../packages/transport-mock '@ledgerhq/react-ui': specifier: ^0.16.2 version: 0.16.2(@emotion/is-prop-valid@1.2.1)(@types/react@18.3.11)(react-dom@18.3.1(react@18.3.1))(react-native-svg@15.3.0(react-native@0.74.3(@babel/core@7.24.7)(@babel/preset-env@7.24.7(@babel/core@7.24.7))(@types/react@18.3.11)(react@18.3.1))(react@18.3.1))(react@18.3.1)(styled-components@5.3.11(@babel/core@7.24.7)(react-dom@18.3.1(react@18.3.1))(react-is@18.3.1)(react@18.3.1)) @@ -205,9 +205,9 @@ importers: specifier: ^18.3.0 version: 18.3.0 - packages/core: + packages/device-management-kit: dependencies: - '@ledgerhq/device-sdk-transport-mock': + '@ledgerhq/device-transport-kit-mock-client': specifier: workspace:* version: link:../transport-mock '@sentry/minimal': @@ -286,7 +286,7 @@ importers: devDependencies: '@ledgerhq/device-management-kit': specifier: workspace:* - version: link:../core + version: link:../device-management-kit '@ledgerhq/esbuild-tools': specifier: workspace:* version: link:../tools/esbuild-tools @@ -326,7 +326,7 @@ importers: devDependencies: '@ledgerhq/device-management-kit': specifier: workspace:* - version: link:../../core + version: link:../../device-management-kit '@ledgerhq/esbuild-tools': specifier: workspace:* version: link:../../tools/esbuild-tools @@ -349,7 +349,7 @@ importers: specifier: ^10.9.2 version: 10.9.2(@types/node@22.8.1)(typescript@5.6.3) - packages/signer/keyring-btc: + packages/signer/signer-btc: dependencies: '@types/crypto-js': specifier: ^4.2.2 @@ -378,7 +378,7 @@ importers: devDependencies: '@ledgerhq/device-management-kit': specifier: workspace:* - version: link:../../core + version: link:../../device-management-kit '@ledgerhq/esbuild-tools': specifier: workspace:* version: link:../../tools/esbuild-tools @@ -401,7 +401,7 @@ importers: specifier: ^10.9.2 version: 10.9.2(@types/node@22.8.1)(typescript@5.6.3) - packages/signer/keyring-eth: + packages/signer/signer-eth: dependencies: ethers-v5: specifier: npm:ethers@^5.7.2 @@ -433,7 +433,7 @@ importers: version: link:../context-module '@ledgerhq/device-management-kit': specifier: workspace:* - version: link:../../core + version: link:../../device-management-kit '@ledgerhq/esbuild-tools': specifier: workspace:* version: link:../../tools/esbuild-tools @@ -488,7 +488,7 @@ importers: devDependencies: '@ledgerhq/device-management-kit': specifier: workspace:* - version: link:../../core + version: link:../../device-management-kit '@ledgerhq/esbuild-tools': specifier: workspace:* version: link:../../tools/esbuild-tools @@ -515,7 +515,7 @@ importers: devDependencies: '@ledgerhq/device-management-kit': specifier: workspace:* - version: link:../../core + version: link:../../device-management-kit '@ledgerhq/esbuild-tools': specifier: workspace:* version: link:../../tools/esbuild-tools