feat: profile ALL filter all envelops

This commit is contained in:
2023-12-23 16:10:57 +08:00
parent def76d1957
commit d19c9a48f1

View File

@@ -173,8 +173,14 @@ impl TinyEncryptConfig {
let mut key_ids = vec![];
if key_filter.is_none() || profile.is_some() {
let profile = profile.as_ref().map(String::as_str).unwrap_or("default");
if let Some(kids) = self.profiles.get(profile) {
kids.iter().for_each(|k| key_ids.push(k.to_string()));
if profile == "ALL" {
self.envelops.iter().for_each(|e| {
key_ids.push(e.kid.to_string());
});
} else {
if let Some(kids) = self.profiles.get(profile) {
kids.iter().for_each(|k| key_ids.push(k.to_string()));
}
}
}
if let Some(key_filter) = key_filter {