fix pgp exports

This commit is contained in:
Clément DOUIN 2023-08-04 21:33:15 +02:00
parent 1ecceca1e6
commit 183c0272cc
No known key found for this signature in database
GPG key ID: 353E4A18EE0FAB72
4 changed files with 20 additions and 23 deletions

14
Cargo.lock generated
View file

@ -2413,7 +2413,7 @@ dependencies = [
[[package]] [[package]]
name = "pimalaya-email" name = "pimalaya-email"
version = "0.14.1-beta" version = "0.14.1-beta"
source = "git+https://git.sr.ht/~soywod/pimalaya#77a2a822e973de2c95d523495ee9ec7709039a41" source = "git+https://git.sr.ht/~soywod/pimalaya#86ed502bba59fa70e3f3352b40c0552a5a870c01"
dependencies = [ dependencies = [
"advisory-lock", "advisory-lock",
"ammonia", "ammonia",
@ -2460,7 +2460,7 @@ dependencies = [
[[package]] [[package]]
name = "pimalaya-email-tpl" name = "pimalaya-email-tpl"
version = "0.3.2-beta" version = "0.3.2-beta"
source = "git+https://git.sr.ht/~soywod/pimalaya#77a2a822e973de2c95d523495ee9ec7709039a41" source = "git+https://git.sr.ht/~soywod/pimalaya#86ed502bba59fa70e3f3352b40c0552a5a870c01"
dependencies = [ dependencies = [
"async-recursion", "async-recursion",
"chumsky 0.9.0", "chumsky 0.9.0",
@ -2479,7 +2479,7 @@ dependencies = [
[[package]] [[package]]
name = "pimalaya-keyring" name = "pimalaya-keyring"
version = "0.0.6-beta" version = "0.0.6-beta"
source = "git+https://git.sr.ht/~soywod/pimalaya#77a2a822e973de2c95d523495ee9ec7709039a41" source = "git+https://git.sr.ht/~soywod/pimalaya#86ed502bba59fa70e3f3352b40c0552a5a870c01"
dependencies = [ dependencies = [
"keyring", "keyring",
"log", "log",
@ -2489,7 +2489,7 @@ dependencies = [
[[package]] [[package]]
name = "pimalaya-oauth2" name = "pimalaya-oauth2"
version = "0.0.5-beta" version = "0.0.5-beta"
source = "git+https://git.sr.ht/~soywod/pimalaya#77a2a822e973de2c95d523495ee9ec7709039a41" source = "git+https://git.sr.ht/~soywod/pimalaya#86ed502bba59fa70e3f3352b40c0552a5a870c01"
dependencies = [ dependencies = [
"log", "log",
"oauth2", "oauth2",
@ -2502,7 +2502,7 @@ dependencies = [
[[package]] [[package]]
name = "pimalaya-pgp" name = "pimalaya-pgp"
version = "0.0.1" version = "0.0.1"
source = "git+https://git.sr.ht/~soywod/pimalaya#77a2a822e973de2c95d523495ee9ec7709039a41" source = "git+https://git.sr.ht/~soywod/pimalaya#86ed502bba59fa70e3f3352b40c0552a5a870c01"
dependencies = [ dependencies = [
"async-recursion", "async-recursion",
"futures", "futures",
@ -2522,7 +2522,7 @@ dependencies = [
[[package]] [[package]]
name = "pimalaya-process" name = "pimalaya-process"
version = "0.0.6-beta" version = "0.0.6-beta"
source = "git+https://git.sr.ht/~soywod/pimalaya#77a2a822e973de2c95d523495ee9ec7709039a41" source = "git+https://git.sr.ht/~soywod/pimalaya#86ed502bba59fa70e3f3352b40c0552a5a870c01"
dependencies = [ dependencies = [
"log", "log",
"thiserror", "thiserror",
@ -2532,7 +2532,7 @@ dependencies = [
[[package]] [[package]]
name = "pimalaya-secret" name = "pimalaya-secret"
version = "0.0.6-beta" version = "0.0.6-beta"
source = "git+https://git.sr.ht/~soywod/pimalaya#77a2a822e973de2c95d523495ee9ec7709039a41" source = "git+https://git.sr.ht/~soywod/pimalaya#86ed502bba59fa70e3f3352b40c0552a5a870c01"
dependencies = [ dependencies = [
"log", "log",
"pimalaya-keyring", "pimalaya-keyring",

View file

@ -6,7 +6,8 @@ use pimalaya_email::backend::{ImapAuthConfig, ImapConfig};
use pimalaya_email::sender::{SmtpAuthConfig, SmtpConfig}; use pimalaya_email::sender::{SmtpAuthConfig, SmtpConfig};
use pimalaya_email::{ use pimalaya_email::{
account::{ account::{
OAuth2Config, OAuth2Method, OAuth2Scopes, PasswdConfig, PgpConfig, PgpKey, PgpNativeConfig, OAuth2Config, OAuth2Method, OAuth2Scopes, PasswdConfig, PgpConfig, PgpNativeConfig,
PgpNativeSecretKey, SignedSecretKey,
}, },
backend::{BackendConfig, MaildirConfig}, backend::{BackendConfig, MaildirConfig},
email::{EmailHooks, EmailTextPlainFormat}, email::{EmailHooks, EmailTextPlainFormat},
@ -402,12 +403,10 @@ pub enum PgpConfigDef {
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
#[serde(remote = "PgpNativeConfig", rename_all = "kebab-case")] #[serde(remote = "PgpNativeConfig", rename_all = "kebab-case")]
pub struct PgpNativeConfigDef { pub struct PgpNativeConfigDef {
#[serde(default, with = "PgpKeyDef")] #[serde(default, with = "PgpNativeSecretKeyDef")]
secret_key: PgpKey, secret_key: PgpNativeSecretKey,
#[serde(default, with = "SecretDef")] #[serde(default, with = "SecretDef")]
secret_key_passwd: Secret, secret_key_passphrase: Secret,
#[serde(default, with = "PgpKeyDef")]
public_key: PgpKey,
#[serde(default = "PgpNativeConfig::default_wkd")] #[serde(default = "PgpNativeConfig::default_wkd")]
wkd: bool, wkd: bool,
#[serde(default = "PgpNativeConfig::default_key_servers")] #[serde(default = "PgpNativeConfig::default_key_servers")]
@ -415,10 +414,12 @@ pub struct PgpNativeConfigDef {
} }
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
#[serde(remote = "PgpKey", rename_all = "kebab-case")] #[serde(remote = "PgpNativeSecretKey", rename_all = "kebab-case")]
pub enum PgpKeyDef { pub enum PgpNativeSecretKeyDef {
#[default] #[default]
None, None,
#[serde(skip)]
Raw(SignedSecretKey),
Path(PathBuf), Path(PathBuf),
#[serde(with = "EntryDef")] #[serde(with = "EntryDef")]
Keyring(Entry), Keyring(Entry),

View file

@ -86,8 +86,7 @@ pub async fn save<P: Printer>(
.collect::<Vec<String>>() .collect::<Vec<String>>()
.join("\n") .join("\n")
}) })
.with_pgp_encrypt(config.pgp.clone()) .with_pgp(config.pgp.clone())
.with_pgp_sign(config.pgp.clone())
.compile() .compile()
.await? .await?
.write_to_vec()?; .write_to_vec()?;
@ -116,8 +115,7 @@ pub async fn send<P: Printer>(
.collect::<Vec<String>>() .collect::<Vec<String>>()
.join("\n") .join("\n")
}) })
.with_pgp_encrypt(config.pgp.clone()) .with_pgp(config.pgp.clone())
.with_pgp_sign(config.pgp.clone())
.compile() .compile()
.await? .await?
.write_to_vec()?; .write_to_vec()?;

View file

@ -76,8 +76,7 @@ pub async fn edit_tpl_with_editor<P: Printer>(
Ok(PostEditChoice::Send) => { Ok(PostEditChoice::Send) => {
printer.print_log("Sending email…")?; printer.print_log("Sending email…")?;
let email = tpl let email = tpl
.with_pgp_encrypt(config.pgp.clone()) .with_pgp(config.pgp.clone())
.with_pgp_sign(config.pgp.clone())
.compile() .compile()
.await? .await?
.write_to_vec()?; .write_to_vec()?;
@ -103,8 +102,7 @@ pub async fn edit_tpl_with_editor<P: Printer>(
} }
Ok(PostEditChoice::RemoteDraft) => { Ok(PostEditChoice::RemoteDraft) => {
let email = tpl let email = tpl
.with_pgp_encrypt(config.pgp.clone()) .with_pgp(config.pgp.clone())
.with_pgp_sign(config.pgp.clone())
.compile() .compile()
.await? .await?
.write_to_vec()?; .write_to_vec()?;