https://github.com/oasisprotocol/ionic-ledger-hw-transport-ble
https://github.com/oasisprotocol/ionic-ledger-hw-transport-ble
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/oasisprotocol/ionic-ledger-hw-transport-ble
- Owner: oasisprotocol
- License: apache-2.0
- Created: 2023-08-22T15:55:54.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2025-01-17T10:45:30.000Z (over 1 year ago)
- Last Synced: 2025-01-29T03:54:07.754Z (over 1 year ago)
- Language: TypeScript
- Size: 176 KB
- Stars: 0
- Watchers: 14
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ionic-ledger-hw-transport-ble
[](https://opensource.org/licenses/Apache-2.0)
[![CI test status][github-ci-tests-badge]][github-ci-tests-link]
[github-ci-tests-badge]: https://github.com/oasisprotocol/ionic-ledger-hw-transport-ble/workflows/ci-test/badge.svg
[github-ci-tests-link]: https://github.com/oasisprotocol/ionic-ledger-hw-transport-ble/actions?query=workflow:ci-test+branch:master
**Ledger Hardware Wallet Bluetooth BLE transport for Ionic.**
```shell
yarn add @oasisprotocol/ionic-ledger-hw-transport-ble
```
### Pre-requisite
- [**Install and link library `@capacitor-community/bluetooth-le` + configure your app for Bluetooth permissions**](https://github.com/capacitor-community/bluetooth-le) (Open the link for documentation)
- **global.Buffer** available. Typically `global.Buffer = require("buffer").Buffer;` that can be placed in a `polyfill.js` and imported with `import "./polyfill";` at first line of the main JavaScript entry file.
## Minimal getting started
`@oasisprotocol/ionic-ledger-hw-transport-ble` works like any of `@ledgerhq/hw-transport` libraries.
The difference here is that the `list()` is not implemented, only `create()`.
Create doesn't always scan for devices, it tries to reuse previously selected
device.
> Important: you will also have to deal with specifics of Bluetooth BLE, for instance, you need to request the LOCATION permission on Android!
Here is a gist of the most important parts required.
### Check for Bluetooth state
```ts
import BleTransport from "@oasisprotocol/ionic-ledger-hw-transport-ble";
// Check if @capacitor-community/bluetooth-le is setup
BleTransport.isSupported()
// Check for bluetooth status
BleTransport.isEnabled()
```
### Connect to device
```ts
const transport = await BleTransport.create()
```
**and now we can just use the transport like any other Ledger transport!**