Set up plugin structure

This commit is contained in:
Jack Grigg
2020-12-31 21:17:35 +00:00
parent 05f7f1b076
commit 0052d91aad
5 changed files with 616 additions and 2 deletions
+43
View File
@@ -0,0 +1,43 @@
use age_core::format::{FileKey, Stanza};
use age_plugin::{
identity::{self, Callbacks, IdentityPluginV1},
recipient::{self, RecipientPluginV1},
};
use std::collections::HashMap;
use std::io;
#[derive(Debug, Default)]
pub(crate) struct RecipientPlugin {}
impl RecipientPluginV1 for RecipientPlugin {
fn add_recipients<'a, I: Iterator<Item = &'a str>>(
&mut self,
recipients: I,
) -> Result<(), Vec<recipient::Error>> {
todo!()
}
fn wrap_file_key(&mut self, file_key: &FileKey) -> Result<Vec<Stanza>, Vec<recipient::Error>> {
todo!()
}
}
#[derive(Debug, Default)]
pub(crate) struct IdentityPlugin {}
impl IdentityPluginV1 for IdentityPlugin {
fn add_identities<'a, I: Iterator<Item = &'a str>>(
&mut self,
identities: I,
) -> Result<(), Vec<identity::Error>> {
todo!()
}
fn unwrap_file_keys(
&mut self,
files: Vec<Vec<Stanza>>,
mut callbacks: impl Callbacks,
) -> io::Result<HashMap<usize, Result<FileKey, Vec<identity::Error>>>> {
todo!()
}
}