diff --git a/src/app/screens/LNURLPay/index.tsx b/src/app/screens/LNURLPay/index.tsx index 55f4be4363..70132bb3ec 100644 --- a/src/app/screens/LNURLPay/index.tsx +++ b/src/app/screens/LNURLPay/index.tsx @@ -172,9 +172,7 @@ function LNURLPay() { const isValidInvoice = lnurl.verifyInvoice({ paymentInfo, - metadata: details.metadata, amount: parseInt(valueSat) * 1000, - payerdata, }); if (!isValidInvoice) { diff --git a/src/common/lib/lnurl.ts b/src/common/lib/lnurl.ts index 489726975b..e97216c05d 100644 --- a/src/common/lib/lnurl.ts +++ b/src/common/lib/lnurl.ts @@ -1,8 +1,6 @@ import fetchAdapter from "@vespaiach/axios-fetch-adapter"; import axios from "axios"; import lightningPayReq from "bolt11"; -import Hex from "crypto-js/enc-hex"; -import sha256 from "crypto-js/sha256"; import { isLNURLDetailsError } from "~/common/utils/typeHelpers"; import { LNURLDetails, @@ -118,33 +116,13 @@ const lnurl = { verifyInvoice({ paymentInfo, - payerdata, - metadata, amount, }: { paymentInfo: LNURLPaymentInfo; - payerdata: - | undefined - | { - name?: string; - email?: string; - }; - metadata: string; amount: number; }) { const paymentRequestDetails = lightningPayReq.decode(paymentInfo.pr); - let metadataHash = ""; - try { - const dataToHash = payerdata - ? metadata + JSON.stringify(payerdata) - : metadata; - metadataHash = sha256(dataToHash).toString(Hex); - } catch (e) { - console.error(); - } switch (true) { - case paymentRequestDetails.tagsObject.purpose_commit_hash !== - metadataHash: // LN WALLET Verifies that h tag (description_hash) in provided invoice is a hash of metadata string converted to byte array in UTF-8 encoding case paymentRequestDetails.millisatoshis !== String(amount): // LN WALLET Verifies that amount in provided invoice equals an amount previously specified by user case paymentInfo.successAction && !["url", "message", "aes"].includes(paymentInfo.successAction.tag): // If successAction is not null: LN WALLET makes sure that tag value of is of supported type, aborts a payment otherwise