Skip to content

Commit

Permalink
fix: hardware wallets are now detected using their VID
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelCastilloB committed Sep 25, 2024
1 parent 680280f commit 8feacce
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ui/app/tabs/hw.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -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'}`
);
Expand Down

0 comments on commit 8feacce

Please sign in to comment.