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

Method load_with_options

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

Load an identity with options.

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

Source from the content-addressed store, hash-verified

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

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