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

Method load_keypair

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

Load a keypair for an identity.

(
        &self,
        id: &IdentityId,
        password: Option<&str>,
    )

Source from the content-addressed store, hash-verified

588
589 /// Load a keypair for an identity.
590 pub fn load_keypair(
591 &self,
592 id: &IdentityId,
593 password: Option<&str>,
594 ) -> Result<KeyPair, IdentityError> {
595 let identity = self.load(id)?;
596 let secret = self.load_secret_key(id, password)?;
597
598 // Verify the secret key matches the public key
599 let derived_public = secret.public_key();
600 if derived_public != identity.public_key {
601 return Err(IdentityError::InvalidKey(
602 "Secret key does not match public key".to_string(),
603 ));
604 }
605
606 Ok(KeyPair::from_secret_key(secret))
607 }
608
609 /// Delete an identity from the store.
610 pub fn delete(&mut self, id: &IdentityId) -> Result<(), IdentityError> {

Callers 13

check_push_credentialsFunction · 0.80
mint_tokenFunction · 0.80
runMethod · 0.80
resolve_personFunction · 0.80
runMethod · 0.80
runMethod · 0.80
executeMethod · 0.80
runMethod · 0.80
executeMethod · 0.80
executeMethod · 0.80
executeMethod · 0.80
executeMethod · 0.80

Calls 3

load_secret_keyMethod · 0.80
loadMethod · 0.45
public_keyMethod · 0.45

Tested by 3

runMethod · 0.64
runMethod · 0.64