Add unwrapping function to XOnlyPublicKey
What changed, and why it matters
This commit adds a simple accessor method that lets users extract the underlying cryptographic key from a wrapper type. It is a routine API addition with no security relevance visible in the code or commit message.
No security action required. Review as a normal API addition.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch adds XOnlyPublicKey::into_inner(self) -> secp256k1::XOnlyPublicKey, a consuming getter that returns the wrapped secp256k1::XOnlyPublicKey. It exposes data already present in the type and does not change parsing, serialization, validation, or cryptographic operations.
Changed components
bitcoin/src/crypto/key.rsXOnlyPublicKeyInspect captured patch +4 / −0
diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs
index abc24946..1a8a2d32 100644
--- a/bitcoin/src/crypto/key.rs
+++ b/bitcoin/src/crypto/key.rs
@@ -62,6 +62,10 @@ impl XOnlyPublicKey {
.map_err(|_| ParseXOnlyPublicKeyError::InvalidXCoordinate)
}
+ /// Returns the inner secp256k1 x-only public key.
+ #[inline]
+ pub fn into_inner(self) -> secp256k1::XOnlyPublicKey { self.0 }
+
/// Serializes the x-only public key as a byte-encoded x coordinate value (32 bytes).
#[inline]
pub fn serialize(&self) -> [u8; constants::SCHNORR_PUBLIC_KEY_SIZE] { self.0.serialize() }
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.