diff --git a/package.json b/package.json index 1c293a97..adaa3aec 100644 --- a/package.json +++ b/package.json @@ -43,12 +43,12 @@ "webpack-sources": "1.0.1" }, "dependencies": { - "@ledgerhq/currencies": "^4.7.3", + "@ledgerhq/currencies": "^4.7.5", "@ledgerhq/hw-app-btc": "^4.7.3", "@ledgerhq/hw-app-eth": "^4.7.3", "@ledgerhq/hw-transport": "^4.7.3", "@ledgerhq/hw-transport-node-hid": "^4.7.3", - "@ledgerhq/wallet-common": "^0.6.0", + "@ledgerhq/wallet-common": "^0.10.0", "axios": "^0.18.0", "bcryptjs": "^2.4.3", "bitcoinjs-lib": "^3.3.2", @@ -117,7 +117,7 @@ "concurrently": "^3.5.1", "dotenv": "^5.0.1", "electron": "1.8.4", - "electron-builder": "^20.8.0", + "electron-builder": "^20.8.1", "electron-devtools-installer": "^2.2.3", "electron-rebuild": "^1.7.3", "electron-webpack": "^2.0.1", diff --git a/src/internals/usb/devices.js b/src/internals/usb/devices.js index e735149c..a21b2188 100644 --- a/src/internals/usb/devices.js +++ b/src/internals/usb/devices.js @@ -38,8 +38,15 @@ export default (send: IPCSend) => ({ async function isValidHIDDevice(devicePath: string): Promise { try { const transport: Transport<*> = await CommNodeHid.open(devicePath) - await transport.send(...APDUS.GET_FIRMWARE) - return true + try { + await transport.send(...APDUS.GET_FIRMWARE) + return true + } catch (err) { + // if we are inside an app, the first call should have failed, + // so we try this one + await transport.send(...APDUS.GET_FIRMWARE_FALLBACK) + return true + } } catch (err) { return false } diff --git a/src/internals/usb/manager/constants.js b/src/internals/usb/manager/constants.js index c67191e1..834a7b03 100644 --- a/src/internals/usb/manager/constants.js +++ b/src/internals/usb/manager/constants.js @@ -4,4 +4,7 @@ export const BASE_SOCKET_URL = 'ws://api.ledgerwallet.com/update/install' // List of APDUS export const APDUS = { GET_FIRMWARE: [0xe0, 0x01, 0x00, 0x00], + // we dont have common call that works inside app & dashboard + // TODO: this should disappear. + GET_FIRMWARE_FALLBACK: [0xe0, 0xc4, 0x00, 0x00], } diff --git a/yarn.lock b/yarn.lock index 06cbc0d0..798dedd6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -913,7 +913,7 @@ lodash "^4.2.0" to-fast-properties "^2.0.0" -"@ledgerhq/currencies@^4.7.1", "@ledgerhq/currencies@^4.7.3": +"@ledgerhq/currencies@^4.7.1": version "4.7.3" resolved "https://registry.yarnpkg.com/@ledgerhq/currencies/-/currencies-4.7.3.tgz#0e28c0f1c74cf00b990be6865fbec374f808b71f" dependencies: @@ -921,6 +921,14 @@ numeral "^2.0.6" querystring "^0.2.0" +"@ledgerhq/currencies@^4.7.5": + version "4.7.5" + resolved "https://registry.yarnpkg.com/@ledgerhq/currencies/-/currencies-4.7.5.tgz#e852b58359254fbb2087de328df84343b586f4ab" + dependencies: + lodash "^4.17.5" + numeral "^2.0.6" + querystring "^0.2.0" + "@ledgerhq/hw-app-btc@^4.7.3": version "4.7.3" resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-btc/-/hw-app-btc-4.7.3.tgz#5a7d365f893f5a72bbb6b639d1738edced712c5f" @@ -947,9 +955,9 @@ dependencies: events "^2.0.0" -"@ledgerhq/wallet-common@^0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/wallet-common/-/wallet-common-0.6.0.tgz#e6a77fada1e3eaef4d6e59f3ea5cebaf0a276a63" +"@ledgerhq/wallet-common@^0.10.0": + version "0.10.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/wallet-common/-/wallet-common-0.10.0.tgz#0275de0d0f73bdfb7aee7bbbaa324f2f3f993aee" dependencies: "@ledgerhq/currencies" "^4.7.1" axios "^0.18.0" @@ -1366,38 +1374,38 @@ app-builder-bin-linux@1.7.2: version "1.7.2" resolved "https://registry.yarnpkg.com/app-builder-bin-linux/-/app-builder-bin-linux-1.7.2.tgz#a764c8e52ecf1b5b068f32c820c6daf1ffed6a8f" -app-builder-bin-linux@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/app-builder-bin-linux/-/app-builder-bin-linux-1.8.2.tgz#ea3290e8806099f686a859bfae6e94b136f0daeb" - app-builder-bin-linux@1.8.3: version "1.8.3" resolved "https://registry.yarnpkg.com/app-builder-bin-linux/-/app-builder-bin-linux-1.8.3.tgz#4bf638a7bd29365e5534d2ba554baf1350fb4a87" +app-builder-bin-linux@1.8.4: + version "1.8.4" + resolved "https://registry.yarnpkg.com/app-builder-bin-linux/-/app-builder-bin-linux-1.8.4.tgz#9fa4f4f6af21f147cdedc69279940134c77d297f" + app-builder-bin-mac@1.7.2: version "1.7.2" resolved "https://registry.yarnpkg.com/app-builder-bin-mac/-/app-builder-bin-mac-1.7.2.tgz#c4ee0d950666c97c12a45ac74ec6396be3357644" -app-builder-bin-mac@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/app-builder-bin-mac/-/app-builder-bin-mac-1.8.2.tgz#15e96ae41604346efc3c3864e7da0f40200bd4e5" - app-builder-bin-mac@1.8.3: version "1.8.3" resolved "https://registry.yarnpkg.com/app-builder-bin-mac/-/app-builder-bin-mac-1.8.3.tgz#8e2c63e9d822fce2eee8db2f9f817d7b68532df7" +app-builder-bin-mac@1.8.4: + version "1.8.4" + resolved "https://registry.yarnpkg.com/app-builder-bin-mac/-/app-builder-bin-mac-1.8.4.tgz#abd35353167b037a15353fe44c84b0b17045d12f" + app-builder-bin-win@1.7.2: version "1.7.2" resolved "https://registry.yarnpkg.com/app-builder-bin-win/-/app-builder-bin-win-1.7.2.tgz#7acac890782f4118f09941b343ba06c56452a6f6" -app-builder-bin-win@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/app-builder-bin-win/-/app-builder-bin-win-1.8.2.tgz#5cf9a7a1d07eb75b03367f8ea80efc456746515e" - app-builder-bin-win@1.8.3: version "1.8.3" resolved "https://registry.yarnpkg.com/app-builder-bin-win/-/app-builder-bin-win-1.8.3.tgz#3598ec1c523dd197e8bb5dfeab3e2fe70905ae79" +app-builder-bin-win@1.8.4: + version "1.8.4" + resolved "https://registry.yarnpkg.com/app-builder-bin-win/-/app-builder-bin-win-1.8.4.tgz#ba5f7a7d8ae48d32c400691b3c45f6f746c27748" + app-builder-bin@1.7.2: version "1.7.2" resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-1.7.2.tgz#daf67060a6bad8f5f611a0d2876d9db897a83f06" @@ -1406,14 +1414,6 @@ app-builder-bin@1.7.2: app-builder-bin-mac "1.7.2" app-builder-bin-win "1.7.2" -app-builder-bin@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-1.8.2.tgz#a81602e75d1616c80ce29a77762617cbf293c593" - optionalDependencies: - app-builder-bin-linux "1.8.2" - app-builder-bin-mac "1.8.2" - app-builder-bin-win "1.8.2" - app-builder-bin@1.8.3: version "1.8.3" resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-1.8.3.tgz#902174b5864521e5068fe1d8ae5566633a5b9c44" @@ -1422,6 +1422,14 @@ app-builder-bin@1.8.3: app-builder-bin-mac "1.8.3" app-builder-bin-win "1.8.3" +app-builder-bin@1.8.4: + version "1.8.4" + resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-1.8.4.tgz#ca8fd02209c2e0681de97fdb4c559d93381cc812" + optionalDependencies: + app-builder-bin-linux "1.8.4" + app-builder-bin-mac "1.8.4" + app-builder-bin-win "1.8.4" + app-root-path@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-2.0.1.tgz#cd62dcf8e4fd5a417efc664d2e5b10653c651b46" @@ -3171,12 +3179,12 @@ builder-util@5.6.7: stat-mode "^0.2.2" temp-file "^3.1.1" -builder-util@5.7.3: - version "5.7.3" - resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-5.7.3.tgz#c7150e3a2bd439bd6e29a6b51bcb042001bf131b" +builder-util@5.7.4, builder-util@^5.6.7, builder-util@^5.7.0: + version "5.7.4" + resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-5.7.4.tgz#d6e9a56e2865f0d0a504a07ea0f8dc35185b4795" dependencies: "7zip-bin" "~3.1.0" - app-builder-bin "1.8.2" + app-builder-bin "1.8.3" bluebird-lst "^1.0.5" builder-util-runtime "^4.2.0" chalk "^2.3.2" @@ -3190,12 +3198,12 @@ builder-util@5.7.3: stat-mode "^0.2.2" temp-file "^3.1.1" -builder-util@^5.6.7, builder-util@^5.7.0, builder-util@^5.7.3: - version "5.7.4" - resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-5.7.4.tgz#d6e9a56e2865f0d0a504a07ea0f8dc35185b4795" +builder-util@^5.7.4: + version "5.7.5" + resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-5.7.5.tgz#58f8d2b7a35445c5fb45bff50b39bbed554c9863" dependencies: "7zip-bin" "~3.1.0" - app-builder-bin "1.8.3" + app-builder-bin "1.8.4" bluebird-lst "^1.0.5" builder-util-runtime "^4.2.0" chalk "^2.3.2" @@ -4799,21 +4807,21 @@ ejs@^2.5.7: version "2.5.7" resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.5.7.tgz#cc872c168880ae3c7189762fd5ffc00896c9518a" -electron-builder-lib@20.8.0: - version "20.8.0" - resolved "https://registry.yarnpkg.com/electron-builder-lib/-/electron-builder-lib-20.8.0.tgz#6bed39a8077594827e2cc8bc7c8ad0adbabe18f0" +electron-builder-lib@20.8.1: + version "20.8.1" + resolved "https://registry.yarnpkg.com/electron-builder-lib/-/electron-builder-lib-20.8.1.tgz#633167c55f183951b031b59261a923968c098073" dependencies: "7zip-bin" "~3.1.0" - app-builder-bin "1.8.2" + app-builder-bin "1.8.3" async-exit-hook "^2.0.1" bluebird-lst "^1.0.5" - builder-util "5.7.3" + builder-util "5.7.4" builder-util-runtime "4.2.0" chromium-pickle-js "^0.2.0" debug "^3.1.0" ejs "^2.5.8" electron-osx-sign "0.4.10" - electron-publish "20.8.0" + electron-publish "20.8.1" fs-extra-p "^4.5.2" hosted-git-info "^2.6.0" is-ci "^1.1.0" @@ -4857,16 +4865,16 @@ electron-builder-lib@~20.6.2: semver "^5.5.0" temp-file "^3.1.1" -electron-builder@^20.8.0: - version "20.8.0" - resolved "https://registry.yarnpkg.com/electron-builder/-/electron-builder-20.8.0.tgz#9f7067dc8a3aa9451d08e0231066556d39d0ffef" +electron-builder@^20.8.1: + version "20.8.1" + resolved "https://registry.yarnpkg.com/electron-builder/-/electron-builder-20.8.1.tgz#3d19607a7f7d3ee7f3e110a6fc66c720ed1d2cc0" dependencies: bluebird-lst "^1.0.5" - builder-util "5.7.3" + builder-util "5.7.4" builder-util-runtime "4.2.0" chalk "^2.3.2" dmg-builder "4.1.3" - electron-builder-lib "20.8.0" + electron-builder-lib "20.8.1" electron-download-tf "4.3.4" fs-extra-p "^4.5.2" is-ci "^1.1.0" @@ -4940,12 +4948,12 @@ electron-publish@20.6.1: lazy-val "^1.0.3" mime "^2.2.0" -electron-publish@20.8.0: - version "20.8.0" - resolved "https://registry.yarnpkg.com/electron-publish/-/electron-publish-20.8.0.tgz#c608c87b4d2e787fdc5c3430417bf8412ac62498" +electron-publish@20.8.1: + version "20.8.1" + resolved "https://registry.yarnpkg.com/electron-publish/-/electron-publish-20.8.1.tgz#ec5730efbda88c6566a47395d433d7b122782675" dependencies: bluebird-lst "^1.0.5" - builder-util "^5.7.3" + builder-util "^5.7.4" builder-util-runtime "^4.2.0" chalk "^2.3.2" fs-extra-p "^4.5.2"