diff --git a/crates/asp/src/lib.rs b/crates/asp/src/lib.rs index 7f6ab67..9accdc7 100644 --- a/crates/asp/src/lib.rs +++ b/crates/asp/src/lib.rs @@ -6,17 +6,17 @@ pub mod utils; #[cfg(test)] pub(crate) mod test_constants { // NOTE: This key is taken from the example keys in RFC 7517 - pub(crate) static KEY: &'static str = r#" + pub(crate) static KEY: &str = r#" {"kty":"EC", "crv":"P-256", "x":"MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4", "y":"4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM", "d":"870MB6gfuTJ4HtUnUvYMyJpr5eUZNP4Bk43bVdj3eAE"} "#; - pub(crate) static ASPE_URI: &'static str = "aspe:example.com:452JFAI6B3KOLKBAUX3MC73DAU"; + pub(crate) static ASPE_URI: &str = "aspe:example.com:452JFAI6B3KOLKBAUX3MC73DAU"; - pub(crate) static PROFILE: &'static str = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiIsImtpZCI6IjQ1MkpGQUk2QjNLT0xLQkFVWDNNQzczREFVIiwiandrIjp7Imt0eSI6IkVDIiwiY3J2IjoiUC0yNTYiLCJ4IjoiTUtCQ1ROSWNLVVNEaWkxMXlTczM1MjZpRFo4QWlUbzdUdTZLUEFxdjdENCIsInkiOiI0RXRsNlNSVzJZaUxVck41dmZ2Vkh1aHA3eDhQeGx0bVdXbGJiTTRJRnlNIn19.eyJodHRwOi8vYXJpYWRuZS5pZC92ZXJzaW9uIjowLCJodHRwOi8vYXJpYWRuZS5pZC90eXBlIjoicHJvZmlsZSIsImh0dHA6Ly9hcmlhZG5lLmlkL25hbWUiOiJFeGFtcGxlIG5hbWUiLCJodHRwOi8vYXJpYWRuZS5pZC9jbGFpbXMiOlsiZG5zOmV4YW1wbGUuY29tP3R5cGU9VFhUIiwiaHR0cHM6Ly9naXQuZXhhbXBsZS5jb20vZXhhbXBsZS9mb3JnZWpvX3Byb29mIl0sImh0dHA6Ly9hcml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RBVSJ9.044vzbhefes8bFJFrXLwU2RNYhNvK_rNDDqM7NjEaC8alyFl-5Fh_Obj-pIKUkcxD-HL27y2objt_-lbDqvw4g"; + pub(crate) static DELETE_REQUEST: &str = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiIsImtpZCI6IjQ1MkpGQUk2QjNLT0xLQkFVWDNNQzczREFVIiwiandrIjp7Imt0eSI6IkVDIiwiY3J2IjoiUC0yNTYiLCJ4IjoiTUtCQ1ROSWNLVVNEaWkxMXlTczM1MjZpRFo4QWlUbzdUdTZLUEFxdjdENCIsInkiOiI0RXRsNlNSVzJZaUxVck41dmZ2Vkh1aHA3eDhQeGx0bVdXbGJiTTRJRnlNIn19.eyJodHRwOi8vYXJpYWRuZS5pZC92ZXJzaW9uIjowLCJodHRwOi8vYXJpYWRuZS5pZC90eXBlIjoicmVxdWVzdCIsImh0dHA6Ly9hcmlhZG5lLmlkL2FjdGlvbiI6ImRlbGV0ZSIsImh0dHA6Ly9hcmlhZG5lLmlkL2FzcGVfdXJpIjoiYXNwZTpleGFtcGxlLmNvbTo0NTJKRkFJNkIzS09MS0JBVVgzTUM3M0RBVSJ9.DJNuN-wTXxOW3VZHcN_tlUIFOHfI0GeD_uzs1RplwsGTBe0Z4KpIojEQ85N7tSnuLxuGlsR8kd1SrbcvxhkWaw"; } diff --git a/src/commands/keys/delete.rs b/src/commands/keys/delete.rs index 47b595c..e7c08bf 100644 --- a/src/commands/keys/delete.rs +++ b/src/commands/keys/delete.rs @@ -48,7 +48,7 @@ impl AspmSubcommand for KeysDeleteCommand { style = Anstyle::new() .fg_color(Some(AnstyleColor::Ansi(AnsiColor::BrightYellow))) .render(), - reset = Reset::default().render() + reset = Reset.render() ); keys.remove(0) } @@ -56,7 +56,7 @@ impl AspmSubcommand for KeysDeleteCommand { if !self.no_confirm { // Construct styles - let reset = Reset::default().render(); + let reset = Reset.render(); let alias_style = Anstyle::new() .underline() .fg_color(Some(anstyle::Color::Ansi(AnsiColor::BrightCyan))) diff --git a/src/commands/keys/export.rs b/src/commands/keys/export.rs index c6fd907..ca5a563 100644 --- a/src/commands/keys/export.rs +++ b/src/commands/keys/export.rs @@ -84,7 +84,7 @@ impl AspmSubcommand for KeysExportCommand { style = Anstyle::new() .fg_color(Some(AnstyleColor::Ansi(AnsiColor::BrightYellow))) .render(), - reset = Reset::default().render() + reset = Reset.render() ); keys.remove(0) } @@ -107,7 +107,7 @@ impl AspmSubcommand for KeysExportCommand { let aes_key = hash.hash.context("Unable to derive encryption key")?; let aes_key = &aes_key.as_bytes()[0..32]; - if let Ok(decrypted) = Aes256Gcm::new(&Key::::from_slice(aes_key)) + if let Ok(decrypted) = Aes256Gcm::new(Key::::from_slice(aes_key)) .decrypt((&aes_key[0..12]).into(), key.cipher_text.as_slice()) { let decrypted = AspKey::from_jwk(Jwk::from_bytes(decrypted)?)?; diff --git a/src/commands/keys/generate.rs b/src/commands/keys/generate.rs index 6bbb9c3..5619c26 100644 --- a/src/commands/keys/generate.rs +++ b/src/commands/keys/generate.rs @@ -72,7 +72,7 @@ impl AspmSubcommand for KeysGenerateCommand { let aes_key = hash.hash.context("Unable to derive encryption key")?; let aes_key = &aes_key.as_bytes()[0..32]; - let Ok(cipher_text) = Aes256Gcm::new(&Key::::from_slice(aes_key)) + let Ok(cipher_text) = Aes256Gcm::new(Key::::from_slice(aes_key)) .encrypt((&aes_key[0..12]).into(), key.jwk.to_string().as_bytes()) else { bail!("Failure encrypting key") diff --git a/src/commands/keys/import.rs b/src/commands/keys/import.rs index 8826dd7..93b6d50 100644 --- a/src/commands/keys/import.rs +++ b/src/commands/keys/import.rs @@ -21,7 +21,7 @@ pub enum KeyImportFormat { Jwk, // Imports a PGP key from a local GPG store #[cfg(feature = "gpg-compat")] - GPG, + Gpg, } /// Imports an ASP from raw JWK format. This only will import JWKs that have supported curves. @@ -66,7 +66,7 @@ impl AspmSubcommand for KeysImportCommand { ) .context("Unable to convert parsed JWK to an AspKey")?, #[cfg(feature = "gpg-compat")] - KeyImportFormat::GPG => { + KeyImportFormat::Gpg => { use gpgme::{Context as GpgContext, PassphraseRequest}; use sequoia_openpgp::{crypto::mpi, packet::key, parse::Parse, types::Curve}; use std::{io::Write, sync::Arc}; @@ -249,7 +249,7 @@ impl AspmSubcommand for KeysImportCommand { let aes_key = &aes_key.as_bytes()[0..32]; let key = Key::::from_slice(aes_key); - let Ok(cipher_text) = Aes256Gcm::new(&key) + let Ok(cipher_text) = Aes256Gcm::new(key) .encrypt((&aes_key[0..12]).into(), asp_key.jwk.to_string().as_bytes()) else { bail!("Failure encrypting key") diff --git a/src/commands/keys/list.rs b/src/commands/keys/list.rs index c1d8ff9..1bb5da8 100644 --- a/src/commands/keys/list.rs +++ b/src/commands/keys/list.rs @@ -22,7 +22,7 @@ impl AspmSubcommand for KeysListCommand { .context("Unable to read keys from database")?; // Construct styles - let reset = Reset::default().render(); + let reset = Reset.render(); let header_style = Anstyle::new() .bold() .underline() diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 462267a..b58f85b 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -19,14 +19,14 @@ pub trait AspmSubcommand: Parser + Sync { } #[async_trait::async_trait] -pub(self) trait KeysEntityExt { +trait KeysEntityExt { type ResultEnum; /// Queries the database for a specific key entity, first checking by fingerprint and then checking async fn query_key(db: &DatabaseConnection, query: &str) -> anyhow::Result; } -pub(self) enum KeysQueryResult { +enum KeysQueryResult { None, One(KeysModel), Many(Vec), diff --git a/src/commands/profiles/create.rs b/src/commands/profiles/create.rs index 019b621..9635229 100644 --- a/src/commands/profiles/create.rs +++ b/src/commands/profiles/create.rs @@ -68,21 +68,21 @@ impl AspmSubcommand for ProfilesCreateCommand { .interact() .context("Unable to prompt on stderr")?) .filter(|x: &String| !x.is_empty()) - .map_or(Ok(None), |string: String| Url::parse(&string).context("Unable to parse avatar URL").map(|url| Some(url)))?, + .map_or(Ok(None), |string: String| Url::parse(&string).context("Unable to parse avatar URL").map(Some))?, email: Some(Input::with_theme(&theme) .with_prompt("If you want to add an email to this profile, enter it or an empty string") .allow_empty(true) .interact() .context("Unable to prompt on stderr")?) .filter(|x: &String| !x.is_empty()) - .map_or(Ok(None), |string: String| Email::from_string(string).context("Unable to parse email").map(|email| Some(email)))?, + .map_or(Ok(None), |string: String| Email::from_string(string).context("Unable to parse email").map(Some))?, color: Some(Input::with_theme(&theme) .with_prompt("If you want to add a color to this profile, enter it in hex format (#AABBCC) or an empty string") .allow_empty(true) .interact() .context("Unable to prompt on stderr")?) .filter(|x: &String| !x.is_empty()) - .map_or(Ok(None), |hex: String| HexColor::from_str(&hex).context("Unable to parse color code").map(|color| Some(color)))?, + .map_or(Ok(None), |hex: String| HexColor::from_str(&hex).context("Unable to parse color code").map(Some))?, }; dbg!(profile);