Trait coins_bip32::derived::DerivedKey[][src]

pub trait DerivedKey {
    fn derivation(&self) -> &KeyDerivation;

    fn same_root<K: DerivedKey>(&self, other: &K) -> bool { ... }
fn is_possible_ancestor_of<K: DerivedKey>(&self, other: &K) -> bool { ... }
fn path_to_descendant<K: DerivedKey>(
        &self,
        other: &K
    ) -> Option<DerivationPath> { ... } }

Derived keys are keys coupled with their derivation. We use this trait to check ancestry relationships between keys.

Required methods

fn derivation(&self) -> &KeyDerivation[src]

Return this key’s derivation

Loading content...

Provided methods

fn same_root<K: DerivedKey>(&self, other: &K) -> bool[src]

true if the keys share a root fingerprint, false otherwise. Note that on key fingerprints, which may collide accidentally, or be intentionally collided.

fn is_possible_ancestor_of<K: DerivedKey>(&self, other: &K) -> bool[src]

true if this key is a possible ancestor of the argument, false otherwise.

Warning: this check is cheap, but imprecise. It simply compares the root fingerprints (which may collide) and checks that self.path is a prefix of other.path. This may be deliberately foold by an attacker. For a precise check, use DerivedXPriv::is_private_ancestor_of() or DerivedXPub::is_public_ancestor_of()

fn path_to_descendant<K: DerivedKey>(&self, other: &K) -> Option<DerivationPath>[src]

Returns the path to the descendant, or None if the argument is definitely not a descendant.

This is useful for determining the path to reach some descendant from some ancestor.

Loading content...

Implementors

Loading content...