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]]
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",

View file

@ -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),

View file

@ -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()?;
@ -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()?;

View file

@ -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()?;
@ -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()?;