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