@ledgerhq/hw-transport-u2f
Advanced tools
Comparing version 4.8.0-beta.b178a6cf to 4.8.0-rc1.1b178f67
@@ -11,2 +11,6 @@ "use strict"; | ||
var _typeof2 = require("babel-runtime/helpers/typeof"); | ||
var _typeof3 = _interopRequireDefault(_typeof2); | ||
var _getPrototypeOf = require("babel-runtime/core-js/object/get-prototype-of"); | ||
@@ -20,6 +24,2 @@ | ||
var _typeof2 = require("babel-runtime/helpers/typeof"); | ||
var _typeof3 = _interopRequireDefault(_typeof2); | ||
var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator"); | ||
@@ -139,3 +139,2 @@ | ||
var openTimeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5000; | ||
var isU2FError; | ||
return _regenerator2.default.wrap(function _callee$(_context) { | ||
@@ -145,39 +144,5 @@ while (1) { | ||
case 0: | ||
_context.prev = 0; | ||
_context.next = 3; | ||
return attemptExchange(Buffer.alloc(6), openTimeout, false, Buffer.alloc(1)); | ||
case 3: | ||
_context.next = 17; | ||
break; | ||
case 5: | ||
_context.prev = 5; | ||
_context.t0 = _context["catch"](0); | ||
isU2FError = (0, _typeof3.default)(_context.t0.metaData) === "object"; | ||
if (!isU2FError) { | ||
_context.next = 16; | ||
break; | ||
} | ||
if (!isTimeoutU2FError(_context.t0)) { | ||
_context.next = 14; | ||
break; | ||
} | ||
emitDisconnect(); | ||
throw wrapU2FTransportError(_context.t0, "Ledger device unreachable.\n" + "Make sure the device is plugged, unlocked and with the correct application opened." + (location && location.protocol !== "https:" ? "\nYou are not running on HTTPS. U2F is likely to not work in unsecure protocol." : ""), "Timeout"); | ||
case 14: | ||
_context.next = 17; | ||
break; | ||
case 16: | ||
throw _context.t0; | ||
case 17: | ||
return _context.abrupt("return", new TransportU2F()); | ||
case 18: | ||
case 1: | ||
case "end": | ||
@@ -187,3 +152,3 @@ return _context.stop(); | ||
} | ||
}, _callee, this, [[0, 5]]); | ||
}, _callee, this); | ||
})); | ||
@@ -190,0 +155,0 @@ |
{ | ||
"name": "@ledgerhq/hw-transport-u2f", | ||
"version": "4.8.0-beta.b178a6cf", | ||
"version": "4.8.0-rc1.1b178f67", | ||
"description": "Ledger Hardware Wallet Web implementation of the communication layer, using U2F api", | ||
@@ -29,3 +29,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@ledgerhq/hw-transport": "^4.8.0-beta.b178a6cf", | ||
"@ledgerhq/hw-transport": "^4.8.0-rc1.1b178f67", | ||
"u2f-api": "0.2.7" | ||
@@ -32,0 +32,0 @@ }, |
@@ -124,7 +124,7 @@ //@flow | ||
static async open(_: *, openTimeout?: number = 5000): Promise<TransportU2F> { | ||
try { | ||
/*try { | ||
// This is not a valid exchange at all, but this allows to have a way to know if there is a device. | ||
// in case it reaches the timeout, we will throw timeout error, in other case, we will return the U2FTransport. | ||
await attemptExchange( | ||
Buffer.alloc(6), | ||
Buffer.alloc(0), | ||
openTimeout, | ||
@@ -154,3 +154,3 @@ false, | ||
} | ||
} | ||
}*/ | ||
return new TransportU2F(); | ||
@@ -157,0 +157,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
30684
40608
673