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 as_ptr(&self) -> *const PublicKey
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
Calculate the base32 serialized length
source§impl Clone for PayeePubKey
impl Clone for PayeePubKey
source§fn clone(&self) -> PayeePubKey
fn clone(&self) -> PayeePubKey
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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 = ParseError
type Err = ParseError
The associated error which can be returned from parsing (e.g. because of bad padding).
source§fn from_base32(field_data: &[u5]) -> Result<PayeePubKey, ParseError>
fn from_base32(field_data: &[u5]) -> Result<PayeePubKey, ParseError>
Convert a base32 slice to
Self
.