Skip to content

shocknet/clink-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLINK Demo Client

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):

  1. Lightning-address discovery – map an user@domain NIP-05 identifier to a clink_offer string.
  2. Offers (noffer) – ask a remote node for a fresh BOLT-11 invoice over Nostr.
  3. 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.


Running locally

# in the clink-demo directory
npm install      # first time only
npm start        # opens http://localhost:8787

Build a static bundle:

npm run build    # output in dist/

How to use

1. Address checker

• 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.

2. Generate an invoice from an Offer

• Still on index.html, paste a noffer string (or use the default).
• Click Decode OfferGet 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.

3. Pay an invoice with a Debit

• 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.


Project layout

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

Contributing

PRs and issues welcome. Protocol discussions live in the main CLINK repository.


License

MIT

Links

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Contributors 3

  •  
  •  
  •