Load an identity with options.
(
&self,
id: &IdentityId,
_options: &LoadOptions,
)
| 525 | |
| 526 | /// Load an identity with options. |
| 527 | pub fn load_with_options( |
| 528 | &self, |
| 529 | id: &IdentityId, |
| 530 | _options: &LoadOptions, |
| 531 | ) -> Result<Identity, IdentityError> { |
| 532 | let identity_dir = self.find_identity_dir(id)?; |
| 533 | let identity_path = identity_dir.join(Self::IDENTITY_FILE); |
| 534 | |
| 535 | if !identity_path.exists() { |
| 536 | return Err(IdentityError::NotFound { |
| 537 | name: id.to_base32(), |
| 538 | }); |
| 539 | } |
| 540 | |
| 541 | let content = fs::read_to_string(&identity_path)?; |
| 542 | let stored: StoredIdentity = toml::from_str(&content)?; |
| 543 | stored.to_identity() |
| 544 | } |
| 545 | |
| 546 | /// Load an identity by name. |
| 547 | pub fn load_by_name(&self, name: &str) -> Result<Identity, IdentityError> { |
no test coverage detected