From 805a4f5a2e1cba8106098ec5465a3188ddf6cd2d Mon Sep 17 00:00:00 2001 From: Clawd Date: Mon, 16 Feb 2026 12:15:46 -0800 Subject: README: emphasize minimal dependencies --- README.md | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 0e7c891..8ca5ebd 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,35 @@ # nostr -A Go library for the [Nostr protocol](https://github.com/nostr-protocol/nostr). +A minimal Go library for the [Nostr protocol](https://github.com/nostr-protocol/nostr). ```bash go get code.northwest.io/nostr ``` -## Features +## Why This Library? -- **Keys** — Generate, parse, and convert between hex/bech32 (npub/nsec) -- **Events** — Create, sign, and verify NIP-01 events -- **Filters** — Build subscription filters -- **Relay** — WebSocket connections with publish/subscribe +**1 dependency.** That's it. + +Other Nostr libraries pull in 30+ dependencies. This one has exactly one direct dependency: `btcec` for Schnorr signatures (required by the protocol). + +``` +require github.com/btcsuite/btcd/btcec/v2 v2.3.4 +``` + +No WebSocket libraries, no logging frameworks, no kitchen sink. Just the core protocol. + +## What's Included + +- **Keys** — Generate, parse, sign, verify (hex and bech32/npub/nsec) +- **Events** — Create, serialize, sign NIP-01 events +- **Filters** — Build and match subscription filters +- **Relay** — WebSocket pub/sub (stdlib `net/http` only) - **Tags** — Parse and build event tags +- **Envelopes** — Protocol message parsing + +## What's Not Included + +This is a minimal core library. It implements NIP-01 and the basics. It doesn't implement every NIP, handle connection pooling, or manage relay discovery. Build that yourself, or don't. ## Usage @@ -26,7 +43,7 @@ import ( ) func main() { - // Generate a new key pair + // Generate a key pair key, _ := nostr.GenerateKey() fmt.Println("npub:", key.Npub()) @@ -37,22 +54,18 @@ func main() { } event.Sign(key) - // Connect to a relay and publish + // Connect and publish ctx := context.Background() relay, _ := nostr.Connect(ctx, "wss://relay.damus.io") defer relay.Close() - + relay.Publish(ctx, event) } ``` ## Examples -See [examples/basic](examples/basic) for a complete runnable example. - -## Benchmarks - -Performance benchmarks are in [benchmarks/](benchmarks/). +See [examples/basic](examples/basic) for a runnable example. ## License -- cgit v1.2.3