From 8feacce56454992b07e92799b8f26044e118c641 Mon Sep 17 00:00:00 2001 From: Angel Castillo Date: Wed, 25 Sep 2024 14:30:11 +0800 Subject: [PATCH] fix: hardware wallets are now detected using their VID --- src/ui/app/tabs/hw.jsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ui/app/tabs/hw.jsx b/src/ui/app/tabs/hw.jsx index 1d066b2e..1cad0f84 100644 --- a/src/ui/app/tabs/hw.jsx +++ b/src/ui/app/tabs/hw.jsx @@ -42,10 +42,11 @@ import { MdUsb } from 'react-icons/md'; import { Planet } from 'react-kawaii'; import { useCaptureEvent } from '../../../features/analytics/hooks'; import { Events } from '../../../features/analytics/events'; +import { ledgerUSBVendorId } from '@ledgerhq/devices'; -const MANUFACTURER = { - ledger: 'Ledger', - trezor: 'SatoshiLabs', +const VENDOR_IDS = { + ledger: [ledgerUSBVendorId], + trezor: [0x534c, 0x1209], // Model T HID 0x534c and others 0x1209 - taken from https://github.com/vacuumlabs/trezor-suite/blob/develop/packages/transport/src/constants.ts#L13-L21 }; const App = () => { @@ -189,7 +190,7 @@ const ConnectHW = ({ onConfirm }) => { const device = await navigator.usb.requestDevice({ filters: [], }); - if (device.manufacturerName !== MANUFACTURER[selected]) { + if (!VENDOR_IDS[selected].some((vendorId) => vendorId === device.vendorId)) { setError( `Device is not a ${selected == HW.ledger ? 'Ledger' : 'Trezor'}` );