Skip to content
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

Merged

Commits on Jul 28, 2023

  1. Configuration menu
    Copy the full SHA
    9c708df View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4bb4a97 View commit details
    Browse the repository at this point in the history

Commits on Aug 22, 2023

  1. 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.
    jkczyz committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    1811ebf View commit details
    Browse the repository at this point in the history
  2. 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.
    jkczyz committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    239f22c View commit details
    Browse the repository at this point in the history
  3. Rename field of unsigned BOLT message contents

    Using `contents` for the field name is more consistent with the signed
    messages.
    jkczyz committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    889848d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    230f081 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    270bc2e View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    85c471a View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    68d4717 View commit details
    Browse the repository at this point in the history
  8. 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.
    jkczyz committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    66060ca View commit details
    Browse the repository at this point in the history
  9. 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.
    jkczyz committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    9d02d06 View commit details
    Browse the repository at this point in the history
  10. Expose Offer accessor functions in InvoiceRequest

    Also, expose both Offer and InvoiceRequest functions in
    UnsignedInvoiceRequest.
    jkczyz committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    bde9823 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    57e62da View commit details
    Browse the repository at this point in the history
  12. 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).
    jkczyz committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    7f641da View commit details
    Browse the repository at this point in the history
  13. Use TaggedHash in merkle::verify_signature

    An earlier commit introduced TaggedHash for use in sign_message. For
    consistency, use it in verify_signature, too.
    jkczyz committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    63d0d55 View commit details
    Browse the repository at this point in the history
  14. 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.
    jkczyz committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    39012e3 View commit details
    Browse the repository at this point in the history