Skip to Content
We're improving our docs. Share your experience and help shape what comes next.
DocumentationDevice interactionIntegration WalkthroughsHow to ...Use a Transport

Transports

The Device Management Kit is offering several transports to communicate with a Ledger device. Depending on the environment and usecase, you can choose the transport that best suits your needs.

Available transports

TransportDescription
Web HID The WebHID transport uses the Web HID API (usb) to communicate with a Ledger device.
Web BLE The WebBLE transport uses the Web BLE API (bluetooth) to communicate with a Ledger device.
RN HID The React Native HID transport uses the react-native (usb) to communicate with a Ledger device.
RN BLE The React Native BLE transport uses the react-native-ble-plx (bluetooth) to communicate with a Ledger device.
Node HID The Node HID transport uses the node-hid library (usb) to communicate with a Ledger device.
Speculos The Speculos transport is used to communicate with the speculos device simulator.

How to use a transport

Transports are injected in the DeviceManagementKitBuilder before building the Device Management Kit instance. This is done by calling the addTransport method on the builder. You can inject the transport in two different ways:

  • Using the default transport factory provided by the package
  • Using directly the transport creating your own factory (for custom transports or additional configuration…)
import { DeviceManagementKitBuilder } from "@ledgerhq/device-management-kit"; import { WebHidTransport, webHidTransportFactory } from "@ledgerhq/device-transport-kit-web-hid"; // Using the default transport factory const dmk = new DeviceManagementKitBuilder() .addTransport(webHidTransportFactory) .build(); // Using the transport directly const dmk = new DeviceManagementKitBuilder() .addTransport(({ deviceModelDataSource: DeviceModelDataSource; loggerServiceFactory: (tag: string) => LoggerPublisherService; config: DmkConfig; apduSenderServiceFactory: ApduSenderServiceFactory; apduReceiverServiceFactory: ApduReceiverServiceFactory; }) => { // Some extra code here to configure the transport // Then we return the transport instance return new WebHidTransport( deviceModelDataSource, loggerServiceFactory, config, apduSenderServiceFactory, apduReceiverServiceFactory, ); }) .build();

How to use the Speculos transport

The Speculos transport is used to communicate with the speculos device simulator. The factory function accepts a speculosUrl parameter that is the url of the speculos server.

const dmk = new DeviceManagementKitBuilder() .addTransport(speculosTransportFactory("http://localhost:5000")) .build();
Last updated on
Ledger
Copyright © Ledger SAS. All rights reserved. Ledger, Ledger Stax, Ledger Flex, Ledger Nano, Ledger Nano S, Ledger OS, Ledger Wallet, [LEDGER] (logo), [L] (logo) are trademarks owned by Ledger SAS.