Find the directory for an identity by ID.
(&self, id: &IdentityId)
| 891 | |
| 892 | /// Find the directory for an identity by ID. |
| 893 | fn find_identity_dir(&self, id: &IdentityId) -> Result<PathBuf, IdentityError> { |
| 894 | let id_suffix = id.short(); |
| 895 | |
| 896 | for entry in fs::read_dir(&self.root)? { |
| 897 | let entry = entry?; |
| 898 | let path = entry.path(); |
| 899 | |
| 900 | if path.is_dir() { |
| 901 | if let Some(name) = path.file_name().and_then(|n| n.to_str()) { |
| 902 | if name.ends_with(&id_suffix) { |
| 903 | return Ok(path); |
| 904 | } |
| 905 | } |
| 906 | } |
| 907 | } |
| 908 | |
| 909 | Err(IdentityError::NotFound { |
| 910 | name: id.to_base32(), |
| 911 | }) |
| 912 | } |
| 913 | |
| 914 | /// Save the store configuration. |
| 915 | fn save_config(&self) -> Result<(), IdentityError> { |
no test coverage detected