[][src]Trait grin_keychain::Keychain

pub trait Keychain: Sync + Send + Clone {
    fn from_seed(seed: &[u8], is_floo: bool) -> Result<Self, Error>;
fn from_mnemonic(
        word_list: &str,
        extension_word: &str,
        is_floo: bool
    ) -> Result<Self, Error>;
fn from_random_seed(is_floo: 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

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

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

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

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

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

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

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

XOR masks the keychain's master key against another key

fn root_key_id() -> Identifier

Root identifier for that keychain

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.

fn public_root_key(&self) -> PublicKey

The public root key

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

Loading content...

Implementors

impl Keychain for ExtKeychain[src]

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

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

Loading content...