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

Fix description of wrapped invoices don't respect privacy setting #1513

Merged
merged 1 commit into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion api/paidAction/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,10 @@ export async function createLightningInvoice (actionType, args, context) {
expiry: INVOICE_EXPIRE_SECS
}, { models })

// the sender (me) decides if the wrapped invoice has a description
// whereas the recipient decides if their invoice has a description
const { invoice: wrappedInvoice, maxFee } = await wrapInvoice(
bolt11, { msats: cost, description }, { lnd })
bolt11, { msats: cost, description }, { me, lnd })

return {
bolt11,
Expand Down
7 changes: 6 additions & 1 deletion wallets/wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const ZAP_SYBIL_FEE_MULT = 10 / 7 // the fee for the zap sybil service
maxFee: number
}
*/
export default async function wrapInvoice (bolt11, { msats, description, descriptionHash }, { lnd }) {
export default async function wrapInvoice (bolt11, { msats, description, descriptionHash }, { me, lnd }) {
try {
console.group('wrapInvoice', description)

Expand Down Expand Up @@ -112,6 +112,11 @@ export default async function wrapInvoice (bolt11, { msats, description, descrip
wrapped.description = inv.description
}

if (me?.hideInvoiceDesc) {
wrapped.description = undefined
wrapped.description_hash = undefined
}

// validate the expiration
if (new Date(inv.expires_at) < new Date(Date.now() + INCOMING_EXPIRATION_BUFFER_MSECS)) {
throw new Error('Invoice expiration is too soon')
Expand Down
Loading