feat: encrypt

This commit is contained in:
2023-09-30 20:32:40 +08:00
parent 7a3cb8d243
commit 67d51d939c

View File

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