Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hardware wallets are now detected using their VID #953

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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