Resolve the verifying identity exactly as `memory verify` does, but SOFT: a missing default (or no store) yields `Ok(None)` (all verifies `–`); a `--identity ` that does not exist IS a hard error.
(name: &Option<String>)
| 205 | /// missing default (or no store) yields `Ok(None)` (all verifies `–`); a |
| 206 | /// `--identity <name>` that does not exist IS a hard error. |
| 207 | fn resolve_verifier(name: &Option<String>) -> CliResult<Option<Verifier>> { |
| 208 | let store = match IdentityStore::open_default() { |
| 209 | Ok(s) => s, |
| 210 | Err(_) => return Ok(None), |
| 211 | }; |
| 212 | let identity = if let Some(name) = name { |
| 213 | Some( |
| 214 | store |
| 215 | .load_by_name(name) |
| 216 | .map_err(|_| CliError::IdentityNotFound(name.clone()))?, |
| 217 | ) |
| 218 | } else { |
| 219 | store.get_default().ok().flatten() |
| 220 | }; |
| 221 | Ok(identity.map(|id| Verifier { |
| 222 | did: did_for_public_key(&id.public_key), |
| 223 | public_key: id.public_key, |
| 224 | })) |
| 225 | } |
| 226 | |
| 227 | /// The DID-match-then-verify rule for a memory. Pure over its inputs so it can be |
| 228 | /// unit-tested without a global `IdentityStore`. See the intent list's |
no test coverage detected