@ledgerhq/hw-transport-webusb
Advanced tools
Comparing version 4.41.1 to 4.43.0
@@ -57,4 +57,26 @@ "use strict"; | ||
/** | ||
* Check if WebUSB transport is supported. | ||
*/ | ||
/** | ||
* List the WebUSB devices that was previously authorized. | ||
*/ | ||
/** | ||
* Actively listen to WebUSB devices and emit ONE device that was selected by the native permission UI. | ||
* | ||
* Important: it must be called in the context of a UI click! | ||
*/ | ||
_createClass(TransportWebUSB, [{ | ||
key: "close", | ||
/** | ||
* Release the transport device | ||
*/ | ||
value: function () { | ||
@@ -95,2 +117,9 @@ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { | ||
}() | ||
/** | ||
* Exchange with the device using APDU protocol. | ||
* @param apdu | ||
* @returns a promise of apdu response | ||
*/ | ||
}, { | ||
@@ -101,2 +130,7 @@ key: "setScrambleKey", | ||
key: "open", | ||
/** | ||
* Create a Ledger transport with a USBDevice | ||
*/ | ||
value: function () { | ||
@@ -103,0 +137,0 @@ var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(device) { |
{ | ||
"name": "@ledgerhq/hw-transport-webusb", | ||
"version": "4.41.1", | ||
"version": "4.43.0", | ||
"description": "Ledger Hardware Wallet WebUSB implementation of the communication layer", | ||
@@ -27,8 +27,8 @@ "keywords": [ | ||
"dependencies": { | ||
"@ledgerhq/devices": "^4.41.1", | ||
"@ledgerhq/errors": "^4.41.1", | ||
"@ledgerhq/hw-transport": "^4.41.1" | ||
"@ledgerhq/devices": "^4.43.0", | ||
"@ledgerhq/errors": "^4.43.0", | ||
"@ledgerhq/hw-transport": "^4.43.0" | ||
}, | ||
"devDependencies": { | ||
"flow-bin": "^0.92.1", | ||
"flow-bin": "^0.94.0", | ||
"flow-typed": "^2.3.0" | ||
@@ -43,3 +43,3 @@ }, | ||
}, | ||
"gitHead": "b8b85dda3360d61b8ff18c8cce70a3cf367b7897" | ||
"gitHead": "7ccb5e16a1aa635f9911fbb1bb7eeac87b4e522b" | ||
} |
@@ -13,2 +13,4 @@ <img src="https://user-images.githubusercontent.com/211411/34776833-6f1ef4da-f618-11e7-8b13-f0697901d6a8.png" height="100" /> | ||
Important: The transport functions `create()` and `listen()` must be in the context of an user interaction (like a **"click"** event), otherwise it will fails with DOM Exception. | ||
## API | ||
@@ -23,2 +25,11 @@ | ||
- [Examples](#examples) | ||
- [close](#close) | ||
- [exchange](#exchange) | ||
- [Parameters](#parameters-1) | ||
- [isSupported](#issupported) | ||
- [list](#list) | ||
- [listen](#listen) | ||
- [Parameters](#parameters-2) | ||
- [open](#open) | ||
- [Parameters](#parameters-3) | ||
@@ -42,1 +53,45 @@ ### TransportWebUSB | ||
``` | ||
#### close | ||
Release the transport device | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<void>** | ||
#### 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)<[Buffer](https://nodejs.org/api/buffer.html)>** a promise of apdu response | ||
#### isSupported | ||
Check if WebUSB transport is supported. | ||
#### list | ||
List the WebUSB devices that was previously authorized. | ||
#### listen | ||
Actively listen to WebUSB devices and emit ONE device that was selected by the native permission UI. | ||
Important: it must be called in the context of a UI click! | ||
##### Parameters | ||
- `observer` **Observer<DescriptorEvent<USBDevice>>** | ||
Returns **Subscription** | ||
#### open | ||
Create a Ledger transport with a USBDevice | ||
##### Parameters | ||
- `device` **USBDevice** |
@@ -33,6 +33,17 @@ //@flow | ||
/** | ||
* Check if WebUSB transport is supported. | ||
*/ | ||
static isSupported = isSupported; | ||
/** | ||
* List the WebUSB devices that was previously authorized. | ||
*/ | ||
static list = getLedgerDevices; | ||
/** | ||
* Actively listen to WebUSB devices and emit ONE device that was selected by the native permission UI. | ||
* | ||
* Important: it must be called in the context of a UI click! | ||
*/ | ||
static listen = ( | ||
@@ -55,2 +66,5 @@ observer: Observer<DescriptorEvent<USBDevice>> | ||
/** | ||
* Create a Ledger transport with a USBDevice | ||
*/ | ||
static async open(device: USBDevice) { | ||
@@ -66,2 +80,5 @@ await device.open(); | ||
/** | ||
* Release the transport device | ||
*/ | ||
async close(): Promise<void> { | ||
@@ -74,2 +91,7 @@ await this.exchangeBusyPromise; | ||
/** | ||
* Exchange with the device using APDU protocol. | ||
* @param apdu | ||
* @returns a promise of apdu response | ||
*/ | ||
exchange = (apdu: Buffer): Promise<Buffer> => | ||
@@ -76,0 +98,0 @@ this.exchangeAtomicImpl(async () => { |
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
45198
514
95
Updated@ledgerhq/devices@^4.43.0
Updated@ledgerhq/errors@^4.43.0