use yubikey::YubiKey;
use yubikey::piv::{AlgorithmId, SlotId};

fn main() {
    let mut yk = YubiKey::open().unwrap();
    println!("serial: {}", yk.serial());
    println!("version: {}", yk.version());
    println!("name: {}", yk.name());
    println!("chuid: {:?}", yk.chuid());
    println!("cccid: {:?}", yk.cccid());
    println!("config: {:?}", yk.config());
    // let keys = yubikey.piv_keys().unwrap();
    // for k in keys {
    //     println!("piv: {:?}", k);
    // }
    println!("{:?}", yk.verify_pin(b"123456"));
    let raw_in = [1_u8; 256];
    // let raw_in = hex::decode("c25cebe2b6ad6e3e2d9494f707666a711a2f347a02c5bf95d686703dfdd9743d").unwrap();
    let s = yubikey::piv::sign_data(&mut yk, &raw_in, AlgorithmId::Rsa2048, SlotId::Signature);
    println!("{:?}", s);
    println!("{:?}", hex::encode(s.unwrap().as_slice()));
}
