A minimal web demo built with the @shocknet/clink-sdk.
It showcases the three core interactions defined by CLINK (Common Lightning Interface for Nostr Keys):
- Lightning-address discovery – map an
user@domainNIP-05 identifier to aclink_offerstring. - Offers (
noffer) – ask a remote node for a fresh BOLT-11 invoice over Nostr. - Debits (
ndebit) – authorise a remote node to pay a BOLT-11 invoice from your wallet.
Everything flows through Nostr – no HTTP callbacks, WebSockets or Tor-like onion-messages are required.
# in the clink-demo directory
npm install # first time only
npm start # opens http://localhost:8787Build a static bundle:
npm run build # output in dist/• Open the page (it defaults to index.html).
• Enter a Lightning Address like [email protected].
• Click Check Address.
The demo fetches https://example.com/.well-known/nostr.json?name=bob and reports whether it contains a clink_offer entry.
• Still on index.html, paste a noffer string (or use the default).
• Click Decode Offer → Get Invoice.
The SDK signs and sends a noffer_request event with an ephemeral key cached in localStorage. Once the provider replies the BOLT-11 is displayed and rendered as a QR code.
• Navigate to debit.html.
• Paste an ndebit string (generated by a CLINK-capable wallet like ShockWallet).
• Paste a BOLT-11 to be paid.
• Click Pay Invoice.
The SDK builds an ndebit_payment_request event, signs it, and waits for the provider's reply.
clink-demo
│
├── src/ # TypeScript, HTML & CSS sources
│ ├── index.ts # Address checker + Offer flow
│ ├── debit.ts # Debit flow
│ ├── utils.ts # localStorage-backed client key helper
│ └── styles.css
├── dist/ # Compiled output (to verify demo)
├── webpack.config.js # Build pipeline
└── tsconfig.json
PRs and issues welcome. Protocol discussions live in the main CLINK repository.
MIT