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

Method load_keypair

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

Load a keypair for an identity.

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

Source from the content-addressed store, hash-verified

609
610 /// Load a keypair for an identity.
611 pub fn load_keypair(
612 &self,
613 id: &IdentityId,
614 password: Option<&str>,
615 ) -> Result<KeyPair, IdentityError> {
616 let identity = self.load(id)?;
617 let secret = self.load_secret_key(id, password)?;
618
619 // Verify the secret key matches the public key
620 let derived_public = secret.public_key();
621 if derived_public != identity.public_key {
622 return Err(IdentityError::InvalidKey(
623 "Secret key does not match public key".to_string(),
624 ));
625 }
626
627 Ok(KeyPair::from_secret_key(secret))
628 }
629
630 /// Delete an identity from the store.
631 pub fn delete(&mut self, id: &IdentityId) -> Result<(), IdentityError> {

Callers 15

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
resolve_turn_signerFunction · 0.80

Calls 3

load_secret_keyMethod · 0.80
loadMethod · 0.45
public_keyMethod · 0.45

Tested by 4

runMethod · 0.64
runMethod · 0.64