From 67d51d939ce31d5f0a848fd1d43956a053a74ae3 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sat, 30 Sep 2023 20:32:40 +0800 Subject: [PATCH] feat: encrypt --- src/cmd_encrypt.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmd_encrypt.rs b/src/cmd_encrypt.rs index 3ccac26..b18adb9 100644 --- a/src/cmd_encrypt.rs +++ b/src/cmd_encrypt.rs @@ -88,11 +88,11 @@ fn encrypt_single(path: &PathBuf, envelops: &[&TinyEncryptConfigEnvelop], cmd_en if cmd_encrypt.compatible_with_1_0 { if let Some(envelops) = &encrypt_meta.envelops { for envelop in envelops { - if envelop.r#type == TinyEncryptEnvelopType::Pgp { + if (envelop.r#type == TinyEncryptEnvelopType::Pgp) && encrypt_meta.pgp_envelop.is_none() { encrypt_meta.pgp_fingerprint = Some(format!("KID:{}", envelop.kid)); encrypt_meta.pgp_envelop = Some(envelop.encrypted_key.clone()); } - if envelop.r#type == TinyEncryptEnvelopType::Ecdh { + if (envelop.r#type == TinyEncryptEnvelopType::Ecdh) && encrypt_meta.ecdh_envelop.is_none() { encrypt_meta.ecdh_point = Some(format!("KID:{}", envelop.kid)); encrypt_meta.ecdh_envelop = Some(envelop.encrypted_key.clone()); }