Resolve the PERSON's signing identity + keypair, exactly as `atomic intent attest` does.
(
identity: Option<&str>,
)
| 209 | /// Resolve the PERSON's signing identity + keypair, exactly as |
| 210 | /// `atomic intent attest` does. |
| 211 | fn resolve_person( |
| 212 | identity: Option<&str>, |
| 213 | ) -> CliResult<( |
| 214 | atomic_identity::identity::Identity, |
| 215 | atomic_identity::keypair::KeyPair, |
| 216 | )> { |
| 217 | let store = IdentityStore::open_default() |
| 218 | .map_err(|e| CliError::Internal(anyhow::anyhow!("Failed to open identity store: {}", e)))?; |
| 219 | let identity = if let Some(name) = identity { |
| 220 | store |
| 221 | .load_by_name(name) |
| 222 | .map_err(|_| CliError::IdentityNotFound(name.to_string()))? |
| 223 | } else { |
| 224 | store |
| 225 | .get_default() |
| 226 | .map_err(|e| { |
| 227 | CliError::Internal(anyhow::anyhow!("Failed to load default identity: {}", e)) |
| 228 | })? |
| 229 | .ok_or_else(|| CliError::InvalidArgument { |
| 230 | message: "No default identity set. Create one first:\n \ |
| 231 | atomic identity new <name> --email <email> --set-default" |
| 232 | .to_string(), |
| 233 | })? |
| 234 | }; |
| 235 | let keypair = store.load_keypair(&identity.id, None).map_err(|e| { |
| 236 | CliError::Internal(anyhow::anyhow!( |
| 237 | "Failed to load keypair for '{}': {}", |
| 238 | identity.name, |
| 239 | e |
| 240 | )) |
| 241 | })?; |
| 242 | Ok((identity, keypair)) |
| 243 | } |
| 244 | |
| 245 | /// Print the PROV JSON-LD artifact(s) to stdout. When `signed`, add the |
| 246 | /// dev-signature caveat (the signing path was used). |
no test coverage detected