UNPKG

@ledgerhq/hw-transport-node-hid-noevents

Version:

Ledger Hardware Wallet Node implementation of the communication layer, using node-hid. without usb events

93 lines (56 loc) 2.75 kB
<img src="https://user-images.githubusercontent.com/4631227/191834116-59cf590e-25cc-4956-ae5c-812ea464f324.png" height="100" /> [GitHub](https://github.com/LedgerHQ/ledger-live/), [Ledger Devs Discord](https://developers.ledger.com/discord-pro), [Developer Portal](https://developers.ledger.com/) ## @ledgerhq/hw-transport-node-hid-noevents Allows to communicate with Ledger Hardware Wallets. **\[Node]**/Electron **(HID)** – uses **only** `node-hid`. Does not provide USB events. ## API <!-- Generated by documentation.js. Update this documentation by updating the source code. --> #### Table of Contents * [TransportNodeHidNoEvents](#transportnodehidnoevents) * [Parameters](#parameters) * [Examples](#examples) * [exchange](#exchange) * [Parameters](#parameters-1) * [close](#close) * [isSupported](#issupported) * [list](#list) * [listen](#listen) * [Parameters](#parameters-2) * [open](#open) * [Parameters](#parameters-3) ### TransportNodeHidNoEvents **Extends Transport** node-hid Transport minimal implementation #### Parameters * `device` **HID.HID**&#x20; * `$1` **{context: TraceContext?, logType: LogType?}** (optional, default `{}`) * `$1.context` &#x20; * `$1.logType` &#x20; #### Examples ```javascript import TransportNodeHid from "@ledgerhq/hw-transport-node-hid-noevents"; ... TransportNodeHid.create().then(transport => ...) ``` #### exchange Exchange with the device using APDU protocol. ##### Parameters * `apdu` **[Buffer](https://nodejs.org/api/buffer.html)**&#x20; Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Buffer](https://nodejs.org/api/buffer.html)>** a promise of apdu response #### close release the USB device. Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<void>**&#x20; #### isSupported Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>**&#x20; #### list Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<any>**&#x20; #### listen ##### Parameters * `observer` **Observer\<DescriptorEvent\<any>>**&#x20; Returns **Subscription**&#x20; #### open if path="" is not provided, the library will take the first device ##### Parameters * `path` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | null | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**&#x20;