pub struct DerivedPrivateKey { /* private fields */ }Expand description
A private key derived via the IC’s derivation mechanism
Due to oddities in Ed25519’s secret key format, a derived private key cannot be treated the same way as an ordinary private key. In particular, it cannot be serialized.
Implementations§
Source§impl DerivedPrivateKey
impl DerivedPrivateKey
Sourcepub fn sign_message(&self, msg: &[u8]) -> [u8; 64]
pub fn sign_message(&self, msg: &[u8]) -> [u8; 64]
Sign a message and return a signature
This is the non-prehashed variant of Ed25519
Sourcepub fn public_key(&self) -> PublicKey
pub fn public_key(&self) -> PublicKey
Return the public key associated with this private key
Sourcepub fn derive_subkey(
&self,
derivation_path: &DerivationPath,
) -> (DerivedPrivateKey, [u8; 32])
pub fn derive_subkey( &self, derivation_path: &DerivationPath, ) -> (DerivedPrivateKey, [u8; 32])
Derive a private key from this private key using a derivation path
This is the same derivation system used by the Internet Computer when deriving subkeys for threshold Ed25519
Note that this function returns a DerivedPrivateKey rather than Self, and that DerivedPrivateKey can sign messages but cannot be serialized. This is due to the definition of Ed25519 private keys, which is incompatible with additive derivation.
Sourcepub fn derive_subkey_with_chain_code(
&self,
derivation_path: &DerivationPath,
chain_code: &[u8; 32],
) -> (DerivedPrivateKey, [u8; 32])
pub fn derive_subkey_with_chain_code( &self, derivation_path: &DerivationPath, chain_code: &[u8; 32], ) -> (DerivedPrivateKey, [u8; 32])
Derive a private key from this private key using a derivation path and chain code
This is the same derivation system used by the Internet Computer when deriving subkeys for threshold Ed25519
Note that this function returns a DerivedPrivateKey rather than Self, and that DerivedPrivateKey can sign messages but cannot be serialized. This is due to the definition of Ed25519 private keys, which is incompatible with additive derivation.