Resolve the PERSON's signing identity + keypair, exactly as `atomic intent attest` does.
(
identity: Option<&str>,
)
| 290 | /// Resolve the PERSON's signing identity + keypair, exactly as |
| 291 | /// `atomic intent attest` does. |
| 292 | pub(crate) fn resolve_person( |
| 293 | identity: Option<&str>, |
| 294 | ) -> CliResult<( |
| 295 | atomic_identity::identity::Identity, |
| 296 | atomic_identity::keypair::KeyPair, |
| 297 | )> { |
| 298 | let store = IdentityStore::open_default() |
| 299 | .map_err(|e| CliError::Internal(anyhow::anyhow!("Failed to open identity store: {}", e)))?; |
| 300 | let identity = if let Some(name) = identity { |
| 301 | store |
| 302 | .load_by_name(name) |
| 303 | .map_err(|_| CliError::IdentityNotFound(name.to_string()))? |
| 304 | } else { |
| 305 | store |
| 306 | .get_default() |
| 307 | .map_err(|e| { |
| 308 | CliError::Internal(anyhow::anyhow!("Failed to load default identity: {}", e)) |
| 309 | })? |
| 310 | .ok_or_else(|| CliError::InvalidArgument { |
| 311 | message: "No default identity set. Create one first:\n \ |
| 312 | atomic identity new <name> --email <email> --set-default" |
| 313 | .to_string(), |
| 314 | })? |
| 315 | }; |
| 316 | let keypair = store.load_keypair(&identity.id, None).map_err(|e| { |
| 317 | CliError::Internal(anyhow::anyhow!( |
| 318 | "Failed to load keypair for '{}': {}", |
| 319 | identity.name, |
| 320 | e |
| 321 | )) |
| 322 | })?; |
| 323 | Ok((identity, keypair)) |
| 324 | } |
| 325 | |
| 326 | /// Print the PROV JSON-LD artifact(s) to stdout. When `signed`, add the |
| 327 | /// dev-signature caveat (the signing path was used). |
no test coverage detected