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

Disallow user-provided payer_signing_pubkey #3264

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Commits on Sep 16, 2024

  1. Rename Offer::signing_pubkey to Offer::issuer_signing_pubkey

    The spec was recently changed to use offer_issuer_id instead of
    offer_node_id. LDK always used signing_pubkey to avoid confusion with a
    node_id. Rename it to issuer_signing_pubkey now as InvoiceRequest and
    Bolt12Invoice will have similarly named methods in upcoming commits.
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    df58f26 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7351270 View commit details
    Browse the repository at this point in the history
  3. Add issuer_signing_pubkey to Bolt12Invoice

    Useful for determining if the signing_pubkey is the
    issuer_signing_pubkey or is from a blinded path.
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    a466f2e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    cfe8430 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    de29295 View commit details
    Browse the repository at this point in the history
  6. Rename InvoiceRequest::payer_id

    For consistency with Offer::issuer_signing_pubkey, rename
    InvoiceRequest::payer_id to use "signing_pubkey" instead of "id".
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    dd8f744 View commit details
    Browse the repository at this point in the history
  7. Rename Refund::payer_id

    For consistency with Offer::issuer_signing_pubkey, rename
    Refund::payer_id to use "signing_pubkey" instead of "id".
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    e11025f View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    acd36a8 View commit details
    Browse the repository at this point in the history
  9. Add optional lifetime to tlv_stream macro

    Using the tlv_stream macro without a type needing a reference results in
    a compilation error because of an unused lifetime parameter. To avoid
    this, add an optional lifetime parameter to the macro. This allows for
    experimental TLVs, which will be empty initially, and TLVs of entirely
    primitive types.
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    6982edb View commit details
    Browse the repository at this point in the history
  10. Remove unneeded Eq and PartialEq derives

    TlvRecord has a few fields, but comparing only the record_bytes is
    sufficient for equality since the other fields are initialized from it.
    Remove the Eq and PartialEq derives as they compare these other fields.
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    6cf494f View commit details
    Browse the repository at this point in the history
  11. Separate bytes for experimental TLVs

    When constructing UnsignedInvoiceRequest or UnsignedBolt12Invoice, use a
    separate field for experimental TLV bytes. This allows for properly
    inserting the signature TLVs before the experimental TLVs when signing.
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    0eee6ea View commit details
    Browse the repository at this point in the history
  12. Function for iterating over Offer TLV records

    Add a utility function for iterating over Offer TLV records contained in
    any valid TLV stream bytes. Using a common function ensures th
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    44c50d6 View commit details
    Browse the repository at this point in the history
  13. Pass bytes instead of TlvStream to verify

    Passing bytes directly to InvoiceContents::verify improves readability.
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    63ce591 View commit details
    Browse the repository at this point in the history
  14. Parse experimental offer TLV records

    The BOLT12 spec defines an experimental TLV range that are allowed in
    offer messages. Allow this range when parsing an offer and include those
    bytes in any invoice requests. Also include those bytes when computing
    an OfferId and verifying that an InvoiceRequest is for a valid Offer.
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    5726c08 View commit details
    Browse the repository at this point in the history
  15. Test verification with experimental offer TLVs

    Offer metadata is generated from the offer TLVs and should included
    those in the experimental range. When verifying invoice request and
    invoice messages, these TLVs must be included. Similarly, OfferId
    construction should included these TLVs as well. Modify the BOLT12
    verification tests to cover these TLVs.
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    dd1db79 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    f0631db View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    51a7994 View commit details
    Browse the repository at this point in the history
  18. Parse experimental invreq TLV records

    The BOLT12 spec defines an experimental TLV range that are allowed in
    invoice_request messages. Allow this range when parsing an invoice
    request and include those bytes in any invoice. Also include those bytes
    when verifying that a Bolt12Invoice is for a valid InvoiceRequest.
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    49fc178 View commit details
    Browse the repository at this point in the history
  19. Test verification with experimental invreq TLVs

    Payer metadata is generated from the invreq TLVs and should included
    those in the experimental range. When verifying invoice messages, these
    TLVs must be included. Modify the BOLT12 verification tests to cover
    them.
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    cc749b8 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    ad638a5 View commit details
    Browse the repository at this point in the history
  21. Parse experimental invoice TLV records

    The BOLT12 spec defines an experimental TLV range that is allowed in
    offer and invoice_request messages. The remaining TLV-space is for
    experimental use in invoice messages. Allow this range when parsing an
    invoice and include it when signing one.
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    575433d View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    1fc4d51 View commit details
    Browse the repository at this point in the history
  23. Replace spaces with tabs

    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    7a89807 View commit details
    Browse the repository at this point in the history
  24. Disallow user-provided payer_signing_pubkey

    When creating an InvoiceRequests, users may choose to either use a
    transient signing pubkey generated by LDK or provide a static one.
    Disallow the latter as it allows users to reuse the same pubkey, which
    results in poor sender privacy.
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    ad39980 View commit details
    Browse the repository at this point in the history
  25. Remove PayerSigningPubkeyStrategy

    Now that InvoiceRequest::payer_signing_pubkey is always a derived
    pubkey, there is no longer a need for PayerSigningPubkeyStrategy.
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    cdc21f1 View commit details
    Browse the repository at this point in the history
  26. Remove NodeSigner::sign_bolt12_invoice_request

    Now that invoice requests are signed using transient keys only, remove
    the corresponding signing method from NodeSigner since it is never used.
    jkczyz committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    4baba94 View commit details
    Browse the repository at this point in the history