Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function getEthApp() {
try {
if (!transport) {
transport = await TransportNodeHid.create();
transport.on('disconnect', () => (transport = null));
}
return new LedgerEth(transport);
} catch (err) {
if (err && err.name === 'TransportError') {
throw new Error('ENCLAVE_LEDGER_IN_USE');
}
if (err && err.message && err.message.includes('cannot open device with path')) {
throw new Error('ENCLAVE_LEDGER_IN_USE');
}
throw err;
}
}