There are three ways to communicate with Ledger Device.
For browser and node.js it's recommended to use USB
device,
that uses node-usb on node.js side and uses WebUSB in the browser.
WebAuthn is also available for browsers that support it.
Most of the examples are for node.js, even though code is identical for webusb and node.js you still need to User Action in the browser to get access to the device, so it's easier to check examples on node.
There's also web usb demo, that handles device.
- ./bcoin-getPublicKey.js - Get public key for BIP32 path.
- ./bcoin-getXPUBs.js - Get XPUB and public keys from it.
- ./bcoin-verifyAddress.js - Verify addresses on device screen.
- ./bcoin-p2pkh.js - Sign P2PKH transaction.
- ./bcoin-getP2SH-address.js - Get P2SH address.
- ./bcoin-spendP2SH.js - Sign P2SH transaction.
- ./bcoin-p2wpkh.js - Sign P2WPKH transaction.
- ./bcoin-signMessage.js - Sign Message.
- ./webusb/index.js - WebUSB Demo.
- ./webauthn/index.js - WebAuthn example for browser to get XPUB and derive keys.