Trait grin_keychain::Keychain

source ·
pub trait Keychain: Sync + Send + Clone {
Show 13 methods // Required methods fn from_seed(seed: &[u8], is_test: bool) -> Result<Self, Error>; fn from_mnemonic( word_list: &str, extension_word: &str, is_test: bool ) -> Result<Self, Error>; fn from_random_seed(is_test: bool) -> Result<Self, Error>; fn mask_master_key(&mut self, mask: &SecretKey) -> Result<(), Error>; fn root_key_id() -> Identifier; fn derive_key_id( depth: u8, d1: u32, d2: u32, d3: u32, d4: u32 ) -> Identifier; fn public_root_key(&self) -> PublicKey; fn derive_key( &self, amount: u64, id: &Identifier, switch: SwitchCommitmentType ) -> Result<SecretKey, Error>; fn commit( &self, amount: u64, id: &Identifier, switch: SwitchCommitmentType ) -> Result<Commitment, Error>; fn blind_sum(&self, blind_sum: &BlindSum) -> Result<BlindingFactor, Error>; fn sign( &self, msg: &Message, amount: u64, id: &Identifier, switch: SwitchCommitmentType ) -> Result<Signature, Error>; fn sign_with_blinding( &self, _: &Message, _: &BlindingFactor ) -> Result<Signature, Error>; fn secp(&self) -> &Secp256k1;
}

Required Methods§

source

fn from_seed(seed: &[u8], is_test: bool) -> Result<Self, Error>

Generates a keychain from a raw binary seed (which has already been decrypted if applicable).

source

fn from_mnemonic( word_list: &str, extension_word: &str, is_test: bool ) -> Result<Self, Error>

Generates a keychain from a list of space-separated mnemonic words

source

fn from_random_seed(is_test: bool) -> Result<Self, Error>

Generates a keychain from a randomly generated seed. Mostly used for tests.

source

fn mask_master_key(&mut self, mask: &SecretKey) -> Result<(), Error>

XOR masks the keychain’s master key against another key

source

fn root_key_id() -> Identifier

Root identifier for that keychain

source

fn derive_key_id(depth: u8, d1: u32, d2: u32, d3: u32, d4: u32) -> Identifier

Derives a key id from the depth of the keychain and the values at each depth level. See KeychainPath for more information.

source

fn public_root_key(&self) -> PublicKey

The public root key

source

fn derive_key( &self, amount: u64, id: &Identifier, switch: SwitchCommitmentType ) -> Result<SecretKey, Error>

source

fn commit( &self, amount: u64, id: &Identifier, switch: SwitchCommitmentType ) -> Result<Commitment, Error>

source

fn blind_sum(&self, blind_sum: &BlindSum) -> Result<BlindingFactor, Error>

source

fn sign( &self, msg: &Message, amount: u64, id: &Identifier, switch: SwitchCommitmentType ) -> Result<Signature, Error>

source

fn sign_with_blinding( &self, _: &Message, _: &BlindingFactor ) -> Result<Signature, Error>

source

fn secp(&self) -> &Secp256k1

Object Safety§

This trait is not object safe.

Implementors§