Socket
Socket
Sign inDemoInstall

@ledgerhq/hw-transport-webusb

Package Overview
Dependencies
Maintainers
11
Versions
288
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ledgerhq/hw-transport-webusb - npm Package Compare versions

Comparing version 4.41.1 to 4.43.0

34

lib/TransportWebUSB.js

@@ -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) {

12

package.json
{
"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)&lt;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)&lt;[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&lt;DescriptorEvent&lt;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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc