@ledgerhq/hw-transport-webusb

  • Version 6.27.8
  • Published
  • 82.5 kB
  • 4 dependencies
  • Apache-2.0 license

Install

npm i @ledgerhq/hw-transport-webusb
yarn add @ledgerhq/hw-transport-webusb
pnpm add @ledgerhq/hw-transport-webusb

Overview

Ledger Hardware Wallet WebUSB implementation of the communication layer

Index

Classes

class TransportWebUSB

class TransportWebUSB extends Transport {}
  • WebUSB Transport implementation

    Example 1

    import TransportWebUSB from "@ledgerhq/hw-transport-webusb"; ... TransportWebUSB.create().then(transport => ...)

constructor

constructor(device: USBDevice, interfaceNumber: number);

    property channel

    channel: number;

      property device

      device: USBDevice;

        property deviceModel

        deviceModel: any;

          property interfaceNumber

          interfaceNumber: number;

            property isSupported

            static isSupported: () => Promise<boolean>;
            • Check if WebUSB transport is supported.

            property list

            static list: () => Promise<USBDevice[]>;
            • List the WebUSB devices that was previously authorized by the user.

            property listen

            static listen: (observer: Observer<DescriptorEvent<USBDevice>>) => Subscription;
            • Actively listen to WebUSB devices and emit ONE device that was either accepted before, if not it will trigger the native permission UI.

              Important: it must be called in the context of a UI click!

            property packetSize

            packetSize: number;

              method close

              close: () => Promise<void>;
              • Release the transport device

              method exchange

              exchange: (apdu: Buffer) => Promise<Buffer>;
              • Exchange with the device using APDU protocol.

                Parameter apdu

                Returns

                a promise of apdu response

              method open

              static open: (device: USBDevice) => Promise<TransportWebUSB>;
              • Create a Ledger transport with a USBDevice

              method openConnected

              static openConnected: () => Promise<TransportWebUSB | null>;
              • Similar to create() except it will never display the device permission (it returns a Promise<?Transport>, null if it fails to find a device).

              method request

              static request: () => Promise<TransportWebUSB>;
              • Similar to create() except it will always display the device permission (even if some devices are already accepted).

              method setScrambleKey

              setScrambleKey: () => void;

                Package Files (1)

                Dependencies (4)

                Dev Dependencies (1)

                Peer Dependencies (0)

                No peer dependencies.

                Badge

                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@ledgerhq/hw-transport-webusb.

                • Markdown
                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@ledgerhq/hw-transport-webusb)
                • HTML
                  <a href="https://www.jsdocs.io/package/@ledgerhq/hw-transport-webusb"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>