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

Function extract_default_identity_from_config

atomic-agent/src/identity.rs:447–466  ·  view source on GitHub ↗

Extract the default identity ID from config.toml content. Looks for `default_identity = "BASE32_ID"` in the TOML.

(content: &str)

Source from the content-addressed store, hash-verified

445///
446/// Looks for `default_identity = "BASE32_ID"` in the TOML.
447fn extract_default_identity_from_config(content: &str) -> Option<String> {
448 // Simple TOML parsing — look for default_identity key
449 for line in content.lines() {
450 let trimmed = line.trim();
451 if trimmed.starts_with("default_identity") {
452 // Extract the value between quotes
453 if let Some(start) = trimmed.find('"') {
454 if let Some(end) = trimmed.rfind('"') {
455 if end > start {
456 let value = &trimmed[start + 1..end];
457 if !value.is_empty() {
458 return Some(value.to_string());
459 }
460 }
461 }
462 }
463 }
464 }
465 None
466}
467
468/// Load identity info from a directory matching the given ID.
469fn load_identity_by_id(identities_dir: &Path, id_base32: &str) -> Option<UserIdentityInfo> {

Callers 1

Calls 2

linesMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected