pub trait VersionResolver: Copy + Clone + PartialEq + Eq + PartialOrd + Ord + Hash + Debug {
    type Network;
    type Application;

    fn resolve(
        network: Self::Network,
        applicable_for: Self::Application,
        is_priv: bool
    ) -> KeyVersion; fn is_pub(_: &KeyVersion) -> Option<bool> { ... } fn is_prv(_: &KeyVersion) -> Option<bool> { ... } fn network(_: &KeyVersion) -> Option<Self::Network> { ... } fn application(_: &KeyVersion) -> Option<Self::Application> { ... } fn derivation_path(
        _: &KeyVersion,
        _: Option<ChildNumber>
    ) -> Option<DerivationPath> { ... } fn make_pub(_: &KeyVersion) -> Option<KeyVersion> { ... } fn make_prv(_: &KeyVersion) -> Option<KeyVersion> { ... } }
Expand description

Trait which must be implemented by helpers which do construction, interpretation, verification and cross-conversion of extended public and private key version magic bytes from KeyVersion

Required Associated Types

Type that defines recognized network options

Type that defines possible applications fro public and private keys (types of scriptPubkey descriptors in which they can be used)

Required Methods

Constructor for KeyVersion with given network, application scope and key type (public or private)

Provided Methods

Detects whether provided version corresponds to an extended public key. Returns None if the version is not recognized/unknown to the resolver.

Detects whether provided version corresponds to an extended private key. Returns None if the version is not recognized/unknown to the resolver.

Detects network used by the provided key version bytes. Returns None if the version is not recognized/unknown to the resolver.

Detects application scope defined by the provided key version bytes. Application scope is a types of scriptPubkey descriptors in which given extended public/private keys can be used. Returns None if the version is not recognized/unknown to the resolver.

Returns BIP 32 derivation path for the provided key version. Returns None if the version is not recognized/unknown to the resolver.

Converts version into version corresponding to an extended public key. Returns None if the resolver does not know how to perform conversion.

Converts version into version corresponding to an extended private key. Returns None if the resolver does not know how to perform conversion.

Implementors