pub struct SignedRawBolt11Invoice { /* private fields */ }
Expand description

Represents a signed RawBolt11Invoice 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 RawBolt11Invoice.

Implementations§

§

impl SignedRawBolt11Invoice

pub fn into_parts(self) -> (RawBolt11Invoice, [u8; 32], Bolt11InvoiceSignature)

Disassembles the SignedRawBolt11Invoice into its three parts:

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

pub fn raw_invoice(&self) -> &RawBolt11Invoice

The RawBolt11Invoice which was signed.

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

The hash of the RawBolt11Invoice that was signed.

pub fn signature(&self) -> &Bolt11InvoiceSignature

Signature for the invoice.

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

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

pub fn check_signature(&self) -> bool

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 = RawBolt11Invoice>§

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

Calculate the hash of the encoded RawBolt11Invoice which should be signed.

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

Returns an iterator over all tagged fields with known semantics.

This is not exported to bindings users as there is not yet a manual mapping for a FilterMap

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

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

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

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

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

pub fn min_final_cltv_expiry_delta(&self) -> Option<&MinFinalCltvExpiryDelta>

pub fn payment_secret(&self) -> Option<&PaymentSecret>

pub fn payment_metadata(&self) -> Option<&Vec<u8>>

pub fn features(&self) -> Option<&Features<Bolt11InvoiceContext>>

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

This is not exported to bindings users as we don’t support Vec<&NonOpaqueType>

pub fn private_routes(&self) -> Vec<&PrivateRoute>

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

pub fn currency(&self) -> Currency

Trait Implementations§

§

impl Clone for SignedRawBolt11Invoice

§

fn clone(&self) -> SignedRawBolt11Invoice

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for SignedRawBolt11Invoice

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Deref for SignedRawBolt11Invoice

§

type Target = RawBolt11Invoice

The resulting type after dereferencing.
§

fn deref(&self) -> &RawBolt11Invoice

Dereferences the value.
§

impl Display for SignedRawBolt11Invoice

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl FromStr for SignedRawBolt11Invoice

use lightning_invoice::*;

let invoice = "lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\
h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\
5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\
h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\
j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\
ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\
guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\
ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\
p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\
8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\
j5r6drg6k6zcqj0fcwg";

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

let parsed_2 = match invoice.parse::<SignedRawBolt11Invoice>() {
	Ok(signed) => match Bolt11Invoice::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 = Bolt11ParseError

The associated error which can be returned from parsing.
§

fn from_str( s: &str, ) -> Result<SignedRawBolt11Invoice, <SignedRawBolt11Invoice as FromStr>::Err>

Parses a string s to return a value of this type. Read more
§

impl Hash for SignedRawBolt11Invoice

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl Ord for SignedRawBolt11Invoice

§

fn cmp(&self, other: &SignedRawBolt11Invoice) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
§

impl PartialEq for SignedRawBolt11Invoice

§

fn eq(&self, other: &SignedRawBolt11Invoice) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialOrd for SignedRawBolt11Invoice

§

fn partial_cmp(&self, other: &SignedRawBolt11Invoice) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl TryFrom<SignedRawBolt11Invoice> for Invoice

§

type Error = Status

The type returned in the event of a conversion error.
§

fn try_from( bolt11_raw: SignedRawBolt11Invoice, ) -> Result<Invoice, <Invoice as TryFrom<SignedRawBolt11Invoice>>::Error>

Performs the conversion.
§

impl Eq for SignedRawBolt11Invoice

§

impl StructuralPartialEq for SignedRawBolt11Invoice

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

§

impl<T> AsAny for T
where T: Any,

§

fn as_any(&self) -> &(dyn Any + 'static)

§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

§

fn type_name(&self) -> &'static str

Gets the type name of self
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<T> Downcast for T
where T: AsAny + ?Sized,

§

fn is<T>(&self) -> bool
where T: AsAny,

Returns true if the boxed type is the same as T. Read more
§

fn downcast_ref<T>(&self) -> Option<&T>
where T: AsAny,

Forward to the method defined on the type Any.
§

fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: AsAny,

Forward to the method defined on the type Any.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> DartSafe for T

§

impl<T> Sequence for T
where T: Eq + Hash,