Load an identity with options.
(
&self,
id: &IdentityId,
_options: &LoadOptions,
)
| 504 | |
| 505 | /// Load an identity with options. |
| 506 | pub fn load_with_options( |
| 507 | &self, |
| 508 | id: &IdentityId, |
| 509 | _options: &LoadOptions, |
| 510 | ) -> Result<Identity, IdentityError> { |
| 511 | let identity_dir = self.find_identity_dir(id)?; |
| 512 | let identity_path = identity_dir.join(Self::IDENTITY_FILE); |
| 513 | |
| 514 | if !identity_path.exists() { |
| 515 | return Err(IdentityError::NotFound { |
| 516 | name: id.to_base32(), |
| 517 | }); |
| 518 | } |
| 519 | |
| 520 | let content = fs::read_to_string(&identity_path)?; |
| 521 | let stored: StoredIdentity = toml::from_str(&content)?; |
| 522 | stored.to_identity() |
| 523 | } |
| 524 | |
| 525 | /// Load an identity by name. |
| 526 | pub fn load_by_name(&self, name: &str) -> Result<Identity, IdentityError> { |
no test coverage detected