key: Make as_inner pub(super) for secret key types
What changed, and why it matters
This commit narrows the visibility of two internal accessor methods from public to crate-internal. It is a routine API-cleanup change with no security relevance: it does not fix a bug, change behavior, or address any reported vulnerability.
No security action required. Treat as a normal API-visibility refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch changes as_inner() on PrivateKey and Keypair from pub to pub(super) inside the encapsulate module. This is part of a long-term encapsulation effort to reduce direct exposure of underlying secp256k1 types. The methods remain accessible within the module hierarchy; only external callers are restricted. No logic, validation, or cryptographic operations are modified.
Changed components
bitcoin/src/crypto/key.rsInspect captured patch +2 / −2
diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs
index 86b18c25..0ebbddab 100644
--- a/bitcoin/src/crypto/key.rs
+++ b/bitcoin/src/crypto/key.rs
@@ -92,7 +92,7 @@ mod encapsulate {
/// Returns a reference to the inner [`secp256k1::Keypair`].
#[inline]
- pub fn as_inner(&self) -> &secp256k1::Keypair { &self.0 }
+ pub(super) fn as_inner(&self) -> &secp256k1::Keypair { &self.0 }
}
/// A Bitcoin ECDSA public key.
@@ -166,7 +166,7 @@ mod encapsulate {
/// Returns a reference to the inner secp256k1 secret key.
#[inline]
- pub fn as_inner(&self) -> &secp256k1::SecretKey { &self.inner }
+ pub(super) fn as_inner(&self) -> &secp256k1::SecretKey { &self.inner }
/// Returns whether this private key should be serialized as compressed.
#[inline]
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.