Webln

From claude-dev-suite/claude-dev-suite · View interactive version

Webln is an AI agent skill from the GitHub repository claude-dev-suite/claude-dev-suite. WebLN: browser API for Lightning. window.webln exposed by wallet extensions / mobile webviews. Methods: enable, getInfo, sendPayment, makeInvoice, signMessage. Bitcoin Connect (modern wrapper). USE WHEN: building web apps with Lightning payments, integrating with Alby/getalby, designing WebLN-compat

How to use this skill

Skill file

WebLN

WebLN is a JavaScript API that lets web pages interact with the

user's Lightning wallet via a browser extension or in-page provider.

Spec: <https://www.webln.guide/>

Detection

if (typeof window.webln !== "undefined") {
    await window.webln.enable();
    // Now you can call other methods
}

enable() triggers a permission prompt the first time on a new

domain.

Methods

`getInfo()`

const info = await window.webln.getInfo();
// { node: { alias, pubkey, color }, methods: [...] }

Returns wallet info; methods lists supported operations.

`sendPayment(invoice)`

const r = await window.webln.sendPayment("lnbc100u...");
// { preimage: "abcd..." }

Invokes wallet UI to confirm payment. Returns preimage on success.

`makeInvoice(args)`

const r = await window.webln.makeInvoice({
    amount: 1000,    // sats
    defaultMemo: "Coffee"
});
// { paymentRequest: "lnbc1u..." }

User confirms amount; wallet generates invoice.

`signMessage(message)`

const r = await window.webln.signMessage("Hello");
// { signature: "...", message: "Hello" }

Signs with the wallet's node key (BIP137-style). Used for auth.

`verifyMessage(signature, message)`

Verify a signature against the wallet's node pubkey.

`keysend(args)` (some impls)

await window.webln.keysend({
    destination: "<pubkey>",
    amount: 100,
    customRecords: { "1234": "abc" }
});

Providers

| Provider | Type |

|----------|------|

| Alby Browser Extension | Most popular, supports custodial + connect-to-node |

| getalby.com hosted | Web-based, login provides webln |

| Joule | Older, less maintained |

| Mutiny Wallet | Web-based, exposes webln in its iframe |

| Custom (e.g., businesses) | Backend-API-backed window.webln shim |

Bitcoin Connect

A wrapper library that handles WebLN + LNURL + NWC fallbacks:

<script src="https://cdn.jsdelivr.net/npm/@getalby/bitcoin-connect/dist/index.js"></script>
<bc-button label="Connect Wallet"></bc-button>
<script>
window.bitcoinConnect.onConnected(() => {
  window.webln.sendPayment(invoice);
});
</script>

Auto-detects:

Permissions model

Per-domain. User explicitly approves:

rules).

makeInvoice typically silent (no permission needed; it's just

generating a receive-side invoice).

Use cases

→ unlock content).

Common bugs

reject.

makeInvoice's amount, but invoices internally are msat.

WebLN via shim that fails on actual call.

See also

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.