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

Function load_identity

libatomic/src/daemon/services_agent.rs:2984–3002  ·  view source on GitHub ↗
(name: Option<&str>)

Source from the content-addressed store, hash-verified

2982}
2983
2984fn load_identity(name: Option<&str>) -> Result<IdentityMaterial, Status> {
2985 let store = IdentityStore::open_default()
2986 .map_err(|error| domain_status(ErrorCode::Internal, format!("identity store: {error}")))?;
2987 let identity = match name {
2988 Some(name) => store.load_by_name(name).map_err(|error| {
2989 domain_status(ErrorCode::NotFound, format!("identity '{name}': {error}"))
2990 })?,
2991 None => store
2992 .get_default()
2993 .map_err(|error| {
2994 domain_status(ErrorCode::Internal, format!("default identity: {error}"))
2995 })?
2996 .ok_or_else(|| domain_status(ErrorCode::NotFound, "no default identity selected"))?,
2997 };
2998 let keypair = store
2999 .load_keypair(&identity.id, None)
3000 .map_err(|error| domain_status(ErrorCode::Internal, format!("signing key: {error}")))?;
3001 Ok(IdentityMaterial { identity, keypair })
3002}
3003
3004/// Load an identity for VERIFICATION only — the public key, never a secret
3005/// key. The external-signing flow (`--prepare`/`--signed`) must work for an

Callers 1

record_attestationMethod · 0.85

Calls 4

domain_statusFunction · 0.85
load_by_nameMethod · 0.80
load_keypairMethod · 0.80
get_defaultMethod · 0.45

Tested by

no test coverage detected