You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
1.6 KiB

//! Parsed config
use super::*;
pub mod op {
/// The crypt mode
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
pub enum Mode {
/// Detect based on file-type
Autodetect,
Encrypt,
Decrypt,
}
impl Default for Mode
{
#[inline]
fn default() -> Self
{
Mode::Autodetect
}
}
#[derive(Debug, Clone,PartialEq, Eq, Default)]
pub struct Normal {
pub rsa: Vec<(String, Password)>,
pub sign: Vec<(String, Password)>,
pub aes: Vec<(String, Password)>,
pub mode: Mode,
pub files: Vec<(String, Option<String>)>,
}
#[derive(Debug, Clone,PartialEq, Eq)]
pub enum GenerateKey {
Rsa(Rsa),
Aes(Aes),
}
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
pub enum Password
{
No,
Yes,
Specific(String),
}
impl Default for Password
{
#[inline]
fn default() -> Self
{
Self::No
}
}
#[derive(Debug ,PartialEq, Eq, Clone, Hash, Default)]
pub struct KeyDescription
{
pub name: String,
pub email: String,
pub description: String,
other: String,
}
#[derive(Debug, Clone,PartialEq, Eq)]
pub struct Rsa
{
input: Option<(String, Password)>,
output_priv: String,
output_pub: Option<String>,
password: Password,
description: KeyDescription,
}
#[derive(Debug,Clone, PartialEq, Eq)]
pub struct Aes
{
input: Option<(String, Password)>,
output: String,
password: Password,
description: KeyDescription,
}
}
#[derive(Debug, Clone,PartialEq, Eq)]
pub enum Operation
{
Normal(op::Normal),
GenerateKey(op::GenerateKey),
KeyInfo(Vec<(String, op::Password)>),
Help,
}