MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / matches

Method matches

atomic-identity/src/store.rs:304–338  ·  view source on GitHub ↗

Check if an identity matches this filter.

(&self, identity: &Identity, has_secret: bool)

Source from the content-addressed store, hash-verified

302
303 /// Check if an identity matches this filter.
304 fn matches(&self, identity: &Identity, has_secret: bool) -> bool {
305 if let Some(ref usage) = self.usage {
306 if &identity.usage != usage {
307 return false;
308 }
309 }
310
311 if let Some(ref identity_type) = self.identity_type {
312 if &identity.identity_type != identity_type {
313 return false;
314 }
315 }
316
317 if let Some(ref pattern) = self.name_pattern {
318 if !identity
319 .name
320 .to_lowercase()
321 .contains(&pattern.to_lowercase())
322 {
323 return false;
324 }
325 }
326
327 if let Some(require_secret) = self.has_secret_key {
328 if has_secret != require_secret {
329 return false;
330 }
331 }
332
333 if self.valid_only && !identity.is_valid() {
334 return false;
335 }
336
337 true
338 }
339}
340
341/// Identity store for persisting and managing multiple identities.

Callers 4

count_occurrencesFunction · 0.45
list_filteredMethod · 0.45
count_occurrencesFunction · 0.45
count_occurrencesFunction · 0.45

Calls 2

containsMethod · 0.45
is_validMethod · 0.45

Tested by 3

count_occurrencesFunction · 0.36
count_occurrencesFunction · 0.36
count_occurrencesFunction · 0.36