Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ledgerhq/hw-transport-node-hid

Package Overview
Dependencies
Maintainers
6
Versions
399
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ledgerhq/hw-transport-node-hid - npm Package Compare versions

Comparing version 1.2.0-beta.10b44916 to 1.2.0-beta.5f7fbb68

22

lib/TransportNodeHid.js

@@ -70,3 +70,3 @@ "use strict";

exchange(apduHex, statusList) {
exchange(apdu) {
function ledgerWrap(channel, command, packetSize) {

@@ -159,4 +159,2 @@ let sequenceIdx = 0;

const apdu = Buffer.from(apduHex, "hex");
const deferred = defer();

@@ -270,9 +268,7 @@ let exchangeTimeout;

performExchange().then(result => {
let status,
response,
let response,
resultBin = result;
if (!this.ledgerTransport) {
if (resultBin.length === 2 || resultBin[0] !== 0x61) {
status = resultBin[0] << 8 | resultBin[1];
response = resultBin.toString("hex");
response = resultBin;
} else {

@@ -284,15 +280,7 @@ let size = resultBin[1];

}
response = resultBin.toString("hex", 2);
status = resultBin[2 + size] << 8 | resultBin[2 + size + 1];
response = resultBin.slice(2);
}
} else {
response = resultBin.toString("hex");
status = resultBin[resultBin.length - 2] << 8 | resultBin[resultBin.length - 1];
response = resultBin;
}
// Check the status
const statusFound = statusList.some(s => s === status);
if (!statusFound) {
deferred.reject("Invalid status " + status.toString(16));
}
// build the response

@@ -299,0 +287,0 @@ if (this.timeout !== 0) {

{
"name": "@ledgerhq/hw-transport-node-hid",
"version": "1.2.0-beta.10b44916",
"version": "1.2.0-beta.5f7fbb68",
"description": "Ledger Hardware Wallet Node implementation of the communication layer, using node-hid",

@@ -28,3 +28,3 @@ "keywords": [

"dependencies": {
"@ledgerhq/hw-transport": "^1.2.0-beta.10b44916",
"@ledgerhq/hw-transport": "^1.2.0-beta.5f7fbb68",
"node-hid": "^0.7.2"

@@ -31,0 +31,0 @@ },

@@ -96,3 +96,3 @@ //@flow

exchange(apduHex: string, statusList: Array<number>): Promise<string> {
exchange(apdu: Buffer): Promise<Buffer> {
function ledgerWrap(channel, command, packetSize) {

@@ -202,4 +202,2 @@ let sequenceIdx = 0;

const apdu = Buffer.from(apduHex, "hex");
const deferred = defer();

@@ -330,9 +328,7 @@ let exchangeTimeout;

.then(result => {
let status,
response,
let response,
resultBin = result;
if (!this.ledgerTransport) {
if (resultBin.length === 2 || resultBin[0] !== 0x61) {
status = (resultBin[0] << 8) | resultBin[1];
response = resultBin.toString("hex");
response = resultBin;
} else {

@@ -344,17 +340,7 @@ let size = resultBin[1];

}
response = resultBin.toString("hex", 2);
status = (resultBin[2 + size] << 8) | resultBin[2 + size + 1];
response = resultBin.slice(2);
}
} else {
response = resultBin.toString("hex");
status =
(resultBin[resultBin.length - 2] << 8) |
resultBin[resultBin.length - 1];
response = resultBin;
}
// Check the status
const statusFound = statusList.some(s => s === status);
if (!statusFound) {
deferred.reject("Invalid status " + status.toString(16));
}
// build the response

@@ -361,0 +347,0 @@ if (this.timeout !== 0) {

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