Skip to content

Clarify preimage format / encoding #8

Closed
@philippgille

Description

Currently the value in the "x-preimage" header is required to be Base64, because that's the format that's used in listed invoices when executing lncli listinvoices. Not only for preimages, but also for their hashes.

But on the other hand the LightningClient's method LookupInvoice(...) expects a hex-encoded payment hash.

That's why in our package, when receiving a request with a correct x-preimage header, we need to:

  1. Base64 Decode the preimage
  2. Sha256 the previous value
  3. Hex the previous value
  4. Send it to lnd

So:

  1. Figure out which format is best for using in the header (Plain preimage, Base64 or hex)
  2. Change our implementation in case it's not Base64
  3. Document which format is expected

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions