Migrate to latest age-plugin crate commit
This commit is contained in:
+1
-5
@@ -327,11 +327,7 @@ fn main() -> Result<(), Error> {
|
||||
}
|
||||
|
||||
if let Some(state_machine) = opts.age_plugin {
|
||||
run_state_machine(
|
||||
&state_machine,
|
||||
Some(plugin::RecipientPlugin::default),
|
||||
Some(plugin::IdentityPlugin::default),
|
||||
)?;
|
||||
run_state_machine(&state_machine, plugin::Handler)?;
|
||||
Ok(())
|
||||
} else if opts.version {
|
||||
println!("age-plugin-yubikey {}", env!("CARGO_PKG_VERSION"));
|
||||
|
||||
+21
-2
@@ -2,13 +2,28 @@ use age_core::format::{FileKey, Stanza};
|
||||
use age_plugin::{
|
||||
identity::{self, IdentityPluginV1},
|
||||
recipient::{self, RecipientPluginV1},
|
||||
Callbacks,
|
||||
Callbacks, PluginHandler,
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::io;
|
||||
|
||||
use crate::{fl, format, key, p256::Recipient, PLUGIN_NAME};
|
||||
|
||||
pub(crate) struct Handler;
|
||||
|
||||
impl PluginHandler for Handler {
|
||||
type RecipientV1 = RecipientPlugin;
|
||||
type IdentityV1 = IdentityPlugin;
|
||||
|
||||
fn recipient_v1(self) -> io::Result<Self::RecipientV1> {
|
||||
Ok(RecipientPlugin::default())
|
||||
}
|
||||
|
||||
fn identity_v1(self) -> io::Result<Self::IdentityV1> {
|
||||
Ok(IdentityPlugin::default())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub(crate) struct RecipientPlugin {
|
||||
recipients: Vec<Recipient>,
|
||||
@@ -58,6 +73,10 @@ impl RecipientPluginV1 for RecipientPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
fn labels(&mut self) -> HashSet<String> {
|
||||
HashSet::new()
|
||||
}
|
||||
|
||||
fn wrap_file_keys(
|
||||
&mut self,
|
||||
file_keys: Vec<FileKey>,
|
||||
|
||||
Reference in New Issue
Block a user