Struct sapio_bitcoin::util::key::PrivateKey
source · [−]Expand description
A Bitcoin ECDSA private key
Fields
compressed: bool
Whether this private key should be serialized as compressed
network: Network
The network on which this key should be used
inner: SecretKey
The actual ECDSA key
Implementations
sourceimpl PrivateKey
impl PrivateKey
sourcepub fn new(key: SecretKey, network: Network) -> PrivateKey
pub fn new(key: SecretKey, network: Network) -> PrivateKey
Constructs compressed ECDSA private key from the provided generic Secp256k1 private key and the specified network
sourcepub fn new_uncompressed(key: SecretKey, network: Network) -> PrivateKey
pub fn new_uncompressed(key: SecretKey, network: Network) -> PrivateKey
Constructs uncompressed (legacy) ECDSA private key from the provided generic Secp256k1 private key and the specified network
sourcepub fn public_key<C: Signing>(&self, secp: &Secp256k1<C>) -> PublicKey
pub fn public_key<C: Signing>(&self, secp: &Secp256k1<C>) -> PublicKey
Creates a public key from this private key
sourcepub fn to_bytes(&self) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn to_bytes(&self) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Serialize the private key to bytes
sourcepub fn from_slice(data: &[u8], network: Network) -> Result<PrivateKey, Error>
pub fn from_slice(data: &[u8], network: Network) -> Result<PrivateKey, Error>
Deserialize a private key from a slice
Trait Implementations
sourceimpl Clone for PrivateKey
impl Clone for PrivateKey
sourcefn clone(&self) -> PrivateKey
fn clone(&self) -> PrivateKey
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for PrivateKey
impl Debug for PrivateKey
sourceimpl<'de> Deserialize<'de> for PrivateKey
This is supported on crate feature serde
only.
impl<'de> Deserialize<'de> for PrivateKey
serde
only.sourcefn deserialize<D: Deserializer<'de>>(d: D) -> Result<PrivateKey, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<PrivateKey, D::Error>
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for PrivateKey
impl Display for PrivateKey
sourceimpl FromStr for PrivateKey
impl FromStr for PrivateKey
sourceimpl Index<RangeFull> for PrivateKey
impl Index<RangeFull> for PrivateKey
sourceimpl PartialEq<PrivateKey> for PrivateKey
impl PartialEq<PrivateKey> for PrivateKey
sourcefn eq(&self, other: &PrivateKey) -> bool
fn eq(&self, other: &PrivateKey) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &PrivateKey) -> bool
fn ne(&self, other: &PrivateKey) -> bool
This method tests for !=
.
sourceimpl Serialize for PrivateKey
This is supported on crate feature serde
only.
impl Serialize for PrivateKey
serde
only.impl Copy for PrivateKey
impl Eq for PrivateKey
impl StructuralEq for PrivateKey
impl StructuralPartialEq for PrivateKey
Auto Trait Implementations
impl RefUnwindSafe for PrivateKey
impl Send for PrivateKey
impl Sync for PrivateKey
impl Unpin for PrivateKey
impl UnwindSafe for PrivateKey
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more