Resolve the verifying identity exactly as the verify verb does, but SOFT: a missing default (or no store) yields `Ok(None)` so the list still renders with all-`–` verifies. A `--identity ` that does not exist IS a hard error (`IdentityNotFound`), matching the verify verb.
(name: &Option<String>)
| 257 | /// with all-`–` verifies. A `--identity <name>` that does not exist IS a hard |
| 258 | /// error (`IdentityNotFound`), matching the verify verb. |
| 259 | fn resolve_verifier(name: &Option<String>) -> CliResult<Option<Verifier>> { |
| 260 | let store = match IdentityStore::open_default() { |
| 261 | Ok(s) => s, |
| 262 | // No store at all ⇒ soft-fail to "no identity" (all verifies '–'). |
| 263 | Err(_) => return Ok(None), |
| 264 | }; |
| 265 | let identity = if let Some(name) = name { |
| 266 | // A named-but-missing identity is a hard error (parity with verify). |
| 267 | Some( |
| 268 | store |
| 269 | .load_by_name(name) |
| 270 | .map_err(|_| CliError::IdentityNotFound(name.clone()))?, |
| 271 | ) |
| 272 | } else { |
| 273 | // No default resolvable ⇒ soft-fail, don't abort the list. |
| 274 | store.get_default().ok().flatten() |
| 275 | }; |
| 276 | Ok(identity.map(|id| Verifier { |
| 277 | did: did_for_public_key(&id.public_key), |
| 278 | public_key: id.public_key, |
| 279 | })) |
| 280 | } |
| 281 | |
| 282 | /// The DID-match-then-verify rule for an intent. Pure over its inputs so it can |
| 283 | /// be unit-tested without a global `IdentityStore`. |
no test coverage detected