Migrate to latest age-plugin crate commit

This commit is contained in:
Jack Grigg
2024-11-01 09:18:58 +00:00
parent c015dedcf8
commit e21c504b33
4 changed files with 28 additions and 11 deletions
Generated
+2 -4
View File
@@ -36,8 +36,7 @@ dependencies = [
[[package]]
name = "age-core"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5f11899bc2bbddd135edbc30c36b1924fa59d0746bb45beb5933fafe3fe509b"
source = "git+https://github.com/str4d/rage.git?rev=baf277a749c839e49f93bffb58d36734ac94be83#baf277a749c839e49f93bffb58d36734ac94be83"
dependencies = [
"base64 0.21.7",
"chacha20poly1305",
@@ -54,8 +53,7 @@ dependencies = [
[[package]]
name = "age-plugin"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04740d993aac0e06eaf4cfbf8484a8a23a6a7f950cf5d53bdf2d6ea3f429eb9d"
source = "git+https://github.com/str4d/rage.git?rev=baf277a749c839e49f93bffb58d36734ac94be83#baf277a749c839e49f93bffb58d36734ac94be83"
dependencies = [
"age-core",
"base64 0.21.7",
+4
View File
@@ -56,3 +56,7 @@ man = "0.3"
tempfile = "3"
test-with = "0.11"
which = "5"
[patch.crates-io]
age-core = { git = "https://github.com/str4d/rage.git", rev = "baf277a749c839e49f93bffb58d36734ac94be83" }
age-plugin = { git = "https://github.com/str4d/rage.git", rev = "baf277a749c839e49f93bffb58d36734ac94be83" }
+1 -5
View File
@@ -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
View File
@@ -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>,