Skip to main content

Crate lsdk

Crate lsdk 

Source
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:

LayerFeatureContent
core(always)APDU encoding, status words, HID framing, device models, Transport trait, dashboard commands (Device)
native HIDhidtransport::hid::HidTransport built on hidapi
WebHIDwebhid[transport::webhid::WebHidTransport] for wasm32
manager APImanager-apimanager::api::ManagerApi: app catalog, firmware metadata
HSM channelhsmhsm: the websocket secure channel used for genuine check, install, update
managermanagermanager::ops: genuine check, install / uninstall apps, firmware update
appseth, btc, solapp 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.
appsbtc or eth or sol
App clients: talk to the coin apps running on the device.
attestationattestation
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.
hsmhsm
Secure channel with the HSM (“scriptrunner”) over a websocket.
loaderloader
App images and sideloading over the secure channel.
managerhsm or manager-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.
scpscp
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.