use std::io::Read;
use std::sync::Arc;
use core_foundation::data::CFData;
use security_framework::key::SecKey;
use security_framework::os::macos::item::KeyType;
use security_framework::os::macos::keychain::SecKeychain;

fn main() {
    let mut sec_keychain = SecKeychain::default().unwrap();
    // let sec = sec_keychain.set_generic_password("Test", "test", "helloworld".as_bytes());
    // println!("{:?}",sec);
    let acc = sec_keychain.find_generic_password("Test", "test");
    println!("{:?}", acc);
    println!("{:?}", acc.as_ref().unwrap().0);
    println!("{:?}", acc.as_ref().unwrap().0.bytes());

    // let l = vec![5];
    // let cf_data = CFData::from_arc(Arc::new(l));
    // let a = security_framework::os::macos::key::SecKeyExt::from_data(
    //     KeyType::rsa(), &cf_data);
    // println!("{:?}", a);
}
