diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 27 |
1 files changed, 15 insertions, 12 deletions
| @@ -1,6 +1,6 @@ | |||
| 1 | # nostr | 1 | # nostr |
| 2 | 2 | ||
| 3 | A minimal Go library for the [Nostr protocol](https://github.com/nostr-protocol/nostr). | 3 | A zero-dependency Go library for the [Nostr protocol](https://github.com/nostr-protocol/nostr). |
| 4 | 4 | ||
| 5 | ```bash | 5 | ```bash |
| 6 | go get code.northwest.io/nostr | 6 | go get code.northwest.io/nostr |
| @@ -8,29 +8,32 @@ go get code.northwest.io/nostr | |||
| 8 | 8 | ||
| 9 | ## Why This Library? | 9 | ## Why This Library? |
| 10 | 10 | ||
| 11 | **1 dependency.** That's it. | 11 | You probably shouldn't use it. |
| 12 | 12 | ||
| 13 | Other Nostr libraries pull in 30+ dependencies. This one has exactly one direct dependency: `btcec` for Schnorr signatures (required by the protocol). | 13 | This library rolls its own secp256k1 cryptography in pure Go. No CGO, no external dependencies, no nothing. I built it to see if it was possible to implement Nostr with truly zero dependencies. It is. But that doesn't mean it's a good idea. |
| 14 | 14 | ||
| 15 | ``` | 15 | **What you get:** |
| 16 | require github.com/btcsuite/btcd/btcec/v2 v2.3.4 | 16 | - Zero external dependencies |
| 17 | ``` | 17 | - Fully auditable pure-Go crypto |
| 18 | - Passes all BIP-340 test vectors | ||
| 19 | - Works fine for normal Nostr usage | ||
| 20 | |||
| 21 | **What you're giving up:** | ||
| 22 | - Constant-time operations (timing attacks are theoretically possible) | ||
| 23 | - Performance (~10x slower than btcec) | ||
| 24 | - Battle-tested crypto code | ||
| 18 | 25 | ||
| 19 | No WebSocket libraries, no logging frameworks, no kitchen sink. Just the core protocol. | 26 | If you're building something serious, use a library backed by btcec. If you're hacking on a side project or just want to read the code, welcome. |
| 20 | 27 | ||
| 21 | ## What's Included | 28 | ## What's Included |
| 22 | 29 | ||
| 23 | - **Keys** — Generate, parse, sign, verify (hex and bech32/npub/nsec) | 30 | - **Keys** — Generate, parse, sign, verify (hex and bech32/npub/nsec) |
| 24 | - **Events** — Create, serialize, sign NIP-01 events | 31 | - **Events** — Create, serialize, sign NIP-01 events |
| 25 | - **Filters** — Build and match subscription filters | 32 | - **Filters** — Build and match subscription filters |
| 26 | - **Relay** — WebSocket pub/sub (stdlib `net/http` only) | 33 | - **Relay** — WebSocket pub/sub (stdlib only) |
| 27 | - **Tags** — Parse and build event tags | 34 | - **Tags** — Parse and build event tags |
| 28 | - **Envelopes** — Protocol message parsing | 35 | - **Envelopes** — Protocol message parsing |
| 29 | 36 | ||
| 30 | ## What's Not Included | ||
| 31 | |||
| 32 | 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. | ||
| 33 | |||
| 34 | ## Usage | 37 | ## Usage |
| 35 | 38 | ||
| 36 | ```go | 39 | ```go |
