@ledgerhq/hw-transport-http
Advanced tools
Comparing version 6.3.0 to 6.6.0
@@ -68,7 +68,7 @@ var __extends = (this && this.__extends) || (function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, HttpTransport.check(url, timeout)]; | ||
case 1: | ||
_a.sent(); | ||
_b.sent(); | ||
return [2 /*return*/, new HttpTransport(url)]; | ||
@@ -82,4 +82,4 @@ } | ||
var apduHex, response, body; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
@@ -100,3 +100,3 @@ apduHex = apdu.toString("hex"); | ||
case 1: | ||
response = _a.sent(); | ||
response = _b.sent(); | ||
if (response.status !== 200) { | ||
@@ -107,3 +107,3 @@ throw new TransportError("failed to communicate to server. code=" + response.status, "HttpTransportStatus" + response.status); | ||
case 2: | ||
body = _a.sent(); | ||
body = _b.sent(); | ||
if (body.error) | ||
@@ -121,2 +121,4 @@ throw body.error; | ||
}; | ||
var _a; | ||
_a = HttpTransport; | ||
HttpTransport.isSupported = function () { | ||
@@ -134,4 +136,4 @@ return Promise.resolve(typeof fetch === "function"); | ||
var response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
return __generator(_a, function (_b) { | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, axios({ | ||
@@ -142,3 +144,3 @@ url: url, | ||
case 1: | ||
response = _a.sent(); | ||
response = _b.sent(); | ||
if (response.status !== 200) { | ||
@@ -145,0 +147,0 @@ throw new TransportError("failed to access HttpTransport(" + |
@@ -73,4 +73,4 @@ var __extends = (this && this.__extends) || (function () { | ||
var exchangeMethods; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, new Promise(function (resolve, reject) { | ||
@@ -117,3 +117,3 @@ try { | ||
case 1: | ||
exchangeMethods = _a.sent(); | ||
exchangeMethods = _c.sent(); | ||
return [2 /*return*/, new WebSocketTransport(exchangeMethods)]; | ||
@@ -128,4 +128,4 @@ } | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
@@ -140,3 +140,3 @@ hex = apdu.toString("hex"); | ||
case 1: | ||
res = _a.sent(); | ||
res = _c.sent(); | ||
log("apdu", "<= " + res.toString("hex")); | ||
@@ -151,3 +151,3 @@ return [2 /*return*/, res]; | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return __generator(this, function (_c) { | ||
this.hook.close(); | ||
@@ -162,2 +162,4 @@ return [2 /*return*/, new Promise(function (success) { | ||
}; | ||
var _a; | ||
_a = WebSocketTransport; | ||
WebSocketTransport.isSupported = function () { | ||
@@ -174,3 +176,3 @@ return Promise.resolve(typeof WebSocket === "function"); | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return __generator(_a, function (_c) { | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
@@ -177,0 +179,0 @@ var socket = new WebSocket(url); |
@@ -73,7 +73,7 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, HttpTransport.check(url, timeout)]; | ||
case 1: | ||
_a.sent(); | ||
_b.sent(); | ||
return [2 /*return*/, new HttpTransport(url)]; | ||
@@ -87,8 +87,8 @@ } | ||
var apduHex, response, body; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
apduHex = apdu.toString("hex"); | ||
logs_1.log("apdu", "=> " + apduHex); | ||
return [4 /*yield*/, axios_1["default"]({ | ||
(0, logs_1.log)("apdu", "=> " + apduHex); | ||
return [4 /*yield*/, (0, axios_1["default"])({ | ||
method: "POST", | ||
@@ -105,3 +105,3 @@ url: this.url, | ||
case 1: | ||
response = _a.sent(); | ||
response = _b.sent(); | ||
if (response.status !== 200) { | ||
@@ -112,6 +112,6 @@ throw new errors_1.TransportError("failed to communicate to server. code=" + response.status, "HttpTransportStatus" + response.status); | ||
case 2: | ||
body = _a.sent(); | ||
body = _b.sent(); | ||
if (body.error) | ||
throw body.error; | ||
logs_1.log("apdu", "<= " + body.data); | ||
(0, logs_1.log)("apdu", "<= " + body.data); | ||
return [2 /*return*/, Buffer.from(body.data, "hex")]; | ||
@@ -126,2 +126,4 @@ } | ||
}; | ||
var _a; | ||
_a = HttpTransport; | ||
HttpTransport.isSupported = function () { | ||
@@ -139,5 +141,5 @@ return Promise.resolve(typeof fetch === "function"); | ||
var response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, axios_1["default"]({ | ||
return __generator(_a, function (_b) { | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, (0, axios_1["default"])({ | ||
url: url, | ||
@@ -147,3 +149,3 @@ timeout: timeout | ||
case 1: | ||
response = _a.sent(); | ||
response = _b.sent(); | ||
if (response.status !== 200) { | ||
@@ -150,0 +152,0 @@ throw new errors_1.TransportError("failed to access HttpTransport(" + |
@@ -78,4 +78,4 @@ "use strict"; | ||
var exchangeMethods; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, new Promise(function (resolve, reject) { | ||
@@ -122,3 +122,3 @@ try { | ||
case 1: | ||
exchangeMethods = _a.sent(); | ||
exchangeMethods = _c.sent(); | ||
return [2 /*return*/, new WebSocketTransport(exchangeMethods)]; | ||
@@ -133,7 +133,7 @@ } | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
hex = apdu.toString("hex"); | ||
logs_1.log("apdu", "=> " + hex); | ||
(0, logs_1.log)("apdu", "=> " + hex); | ||
return [4 /*yield*/, new Promise(function (resolve, reject) { | ||
@@ -145,4 +145,4 @@ _this.hook.rejectExchange = function (e) { return reject(e); }; | ||
case 1: | ||
res = _a.sent(); | ||
logs_1.log("apdu", "<= " + res.toString("hex")); | ||
res = _c.sent(); | ||
(0, logs_1.log)("apdu", "<= " + res.toString("hex")); | ||
return [2 /*return*/, res]; | ||
@@ -156,3 +156,3 @@ } | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return __generator(this, function (_c) { | ||
this.hook.close(); | ||
@@ -167,2 +167,4 @@ return [2 /*return*/, new Promise(function (success) { | ||
}; | ||
var _a; | ||
_a = WebSocketTransport; | ||
WebSocketTransport.isSupported = function () { | ||
@@ -179,3 +181,3 @@ return Promise.resolve(typeof WebSocket === "function"); | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return __generator(_a, function (_c) { | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
@@ -182,0 +184,0 @@ var socket = new WebSocket(url); |
{ | ||
"name": "@ledgerhq/hw-transport-http", | ||
"version": "6.3.0", | ||
"version": "6.6.0", | ||
"description": "Ledger Hardware Wallet communication layer over http", | ||
@@ -33,3 +33,3 @@ "keywords": [ | ||
"@ledgerhq/logs": "^6.2.0", | ||
"axios": "^0.21.1", | ||
"axios": "^0.21.3", | ||
"ws": "7" | ||
@@ -42,3 +42,3 @@ }, | ||
}, | ||
"gitHead": "1d1390f9be381e4f2698a43e72787d9540536b4d" | ||
"gitHead": "d694b9f12d91fe04c25f84fa0ea84346b0fd7232" | ||
} |
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
97182
1408
Updatedaxios@^0.21.3