Find the directory for an identity by ID.
(&self, id: &IdentityId)
| 870 | |
| 871 | /// Find the directory for an identity by ID. |
| 872 | fn find_identity_dir(&self, id: &IdentityId) -> Result<PathBuf, IdentityError> { |
| 873 | let id_suffix = id.short(); |
| 874 | |
| 875 | for entry in fs::read_dir(&self.root)? { |
| 876 | let entry = entry?; |
| 877 | let path = entry.path(); |
| 878 | |
| 879 | if path.is_dir() { |
| 880 | if let Some(name) = path.file_name().and_then(|n| n.to_str()) { |
| 881 | if name.ends_with(&id_suffix) { |
| 882 | return Ok(path); |
| 883 | } |
| 884 | } |
| 885 | } |
| 886 | } |
| 887 | |
| 888 | Err(IdentityError::NotFound { |
| 889 | name: id.to_base32(), |
| 890 | }) |
| 891 | } |
| 892 | |
| 893 | /// Save the store configuration. |
| 894 | fn save_config(&self) -> Result<(), IdentityError> { |
no test coverage detected