diff --git a/src/key.rs b/src/key.rs index 3a09dcf..684f39d 100644 --- a/src/key.rs +++ b/src/key.rs @@ -21,8 +21,8 @@ use yubikey::{ use crate::{ error::Error, fl, - format::RecipientLine, p256::{Recipient, TAG_BYTES}, + piv_p256, util::{otp_serial_prefix, Metadata}, IDENTITY_PREFIX, }; @@ -476,7 +476,7 @@ impl Stub { bytes } - pub(crate) fn matches(&self, line: &RecipientLine) -> bool { + pub(crate) fn matches(&self, line: &piv_p256::RecipientLine) -> bool { self.tag == line.tag } diff --git a/src/main.rs b/src/main.rs index adf4de4..9dda740 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,9 +16,9 @@ use yubikey::{piv::RetiredSlotId, reader::Context, PinPolicy, Serial, TouchPolic mod builder; mod error; -mod format; mod key; mod p256; +mod piv_p256; mod plugin; mod util; diff --git a/src/format.rs b/src/piv_p256.rs similarity index 100% rename from src/format.rs rename to src/piv_p256.rs diff --git a/src/plugin.rs b/src/plugin.rs index 263e2a6..0b4a2ad 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -7,7 +7,7 @@ use age_plugin::{ use std::collections::{HashMap, HashSet}; use std::io; -use crate::{fl, format, key, p256::Recipient, PLUGIN_NAME}; +use crate::{fl, key, p256::Recipient, piv_p256, PLUGIN_NAME}; pub(crate) struct Handler; @@ -114,7 +114,7 @@ impl RecipientPluginV1 for RecipientPlugin { self.recipients .iter() .chain(yk_recipients.iter()) - .map(|pk| format::RecipientLine::wrap_file_key(&file_key, pk).into()) + .map(|pk| piv_p256::RecipientLine::wrap_file_key(&file_key, pk).into()) .collect() }) .collect()) @@ -159,7 +159,7 @@ impl IdentityPluginV1 for IdentityPlugin { let mut file_keys = HashMap::with_capacity(files.len()); // Filter to files / stanzas for which we have matching YubiKeys - let mut candidate_stanzas: Vec<(&key::Stub, HashMap>)> = + let mut candidate_stanzas: Vec<(&key::Stub, HashMap>)> = self.yubikeys .iter() .map(|stub| (stub, HashMap::new())) @@ -168,7 +168,7 @@ impl IdentityPluginV1 for IdentityPlugin { for (file, stanzas) in files.iter().enumerate() { for (stanza_index, stanza) in stanzas.iter().enumerate() { match ( - format::RecipientLine::from_stanza(stanza).map(|res| { + piv_p256::RecipientLine::from_stanza(stanza).map(|res| { res.map_err(|_| identity::Error::Stanza { file_index: file, stanza_index,