pub struct PublicKey(_);
Expand description
A Secp256k1 public key, used for verification of signatures
Implementations
sourceimpl PublicKey
impl PublicKey
sourcepub fn as_ptr(&self) -> *const PublicKey
pub fn as_ptr(&self) -> *const PublicKey
Obtains a raw pointer suitable for use with FFI functions
sourcepub fn from_secret_key(
secp: &Secp256k1,
sk: &SecretKey
) -> Result<PublicKey, Error>
pub fn from_secret_key(
secp: &Secp256k1,
sk: &SecretKey
) -> Result<PublicKey, Error>
Creates a new public key from a secret key.
sourcepub fn from_slice(secp: &Secp256k1, data: &[u8]) -> Result<PublicKey, Error>
pub fn from_slice(secp: &Secp256k1, data: &[u8]) -> Result<PublicKey, Error>
Creates a public key directly from a slice
sourcepub fn serialize_vec(
&self,
secp: &Secp256k1,
compressed: bool
) -> ArrayVec<[u8; 72]>
pub fn serialize_vec(
&self,
secp: &Secp256k1,
compressed: bool
) -> ArrayVec<[u8; 72]>
Serialize the key as a byte-encoded pair of values. In compressed form the y-coordinate is represented by only a single bit, as x determines it up to one bit.
sourcepub fn add_exp_assign(
&mut self,
secp: &Secp256k1,
other: &SecretKey
) -> Result<(), Error>
pub fn add_exp_assign(
&mut self,
secp: &Secp256k1,
other: &SecretKey
) -> Result<(), Error>
Adds the pk corresponding to other
to the pk self
in place
Trait Implementations
impl Copy for PublicKey
impl Eq for PublicKey
impl StructuralEq for PublicKey
impl StructuralPartialEq for PublicKey
Auto Trait Implementations
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
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)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more