Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function getFirstLedgerDevice(): Promise {
if (!(window && window.navigator.usb))
throw new WebUSBNotAvailable()
const existingDevices = await TransportWebUSB.list()
return existingDevices.length > 0 ? existingDevices[0] : null
}