use keyfork_derive_util::{DerivationPath, DerivationIndex}; pub static OPENPGP: DerivationIndex = DerivationIndex::new_unchecked(7366512, true); pub enum Target { OpenPGP(DerivationIndex), } impl std::fmt::Display for Target { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::OpenPGP(account) => { write!(f, "OpenPGP key (account {account})") } } } } /// Determine the closest [`Target`] for the given path. This method is intended to be used by /// `keyforkd` to provide an optional textual prompt to what a client is attempting to derive. pub fn guess_target(path: &DerivationPath) -> Option { Some(match Vec::from_iter(path.iter())[..] { [t, index] if t == &OPENPGP => Target::OpenPGP(index.clone()), _ => return None, }) }