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>)
| 131 | /// missing default (or no store) yields `Ok(None)` (all verifies `–`); a |
| 132 | /// `--identity <name>` that does not exist IS a hard error. |
| 133 | fn resolve_verifier(name: &Option<String>) -> CliResult<Option<Verifier>> { |
| 134 | let store = match IdentityStore::open_default() { |
| 135 | Ok(s) => s, |
| 136 | Err(_) => return Ok(None), |
| 137 | }; |
| 138 | let identity = if let Some(name) = name { |
| 139 | Some( |
| 140 | store |
| 141 | .load_by_name(name) |
| 142 | .map_err(|_| CliError::IdentityNotFound(name.clone()))?, |
| 143 | ) |
| 144 | } else { |
| 145 | store.get_default().ok().flatten() |
| 146 | }; |
| 147 | Ok(identity.map(|id| Verifier { |
| 148 | did: did_for_public_key(&id.public_key), |
| 149 | public_key: id.public_key, |
| 150 | })) |
| 151 | } |
| 152 | |
| 153 | /// The DID-match-then-verify rule for a memory. Pure over its inputs so it can be |
| 154 | /// unit-tested without a global `IdentityStore`. See the intent list's |
no test coverage detected