diff options
| -rw-r--r-- | README.md | 22 |
1 files changed, 18 insertions, 4 deletions
| @@ -8,15 +8,15 @@ 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 | **Zero dependencies.** |
| 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 | Other Nostr libraries pull in 30+ dependencies. This one has none. The secp256k1 cryptography is implemented in pure Go, embedded in the library. |
| 14 | 14 | ||
| 15 | ``` | 15 | ``` |
| 16 | require github.com/btcsuite/btcd/btcec/v2 v2.3.4 | 16 | require (nothing) |
| 17 | ``` | 17 | ``` |
| 18 | 18 | ||
| 19 | No WebSocket libraries, no logging frameworks, no kitchen sink. Just the core protocol. | 19 | No external crypto libraries, no WebSocket libraries, no logging frameworks, no kitchen sink. Just the core protocol. |
| 20 | 20 | ||
| 21 | ## What's Included | 21 | ## What's Included |
| 22 | 22 | ||
| @@ -31,6 +31,20 @@ No WebSocket libraries, no logging frameworks, no kitchen sink. Just the core pr | |||
| 31 | 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. | 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 | 33 | ||
| 34 | ## Cryptography | ||
| 35 | |||
| 36 | This library uses an internal pure-Go implementation of secp256k1 and BIP-340 Schnorr signatures. | ||
| 37 | |||
| 38 | **Tradeoffs:** | ||
| 39 | |||
| 40 | - ✅ Zero dependencies, fully auditable | ||
| 41 | - ✅ Passes all BIP-340 test vectors | ||
| 42 | - ✅ Interoperable with btcec/bitcoin implementations | ||
| 43 | - ⚠️ **Not constant-time** — uses Go's `math/big`, which has variable-time operations | ||
| 44 | - ⚠️ ~10x slower than btcec (still fast enough for typical Nostr usage) | ||
| 45 | |||
| 46 | For applications signing thousands of events per second or with strict timing-attack threat models, consider a library backed by btcec or libsecp256k1. | ||
| 47 | |||
| 34 | ## Usage | 48 | ## Usage |
| 35 | 49 | ||
| 36 | ```go | 50 | ```go |
