// SPDX-FileCopyrightText: Heiko Schaefer // SPDX-License-Identifier: MIT OR Apache-2.0 use rpgpie_certificate_store::Store; pub fn main() { env_logger::init(); let store = Store::new().expect("FIXME"); // -- get by primary fingerprint -- let res = store .get_by_primary_fingerprint("23DA7C0EAA711F0170013595B518D342EB2D4805") .expect("FIXME"); println!( "found by primary: {}", hex::encode(res.unwrap().fingerprint()) ); // -- get by subkey fingerprint -- let res = store .search_by_fingerprint("C76689BA8FFD8370ABF19C36C835823320B380D2") .expect("foo"); let fps: Vec<_> = res.iter().map(|c| hex::encode(c.fingerprint())).collect(); println!("found by subkey: {}", fps.join(", ")); // -- get by key id -- let res = store.search_by_key_id("39D6C12995A8D067").expect("foo"); let fps: Vec<_> = res.iter().map(|c| hex::encode(c.fingerprint())).collect(); println!("key id found: {}", fps.join(", ")); // -- get by email -- let res = store.search_by_email("heiko@schaefer.name").expect("foo"); let fps: Vec<_> = res.iter().map(|c| hex::encode(c.fingerprint())).collect(); println!("email found: {}", fps.join(", ")); // -- get by user id exact -- let res = store .search_exact_user_id("Clint Byrum ") .expect("foo"); let fps: Vec<_> = res.iter().map(|c| hex::encode(c.fingerprint())).collect(); println!("user id exact found: {}", fps.join(", ")); // -- get by user id fuzzy -- let res = store.search_like_user_id("%clint%").expect("foo"); let fps: Vec<_> = res.iter().map(|c| hex::encode(c.fingerprint())).collect(); println!("user id fuzzy found: {}", fps.join(", ")); // // insert cert // let cert = Certificate::load(&mut File::open(path).unwrap()).unwrap(); // assert_eq!(cert.len(), 1); // store.insert(&cert[0]).unwrap(); }