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>)
| 138 | /// with all-`–` verifies. A `--identity <name>` that does not exist IS a hard |
| 139 | /// error (`IdentityNotFound`), matching the verify verb. |
| 140 | fn resolve_verifier(name: &Option<String>) -> CliResult<Option<Verifier>> { |
| 141 | let store = match IdentityStore::open_default() { |
| 142 | Ok(s) => s, |
| 143 | // No store at all ⇒ soft-fail to "no identity" (all verifies '–'). |
| 144 | Err(_) => return Ok(None), |
| 145 | }; |
| 146 | let identity = if let Some(name) = name { |
| 147 | // A named-but-missing identity is a hard error (parity with verify). |
| 148 | Some( |
| 149 | store |
| 150 | .load_by_name(name) |
| 151 | .map_err(|_| CliError::IdentityNotFound(name.clone()))?, |
| 152 | ) |
| 153 | } else { |
| 154 | // No default resolvable ⇒ soft-fail, don't abort the list. |
| 155 | store.get_default().ok().flatten() |
| 156 | }; |
| 157 | Ok(identity.map(|id| Verifier { |
| 158 | did: did_for_public_key(&id.public_key), |
| 159 | public_key: id.public_key, |
| 160 | })) |
| 161 | } |
| 162 | |
| 163 | /// The DID-match-then-verify rule for an intent. Pure over its inputs so it can |
| 164 | /// be unit-tested without a global `IdentityStore`. |
no test coverage detected