UNPKG

@ledgerhq/hw-transport-web-ble

Version:

Ledger Hardware Wallet Web Bluetooth implementation of the communication layer

109 lines (66 loc) 2.92 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-web-ble Allows to communicate with Ledger Hardware Wallets. **[Web]** **(Bluetooth)** – [check browser support](https://caniuse.com/web-bluetooth). --- ## Are you adding Ledger support to your software wallet? You may be using this package to open a Bluetooth connection between your web application and the device. For a smooth and quick integration: - See the developers’ documentation on the [Developer Portal](https://developers.ledger.com/docs/transport/overview/) and - Go on [Discord](https://developers.ledger.com/discord-pro/) to chat with developer support and the developer community. --- ## API <!-- Generated by documentation.js. Update this documentation by updating the source code. --> #### Table of Contents - [BluetoothTransport](#bluetoothtransport) - [Parameters](#parameters) - [Examples](#examples) - [exchange](#exchange) - [Parameters](#parameters-1) - [observeAvailability](#observeavailability) - [Parameters](#parameters-2) - [listen](#listen) - [Parameters](#parameters-3) - [open](#open) - [Parameters](#parameters-4) - [disconnect](#disconnect) - [Parameters](#parameters-5) ### BluetoothTransport **Extends Transport** react-native bluetooth BLE implementation #### Parameters - `device` **Device** - `writeCharacteristic` **Characteristic** - `notifyObservable` **Observable&lt;any>** - `deviceModel` **DeviceModel** #### Examples ```javascript import BluetoothTransport from "@ledgerhq/hw-transport-web-ble"; ``` #### exchange Exchange with the device using APDU protocol. ##### Parameters - `apdu` **[Buffer](https://nodejs.org/api/buffer.html)** Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[Buffer](https://nodejs.org/api/buffer.html)>** a promise of apdu response #### observeAvailability observe event with { available: bool, type: string } (available is generic, type is specific) an event is emit once and then each time it changes ##### Parameters - `observer` **any** #### listen Scan for Ledger Bluetooth devices. On this web implementation, it only emits ONE device, the one that was selected in the UI (if any). ##### Parameters - `observer` **any** #### open open a bluetooth device. ##### Parameters - `deviceOrId` **(Device | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** #### disconnect globally disconnect a bluetooth device by its id. ##### Parameters - `id` **any**