diff --git a/src/descriptor/key.rs b/src/descriptor/key.rs index 6af0146e0..9e8deb948 100644 --- a/src/descriptor/key.rs +++ b/src/descriptor/key.rs @@ -777,6 +777,16 @@ impl DefiniteDescriptorKey { pub fn full_derivation_path(&self) -> bip32::DerivationPath { self.0.full_derivation_path() } + + /// Reference to the underlying `DescriptorPublicKey` + pub fn as_descriptor_public_key(&self) -> &DescriptorPublicKey { + &self.0 + } + + /// Converts the definite key into a generic one + pub fn into_descriptor_public_key(self) -> DescriptorPublicKey { + self.0 + } } impl FromStr for DefiniteDescriptorKey { @@ -842,6 +852,12 @@ impl From for DescriptorPublicKey { } } +impl Borrow for DefiniteDescriptorKey { + fn borrow(&self) -> &DescriptorPublicKey { + &self.0 + } +} + #[cfg(test)] mod test { use core::str::FromStr;