1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
use crate::types::key_type::KeyType; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] /// Key Parameters, used **before** encryption / decryption, that describes user's preference to *Enkryptit!*'s backend, and stored in /// the parameters. /// /// Contains : /// - PassWord /// - File /// - Os pub enum KeyParams { PassWord, File, Os, } impl KeyParams { /// Converts a [`KeyParams`] into a [`KeyType`] pub fn to_type(&self) -> KeyType { match self { Self::File => KeyType::FromFile, Self::Os => KeyType::FromOS, Self::PassWord => KeyType::Password, } } }