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§
source§impl SignedRawBolt11Invoice
impl SignedRawBolt11Invoice
sourcepub fn into_parts(self) -> (RawBolt11Invoice, [u8; 32], Bolt11InvoiceSignature)
pub fn into_parts(self) -> (RawBolt11Invoice, [u8; 32], Bolt11InvoiceSignature)
Disassembles the SignedRawBolt11Invoice
into its three parts:
- raw invoice
- hash of the raw invoice
- signature
sourcepub fn raw_invoice(&self) -> &RawBolt11Invoice
pub fn raw_invoice(&self) -> &RawBolt11Invoice
The RawBolt11Invoice
which was signed.
sourcepub fn signable_hash(&self) -> &[u8; 32]
pub fn signable_hash(&self) -> &[u8; 32]
The hash of the RawBolt11Invoice
that was signed.
sourcepub fn signature(&self) -> &Bolt11InvoiceSignature
pub fn signature(&self) -> &Bolt11InvoiceSignature
Signature for the invoice.
sourcepub fn recover_payee_pub_key(&self) -> Result<PayeePubKey, Error>
pub fn recover_payee_pub_key(&self) -> Result<PayeePubKey, Error>
Recovers the public key used for signing the invoice from the recoverable signature.
sourcepub fn check_signature(&self) -> bool
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>§
sourcepub fn signable_hash(&self) -> [u8; 32]
pub fn signable_hash(&self) -> [u8; 32]
Calculate the hash of the encoded RawBolt11Invoice
which should be signed.
sourcepub fn known_tagged_fields(
&self,
) -> FilterMap<Iter<'_, RawTaggedField>, fn(_: &RawTaggedField) -> Option<&TaggedField>>
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<&Bolt11InvoiceFeatures>
sourcepub fn fallbacks(&self) -> Vec<&Fallback>
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>
sourcepub fn amount_pico_btc(&self) -> Option<u64>
pub fn amount_pico_btc(&self) -> Option<u64>
Returns None
if no amount is set or on overflow.
pub fn currency(&self) -> Currency
Trait Implementations§
source§impl Clone for SignedRawBolt11Invoice
impl Clone for SignedRawBolt11Invoice
source§fn clone(&self) -> SignedRawBolt11Invoice
fn clone(&self) -> SignedRawBolt11Invoice
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SignedRawBolt11Invoice
impl Debug for SignedRawBolt11Invoice
source§impl Deref for SignedRawBolt11Invoice
impl Deref for SignedRawBolt11Invoice
source§type Target = RawBolt11Invoice
type Target = RawBolt11Invoice
source§fn deref(&self) -> &RawBolt11Invoice
fn deref(&self) -> &RawBolt11Invoice
source§impl Display for SignedRawBolt11Invoice
impl Display for SignedRawBolt11Invoice
source§impl FromStr for SignedRawBolt11Invoice
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);
source§impl Hash for SignedRawBolt11Invoice
impl Hash for SignedRawBolt11Invoice
source§impl Ord for SignedRawBolt11Invoice
impl Ord for SignedRawBolt11Invoice
source§fn cmp(&self, other: &SignedRawBolt11Invoice) -> Ordering
fn cmp(&self, other: &SignedRawBolt11Invoice) -> 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 SignedRawBolt11Invoice
impl PartialEq for SignedRawBolt11Invoice
source§impl PartialOrd for SignedRawBolt11Invoice
impl PartialOrd for SignedRawBolt11Invoice
impl Eq for SignedRawBolt11Invoice
impl StructuralPartialEq for SignedRawBolt11Invoice
Auto Trait Implementations§
impl Freeze for SignedRawBolt11Invoice
impl RefUnwindSafe for SignedRawBolt11Invoice
impl Send for SignedRawBolt11Invoice
impl Sync for SignedRawBolt11Invoice
impl Unpin for SignedRawBolt11Invoice
impl UnwindSafe for SignedRawBolt11Invoice
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
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)
clone_to_uninit
)