MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / load_with_options

Method load_with_options

atomic-identity/src/store.rs:498–515  ·  view source on GitHub ↗

Load an identity with options.

(
        &self,
        id: &IdentityId,
        _options: &LoadOptions,
    )

Source from the content-addressed store, hash-verified

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> {

Callers 1

loadMethod · 0.80

Calls 4

find_identity_dirMethod · 0.80
to_identityMethod · 0.80
existsMethod · 0.45
to_base32Method · 0.45

Tested by

no test coverage detected