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

Method load_keypair

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

Load a keypair for an identity.

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

Source from the content-addressed store, hash-verified

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

Callers 5

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

Calls 3

load_secret_keyMethod · 0.80
loadMethod · 0.45
public_keyMethod · 0.45

Tested by 1