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§

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

Structs§

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

Enums§

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

Constants§