Expand description
§lsdk
A Rust SDK to talk to hardware wallets that run the BOLOS operating system (Nano S, Nano S Plus, Nano X, Stax, Flex, Nano Gen5) over USB HID, from native code or from the browser through WebHID.
The crate is split in layers, each behind a cargo feature so you only pay for what you use:
| Layer | Feature | Content |
|---|---|---|
| core | (always) | APDU encoding, status words, HID framing, device models, Transport trait, dashboard commands (Device) |
| native HID | hid | transport::hid::HidTransport built on hidapi |
| WebHID | webhid | [transport::webhid::WebHidTransport] for wasm32 |
| manager API | manager-api | manager::api::ManagerApi: app catalog, firmware metadata |
| HSM channel | hsm | hsm: the websocket secure channel used for genuine check, install, update |
| manager | manager | manager::ops: genuine check, install / uninstall apps, firmware update |
| apps | eth, btc, sol | app clients (apps) to derive addresses, build and sign transactions |
use lsdk::{Device, transport::hid::HidTransport};
let transport = HidTransport::open_first()?;
let device = Device::new(transport);
let version = device.get_version().await?;
println!("{} running {}", version.model().map(|m| m.name()).unwrap_or("?"), version.se_version);Re-exports§
pub use apdu::Apdu;pub use apdu::Response;pub use apdu::StatusWord;pub use device::Device;pub use error::Error;pub use error::Result;pub use model::DeviceModel;pub use transport::Transport;
Modules§
- apdu
- APDU command and response types.
- apps
btcorethorsol - App clients: talk to the coin apps running on the device.
- attestation
attestation - Offline genuine check: device attestation without contacting the vendor.
- device
- High level device handle with the dashboard commands.
- error
- Error type used across the crate.
- framing
- HID framing used by the devices over USB.
- hsm
hsm - Secure channel with the HSM (“scriptrunner”) over a websocket.
- loader
loader - App images and sideloading over the secure channel.
- manager
hsmormanager-api - Device management: manager HTTP API and high level operations.
- model
- Device models.
- os
- Dashboard (BOLOS) commands: version, apps, device name, battery…
- path
- BIP-32 derivation paths.
- scp
scp - Dashboard secure channel (SCP) and the secure commands it carries.
- transport
- Transports carry raw APDUs to a device and bring back raw responses.
Constants§
- VENDOR_
ID - USB vendor id used by all devices.