Crate coldcard

Source
Expand description

§Coldcard interface library in Rust.

This library provides interfacing functionality for the Coldcard hardware wallet. It automatically sets up an encrypted communication channel using ECDH that cannot be turned off, so MITM mitigation is possible out of the box using the check_mitm method.

It does not validate that a particular function is available on a particular Coldcard (due to firmware differences), so that is left to the user to explore.

use coldcard::protocol;

// create an API instance
let mut api = coldcard::Api::new()?;

// detect all connected Coldcards
let serials = api.detect()?;

// get the first serial and open it
let (mut cc, master_xpub) = api.open(&serials[0], None)?;

// set a passphrase
cc.set_passphrase(protocol::Passphrase::new("secret")?)?;

// after the user confirms
let xpub = cc.get_passphrase_done()?;

if let Some(xpub) = xpub {
   println!("The new XPUB is: {}", xpub);
}

// secure logout
cc.logout()?;

Modules§

constants
Various constants used by the Coldcard.
firmware
Firmware and upgrade related module.
protocol
Codec and protocol module.
util
Miscellaneous utility functions.

Structs§

Api
API for interacting with Coldcard devices.
Backup
Backup bytes and their checksum as calculated by Coldcard.
Coldcard
Connected and initialized Coldcard device ready for use.
Options
Specifies various options that a Coldcard can be opened with.
SerialNumber
Represents a particular Coldcard serial number.
SignedMessage
Signed message (binary) and the address that signed it.
XpubInfo
B58 encoded xpub and its fingerprint.

Enums§

Error
Any type of error that can occur while a Coldcard is being used.
SignMode
Signing mode for PSBT.

Constants§

CKCC_PID
Coldcard’s HID product id.
COINKITE_VID
Coinkite’s HID vendor id.