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>)
| 161 | /// with all-`–` verifies. A `--identity <name>` that does not exist IS a hard |
| 162 | /// error (`IdentityNotFound`), matching the verify verb. |
| 163 | fn resolve_verifier(name: &Option<String>) -> CliResult<Option<Verifier>> { |
| 164 | let store = match IdentityStore::open_default() { |
| 165 | Ok(s) => s, |
| 166 | // No store at all ⇒ soft-fail to "no identity" (all verifies '–'). |
| 167 | Err(_) => return Ok(None), |
| 168 | }; |
| 169 | let identity = if let Some(name) = name { |
| 170 | // A named-but-missing identity is a hard error (parity with verify). |
| 171 | Some( |
| 172 | store |
| 173 | .load_by_name(name) |
| 174 | .map_err(|_| CliError::IdentityNotFound(name.clone()))?, |
| 175 | ) |
| 176 | } else { |
| 177 | // No default resolvable ⇒ soft-fail, don't abort the list. |
| 178 | store.get_default().ok().flatten() |
| 179 | }; |
| 180 | Ok(identity.map(|id| Verifier { |
| 181 | did: did_for_public_key(&id.public_key), |
| 182 | public_key: id.public_key, |
| 183 | })) |
| 184 | } |
| 185 | |
| 186 | /// The DID-match-then-verify rule for an intent. Pure over its inputs so it can |
| 187 | /// be unit-tested without a global `IdentityStore`. |
no test coverage detected