nitrokey3 0.3.0

Client library for Nitrokey 3 devices
Documentation
// Copyright (C) 2021 Robin Krahl <robin.krahl@ireas.org>
// SPDX-License-Identifier: Apache-2.0 or MIT

//! Lists all connected Nitrokey 3 devices and their firmware version.

fn main() -> Result<(), nitrokey3::Error> {
    let hidapi = hidapi::HidApi::new()?;
    let devices = nitrokey3::list(&hidapi);
    println!("Found {} Nitrokey 3 devices", devices.len());
    for device in devices {
        let device = device.connect()?;
        let firmware_version = device.firmware_version()?;
        let uuid = device.uuid()?;
        print!("- Nitrokey 3 ");
        if let Some(uuid) = uuid {
            print!("{} ", uuid);
        }
        println!("with firmware version {}", firmware_version);
    }
    Ok(())
}