(name: Option<&str>)
| 2982 | } |
| 2983 | |
| 2984 | fn load_identity(name: Option<&str>) -> Result<IdentityMaterial, Status> { |
| 2985 | let store = IdentityStore::open_default() |
| 2986 | .map_err(|error| domain_status(ErrorCode::Internal, format!("identity store: {error}")))?; |
| 2987 | let identity = match name { |
| 2988 | Some(name) => store.load_by_name(name).map_err(|error| { |
| 2989 | domain_status(ErrorCode::NotFound, format!("identity '{name}': {error}")) |
| 2990 | })?, |
| 2991 | None => store |
| 2992 | .get_default() |
| 2993 | .map_err(|error| { |
| 2994 | domain_status(ErrorCode::Internal, format!("default identity: {error}")) |
| 2995 | })? |
| 2996 | .ok_or_else(|| domain_status(ErrorCode::NotFound, "no default identity selected"))?, |
| 2997 | }; |
| 2998 | let keypair = store |
| 2999 | .load_keypair(&identity.id, None) |
| 3000 | .map_err(|error| domain_status(ErrorCode::Internal, format!("signing key: {error}")))?; |
| 3001 | Ok(IdentityMaterial { identity, keypair }) |
| 3002 | } |
| 3003 | |
| 3004 | /// Load an identity for VERIFICATION only — the public key, never a secret |
| 3005 | /// key. The external-signing flow (`--prepare`/`--signed`) must work for an |
no test coverage detected