pub struct Privkey(pub SecretKey);Expand description
A wrapper for secp256k1 secret key
Tuple Fields§
§0: SecretKeyImplementations§
Source§impl Privkey
impl Privkey
pub fn from_slice(key: &[u8]) -> Self
pub fn pubkey(&self) -> Pubkey
pub fn tweak<I: Into<[u8; 32]>>(&self, scalar: I) -> Self
pub fn sign(&self, message: [u8; 32]) -> EcdsaSignature
pub fn x_only_pub_key(&self) -> XOnlyPublicKey
pub fn sign_schnorr(&self, message: [u8; 32]) -> SchnorrSignature
Trait Implementations§
Source§impl AsRef<[u8; 32]> for Privkey
impl AsRef<[u8; 32]> for Privkey
Source§fn as_ref(&self) -> &[u8; 32]
fn as_ref(&self) -> &[u8; 32]
Gets a reference to the underlying array.
§Side channel attacks
Using ordering functions (PartialOrd/Ord) on a reference to secret keys leaks data
because the implementations are not constant time. Doing so will make your code vulnerable
to side channel attacks. SecretKey::eq is implemented using a constant time algorithm,
please consider using it to do comparisons of secret keys.
Source§impl<'de> Deserialize<'de> for Privkey
impl<'de> Deserialize<'de> for Privkey
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Privkey
impl StructuralPartialEq for Privkey
Auto Trait Implementations§
impl Freeze for Privkey
impl RefUnwindSafe for Privkey
impl Send for Privkey
impl Sync for Privkey
impl Unpin for Privkey
impl UnsafeUnpin for Privkey
impl UnwindSafe for Privkey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more