Struct lightning_invoice::PayeePubKey
source · pub struct PayeePubKey(pub PublicKey);
Expand description
Payee public key
Tuple Fields§
§0: PublicKey
Methods from Deref<Target = PublicKey>§
sourcepub fn cmp_fast_unstable(&self, other: &PublicKey) -> Ordering
pub fn cmp_fast_unstable(&self, other: &PublicKey) -> Ordering
Like cmp::Cmp
but faster and with no guarantees across library versions.
The Cmp
implementation for FFI types is stable but slow because it first
serializes self
and other
before comparing them. This function provides a faster
comparison if you know that your types come from the same library version.
sourcepub fn eq_fast_unstable(&self, other: &PublicKey) -> bool
pub fn eq_fast_unstable(&self, other: &PublicKey) -> bool
Like cmp::Eq
but faster and with no guarantees across library versions.
The Eq
implementation for FFI types is stable but slow because it first serializes
self
and other
before comparing them. This function provides a faster equality
check if you know that your types come from the same library version.
sourcepub fn as_ptr(&self) -> *const PublicKey
👎Deprecated since 0.25.0: Use Self::as_c_ptr if you need to access the FFI layer
pub fn as_ptr(&self) -> *const PublicKey
Obtains a raw const pointer suitable for use with FFI functions.
sourcepub fn serialize(&self) -> [u8; 33]
pub fn serialize(&self) -> [u8; 33]
Serializes 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 serialize_uncompressed(&self) -> [u8; 65]
pub fn serialize_uncompressed(&self) -> [u8; 65]
Serializes the key as a byte-encoded pair of values, in uncompressed form.
sourcepub fn combine(&self, other: &PublicKey) -> Result<PublicKey, Error>
pub fn combine(&self, other: &PublicKey) -> Result<PublicKey, Error>
Adds a second key to this one, returning the sum.
§Errors
If the result would be the point at infinity, i.e. adding this point to its own negation.
§Examples
use secp256k1::{rand, Secp256k1};
let secp = Secp256k1::new();
let mut rng = rand::thread_rng();
let (_, pk1) = secp.generate_keypair(&mut rng);
let (_, pk2) = secp.generate_keypair(&mut rng);
let sum = pk1.combine(&pk2).expect("It's improbable to fail for 2 random public keys");
sourcepub fn x_only_public_key(&self) -> (XOnlyPublicKey, Parity)
pub fn x_only_public_key(&self) -> (XOnlyPublicKey, Parity)
Returns the XOnlyPublicKey
(and it’s Parity
) for this PublicKey
.
Trait Implementations§
source§impl Base32Len for PayeePubKey
impl Base32Len for PayeePubKey
source§fn base32_len(&self) -> usize
fn base32_len(&self) -> usize
source§impl Clone for PayeePubKey
impl Clone for PayeePubKey
source§fn clone(&self) -> PayeePubKey
fn clone(&self) -> PayeePubKey
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PayeePubKey
impl Debug for PayeePubKey
source§impl Deref for PayeePubKey
impl Deref for PayeePubKey
source§impl From<PublicKey> for PayeePubKey
impl From<PublicKey> for PayeePubKey
source§impl FromBase32 for PayeePubKey
impl FromBase32 for PayeePubKey
§type Err = Bolt11ParseError
type Err = Bolt11ParseError
source§fn from_base32(field_data: &[u5]) -> Result<PayeePubKey, Bolt11ParseError>
fn from_base32(field_data: &[u5]) -> Result<PayeePubKey, Bolt11ParseError>
Self
.source§impl Hash for PayeePubKey
impl Hash for PayeePubKey
source§impl Ord for PayeePubKey
impl Ord for PayeePubKey
source§fn cmp(&self, other: &PayeePubKey) -> Ordering
fn cmp(&self, other: &PayeePubKey) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for PayeePubKey
impl PartialEq for PayeePubKey
source§fn eq(&self, other: &PayeePubKey) -> bool
fn eq(&self, other: &PayeePubKey) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for PayeePubKey
impl PartialOrd for PayeePubKey
source§fn partial_cmp(&self, other: &PayeePubKey) -> Option<Ordering>
fn partial_cmp(&self, other: &PayeePubKey) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more