feat: update code

This commit is contained in:
2023-10-15 16:56:03 +08:00
parent a37d5b8d62
commit 66e93106fe

View File

@@ -3,11 +3,9 @@ use crate::spec::TinyEncryptEnvelop;
pub fn format_envelop(envelop: &TinyEncryptEnvelop, config: &Option<TinyEncryptConfig>) -> String {
let config_envelop = config.as_ref().and_then(|c| c.find_by_kid(&envelop.kid));
let envelop_kid = config_envelop.and_then(|e| e.sid.as_ref()).map(|sid|
format!(", Sid: {}", sid)
).unwrap_or_else(|| {
format!(", Kid: {}", envelop.kid)
});
let envelop_kid = config_envelop.and_then(|e| e.sid.as_ref())
.map(|sid| format!(", Sid: {}", sid))
.unwrap_or_else(|| format!(", Kid: {}", envelop.kid));
let envelop_desc = get_envelop_desc(envelop, &config_envelop);
let desc = envelop_desc.as_ref()
.map(|desc| format!(", Desc: {}", desc))