Trait slip132::VersionResolver
source · [−]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
Associated Types
type Application
type Application
Type that defines possible applications fro public and private keys (types of scriptPubkey descriptors in which they can be used)
Required methods
fn resolve(
network: Self::Network,
applicable_for: Self::Application,
is_priv: bool
) -> KeyVersion
fn resolve(
network: Self::Network,
applicable_for: Self::Application,
is_priv: bool
) -> KeyVersion
Constructor for KeyVersion
with given network, application scope and
key type (public or private)
Provided methods
fn is_pub(_: &KeyVersion) -> Option<bool>
fn is_pub(_: &KeyVersion) -> Option<bool>
Detects whether provided version corresponds to an extended public key.
Returns None
if the version is not recognized/unknown to the resolver.
fn is_prv(_: &KeyVersion) -> Option<bool>
fn is_prv(_: &KeyVersion) -> Option<bool>
Detects whether provided version corresponds to an extended private key.
Returns None
if the version is not recognized/unknown to the resolver.
fn network(_: &KeyVersion) -> Option<Self::Network>
fn network(_: &KeyVersion) -> Option<Self::Network>
Detects network used by the provided key version bytes.
Returns None
if the version is not recognized/unknown to the resolver.
fn application(_: &KeyVersion) -> Option<Self::Application>
fn application(_: &KeyVersion) -> Option<Self::Application>
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.
fn derivation_path(
_: &KeyVersion,
_: Option<ChildNumber>
) -> Option<DerivationPath>
fn derivation_path(
_: &KeyVersion,
_: Option<ChildNumber>
) -> Option<DerivationPath>
Returns BIP 32 derivation path for the provided key version.
Returns None
if the version is not recognized/unknown to the resolver.
fn make_pub(_: &KeyVersion) -> Option<KeyVersion>
fn make_pub(_: &KeyVersion) -> Option<KeyVersion>
Converts version into version corresponding to an extended public key.
Returns None
if the resolver does not know how to perform conversion.
fn make_prv(_: &KeyVersion) -> Option<KeyVersion>
fn make_prv(_: &KeyVersion) -> Option<KeyVersion>
Converts version into version corresponding to an extended private key.
Returns None
if the resolver does not know how to perform conversion.