Skip to content

Commit

Permalink
fix pgp exports
Browse files Browse the repository at this point in the history
  • Loading branch information
soywod committed Aug 4, 2023
1 parent 1ecceca commit 183c027
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions src/config/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -402,23 +403,23 @@ 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")]
key_servers: Vec<String>,
}

#[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),
Expand Down
6 changes: 2 additions & 4 deletions src/domain/tpl/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ pub async fn save<P: Printer>(
.collect::<Vec<String>>()
.join("\n")
})
.with_pgp_encrypt(config.pgp.clone())
.with_pgp_sign(config.pgp.clone())
.with_pgp(config.pgp.clone())
.compile()
.await?
.write_to_vec()?;
Expand Down Expand Up @@ -116,8 +115,7 @@ pub async fn send<P: Printer>(
.collect::<Vec<String>>()
.join("\n")
})
.with_pgp_encrypt(config.pgp.clone())
.with_pgp_sign(config.pgp.clone())
.with_pgp(config.pgp.clone())
.compile()
.await?
.write_to_vec()?;
Expand Down
6 changes: 2 additions & 4 deletions src/ui/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ pub async fn edit_tpl_with_editor<P: Printer>(
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()?;
Expand All @@ -103,8 +102,7 @@ pub async fn edit_tpl_with_editor<P: Printer>(
}
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()?;
Expand Down

0 comments on commit 183c027

Please sign in to comment.