diff --git a/Cargo.lock b/Cargo.lock index 35c0917..6483270 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2413,7 +2413,7 @@ dependencies = [ [[package]] name = "pimalaya-email" version = "0.14.1-beta" -source = "git+https://git.sr.ht/~soywod/pimalaya#77a2a822e973de2c95d523495ee9ec7709039a41" +source = "git+https://git.sr.ht/~soywod/pimalaya#86ed502bba59fa70e3f3352b40c0552a5a870c01" dependencies = [ "advisory-lock", "ammonia", @@ -2460,7 +2460,7 @@ dependencies = [ [[package]] name = "pimalaya-email-tpl" version = "0.3.2-beta" -source = "git+https://git.sr.ht/~soywod/pimalaya#77a2a822e973de2c95d523495ee9ec7709039a41" +source = "git+https://git.sr.ht/~soywod/pimalaya#86ed502bba59fa70e3f3352b40c0552a5a870c01" dependencies = [ "async-recursion", "chumsky 0.9.0", @@ -2479,7 +2479,7 @@ dependencies = [ [[package]] name = "pimalaya-keyring" version = "0.0.6-beta" -source = "git+https://git.sr.ht/~soywod/pimalaya#77a2a822e973de2c95d523495ee9ec7709039a41" +source = "git+https://git.sr.ht/~soywod/pimalaya#86ed502bba59fa70e3f3352b40c0552a5a870c01" dependencies = [ "keyring", "log", @@ -2489,7 +2489,7 @@ dependencies = [ [[package]] name = "pimalaya-oauth2" version = "0.0.5-beta" -source = "git+https://git.sr.ht/~soywod/pimalaya#77a2a822e973de2c95d523495ee9ec7709039a41" +source = "git+https://git.sr.ht/~soywod/pimalaya#86ed502bba59fa70e3f3352b40c0552a5a870c01" dependencies = [ "log", "oauth2", @@ -2502,7 +2502,7 @@ dependencies = [ [[package]] name = "pimalaya-pgp" version = "0.0.1" -source = "git+https://git.sr.ht/~soywod/pimalaya#77a2a822e973de2c95d523495ee9ec7709039a41" +source = "git+https://git.sr.ht/~soywod/pimalaya#86ed502bba59fa70e3f3352b40c0552a5a870c01" dependencies = [ "async-recursion", "futures", @@ -2522,7 +2522,7 @@ dependencies = [ [[package]] name = "pimalaya-process" version = "0.0.6-beta" -source = "git+https://git.sr.ht/~soywod/pimalaya#77a2a822e973de2c95d523495ee9ec7709039a41" +source = "git+https://git.sr.ht/~soywod/pimalaya#86ed502bba59fa70e3f3352b40c0552a5a870c01" dependencies = [ "log", "thiserror", @@ -2532,7 +2532,7 @@ dependencies = [ [[package]] name = "pimalaya-secret" version = "0.0.6-beta" -source = "git+https://git.sr.ht/~soywod/pimalaya#77a2a822e973de2c95d523495ee9ec7709039a41" +source = "git+https://git.sr.ht/~soywod/pimalaya#86ed502bba59fa70e3f3352b40c0552a5a870c01" dependencies = [ "log", "pimalaya-keyring", diff --git a/src/config/prelude.rs b/src/config/prelude.rs index 34db8ba..5dd28f6 100644 --- a/src/config/prelude.rs +++ b/src/config/prelude.rs @@ -6,7 +6,8 @@ use pimalaya_email::backend::{ImapAuthConfig, ImapConfig}; use pimalaya_email::sender::{SmtpAuthConfig, SmtpConfig}; use pimalaya_email::{ account::{ - OAuth2Config, OAuth2Method, OAuth2Scopes, PasswdConfig, PgpConfig, PgpKey, PgpNativeConfig, + OAuth2Config, OAuth2Method, OAuth2Scopes, PasswdConfig, PgpConfig, PgpNativeConfig, + PgpNativeSecretKey, SignedSecretKey, }, backend::{BackendConfig, MaildirConfig}, email::{EmailHooks, EmailTextPlainFormat}, @@ -402,12 +403,10 @@ pub enum PgpConfigDef { #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)] #[serde(remote = "PgpNativeConfig", rename_all = "kebab-case")] pub struct PgpNativeConfigDef { - #[serde(default, with = "PgpKeyDef")] - secret_key: PgpKey, + #[serde(default, with = "PgpNativeSecretKeyDef")] + secret_key: PgpNativeSecretKey, #[serde(default, with = "SecretDef")] - secret_key_passwd: Secret, - #[serde(default, with = "PgpKeyDef")] - public_key: PgpKey, + secret_key_passphrase: Secret, #[serde(default = "PgpNativeConfig::default_wkd")] wkd: bool, #[serde(default = "PgpNativeConfig::default_key_servers")] @@ -415,10 +414,12 @@ pub struct PgpNativeConfigDef { } #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)] -#[serde(remote = "PgpKey", rename_all = "kebab-case")] -pub enum PgpKeyDef { +#[serde(remote = "PgpNativeSecretKey", rename_all = "kebab-case")] +pub enum PgpNativeSecretKeyDef { #[default] None, + #[serde(skip)] + Raw(SignedSecretKey), Path(PathBuf), #[serde(with = "EntryDef")] Keyring(Entry), diff --git a/src/domain/tpl/handlers.rs b/src/domain/tpl/handlers.rs index 3e2b210..f7cfd48 100644 --- a/src/domain/tpl/handlers.rs +++ b/src/domain/tpl/handlers.rs @@ -86,8 +86,7 @@ pub async fn save( .collect::>() .join("\n") }) - .with_pgp_encrypt(config.pgp.clone()) - .with_pgp_sign(config.pgp.clone()) + .with_pgp(config.pgp.clone()) .compile() .await? .write_to_vec()?; @@ -116,8 +115,7 @@ pub async fn send( .collect::>() .join("\n") }) - .with_pgp_encrypt(config.pgp.clone()) - .with_pgp_sign(config.pgp.clone()) + .with_pgp(config.pgp.clone()) .compile() .await? .write_to_vec()?; diff --git a/src/ui/editor.rs b/src/ui/editor.rs index ecbf6b3..67be4c2 100644 --- a/src/ui/editor.rs +++ b/src/ui/editor.rs @@ -76,8 +76,7 @@ pub async fn edit_tpl_with_editor( Ok(PostEditChoice::Send) => { printer.print_log("Sending email…")?; let email = tpl - .with_pgp_encrypt(config.pgp.clone()) - .with_pgp_sign(config.pgp.clone()) + .with_pgp(config.pgp.clone()) .compile() .await? .write_to_vec()?; @@ -103,8 +102,7 @@ pub async fn edit_tpl_with_editor( } Ok(PostEditChoice::RemoteDraft) => { let email = tpl - .with_pgp_encrypt(config.pgp.clone()) - .with_pgp_sign(config.pgp.clone()) + .with_pgp(config.pgp.clone()) .compile() .await? .write_to_vec()?;