[][src]Struct lightning_invoice::SignedRawInvoice

pub struct SignedRawInvoice { /* fields omitted */ }

Represents a signed RawInvoice with cached hash. The signature is not checked and may be invalid.

Invariants

The hash has to be either from the deserialized invoice or from the serialized raw_invoice.

Implementations

impl SignedRawInvoice[src]

pub fn into_parts(self) -> (RawInvoice, [u8; 32], Signature)[src]

Disassembles the SignedRawInvoice into its three parts:

  1. raw invoice
  2. hash of the raw invoice
  3. signature

pub fn raw_invoice(&self) -> &RawInvoice[src]

The RawInvoice which was signed.

pub fn hash(&self) -> &[u8; 32][src]

The hash of the RawInvoice that was signed.

pub fn signature(&self) -> &Signature[src]

Signature for the invoice.

pub fn recover_payee_pub_key(&self) -> Result<PayeePubKey, Error>[src]

Recovers the public key used for signing the invoice from the recoverable signature.

pub fn check_signature(&self) -> bool[src]

Checks if the signature is valid for the included payee public key or if none exists if it's valid for the recovered signature (which should always be true?).

Methods from Deref<Target = RawInvoice>

pub fn hash(&self) -> [u8; 32][src]

Calculate the hash of the encoded RawInvoice

pub fn known_tagged_fields(
    &self
) -> FilterMap<Iter<'_, RawTaggedField>, fn(_: &RawTaggedField) -> Option<&TaggedField>>
[src]

Returns an iterator over all tagged fields with known semantics.

pub fn payment_hash(&self) -> Option<&Sha256>[src]

pub fn description(&self) -> Option<&Description>[src]

pub fn payee_pub_key(&self) -> Option<&PayeePubKey>[src]

pub fn description_hash(&self) -> Option<&Sha256>[src]

pub fn expiry_time(&self) -> Option<&ExpiryTime>[src]

pub fn min_final_cltv_expiry(&self) -> Option<&MinFinalCltvExpiry>[src]

pub fn fallbacks(&self) -> Vec<&Fallback>

Notable traits for Vec<u8, Global>

impl Write for Vec<u8, Global>
[src]

pub fn routes(&self) -> Vec<&Route>

Notable traits for Vec<u8, Global>

impl Write for Vec<u8, Global>
[src]

pub fn amount_pico_btc(&self) -> Option<u64>[src]

pub fn currency(&self) -> Currency[src]

Trait Implementations

impl Clone for SignedRawInvoice[src]

impl Debug for SignedRawInvoice[src]

impl Deref for SignedRawInvoice[src]

type Target = RawInvoice

The resulting type after dereferencing.

impl Display for SignedRawInvoice[src]

impl Eq for SignedRawInvoice[src]

impl FromStr for SignedRawInvoice[src]

use lightning_invoice::*;

let invoice = "lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\
	l2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\
	3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\
	ky03ylcqca784w";

let parsed_1 = invoice.parse::<Invoice>();

let parsed_2 = match invoice.parse::<SignedRawInvoice>() {
	Ok(signed) => match Invoice::from_signed(signed) {
		Ok(invoice) => Ok(invoice),
		Err(e) => Err(ParseOrSemanticError::SemanticError(e)),
	},
	Err(e) => Err(ParseOrSemanticError::ParseError(e)),
};

assert!(parsed_1.is_ok());
assert_eq!(parsed_1, parsed_2);

type Err = ParseError

The associated error which can be returned from parsing.

impl PartialEq<SignedRawInvoice> for SignedRawInvoice[src]

impl StructuralEq for SignedRawInvoice[src]

impl StructuralPartialEq for SignedRawInvoice[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.