[][src]Trait grin_keychain::Keychain

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

Required methods

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

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

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

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

pub fn from_random_seed(is_test: bool) -> Result<Self, Error>[src]

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

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

XOR masks the keychain's master key against another key

pub fn root_key_id() -> Identifier[src]

Root identifier for that keychain

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

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

pub fn public_root_key(&self) -> PublicKey[src]

The public root key

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

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

pub fn blind_sum(&self, blind_sum: &BlindSum) -> Result<BlindingFactor, Error>[src]

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

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

pub fn secp(&self) -> &Secp256k1[src]

Loading content...

Implementors

impl Keychain for ExtKeychain[src]

pub fn from_random_seed(is_test: bool) -> Result<ExtKeychain, Error>[src]

For testing - probably not a good idea to use outside of tests.

Loading content...