-
Notifications
You must be signed in to change notification settings - Fork 339
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
Support signing BOLT 12 messages in NodeSigner
#2432
Support signing BOLT 12 messages in NodeSigner
#2432
Commits on Jul 28, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 9c708df - Browse repository at this point
Copy the full SHA 9c708dfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4bb4a97 - Browse repository at this point
Copy the full SHA 4bb4a97View commit details
Commits on Aug 22, 2023
-
TaggedHash for BOLT 12 signing function
The function used to sign BOLT 12 messages only takes a message digest. This doesn't allow signers to independently verify the message before signing nor does it allow them to derive the necessary signing keys, if needed. Introduce a TaggedHash wrapper for a message digest, which each unsigned BOLT 12 message type constructs upon initialization. Change the signing function to take AsRef<TaggedHash>, which each unsigned type implements. This allows the signing function to take any unsigned message and obtain its tagged hash.
Configuration menu - View commit details
-
Copy full SHA for 1811ebf - Browse repository at this point
Copy the full SHA 1811ebfView commit details -
Wrap KeyPair by DerivedSigningPubkey
InvoiceBuilder is parameterized by a SigningPubkeyStrategy, either ExplicitSigningPubkey and DerivedSigningPubkey. It also holds an Option<KeyPair>, which may be None and Some for those strategies, respectively. This leads to methods for InvoiceBuilder parameterized by DerivedSigningPubkey needing to blindly unwrap the Option<KeyPair>. Instead, have DerivedSigningPubkey wrap KeyPair.
Configuration menu - View commit details
-
Copy full SHA for 239f22c - Browse repository at this point
Copy the full SHA 239f22cView commit details -
Rename field of unsigned BOLT message contents
Using `contents` for the field name is more consistent with the signed messages.
Configuration menu - View commit details
-
Copy full SHA for 889848d - Browse repository at this point
Copy the full SHA 889848dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 230f081 - Browse repository at this point
Copy the full SHA 230f081View commit details -
Configuration menu - View commit details
-
Copy full SHA for 270bc2e - Browse repository at this point
Copy the full SHA 270bc2eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 85c471a - Browse repository at this point
Copy the full SHA 85c471aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 68d4717 - Browse repository at this point
Copy the full SHA 68d4717View commit details -
Macro-ize Offer accessors for reuse
InvoiceRequest wraps OfferContents, which shouldn't be exposed as it is an implementation detail. Define a macro for Offer accessor methods so that InvoiceRequest and UnsignedInvoiceRequest can also define them.
Configuration menu - View commit details
-
Copy full SHA for 66060ca - Browse repository at this point
Copy the full SHA 66060caView commit details -
Macro-ize InvoiceRequest accessors for reuse
Various messages wrap InvoiceRequestContents, which shouldn't be exposed as it is an implementation detail. Define a macro for InvoiceRequest accessor methods so that these messages can also define them.
Configuration menu - View commit details
-
Copy full SHA for 9d02d06 - Browse repository at this point
Copy the full SHA 9d02d06View commit details -
Expose Offer accessor functions in InvoiceRequest
Also, expose both Offer and InvoiceRequest functions in UnsignedInvoiceRequest.
Configuration menu - View commit details
-
Copy full SHA for bde9823 - Browse repository at this point
Copy the full SHA bde9823View commit details -
Configuration menu - View commit details
-
Copy full SHA for 57e62da - Browse repository at this point
Copy the full SHA 57e62daView commit details -
Expose Offer/InvoiceRequest methods in Invoice
Bolt12Invoice can either be for an Offer (via an InvoiceRequest) or a Refund. It wraps those types, so expose their methods on both Bolt12Invoice and UnsignedBolt12Invoice. Since Refund does not have all the Offer/InvoiceRequest methods, use an Option return type such that None can returned for refund-based invoices. For methods that are duplicated between Offer/InvoiceRequest and Bolt12Invoice, prefer the (non-Option, if applicable) method from Bolt12Invoice (e.g., amount_msats, signing_pubkey).
Configuration menu - View commit details
-
Copy full SHA for 7f641da - Browse repository at this point
Copy the full SHA 7f641daView commit details -
Use TaggedHash in merkle::verify_signature
An earlier commit introduced TaggedHash for use in sign_message. For consistency, use it in verify_signature, too.
Configuration menu - View commit details
-
Copy full SHA for 63d0d55 - Browse repository at this point
Copy the full SHA 63d0d55View commit details -
Support signing BOLT 12 invoices in NodeSigner
BOLT 12 messages need to be signed in the following scenarios: - constructing an InvoiceRequest after scanning an Offer, - constructing an Invoice after scanning a Refund, and - constructing an Invoice when handling an InvoiceRequest. Extend the NodeSigner trait to support signing BOLT 12 invoices such that it can be used in the latter contexts. The method could be used in an OffersMessageHandler.
Configuration menu - View commit details
-
Copy full SHA for 39012e3 - Browse repository at this point
Copy the full SHA 39012e3View commit details