fix: discover a mint's signing key from the mint-address endpoint, not the payRequest

This commit is contained in:
2026-08-20 09:54:26 +02:00
parent 3f22534cf0
commit 39261212cf
2 changed files with 21 additions and 9 deletions
+7 -2
View File
@@ -291,13 +291,18 @@ const trustSuggestion = async (address: string) => {
}
}
const info = await fetchPayRequest(payUrl);
if (!info.mintPubkey) {
// the signing key is announced on the mint-address (lnurlw discovery)
// response, not the payRequest: per the reference mint (lnurl-mint) a
// wallet paying the mint invoice recovers the node id from the invoice
// itself, so LUD-25 advertises mintPubkey on the withdraw side only
const announcedKey = nodeInfo?.nodePubkey ?? info.mintPubkey;
if (!announcedKey) {
throw new Error("This mint didn't announce its signing key - add it manually instead.");
}
const server = serverOf(payUrl);
const result = mints.trust(
server,
info.mintPubkey,
announcedKey,
mintAddressCacheInfo(nodeInfo, lightningAddressUsername(payUrl)),
);
trustResult(result, server);