# Nostr Chat Widget A lightweight, client‑only Nostr chat widget that can be dropped into any website. The widget is built using **nostr-tools** and **Tailwind CSS** for styling. --- ## 🚀 Quick Start ```bash # clone and open the demo page git clone https://github.com/yourusername/nostr-web-chat-plugin.git cd nostr-web-chat-plugin open demo/index.html # use your preferred browser ``` Once the demo page is open you can immediately play with the widget: 1. **Add the public key** – see *Configuring the Public Key* section below. 2. Hit the orange button in the bottom‑right corner and start chatting! --- ## 🔑 Configuring the Public Key (npub) on the Demo Page We added an easy‑to‑use input bar at the top‑center of the demo page that lets you quickly test the widget with any Nostr npub. The JS code reads the key from **localStorage** under the key `cs_pubkey`. When you set a new npub it temporarily overwrites the hard‑coded `csPubkey` value in `src/chat.js`. This makes testing live chats a breeze without touching the source. ### How It Works 1. **Add the input bar** – The demo page already contains a small form (see `demo/index.html`). 2. **Enter an npub** – Click *Set Npub* to store the value in localStorage. 3. **Reload the page** – The widget automatically loads the new key from localStorage and uses it for all DM interactions. 4. **Clear** – Delete `cs_pubkey` from localStorage or set it back to the original value to revert. Below is a quick snippet of the relevant part of `demo/index.html` for reference: ```html