Find the directory for an identity by ID.
(&self, id: &IdentityId)
| 740 | |
| 741 | /// Find the directory for an identity by ID. |
| 742 | fn find_identity_dir(&self, id: &IdentityId) -> Result<PathBuf, IdentityError> { |
| 743 | let id_suffix = id.short(); |
| 744 | |
| 745 | for entry in fs::read_dir(&self.root)? { |
| 746 | let entry = entry?; |
| 747 | let path = entry.path(); |
| 748 | |
| 749 | if path.is_dir() { |
| 750 | if let Some(name) = path.file_name().and_then(|n| n.to_str()) { |
| 751 | if name.ends_with(&id_suffix) { |
| 752 | return Ok(path); |
| 753 | } |
| 754 | } |
| 755 | } |
| 756 | } |
| 757 | |
| 758 | Err(IdentityError::NotFound { |
| 759 | name: id.to_base32(), |
| 760 | }) |
| 761 | } |
| 762 | |
| 763 | /// Save the store configuration. |
| 764 | fn save_config(&self) -> Result<(), IdentityError> { |
no test coverage detected