pub struct PublicKey(/* private fields */);
Expand description
A Secp256k1 public key, used for verification of signatures
Implementations§
Source§impl 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.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PublicKey
impl<'de> Deserialize<'de> for PublicKey
Source§fn deserialize<D>(d: D) -> Result<PublicKey, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<PublicKey, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for PublicKey
impl Eq for PublicKey
impl StructuralPartialEq for PublicKey
Auto Trait Implementations§
impl Freeze for PublicKey
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)