-
Notifications
You must be signed in to change notification settings - Fork 405
Trivial Bindings Updates #2229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trivial Bindings Updates #2229
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,8 @@ pub(super) const IV_BYTES: &[u8; IV_LEN] = b"LDK Invreq ~~~~~"; | |
/// | ||
/// See [module-level documentation] for usage. | ||
/// | ||
/// This is not exported to bindings users as builder patterns don't map outside of move semantics. | ||
/// | ||
/// [module-level documentation]: self | ||
pub struct InvoiceRequestBuilder<'a, 'b, P: PayerIdStrategy, T: secp256k1::Signing> { | ||
offer: &'a Offer, | ||
|
@@ -94,12 +96,18 @@ pub struct InvoiceRequestBuilder<'a, 'b, P: PayerIdStrategy, T: secp256k1::Signi | |
} | ||
|
||
/// Indicates how [`InvoiceRequest::payer_id`] will be set. | ||
/// | ||
/// This is not exported to bindings users as builder patterns don't map outside of move semantics. | ||
pub trait PayerIdStrategy {} | ||
|
||
/// [`InvoiceRequest::payer_id`] will be explicitly set. | ||
/// | ||
/// This is not exported to bindings users as builder patterns don't map outside of move semantics. | ||
pub struct ExplicitPayerId {} | ||
|
||
/// [`InvoiceRequest::payer_id`] will be derived. | ||
/// | ||
/// This is not exported to bindings users as builder patterns don't map outside of move semantics. | ||
pub struct DerivedPayerId {} | ||
|
||
impl PayerIdStrategy for ExplicitPayerId {} | ||
|
@@ -340,6 +348,8 @@ pub struct UnsignedInvoiceRequest<'a> { | |
|
||
impl<'a> UnsignedInvoiceRequest<'a> { | ||
/// Signs the invoice request using the given function. | ||
/// | ||
/// This is not exported to bindings users as functions are not yet mapped. | ||
Comment on lines
+351
to
+352
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Likewise. |
||
pub fn sign<F, E>(self, sign: F) -> Result<InvoiceRequest, SignError<E>> | ||
where | ||
F: FnOnce(&Message) -> Result<Signature, E> | ||
|
@@ -465,6 +475,8 @@ impl InvoiceRequest { | |
/// See [`InvoiceRequest::respond_with_no_std`] for further details where the aforementioned | ||
/// creation time is used for the `created_at` parameter. | ||
/// | ||
/// This is not exported to bindings users as builder patterns don't map outside of move semantics. | ||
/// | ||
/// [`Duration`]: core::time::Duration | ||
#[cfg(feature = "std")] | ||
pub fn respond_with( | ||
|
@@ -493,6 +505,8 @@ impl InvoiceRequest { | |
/// | ||
/// Errors if the request contains unknown required features. | ||
/// | ||
/// This is not exported to bindings users as builder patterns don't map outside of move semantics. | ||
/// | ||
/// [`Invoice::created_at`]: crate::offers::invoice::Invoice::created_at | ||
pub fn respond_with_no_std( | ||
&self, payment_paths: Vec<(BlindedPath, BlindedPayInfo)>, payment_hash: PaymentHash, | ||
|
@@ -511,6 +525,8 @@ impl InvoiceRequest { | |
/// | ||
/// See [`InvoiceRequest::respond_with`] for further details. | ||
/// | ||
/// This is not exported to bindings users as builder patterns don't map outside of move semantics. | ||
/// | ||
/// [`Invoice`]: crate::offers::invoice::Invoice | ||
#[cfg(feature = "std")] | ||
pub fn verify_and_respond_using_derived_keys<T: secp256k1::Signing>( | ||
|
@@ -532,6 +548,8 @@ impl InvoiceRequest { | |
/// | ||
/// See [`InvoiceRequest::respond_with_no_std`] for further details. | ||
/// | ||
/// This is not exported to bindings users as builder patterns don't map outside of move semantics. | ||
/// | ||
/// [`Invoice`]: crate::offers::invoice::Invoice | ||
pub fn verify_and_respond_using_derived_keys_no_std<T: secp256k1::Signing>( | ||
&self, payment_paths: Vec<(BlindedPath, BlindedPayInfo)>, payment_hash: PaymentHash, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,6 +116,8 @@ impl<T: SeekReadable> TryFrom<Vec<u8>> for ParsedMessage<T> { | |
} | ||
|
||
/// Error when parsing a bech32 encoded message using [`str::parse`]. | ||
/// | ||
/// This is not exported to bindings users as its name conflicts with the BOLT 11 ParseError type. | ||
Comment on lines
+119
to
+120
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does not exporting this affect using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, those are not exported as a result. |
||
#[derive(Debug, PartialEq)] | ||
pub enum ParseError { | ||
/// The bech32 encoding does not conform to the BOLT 12 requirements for continuing messages | ||
|
@@ -135,6 +137,8 @@ pub enum ParseError { | |
} | ||
|
||
/// Error when interpreting a TLV stream as a specific type. | ||
/// | ||
/// This is not exported to bindings users as its name conflicts with the BOLT 11 SemanticError type. | ||
#[derive(Debug, PartialEq)] | ||
pub enum SemanticError { | ||
/// The current [`std::time::SystemTime`] is past the offer or invoice's expiration. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be on the struct? It only can be created from
InvoiceBuilder
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well once we fix the builders to work in bindings, we should also add a sign that just takes a private key?