@ledgerhq/hw-transport-web-ble
Advanced tools
Comparing version 4.37.0-beta.2b8718d2 to 4.37.0
@@ -146,3 +146,3 @@ "use strict"; | ||
return new Promise(function (s) { | ||
return setTimeout(s, 200); | ||
return setTimeout(s, 500); | ||
}); | ||
@@ -239,7 +239,5 @@ | ||
}); | ||
return { | ||
unsubscribe: function unsubscribe() { | ||
unsubscribed = true; | ||
bluetooth.removeEventListener("availabilitychanged", onAvailabilityChanged); | ||
} | ||
return function () { | ||
unsubscribed = true; | ||
bluetooth.removeEventListener("availabilitychanged", onAvailabilityChanged); | ||
}; | ||
@@ -528,3 +526,3 @@ }); | ||
mtu = _context7.t0 + 3; | ||
_context7.next = 13; | ||
_context7.next = 12; | ||
break; | ||
@@ -540,9 +538,6 @@ | ||
}); | ||
_context7.next = 12; | ||
return _this4.device.gatt.disconnect().catch(function () {}); | ||
_this4.device.gatt.disconnect(); | ||
throw _context7.t1; | ||
case 12: | ||
throw _context7.t1; | ||
case 13: | ||
case "end": | ||
@@ -549,0 +544,0 @@ return _context7.stop(); |
{ | ||
"name": "@ledgerhq/hw-transport-web-ble", | ||
"version": "4.37.0-beta.2b8718d2", | ||
"version": "4.37.0", | ||
"description": "Ledger Hardware Wallet Web Bluetooth implementation of the communication layer", | ||
@@ -28,9 +28,9 @@ "keywords": [ | ||
"dependencies": { | ||
"@ledgerhq/devices": "^4.37.0-beta.2b8718d2", | ||
"@ledgerhq/errors": "^4.37.0-beta.2b8718d2", | ||
"@ledgerhq/hw-transport": "^4.37.0-beta.2b8718d2", | ||
"@ledgerhq/devices": "^4.37.0", | ||
"@ledgerhq/errors": "^4.37.0", | ||
"@ledgerhq/hw-transport": "^4.37.0", | ||
"rxjs": "^6.4.0" | ||
}, | ||
"devDependencies": { | ||
"flow-bin": "^0.66.0", | ||
"flow-bin": "^0.92.1", | ||
"flow-typed": "^2.3.0" | ||
@@ -40,6 +40,8 @@ }, | ||
"flow": "flow", | ||
"clean": "rm -rf lib/", | ||
"build": "cd ../.. && export PATH=$(yarn bin):$PATH && cd - && babel --source-maps -d lib src && flow-copy-source -v src lib", | ||
"watch": "cd ../.. && export PATH=$(yarn bin):$PATH && cd - && babel --watch --source-maps -d lib src & flow-copy-source -w -v src lib" | ||
} | ||
"clean": "bash ../../script/clean.sh", | ||
"build": "bash ../../script/build.sh", | ||
"watch": "bash ../../script/watch.sh", | ||
"doc": "bash ../../script/doc.sh" | ||
}, | ||
"gitHead": "8b31eec9c71f2b8ec4d1db47c2fb7ae20f188de2" | ||
} |
<img src="https://user-images.githubusercontent.com/211411/34776833-6f1ef4da-f618-11e7-8b13-f0697901d6a8.png" height="100" /> | ||
[Github](https://github.com/LedgerHQ/ledgerjs/), | ||
[API Doc](http://ledgerhq.github.io/ledgerjs/), | ||
[Ledger Devs Slack](https://ledger-dev.slack.com/) | ||
## @ledgerhq/hw-transport-web-ble | ||
Library for Ledger Hardware Wallets. | ||
Allows to communicate with Ledger Hardware Wallets. | ||
[Github](https://github.com/LedgerHQ/ledgerjs/), | ||
[API Doc](http://ledgerhq.github.io/ledgerjs/), | ||
[Ledger Devs Slack](https://ledger-dev.slack.com/) | ||
**[Web]** **(Bluetooth)** – [check browser support](https://caniuse.com/web-bluetooth). | ||
## API | ||
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
#### Table of Contents | ||
- [BluetoothTransport](#bluetoothtransport) | ||
- [Parameters](#parameters) | ||
- [Examples](#examples) | ||
- [observeAvailability](#observeavailability) | ||
- [Parameters](#parameters-1) | ||
### BluetoothTransport | ||
**Extends Transport** | ||
react-native bluetooth BLE implementation | ||
#### Parameters | ||
- `device` **Device** | ||
- `writeCharacteristic` **Characteristic** | ||
- `notifyObservable` **Observable<any>** | ||
- `deviceModel` **DeviceModel** | ||
#### Examples | ||
```javascript | ||
import BluetoothTransport from "@ledgerhq/hw-transport-web-ble"; | ||
``` | ||
#### observeAvailability | ||
TODO could add this concept in all transports | ||
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** |
@@ -27,3 +27,3 @@ // @flow | ||
mtuSize: number | ||
) => { | ||
): Observable<void> => { | ||
const chunks = chunkBuffer(apdu, i => mtuSize - (i === 0 ? 5 : 3)).map( | ||
@@ -30,0 +30,0 @@ (buffer, i) => { |
@@ -35,3 +35,3 @@ // @flow | ||
const availability = () => | ||
const availability = (): Observable<boolean> => | ||
Observable.create(observer => { | ||
@@ -49,10 +49,8 @@ const bluetooth = requiresBluetooth(); | ||
}); | ||
return { | ||
unsubscribe: () => { | ||
unsubscribed = true; | ||
bluetooth.removeEventListener( | ||
"availabilitychanged", | ||
onAvailabilityChanged | ||
); | ||
} | ||
return () => { | ||
unsubscribed = true; | ||
bluetooth.removeEventListener( | ||
"availabilitychanged", | ||
onAvailabilityChanged | ||
); | ||
}; | ||
@@ -165,4 +163,4 @@ }); | ||
await device.gatt.disconnect(); | ||
// It seems web ble needs some time to really disconnect?! | ||
await new Promise(s => setTimeout(s, 200)); | ||
// necessary time for the bonding workaround | ||
await new Promise(s => setTimeout(s, 500)); | ||
} | ||
@@ -293,3 +291,3 @@ } | ||
}); | ||
await this.device.gatt.disconnect().catch(() => {}); | ||
this.device.gatt.disconnect(); | ||
throw e; | ||
@@ -296,0 +294,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
53
104324
28
1274
Updated@ledgerhq/devices@^4.37.0
Updated@ledgerhq/errors@^4.37.0