What is @ledgerhq/hw-transport?
@ledgerhq/hw-transport is a JavaScript library that provides a set of transport methods to communicate with Ledger hardware wallets. It supports various transport protocols such as USB, WebUSB, and Bluetooth, allowing developers to interact with Ledger devices in a secure and efficient manner.
What are @ledgerhq/hw-transport's main functionalities?
USB Transport
This feature allows you to connect to a Ledger device using USB. The code sample demonstrates how to establish a connection and then close it.
const Transport = require('@ledgerhq/hw-transport-node-hid').default;
async function connectLedger() {
const transport = await Transport.create();
console.log('Connected to Ledger via USB');
await transport.close();
}
connectLedger();
WebUSB Transport
This feature allows you to connect to a Ledger device using WebUSB. The code sample demonstrates how to establish a connection and then close it.
const TransportWebUSB = require('@ledgerhq/hw-transport-webusb').default;
async function connectLedgerWebUSB() {
const transport = await TransportWebUSB.create();
console.log('Connected to Ledger via WebUSB');
await transport.close();
}
connectLedgerWebUSB();
Bluetooth Transport
This feature allows you to connect to a Ledger device using Bluetooth. The code sample demonstrates how to establish a connection and then close it.
const TransportBLE = require('@ledgerhq/hw-transport-ble').default;
async function connectLedgerBLE() {
const transport = await TransportBLE.create();
console.log('Connected to Ledger via Bluetooth');
await transport.close();
}
connectLedgerBLE();
Other packages similar to @ledgerhq/hw-transport
trezor-connect
trezor-connect is a JavaScript library for communicating with Trezor hardware wallets. It provides similar functionalities to @ledgerhq/hw-transport, such as USB and WebUSB support, but is specifically designed for Trezor devices.
bitbox02-api
bitbox02-api is a JavaScript library for interacting with BitBox02 hardware wallets. It offers functionalities similar to @ledgerhq/hw-transport, including USB communication, but is tailored for BitBox02 devices.