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

Method load_with_options

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

Load an identity with options.

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

Source from the content-addressed store, hash-verified

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

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