New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ledgerhq/hw-transport-u2f

Package Overview
Dependencies
Maintainers
6
Versions
184
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 1.2.0-beta.b4ba11b7 to 1.2.0-beta.df091f88

37

lib/TransportU2F.js

@@ -44,22 +44,2 @@ "use strict";

const normal64 = base64 => base64.replace(/-/g, "+").replace(/_/g, "/") + "==".substring(0, 3 * base64.length % 4);
function u2fPromise(response, statusList) {
const { signatureData } = response;
return new Promise((resolve, reject) => {
if (typeof signatureData === "string") {
const data = Buffer.from(normal64(signatureData), "base64");
if (typeof statusList !== "undefined") {
const sw = data.readUInt16BE(data.length - 2);
const statusFound = statusList.some(s => s === sw);
if (!statusFound) {
reject("Invalid status " + sw.toString(16));
}
}
resolve(data.toString("hex", 5));
} else {
reject(response);
}
});
}
/**

@@ -87,4 +67,3 @@ * U2F web Transport implementation

exchange(apduHex, statusList) {
const apdu = Buffer.from(apduHex, "hex");
exchange(apdu) {
const keyHandle = wrapApdu(apdu, this.scrambleKey);

@@ -98,3 +77,11 @@ const challenge = Buffer.from("0000000000000000000000000000000000000000000000000000000000000000", "hex");

};
return (0, _u2fApi.sign)(signRequest, this.timeoutSeconds).then(result => u2fPromise(result, statusList));
return (0, _u2fApi.sign)(signRequest, this.timeoutSeconds).then(response => {
const { signatureData } = response;
if (typeof signatureData === "string") {
const data = Buffer.from(normal64(signatureData), "base64");
return data.slice(5);
} else {
throw response;
}
});
}

@@ -114,6 +101,6 @@

TransportU2F.discover = observer => {
TransportU2F.listen = observer => {
let unsubscribed = false;
(0, _u2fApi.isSupported)().then(supported => {
if (!unsubscribed && supported) observer.next(null);
if (!unsubscribed && supported) observer.next({ type: "add", descriptor: null });
});

@@ -120,0 +107,0 @@ return {

{
"name": "@ledgerhq/hw-transport-u2f",
"version": "1.2.0-beta.b4ba11b7",
"version": "1.2.0-beta.df091f88",
"description": "Ledger Hardware Wallet Web implementation of the communication layer, using U2F api",

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

"dependencies": {
"@ledgerhq/hw-transport": "^1.2.0-beta.b4ba11b7",
"@ledgerhq/hw-transport": "^1.2.0-beta.df091f88",
"u2f-api": "^0.2.7"

@@ -32,0 +32,0 @@ },

@@ -41,22 +41,2 @@ /********************************************************************************

"==".substring(0, (3 * base64.length) % 4);
function u2fPromise(response, statusList) {
const { signatureData } = response;
return new Promise((resolve, reject) => {
if (typeof signatureData === "string") {
const data = Buffer.from(normal64(signatureData), "base64");
if (typeof statusList !== "undefined") {
const sw = data.readUInt16BE(data.length - 2);
const statusFound = statusList.some(s => s === sw);
if (!statusFound) {
reject("Invalid status " + sw.toString(16));
}
}
resolve(data.toString("hex", 5));
} else {
reject(response);
}
});
}
/**

@@ -75,6 +55,7 @@ * U2F web Transport implementation

static discover = (observer: *) => {
static listen = (observer: *) => {
let unsubscribed = false;
isSupported().then(supported => {
if (!unsubscribed && supported) observer.next(null);
if (!unsubscribed && supported)
observer.next({ type: "add", descriptor: null });
});

@@ -103,4 +84,3 @@ return {

exchange(apduHex: string, statusList: Array<number>): Promise<string> {
const apdu = Buffer.from(apduHex, "hex");
exchange(apdu: Buffer): Promise<Buffer> {
const keyHandle = wrapApdu(apdu, this.scrambleKey);

@@ -117,5 +97,11 @@ const challenge = Buffer.from(

};
return sign(signRequest, this.timeoutSeconds).then(result =>
u2fPromise(result, statusList)
);
return sign(signRequest, this.timeoutSeconds).then(response => {
const { signatureData } = response;
if (typeof signatureData === "string") {
const data = Buffer.from(normal64(signatureData), "base64");
return data.slice(5);
} else {
throw response;
}
});
}

@@ -122,0 +108,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